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="" 794c9b53e3Smalcaudio_card_list="ac97 es1370 sb16" 804c9b53e3Smalcaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus" 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="" 95ac0df51dSaliguori 96ac0df51dSaliguori# parse CC options first 97ac0df51dSaliguorifor opt do 98ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 99ac0df51dSaliguori case "$opt" in 100ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 101ac0df51dSaliguori ;; 102ac0df51dSaliguori --cc=*) cc="$optarg" 103ac0df51dSaliguori ;; 1042ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 1052ff6b91eSJuan Quintela ;; 106a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 107e2a2ed06SJuan Quintela ;; 108e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 109e2a2ed06SJuan Quintela ;; 11050e7b1a0SJuan Quintela --sparc_cpu=*) 11150e7b1a0SJuan Quintela sparc_cpu="$optarg" 11250e7b1a0SJuan Quintela case $sparc_cpu in 113ed968ff1SJuan Quintela v7|v8|v8plus|v8plusa) 11450e7b1a0SJuan Quintela cpu="sparc" 11550e7b1a0SJuan Quintela ;; 11650e7b1a0SJuan Quintela v9) 11750e7b1a0SJuan Quintela cpu="sparc64" 11850e7b1a0SJuan Quintela ;; 11950e7b1a0SJuan Quintela *) 12050e7b1a0SJuan Quintela echo "undefined SPARC architecture. Exiting"; 12150e7b1a0SJuan Quintela exit 1 12250e7b1a0SJuan Quintela ;; 12350e7b1a0SJuan Quintela esac 12450e7b1a0SJuan Quintela ;; 125ac0df51dSaliguori esac 126ac0df51dSaliguoridone 127ac0df51dSaliguori# OS specific 128ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 129ac0df51dSaliguori# we can eliminate it's usage altogether 130ac0df51dSaliguori 131ac0df51dSaliguoricc="${cross_prefix}${cc}" 132ac0df51dSaliguoriar="${cross_prefix}${ar}" 1337aa486feSAnthony Liguoriobjcopy="${cross_prefix}${objcopy}" 1347aa486feSAnthony Liguorild="${cross_prefix}${ld}" 13552ba784dSHollis Blanchardstrip="${cross_prefix}${strip}" 1369fe6de94SBlue Swirlwindres="${cross_prefix}${windres}" 137ac0df51dSaliguori 138be17dc90SMichael S. Tsirkin# default flags for all hosts 139be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 140be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS" 141be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 142be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 143be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 14484958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 145be17dc90SMichael S. TsirkinQEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS" 146be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS" 147be17dc90SMichael S. Tsirkin 148a21493e0SBlue Swirlgcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 149a21493e0SBlue Swirlgcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 1500b65b9e1SBlue Swirlgcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 151a21493e0SBlue Swirlgcc_flags="-fstack-protector-all $gcc_flags" 152be17dc90SMichael S. Tsirkincat > $TMPC << EOF 153aa527b65SAurelien Jarnoint main(void) { return 0; } 154be17dc90SMichael S. TsirkinEOF 155be17dc90SMichael S. Tsirkinfor flag in $gcc_flags; do 156aa527b65SAurelien Jarno if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then 1571e027be7SMarkus Armbruster QEMU_CFLAGS="$QEMU_CFLAGS $flag" 158be17dc90SMichael S. Tsirkin fi 159be17dc90SMichael S. Tsirkindone 160be17dc90SMichael S. Tsirkin 161ac0df51dSaliguori# check that the C compiler works. 162ac0df51dSaliguoricat > $TMPC <<EOF 163ac0df51dSaliguoriint main(void) {} 164ac0df51dSaliguoriEOF 165ac0df51dSaliguori 16652166aa0SJuan Quintelaif compile_object ; then 167ac0df51dSaliguori : C compiler works ok 168ac0df51dSaliguorielse 169ac0df51dSaliguori echo "ERROR: \"$cc\" either does not exist or does not work" 170ac0df51dSaliguori exit 1 171ac0df51dSaliguorifi 172ac0df51dSaliguori 173ac0df51dSaliguoricheck_define() { 174ac0df51dSaliguoricat > $TMPC <<EOF 175ac0df51dSaliguori#if !defined($1) 176ac0df51dSaliguori#error Not defined 177ac0df51dSaliguori#endif 178ac0df51dSaliguoriint main(void) { return 0; } 179ac0df51dSaliguoriEOF 18052166aa0SJuan Quintela compile_object 181ac0df51dSaliguori} 182ac0df51dSaliguori 1832ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 1842ff6b91eSJuan Quintela # command line argument 1852ff6b91eSJuan Quintela : 1862ff6b91eSJuan Quintelaelif check_define __i386__ ; then 187ac0df51dSaliguori cpu="i386" 188ac0df51dSaliguorielif check_define __x86_64__ ; then 189ac0df51dSaliguori cpu="x86_64" 1903aa9bd6cSblueswir1elif check_define __sparc__ ; then 1913aa9bd6cSblueswir1 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA 1923aa9bd6cSblueswir1 # They must be specified using --sparc_cpu 1933aa9bd6cSblueswir1 if check_define __arch64__ ; then 1943aa9bd6cSblueswir1 cpu="sparc64" 1953aa9bd6cSblueswir1 else 1963aa9bd6cSblueswir1 cpu="sparc" 1973aa9bd6cSblueswir1 fi 198fdf7ed96Smalcelif check_define _ARCH_PPC ; then 199fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 200fdf7ed96Smalc cpu="ppc64" 201ac0df51dSaliguori else 202fdf7ed96Smalc cpu="ppc" 203fdf7ed96Smalc fi 204afa05235SAurelien Jarnoelif check_define __mips__ ; then 205afa05235SAurelien Jarno cpu="mips" 206477ba620SAurelien Jarnoelif check_define __ia64__ ; then 207477ba620SAurelien Jarno cpu="ia64" 208d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 209d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 210d66ed0eaSAurelien Jarno cpu="s390x" 211d66ed0eaSAurelien Jarno else 212d66ed0eaSAurelien Jarno cpu="s390" 213d66ed0eaSAurelien Jarno fi 214fdf7ed96Smalcelse 215fdf7ed96Smalc cpu=`uname -m` 216ac0df51dSaliguorifi 217ac0df51dSaliguori 2185327cf48Sbellardtarget_list="" 2197d13299dSbellardcase "$cpu" in 220afa05235SAurelien Jarno alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64) 221ea8f20f8SJuan Quintela cpu="$cpu" 222ea8f20f8SJuan Quintela ;; 2237d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 22497a847bcSbellard cpu="i386" 2257d13299dSbellard ;; 226aaa5fa14Saurel32 x86_64|amd64) 227aaa5fa14Saurel32 cpu="x86_64" 228aaa5fa14Saurel32 ;; 229ba68055eSbellard armv*b) 230808c4954Sbellard cpu="armv4b" 231808c4954Sbellard ;; 232ba68055eSbellard armv*l) 2337d13299dSbellard cpu="armv4l" 2347d13299dSbellard ;; 235f54b3f92Saurel32 parisc|parisc64) 236f54b3f92Saurel32 cpu="hppa" 237f54b3f92Saurel32 ;; 238afa05235SAurelien Jarno mips*) 239afa05235SAurelien Jarno cpu="mips" 240afa05235SAurelien Jarno ;; 24124e804ecSAlexander Graf s390) 242fb3e5849Sbellard cpu="s390" 243fb3e5849Sbellard ;; 24424e804ecSAlexander Graf s390x) 24524e804ecSAlexander Graf cpu="s390x" 24624e804ecSAlexander Graf ;; 2473142255cSblueswir1 sparc|sun4[cdmuv]) 248ae228531Sbellard cpu="sparc" 249ae228531Sbellard ;; 2507d13299dSbellard *) 251a447d4dcSPaolo Bonzini echo "Unsupported CPU = $cpu" 252a447d4dcSPaolo Bonzini exit 1 2537d13299dSbellard ;; 2547d13299dSbellardesac 255e2d52ad3SJuan Quintela 2563a3fb96dSStefan Weil# Default value for a variable defining feature "foo". 2573a3fb96dSStefan Weil# * foo="no" feature will only be used if --enable-foo arg is given 2583a3fb96dSStefan Weil# * foo="" feature will be searched for, and if found, will be used 2593a3fb96dSStefan Weil# unless --disable-foo is given 2603a3fb96dSStefan Weil# * foo="yes" this value will only be set by --enable-foo flag. 2613a3fb96dSStefan Weil# feature will searched for, 2623a3fb96dSStefan Weil# if not found, configure exits with error 263e2d52ad3SJuan Quintela# 2643a3fb96dSStefan Weil# Always add --enable-foo and --disable-foo command line args. 2653a3fb96dSStefan Weil# Distributions want to ensure that several features are compiled in, and it 2663a3fb96dSStefan Weil# is impossible without a --enable-foo that exits if a feature is not found. 267e2d52ad3SJuan Quintela 268a20a6f46SJuan Quintelabluez="" 2694ffcedb6SJuan Quintelabrlapi="" 270788c8196SJuan Quintelacurl="" 271c584a6d0SJuan Quintelacurses="" 272a25dba17SJuan Quinteladocs="" 2732df87df7SJuan Quintelafdt="" 274b31a0277SJuan Quintelakvm="" 275dae5079aSJan Kiszkakvm_para="" 276b0a47e79SJuan Quintelanptl="" 277c4198157SJuan Quintelasdl="" 278dfffc653SJuan Quintelasparse="no" 279ee682d27SStefan Weiluuid="" 280dfb278bdSJuan Quintelavde="" 2811be10ad2SJuan Quintelavnc_tls="" 282ea784e3bSJuan Quintelavnc_sasl="" 2832f6f5c7aSCorentin Charyvnc_jpeg="" 284efe556adSCorentin Charyvnc_png="" 28596763cf9SCorentin Charyvnc_thread="no" 286fc321b4bSJuan Quintelaxen="" 2875c6c3a6cSChristoph Hellwiglinux_aio="" 288758e8e38SVenkateswararao Jujjuri (JV)attr="" 289d5970055SMichael S. Tsirkinvhost_net="" 290dfb278bdSJuan Quintela 2917d13299dSbellardgprof="no" 292f8393946Saurel32debug_tcg="no" 293b4475aa2SLuiz Capitulinodebug_mon="no" 294f3d08ee6SPaul Brookdebug="no" 2951625af87Saliguoristrip_opt="yes" 2967d13299dSbellardbigendian="no" 29767b915a5Sbellardmingw32="no" 29867b915a5SbellardEXESUF="" 299683035deSPaolo Bonziniprefix="/usr/local" 300683035deSPaolo Bonzinimandir="\${prefix}/share/man" 301683035deSPaolo Bonzinidatadir="\${prefix}/share/qemu" 302683035deSPaolo Bonzinidocdir="\${prefix}/share/doc/qemu" 303683035deSPaolo Bonzinibindir="\${prefix}/bin" 304683035deSPaolo Bonzinisysconfdir="\${prefix}/etc" 305683035deSPaolo Bonziniconfsuffix="/qemu" 306443f1376Sbellardslirp="yes" 307102a52e4Sbellardfmod_lib="" 308102a52e4Sbellardfmod_inc="" 3092f6a1ab0Sblueswir1oss_lib="" 310b1a550a0Spbrookbsd="no" 3115327cf48Sbellardlinux="no" 312d2c7c9b8Sblueswir1solaris="no" 31305c2a3e7Sbellardprofiler="no" 3145b0753e0Sbellardcocoa="no" 3150a8e90f4Spbrooksoftmmu="yes" 316831b7825Sthslinux_user="no" 317831b7825Sthsdarwin_user="no" 31884778508Sblueswir1bsd_user="no" 319379f6698SPaul Brookguest_base="" 320c5937220Spbrookuname_release="" 321e5d355d1Saliguoriio_thread="no" 3228ff9cbf7Smalcmixemu="no" 323eac30262Saliguorikerneldir="" 324b29fe3edSmalcaix="no" 325179cf400SAndreas Färberhaiku="no" 32677755340Sthsblobs="yes" 3274a19f1ecSpbrookpkgversion="" 3285495ed11SLuiz Capitulinocheck_utests="no" 32934005a00SKirill A. Shutemovuser_pie="no" 33020ff6c80SAnthony Liguorizero_malloc="" 33194a420b1SStefan Hajnoczitrace_backend="nop" 3329410b56cSPrerna Saxenatrace_file="trace" 333cd4ec0b4SGerd Hoffmannspice="" 3347d13299dSbellard 3357d13299dSbellard# OS specific 336ac0df51dSaliguoriif check_define __linux__ ; then 337ac0df51dSaliguori targetos="Linux" 338ac0df51dSaliguorielif check_define _WIN32 ; then 339ac0df51dSaliguori targetos='MINGW32' 340169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then 341169dc5d3Sblueswir1 targetos='OpenBSD' 342169dc5d3Sblueswir1elif check_define __sun__ ; then 343169dc5d3Sblueswir1 targetos='SunOS' 344179cf400SAndreas Färberelif check_define __HAIKU__ ; then 345179cf400SAndreas Färber targetos='Haiku' 346ac0df51dSaliguorielse 3477d13299dSbellard targetos=`uname -s` 348ac0df51dSaliguorifi 3490dbfc675SJuan Quintela 3507d13299dSbellardcase $targetos in 351c326e0afSbellardCYGWIN*) 352c326e0afSbellard mingw32="yes" 353a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 354d5631638Smalc audio_possible_drivers="winwave sdl" 355d5631638Smalc audio_drv_list="winwave" 356c326e0afSbellard;; 35767b915a5SbellardMINGW32*) 35867b915a5Sbellard mingw32="yes" 359d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 360d5631638Smalc audio_drv_list="winwave" 36167b915a5Sbellard;; 3625c40d2bdSthsGNU/kFreeBSD) 363a167ba50SAurelien Jarno bsd="yes" 3640c58ac1cSmalc audio_drv_list="oss" 365f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 3665c40d2bdSths;; 3677d3505c5SbellardFreeBSD) 3687d3505c5Sbellard bsd="yes" 369a167ba50SAurelien Jarno make="gmake" 3700c58ac1cSmalc audio_drv_list="oss" 371f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 372f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 373f01576f1SJuergen Lock LIBS="-lutil $LIBS" 3747d3505c5Sbellard;; 375c5e97233Sblueswir1DragonFly) 376c5e97233Sblueswir1 bsd="yes" 377a167ba50SAurelien Jarno make="gmake" 378c5e97233Sblueswir1 audio_drv_list="oss" 379c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 380c5e97233Sblueswir1;; 3817d3505c5SbellardNetBSD) 3827d3505c5Sbellard bsd="yes" 383a167ba50SAurelien Jarno make="gmake" 3840c58ac1cSmalc audio_drv_list="oss" 385c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3868ef92a88Sblueswir1 oss_lib="-lossaudio" 3877d3505c5Sbellard;; 3887d3505c5SbellardOpenBSD) 3897d3505c5Sbellard bsd="yes" 390a167ba50SAurelien Jarno make="gmake" 3910c58ac1cSmalc audio_drv_list="oss" 392c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3932f6a1ab0Sblueswir1 oss_lib="-lossaudio" 3947d3505c5Sbellard;; 39583fb7adfSbellardDarwin) 39683fb7adfSbellard bsd="yes" 39783fb7adfSbellard darwin="yes" 3980dbfc675SJuan Quintela # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can 3990dbfc675SJuan Quintela # run 64-bit userspace code 400aab8588aSmalc if [ "$cpu" = "i386" ] ; then 4011b0f9cc2Saliguori is_x86_64=`sysctl -n hw.optional.x86_64` 402aab8588aSmalc [ "$is_x86_64" = "1" ] && cpu=x86_64 4031b0f9cc2Saliguori fi 4041b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 405a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 4060c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 4071b0f9cc2Saliguori else 408a558ee17SJuan Quintela QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" 4091b0f9cc2Saliguori fi 410831b7825Sths darwin_user="yes" 411fd677642Sths cocoa="yes" 4120c58ac1cSmalc audio_drv_list="coreaudio" 413c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 4140c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 4157973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 41683fb7adfSbellard;; 417ec530c81SbellardSunOS) 418ec530c81Sbellard solaris="yes" 419c2b84fabSths make="gmake" 420c2b84fabSths install="ginstall" 421fa58948dSBlue Swirl ld="gld" 4220475a5caSths needs_libsunmath="no" 423c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 424ef18c883Sths # have to select again, because `uname -m` returns i86pc 425ef18c883Sths # even on an x86_64 box. 426ef18c883Sths solariscpu=`isainfo -k` 427ef18c883Sths if test "${solariscpu}" = "amd64" ; then 428ef18c883Sths cpu="x86_64" 429ef18c883Sths fi 430c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 4310475a5caSths if test "$solarisrev" -le 9 ; then 4320475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 4330475a5caSths needs_libsunmath="yes" 434f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 435f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 436f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 4370475a5caSths else 4380475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 4390475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 4400475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 4410475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 4420475a5caSths exit 1 4430475a5caSths fi 4440475a5caSths fi 44586b2bd93Sths fi 4466b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 4470c58ac1cSmalc audio_drv_list="oss" 4486b4d2ba1Sths fi 449c2de5c91Smalc audio_possible_drivers="oss sdl" 450d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 451d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 452d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 453d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 454a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 455e174c0bbSJuan Quintela LIBS="-lsocket -lnsl -lresolv $LIBS" 456ec530c81Sbellard;; 457b29fe3edSmalcAIX) 458b29fe3edSmalc aix="yes" 459b29fe3edSmalc make="gmake" 460b29fe3edSmalc;; 461179cf400SAndreas FärberHaiku) 462179cf400SAndreas Färber haiku="yes" 463179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 464179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 465179cf400SAndreas Färber;; 466fb065187Sbellard*) 4670c58ac1cSmalc audio_drv_list="oss" 468b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 4695327cf48Sbellard linux="yes" 470831b7825Sths linux_user="yes" 47168063649Sblueswir1 usb="linux" 47207f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 473c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 474c9ec1fe4Sbellard fi 475fb065187Sbellard;; 4767d13299dSbellardesac 4777d13299dSbellard 4787d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 479b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 48068063649Sblueswir1 usb="bsd" 48183fb7adfSbellard fi 48284778508Sblueswir1 bsd_user="yes" 4837d3505c5Sbellardfi 4847d3505c5Sbellard 4853457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 4863457a3f8SJuan Quintela EXESUF=".exe" 487a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 488e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 489e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 490884044aaSJuan Quintela LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 491683035deSPaolo Bonzini prefix="c:/Program Files/Qemu" 492683035deSPaolo Bonzini mandir="\${prefix}" 493683035deSPaolo Bonzini datadir="\${prefix}" 494683035deSPaolo Bonzini docdir="\${prefix}" 495683035deSPaolo Bonzini bindir="\${prefix}" 496683035deSPaolo Bonzini sysconfdir="\${prefix}" 497683035deSPaolo Bonzini confsuffix="" 4983457a3f8SJuan Quintelafi 4993457a3f8SJuan Quintela 5007d13299dSbellard# find source path 501ad064840Spbrooksource_path=`dirname "$0"` 50259faef3aSbalrogsource_path_used="no" 50359faef3aSbalrogworkdir=`pwd` 504ad064840Spbrookif [ -z "$source_path" ]; then 50559faef3aSbalrog source_path=$workdir 506ad064840Spbrookelse 507ad064840Spbrook source_path=`cd "$source_path"; pwd` 5087d13299dSbellardfi 509724db118Spbrook[ -f "$workdir/vl.c" ] || source_path_used="yes" 5107d13299dSbellard 511487fefdbSAnthony Liguoriwerror="" 51285aa5189Sbellard 5137d13299dSbellardfor opt do 514a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 5157d13299dSbellard case "$opt" in 5162efc3265Sbellard --help|-h) show_help=yes 5172efc3265Sbellard ;; 518b1a550a0Spbrook --prefix=*) prefix="$optarg" 5197d13299dSbellard ;; 520b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 52132ce6337Sbellard ;; 522b1a550a0Spbrook --source-path=*) source_path="$optarg" 523ad064840Spbrook source_path_used="yes" 5247d13299dSbellard ;; 525ac0df51dSaliguori --cross-prefix=*) 5267d13299dSbellard ;; 527ac0df51dSaliguori --cc=*) 5287d13299dSbellard ;; 529b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 53083469015Sbellard ;; 531b1a550a0Spbrook --make=*) make="$optarg" 5327d13299dSbellard ;; 5336a882643Spbrook --install=*) install="$optarg" 5346a882643Spbrook ;; 535e2a2ed06SJuan Quintela --extra-cflags=*) 5367d13299dSbellard ;; 537e2a2ed06SJuan Quintela --extra-ldflags=*) 5387d13299dSbellard ;; 5392ff6b91eSJuan Quintela --cpu=*) 5407d13299dSbellard ;; 541b1a550a0Spbrook --target-list=*) target_list="$optarg" 542de83cd02Sbellard ;; 54394a420b1SStefan Hajnoczi --trace-backend=*) trace_backend="$optarg" 54494a420b1SStefan Hajnoczi ;; 5459410b56cSPrerna Saxena --trace-file=*) trace_file="$optarg" 5469410b56cSPrerna Saxena ;; 5477d13299dSbellard --enable-gprof) gprof="yes" 5487d13299dSbellard ;; 54979427693SLoïc Minier --static) 55079427693SLoïc Minier static="yes" 55179427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 55243ce4dfeSbellard ;; 5530b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 5540b24e75fSPaolo Bonzini ;; 5550b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 5560b24e75fSPaolo Bonzini ;; 5570b24e75fSPaolo Bonzini --datadir=*) datadir="$optarg" 5580b24e75fSPaolo Bonzini ;; 5590b24e75fSPaolo Bonzini --docdir=*) docdir="$optarg" 5600b24e75fSPaolo Bonzini ;; 561ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 56207381cc1SAnthony Liguori ;; 56397a847bcSbellard --disable-sdl) sdl="no" 56497a847bcSbellard ;; 565c4198157SJuan Quintela --enable-sdl) sdl="yes" 566c4198157SJuan Quintela ;; 567b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 568102a52e4Sbellard ;; 569c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 570c2de5c91Smalc ;; 5712f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 5722f6a1ab0Sblueswir1 ;; 5732fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 5740c58ac1cSmalc ;; 5750c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 5760c58ac1cSmalc ;; 577eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 578eb852011SMarkus Armbruster ;; 579f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 580f8393946Saurel32 ;; 581f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 582f8393946Saurel32 ;; 583b4475aa2SLuiz Capitulino --enable-debug-mon) debug_mon="yes" 584b4475aa2SLuiz Capitulino ;; 585b4475aa2SLuiz Capitulino --disable-debug-mon) debug_mon="no" 586b4475aa2SLuiz Capitulino ;; 587f3d08ee6SPaul Brook --enable-debug) 588f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 589f3d08ee6SPaul Brook debug_tcg="yes" 590b4475aa2SLuiz Capitulino debug_mon="yes" 591f3d08ee6SPaul Brook debug="yes" 592f3d08ee6SPaul Brook strip_opt="no" 593f3d08ee6SPaul Brook ;; 59403b4fe7dSaliguori --enable-sparse) sparse="yes" 59503b4fe7dSaliguori ;; 59603b4fe7dSaliguori --disable-sparse) sparse="no" 59703b4fe7dSaliguori ;; 5981625af87Saliguori --disable-strip) strip_opt="no" 5991625af87Saliguori ;; 6008d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 6018d5d2d4cSths ;; 6021be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 6031be10ad2SJuan Quintela ;; 6042f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 6052f9606b3Saliguori ;; 606ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 607ea784e3bSJuan Quintela ;; 6082f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 6092f6f5c7aSCorentin Chary ;; 6102f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 6112f6f5c7aSCorentin Chary ;; 612efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 613efe556adSCorentin Chary ;; 614efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 615efe556adSCorentin Chary ;; 616bd023f95SCorentin Chary --disable-vnc-thread) vnc_thread="no" 617bd023f95SCorentin Chary ;; 618bd023f95SCorentin Chary --enable-vnc-thread) vnc_thread="yes" 619bd023f95SCorentin Chary ;; 620443f1376Sbellard --disable-slirp) slirp="no" 621c20709aaSbellard ;; 622ee682d27SStefan Weil --disable-uuid) uuid="no" 623ee682d27SStefan Weil ;; 624ee682d27SStefan Weil --enable-uuid) uuid="yes" 625ee682d27SStefan Weil ;; 626e0e6c8c0Saliguori --disable-vde) vde="no" 6278a16d273Sths ;; 628dfb278bdSJuan Quintela --enable-vde) vde="yes" 629dfb278bdSJuan Quintela ;; 630e37630caSaliguori --disable-xen) xen="no" 631e37630caSaliguori ;; 632fc321b4bSJuan Quintela --enable-xen) xen="yes" 633fc321b4bSJuan Quintela ;; 6342e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 6352e4d9fb1Saurel32 ;; 6364ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 6374ffcedb6SJuan Quintela ;; 638fb599c9aSbalrog --disable-bluez) bluez="no" 639fb599c9aSbalrog ;; 640a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 641a20a6f46SJuan Quintela ;; 6427ba1e619Saliguori --disable-kvm) kvm="no" 6437ba1e619Saliguori ;; 644b31a0277SJuan Quintela --enable-kvm) kvm="yes" 645b31a0277SJuan Quintela ;; 646cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 647cd4ec0b4SGerd Hoffmann ;; 648cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 649cd4ec0b4SGerd Hoffmann ;; 65005c2a3e7Sbellard --enable-profiler) profiler="yes" 65105c2a3e7Sbellard ;; 652c2de5c91Smalc --enable-cocoa) 653c2de5c91Smalc cocoa="yes" ; 654c2de5c91Smalc sdl="no" ; 655c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 6565b0753e0Sbellard ;; 657cad25d69Spbrook --disable-system) softmmu="no" 6580a8e90f4Spbrook ;; 659cad25d69Spbrook --enable-system) softmmu="yes" 6600a8e90f4Spbrook ;; 6610953a80fSZachary Amsden --disable-user) 6620953a80fSZachary Amsden linux_user="no" ; 6630953a80fSZachary Amsden bsd_user="no" ; 6640953a80fSZachary Amsden darwin_user="no" 6650953a80fSZachary Amsden ;; 6660953a80fSZachary Amsden --enable-user) ;; 667831b7825Sths --disable-linux-user) linux_user="no" 6680a8e90f4Spbrook ;; 669831b7825Sths --enable-linux-user) linux_user="yes" 670831b7825Sths ;; 671831b7825Sths --disable-darwin-user) darwin_user="no" 672831b7825Sths ;; 673831b7825Sths --enable-darwin-user) darwin_user="yes" 6740a8e90f4Spbrook ;; 67584778508Sblueswir1 --disable-bsd-user) bsd_user="no" 67684778508Sblueswir1 ;; 67784778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 67884778508Sblueswir1 ;; 679379f6698SPaul Brook --enable-guest-base) guest_base="yes" 680379f6698SPaul Brook ;; 681379f6698SPaul Brook --disable-guest-base) guest_base="no" 682379f6698SPaul Brook ;; 68334005a00SKirill A. Shutemov --enable-user-pie) user_pie="yes" 68434005a00SKirill A. Shutemov ;; 68534005a00SKirill A. Shutemov --disable-user-pie) user_pie="no" 68634005a00SKirill A. Shutemov ;; 687c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 688c5937220Spbrook ;; 6893142255cSblueswir1 --sparc_cpu=*) 6903142255cSblueswir1 ;; 69185aa5189Sbellard --enable-werror) werror="yes" 69285aa5189Sbellard ;; 69385aa5189Sbellard --disable-werror) werror="no" 69485aa5189Sbellard ;; 6954d3b6f6eSbalrog --disable-curses) curses="no" 6964d3b6f6eSbalrog ;; 697c584a6d0SJuan Quintela --enable-curses) curses="yes" 698c584a6d0SJuan Quintela ;; 699769ce76dSAlexander Graf --disable-curl) curl="no" 700769ce76dSAlexander Graf ;; 701788c8196SJuan Quintela --enable-curl) curl="yes" 702788c8196SJuan Quintela ;; 7032df87df7SJuan Quintela --disable-fdt) fdt="no" 7042df87df7SJuan Quintela ;; 7052df87df7SJuan Quintela --enable-fdt) fdt="yes" 7062df87df7SJuan Quintela ;; 7075495ed11SLuiz Capitulino --disable-check-utests) check_utests="no" 7085495ed11SLuiz Capitulino ;; 7095495ed11SLuiz Capitulino --enable-check-utests) check_utests="yes" 7105495ed11SLuiz Capitulino ;; 711bd0c5661Spbrook --disable-nptl) nptl="no" 712bd0c5661Spbrook ;; 713b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 714b0a47e79SJuan Quintela ;; 7158ff9cbf7Smalc --enable-mixemu) mixemu="yes" 7168ff9cbf7Smalc ;; 7175c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 7185c6c3a6cSChristoph Hellwig ;; 7195c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 7205c6c3a6cSChristoph Hellwig ;; 721758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 722758e8e38SVenkateswararao Jujjuri (JV) ;; 723758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 724758e8e38SVenkateswararao Jujjuri (JV) ;; 725e5d355d1Saliguori --enable-io-thread) io_thread="yes" 726e5d355d1Saliguori ;; 72777755340Sths --disable-blobs) blobs="no" 72877755340Sths ;; 729eac30262Saliguori --kerneldir=*) kerneldir="$optarg" 730eac30262Saliguori ;; 7314a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 7324a19f1ecSpbrook ;; 733a25dba17SJuan Quintela --disable-docs) docs="no" 73470ec5dc0SAnthony Liguori ;; 735a25dba17SJuan Quintela --enable-docs) docs="yes" 73683a3ab8bSJuan Quintela ;; 737d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 738d5970055SMichael S. Tsirkin ;; 739d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 740d5970055SMichael S. Tsirkin ;; 7416bde81cbSPaolo Bonzini --*dir) 7426bde81cbSPaolo Bonzini ;; 7437f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 7447f1559c6Sbalrog ;; 7457d13299dSbellard esac 7467d13299dSbellarddone 7477d13299dSbellard 7483142255cSblueswir1# 7493142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 750a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 7513142255cSblueswir1# 752379f6698SPaul Brookhost_guest_base="no" 75340293e58Sbellardcase "$cpu" in 754ed968ff1SJuan Quintela sparc) case $sparc_cpu in 755ed968ff1SJuan Quintela v7|v8) 756a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 757ed968ff1SJuan Quintela ;; 758ed968ff1SJuan Quintela v8plus|v8plusa) 759a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 760ed968ff1SJuan Quintela ;; 761ed968ff1SJuan Quintela *) # sparc_cpu not defined in the command line 762a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" 763ed968ff1SJuan Quintela esac 7640c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 765a558ee17SJuan Quintela QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" 766762e8230Sblueswir1 if test "$solaris" = "no" ; then 767a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS" 768c81da56eSJuan Quintela helper_cflags="-ffixed-i0" 769762e8230Sblueswir1 fi 7703142255cSblueswir1 ;; 771ed968ff1SJuan Quintela sparc64) 772a558ee17SJuan Quintela QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" 7730c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 774a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" 775ed968ff1SJuan Quintela if test "$solaris" != "no" ; then 776a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" 777762e8230Sblueswir1 fi 7783142255cSblueswir1 ;; 77976d83bdeSths s390) 78028d7cc49SRichard Henderson QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS" 78128d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 78248bb3750SRichard Henderson host_guest_base="yes" 78328d7cc49SRichard Henderson ;; 78428d7cc49SRichard Henderson s390x) 78528d7cc49SRichard Henderson QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS" 78628d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 78748bb3750SRichard Henderson host_guest_base="yes" 78876d83bdeSths ;; 78940293e58Sbellard i386) 790a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 7910c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 792c81da56eSJuan Quintela helper_cflags="-fomit-frame-pointer" 793379f6698SPaul Brook host_guest_base="yes" 79440293e58Sbellard ;; 79540293e58Sbellard x86_64) 796a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 7970c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 798379f6698SPaul Brook host_guest_base="yes" 799379f6698SPaul Brook ;; 800379f6698SPaul Brook arm*) 801379f6698SPaul Brook host_guest_base="yes" 80240293e58Sbellard ;; 803f6548c0aSmalc ppc*) 804f6548c0aSmalc host_guest_base="yes" 805f6548c0aSmalc ;; 806cc01cc8eSAurelien Jarno mips*) 807cc01cc8eSAurelien Jarno host_guest_base="yes" 808cc01cc8eSAurelien Jarno ;; 809477ba620SAurelien Jarno ia64*) 810477ba620SAurelien Jarno host_guest_base="yes" 811477ba620SAurelien Jarno ;; 812fd76e73aSRichard Henderson hppa*) 813fd76e73aSRichard Henderson host_guest_base="yes" 814fd76e73aSRichard Henderson ;; 8153142255cSblueswir1esac 8163142255cSblueswir1 817379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base" 818379f6698SPaul Brook 819af5db58eSpbrookif test x"$show_help" = x"yes" ; then 820af5db58eSpbrookcat << EOF 821af5db58eSpbrook 822af5db58eSpbrookUsage: configure [options] 823af5db58eSpbrookOptions: [defaults in brackets after descriptions] 824af5db58eSpbrook 825af5db58eSpbrookEOF 826af5db58eSpbrookecho "Standard options:" 827af5db58eSpbrookecho " --help print this message" 828af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 829af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 830af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 831af5db58eSpbrookecho " --target-list=LIST set target list [$target_list]" 832af5db58eSpbrookecho "" 833af5db58eSpbrookecho "Advanced options (experts only):" 834af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 835af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 836af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 8370bfe8cc0SPaolo Bonziniecho " --host-cc=CC use C compiler CC [$host_cc] for code run at" 8380bfe8cc0SPaolo Bonziniecho " build time" 839a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 840e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 841af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 8426a882643Spbrookecho " --install=INSTALL use specified install [$install]" 843af5db58eSpbrookecho " --static enable static build [$static]" 8440b24e75fSPaolo Bonziniecho " --mandir=PATH install man pages in PATH" 8450b24e75fSPaolo Bonziniecho " --datadir=PATH install firmware in PATH" 8460b24e75fSPaolo Bonziniecho " --docdir=PATH install documentation in PATH" 8470b24e75fSPaolo Bonziniecho " --bindir=PATH install binaries in PATH" 8480b24e75fSPaolo Bonziniecho " --sysconfdir=PATH install config in PATH/qemu" 849f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 850f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 85109695a4aSStefan Weilecho " --enable-debug enable common debug build options" 852890b1658Saliguoriecho " --enable-sparse enable sparse checker" 853890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 8541625af87Saliguoriecho " --disable-strip disable stripping binaries" 85585aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 856fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 857c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 858af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 859c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 860c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 8614c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 8624c9b53e3Smalcecho " Available cards: $audio_possible_cards" 863eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 864eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 8658ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 866e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 867fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 8682e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 8694ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 8708d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 8711be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 8722f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 873ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 8742f6f5c7aSCorentin Charyecho " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" 8752f6f5c7aSCorentin Charyecho " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" 87696763cf9SCorentin Charyecho " --disable-vnc-png disable PNG compression for VNC server (default)" 877efe556adSCorentin Charyecho " --enable-vnc-png enable PNG compression for VNC server" 878bd023f95SCorentin Charyecho " --disable-vnc-thread disable threaded VNC server" 879bd023f95SCorentin Charyecho " --enable-vnc-thread enable threaded VNC server" 880af896aaaSpbrookecho " --disable-curses disable curses output" 881c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 882769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 883788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 8842df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 8852df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 8865495ed11SLuiz Capitulinoecho " --disable-check-utests disable check unit-tests" 8875495ed11SLuiz Capitulinoecho " --enable-check-utests enable check unit-tests" 888fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 889a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 8907ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 891b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 892bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 893e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 894af5db58eSpbrookecho " --enable-system enable all system emulation targets" 895af5db58eSpbrookecho " --disable-system disable all system emulation targets" 8960953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 8970953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 898831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 899831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 900831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 901831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 90284778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 90384778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 904379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 905379f6698SPaul Brookecho " emulation targets" 906379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 90734005a00SKirill A. Shutemovecho " --enable-user-pie build usermode emulation targets as PIE" 90834005a00SKirill A. Shutemovecho " --disable-user-pie do not build usermode emulation targets as PIE" 909af5db58eSpbrookecho " --fmod-lib path to FMOD library" 910af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 9112f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 912c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 9133142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 914ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 915ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 916e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 917dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 9185c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 9195c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 920758e8e38SVenkateswararao Jujjuri (JV)echo " --disable-attr disables attr and xattr support" 921758e8e38SVenkateswararao Jujjuri (JV)echo " --enable-attr enable attr and xattr support" 922e5d355d1Saliguoriecho " --enable-io-thread enable IO thread" 92377755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 924eac30262Saliguoriecho " --kerneldir=PATH look for kernel includes in PATH" 925d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 926d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 927d5970055SMichael S. Tsirkinecho " --disable-vhost-net disable vhost-net acceleration support" 928d5970055SMichael S. Tsirkinecho " --enable-vhost-net enable vhost-net acceleration support" 9297e24e92aSStefan Hajnocziecho " --trace-backend=B Trace backend nop simple ust" 9309410b56cSPrerna Saxenaecho " --trace-file=NAME Full PATH,NAME of file to store traces" 9319410b56cSPrerna Saxenaecho " Default:trace-<pid>" 932cd4ec0b4SGerd Hoffmannecho " --disable-spice disable spice" 933cd4ec0b4SGerd Hoffmannecho " --enable-spice enable spice" 934af5db58eSpbrookecho "" 9355bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 936af5db58eSpbrookexit 1 937af5db58eSpbrookfi 938af5db58eSpbrook 939ec530c81Sbellard# 940ec530c81Sbellard# Solaris specific configure tool chain decisions 941ec530c81Sbellard# 942ec530c81Sbellardif test "$solaris" = "yes" ; then 9436792aa11SLoïc Minier if has $install; then 9446792aa11SLoïc Minier : 9456792aa11SLoïc Minier else 946ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 947ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 948ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 949ec530c81Sbellard exit 1 950ec530c81Sbellard fi 9516792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 952ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 953ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 954ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 955ec530c81Sbellard exit 1 956ec530c81Sbellard fi 9576792aa11SLoïc Minier if has ar; then 9586792aa11SLoïc Minier : 9596792aa11SLoïc Minier else 960ec530c81Sbellard echo "Error: No path includes ar" 961ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 962ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 963ec530c81Sbellard fi 964ec530c81Sbellard exit 1 965ec530c81Sbellard fi 966ec530c81Sbellardfi 967ec530c81Sbellard 968ec530c81Sbellard 9695327cf48Sbellardif test -z "$target_list" ; then 9705327cf48Sbellard# these targets are portable 9710a8e90f4Spbrook if [ "$softmmu" = "yes" ] ; then 9722408a527Saurel32 target_list="\ 9732408a527Saurel32i386-softmmu \ 9742408a527Saurel32x86_64-softmmu \ 9752408a527Saurel32arm-softmmu \ 9762408a527Saurel32cris-softmmu \ 9772408a527Saurel32m68k-softmmu \ 97872b675caSEdgar E. Iglesiasmicroblaze-softmmu \ 9792408a527Saurel32mips-softmmu \ 9802408a527Saurel32mipsel-softmmu \ 9812408a527Saurel32mips64-softmmu \ 9822408a527Saurel32mips64el-softmmu \ 9832408a527Saurel32ppc-softmmu \ 9842408a527Saurel32ppcemb-softmmu \ 9852408a527Saurel32ppc64-softmmu \ 9862408a527Saurel32sh4-softmmu \ 9872408a527Saurel32sh4eb-softmmu \ 9882408a527Saurel32sparc-softmmu \ 9891b64fcaeSIgor V. Kovalenkosparc64-softmmu \ 9902408a527Saurel32" 9910a8e90f4Spbrook fi 9925327cf48Sbellard# the following are Linux specific 993831b7825Sths if [ "$linux_user" = "yes" ] ; then 9942408a527Saurel32 target_list="${target_list}\ 9952408a527Saurel32i386-linux-user \ 9962408a527Saurel32x86_64-linux-user \ 9972408a527Saurel32alpha-linux-user \ 9982408a527Saurel32arm-linux-user \ 9992408a527Saurel32armeb-linux-user \ 10002408a527Saurel32cris-linux-user \ 10012408a527Saurel32m68k-linux-user \ 100272b675caSEdgar E. Iglesiasmicroblaze-linux-user \ 10032408a527Saurel32mips-linux-user \ 10042408a527Saurel32mipsel-linux-user \ 10052408a527Saurel32ppc-linux-user \ 10062408a527Saurel32ppc64-linux-user \ 10072408a527Saurel32ppc64abi32-linux-user \ 10082408a527Saurel32sh4-linux-user \ 10092408a527Saurel32sh4eb-linux-user \ 10102408a527Saurel32sparc-linux-user \ 10112408a527Saurel32sparc64-linux-user \ 10122408a527Saurel32sparc32plus-linux-user \ 10132408a527Saurel32" 1014831b7825Sths fi 1015831b7825Sths# the following are Darwin specific 1016831b7825Sths if [ "$darwin_user" = "yes" ] ; then 10172408a527Saurel32 target_list="$target_list i386-darwin-user ppc-darwin-user " 10185327cf48Sbellard fi 101984778508Sblueswir1# the following are BSD specific 102084778508Sblueswir1 if [ "$bsd_user" = "yes" ] ; then 102184778508Sblueswir1 target_list="${target_list}\ 102231fc12dfSblueswir1i386-bsd-user \ 102331fc12dfSblueswir1x86_64-bsd-user \ 102431fc12dfSblueswir1sparc-bsd-user \ 102584778508Sblueswir1sparc64-bsd-user \ 102684778508Sblueswir1" 102784778508Sblueswir1 fi 10286e20a45fSbellardelse 1029b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 10305327cf48Sbellardfi 10310a8e90f4Spbrookif test -z "$target_list" ; then 10320a8e90f4Spbrook echo "No targets enabled" 10330a8e90f4Spbrook exit 1 10340a8e90f4Spbrookfi 1035f55fe278SPaolo Bonzini# see if system emulation was really requested 1036f55fe278SPaolo Bonzinicase " $target_list " in 1037f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1038f55fe278SPaolo Bonzini ;; 1039f55fe278SPaolo Bonzini *) softmmu=no 1040f55fe278SPaolo Bonzini ;; 1041f55fe278SPaolo Bonziniesac 10425327cf48Sbellard 1043249247c9SJuan Quintelafeature_not_found() { 1044249247c9SJuan Quintela feature=$1 1045249247c9SJuan Quintela 1046249247c9SJuan Quintela echo "ERROR" 1047249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 10489332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 1049249247c9SJuan Quintela echo "ERROR" 1050249247c9SJuan Quintela exit 1; 1051249247c9SJuan Quintela} 1052249247c9SJuan Quintela 10537d13299dSbellardif test -z "$cross_prefix" ; then 10547d13299dSbellard 10557d13299dSbellard# --- 10567d13299dSbellard# big/little endian test 10577d13299dSbellardcat > $TMPC << EOF 10587d13299dSbellard#include <inttypes.h> 10597d13299dSbellardint main(int argc, char ** argv){ 10607d13299dSbellard volatile uint32_t i=0x01234567; 10617d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 10627d13299dSbellard} 10637d13299dSbellardEOF 10647d13299dSbellard 106552166aa0SJuan Quintelaif compile_prog "" "" ; then 10667d13299dSbellard$TMPE && bigendian="yes" 10677d13299dSbellardelse 10687d13299dSbellardecho big/little test failed 10697d13299dSbellardfi 10707d13299dSbellard 10717d13299dSbellardelse 10727d13299dSbellard 10737d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 1074ea8f20f8SJuan Quintelacase "$cpu" in 107524e804ecSAlexander Graf armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1076ea8f20f8SJuan Quintela bigendian=yes 1077ea8f20f8SJuan Quintela ;; 1078ea8f20f8SJuan Quintelaesac 10797d13299dSbellard 10807d13299dSbellardfi 10817d13299dSbellard 1082b6853697Sbellard# host long bits test 1083b6853697Sbellardhostlongbits="32" 1084ea8f20f8SJuan Quintelacase "$cpu" in 108524e804ecSAlexander Graf x86_64|alpha|ia64|sparc64|ppc64|s390x) 1086ea8f20f8SJuan Quintela hostlongbits=64 1087ea8f20f8SJuan Quintela ;; 1088ea8f20f8SJuan Quintelaesac 1089b6853697Sbellard 1090b0a47e79SJuan Quintela 1091b0a47e79SJuan Quintela########################################## 1092b0a47e79SJuan Quintela# NPTL probe 1093b0a47e79SJuan Quintela 1094b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 1095bd0c5661Spbrook cat > $TMPC <<EOF 1096bd0c5661Spbrook#include <sched.h> 109730813ceaSpbrook#include <linux/futex.h> 1098bd0c5661Spbrookvoid foo() 1099bd0c5661Spbrook{ 1100bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1101bd0c5661Spbrook#error bork 1102bd0c5661Spbrook#endif 1103bd0c5661Spbrook} 1104bd0c5661SpbrookEOF 1105bd0c5661Spbrook 110652166aa0SJuan Quintela if compile_object ; then 1107b0a47e79SJuan Quintela nptl=yes 1108bd0c5661Spbrook else 1109b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 1110b0a47e79SJuan Quintela feature_not_found "nptl" 1111b0a47e79SJuan Quintela fi 1112b0a47e79SJuan Quintela nptl=no 1113b0a47e79SJuan Quintela fi 1114bd0c5661Spbrookfi 1115bd0c5661Spbrook 111611d9f695Sbellard########################################## 1117ac62922eSbalrog# zlib check 1118ac62922eSbalrog 1119ac62922eSbalrogcat > $TMPC << EOF 1120ac62922eSbalrog#include <zlib.h> 1121ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1122ac62922eSbalrogEOF 112352166aa0SJuan Quintelaif compile_prog "" "-lz" ; then 1124ac62922eSbalrog : 1125ac62922eSbalrogelse 1126ac62922eSbalrog echo 1127ac62922eSbalrog echo "Error: zlib check failed" 1128ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 1129ac62922eSbalrog echo 1130ac62922eSbalrog exit 1 1131ac62922eSbalrogfi 1132ac62922eSbalrog 1133ac62922eSbalrog########################################## 1134e37630caSaliguori# xen probe 1135e37630caSaliguori 1136fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1137b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1138e37630caSaliguori cat > $TMPC <<EOF 1139e37630caSaliguori#include <xenctrl.h> 1140e37630caSaliguori#include <xs.h> 1141df7a607bSChristoph Eggerint main(void) { xs_daemon_open(); xc_interface_open(); return 0; } 1142e37630caSaliguoriEOF 114352166aa0SJuan Quintela if compile_prog "" "$xen_libs" ; then 1144fc321b4bSJuan Quintela xen=yes 11453efd632bSJuan Quintela libs_softmmu="$xen_libs $libs_softmmu" 1146e37630caSaliguori else 1147fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 1148fc321b4bSJuan Quintela feature_not_found "xen" 1149fc321b4bSJuan Quintela fi 1150fc321b4bSJuan Quintela xen=no 1151e37630caSaliguori fi 1152e37630caSaliguorifi 1153e37630caSaliguori 1154e37630caSaliguori########################################## 1155f91672e5SPaolo Bonzini# pkgconfig probe 1156f91672e5SPaolo Bonzini 1157f91672e5SPaolo Bonzinipkgconfig="${cross_prefix}pkg-config" 11580dba6195SLoïc Minierif ! has $pkgconfig; then 1159f91672e5SPaolo Bonzini # likely not cross compiling, or hope for the best 1160f91672e5SPaolo Bonzini pkgconfig=pkg-config 1161f91672e5SPaolo Bonzinifi 1162f91672e5SPaolo Bonzini 1163f91672e5SPaolo Bonzini########################################## 1164dfffc653SJuan Quintela# Sparse probe 1165dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 11660dba6195SLoïc Minier if has cgcc; then 1167dfffc653SJuan Quintela sparse=yes 1168dfffc653SJuan Quintela else 1169dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1170dfffc653SJuan Quintela feature_not_found "sparse" 1171dfffc653SJuan Quintela fi 1172dfffc653SJuan Quintela sparse=no 1173dfffc653SJuan Quintela fi 1174dfffc653SJuan Quintelafi 1175dfffc653SJuan Quintela 1176dfffc653SJuan Quintela########################################## 117711d9f695Sbellard# SDL probe 117811d9f695Sbellard 1179fec0e3e8SStefan Weil# Look for sdl configuration program (pkg-config or sdl-config). 1180fec0e3e8SStefan Weil# Prefer variant with cross prefix if cross compiling, 1181fec0e3e8SStefan Weil# and favour pkg-config with sdl over sdl-config. 1182fec0e3e8SStefan Weilif test -n "$cross_prefix" -a $pkgconfig != pkg-config && \ 1183fec0e3e8SStefan Weil $pkgconfig sdl --modversion >/dev/null 2>&1; then 1184fec0e3e8SStefan Weil sdlconfig="$pkgconfig sdl" 1185fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 1186fec0e3e8SStefan Weilelif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then 1187fec0e3e8SStefan Weil sdlconfig="${cross_prefix}sdl-config" 1188fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1189fec0e3e8SStefan Weilelif $pkgconfig sdl --modversion >/dev/null 2>&1; then 11909316f803SPaolo Bonzini sdlconfig="$pkgconfig sdl" 11919316f803SPaolo Bonzini _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 11920dba6195SLoïc Minierelif has sdl-config; then 11939316f803SPaolo Bonzini sdlconfig='sdl-config' 11949316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1195a0dfd8a4SLoïc Minierelse 1196a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1197a0dfd8a4SLoïc Minier feature_not_found "sdl" 1198a0dfd8a4SLoïc Minier fi 1199a0dfd8a4SLoïc Minier sdl=no 12009316f803SPaolo Bonzinifi 120111d9f695Sbellard 12029316f803SPaolo Bonzinisdl_too_old=no 1203c4198157SJuan Quintelaif test "$sdl" != "no" ; then 120411d9f695Sbellard cat > $TMPC << EOF 120511d9f695Sbellard#include <SDL.h> 120611d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 120711d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 120811d9f695SbellardEOF 12099316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 121074f42e18STeLeMan if test "$static" = "yes" ; then 121174f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 121274f42e18STeLeMan else 12139316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 121474f42e18STeLeMan fi 121552166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 121611d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 121711d9f695Sbellard sdl_too_old=yes 121811d9f695Sbellard else 1219fd677642Sths if test "$cocoa" = "no" ; then 122011d9f695Sbellard sdl=yes 122111d9f695Sbellard fi 1222fd677642Sths fi 12237c1f25b4Sbellard 122467c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 12251ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 122667c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1227f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1228f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 122911d9f695Sbellard fi 123052166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 12311ac88f28SJuan Quintela : 12321ac88f28SJuan Quintela else 12331ac88f28SJuan Quintela sdl=no 12347c1f25b4Sbellard fi 12357c1f25b4Sbellard fi # static link 1236c4198157SJuan Quintela else # sdl not found 1237c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1238c4198157SJuan Quintela feature_not_found "sdl" 1239c4198157SJuan Quintela fi 1240c4198157SJuan Quintela sdl=no 12417c1f25b4Sbellard fi # sdl compile test 1242fd677642Sthsfi 124311d9f695Sbellard 12445368a422Saliguoriif test "$sdl" = "yes" ; then 12455368a422Saliguori cat > $TMPC <<EOF 12465368a422Saliguori#include <SDL.h> 12475368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 12485368a422Saliguori#include <X11/XKBlib.h> 12495368a422Saliguori#else 12505368a422Saliguori#error No x11 support 12515368a422Saliguori#endif 12525368a422Saliguoriint main(void) { return 0; } 12535368a422SaliguoriEOF 125452166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1255681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 12565368a422Saliguori fi 125707d9ac44SJuan Quintela if test "$mingw32" = "yes" ; then 125807d9ac44SJuan Quintela sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole" 125907d9ac44SJuan Quintela fi 12600705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 12615368a422Saliguorifi 12625368a422Saliguori 12638f28f3fbSths########################################## 12648d5d2d4cSths# VNC TLS detection 12651be10ad2SJuan Quintelaif test "$vnc_tls" != "no" ; then 1266ae6b5e5aSaliguori cat > $TMPC <<EOF 1267ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1268ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1269ae6b5e5aSaliguoriEOF 1270f91672e5SPaolo Bonzini vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null` 1271f91672e5SPaolo Bonzini vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null` 127252166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 12731be10ad2SJuan Quintela vnc_tls=yes 1274a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1275ae6b5e5aSaliguori else 12761be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 12771be10ad2SJuan Quintela feature_not_found "vnc-tls" 12781be10ad2SJuan Quintela fi 12791be10ad2SJuan Quintela vnc_tls=no 12808d5d2d4cSths fi 12818d5d2d4cSthsfi 12828d5d2d4cSths 12838d5d2d4cSths########################################## 12842f9606b3Saliguori# VNC SASL detection 12853aefa744SJuan Quintelaif test "$vnc_sasl" != "no" ; then 12862f9606b3Saliguori cat > $TMPC <<EOF 12872f9606b3Saliguori#include <sasl/sasl.h> 12882f9606b3Saliguori#include <stdio.h> 12892f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 12902f9606b3SaliguoriEOF 12912f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 12922f9606b3Saliguori vnc_sasl_cflags="" 12932f9606b3Saliguori vnc_sasl_libs="-lsasl2" 129452166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1295ea784e3bSJuan Quintela vnc_sasl=yes 1296fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 12972f9606b3Saliguori else 1298ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1299ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1300ea784e3bSJuan Quintela fi 1301ea784e3bSJuan Quintela vnc_sasl=no 13022f9606b3Saliguori fi 13032f9606b3Saliguorifi 13042f9606b3Saliguori 13052f9606b3Saliguori########################################## 13062f6f5c7aSCorentin Chary# VNC JPEG detection 130796763cf9SCorentin Charyif test "$vnc_jpeg" != "no" ; then 13082f6f5c7aSCorentin Charycat > $TMPC <<EOF 13092f6f5c7aSCorentin Chary#include <stdio.h> 13102f6f5c7aSCorentin Chary#include <jpeglib.h> 13112f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 13122f6f5c7aSCorentin CharyEOF 13132f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 13142f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 13152f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 13162f6f5c7aSCorentin Chary vnc_jpeg=yes 13172f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 13182f6f5c7aSCorentin Chary else 13192f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 13202f6f5c7aSCorentin Chary feature_not_found "vnc-jpeg" 13212f6f5c7aSCorentin Chary fi 13222f6f5c7aSCorentin Chary vnc_jpeg=no 13232f6f5c7aSCorentin Chary fi 13242f6f5c7aSCorentin Charyfi 13252f6f5c7aSCorentin Chary 13262f6f5c7aSCorentin Chary########################################## 1327efe556adSCorentin Chary# VNC PNG detection 132896763cf9SCorentin Charyif test "$vnc_png" != "no" ; then 1329efe556adSCorentin Charycat > $TMPC <<EOF 1330efe556adSCorentin Chary//#include <stdio.h> 1331efe556adSCorentin Chary#include <png.h> 1332832ce9c2SScott Wood#include <stddef.h> 1333efe556adSCorentin Charyint main(void) { 1334efe556adSCorentin Chary png_structp png_ptr; 1335efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 1336efe556adSCorentin Chary return 0; 1337efe556adSCorentin Chary} 1338efe556adSCorentin CharyEOF 1339efe556adSCorentin Chary vnc_png_cflags="" 1340efe556adSCorentin Chary vnc_png_libs="-lpng" 1341efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 1342efe556adSCorentin Chary vnc_png=yes 1343efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 1344efe556adSCorentin Chary else 1345efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 1346efe556adSCorentin Chary feature_not_found "vnc-png" 1347efe556adSCorentin Chary fi 1348efe556adSCorentin Chary vnc_png=no 1349efe556adSCorentin Chary fi 1350efe556adSCorentin Charyfi 1351efe556adSCorentin Chary 1352efe556adSCorentin Chary########################################## 135376655d6dSaliguori# fnmatch() probe, used for ACL routines 135476655d6dSaliguorifnmatch="no" 135576655d6dSaliguoricat > $TMPC << EOF 135676655d6dSaliguori#include <fnmatch.h> 135776655d6dSaliguoriint main(void) 135876655d6dSaliguori{ 135976655d6dSaliguori fnmatch("foo", "foo", 0); 136076655d6dSaliguori return 0; 136176655d6dSaliguori} 136276655d6dSaliguoriEOF 136352166aa0SJuan Quintelaif compile_prog "" "" ; then 136476655d6dSaliguori fnmatch="yes" 136576655d6dSaliguorifi 136676655d6dSaliguori 136776655d6dSaliguori########################################## 1368ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1369ee682d27SStefan Weilif test "$uuid" != "no" ; then 1370ee682d27SStefan Weil uuid_libs="-luuid" 1371ee682d27SStefan Weil cat > $TMPC << EOF 1372ee682d27SStefan Weil#include <uuid/uuid.h> 1373ee682d27SStefan Weilint main(void) 1374ee682d27SStefan Weil{ 1375ee682d27SStefan Weil uuid_t my_uuid; 1376ee682d27SStefan Weil uuid_generate(my_uuid); 1377ee682d27SStefan Weil return 0; 1378ee682d27SStefan Weil} 1379ee682d27SStefan WeilEOF 1380ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1381ee682d27SStefan Weil uuid="yes" 1382ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1383ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1384ee682d27SStefan Weil else 1385ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1386ee682d27SStefan Weil feature_not_found "uuid" 1387ee682d27SStefan Weil fi 1388ee682d27SStefan Weil uuid=no 1389ee682d27SStefan Weil fi 1390ee682d27SStefan Weilfi 1391ee682d27SStefan Weil 1392ee682d27SStefan Weil########################################## 13938a16d273Sths# vde libraries probe 1394dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 13954baae0acSJuan Quintela vde_libs="-lvdeplug" 13968a16d273Sths cat > $TMPC << EOF 13978a16d273Sths#include <libvdeplug.h> 13984a7f0e06Spbrookint main(void) 13994a7f0e06Spbrook{ 14004a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 14014a7f0e06Spbrook vde_open("", "", &a); 14024a7f0e06Spbrook return 0; 14034a7f0e06Spbrook} 14048a16d273SthsEOF 140552166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 14064baae0acSJuan Quintela vde=yes 14078e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 14088e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1409dfb278bdSJuan Quintela else 1410dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1411dfb278bdSJuan Quintela feature_not_found "vde" 1412dfb278bdSJuan Quintela fi 1413dfb278bdSJuan Quintela vde=no 14148a16d273Sths fi 14158a16d273Sthsfi 14168a16d273Sths 14178a16d273Sths########################################## 1418c2de5c91Smalc# Sound support libraries probe 14198f28f3fbSths 1420c2de5c91Smalcaudio_drv_probe() 1421c2de5c91Smalc{ 1422c2de5c91Smalc drv=$1 1423c2de5c91Smalc hdr=$2 1424c2de5c91Smalc lib=$3 1425c2de5c91Smalc exp=$4 1426c2de5c91Smalc cfl=$5 14278f28f3fbSths cat > $TMPC << EOF 1428c2de5c91Smalc#include <$hdr> 1429c2de5c91Smalcint main(void) { $exp } 14308f28f3fbSthsEOF 143152166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 14328f28f3fbSths : 14338f28f3fbSths else 14348f28f3fbSths echo 1435c2de5c91Smalc echo "Error: $drv check failed" 1436c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 14378f28f3fbSths echo 14388f28f3fbSths exit 1 14398f28f3fbSths fi 1440c2de5c91Smalc} 1441c2de5c91Smalc 14422fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1443c2de5c91Smalcfor drv in $audio_drv_list; do 1444c2de5c91Smalc case $drv in 1445c2de5c91Smalc alsa) 1446c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1447c2de5c91Smalc "snd_pcm_t **handle; return snd_pcm_close(*handle);" 1448a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1449c2de5c91Smalc ;; 1450c2de5c91Smalc 1451c2de5c91Smalc fmod) 1452c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1453c2de5c91Smalc echo 1454c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1455c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1456c2de5c91Smalc echo 1457c2de5c91Smalc exit 1 14588f28f3fbSths fi 1459c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1460a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1461c2de5c91Smalc ;; 1462c2de5c91Smalc 1463c2de5c91Smalc esd) 1464c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1465a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 146667f86e8eSJuan Quintela audio_pt_int="yes" 1467c2de5c91Smalc ;; 1468b8e59f18Smalc 1469b8e59f18Smalc pa) 1470493abda6SAurelien Jarno audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \ 1471b8e59f18Smalc "pa_simple *s = NULL; pa_simple_free(s); return 0;" 1472493abda6SAurelien Jarno libs_softmmu="-lpulse -lpulse-simple $libs_softmmu" 147367f86e8eSJuan Quintela audio_pt_int="yes" 1474b8e59f18Smalc ;; 1475b8e59f18Smalc 1476997e690aSJuan Quintela coreaudio) 1477997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1478997e690aSJuan Quintela ;; 1479997e690aSJuan Quintela 1480a4bf6780SJuan Quintela dsound) 1481a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1482d5631638Smalc audio_win_int="yes" 1483a4bf6780SJuan Quintela ;; 1484a4bf6780SJuan Quintela 1485a4bf6780SJuan Quintela oss) 1486a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1487a4bf6780SJuan Quintela ;; 1488a4bf6780SJuan Quintela 1489a4bf6780SJuan Quintela sdl|wav) 14902f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 14912f6a1ab0Sblueswir1 ;; 14922f6a1ab0Sblueswir1 1493d5631638Smalc winwave) 1494d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1495d5631638Smalc audio_win_int="yes" 1496d5631638Smalc ;; 1497d5631638Smalc 1498e4c63a6aSmalc *) 14991c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1500e4c63a6aSmalc echo 1501e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1502e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 1503e4c63a6aSmalc echo 1504e4c63a6aSmalc exit 1 1505e4c63a6aSmalc } 1506e4c63a6aSmalc ;; 1507c2de5c91Smalc esac 1508c2de5c91Smalcdone 15098f28f3fbSths 15104d3b6f6eSbalrog########################################## 15112e4d9fb1Saurel32# BrlAPI probe 15122e4d9fb1Saurel32 15134ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 1514eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 15152e4d9fb1Saurel32 cat > $TMPC << EOF 15162e4d9fb1Saurel32#include <brlapi.h> 1517832ce9c2SScott Wood#include <stddef.h> 15182e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 15192e4d9fb1Saurel32EOF 152052166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 15212e4d9fb1Saurel32 brlapi=yes 1522264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 15234ffcedb6SJuan Quintela else 15244ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 15254ffcedb6SJuan Quintela feature_not_found "brlapi" 15264ffcedb6SJuan Quintela fi 15274ffcedb6SJuan Quintela brlapi=no 1528eb82284fSJuan Quintela fi 1529eb82284fSJuan Quintelafi 15302e4d9fb1Saurel32 15312e4d9fb1Saurel32########################################## 15324d3b6f6eSbalrog# curses probe 15334f78ef9aSJuan Quintelacurses_list="-lncurses -lcurses" 15344d3b6f6eSbalrog 1535c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 1536c584a6d0SJuan Quintela curses_found=no 15374d3b6f6eSbalrog cat > $TMPC << EOF 15384d3b6f6eSbalrog#include <curses.h> 15395a8ff3aaSblueswir1#ifdef __OpenBSD__ 15405a8ff3aaSblueswir1#define resize_term resizeterm 15415a8ff3aaSblueswir1#endif 15425a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); } 15434d3b6f6eSbalrogEOF 15444f78ef9aSJuan Quintela for curses_lib in $curses_list; do 15454f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 1546c584a6d0SJuan Quintela curses_found=yes 15474f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 15484f78ef9aSJuan Quintela break 15494d3b6f6eSbalrog fi 15504f78ef9aSJuan Quintela done 1551c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 1552c584a6d0SJuan Quintela curses=yes 1553c584a6d0SJuan Quintela else 1554c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 1555c584a6d0SJuan Quintela feature_not_found "curses" 1556c584a6d0SJuan Quintela fi 1557c584a6d0SJuan Quintela curses=no 1558c584a6d0SJuan Quintela fi 15594f78ef9aSJuan Quintelafi 15604d3b6f6eSbalrog 1561414f0dabSblueswir1########################################## 1562769ce76dSAlexander Graf# curl probe 1563769ce76dSAlexander Graf 15644e2b0658SPaolo Bonziniif $pkgconfig libcurl --modversion >/dev/null 2>&1; then 15654e2b0658SPaolo Bonzini curlconfig="$pkgconfig libcurl" 15664e2b0658SPaolo Bonzinielse 15674e2b0658SPaolo Bonzini curlconfig=curl-config 15684e2b0658SPaolo Bonzinifi 15694e2b0658SPaolo Bonzini 1570788c8196SJuan Quintelaif test "$curl" != "no" ; then 1571769ce76dSAlexander Graf cat > $TMPC << EOF 1572769ce76dSAlexander Graf#include <curl/curl.h> 1573769ce76dSAlexander Grafint main(void) { return curl_easy_init(); } 1574769ce76dSAlexander GrafEOF 15754e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 15764e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 1577b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 1578769ce76dSAlexander Graf curl=yes 1579f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 1580f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 1581788c8196SJuan Quintela else 1582788c8196SJuan Quintela if test "$curl" = "yes" ; then 1583788c8196SJuan Quintela feature_not_found "curl" 1584788c8196SJuan Quintela fi 1585788c8196SJuan Quintela curl=no 1586769ce76dSAlexander Graf fi 1587769ce76dSAlexander Graffi # test "$curl" 1588769ce76dSAlexander Graf 1589769ce76dSAlexander Graf########################################## 15905495ed11SLuiz Capitulino# check framework probe 15915495ed11SLuiz Capitulino 15925495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then 15935495ed11SLuiz Capitulino cat > $TMPC << EOF 15945495ed11SLuiz Capitulino#include <check.h> 15955495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; } 15965495ed11SLuiz CapitulinoEOF 1597f91672e5SPaolo Bonzini check_libs=`$pkgconfig --libs check` 15985495ed11SLuiz Capitulino if compile_prog "" $check_libs ; then 15995495ed11SLuiz Capitulino check_utests=yes 16005495ed11SLuiz Capitulino libs_tools="$check_libs $libs_tools" 16015495ed11SLuiz Capitulino else 16025495ed11SLuiz Capitulino if test "$check_utests" = "yes" ; then 16035495ed11SLuiz Capitulino feature_not_found "check" 16045495ed11SLuiz Capitulino fi 16055495ed11SLuiz Capitulino check_utests=no 16065495ed11SLuiz Capitulino fi 16075495ed11SLuiz Capitulinofi # test "$check_utests" 16085495ed11SLuiz Capitulino 16095495ed11SLuiz Capitulino########################################## 1610fb599c9aSbalrog# bluez support probe 1611a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 1612e820e3f4Sbalrog cat > $TMPC << EOF 1613e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 1614e820e3f4Sbalrogint main(void) { return bt_error(0); } 1615e820e3f4SbalrogEOF 1616f91672e5SPaolo Bonzini bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null` 1617f91672e5SPaolo Bonzini bluez_libs=`$pkgconfig --libs bluez 2> /dev/null` 161852166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 1619a20a6f46SJuan Quintela bluez=yes 1620e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 1621e820e3f4Sbalrog else 1622a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 1623a20a6f46SJuan Quintela feature_not_found "bluez" 1624a20a6f46SJuan Quintela fi 1625e820e3f4Sbalrog bluez="no" 1626e820e3f4Sbalrog fi 1627fb599c9aSbalrogfi 1628fb599c9aSbalrog 1629fb599c9aSbalrog########################################## 16307ba1e619Saliguori# kvm probe 1631b31a0277SJuan Quintelaif test "$kvm" != "no" ; then 16327ba1e619Saliguori cat > $TMPC <<EOF 16337ba1e619Saliguori#include <linux/kvm.h> 16349fd8d8d7Saliguori#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12 16357ba1e619Saliguori#error Invalid KVM version 16367ba1e619Saliguori#endif 16379fd8d8d7Saliguori#if !defined(KVM_CAP_USER_MEMORY) 16389fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_USER_MEMORY 16399fd8d8d7Saliguori#endif 16409fd8d8d7Saliguori#if !defined(KVM_CAP_SET_TSS_ADDR) 16419fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_SET_TSS_ADDR 16429fd8d8d7Saliguori#endif 16439fd8d8d7Saliguori#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS) 16449fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS 16459fd8d8d7Saliguori#endif 16467ba1e619Saliguoriint main(void) { return 0; } 16477ba1e619SaliguoriEOF 1648eac30262Saliguori if test "$kerneldir" != "" ; then 1649eac30262Saliguori kvm_cflags=-I"$kerneldir"/include 16508444eb6eSaliguori if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \ 16518444eb6eSaliguori -a -d "$kerneldir/arch/x86/include" ; then 16528444eb6eSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include" 1653406b430dSaliguori elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then 1654406b430dSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" 16550e60a699SAlexander Graf elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then 16560e60a699SAlexander Graf kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include" 16578444eb6eSaliguori elif test -d "$kerneldir/arch/$cpu/include" ; then 16588444eb6eSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include" 16598444eb6eSaliguori fi 1660eac30262Saliguori else 1661f038e8f7SStefan Weil kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null` 1662eac30262Saliguori fi 166352166aa0SJuan Quintela if compile_prog "$kvm_cflags" "" ; then 1664b31a0277SJuan Quintela kvm=yes 1665dae5079aSJan Kiszka cat > $TMPC <<EOF 1666dae5079aSJan Kiszka#include <linux/kvm_para.h> 1667dae5079aSJan Kiszkaint main(void) { return 0; } 1668dae5079aSJan KiszkaEOF 1669dae5079aSJan Kiszka if compile_prog "$kvm_cflags" "" ; then 1670dae5079aSJan Kiszka kvm_para=yes 1671dae5079aSJan Kiszka fi 16727ba1e619Saliguori else 1673b31a0277SJuan Quintela if test "$kvm" = "yes" ; then 16740dba6195SLoïc Minier if has awk && has grep; then 1675a558ee17SJuan Quintela kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \ 16769fd8d8d7Saliguori | grep "error: " \ 16779fd8d8d7Saliguori | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` 16789fd8d8d7Saliguori if test "$kvmerr" != "" ; then 1679b31a0277SJuan Quintela echo -e "${kvmerr}\n\ 1680168ccc11SJan Kiszka NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \ 1681168ccc11SJan Kiszka recent kvm-kmod from http://sourceforge.net/projects/kvm." 16829fd8d8d7Saliguori fi 16839fd8d8d7Saliguori fi 1684b31a0277SJuan Quintela feature_not_found "kvm" 1685b31a0277SJuan Quintela fi 1686b31a0277SJuan Quintela kvm=no 16877ba1e619Saliguori fi 16887ba1e619Saliguorifi 16897ba1e619Saliguori 16907ba1e619Saliguori########################################## 1691d5970055SMichael S. Tsirkin# test for vhost net 1692d5970055SMichael S. Tsirkin 1693d5970055SMichael S. Tsirkinif test "$vhost_net" != "no"; then 1694d5970055SMichael S. Tsirkin if test "$kvm" != "no"; then 1695d5970055SMichael S. Tsirkin cat > $TMPC <<EOF 1696d5970055SMichael S. Tsirkin #include <linux/vhost.h> 1697d5970055SMichael S. Tsirkin int main(void) { return 0; } 1698d5970055SMichael S. TsirkinEOF 1699d5970055SMichael S. Tsirkin if compile_prog "$kvm_cflags" "" ; then 1700d5970055SMichael S. Tsirkin vhost_net=yes 1701d5970055SMichael S. Tsirkin else 1702d5970055SMichael S. Tsirkin if test "$vhost_net" = "yes" ; then 1703d5970055SMichael S. Tsirkin feature_not_found "vhost-net" 1704d5970055SMichael S. Tsirkin fi 1705d5970055SMichael S. Tsirkin vhost_net=no 1706d5970055SMichael S. Tsirkin fi 1707d5970055SMichael S. Tsirkin else 1708d5970055SMichael S. Tsirkin if test "$vhost_net" = "yes" ; then 17094021d247SAurelien Jarno echo "NOTE: vhost-net feature requires KVM (--enable-kvm)." 1710d5970055SMichael S. Tsirkin feature_not_found "vhost-net" 1711d5970055SMichael S. Tsirkin fi 1712d5970055SMichael S. Tsirkin vhost_net=no 1713d5970055SMichael S. Tsirkin fi 1714d5970055SMichael S. Tsirkinfi 1715d5970055SMichael S. Tsirkin 1716d5970055SMichael S. Tsirkin########################################## 1717e5d355d1Saliguori# pthread probe 1718de65fe0fSSebastian HerbsztPTHREADLIBS_LIST="-lpthread -lpthreadGC2" 17193c529d93Saliguori 1720e5d355d1Saliguoripthread=no 1721414f0dabSblueswir1cat > $TMPC << EOF 17223c529d93Saliguori#include <pthread.h> 1723de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; } 1724414f0dabSblueswir1EOF 1725bd00d539SAndreas Färberif compile_prog "" "" ; then 1726bd00d539SAndreas Färber pthread=yes 1727bd00d539SAndreas Färberelse 1728de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 172952166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 1730e5d355d1Saliguori pthread=yes 17315572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 1732de65fe0fSSebastian Herbszt break 1733414f0dabSblueswir1 fi 1734de65fe0fSSebastian Herbszt done 1735bd00d539SAndreas Färberfi 1736414f0dabSblueswir1 17374617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 17384dd75c70SChristoph Hellwig echo 17394dd75c70SChristoph Hellwig echo "Error: pthread check failed" 17404dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 17414dd75c70SChristoph Hellwig echo 17424dd75c70SChristoph Hellwig exit 1 1743e5d355d1Saliguorifi 1744e5d355d1Saliguori 1745bf9298b9Saliguori########################################## 17465c6c3a6cSChristoph Hellwig# linux-aio probe 17475c6c3a6cSChristoph Hellwig 17485c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 17495c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 17505c6c3a6cSChristoph Hellwig#include <libaio.h> 17515c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 1752832ce9c2SScott Wood#include <stddef.h> 17535c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 17545c6c3a6cSChristoph HellwigEOF 17555c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 17565c6c3a6cSChristoph Hellwig linux_aio=yes 1757048d179fSPaul Brook libs_softmmu="$libs_softmmu -laio" 1758048d179fSPaul Brook libs_tools="$libs_tools -laio" 17595c6c3a6cSChristoph Hellwig else 17605c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 17615c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 17625c6c3a6cSChristoph Hellwig fi 17633cfcae3cSLuiz Capitulino linux_aio=no 17645c6c3a6cSChristoph Hellwig fi 17655c6c3a6cSChristoph Hellwigfi 17665c6c3a6cSChristoph Hellwig 17675c6c3a6cSChristoph Hellwig########################################## 1768758e8e38SVenkateswararao Jujjuri (JV)# attr probe 1769758e8e38SVenkateswararao Jujjuri (JV) 1770758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 1771758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 1772758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 1773758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 1774758e8e38SVenkateswararao Jujjuri (JV)#include <attr/xattr.h> 1775758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 1776758e8e38SVenkateswararao Jujjuri (JV)EOF 1777758e8e38SVenkateswararao Jujjuri (JV) if compile_prog "" "-lattr" ; then 1778758e8e38SVenkateswararao Jujjuri (JV) attr=yes 1779758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 1780758e8e38SVenkateswararao Jujjuri (JV) else 1781758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 1782758e8e38SVenkateswararao Jujjuri (JV) feature_not_found "ATTR" 1783758e8e38SVenkateswararao Jujjuri (JV) fi 1784758e8e38SVenkateswararao Jujjuri (JV) attr=no 1785758e8e38SVenkateswararao Jujjuri (JV) fi 1786758e8e38SVenkateswararao Jujjuri (JV)fi 1787758e8e38SVenkateswararao Jujjuri (JV) 1788758e8e38SVenkateswararao Jujjuri (JV)########################################## 1789bf9298b9Saliguori# iovec probe 1790bf9298b9Saliguoricat > $TMPC <<EOF 1791db34f0b3Sblueswir1#include <sys/types.h> 1792bf9298b9Saliguori#include <sys/uio.h> 1793db34f0b3Sblueswir1#include <unistd.h> 1794bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; } 1795bf9298b9SaliguoriEOF 1796bf9298b9Saliguoriiovec=no 179752166aa0SJuan Quintelaif compile_prog "" "" ; then 1798bf9298b9Saliguori iovec=yes 1799bf9298b9Saliguorifi 1800bf9298b9Saliguori 1801f652e6afSaurel32########################################## 1802ceb42de8Saliguori# preadv probe 1803ceb42de8Saliguoricat > $TMPC <<EOF 1804ceb42de8Saliguori#include <sys/types.h> 1805ceb42de8Saliguori#include <sys/uio.h> 1806ceb42de8Saliguori#include <unistd.h> 1807ceb42de8Saliguoriint main(void) { preadv; } 1808ceb42de8SaliguoriEOF 1809ceb42de8Saliguoripreadv=no 181052166aa0SJuan Quintelaif compile_prog "" "" ; then 1811ceb42de8Saliguori preadv=yes 1812ceb42de8Saliguorifi 1813ceb42de8Saliguori 1814ceb42de8Saliguori########################################## 1815f652e6afSaurel32# fdt probe 18162df87df7SJuan Quintelaif test "$fdt" != "no" ; then 1817b41af4baSJuan Quintela fdt_libs="-lfdt" 1818f652e6afSaurel32 cat > $TMPC << EOF 1819f652e6afSaurel32int main(void) { return 0; } 1820f652e6afSaurel32EOF 182152166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 1822f652e6afSaurel32 fdt=yes 1823e4782985SJuan Quintela libs_softmmu="$fdt_libs $libs_softmmu" 18242df87df7SJuan Quintela else 18252df87df7SJuan Quintela if test "$fdt" = "yes" ; then 18262df87df7SJuan Quintela feature_not_found "fdt" 18272df87df7SJuan Quintela fi 18282df87df7SJuan Quintela fdt=no 1829f652e6afSaurel32 fi 1830f652e6afSaurel32fi 1831f652e6afSaurel32 18323b3f24adSaurel32# 18333b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 18343b3f24adSaurel32# emulator. This is done because older glibc versions don't 18353b3f24adSaurel32# have syscall stubs for these implemented. 18363b3f24adSaurel32# 18373b3f24adSaurel32atfile=no 18383b3f24adSaurel32cat > $TMPC << EOF 18393b3f24adSaurel32#define _ATFILE_SOURCE 18403b3f24adSaurel32#include <sys/types.h> 18413b3f24adSaurel32#include <fcntl.h> 18423b3f24adSaurel32#include <unistd.h> 18433b3f24adSaurel32 18443b3f24adSaurel32int 18453b3f24adSaurel32main(void) 18463b3f24adSaurel32{ 18473b3f24adSaurel32 /* try to unlink nonexisting file */ 18483b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 18493b3f24adSaurel32} 18503b3f24adSaurel32EOF 185152166aa0SJuan Quintelaif compile_prog "" "" ; then 18523b3f24adSaurel32 atfile=yes 18533b3f24adSaurel32fi 18543b3f24adSaurel32 185539386ac7Saurel32# Check for inotify functions when we are building linux-user 18563b3f24adSaurel32# emulator. This is done because older glibc versions don't 18573b3f24adSaurel32# have syscall stubs for these implemented. In that case we 18583b3f24adSaurel32# don't provide them even if kernel supports them. 18593b3f24adSaurel32# 18603b3f24adSaurel32inotify=no 18613b3f24adSaurel32cat > $TMPC << EOF 18623b3f24adSaurel32#include <sys/inotify.h> 18633b3f24adSaurel32 18643b3f24adSaurel32int 18653b3f24adSaurel32main(void) 18663b3f24adSaurel32{ 18673b3f24adSaurel32 /* try to start inotify */ 18688690e420Saurel32 return inotify_init(); 18693b3f24adSaurel32} 18703b3f24adSaurel32EOF 187152166aa0SJuan Quintelaif compile_prog "" "" ; then 18723b3f24adSaurel32 inotify=yes 18733b3f24adSaurel32fi 18743b3f24adSaurel32 1875c05c7a73SRiku Voipioinotify1=no 1876c05c7a73SRiku Voipiocat > $TMPC << EOF 1877c05c7a73SRiku Voipio#include <sys/inotify.h> 1878c05c7a73SRiku Voipio 1879c05c7a73SRiku Voipioint 1880c05c7a73SRiku Voipiomain(void) 1881c05c7a73SRiku Voipio{ 1882c05c7a73SRiku Voipio /* try to start inotify */ 1883c05c7a73SRiku Voipio return inotify_init1(0); 1884c05c7a73SRiku Voipio} 1885c05c7a73SRiku VoipioEOF 1886c05c7a73SRiku Voipioif compile_prog "" "" ; then 1887c05c7a73SRiku Voipio inotify1=yes 1888c05c7a73SRiku Voipiofi 1889c05c7a73SRiku Voipio 1890ebc996f3SRiku Voipio# check if utimensat and futimens are supported 1891ebc996f3SRiku Voipioutimens=no 1892ebc996f3SRiku Voipiocat > $TMPC << EOF 1893ebc996f3SRiku Voipio#define _ATFILE_SOURCE 1894ebc996f3SRiku Voipio#include <stddef.h> 1895ebc996f3SRiku Voipio#include <fcntl.h> 1896ebc996f3SRiku Voipio 1897ebc996f3SRiku Voipioint main(void) 1898ebc996f3SRiku Voipio{ 1899ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 1900ebc996f3SRiku Voipio futimens(0, NULL); 1901ebc996f3SRiku Voipio return 0; 1902ebc996f3SRiku Voipio} 1903ebc996f3SRiku VoipioEOF 190452166aa0SJuan Quintelaif compile_prog "" "" ; then 1905ebc996f3SRiku Voipio utimens=yes 1906ebc996f3SRiku Voipiofi 1907ebc996f3SRiku Voipio 1908099d6b0fSRiku Voipio# check if pipe2 is there 1909099d6b0fSRiku Voipiopipe2=no 1910099d6b0fSRiku Voipiocat > $TMPC << EOF 1911099d6b0fSRiku Voipio#include <unistd.h> 1912099d6b0fSRiku Voipio#include <fcntl.h> 1913099d6b0fSRiku Voipio 1914099d6b0fSRiku Voipioint main(void) 1915099d6b0fSRiku Voipio{ 1916099d6b0fSRiku Voipio int pipefd[2]; 1917099d6b0fSRiku Voipio pipe2(pipefd, O_CLOEXEC); 1918099d6b0fSRiku Voipio return 0; 1919099d6b0fSRiku Voipio} 1920099d6b0fSRiku VoipioEOF 192152166aa0SJuan Quintelaif compile_prog "" "" ; then 1922099d6b0fSRiku Voipio pipe2=yes 1923099d6b0fSRiku Voipiofi 1924099d6b0fSRiku Voipio 192540ff6d7eSKevin Wolf# check if accept4 is there 192640ff6d7eSKevin Wolfaccept4=no 192740ff6d7eSKevin Wolfcat > $TMPC << EOF 192840ff6d7eSKevin Wolf#include <sys/socket.h> 192940ff6d7eSKevin Wolf#include <stddef.h> 193040ff6d7eSKevin Wolf 193140ff6d7eSKevin Wolfint main(void) 193240ff6d7eSKevin Wolf{ 193340ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 193440ff6d7eSKevin Wolf return 0; 193540ff6d7eSKevin Wolf} 193640ff6d7eSKevin WolfEOF 193740ff6d7eSKevin Wolfif compile_prog "" "" ; then 193840ff6d7eSKevin Wolf accept4=yes 193940ff6d7eSKevin Wolffi 194040ff6d7eSKevin Wolf 19413ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 19423ce34dfbSvibisreenivasansplice=no 19433ce34dfbSvibisreenivasancat > $TMPC << EOF 19443ce34dfbSvibisreenivasan#include <unistd.h> 19453ce34dfbSvibisreenivasan#include <fcntl.h> 19463ce34dfbSvibisreenivasan#include <limits.h> 19473ce34dfbSvibisreenivasan 19483ce34dfbSvibisreenivasanint main(void) 19493ce34dfbSvibisreenivasan{ 19503ce34dfbSvibisreenivasan int len, fd; 19513ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 19523ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 19533ce34dfbSvibisreenivasan return 0; 19543ce34dfbSvibisreenivasan} 19553ce34dfbSvibisreenivasanEOF 195652166aa0SJuan Quintelaif compile_prog "" "" ; then 19573ce34dfbSvibisreenivasan splice=yes 19583ce34dfbSvibisreenivasanfi 19593ce34dfbSvibisreenivasan 1960*dcc38d1cSMarcelo Tosatti########################################## 1961*dcc38d1cSMarcelo Tosatti# signalfd probe 1962*dcc38d1cSMarcelo Tosattisignalfd="no" 1963*dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 1964*dcc38d1cSMarcelo Tosatti#define _GNU_SOURCE 1965*dcc38d1cSMarcelo Tosatti#include <unistd.h> 1966*dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 1967*dcc38d1cSMarcelo Tosatti#include <signal.h> 1968*dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 1969*dcc38d1cSMarcelo TosattiEOF 1970*dcc38d1cSMarcelo Tosatti 1971*dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 1972*dcc38d1cSMarcelo Tosatti signalfd=yes 1973*dcc38d1cSMarcelo Tosattifi 1974*dcc38d1cSMarcelo Tosatti 1975c2882b96SRiku Voipio# check if eventfd is supported 1976c2882b96SRiku Voipioeventfd=no 1977c2882b96SRiku Voipiocat > $TMPC << EOF 1978c2882b96SRiku Voipio#include <sys/eventfd.h> 1979c2882b96SRiku Voipio 1980c2882b96SRiku Voipioint main(void) 1981c2882b96SRiku Voipio{ 1982c2882b96SRiku Voipio int efd = eventfd(0, 0); 1983c2882b96SRiku Voipio return 0; 1984c2882b96SRiku Voipio} 1985c2882b96SRiku VoipioEOF 1986c2882b96SRiku Voipioif compile_prog "" "" ; then 1987c2882b96SRiku Voipio eventfd=yes 1988c2882b96SRiku Voipiofi 1989c2882b96SRiku Voipio 1990d0927938SUlrich Hecht# check for fallocate 1991d0927938SUlrich Hechtfallocate=no 1992d0927938SUlrich Hechtcat > $TMPC << EOF 1993d0927938SUlrich Hecht#include <fcntl.h> 1994d0927938SUlrich Hecht 1995d0927938SUlrich Hechtint main(void) 1996d0927938SUlrich Hecht{ 1997d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 1998d0927938SUlrich Hecht return 0; 1999d0927938SUlrich Hecht} 2000d0927938SUlrich HechtEOF 2001be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then 2002d0927938SUlrich Hecht fallocate=yes 2003d0927938SUlrich Hechtfi 2004d0927938SUlrich Hecht 2005d0927938SUlrich Hecht# check for dup3 2006d0927938SUlrich Hechtdup3=no 2007d0927938SUlrich Hechtcat > $TMPC << EOF 2008d0927938SUlrich Hecht#include <unistd.h> 2009d0927938SUlrich Hecht 2010d0927938SUlrich Hechtint main(void) 2011d0927938SUlrich Hecht{ 2012d0927938SUlrich Hecht dup3(0, 0, 0); 2013d0927938SUlrich Hecht return 0; 2014d0927938SUlrich Hecht} 2015d0927938SUlrich HechtEOF 201678f5d726SJan Kiszkaif compile_prog "" "" ; then 2017d0927938SUlrich Hecht dup3=yes 2018d0927938SUlrich Hechtfi 2019d0927938SUlrich Hecht 2020cc8ae6deSpbrook# Check if tools are available to build documentation. 2021a25dba17SJuan Quintelaif test "$docs" != "no" ; then 202201668d98SStefan Weil if has makeinfo && has pod2man; then 2023a25dba17SJuan Quintela docs=yes 202483a3ab8bSJuan Quintela else 2025a25dba17SJuan Quintela if test "$docs" = "yes" ; then 2026a25dba17SJuan Quintela feature_not_found "docs" 202783a3ab8bSJuan Quintela fi 2028a25dba17SJuan Quintela docs=no 202983a3ab8bSJuan Quintela fi 2030cc8ae6deSpbrookfi 2031cc8ae6deSpbrook 2032f514f41cSStefan Weil# Search for bswap_32 function 20336ae9a1f4SJuan Quintelabyteswap_h=no 20346ae9a1f4SJuan Quintelacat > $TMPC << EOF 20356ae9a1f4SJuan Quintela#include <byteswap.h> 20366ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 20376ae9a1f4SJuan QuintelaEOF 203852166aa0SJuan Quintelaif compile_prog "" "" ; then 20396ae9a1f4SJuan Quintela byteswap_h=yes 20406ae9a1f4SJuan Quintelafi 20416ae9a1f4SJuan Quintela 2042f514f41cSStefan Weil# Search for bswap_32 function 20436ae9a1f4SJuan Quintelabswap_h=no 20446ae9a1f4SJuan Quintelacat > $TMPC << EOF 20456ae9a1f4SJuan Quintela#include <sys/endian.h> 20466ae9a1f4SJuan Quintela#include <sys/types.h> 20476ae9a1f4SJuan Quintela#include <machine/bswap.h> 20486ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 20496ae9a1f4SJuan QuintelaEOF 205052166aa0SJuan Quintelaif compile_prog "" "" ; then 20516ae9a1f4SJuan Quintela bswap_h=yes 20526ae9a1f4SJuan Quintelafi 20536ae9a1f4SJuan Quintela 2054da93a1fdSaliguori########################################## 2055da93a1fdSaliguori# Do we need librt 2056da93a1fdSaliguoricat > $TMPC <<EOF 2057da93a1fdSaliguori#include <signal.h> 2058da93a1fdSaliguori#include <time.h> 2059da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); } 2060da93a1fdSaliguoriEOF 2061da93a1fdSaliguori 206252166aa0SJuan Quintelaif compile_prog "" "" ; then 206307ffa4bdSJuan Quintela : 206452166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then 206507ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 2066da93a1fdSaliguorifi 2067da93a1fdSaliguori 206831ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 2069179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 20706362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 20716362a53fSJuan Quintelafi 20726362a53fSJuan Quintela 2073de5071c5SBlue Swirl########################################## 2074de5071c5SBlue Swirl# check if the compiler defines offsetof 2075de5071c5SBlue Swirl 2076de5071c5SBlue Swirlneed_offsetof=yes 2077de5071c5SBlue Swirlcat > $TMPC << EOF 2078de5071c5SBlue Swirl#include <stddef.h> 2079de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); } 2080de5071c5SBlue SwirlEOF 2081de5071c5SBlue Swirlif compile_prog "" "" ; then 2082de5071c5SBlue Swirl need_offsetof=no 2083de5071c5SBlue Swirlfi 2084de5071c5SBlue Swirl 20855f6b9e8fSBlue Swirl########################################## 2086747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result 2087747bbdf7SBlue Swirl# 2088747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning 2089747bbdf7SBlue Swirl# about attribute warn_unused_result 2090747bbdf7SBlue Swirl 2091747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no 2092747bbdf7SBlue Swirlcat > $TMPC << EOF 2093747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4) 2094747bbdf7SBlue Swirl#error gcc 3.3 or older 2095747bbdf7SBlue Swirl#endif 2096747bbdf7SBlue Swirlint main(void) { return 0;} 2097747bbdf7SBlue SwirlEOF 2098747bbdf7SBlue Swirlif compile_prog "" ""; then 2099747bbdf7SBlue Swirl gcc_attribute_warn_unused_result=yes 2100747bbdf7SBlue Swirlfi 2101747bbdf7SBlue Swirl 2102cd4ec0b4SGerd Hoffmann# spice probe 2103cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 2104cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 2105cd4ec0b4SGerd Hoffmann#include <spice.h> 2106cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 2107cd4ec0b4SGerd HoffmannEOF 2108cd4ec0b4SGerd Hoffmann spice_cflags=$($pkgconfig --cflags spice-protocol spice-server 2>/dev/null) 2109cd4ec0b4SGerd Hoffmann spice_libs=$($pkgconfig --libs spice-protocol spice-server 2>/dev/null) 2110ba807829SStefan Weil if $pkgconfig --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \ 2111cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 2112cd4ec0b4SGerd Hoffmann spice="yes" 2113cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 2114cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 2115cd4ec0b4SGerd Hoffmann else 2116cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 2117cd4ec0b4SGerd Hoffmann feature_not_found "spice" 2118cd4ec0b4SGerd Hoffmann fi 2119cd4ec0b4SGerd Hoffmann spice="no" 2120cd4ec0b4SGerd Hoffmann fi 2121cd4ec0b4SGerd Hoffmannfi 2122cd4ec0b4SGerd Hoffmann 2123cd4ec0b4SGerd Hoffmann########################################## 2124cd4ec0b4SGerd Hoffmann 2125747bbdf7SBlue Swirl########################################## 21265f6b9e8fSBlue Swirl# check if we have fdatasync 21275f6b9e8fSBlue Swirl 21285f6b9e8fSBlue Swirlfdatasync=no 21295f6b9e8fSBlue Swirlcat > $TMPC << EOF 21305f6b9e8fSBlue Swirl#include <unistd.h> 21315f6b9e8fSBlue Swirlint main(void) { return fdatasync(0); } 21325f6b9e8fSBlue SwirlEOF 21335f6b9e8fSBlue Swirlif compile_prog "" "" ; then 21345f6b9e8fSBlue Swirl fdatasync=yes 21355f6b9e8fSBlue Swirlfi 21365f6b9e8fSBlue Swirl 213794a420b1SStefan Hajnoczi########################################## 2138e78815a5SAndreas Färber# check if we have madvise 2139e78815a5SAndreas Färber 2140e78815a5SAndreas Färbermadvise=no 2141e78815a5SAndreas Färbercat > $TMPC << EOF 2142e78815a5SAndreas Färber#include <sys/types.h> 2143e78815a5SAndreas Färber#include <sys/mman.h> 2144832ce9c2SScott Wood#include <stddef.h> 2145e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 2146e78815a5SAndreas FärberEOF 2147e78815a5SAndreas Färberif compile_prog "" "" ; then 2148e78815a5SAndreas Färber madvise=yes 2149e78815a5SAndreas Färberfi 2150e78815a5SAndreas Färber 2151e78815a5SAndreas Färber########################################## 2152e78815a5SAndreas Färber# check if we have posix_madvise 2153e78815a5SAndreas Färber 2154e78815a5SAndreas Färberposix_madvise=no 2155e78815a5SAndreas Färbercat > $TMPC << EOF 2156e78815a5SAndreas Färber#include <sys/mman.h> 2157832ce9c2SScott Wood#include <stddef.h> 2158e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 2159e78815a5SAndreas FärberEOF 2160e78815a5SAndreas Färberif compile_prog "" "" ; then 2161e78815a5SAndreas Färber posix_madvise=yes 2162e78815a5SAndreas Färberfi 2163e78815a5SAndreas Färber 2164e78815a5SAndreas Färber########################################## 216594a420b1SStefan Hajnoczi# check if trace backend exists 216694a420b1SStefan Hajnoczi 216794a420b1SStefan Hajnoczish "$source_path/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null 216894a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 216994a420b1SStefan Hajnoczi echo 217094a420b1SStefan Hajnoczi echo "Error: invalid trace backend" 217194a420b1SStefan Hajnoczi echo "Please choose a supported trace backend." 217294a420b1SStefan Hajnoczi echo 217394a420b1SStefan Hajnoczi exit 1 217494a420b1SStefan Hajnoczifi 217594a420b1SStefan Hajnoczi 21767e24e92aSStefan Hajnoczi########################################## 21777e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 21787e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 21797e24e92aSStefan Hajnoczi cat > $TMPC << EOF 21807e24e92aSStefan Hajnoczi#include <ust/tracepoint.h> 21817e24e92aSStefan Hajnoczi#include <ust/marker.h> 21827e24e92aSStefan Hajnocziint main(void) { return 0; } 21837e24e92aSStefan HajnocziEOF 21847e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 21857e24e92aSStefan Hajnoczi LIBS="-lust $LIBS" 21867e24e92aSStefan Hajnoczi else 21877e24e92aSStefan Hajnoczi echo 21887e24e92aSStefan Hajnoczi echo "Error: Trace backend 'ust' missing libust header files" 21897e24e92aSStefan Hajnoczi echo 21907e24e92aSStefan Hajnoczi exit 1 21917e24e92aSStefan Hajnoczi fi 21927e24e92aSStefan Hajnoczifi 21937e24e92aSStefan Hajnoczi########################################## 2194e86ecd4bSJuan Quintela# End of CC checks 2195e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 2196e86ecd4bSJuan Quintela 2197e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 21981156c669SJuan Quintela CFLAGS="-O2 $CFLAGS" 2199e86ecd4bSJuan Quintelafi 2200a316e378SJuan Quintela 2201e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror 2202e86ecd4bSJuan Quintela# by default. Only enable by default for git builds 2203e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION` 220420ff6c80SAnthony Liguori 220520ff6c80SAnthony Liguoriif test -z "$werror" ; then 2206e86ecd4bSJuan Quintela if test "$z_version" = "50" -a \ 2207e86ecd4bSJuan Quintela "$linux" = "yes" ; then 2208e86ecd4bSJuan Quintela werror="yes" 2209e86ecd4bSJuan Quintela else 2210e86ecd4bSJuan Quintela werror="no" 2211e86ecd4bSJuan Quintela fi 2212e86ecd4bSJuan Quintelafi 2213e86ecd4bSJuan Quintela 221420ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 221520ff6c80SAnthony Liguori# enable/disable 221620ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 221720ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 221820ff6c80SAnthony Liguori zero_malloc="no" 221920ff6c80SAnthony Liguori else 222020ff6c80SAnthony Liguori zero_malloc="yes" 222120ff6c80SAnthony Liguori fi 222220ff6c80SAnthony Liguorifi 222320ff6c80SAnthony Liguori 2224e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then 2225a558ee17SJuan Quintela QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 2226e86ecd4bSJuan Quintelafi 2227e86ecd4bSJuan Quintela 2228e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 2229e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 22301156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 2231e86ecd4bSJuan Quintela fi 2232e86ecd4bSJuan Quintelafi 2233e86ecd4bSJuan Quintela 2234952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 2235952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 2236952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 2237952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 2238952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 2239952afb71SBlue Swirl fi 2240952afb71SBlue Swirl done 2241952afb71SBlue Swirlfi 2242952afb71SBlue Swirl 2243190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix 22445a67135aSbellard 2245ca35f780SPaolo Bonzinitools= 2246ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then 2247ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 2248ca35f780SPaolo Bonzini if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 2249ca35f780SPaolo Bonzini tools="qemu-nbd\$(EXESUF) $tools" 2250ca35f780SPaolo Bonzini if [ "$check_utests" = "yes" ]; then 2251ca35f780SPaolo Bonzini tools="check-qint check-qstring check-qdict check-qlist $tools" 2252ca35f780SPaolo Bonzini tools="check-qfloat check-qjson $tools" 2253ca35f780SPaolo Bonzini fi 2254ca35f780SPaolo Bonzini fi 2255ca35f780SPaolo Bonzinifi 2256ca35f780SPaolo Bonzini 2257ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 2258ca35f780SPaolo Bonziniroms= 2259ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 2260ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 2261ca35f780SPaolo Bonzini "$softmmu" = yes ; then 2262ca35f780SPaolo Bonzini roms="optionrom" 2263ca35f780SPaolo Bonzinifi 2264ca35f780SPaolo Bonzini 2265ca35f780SPaolo Bonzini 22667d13299dSbellardecho "Install prefix $prefix" 2267f2b9e1e3SPaolo Bonziniecho "BIOS directory `eval echo $datadir`" 2268f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 22691c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 227011d9f695Sbellardif test "$mingw32" = "no" ; then 2271f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 227243ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 227311d9f695Sbellardfi 22745a67135aSbellardecho "Source path $source_path" 22757d13299dSbellardecho "C compiler $cc" 227683469015Sbellardecho "Host C compiler $host_cc" 22770c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 2278a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 22790c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 22807d13299dSbellardecho "make $make" 22816a882643Spbrookecho "install $install" 2282a98fd896Sbellardecho "host CPU $cpu" 2283de83cd02Sbellardecho "host big endian $bigendian" 228497a847bcSbellardecho "target list $target_list" 2285ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 2286b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon" 22877d13299dSbellardecho "gprof enabled $gprof" 228803b4fe7dSaliguoriecho "sparse enabled $sparse" 22891625af87Saliguoriecho "strip binaries $strip_opt" 229005c2a3e7Sbellardecho "profiler $profiler" 229143ce4dfeSbellardecho "static build $static" 229285aa5189Sbellardecho "-Werror enabled $werror" 22935b0753e0Sbellardif test "$darwin" = "yes" ; then 22945b0753e0Sbellard echo "Cocoa support $cocoa" 22955b0753e0Sbellardfi 229697a847bcSbellardecho "SDL support $sdl" 22974d3b6f6eSbalrogecho "curses support $curses" 2298769ce76dSAlexander Grafecho "curl support $curl" 22995495ed11SLuiz Capitulinoecho "check support $check_utests" 230067b915a5Sbellardecho "mingw32 support $mingw32" 23010c58ac1cSmalcecho "Audio drivers $audio_drv_list" 23020c58ac1cSmalcecho "Extra audio cards $audio_card_list" 2303eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 23048ff9cbf7Smalcecho "Mixer emulation $mixemu" 23058d5d2d4cSthsecho "VNC TLS support $vnc_tls" 23062f9606b3Saliguoriecho "VNC SASL support $vnc_sasl" 23072f6f5c7aSCorentin Charyecho "VNC JPEG support $vnc_jpeg" 2308efe556adSCorentin Charyecho "VNC PNG support $vnc_png" 2309bd023f95SCorentin Charyecho "VNC thread $vnc_thread" 23103142255cSblueswir1if test -n "$sparc_cpu"; then 23113142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 23123142255cSblueswir1fi 2313e37630caSaliguoriecho "xen support $xen" 23142e4d9fb1Saurel32echo "brlapi support $brlapi" 2315a20a6f46SJuan Quintelaecho "bluez support $bluez" 2316a25dba17SJuan Quintelaecho "Documentation $docs" 2317c5937220Spbrook[ ! -z "$uname_release" ] && \ 2318c5937220Spbrookecho "uname -r $uname_release" 2319bd0c5661Spbrookecho "NPTL support $nptl" 2320379f6698SPaul Brookecho "GUEST_BASE $guest_base" 232134005a00SKirill A. Shutemovecho "PIE user targets $user_pie" 23228a16d273Sthsecho "vde support $vde" 2323e5d355d1Saliguoriecho "IO thread $io_thread" 23245c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 2325758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 232677755340Sthsecho "Install blobs $blobs" 2327b31a0277SJuan Quintelaecho "KVM support $kvm" 2328f652e6afSaurel32echo "fdt support $fdt" 2329ceb42de8Saliguoriecho "preadv support $preadv" 23305f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 2331e78815a5SAndreas Färberecho "madvise $madvise" 2332e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 2333ee682d27SStefan Weilecho "uuid support $uuid" 2334d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 233594a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 23369410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 2337cd4ec0b4SGerd Hoffmannecho "spice support $spice" 233867b915a5Sbellard 233997a847bcSbellardif test $sdl_too_old = "yes"; then 234024b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 2341e8cd23deSbellardfi 234297a847bcSbellard 234398ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 23444bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 234597a847bcSbellard 234698ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 234798ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 234898ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 234998ec69acSJuan Quintelaecho >> $config_host_mak 235098ec69acSJuan Quintela 235199d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 235299d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 235399d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 235499d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak 235599d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 235699d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak 23571dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak 2358804edf29SJuan Quintela 23592408a527Saurel32case "$cpu" in 236024e804ecSAlexander Graf i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 2361e0da9dd3SJuan Quintela ARCH=$cpu 23622408a527Saurel32 ;; 2363a302c32dSLaurent Desnogues armv4b|armv4l) 236416dbd14fSJuan Quintela ARCH=arm 23652408a527Saurel32 ;; 23662408a527Saurel32esac 236798ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 2368f8393946Saurel32if test "$debug_tcg" = "yes" ; then 23692358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 2370f8393946Saurel32fi 2371b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then 2372b4475aa2SLuiz Capitulino echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak 2373b4475aa2SLuiz Capitulinofi 2374f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 23752358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 2376f3d08ee6SPaul Brookfi 23771625af87Saliguoriif test "$strip_opt" = "yes" ; then 237852ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 23791625af87Saliguorifi 23807d13299dSbellardif test "$bigendian" = "yes" ; then 2381e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 238297a847bcSbellardfi 23832358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak 238467b915a5Sbellardif test "$mingw32" = "yes" ; then 238598ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 23869fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 23879fe6de94SBlue Swirl version_major=${rc_version%%.*} 23889fe6de94SBlue Swirl rc_version=${rc_version#*.} 23899fe6de94SBlue Swirl version_minor=${rc_version%%.*} 23909fe6de94SBlue Swirl rc_version=${rc_version#*.} 23919fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 23929fe6de94SBlue Swirl version_micro=0 23939fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 23949fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 2395210fa556Spbrookelse 239635f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 2397210fa556Spbrookfi 2398128ab2ffSblueswir1 2399dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 2400dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 2401dffcb71cSMark McLoughlinfi 2402dffcb71cSMark McLoughlin 240383fb7adfSbellardif test "$darwin" = "yes" ; then 240498ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 240583fb7adfSbellardfi 2406b29fe3edSmalc 2407b29fe3edSmalcif test "$aix" = "yes" ; then 240898ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 2409b29fe3edSmalcfi 2410b29fe3edSmalc 2411ec530c81Sbellardif test "$solaris" = "yes" ; then 241298ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 24132358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 24140475a5caSths if test "$needs_libsunmath" = "yes" ; then 241575b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 24160475a5caSths fi 2417ec530c81Sbellardfi 2418179cf400SAndreas Färberif test "$haiku" = "yes" ; then 2419179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 2420179cf400SAndreas Färberfi 242197a847bcSbellardif test "$static" = "yes" ; then 242298ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 242397a847bcSbellardfi 242405c2a3e7Sbellardif test $profiler = "yes" ; then 24252358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 242605c2a3e7Sbellardfi 2427c20709aaSbellardif test "$slirp" = "yes" ; then 242898ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 2429b6e31c12SJuan Quintela QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS" 2430c20709aaSbellardfi 24318a16d273Sthsif test "$vde" = "yes" ; then 243298ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 24338a16d273Sthsfi 24340c58ac1cSmalcfor card in $audio_card_list; do 2435f6e5889eSpbrook def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` 243698ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 24370c58ac1cSmalcdone 24382358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 24390c58ac1cSmalcfor drv in $audio_drv_list; do 2440f6e5889eSpbrook def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` 244198ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 2442923e4521Smalc if test "$drv" = "fmod"; then 24437aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 2444fb065187Sbellard fi 24450c58ac1cSmalcdone 244667f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 244767f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 244867f86e8eSJuan Quintelafi 2449d5631638Smalcif test "$audio_win_int" = "yes" ; then 2450d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 2451d5631638Smalcfi 2452eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 24538ff9cbf7Smalcif test "$mixemu" = "yes" ; then 245498ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 24558ff9cbf7Smalcfi 24568d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 245798ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 2458525061bfSJuan Quintela echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak 24598d5d2d4cSthsfi 24602f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 246198ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 246260ddf533SJuan Quintela echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak 24632f9606b3Saliguorifi 246496763cf9SCorentin Charyif test "$vnc_jpeg" != "no" ; then 24652f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 24662f6f5c7aSCorentin Chary echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak 24672f6f5c7aSCorentin Charyfi 246896763cf9SCorentin Charyif test "$vnc_png" != "no" ; then 2469efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 2470efe556adSCorentin Chary echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak 2471efe556adSCorentin Charyfi 247296763cf9SCorentin Charyif test "$vnc_thread" != "no" ; then 2473bd023f95SCorentin Chary echo "CONFIG_VNC_THREAD=y" >> $config_host_mak 2474bd023f95SCorentin Chary echo "CONFIG_THREAD=y" >> $config_host_mak 2475bd023f95SCorentin Charyfi 247676655d6dSaliguoriif test "$fnmatch" = "yes" ; then 24772358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 247876655d6dSaliguorifi 2479ee682d27SStefan Weilif test "$uuid" = "yes" ; then 2480ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 2481ee682d27SStefan Weilfi 2482b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 248398ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 24842358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 248598ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 248698ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 2487a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 248898ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 2489cc8ae6deSpbrookfi 24901ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 249198ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 24928ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 249349ecc3faSbellardfi 249449ecc3faSbellardif test "$cocoa" = "yes" ; then 249598ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 249649ecc3faSbellardfi 24974d3b6f6eSbalrogif test "$curses" = "yes" ; then 249898ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 2499ab4e5602SJan Kiszkafi 25003b3f24adSaurel32if test "$atfile" = "yes" ; then 25012358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 25023b3f24adSaurel32fi 2503ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 25042358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 2505ebc996f3SRiku Voipiofi 2506099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 25072358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 2508099d6b0fSRiku Voipiofi 250940ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 251040ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 251140ff6d7eSKevin Wolffi 25123ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 25132358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 25143ce34dfbSvibisreenivasanfi 2515c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 2516c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 2517c2882b96SRiku Voipiofi 2518d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 2519d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 2520d0927938SUlrich Hechtfi 2521d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 2522d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 2523d0927938SUlrich Hechtfi 25243b3f24adSaurel32if test "$inotify" = "yes" ; then 25252358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 25263b3f24adSaurel32fi 2527c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 2528c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 2529c05c7a73SRiku Voipiofi 25306ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 25316ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 25326ae9a1f4SJuan Quintelafi 25336ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 25346ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 25356ae9a1f4SJuan Quintelafi 2536769ce76dSAlexander Grafif test "$curl" = "yes" ; then 253798ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 2538b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 2539769ce76dSAlexander Graffi 25402e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 254198ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 25422e4d9fb1Saurel32fi 2543fb599c9aSbalrogif test "$bluez" = "yes" ; then 254498ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 2545ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 2546fb599c9aSbalrogfi 2547e37630caSaliguoriif test "$xen" = "yes" ; then 25485647eb74SJuan Quintela echo "CONFIG_XEN=y" >> $config_host_mak 2549e37630caSaliguorifi 2550e5d355d1Saliguoriif test "$io_thread" = "yes" ; then 255198ec69acSJuan Quintela echo "CONFIG_IOTHREAD=y" >> $config_host_mak 2552bd023f95SCorentin Chary echo "CONFIG_THREAD=y" >> $config_host_mak 2553e5d355d1Saliguorifi 25545c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 25555c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 25565c6c3a6cSChristoph Hellwigfi 2557758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 2558758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 2559758e8e38SVenkateswararao Jujjuri (JV)fi 2560758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then 2561758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 2562758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 2563758e8e38SVenkateswararao Jujjuri (JV) fi 2564758e8e38SVenkateswararao Jujjuri (JV)fi 256577755340Sthsif test "$blobs" = "yes" ; then 256698ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 256777755340Sthsfi 2568bf9298b9Saliguoriif test "$iovec" = "yes" ; then 25692358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 2570bf9298b9Saliguorifi 2571ceb42de8Saliguoriif test "$preadv" = "yes" ; then 25722358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 2573ceb42de8Saliguorifi 2574f652e6afSaurel32if test "$fdt" = "yes" ; then 25753f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 2576f652e6afSaurel32fi 2577*dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 2578*dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 2579*dcc38d1cSMarcelo Tosattifi 2580de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then 2581de5071c5SBlue Swirl echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak 2582de5071c5SBlue Swirlfi 2583747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then 2584747bbdf7SBlue Swirl echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak 2585747bbdf7SBlue Swirlfi 25865f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 25875f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 25885f6b9e8fSBlue Swirlfi 2589e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 2590e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 2591e78815a5SAndreas Färberfi 2592e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 2593e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 2594e78815a5SAndreas Färberfi 259597a847bcSbellard 2596cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 2597cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 2598cd4ec0b4SGerd Hoffmannfi 2599cd4ec0b4SGerd Hoffmann 260083fb7adfSbellard# XXX: suppress that 26017d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 26022358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 26037d3505c5Sbellardfi 26047d3505c5Sbellard 26052358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 2606c5937220Spbrook 260720ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 260820ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 260920ff6c80SAnthony Liguorifi 261020ff6c80SAnthony Liguori 261168063649Sblueswir1# USB host support 261268063649Sblueswir1case "$usb" in 261368063649Sblueswir1linux) 261498ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 261568063649Sblueswir1;; 261668063649Sblueswir1bsd) 261798ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 261868063649Sblueswir1;; 261968063649Sblueswir1*) 262098ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 262168063649Sblueswir1;; 262268063649Sblueswir1esac 262368063649Sblueswir1 262494a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 262522890ab5SPrerna Saxenaif test "$trace_backend" = "simple"; then 262622890ab5SPrerna Saxena echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak 262722890ab5SPrerna Saxenafi 26289410b56cSPrerna Saxena# Set the appropriate trace file. 26299410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 26309410b56cSPrerna Saxena trace_file="\"$trace_file-%u\"" 26319410b56cSPrerna Saxenafi 26329410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 26339410b56cSPrerna Saxena 263498ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 263598ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 2636804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 2637804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 2638804edf29SJuan Quintelaecho "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak 2639804edf29SJuan Quintelaecho "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak 2640804edf29SJuan Quintelaecho "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak 2641804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 2642804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 2643804edf29SJuan Quintelaif test "$sparse" = "yes" ; then 2644804edf29SJuan Quintela echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 2645804edf29SJuan Quintela echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 2646a558ee17SJuan Quintela echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 2647804edf29SJuan Quintelafi 2648804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 2649804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 2650804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 26519fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 2652e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 2653a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 2654c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak 2655e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 2656a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 2657a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 265873da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 26593e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 2660804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 2661804edf29SJuan Quintela 26624bf6b55bSJuan Quintela# generate list of library paths for linker script 26634bf6b55bSJuan Quintela 26644bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 26654bf6b55bSJuan Quintela 26664bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 26674bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 26684bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 26694bf6b55bSJuan Quintela else 26704bf6b55bSJuan Quintela rm ${config_host_ld}~ 26714bf6b55bSJuan Quintela fi 26724bf6b55bSJuan Quintelafi 26734bf6b55bSJuan Quintela 26744d904533SBlue Swirlfor d in libdis libdis-user; do 26754d904533SBlue Swirl mkdir -p $d 26764d904533SBlue Swirl rm -f $d/Makefile 26774d904533SBlue Swirl ln -s $source_path/Makefile.dis $d/Makefile 26784d904533SBlue Swirl echo > $d/config.mak 26794d904533SBlue Swirldone 2680d44cff22SRichard Hendersonif test "$static" = "no" -a "$user_pie" = "yes" ; then 2681d44cff22SRichard Henderson echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak 2682d44cff22SRichard Hendersonfi 26834d904533SBlue Swirl 268497a847bcSbellardfor target in $target_list; do 268597a847bcSbellardtarget_dir="$target" 268625be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 2687600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 268897a847bcSbellardtarget_bigendian="no" 26891f3d3c8fSJuan Quintela 2690ea2d6a39SJuan Quintelacase "$target_arch2" in 269124e804ecSAlexander Graf armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus) 2692ea2d6a39SJuan Quintela target_bigendian=yes 2693ea2d6a39SJuan Quintela ;; 2694ea2d6a39SJuan Quintelaesac 269597a847bcSbellardtarget_softmmu="no" 2696997344f3Sbellardtarget_user_only="no" 2697831b7825Sthstarget_linux_user="no" 2698831b7825Sthstarget_darwin_user="no" 269984778508Sblueswir1target_bsd_user="no" 27009e407a85Spbrookcase "$target" in 2701600309b6SBlue Swirl ${target_arch2}-softmmu) 27029e407a85Spbrook target_softmmu="yes" 27039e407a85Spbrook ;; 2704600309b6SBlue Swirl ${target_arch2}-linux-user) 27059c7a4202SBlue Swirl if test "$linux" != "yes" ; then 27069c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 27079c7a4202SBlue Swirl exit 1 27089c7a4202SBlue Swirl fi 27099e407a85Spbrook target_user_only="yes" 27109e407a85Spbrook target_linux_user="yes" 27119e407a85Spbrook ;; 2712600309b6SBlue Swirl ${target_arch2}-darwin-user) 27139c7a4202SBlue Swirl if test "$darwin" != "yes" ; then 27149c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Darwin host" 27159c7a4202SBlue Swirl exit 1 27169c7a4202SBlue Swirl fi 27179e407a85Spbrook target_user_only="yes" 2718831b7825Sths target_darwin_user="yes" 27199e407a85Spbrook ;; 2720600309b6SBlue Swirl ${target_arch2}-bsd-user) 27219cf55765SBlue Swirl if test "$bsd" != "yes" ; then 27229c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 27239c7a4202SBlue Swirl exit 1 27249c7a4202SBlue Swirl fi 272584778508Sblueswir1 target_user_only="yes" 272684778508Sblueswir1 target_bsd_user="yes" 272784778508Sblueswir1 ;; 27289e407a85Spbrook *) 27299e407a85Spbrook echo "ERROR: Target '$target' not recognised" 27309e407a85Spbrook exit 1 27319e407a85Spbrook ;; 27329e407a85Spbrookesac 2733831b7825Sths 273497a847bcSbellardmkdir -p $target_dir 2735158142c2Sbellardmkdir -p $target_dir/fpu 273657fec1feSbellardmkdir -p $target_dir/tcg 273759f2a787SGerd Hoffmannmkdir -p $target_dir/ide 273884778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then 273969de927cSbellard mkdir -p $target_dir/nwfpe 274069de927cSbellardfi 274169de927cSbellard 2742ec530c81Sbellard# 2743ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link 2744ec530c81Sbellard# 2745ec530c81Sbellardrm -f $target_dir/Makefile 2746ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile 2747ec530c81Sbellard 274897a847bcSbellard 274925be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 275097a847bcSbellard 2751e5fe0c52Spbrookbflt="no" 2752bd0c5661Spbrooktarget_nptl="no" 2753600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 27547ee2822cSPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 275556aebc89Spbrookgdb_xml_files="" 27567ba1e619Saliguori 2757938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 27586acff7daSJuan QuintelaTARGET_BASE_ARCH="" 2759e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 2760e73aae67SJuan Quintela 2761600309b6SBlue Swirlcase "$target_arch2" in 27622408a527Saurel32 i386) 27631ad2134fSPaul Brook target_phys_bits=32 27642408a527Saurel32 ;; 27652408a527Saurel32 x86_64) 27666acff7daSJuan Quintela TARGET_BASE_ARCH=i386 27671ad2134fSPaul Brook target_phys_bits=64 27682408a527Saurel32 ;; 27692408a527Saurel32 alpha) 27701ad2134fSPaul Brook target_phys_bits=64 2771a4b388ffSRichard Henderson target_nptl="yes" 27722408a527Saurel32 ;; 27732408a527Saurel32 arm|armeb) 2774b498c8a0SJuan Quintela TARGET_ARCH=arm 2775e5fe0c52Spbrook bflt="yes" 2776bd0c5661Spbrook target_nptl="yes" 277756aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 27781ad2134fSPaul Brook target_phys_bits=32 27792408a527Saurel32 ;; 27802408a527Saurel32 cris) 2781253bd7f8Sedgar_igl target_nptl="yes" 27821ad2134fSPaul Brook target_phys_bits=32 27832408a527Saurel32 ;; 27842408a527Saurel32 m68k) 27850938cda5Saurel32 bflt="yes" 278656aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 27871ad2134fSPaul Brook target_phys_bits=32 27882408a527Saurel32 ;; 278972b675caSEdgar E. Iglesias microblaze) 279072b675caSEdgar E. Iglesias bflt="yes" 279172b675caSEdgar E. Iglesias target_nptl="yes" 279272b675caSEdgar E. Iglesias target_phys_bits=32 279372b675caSEdgar E. Iglesias ;; 27942408a527Saurel32 mips|mipsel) 2795b498c8a0SJuan Quintela TARGET_ARCH=mips 279625be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 2797f04dc72fSPaul Brook target_nptl="yes" 27981ad2134fSPaul Brook target_phys_bits=64 27992408a527Saurel32 ;; 28002408a527Saurel32 mipsn32|mipsn32el) 2801b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 28026acff7daSJuan Quintela TARGET_BASE_ARCH=mips 280325be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 28041ad2134fSPaul Brook target_phys_bits=64 28052408a527Saurel32 ;; 28062408a527Saurel32 mips64|mips64el) 2807b498c8a0SJuan Quintela TARGET_ARCH=mips64 28086acff7daSJuan Quintela TARGET_BASE_ARCH=mips 280925be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 28101ad2134fSPaul Brook target_phys_bits=64 28112408a527Saurel32 ;; 28122408a527Saurel32 ppc) 2813c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 28141ad2134fSPaul Brook target_phys_bits=32 2815d6630708SNathan Froyd target_nptl="yes" 28162408a527Saurel32 ;; 28172408a527Saurel32 ppcemb) 28186acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 2819e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 2820c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 28211ad2134fSPaul Brook target_phys_bits=64 2822d6630708SNathan Froyd target_nptl="yes" 28232408a527Saurel32 ;; 28242408a527Saurel32 ppc64) 28256acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 2826e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 2827c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 28281ad2134fSPaul Brook target_phys_bits=64 28292408a527Saurel32 ;; 28302408a527Saurel32 ppc64abi32) 2831b498c8a0SJuan Quintela TARGET_ARCH=ppc64 28326acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 2833e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 283425be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 2835c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 28361ad2134fSPaul Brook target_phys_bits=64 28372408a527Saurel32 ;; 28382408a527Saurel32 sh4|sh4eb) 2839b498c8a0SJuan Quintela TARGET_ARCH=sh4 28404dbed897Spbrook bflt="yes" 28410b6d3ae0Saurel32 target_nptl="yes" 28421ad2134fSPaul Brook target_phys_bits=32 28432408a527Saurel32 ;; 28442408a527Saurel32 sparc) 28451ad2134fSPaul Brook target_phys_bits=64 28462408a527Saurel32 ;; 28472408a527Saurel32 sparc64) 28486acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 28491ad2134fSPaul Brook target_phys_bits=64 28502408a527Saurel32 ;; 28512408a527Saurel32 sparc32plus) 2852b498c8a0SJuan Quintela TARGET_ARCH=sparc64 28536acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 2854e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 285525be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 28561ad2134fSPaul Brook target_phys_bits=64 28572408a527Saurel32 ;; 285824e804ecSAlexander Graf s390x) 285924e804ecSAlexander Graf target_phys_bits=64 286024e804ecSAlexander Graf ;; 28612408a527Saurel32 *) 2862de83cd02Sbellard echo "Unsupported target CPU" 2863de83cd02Sbellard exit 1 28642408a527Saurel32 ;; 28652408a527Saurel32esac 286625be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 2867053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`" 286825be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 286925be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 287042bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 28716acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then 28726acff7daSJuan Quintela TARGET_BASE_ARCH=$TARGET_ARCH 28736acff7daSJuan Quintelafi 287425be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 2875e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 2876e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 2877e6e91b9cSJuan Quintelafi 287825be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 28791b0c87fcSJuan Quintelacase "$target_arch2" in 28801b0c87fcSJuan Quintela i386|x86_64) 28811b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 288225be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 28831b0c87fcSJuan Quintela fi 28841b0c87fcSJuan Quintelaesac 2885c59249f9SJuan Quintelacase "$target_arch2" in 28860e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 2887c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 2888c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 2889c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 2890c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 28915f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 2892c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 2893c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 289425be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 289525be210fSJuan Quintela echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak 2896dae5079aSJan Kiszka if test "$kvm_para" = "yes"; then 2897dae5079aSJan Kiszka echo "CONFIG_KVM_PARA=y" >> $config_target_mak 2898dae5079aSJan Kiszka fi 2899d5970055SMichael S. Tsirkin if test $vhost_net = "yes" ; then 2900d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 2901d5970055SMichael S. Tsirkin fi 2902c59249f9SJuan Quintela fi 2903c59249f9SJuan Quintelaesac 2904de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 290525be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 290697a847bcSbellardfi 290797a847bcSbellardif test "$target_softmmu" = "yes" ; then 2908b1aa27c4SPaul Brook echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak 290925be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 291025be210fSJuan Quintela echo "LIBS+=$libs_softmmu" >> $config_target_mak 29110e8c9214SAndreas Färber echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak 29125791f45bSKirill A. Shutemov echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak 2913de83cd02Sbellardfi 2914997344f3Sbellardif test "$target_user_only" = "yes" ; then 291525be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 2916997344f3Sbellardfi 2917831b7825Sthsif test "$target_linux_user" = "yes" ; then 291825be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 2919831b7825Sthsfi 2920831b7825Sthsif test "$target_darwin_user" = "yes" ; then 292125be210fSJuan Quintela echo "CONFIG_DARWIN_USER=y" >> $config_target_mak 2922831b7825Sthsfi 292356aebc89Spbrooklist="" 292456aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 292556aebc89Spbrook for x in $gdb_xml_files; do 292656aebc89Spbrook list="$list $source_path/gdb-xml/$x" 292756aebc89Spbrook done 292825be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 29293d0f1517SJuan Quintelafi 2930de83cd02Sbellard 2931f57975fbSJuan Quintelacase "$target_arch2" in 2932990b3e19SRichard Henderson alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus) 293325be210fSJuan Quintela echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak 2934f57975fbSJuan Quintela ;; 2935d6b38939SJuan Quintela *) 293625be210fSJuan Quintela echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak 2937d6b38939SJuan Quintela ;; 2938f57975fbSJuan Quintelaesac 2939f57975fbSJuan Quintela 2940e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 294125be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 2942e5fe0c52Spbrookfi 2943bd0c5661Spbrookif test "$target_user_only" = "yes" \ 2944bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 294525be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 2946bd0c5661Spbrookfi 2947379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 294825be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 2949379f6698SPaul Brookfi 295084778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 295125be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 295284778508Sblueswir1fi 29535b0753e0Sbellard 29544afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 2955fa282484SJuan Quintela 29564afddb55SJuan Quintelacflags="" 2957fa282484SJuan Quintelaldflags="" 29589b8e111fSJuan Quintela 295957ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then 296057ddfbf7SJuan Quintela cflags="-I\$(SRC_PATH)/tcg/sparc $cflags" 296124e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 296224e804ecSAlexander Graf cflags="-I\$(SRC_PATH)/tcg/s390 $cflags" 29635d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then 29645d8a4f8fSRichard Henderson cflags="-I\$(SRC_PATH)/tcg/i386 $cflags" 296557ddfbf7SJuan Quintelaelse 296657ddfbf7SJuan Quintela cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags" 296757ddfbf7SJuan Quintelafi 296857ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/tcg $cflags" 296957ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/fpu $cflags" 297057ddfbf7SJuan Quintela 29714d904533SBlue Swirlif test "$target_user_only" = "yes" ; then 29724d904533SBlue Swirl libdis_config_mak=libdis-user/config.mak 29734d904533SBlue Swirlelse 29744d904533SBlue Swirl libdis_config_mak=libdis/config.mak 29754d904533SBlue Swirlfi 29764d904533SBlue Swirl 297764656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 297864656024SJuan Quintela case "$i" in 297964656024SJuan Quintela alpha) 298025be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 29814d904533SBlue Swirl echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak 298264656024SJuan Quintela ;; 298364656024SJuan Quintela arm) 298425be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 29854d904533SBlue Swirl echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak 298664656024SJuan Quintela ;; 298764656024SJuan Quintela cris) 298825be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 29894d904533SBlue Swirl echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak 299064656024SJuan Quintela ;; 299164656024SJuan Quintela hppa) 299225be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 29934d904533SBlue Swirl echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak 299464656024SJuan Quintela ;; 299564656024SJuan Quintela i386|x86_64) 299625be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 29974d904533SBlue Swirl echo "CONFIG_I386_DIS=y" >> $libdis_config_mak 299864656024SJuan Quintela ;; 2999903ec55cSAurelien Jarno ia64*) 3000903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 3001903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak 3002903ec55cSAurelien Jarno ;; 300364656024SJuan Quintela m68k) 300425be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 30054d904533SBlue Swirl echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak 300664656024SJuan Quintela ;; 300764656024SJuan Quintela microblaze) 300825be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 30094d904533SBlue Swirl echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak 301064656024SJuan Quintela ;; 301164656024SJuan Quintela mips*) 301225be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 30134d904533SBlue Swirl echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak 301464656024SJuan Quintela ;; 301564656024SJuan Quintela ppc*) 301625be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 30174d904533SBlue Swirl echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak 301864656024SJuan Quintela ;; 301924e804ecSAlexander Graf s390*) 302025be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 30214d904533SBlue Swirl echo "CONFIG_S390_DIS=y" >> $libdis_config_mak 302264656024SJuan Quintela ;; 302364656024SJuan Quintela sh4) 302425be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 30254d904533SBlue Swirl echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak 302664656024SJuan Quintela ;; 302764656024SJuan Quintela sparc*) 302825be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 30294d904533SBlue Swirl echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak 303064656024SJuan Quintela ;; 303164656024SJuan Quintela esac 303264656024SJuan Quinteladone 303364656024SJuan Quintela 30346ee7126fSJuan Quintelacase "$ARCH" in 30356ee7126fSJuan Quintelaalpha) 30366ee7126fSJuan Quintela # Ensure there's only a single GP 30376ee7126fSJuan Quintela cflags="-msmall-data $cflags" 30386ee7126fSJuan Quintela;; 30396ee7126fSJuan Quintelaesac 30406ee7126fSJuan Quintela 304155d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 304255d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 304355d9c04bSJuan Quintela arm) 304455d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 304555d9c04bSJuan Quintela ;; 304655d9c04bSJuan Quintela i386|mips|ppc) 304755d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 304855d9c04bSJuan Quintela ;; 304955d9c04bSJuan Quintela esac 305055d9c04bSJuan Quintelafi 305155d9c04bSJuan Quintela 305234005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \ 305334005a00SKirill A. Shutemov "$user_pie" = "yes" ; then 305434005a00SKirill A. Shutemov cflags="-fpie $cflags" 305534005a00SKirill A. Shutemov ldflags="-pie $ldflags" 305634005a00SKirill A. Shutemovfi 305734005a00SKirill A. Shutemov 3058471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \ 3059471857ddSJuan Quintela "$TARGET_ARCH" = "microblaze" -o \ 3060471857ddSJuan Quintela "$TARGET_ARCH" = "cris" \) ; then 306125be210fSJuan Quintela echo "CONFIG_NEED_MMU=y" >> $config_target_mak 3062471857ddSJuan Quintelafi 3063471857ddSJuan Quintela 3064d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 306525be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 3066d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 3067d02c1db3SJuan Quintela cflags="-p $cflags" 3068d02c1db3SJuan Quintela ldflags="-p $ldflags" 3069d02c1db3SJuan Quintela fi 3070d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 3071d02c1db3SJuan Quintela ldflags="-p $ldflags" 307225be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 3073d02c1db3SJuan Quintela fi 3074d02c1db3SJuan Quintelafi 3075d02c1db3SJuan Quintela 30766ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" 30779b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 3078fa282484SJuan Quintela case "$ARCH" in 3079fa282484SJuan Quintela sparc) 3080fa282484SJuan Quintela # -static is used to avoid g1/g3 usage by the dynamic linker 3081322e5878SJuan Quintela ldflags="$linker_script -static $ldflags" 3082fa282484SJuan Quintela ;; 30834d58be06SRichard Henderson alpha | s390x) 30844d58be06SRichard Henderson # The default placement of the application is fine. 30854d58be06SRichard Henderson ;; 3086fd76e73aSRichard Henderson *) 3087322e5878SJuan Quintela ldflags="$linker_script $ldflags" 3088fa282484SJuan Quintela ;; 3089fa282484SJuan Quintela esac 3090fa282484SJuan Quintelafi 3091fa282484SJuan Quintela 309225be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 309325be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 3094fa282484SJuan Quintela 309597a847bcSbellarddone # for target in $targets 30967d13299dSbellard 30977d13299dSbellard# build tree in object directory if source path is different from current one 30987d13299dSbellardif test "$source_path_used" = "yes" ; then 3099e1144d00SMark McLoughlin DIRS="tests tests/cris slirp audio block net pc-bios/optionrom" 31002d9f27d2SAnthony Liguori DIRS="$DIRS roms/seabios roms/vgabios" 31013e230dd2SCorentin Chary DIRS="$DIRS fsdev ui" 31027d13299dSbellard FILES="Makefile tests/Makefile" 3103e7daa605Sths FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" 3104e1ffb0f1Sedgar_igl FILES="$FILES tests/test-mmap.c" 3105ae0bfb79SBlue Swirl FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 31062d9f27d2SAnthony Liguori FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 31077ea78b74SJan Kiszka for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do 31087ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 31097ea78b74SJan Kiszka done 31107d13299dSbellard for dir in $DIRS ; do 31117d13299dSbellard mkdir -p $dir 31127d13299dSbellard done 3113ec530c81Sbellard # remove the link and recreate it, as not all "ln -sf" overwrite the link 31147d13299dSbellard for f in $FILES ; do 3115ec530c81Sbellard rm -f $f 3116ec530c81Sbellard ln -s $source_path/$f $f 31177d13299dSbellard done 31187d13299dSbellardfi 31191ad2134fSPaul Brook 3120c34ebfdcSAnthony Liguori# temporary config to build submodules 31212d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 3122c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 312337116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 3124c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 3125c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 3126c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 3127c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 3128c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 3129c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 3130c34ebfdcSAnthony Liguori echo "HOST_CC=$host_cc" >> $config_mak 3131c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 3132c34ebfdcSAnthony Liguoridone 3133c34ebfdcSAnthony Liguori 31341ad2134fSPaul Brookfor hwlib in 32 64; do 31351ad2134fSPaul Brook d=libhw$hwlib 31361ad2134fSPaul Brook mkdir -p $d 31379953b2fcSBlue Swirl mkdir -p $d/ide 31381ad2134fSPaul Brook rm -f $d/Makefile 31391ad2134fSPaul Brook ln -s $source_path/Makefile.hw $d/Makefile 314037116c89SStefan Weil echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak 31411ad2134fSPaul Brookdone 3142add16157SBlue Swirl 3143add16157SBlue Swirld=libuser 3144add16157SBlue Swirlmkdir -p $d 3145add16157SBlue Swirlrm -f $d/Makefile 3146add16157SBlue Swirlln -s $source_path/Makefile.user $d/Makefile 3147299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then 3148299060a0SKirill A. Shutemov echo "QEMU_CFLAGS+=-fpie" > $d/config.mak 3149299060a0SKirill A. Shutemovfi 3150b40292e7SJan Kiszka 3151b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 3152b40292e7SJan Kiszka mkdir -p QMP 3153b40292e7SJan Kiszkafi 3154