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 1802d5467eSmalctrap "rm -f $TMPC $TMPO $TMPE ; exit" 0 2 3 15 199ac81bbbSmalc 2052166aa0SJuan Quintelacompile_object() { 21a558ee17SJuan Quintela $cc $QEMU_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null 2252166aa0SJuan Quintela} 2352166aa0SJuan Quintela 2452166aa0SJuan Quintelacompile_prog() { 2552166aa0SJuan Quintela local_cflags="$1" 2652166aa0SJuan Quintela local_ldflags="$2" 27a558ee17SJuan Quintela $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null 2852166aa0SJuan Quintela} 2952166aa0SJuan Quintela 307d13299dSbellard# default parameters 312ff6b91eSJuan Quintelacpu="" 3211d9f695Sbellardprefix="" 331e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 3443ce4dfeSbellardstatic="no" 35ed968ff1SJuan Quintelasparc_cpu="" 367d13299dSbellardcross_prefix="" 377d13299dSbellardcc="gcc" 380c58ac1cSmalcaudio_drv_list="" 394c9b53e3Smalcaudio_card_list="ac97 es1370 sb16" 404c9b53e3Smalcaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus" 41eb852011SMarkus Armbrusterblock_drv_whitelist="" 427d13299dSbellardhost_cc="gcc" 437d13299dSbellardar="ar" 447d13299dSbellardmake="make" 456a882643Spbrookinstall="install" 467aa486feSAnthony Liguoriobjcopy="objcopy" 477aa486feSAnthony Liguorild="ld" 48c81da56eSJuan Quintelahelper_cflags="" 4973da375eSJuan Quintelalibs_softmmu="" 503e2e0e6bSJuan Quintelalibs_tools="" 5167f86e8eSJuan Quintelaaudio_pt_int="" 52d5631638Smalcaudio_win_int="" 53ac0df51dSaliguori 54ac0df51dSaliguori# parse CC options first 55ac0df51dSaliguorifor opt do 56ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 57ac0df51dSaliguori case "$opt" in 58ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 59ac0df51dSaliguori ;; 60ac0df51dSaliguori --cc=*) cc="$optarg" 61ac0df51dSaliguori ;; 622ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 632ff6b91eSJuan Quintela ;; 64a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 65e2a2ed06SJuan Quintela ;; 66e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 67e2a2ed06SJuan Quintela ;; 6850e7b1a0SJuan Quintela --sparc_cpu=*) 6950e7b1a0SJuan Quintela sparc_cpu="$optarg" 7050e7b1a0SJuan Quintela case $sparc_cpu in 71ed968ff1SJuan Quintela v7|v8|v8plus|v8plusa) 7250e7b1a0SJuan Quintela cpu="sparc" 7350e7b1a0SJuan Quintela ;; 7450e7b1a0SJuan Quintela v9) 7550e7b1a0SJuan Quintela cpu="sparc64" 7650e7b1a0SJuan Quintela ;; 7750e7b1a0SJuan Quintela *) 7850e7b1a0SJuan Quintela echo "undefined SPARC architecture. Exiting"; 7950e7b1a0SJuan Quintela exit 1 8050e7b1a0SJuan Quintela ;; 8150e7b1a0SJuan Quintela esac 8250e7b1a0SJuan Quintela ;; 83ac0df51dSaliguori esac 84ac0df51dSaliguoridone 85ac0df51dSaliguori# OS specific 86ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 87ac0df51dSaliguori# we can eliminate it's usage altogether 88ac0df51dSaliguori 89ac0df51dSaliguoricc="${cross_prefix}${cc}" 90ac0df51dSaliguoriar="${cross_prefix}${ar}" 917aa486feSAnthony Liguoriobjcopy="${cross_prefix}${objcopy}" 927aa486feSAnthony Liguorild="${cross_prefix}${ld}" 93ac0df51dSaliguori 94be17dc90SMichael S. Tsirkin# default flags for all hosts 95be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 96be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS" 97be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 98be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 99be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 100be17dc90SMichael S. TsirkinQEMU_CFLAGS="-U_FORTIFY_SOURCE $QEMU_CFLAGS" 101be17dc90SMichael S. TsirkinQEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS" 102be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS" 103be17dc90SMichael S. Tsirkin 104be17dc90SMichael S. Tsirkingcc_flags="-Wold-style-declaration -Wold-style-definition" 105be17dc90SMichael S. Tsirkincat > $TMPC << EOF 106be17dc90SMichael S. Tsirkinint main(void) { } 107be17dc90SMichael S. TsirkinEOF 108be17dc90SMichael S. Tsirkinfor flag in $gcc_flags; do 109be17dc90SMichael S. Tsirkin if compile_prog "$QEMU_CFLAGS" "$flag" ; then 110be17dc90SMichael S. Tsirkin QEMU_CFLAGS="$flag $QEMU_CFLAGS" 111be17dc90SMichael S. Tsirkin fi 112be17dc90SMichael S. Tsirkindone 113be17dc90SMichael S. Tsirkin 114ac0df51dSaliguori# check that the C compiler works. 115ac0df51dSaliguoricat > $TMPC <<EOF 116ac0df51dSaliguoriint main(void) {} 117ac0df51dSaliguoriEOF 118ac0df51dSaliguori 11952166aa0SJuan Quintelaif compile_object ; then 120ac0df51dSaliguori : C compiler works ok 121ac0df51dSaliguorielse 122ac0df51dSaliguori echo "ERROR: \"$cc\" either does not exist or does not work" 123ac0df51dSaliguori exit 1 124ac0df51dSaliguorifi 125ac0df51dSaliguori 126ac0df51dSaliguoricheck_define() { 127ac0df51dSaliguoricat > $TMPC <<EOF 128ac0df51dSaliguori#if !defined($1) 129ac0df51dSaliguori#error Not defined 130ac0df51dSaliguori#endif 131ac0df51dSaliguoriint main(void) { return 0; } 132ac0df51dSaliguoriEOF 13352166aa0SJuan Quintela compile_object 134ac0df51dSaliguori} 135ac0df51dSaliguori 1362ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 1372ff6b91eSJuan Quintela # command line argument 1382ff6b91eSJuan Quintela : 1392ff6b91eSJuan Quintelaelif check_define __i386__ ; then 140ac0df51dSaliguori cpu="i386" 141ac0df51dSaliguorielif check_define __x86_64__ ; then 142ac0df51dSaliguori cpu="x86_64" 1433aa9bd6cSblueswir1elif check_define __sparc__ ; then 1443aa9bd6cSblueswir1 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA 1453aa9bd6cSblueswir1 # They must be specified using --sparc_cpu 1463aa9bd6cSblueswir1 if check_define __arch64__ ; then 1473aa9bd6cSblueswir1 cpu="sparc64" 1483aa9bd6cSblueswir1 else 1493aa9bd6cSblueswir1 cpu="sparc" 1503aa9bd6cSblueswir1 fi 151fdf7ed96Smalcelif check_define _ARCH_PPC ; then 152fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 153fdf7ed96Smalc cpu="ppc64" 154ac0df51dSaliguori else 155fdf7ed96Smalc cpu="ppc" 156fdf7ed96Smalc fi 157afa05235SAurelien Jarnoelif check_define __mips__ ; then 158afa05235SAurelien Jarno cpu="mips" 159fdf7ed96Smalcelse 160fdf7ed96Smalc cpu=`uname -m` 161ac0df51dSaliguorifi 162ac0df51dSaliguori 1635327cf48Sbellardtarget_list="" 1647d13299dSbellardcase "$cpu" in 165afa05235SAurelien Jarno alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64) 166ea8f20f8SJuan Quintela cpu="$cpu" 167ea8f20f8SJuan Quintela ;; 1687d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 16997a847bcSbellard cpu="i386" 1707d13299dSbellard ;; 171aaa5fa14Saurel32 x86_64|amd64) 172aaa5fa14Saurel32 cpu="x86_64" 173aaa5fa14Saurel32 ;; 174ba68055eSbellard armv*b) 175808c4954Sbellard cpu="armv4b" 176808c4954Sbellard ;; 177ba68055eSbellard armv*l) 1787d13299dSbellard cpu="armv4l" 1797d13299dSbellard ;; 180f54b3f92Saurel32 parisc|parisc64) 181f54b3f92Saurel32 cpu="hppa" 182f54b3f92Saurel32 ;; 183afa05235SAurelien Jarno mips*) 184afa05235SAurelien Jarno cpu="mips" 185afa05235SAurelien Jarno ;; 18624e804ecSAlexander Graf s390) 187fb3e5849Sbellard cpu="s390" 188fb3e5849Sbellard ;; 18924e804ecSAlexander Graf s390x) 19024e804ecSAlexander Graf cpu="s390x" 19124e804ecSAlexander Graf ;; 1923142255cSblueswir1 sparc|sun4[cdmuv]) 193ae228531Sbellard cpu="sparc" 194ae228531Sbellard ;; 1957d13299dSbellard *) 1967d13299dSbellard cpu="unknown" 1977d13299dSbellard ;; 1987d13299dSbellardesac 199e2d52ad3SJuan Quintela 2003a3fb96dSStefan Weil# Default value for a variable defining feature "foo". 2013a3fb96dSStefan Weil# * foo="no" feature will only be used if --enable-foo arg is given 2023a3fb96dSStefan Weil# * foo="" feature will be searched for, and if found, will be used 2033a3fb96dSStefan Weil# unless --disable-foo is given 2043a3fb96dSStefan Weil# * foo="yes" this value will only be set by --enable-foo flag. 2053a3fb96dSStefan Weil# feature will searched for, 2063a3fb96dSStefan Weil# if not found, configure exits with error 207e2d52ad3SJuan Quintela# 2083a3fb96dSStefan Weil# Always add --enable-foo and --disable-foo command line args. 2093a3fb96dSStefan Weil# Distributions want to ensure that several features are compiled in, and it 2103a3fb96dSStefan Weil# is impossible without a --enable-foo that exits if a feature is not found. 211e2d52ad3SJuan Quintela 212a20a6f46SJuan Quintelabluez="" 2134ffcedb6SJuan Quintelabrlapi="" 214788c8196SJuan Quintelacurl="" 215c584a6d0SJuan Quintelacurses="" 216a25dba17SJuan Quinteladocs="" 2172df87df7SJuan Quintelafdt="" 218b31a0277SJuan Quintelakvm="" 219b0a47e79SJuan Quintelanptl="" 220c4198157SJuan Quintelasdl="" 221dfffc653SJuan Quintelasparse="no" 222ee682d27SStefan Weiluuid="" 223dfb278bdSJuan Quintelavde="" 2241be10ad2SJuan Quintelavnc_tls="" 225ea784e3bSJuan Quintelavnc_sasl="" 226fc321b4bSJuan Quintelaxen="" 2275c6c3a6cSChristoph Hellwiglinux_aio="" 228dfb278bdSJuan Quintela 2297d13299dSbellardgprof="no" 230f8393946Saurel32debug_tcg="no" 231f3d08ee6SPaul Brookdebug="no" 2321625af87Saliguoristrip_opt="yes" 2337d13299dSbellardbigendian="no" 23467b915a5Sbellardmingw32="no" 23567b915a5SbellardEXESUF="" 236443f1376Sbellardslirp="yes" 237102a52e4Sbellardfmod_lib="" 238102a52e4Sbellardfmod_inc="" 2392f6a1ab0Sblueswir1oss_lib="" 240b1a550a0Spbrookbsd="no" 2415327cf48Sbellardlinux="no" 242d2c7c9b8Sblueswir1solaris="no" 24305c2a3e7Sbellardprofiler="no" 2445b0753e0Sbellardcocoa="no" 2450a8e90f4Spbrooksoftmmu="yes" 246831b7825Sthslinux_user="no" 247831b7825Sthsdarwin_user="no" 24884778508Sblueswir1bsd_user="no" 249379f6698SPaul Brookguest_base="" 250c5937220Spbrookuname_release="" 251e5d355d1Saliguoriio_thread="no" 2528ff9cbf7Smalcmixemu="no" 253eac30262Saliguorikerneldir="" 254b29fe3edSmalcaix="no" 25577755340Sthsblobs="yes" 2564a19f1ecSpbrookpkgversion="" 2575495ed11SLuiz Capitulinocheck_utests="no" 25834005a00SKirill A. Shutemovuser_pie="no" 25920ff6c80SAnthony Liguorizero_malloc="" 2607d13299dSbellard 2617d13299dSbellard# OS specific 262ac0df51dSaliguoriif check_define __linux__ ; then 263ac0df51dSaliguori targetos="Linux" 264ac0df51dSaliguorielif check_define _WIN32 ; then 265ac0df51dSaliguori targetos='MINGW32' 266169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then 267169dc5d3Sblueswir1 targetos='OpenBSD' 268169dc5d3Sblueswir1elif check_define __sun__ ; then 269169dc5d3Sblueswir1 targetos='SunOS' 270ac0df51dSaliguorielse 2717d13299dSbellard targetos=`uname -s` 272ac0df51dSaliguorifi 2730dbfc675SJuan Quintela 2747d13299dSbellardcase $targetos in 275c326e0afSbellardCYGWIN*) 276c326e0afSbellard mingw32="yes" 277a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 278d5631638Smalc audio_possible_drivers="winwave sdl" 279d5631638Smalc audio_drv_list="winwave" 280c326e0afSbellard;; 28167b915a5SbellardMINGW32*) 28267b915a5Sbellard mingw32="yes" 283d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 284d5631638Smalc audio_drv_list="winwave" 28567b915a5Sbellard;; 2865c40d2bdSthsGNU/kFreeBSD) 287a167ba50SAurelien Jarno bsd="yes" 2880c58ac1cSmalc audio_drv_list="oss" 289f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 2905c40d2bdSths;; 2917d3505c5SbellardFreeBSD) 2927d3505c5Sbellard bsd="yes" 293a167ba50SAurelien Jarno make="gmake" 2940c58ac1cSmalc audio_drv_list="oss" 295f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 2967d3505c5Sbellard;; 297c5e97233Sblueswir1DragonFly) 298c5e97233Sblueswir1 bsd="yes" 299a167ba50SAurelien Jarno make="gmake" 300c5e97233Sblueswir1 audio_drv_list="oss" 301c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 302c5e97233Sblueswir1;; 3037d3505c5SbellardNetBSD) 3047d3505c5Sbellard bsd="yes" 305a167ba50SAurelien Jarno make="gmake" 3060c58ac1cSmalc audio_drv_list="oss" 307c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3088ef92a88Sblueswir1 oss_lib="-lossaudio" 3097d3505c5Sbellard;; 3107d3505c5SbellardOpenBSD) 3117d3505c5Sbellard bsd="yes" 312a167ba50SAurelien Jarno make="gmake" 3130c58ac1cSmalc audio_drv_list="oss" 314c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3152f6a1ab0Sblueswir1 oss_lib="-lossaudio" 3167d3505c5Sbellard;; 31783fb7adfSbellardDarwin) 31883fb7adfSbellard bsd="yes" 31983fb7adfSbellard darwin="yes" 3200dbfc675SJuan Quintela # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can 3210dbfc675SJuan Quintela # run 64-bit userspace code 322aab8588aSmalc if [ "$cpu" = "i386" ] ; then 3231b0f9cc2Saliguori is_x86_64=`sysctl -n hw.optional.x86_64` 324aab8588aSmalc [ "$is_x86_64" = "1" ] && cpu=x86_64 3251b0f9cc2Saliguori fi 3261b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 327a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 3280c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 3291b0f9cc2Saliguori else 330a558ee17SJuan Quintela QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" 3311b0f9cc2Saliguori fi 332831b7825Sths darwin_user="yes" 333fd677642Sths cocoa="yes" 3340c58ac1cSmalc audio_drv_list="coreaudio" 335c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 3360c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 3377973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 33883fb7adfSbellard;; 339ec530c81SbellardSunOS) 340ec530c81Sbellard solaris="yes" 341c2b84fabSths make="gmake" 342c2b84fabSths install="ginstall" 343fa58948dSBlue Swirl ld="gld" 3440475a5caSths needs_libsunmath="no" 345c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 346ef18c883Sths # have to select again, because `uname -m` returns i86pc 347ef18c883Sths # even on an x86_64 box. 348ef18c883Sths solariscpu=`isainfo -k` 349ef18c883Sths if test "${solariscpu}" = "amd64" ; then 350ef18c883Sths cpu="x86_64" 351ef18c883Sths fi 352c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 3530475a5caSths if test "$solarisrev" -le 9 ; then 3540475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 3550475a5caSths needs_libsunmath="yes" 356f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 357f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 358f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 3590475a5caSths else 3600475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 3610475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 3620475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 3630475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 3640475a5caSths exit 1 3650475a5caSths fi 3660475a5caSths fi 36786b2bd93Sths fi 3686b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 3690c58ac1cSmalc audio_drv_list="oss" 3706b4d2ba1Sths fi 371c2de5c91Smalc audio_possible_drivers="oss sdl" 372d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 373d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 374d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 375d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 376a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 377e174c0bbSJuan Quintela LIBS="-lsocket -lnsl -lresolv $LIBS" 378ec530c81Sbellard;; 379b29fe3edSmalcAIX) 380b29fe3edSmalc aix="yes" 381b29fe3edSmalc make="gmake" 382b29fe3edSmalc;; 383fb065187Sbellard*) 3840c58ac1cSmalc audio_drv_list="oss" 385b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 3865327cf48Sbellard linux="yes" 387831b7825Sths linux_user="yes" 38868063649Sblueswir1 usb="linux" 38907f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 390c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 391c9ec1fe4Sbellard fi 392fb065187Sbellard;; 3937d13299dSbellardesac 3947d13299dSbellard 3957d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 396b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 39768063649Sblueswir1 usb="bsd" 39883fb7adfSbellard fi 39984778508Sblueswir1 bsd_user="yes" 4007d3505c5Sbellardfi 4017d3505c5Sbellard 4023457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 4033457a3f8SJuan Quintela EXESUF=".exe" 404a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 405884044aaSJuan Quintela LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 4063457a3f8SJuan Quintelafi 4073457a3f8SJuan Quintela 4087d13299dSbellard# find source path 409ad064840Spbrooksource_path=`dirname "$0"` 41059faef3aSbalrogsource_path_used="no" 41159faef3aSbalrogworkdir=`pwd` 412ad064840Spbrookif [ -z "$source_path" ]; then 41359faef3aSbalrog source_path=$workdir 414ad064840Spbrookelse 415ad064840Spbrook source_path=`cd "$source_path"; pwd` 4167d13299dSbellardfi 417724db118Spbrook[ -f "$workdir/vl.c" ] || source_path_used="yes" 4187d13299dSbellard 419487fefdbSAnthony Liguoriwerror="" 42085aa5189Sbellard 4217d13299dSbellardfor opt do 422a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 4237d13299dSbellard case "$opt" in 4242efc3265Sbellard --help|-h) show_help=yes 4252efc3265Sbellard ;; 426b1a550a0Spbrook --prefix=*) prefix="$optarg" 4277d13299dSbellard ;; 428b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 42932ce6337Sbellard ;; 430b1a550a0Spbrook --source-path=*) source_path="$optarg" 431ad064840Spbrook source_path_used="yes" 4327d13299dSbellard ;; 433ac0df51dSaliguori --cross-prefix=*) 4347d13299dSbellard ;; 435ac0df51dSaliguori --cc=*) 4367d13299dSbellard ;; 437b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 43883469015Sbellard ;; 439b1a550a0Spbrook --make=*) make="$optarg" 4407d13299dSbellard ;; 4416a882643Spbrook --install=*) install="$optarg" 4426a882643Spbrook ;; 443e2a2ed06SJuan Quintela --extra-cflags=*) 4447d13299dSbellard ;; 445e2a2ed06SJuan Quintela --extra-ldflags=*) 4467d13299dSbellard ;; 4472ff6b91eSJuan Quintela --cpu=*) 4487d13299dSbellard ;; 449b1a550a0Spbrook --target-list=*) target_list="$optarg" 450de83cd02Sbellard ;; 4517d13299dSbellard --enable-gprof) gprof="yes" 4527d13299dSbellard ;; 45343ce4dfeSbellard --static) static="yes" 45443ce4dfeSbellard ;; 45597a847bcSbellard --disable-sdl) sdl="no" 45697a847bcSbellard ;; 457c4198157SJuan Quintela --enable-sdl) sdl="yes" 458c4198157SJuan Quintela ;; 459b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 460102a52e4Sbellard ;; 461c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 462c2de5c91Smalc ;; 4632f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 4642f6a1ab0Sblueswir1 ;; 4652fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 4660c58ac1cSmalc ;; 4670c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 4680c58ac1cSmalc ;; 469eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 470eb852011SMarkus Armbruster ;; 471f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 472f8393946Saurel32 ;; 473f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 474f8393946Saurel32 ;; 475f3d08ee6SPaul Brook --enable-debug) 476f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 477f3d08ee6SPaul Brook debug_tcg="yes" 478f3d08ee6SPaul Brook debug="yes" 479f3d08ee6SPaul Brook strip_opt="no" 480f3d08ee6SPaul Brook ;; 48103b4fe7dSaliguori --enable-sparse) sparse="yes" 48203b4fe7dSaliguori ;; 48303b4fe7dSaliguori --disable-sparse) sparse="no" 48403b4fe7dSaliguori ;; 4851625af87Saliguori --disable-strip) strip_opt="no" 4861625af87Saliguori ;; 4878d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 4888d5d2d4cSths ;; 4891be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 4901be10ad2SJuan Quintela ;; 4912f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 4922f9606b3Saliguori ;; 493ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 494ea784e3bSJuan Quintela ;; 495443f1376Sbellard --disable-slirp) slirp="no" 496c20709aaSbellard ;; 497ee682d27SStefan Weil --disable-uuid) uuid="no" 498ee682d27SStefan Weil ;; 499ee682d27SStefan Weil --enable-uuid) uuid="yes" 500ee682d27SStefan Weil ;; 501e0e6c8c0Saliguori --disable-vde) vde="no" 5028a16d273Sths ;; 503dfb278bdSJuan Quintela --enable-vde) vde="yes" 504dfb278bdSJuan Quintela ;; 505e37630caSaliguori --disable-xen) xen="no" 506e37630caSaliguori ;; 507fc321b4bSJuan Quintela --enable-xen) xen="yes" 508fc321b4bSJuan Quintela ;; 5092e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 5102e4d9fb1Saurel32 ;; 5114ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 5124ffcedb6SJuan Quintela ;; 513fb599c9aSbalrog --disable-bluez) bluez="no" 514fb599c9aSbalrog ;; 515a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 516a20a6f46SJuan Quintela ;; 5177ba1e619Saliguori --disable-kvm) kvm="no" 5187ba1e619Saliguori ;; 519b31a0277SJuan Quintela --enable-kvm) kvm="yes" 520b31a0277SJuan Quintela ;; 52105c2a3e7Sbellard --enable-profiler) profiler="yes" 52205c2a3e7Sbellard ;; 523c2de5c91Smalc --enable-cocoa) 524c2de5c91Smalc cocoa="yes" ; 525c2de5c91Smalc sdl="no" ; 526c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 5275b0753e0Sbellard ;; 528cad25d69Spbrook --disable-system) softmmu="no" 5290a8e90f4Spbrook ;; 530cad25d69Spbrook --enable-system) softmmu="yes" 5310a8e90f4Spbrook ;; 5320953a80fSZachary Amsden --disable-user) 5330953a80fSZachary Amsden linux_user="no" ; 5340953a80fSZachary Amsden bsd_user="no" ; 5350953a80fSZachary Amsden darwin_user="no" 5360953a80fSZachary Amsden ;; 5370953a80fSZachary Amsden --enable-user) ;; 538831b7825Sths --disable-linux-user) linux_user="no" 5390a8e90f4Spbrook ;; 540831b7825Sths --enable-linux-user) linux_user="yes" 541831b7825Sths ;; 542831b7825Sths --disable-darwin-user) darwin_user="no" 543831b7825Sths ;; 544831b7825Sths --enable-darwin-user) darwin_user="yes" 5450a8e90f4Spbrook ;; 54684778508Sblueswir1 --disable-bsd-user) bsd_user="no" 54784778508Sblueswir1 ;; 54884778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 54984778508Sblueswir1 ;; 550379f6698SPaul Brook --enable-guest-base) guest_base="yes" 551379f6698SPaul Brook ;; 552379f6698SPaul Brook --disable-guest-base) guest_base="no" 553379f6698SPaul Brook ;; 55434005a00SKirill A. Shutemov --enable-user-pie) user_pie="yes" 55534005a00SKirill A. Shutemov ;; 55634005a00SKirill A. Shutemov --disable-user-pie) user_pie="no" 55734005a00SKirill A. Shutemov ;; 558c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 559c5937220Spbrook ;; 5603142255cSblueswir1 --sparc_cpu=*) 5613142255cSblueswir1 ;; 56285aa5189Sbellard --enable-werror) werror="yes" 56385aa5189Sbellard ;; 56485aa5189Sbellard --disable-werror) werror="no" 56585aa5189Sbellard ;; 5664d3b6f6eSbalrog --disable-curses) curses="no" 5674d3b6f6eSbalrog ;; 568c584a6d0SJuan Quintela --enable-curses) curses="yes" 569c584a6d0SJuan Quintela ;; 570769ce76dSAlexander Graf --disable-curl) curl="no" 571769ce76dSAlexander Graf ;; 572788c8196SJuan Quintela --enable-curl) curl="yes" 573788c8196SJuan Quintela ;; 5742df87df7SJuan Quintela --disable-fdt) fdt="no" 5752df87df7SJuan Quintela ;; 5762df87df7SJuan Quintela --enable-fdt) fdt="yes" 5772df87df7SJuan Quintela ;; 5785495ed11SLuiz Capitulino --disable-check-utests) check_utests="no" 5795495ed11SLuiz Capitulino ;; 5805495ed11SLuiz Capitulino --enable-check-utests) check_utests="yes" 5815495ed11SLuiz Capitulino ;; 582bd0c5661Spbrook --disable-nptl) nptl="no" 583bd0c5661Spbrook ;; 584b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 585b0a47e79SJuan Quintela ;; 5868ff9cbf7Smalc --enable-mixemu) mixemu="yes" 5878ff9cbf7Smalc ;; 5885c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 5895c6c3a6cSChristoph Hellwig ;; 5905c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 5915c6c3a6cSChristoph Hellwig ;; 592e5d355d1Saliguori --enable-io-thread) io_thread="yes" 593e5d355d1Saliguori ;; 59477755340Sths --disable-blobs) blobs="no" 59577755340Sths ;; 596eac30262Saliguori --kerneldir=*) kerneldir="$optarg" 597eac30262Saliguori ;; 5984a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 5994a19f1ecSpbrook ;; 600a25dba17SJuan Quintela --disable-docs) docs="no" 60170ec5dc0SAnthony Liguori ;; 602a25dba17SJuan Quintela --enable-docs) docs="yes" 60383a3ab8bSJuan Quintela ;; 6047f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 6057f1559c6Sbalrog ;; 6067d13299dSbellard esac 6077d13299dSbellarddone 6087d13299dSbellard 6093142255cSblueswir1# 6103142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 611a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 6123142255cSblueswir1# 613379f6698SPaul Brookhost_guest_base="no" 61440293e58Sbellardcase "$cpu" in 615ed968ff1SJuan Quintela sparc) case $sparc_cpu in 616ed968ff1SJuan Quintela v7|v8) 617a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 618ed968ff1SJuan Quintela ;; 619ed968ff1SJuan Quintela v8plus|v8plusa) 620a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 621ed968ff1SJuan Quintela ;; 622ed968ff1SJuan Quintela *) # sparc_cpu not defined in the command line 623a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" 624ed968ff1SJuan Quintela esac 6250c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 626a558ee17SJuan Quintela QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" 627762e8230Sblueswir1 if test "$solaris" = "no" ; then 628a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS" 629c81da56eSJuan Quintela helper_cflags="-ffixed-i0" 630762e8230Sblueswir1 fi 6313142255cSblueswir1 ;; 632ed968ff1SJuan Quintela sparc64) 633a558ee17SJuan Quintela QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" 6340c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 635a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" 636ed968ff1SJuan Quintela if test "$solaris" != "no" ; then 637a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" 638762e8230Sblueswir1 fi 6393142255cSblueswir1 ;; 64076d83bdeSths s390) 641a558ee17SJuan Quintela QEMU_CFLAGS="-march=z900 $QEMU_CFLAGS" 64276d83bdeSths ;; 64340293e58Sbellard i386) 644a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 6450c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 646c81da56eSJuan Quintela helper_cflags="-fomit-frame-pointer" 647379f6698SPaul Brook host_guest_base="yes" 64840293e58Sbellard ;; 64940293e58Sbellard x86_64) 650a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 6510c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 652379f6698SPaul Brook host_guest_base="yes" 653379f6698SPaul Brook ;; 654379f6698SPaul Brook arm*) 655379f6698SPaul Brook host_guest_base="yes" 65640293e58Sbellard ;; 657f6548c0aSmalc ppc*) 658f6548c0aSmalc host_guest_base="yes" 659f6548c0aSmalc ;; 6603142255cSblueswir1esac 6613142255cSblueswir1 662379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base" 663379f6698SPaul Brook 664af5db58eSpbrookif test x"$show_help" = x"yes" ; then 665af5db58eSpbrookcat << EOF 666af5db58eSpbrook 667af5db58eSpbrookUsage: configure [options] 668af5db58eSpbrookOptions: [defaults in brackets after descriptions] 669af5db58eSpbrook 670af5db58eSpbrookEOF 671af5db58eSpbrookecho "Standard options:" 672af5db58eSpbrookecho " --help print this message" 673af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 674af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 675af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 676af5db58eSpbrookecho " --target-list=LIST set target list [$target_list]" 677af5db58eSpbrookecho "" 678af5db58eSpbrookecho "Advanced options (experts only):" 679af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 680af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 681af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 682af5db58eSpbrookecho " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc." 683a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 684e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 685af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 6866a882643Spbrookecho " --install=INSTALL use specified install [$install]" 687af5db58eSpbrookecho " --static enable static build [$static]" 688f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 689f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 69009695a4aSStefan Weilecho " --enable-debug enable common debug build options" 691890b1658Saliguoriecho " --enable-sparse enable sparse checker" 692890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 6931625af87Saliguoriecho " --disable-strip disable stripping binaries" 69485aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 695fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 696c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 697af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 698c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 699c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 7004c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 7014c9b53e3Smalcecho " Available cards: $audio_possible_cards" 702eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 703eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 7048ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 705e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 706fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 7072e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 7084ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 7098d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 7101be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 7112f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 712ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 713af896aaaSpbrookecho " --disable-curses disable curses output" 714c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 715769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 716788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 7172df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 7182df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 7195495ed11SLuiz Capitulinoecho " --disable-check-utests disable check unit-tests" 7205495ed11SLuiz Capitulinoecho " --enable-check-utests enable check unit-tests" 721fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 722a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 7237ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 724b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 725bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 726e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 727af5db58eSpbrookecho " --enable-system enable all system emulation targets" 728af5db58eSpbrookecho " --disable-system disable all system emulation targets" 7290953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 7300953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 731831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 732831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 733831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 734831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 73584778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 73684778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 737379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 738379f6698SPaul Brookecho " emulation targets" 739379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 74034005a00SKirill A. Shutemovecho " --enable-user-pie build usermode emulation targets as PIE" 74134005a00SKirill A. Shutemovecho " --disable-user-pie do not build usermode emulation targets as PIE" 742af5db58eSpbrookecho " --fmod-lib path to FMOD library" 743af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 7442f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 745c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 7463142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 747ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 748ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 749e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 750dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 7515c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 7525c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 753e5d355d1Saliguoriecho " --enable-io-thread enable IO thread" 75477755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 755eac30262Saliguoriecho " --kerneldir=PATH look for kernel includes in PATH" 756af5db58eSpbrookecho "" 7575bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 758af5db58eSpbrookexit 1 759af5db58eSpbrookfi 760af5db58eSpbrook 761ec530c81Sbellard# 762ec530c81Sbellard# Solaris specific configure tool chain decisions 763ec530c81Sbellard# 764ec530c81Sbellardif test "$solaris" = "yes" ; then 765ec530c81Sbellard solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"` 766ec530c81Sbellard if test -z "$solinst" ; then 767ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 768ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 769ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 770ec530c81Sbellard exit 1 771ec530c81Sbellard fi 772ec530c81Sbellard if test "$solinst" = "/usr/sbin/install" ; then 773ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 774ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 775ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 776ec530c81Sbellard exit 1 777ec530c81Sbellard fi 778ec530c81Sbellard sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"` 779ec530c81Sbellard if test -z "$sol_ar" ; then 780ec530c81Sbellard echo "Error: No path includes ar" 781ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 782ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 783ec530c81Sbellard fi 784ec530c81Sbellard exit 1 785ec530c81Sbellard fi 786ec530c81Sbellardfi 787ec530c81Sbellard 788ec530c81Sbellard 7895327cf48Sbellardif test -z "$target_list" ; then 7905327cf48Sbellard# these targets are portable 7910a8e90f4Spbrook if [ "$softmmu" = "yes" ] ; then 7922408a527Saurel32 target_list="\ 7932408a527Saurel32i386-softmmu \ 7942408a527Saurel32x86_64-softmmu \ 7952408a527Saurel32arm-softmmu \ 7962408a527Saurel32cris-softmmu \ 7972408a527Saurel32m68k-softmmu \ 79872b675caSEdgar E. Iglesiasmicroblaze-softmmu \ 7992408a527Saurel32mips-softmmu \ 8002408a527Saurel32mipsel-softmmu \ 8012408a527Saurel32mips64-softmmu \ 8022408a527Saurel32mips64el-softmmu \ 8032408a527Saurel32ppc-softmmu \ 8042408a527Saurel32ppcemb-softmmu \ 8052408a527Saurel32ppc64-softmmu \ 8062408a527Saurel32sh4-softmmu \ 8072408a527Saurel32sh4eb-softmmu \ 8082408a527Saurel32sparc-softmmu \ 8091b64fcaeSIgor V. Kovalenkosparc64-softmmu \ 8102408a527Saurel32" 8110a8e90f4Spbrook fi 8125327cf48Sbellard# the following are Linux specific 813831b7825Sths if [ "$linux_user" = "yes" ] ; then 8142408a527Saurel32 target_list="${target_list}\ 8152408a527Saurel32i386-linux-user \ 8162408a527Saurel32x86_64-linux-user \ 8172408a527Saurel32alpha-linux-user \ 8182408a527Saurel32arm-linux-user \ 8192408a527Saurel32armeb-linux-user \ 8202408a527Saurel32cris-linux-user \ 8212408a527Saurel32m68k-linux-user \ 82272b675caSEdgar E. Iglesiasmicroblaze-linux-user \ 8232408a527Saurel32mips-linux-user \ 8242408a527Saurel32mipsel-linux-user \ 8252408a527Saurel32ppc-linux-user \ 8262408a527Saurel32ppc64-linux-user \ 8272408a527Saurel32ppc64abi32-linux-user \ 8282408a527Saurel32sh4-linux-user \ 8292408a527Saurel32sh4eb-linux-user \ 8302408a527Saurel32sparc-linux-user \ 8312408a527Saurel32sparc64-linux-user \ 8322408a527Saurel32sparc32plus-linux-user \ 8332408a527Saurel32" 834831b7825Sths fi 835831b7825Sths# the following are Darwin specific 836831b7825Sths if [ "$darwin_user" = "yes" ] ; then 8372408a527Saurel32 target_list="$target_list i386-darwin-user ppc-darwin-user " 8385327cf48Sbellard fi 83984778508Sblueswir1# the following are BSD specific 84084778508Sblueswir1 if [ "$bsd_user" = "yes" ] ; then 84184778508Sblueswir1 target_list="${target_list}\ 84231fc12dfSblueswir1i386-bsd-user \ 84331fc12dfSblueswir1x86_64-bsd-user \ 84431fc12dfSblueswir1sparc-bsd-user \ 84584778508Sblueswir1sparc64-bsd-user \ 84684778508Sblueswir1" 84784778508Sblueswir1 fi 8486e20a45fSbellardelse 849b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 8505327cf48Sbellardfi 8510a8e90f4Spbrookif test -z "$target_list" ; then 8520a8e90f4Spbrook echo "No targets enabled" 8530a8e90f4Spbrook exit 1 8540a8e90f4Spbrookfi 8555327cf48Sbellard 856249247c9SJuan Quintelafeature_not_found() { 857249247c9SJuan Quintela feature=$1 858249247c9SJuan Quintela 859249247c9SJuan Quintela echo "ERROR" 860249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 8619332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 862249247c9SJuan Quintela echo "ERROR" 863249247c9SJuan Quintela exit 1; 864249247c9SJuan Quintela} 865249247c9SJuan Quintela 8667d13299dSbellardif test -z "$cross_prefix" ; then 8677d13299dSbellard 8687d13299dSbellard# --- 8697d13299dSbellard# big/little endian test 8707d13299dSbellardcat > $TMPC << EOF 8717d13299dSbellard#include <inttypes.h> 8727d13299dSbellardint main(int argc, char ** argv){ 8737d13299dSbellard volatile uint32_t i=0x01234567; 8747d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 8757d13299dSbellard} 8767d13299dSbellardEOF 8777d13299dSbellard 87852166aa0SJuan Quintelaif compile_prog "" "" ; then 8797d13299dSbellard$TMPE && bigendian="yes" 8807d13299dSbellardelse 8817d13299dSbellardecho big/little test failed 8827d13299dSbellardfi 8837d13299dSbellard 8847d13299dSbellardelse 8857d13299dSbellard 8867d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 887ea8f20f8SJuan Quintelacase "$cpu" in 88824e804ecSAlexander Graf armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 889ea8f20f8SJuan Quintela bigendian=yes 890ea8f20f8SJuan Quintela ;; 891ea8f20f8SJuan Quintelaesac 8927d13299dSbellard 8937d13299dSbellardfi 8947d13299dSbellard 895b6853697Sbellard# host long bits test 896b6853697Sbellardhostlongbits="32" 897ea8f20f8SJuan Quintelacase "$cpu" in 89824e804ecSAlexander Graf x86_64|alpha|ia64|sparc64|ppc64|s390x) 899ea8f20f8SJuan Quintela hostlongbits=64 900ea8f20f8SJuan Quintela ;; 901ea8f20f8SJuan Quintelaesac 902b6853697Sbellard 903b0a47e79SJuan Quintela 904b0a47e79SJuan Quintela########################################## 905b0a47e79SJuan Quintela# NPTL probe 906b0a47e79SJuan Quintela 907b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 908bd0c5661Spbrook cat > $TMPC <<EOF 909bd0c5661Spbrook#include <sched.h> 91030813ceaSpbrook#include <linux/futex.h> 911bd0c5661Spbrookvoid foo() 912bd0c5661Spbrook{ 913bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 914bd0c5661Spbrook#error bork 915bd0c5661Spbrook#endif 916bd0c5661Spbrook} 917bd0c5661SpbrookEOF 918bd0c5661Spbrook 91952166aa0SJuan Quintela if compile_object ; then 920b0a47e79SJuan Quintela nptl=yes 921bd0c5661Spbrook else 922b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 923b0a47e79SJuan Quintela feature_not_found "nptl" 924b0a47e79SJuan Quintela fi 925b0a47e79SJuan Quintela nptl=no 926b0a47e79SJuan Quintela fi 927bd0c5661Spbrookfi 928bd0c5661Spbrook 92911d9f695Sbellard########################################## 930ac62922eSbalrog# zlib check 931ac62922eSbalrog 932ac62922eSbalrogcat > $TMPC << EOF 933ac62922eSbalrog#include <zlib.h> 934ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 935ac62922eSbalrogEOF 93652166aa0SJuan Quintelaif compile_prog "" "-lz" ; then 937ac62922eSbalrog : 938ac62922eSbalrogelse 939ac62922eSbalrog echo 940ac62922eSbalrog echo "Error: zlib check failed" 941ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 942ac62922eSbalrog echo 943ac62922eSbalrog exit 1 944ac62922eSbalrogfi 945ac62922eSbalrog 946ac62922eSbalrog########################################## 947e37630caSaliguori# xen probe 948e37630caSaliguori 949fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 950b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 951e37630caSaliguori cat > $TMPC <<EOF 952e37630caSaliguori#include <xenctrl.h> 953e37630caSaliguori#include <xs.h> 954df7a607bSChristoph Eggerint main(void) { xs_daemon_open(); xc_interface_open(); return 0; } 955e37630caSaliguoriEOF 95652166aa0SJuan Quintela if compile_prog "" "$xen_libs" ; then 957fc321b4bSJuan Quintela xen=yes 9583efd632bSJuan Quintela libs_softmmu="$xen_libs $libs_softmmu" 959e37630caSaliguori else 960fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 961fc321b4bSJuan Quintela feature_not_found "xen" 962fc321b4bSJuan Quintela fi 963fc321b4bSJuan Quintela xen=no 964e37630caSaliguori fi 965e37630caSaliguorifi 966e37630caSaliguori 967e37630caSaliguori########################################## 968dfffc653SJuan Quintela# Sparse probe 969dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 970dfffc653SJuan Quintela if test -x "$(which cgcc 2>/dev/null)"; then 971dfffc653SJuan Quintela sparse=yes 972dfffc653SJuan Quintela else 973dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 974dfffc653SJuan Quintela feature_not_found "sparse" 975dfffc653SJuan Quintela fi 976dfffc653SJuan Quintela sparse=no 977dfffc653SJuan Quintela fi 978dfffc653SJuan Quintelafi 979dfffc653SJuan Quintela 980dfffc653SJuan Quintela########################################## 98111d9f695Sbellard# SDL probe 98211d9f695Sbellard 98311d9f695Sbellardsdl_too_old=no 98411d9f695Sbellard 985c4198157SJuan Quintelaif test "$sdl" != "no" ; then 98611d9f695Sbellard cat > $TMPC << EOF 98711d9f695Sbellard#include <SDL.h> 98811d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 98911d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 99011d9f695SbellardEOF 9918ad3a7ddSJuan Quintela sdl_cflags=`sdl-config --cflags 2> /dev/null` 9928ad3a7ddSJuan Quintela sdl_libs=`sdl-config --libs 2> /dev/null` 99352166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 994d3d9738fSJuan Quintela _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'` 99511d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 99611d9f695Sbellard sdl_too_old=yes 99711d9f695Sbellard else 998fd677642Sths if test "$cocoa" = "no" ; then 99911d9f695Sbellard sdl=yes 100011d9f695Sbellard fi 1001fd677642Sths fi 10027c1f25b4Sbellard 10037c1f25b4Sbellard # static link with sdl ? 10041ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 10051ac88f28SJuan Quintela sdl_libs=`sdl-config --static-libs 2>/dev/null` 10061ac88f28SJuan Quintela if test `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` ; then 10071ac88f28SJuan Quintela sdl_libs="$sdl_libs `aalib-config --static-libs >2 /dev/null`" 10081ac88f28SJuan Quintela sdl_cflags="$sd_cflags `aalib-config --cflags >2 /dev/null`" 100911d9f695Sbellard fi 101052166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 10111ac88f28SJuan Quintela : 10121ac88f28SJuan Quintela else 10131ac88f28SJuan Quintela sdl=no 10147c1f25b4Sbellard fi 10157c1f25b4Sbellard fi # static link 1016c4198157SJuan Quintela else # sdl not found 1017c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1018c4198157SJuan Quintela feature_not_found "sdl" 1019c4198157SJuan Quintela fi 1020c4198157SJuan Quintela sdl=no 10217c1f25b4Sbellard fi # sdl compile test 1022fd677642Sthsfi 102311d9f695Sbellard 10245368a422Saliguoriif test "$sdl" = "yes" ; then 10255368a422Saliguori cat > $TMPC <<EOF 10265368a422Saliguori#include <SDL.h> 10275368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 10285368a422Saliguori#include <X11/XKBlib.h> 10295368a422Saliguori#else 10305368a422Saliguori#error No x11 support 10315368a422Saliguori#endif 10325368a422Saliguoriint main(void) { return 0; } 10335368a422SaliguoriEOF 103452166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1035681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 10365368a422Saliguori fi 103707d9ac44SJuan Quintela if test "$mingw32" = "yes" ; then 103807d9ac44SJuan Quintela sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole" 103907d9ac44SJuan Quintela fi 10400705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 10415368a422Saliguorifi 10425368a422Saliguori 10438f28f3fbSths########################################## 10448d5d2d4cSths# VNC TLS detection 10451be10ad2SJuan Quintelaif test "$vnc_tls" != "no" ; then 1046ae6b5e5aSaliguori cat > $TMPC <<EOF 1047ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1048ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1049ae6b5e5aSaliguoriEOF 1050ae6b5e5aSaliguori vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null` 1051ae6b5e5aSaliguori vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null` 105252166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 10531be10ad2SJuan Quintela vnc_tls=yes 1054a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1055ae6b5e5aSaliguori else 10561be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 10571be10ad2SJuan Quintela feature_not_found "vnc-tls" 10581be10ad2SJuan Quintela fi 10591be10ad2SJuan Quintela vnc_tls=no 10608d5d2d4cSths fi 10618d5d2d4cSthsfi 10628d5d2d4cSths 10638d5d2d4cSths########################################## 10642f9606b3Saliguori# VNC SASL detection 10653aefa744SJuan Quintelaif test "$vnc_sasl" != "no" ; then 10662f9606b3Saliguori cat > $TMPC <<EOF 10672f9606b3Saliguori#include <sasl/sasl.h> 10682f9606b3Saliguori#include <stdio.h> 10692f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 10702f9606b3SaliguoriEOF 10712f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 10722f9606b3Saliguori vnc_sasl_cflags="" 10732f9606b3Saliguori vnc_sasl_libs="-lsasl2" 107452166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1075ea784e3bSJuan Quintela vnc_sasl=yes 1076fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 10772f9606b3Saliguori else 1078ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1079ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1080ea784e3bSJuan Quintela fi 1081ea784e3bSJuan Quintela vnc_sasl=no 10822f9606b3Saliguori fi 10832f9606b3Saliguorifi 10842f9606b3Saliguori 10852f9606b3Saliguori########################################## 108676655d6dSaliguori# fnmatch() probe, used for ACL routines 108776655d6dSaliguorifnmatch="no" 108876655d6dSaliguoricat > $TMPC << EOF 108976655d6dSaliguori#include <fnmatch.h> 109076655d6dSaliguoriint main(void) 109176655d6dSaliguori{ 109276655d6dSaliguori fnmatch("foo", "foo", 0); 109376655d6dSaliguori return 0; 109476655d6dSaliguori} 109576655d6dSaliguoriEOF 109652166aa0SJuan Quintelaif compile_prog "" "" ; then 109776655d6dSaliguori fnmatch="yes" 109876655d6dSaliguorifi 109976655d6dSaliguori 110076655d6dSaliguori########################################## 1101ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1102ee682d27SStefan Weilif test "$uuid" != "no" ; then 1103ee682d27SStefan Weil uuid_libs="-luuid" 1104ee682d27SStefan Weil cat > $TMPC << EOF 1105ee682d27SStefan Weil#include <uuid/uuid.h> 1106ee682d27SStefan Weilint main(void) 1107ee682d27SStefan Weil{ 1108ee682d27SStefan Weil uuid_t my_uuid; 1109ee682d27SStefan Weil uuid_generate(my_uuid); 1110ee682d27SStefan Weil return 0; 1111ee682d27SStefan Weil} 1112ee682d27SStefan WeilEOF 1113ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1114ee682d27SStefan Weil uuid="yes" 1115ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1116ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1117ee682d27SStefan Weil else 1118ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1119ee682d27SStefan Weil feature_not_found "uuid" 1120ee682d27SStefan Weil fi 1121ee682d27SStefan Weil uuid=no 1122ee682d27SStefan Weil fi 1123ee682d27SStefan Weilfi 1124ee682d27SStefan Weil 1125ee682d27SStefan Weil########################################## 11268a16d273Sths# vde libraries probe 1127dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 11284baae0acSJuan Quintela vde_libs="-lvdeplug" 11298a16d273Sths cat > $TMPC << EOF 11308a16d273Sths#include <libvdeplug.h> 11314a7f0e06Spbrookint main(void) 11324a7f0e06Spbrook{ 11334a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 11344a7f0e06Spbrook vde_open("", "", &a); 11354a7f0e06Spbrook return 0; 11364a7f0e06Spbrook} 11378a16d273SthsEOF 113852166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 11394baae0acSJuan Quintela vde=yes 11408e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 11418e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1142dfb278bdSJuan Quintela else 1143dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1144dfb278bdSJuan Quintela feature_not_found "vde" 1145dfb278bdSJuan Quintela fi 1146dfb278bdSJuan Quintela vde=no 11478a16d273Sths fi 11488a16d273Sthsfi 11498a16d273Sths 11508a16d273Sths########################################## 1151c2de5c91Smalc# Sound support libraries probe 11528f28f3fbSths 1153c2de5c91Smalcaudio_drv_probe() 1154c2de5c91Smalc{ 1155c2de5c91Smalc drv=$1 1156c2de5c91Smalc hdr=$2 1157c2de5c91Smalc lib=$3 1158c2de5c91Smalc exp=$4 1159c2de5c91Smalc cfl=$5 11608f28f3fbSths cat > $TMPC << EOF 1161c2de5c91Smalc#include <$hdr> 1162c2de5c91Smalcint main(void) { $exp } 11638f28f3fbSthsEOF 116452166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 11658f28f3fbSths : 11668f28f3fbSths else 11678f28f3fbSths echo 1168c2de5c91Smalc echo "Error: $drv check failed" 1169c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 11708f28f3fbSths echo 11718f28f3fbSths exit 1 11728f28f3fbSths fi 1173c2de5c91Smalc} 1174c2de5c91Smalc 11752fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1176c2de5c91Smalcfor drv in $audio_drv_list; do 1177c2de5c91Smalc case $drv in 1178c2de5c91Smalc alsa) 1179c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1180c2de5c91Smalc "snd_pcm_t **handle; return snd_pcm_close(*handle);" 1181a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1182c2de5c91Smalc ;; 1183c2de5c91Smalc 1184c2de5c91Smalc fmod) 1185c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1186c2de5c91Smalc echo 1187c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1188c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1189c2de5c91Smalc echo 1190c2de5c91Smalc exit 1 11918f28f3fbSths fi 1192c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1193a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1194c2de5c91Smalc ;; 1195c2de5c91Smalc 1196c2de5c91Smalc esd) 1197c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1198a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 119967f86e8eSJuan Quintela audio_pt_int="yes" 1200c2de5c91Smalc ;; 1201b8e59f18Smalc 1202b8e59f18Smalc pa) 1203493abda6SAurelien Jarno audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \ 1204b8e59f18Smalc "pa_simple *s = NULL; pa_simple_free(s); return 0;" 1205493abda6SAurelien Jarno libs_softmmu="-lpulse -lpulse-simple $libs_softmmu" 120667f86e8eSJuan Quintela audio_pt_int="yes" 1207b8e59f18Smalc ;; 1208b8e59f18Smalc 1209997e690aSJuan Quintela coreaudio) 1210997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1211997e690aSJuan Quintela ;; 1212997e690aSJuan Quintela 1213a4bf6780SJuan Quintela dsound) 1214a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1215d5631638Smalc audio_win_int="yes" 1216a4bf6780SJuan Quintela ;; 1217a4bf6780SJuan Quintela 1218a4bf6780SJuan Quintela oss) 1219a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1220a4bf6780SJuan Quintela ;; 1221a4bf6780SJuan Quintela 1222a4bf6780SJuan Quintela sdl|wav) 12232f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 12242f6a1ab0Sblueswir1 ;; 12252f6a1ab0Sblueswir1 1226d5631638Smalc winwave) 1227d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1228d5631638Smalc audio_win_int="yes" 1229d5631638Smalc ;; 1230d5631638Smalc 1231e4c63a6aSmalc *) 12321c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1233e4c63a6aSmalc echo 1234e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1235e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 1236e4c63a6aSmalc echo 1237e4c63a6aSmalc exit 1 1238e4c63a6aSmalc } 1239e4c63a6aSmalc ;; 1240c2de5c91Smalc esac 1241c2de5c91Smalcdone 12428f28f3fbSths 12434d3b6f6eSbalrog########################################## 12442e4d9fb1Saurel32# BrlAPI probe 12452e4d9fb1Saurel32 12464ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 1247eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 12482e4d9fb1Saurel32 cat > $TMPC << EOF 12492e4d9fb1Saurel32#include <brlapi.h> 12502e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 12512e4d9fb1Saurel32EOF 125252166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 12532e4d9fb1Saurel32 brlapi=yes 1254264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 12554ffcedb6SJuan Quintela else 12564ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 12574ffcedb6SJuan Quintela feature_not_found "brlapi" 12584ffcedb6SJuan Quintela fi 12594ffcedb6SJuan Quintela brlapi=no 1260eb82284fSJuan Quintela fi 1261eb82284fSJuan Quintelafi 12622e4d9fb1Saurel32 12632e4d9fb1Saurel32########################################## 12644d3b6f6eSbalrog# curses probe 12654f78ef9aSJuan Quintelacurses_list="-lncurses -lcurses" 12664d3b6f6eSbalrog 1267c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 1268c584a6d0SJuan Quintela curses_found=no 12694d3b6f6eSbalrog cat > $TMPC << EOF 12704d3b6f6eSbalrog#include <curses.h> 12715a8ff3aaSblueswir1#ifdef __OpenBSD__ 12725a8ff3aaSblueswir1#define resize_term resizeterm 12735a8ff3aaSblueswir1#endif 12745a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); } 12754d3b6f6eSbalrogEOF 12764f78ef9aSJuan Quintela for curses_lib in $curses_list; do 12774f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 1278c584a6d0SJuan Quintela curses_found=yes 12794f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 12804f78ef9aSJuan Quintela break 12814d3b6f6eSbalrog fi 12824f78ef9aSJuan Quintela done 1283c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 1284c584a6d0SJuan Quintela curses=yes 1285c584a6d0SJuan Quintela else 1286c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 1287c584a6d0SJuan Quintela feature_not_found "curses" 1288c584a6d0SJuan Quintela fi 1289c584a6d0SJuan Quintela curses=no 1290c584a6d0SJuan Quintela fi 12914f78ef9aSJuan Quintelafi 12924d3b6f6eSbalrog 1293414f0dabSblueswir1########################################## 1294769ce76dSAlexander Graf# curl probe 1295769ce76dSAlexander Graf 1296788c8196SJuan Quintelaif test "$curl" != "no" ; then 1297769ce76dSAlexander Graf cat > $TMPC << EOF 1298769ce76dSAlexander Graf#include <curl/curl.h> 1299769ce76dSAlexander Grafint main(void) { return curl_easy_init(); } 1300769ce76dSAlexander GrafEOF 1301b1d5a277SJuan Quintela curl_cflags=`curl-config --cflags 2>/dev/null` 130252368552SPaul Brook curl_libs=`curl-config --libs 2>/dev/null` 1303b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 1304769ce76dSAlexander Graf curl=yes 1305f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 1306f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 1307788c8196SJuan Quintela else 1308788c8196SJuan Quintela if test "$curl" = "yes" ; then 1309788c8196SJuan Quintela feature_not_found "curl" 1310788c8196SJuan Quintela fi 1311788c8196SJuan Quintela curl=no 1312769ce76dSAlexander Graf fi 1313769ce76dSAlexander Graffi # test "$curl" 1314769ce76dSAlexander Graf 1315769ce76dSAlexander Graf########################################## 13165495ed11SLuiz Capitulino# check framework probe 13175495ed11SLuiz Capitulino 13185495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then 13195495ed11SLuiz Capitulino cat > $TMPC << EOF 13205495ed11SLuiz Capitulino#include <check.h> 13215495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; } 13225495ed11SLuiz CapitulinoEOF 13235495ed11SLuiz Capitulino check_libs=`pkg-config --libs check` 13245495ed11SLuiz Capitulino if compile_prog "" $check_libs ; then 13255495ed11SLuiz Capitulino check_utests=yes 13265495ed11SLuiz Capitulino libs_tools="$check_libs $libs_tools" 13275495ed11SLuiz Capitulino else 13285495ed11SLuiz Capitulino if test "$check_utests" = "yes" ; then 13295495ed11SLuiz Capitulino feature_not_found "check" 13305495ed11SLuiz Capitulino fi 13315495ed11SLuiz Capitulino check_utests=no 13325495ed11SLuiz Capitulino fi 13335495ed11SLuiz Capitulinofi # test "$check_utests" 13345495ed11SLuiz Capitulino 13355495ed11SLuiz Capitulino########################################## 1336fb599c9aSbalrog# bluez support probe 1337a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 1338e820e3f4Sbalrog cat > $TMPC << EOF 1339e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 1340e820e3f4Sbalrogint main(void) { return bt_error(0); } 1341e820e3f4SbalrogEOF 1342efcfd0c5SBlue Swirl bluez_cflags=`pkg-config --cflags bluez 2> /dev/null` 1343efcfd0c5SBlue Swirl bluez_libs=`pkg-config --libs bluez 2> /dev/null` 134452166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 1345a20a6f46SJuan Quintela bluez=yes 1346e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 1347e820e3f4Sbalrog else 1348a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 1349a20a6f46SJuan Quintela feature_not_found "bluez" 1350a20a6f46SJuan Quintela fi 1351e820e3f4Sbalrog bluez="no" 1352e820e3f4Sbalrog fi 1353fb599c9aSbalrogfi 1354fb599c9aSbalrog 1355fb599c9aSbalrog########################################## 13567ba1e619Saliguori# kvm probe 1357b31a0277SJuan Quintelaif test "$kvm" != "no" ; then 13587ba1e619Saliguori cat > $TMPC <<EOF 13597ba1e619Saliguori#include <linux/kvm.h> 13609fd8d8d7Saliguori#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12 13617ba1e619Saliguori#error Invalid KVM version 13627ba1e619Saliguori#endif 13639fd8d8d7Saliguori#if !defined(KVM_CAP_USER_MEMORY) 13649fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_USER_MEMORY 13659fd8d8d7Saliguori#endif 13669fd8d8d7Saliguori#if !defined(KVM_CAP_SET_TSS_ADDR) 13679fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_SET_TSS_ADDR 13689fd8d8d7Saliguori#endif 13699fd8d8d7Saliguori#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS) 13709fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS 13719fd8d8d7Saliguori#endif 13727ba1e619Saliguoriint main(void) { return 0; } 13737ba1e619SaliguoriEOF 1374eac30262Saliguori if test "$kerneldir" != "" ; then 1375eac30262Saliguori kvm_cflags=-I"$kerneldir"/include 13768444eb6eSaliguori if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \ 13778444eb6eSaliguori -a -d "$kerneldir/arch/x86/include" ; then 13788444eb6eSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include" 1379406b430dSaliguori elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then 1380406b430dSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" 13810e60a699SAlexander Graf elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then 13820e60a699SAlexander Graf kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include" 13838444eb6eSaliguori elif test -d "$kerneldir/arch/$cpu/include" ; then 13848444eb6eSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include" 13858444eb6eSaliguori fi 1386eac30262Saliguori else 1387eac30262Saliguori kvm_cflags="" 1388eac30262Saliguori fi 138952166aa0SJuan Quintela if compile_prog "$kvm_cflags" "" ; then 1390b31a0277SJuan Quintela kvm=yes 13917ba1e619Saliguori else 1392b31a0277SJuan Quintela if test "$kvm" = "yes" ; then 13939fd8d8d7Saliguori if [ -x "`which awk 2>/dev/null`" ] && \ 13949fd8d8d7Saliguori [ -x "`which grep 2>/dev/null`" ]; then 1395a558ee17SJuan Quintela kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \ 13969fd8d8d7Saliguori | grep "error: " \ 13979fd8d8d7Saliguori | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` 13989fd8d8d7Saliguori if test "$kvmerr" != "" ; then 1399b31a0277SJuan Quintela echo -e "${kvmerr}\n\ 1400168ccc11SJan Kiszka NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \ 1401168ccc11SJan Kiszka recent kvm-kmod from http://sourceforge.net/projects/kvm." 14029fd8d8d7Saliguori fi 14039fd8d8d7Saliguori fi 1404b31a0277SJuan Quintela feature_not_found "kvm" 1405b31a0277SJuan Quintela fi 1406b31a0277SJuan Quintela kvm=no 14077ba1e619Saliguori fi 14087ba1e619Saliguorifi 14097ba1e619Saliguori 14107ba1e619Saliguori########################################## 1411e5d355d1Saliguori# pthread probe 1412de65fe0fSSebastian HerbsztPTHREADLIBS_LIST="-lpthread -lpthreadGC2" 14133c529d93Saliguori 1414e5d355d1Saliguoripthread=no 1415414f0dabSblueswir1cat > $TMPC << EOF 14163c529d93Saliguori#include <pthread.h> 1417de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; } 1418414f0dabSblueswir1EOF 1419de65fe0fSSebastian Herbsztfor pthread_lib in $PTHREADLIBS_LIST; do 142052166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 1421e5d355d1Saliguori pthread=yes 14225572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 1423de65fe0fSSebastian Herbszt break 1424414f0dabSblueswir1 fi 1425de65fe0fSSebastian Herbsztdone 1426414f0dabSblueswir1 14274617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 14284dd75c70SChristoph Hellwig echo 14294dd75c70SChristoph Hellwig echo "Error: pthread check failed" 14304dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 14314dd75c70SChristoph Hellwig echo 14324dd75c70SChristoph Hellwig exit 1 1433e5d355d1Saliguorifi 1434e5d355d1Saliguori 1435bf9298b9Saliguori########################################## 14365c6c3a6cSChristoph Hellwig# linux-aio probe 14375c6c3a6cSChristoph Hellwig 14385c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 14395c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 14405c6c3a6cSChristoph Hellwig#include <libaio.h> 14415c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 14425c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 14435c6c3a6cSChristoph HellwigEOF 14445c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 14455c6c3a6cSChristoph Hellwig linux_aio=yes 14465c6c3a6cSChristoph Hellwig LIBS="$LIBS -laio" 14475c6c3a6cSChristoph Hellwig else 14485c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 14495c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 14505c6c3a6cSChristoph Hellwig fi 14513cfcae3cSLuiz Capitulino linux_aio=no 14525c6c3a6cSChristoph Hellwig fi 14535c6c3a6cSChristoph Hellwigfi 14545c6c3a6cSChristoph Hellwig 14555c6c3a6cSChristoph Hellwig########################################## 1456bf9298b9Saliguori# iovec probe 1457bf9298b9Saliguoricat > $TMPC <<EOF 1458db34f0b3Sblueswir1#include <sys/types.h> 1459bf9298b9Saliguori#include <sys/uio.h> 1460db34f0b3Sblueswir1#include <unistd.h> 1461bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; } 1462bf9298b9SaliguoriEOF 1463bf9298b9Saliguoriiovec=no 146452166aa0SJuan Quintelaif compile_prog "" "" ; then 1465bf9298b9Saliguori iovec=yes 1466bf9298b9Saliguorifi 1467bf9298b9Saliguori 1468f652e6afSaurel32########################################## 1469ceb42de8Saliguori# preadv probe 1470ceb42de8Saliguoricat > $TMPC <<EOF 1471ceb42de8Saliguori#include <sys/types.h> 1472ceb42de8Saliguori#include <sys/uio.h> 1473ceb42de8Saliguori#include <unistd.h> 1474ceb42de8Saliguoriint main(void) { preadv; } 1475ceb42de8SaliguoriEOF 1476ceb42de8Saliguoripreadv=no 147752166aa0SJuan Quintelaif compile_prog "" "" ; then 1478ceb42de8Saliguori preadv=yes 1479ceb42de8Saliguorifi 1480ceb42de8Saliguori 1481ceb42de8Saliguori########################################## 1482f652e6afSaurel32# fdt probe 14832df87df7SJuan Quintelaif test "$fdt" != "no" ; then 1484b41af4baSJuan Quintela fdt_libs="-lfdt" 1485f652e6afSaurel32 cat > $TMPC << EOF 1486f652e6afSaurel32int main(void) { return 0; } 1487f652e6afSaurel32EOF 148852166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 1489f652e6afSaurel32 fdt=yes 1490e4782985SJuan Quintela libs_softmmu="$fdt_libs $libs_softmmu" 14912df87df7SJuan Quintela else 14922df87df7SJuan Quintela if test "$fdt" = "yes" ; then 14932df87df7SJuan Quintela feature_not_found "fdt" 14942df87df7SJuan Quintela fi 14952df87df7SJuan Quintela fdt=no 1496f652e6afSaurel32 fi 1497f652e6afSaurel32fi 1498f652e6afSaurel32 14993b3f24adSaurel32# 15003b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 15013b3f24adSaurel32# emulator. This is done because older glibc versions don't 15023b3f24adSaurel32# have syscall stubs for these implemented. 15033b3f24adSaurel32# 15043b3f24adSaurel32atfile=no 15053b3f24adSaurel32cat > $TMPC << EOF 15063b3f24adSaurel32#define _ATFILE_SOURCE 15073b3f24adSaurel32#include <sys/types.h> 15083b3f24adSaurel32#include <fcntl.h> 15093b3f24adSaurel32#include <unistd.h> 15103b3f24adSaurel32 15113b3f24adSaurel32int 15123b3f24adSaurel32main(void) 15133b3f24adSaurel32{ 15143b3f24adSaurel32 /* try to unlink nonexisting file */ 15153b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 15163b3f24adSaurel32} 15173b3f24adSaurel32EOF 151852166aa0SJuan Quintelaif compile_prog "" "" ; then 15193b3f24adSaurel32 atfile=yes 15203b3f24adSaurel32fi 15213b3f24adSaurel32 152239386ac7Saurel32# Check for inotify functions when we are building linux-user 15233b3f24adSaurel32# emulator. This is done because older glibc versions don't 15243b3f24adSaurel32# have syscall stubs for these implemented. In that case we 15253b3f24adSaurel32# don't provide them even if kernel supports them. 15263b3f24adSaurel32# 15273b3f24adSaurel32inotify=no 15283b3f24adSaurel32cat > $TMPC << EOF 15293b3f24adSaurel32#include <sys/inotify.h> 15303b3f24adSaurel32 15313b3f24adSaurel32int 15323b3f24adSaurel32main(void) 15333b3f24adSaurel32{ 15343b3f24adSaurel32 /* try to start inotify */ 15358690e420Saurel32 return inotify_init(); 15363b3f24adSaurel32} 15373b3f24adSaurel32EOF 153852166aa0SJuan Quintelaif compile_prog "" "" ; then 15393b3f24adSaurel32 inotify=yes 15403b3f24adSaurel32fi 15413b3f24adSaurel32 1542ebc996f3SRiku Voipio# check if utimensat and futimens are supported 1543ebc996f3SRiku Voipioutimens=no 1544ebc996f3SRiku Voipiocat > $TMPC << EOF 1545ebc996f3SRiku Voipio#define _ATFILE_SOURCE 1546ebc996f3SRiku Voipio#define _GNU_SOURCE 1547ebc996f3SRiku Voipio#include <stddef.h> 1548ebc996f3SRiku Voipio#include <fcntl.h> 1549ebc996f3SRiku Voipio 1550ebc996f3SRiku Voipioint main(void) 1551ebc996f3SRiku Voipio{ 1552ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 1553ebc996f3SRiku Voipio futimens(0, NULL); 1554ebc996f3SRiku Voipio return 0; 1555ebc996f3SRiku Voipio} 1556ebc996f3SRiku VoipioEOF 155752166aa0SJuan Quintelaif compile_prog "" "" ; then 1558ebc996f3SRiku Voipio utimens=yes 1559ebc996f3SRiku Voipiofi 1560ebc996f3SRiku Voipio 1561099d6b0fSRiku Voipio# check if pipe2 is there 1562099d6b0fSRiku Voipiopipe2=no 1563099d6b0fSRiku Voipiocat > $TMPC << EOF 1564099d6b0fSRiku Voipio#define _GNU_SOURCE 1565099d6b0fSRiku Voipio#include <unistd.h> 1566099d6b0fSRiku Voipio#include <fcntl.h> 1567099d6b0fSRiku Voipio 1568099d6b0fSRiku Voipioint main(void) 1569099d6b0fSRiku Voipio{ 1570099d6b0fSRiku Voipio int pipefd[2]; 1571099d6b0fSRiku Voipio pipe2(pipefd, O_CLOEXEC); 1572099d6b0fSRiku Voipio return 0; 1573099d6b0fSRiku Voipio} 1574099d6b0fSRiku VoipioEOF 157552166aa0SJuan Quintelaif compile_prog "" "" ; then 1576099d6b0fSRiku Voipio pipe2=yes 1577099d6b0fSRiku Voipiofi 1578099d6b0fSRiku Voipio 157940ff6d7eSKevin Wolf# check if accept4 is there 158040ff6d7eSKevin Wolfaccept4=no 158140ff6d7eSKevin Wolfcat > $TMPC << EOF 158240ff6d7eSKevin Wolf#define _GNU_SOURCE 158340ff6d7eSKevin Wolf#include <sys/socket.h> 158440ff6d7eSKevin Wolf#include <stddef.h> 158540ff6d7eSKevin Wolf 158640ff6d7eSKevin Wolfint main(void) 158740ff6d7eSKevin Wolf{ 158840ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 158940ff6d7eSKevin Wolf return 0; 159040ff6d7eSKevin Wolf} 159140ff6d7eSKevin WolfEOF 159240ff6d7eSKevin Wolfif compile_prog "" "" ; then 159340ff6d7eSKevin Wolf accept4=yes 159440ff6d7eSKevin Wolffi 159540ff6d7eSKevin Wolf 15963ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 15973ce34dfbSvibisreenivasansplice=no 15983ce34dfbSvibisreenivasancat > $TMPC << EOF 15993ce34dfbSvibisreenivasan#define _GNU_SOURCE 16003ce34dfbSvibisreenivasan#include <unistd.h> 16013ce34dfbSvibisreenivasan#include <fcntl.h> 16023ce34dfbSvibisreenivasan#include <limits.h> 16033ce34dfbSvibisreenivasan 16043ce34dfbSvibisreenivasanint main(void) 16053ce34dfbSvibisreenivasan{ 16063ce34dfbSvibisreenivasan int len, fd; 16073ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 16083ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 16093ce34dfbSvibisreenivasan return 0; 16103ce34dfbSvibisreenivasan} 16113ce34dfbSvibisreenivasanEOF 161252166aa0SJuan Quintelaif compile_prog "" "" ; then 16133ce34dfbSvibisreenivasan splice=yes 16143ce34dfbSvibisreenivasanfi 16153ce34dfbSvibisreenivasan 1616c2882b96SRiku Voipio# check if eventfd is supported 1617c2882b96SRiku Voipioeventfd=no 1618c2882b96SRiku Voipiocat > $TMPC << EOF 1619c2882b96SRiku Voipio#include <sys/eventfd.h> 1620c2882b96SRiku Voipio 1621c2882b96SRiku Voipioint main(void) 1622c2882b96SRiku Voipio{ 1623c2882b96SRiku Voipio int efd = eventfd(0, 0); 1624c2882b96SRiku Voipio return 0; 1625c2882b96SRiku Voipio} 1626c2882b96SRiku VoipioEOF 1627c2882b96SRiku Voipioif compile_prog "" "" ; then 1628c2882b96SRiku Voipio eventfd=yes 1629c2882b96SRiku Voipiofi 1630c2882b96SRiku Voipio 1631d0927938SUlrich Hecht# check for fallocate 1632d0927938SUlrich Hechtfallocate=no 1633d0927938SUlrich Hechtcat > $TMPC << EOF 1634d0927938SUlrich Hecht#include <fcntl.h> 1635d0927938SUlrich Hecht 1636d0927938SUlrich Hechtint main(void) 1637d0927938SUlrich Hecht{ 1638d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 1639d0927938SUlrich Hecht return 0; 1640d0927938SUlrich Hecht} 1641d0927938SUlrich HechtEOF 1642be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then 1643d0927938SUlrich Hecht fallocate=yes 1644d0927938SUlrich Hechtfi 1645d0927938SUlrich Hecht 1646d0927938SUlrich Hecht# check for dup3 1647d0927938SUlrich Hechtdup3=no 1648d0927938SUlrich Hechtcat > $TMPC << EOF 1649d0927938SUlrich Hecht#include <unistd.h> 1650d0927938SUlrich Hecht 1651d0927938SUlrich Hechtint main(void) 1652d0927938SUlrich Hecht{ 1653d0927938SUlrich Hecht dup3(0, 0, 0); 1654d0927938SUlrich Hecht return 0; 1655d0927938SUlrich Hecht} 1656d0927938SUlrich HechtEOF 165778f5d726SJan Kiszkaif compile_prog "" "" ; then 1658d0927938SUlrich Hecht dup3=yes 1659d0927938SUlrich Hechtfi 1660d0927938SUlrich Hecht 1661cc8ae6deSpbrook# Check if tools are available to build documentation. 1662a25dba17SJuan Quintelaif test "$docs" != "no" ; then 166383a3ab8bSJuan Quintela if test -x "`which texi2html 2>/dev/null`" -a \ 166483a3ab8bSJuan Quintela -x "`which pod2man 2>/dev/null`" ; then 1665a25dba17SJuan Quintela docs=yes 166683a3ab8bSJuan Quintela else 1667a25dba17SJuan Quintela if test "$docs" = "yes" ; then 1668a25dba17SJuan Quintela feature_not_found "docs" 166983a3ab8bSJuan Quintela fi 1670a25dba17SJuan Quintela docs=no 167183a3ab8bSJuan Quintela fi 1672cc8ae6deSpbrookfi 1673cc8ae6deSpbrook 1674f514f41cSStefan Weil# Search for bswap_32 function 16756ae9a1f4SJuan Quintelabyteswap_h=no 16766ae9a1f4SJuan Quintelacat > $TMPC << EOF 16776ae9a1f4SJuan Quintela#include <byteswap.h> 16786ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 16796ae9a1f4SJuan QuintelaEOF 168052166aa0SJuan Quintelaif compile_prog "" "" ; then 16816ae9a1f4SJuan Quintela byteswap_h=yes 16826ae9a1f4SJuan Quintelafi 16836ae9a1f4SJuan Quintela 1684f514f41cSStefan Weil# Search for bswap_32 function 16856ae9a1f4SJuan Quintelabswap_h=no 16866ae9a1f4SJuan Quintelacat > $TMPC << EOF 16876ae9a1f4SJuan Quintela#include <sys/endian.h> 16886ae9a1f4SJuan Quintela#include <sys/types.h> 16896ae9a1f4SJuan Quintela#include <machine/bswap.h> 16906ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 16916ae9a1f4SJuan QuintelaEOF 169252166aa0SJuan Quintelaif compile_prog "" "" ; then 16936ae9a1f4SJuan Quintela bswap_h=yes 16946ae9a1f4SJuan Quintelafi 16956ae9a1f4SJuan Quintela 1696da93a1fdSaliguori########################################## 1697da93a1fdSaliguori# Do we need librt 1698da93a1fdSaliguoricat > $TMPC <<EOF 1699da93a1fdSaliguori#include <signal.h> 1700da93a1fdSaliguori#include <time.h> 1701da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); } 1702da93a1fdSaliguoriEOF 1703da93a1fdSaliguori 170452166aa0SJuan Quintelaif compile_prog "" "" ; then 170507ffa4bdSJuan Quintela : 170652166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then 170707ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 1708da93a1fdSaliguorifi 1709da93a1fdSaliguori 1710a36abbbbSJuan Quintela# Determine what linker flags to use to force archive inclusion 1711a36abbbbSJuan Quintelacheck_linker_flags() 1712a36abbbbSJuan Quintela{ 1713a36abbbbSJuan Quintela w2= 1714a36abbbbSJuan Quintela if test "$2" ; then 1715a36abbbbSJuan Quintela w2=-Wl,$2 1716a36abbbbSJuan Quintela fi 171752166aa0SJuan Quintela compile_prog "" "-Wl,$1 ${w2}" 1718a36abbbbSJuan Quintela} 1719a36abbbbSJuan Quintela 1720a36abbbbSJuan Quintelacat > $TMPC << EOF 1721a36abbbbSJuan Quintelaint main(void) { } 1722a36abbbbSJuan QuintelaEOF 1723a36abbbbSJuan Quintelaif check_linker_flags --whole-archive --no-whole-archive ; then 1724a36abbbbSJuan Quintela # GNU ld 1725a36abbbbSJuan Quintela arlibs_begin="-Wl,--whole-archive" 1726a36abbbbSJuan Quintela arlibs_end="-Wl,--no-whole-archive" 1727a36abbbbSJuan Quintelaelif check_linker_flags -z,allextract -z,defaultextract ; then 1728a36abbbbSJuan Quintela # Solaris ld 172931ff504dSBlue Swirl arlibs_begin="-Wl,-z,allextract" 1730a36abbbbSJuan Quintela arlibs_end="-Wl,-z,defaultextract" 1731a36abbbbSJuan Quintelaelif check_linker_flags -all_load ; then 1732a36abbbbSJuan Quintela # Mac OS X 1733a36abbbbSJuan Quintela arlibs_begin="-all_load" 1734a36abbbbSJuan Quintela arlibs_end="" 1735a36abbbbSJuan Quintelaelse 1736a36abbbbSJuan Quintela echo "Error: your linker does not support --whole-archive or -z." 1737a36abbbbSJuan Quintela echo "Please report to qemu-devel@nongnu.org" 1738a36abbbbSJuan Quintela exit 1 1739a36abbbbSJuan Quintelafi 1740a36abbbbSJuan Quintela 174131ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 17426362a53fSJuan Quintela "$aix" != "yes" ; then 17436362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 17446362a53fSJuan Quintelafi 17456362a53fSJuan Quintela 1746de5071c5SBlue Swirl########################################## 1747de5071c5SBlue Swirl# check if the compiler defines offsetof 1748de5071c5SBlue Swirl 1749de5071c5SBlue Swirlneed_offsetof=yes 1750de5071c5SBlue Swirlcat > $TMPC << EOF 1751de5071c5SBlue Swirl#include <stddef.h> 1752de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); } 1753de5071c5SBlue SwirlEOF 1754de5071c5SBlue Swirlif compile_prog "" "" ; then 1755de5071c5SBlue Swirl need_offsetof=no 1756de5071c5SBlue Swirlfi 1757de5071c5SBlue Swirl 17585f6b9e8fSBlue Swirl########################################## 1759747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result 1760747bbdf7SBlue Swirl# 1761747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning 1762747bbdf7SBlue Swirl# about attribute warn_unused_result 1763747bbdf7SBlue Swirl 1764747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no 1765747bbdf7SBlue Swirlcat > $TMPC << EOF 1766747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4) 1767747bbdf7SBlue Swirl#error gcc 3.3 or older 1768747bbdf7SBlue Swirl#endif 1769747bbdf7SBlue Swirlint main(void) { return 0;} 1770747bbdf7SBlue SwirlEOF 1771747bbdf7SBlue Swirlif compile_prog "" ""; then 1772747bbdf7SBlue Swirl gcc_attribute_warn_unused_result=yes 1773747bbdf7SBlue Swirlfi 1774747bbdf7SBlue Swirl 1775747bbdf7SBlue Swirl########################################## 17765f6b9e8fSBlue Swirl# check if we have fdatasync 17775f6b9e8fSBlue Swirl 17785f6b9e8fSBlue Swirlfdatasync=no 17795f6b9e8fSBlue Swirlcat > $TMPC << EOF 17805f6b9e8fSBlue Swirl#include <unistd.h> 17815f6b9e8fSBlue Swirlint main(void) { return fdatasync(0); } 17825f6b9e8fSBlue SwirlEOF 17835f6b9e8fSBlue Swirlif compile_prog "" "" ; then 17845f6b9e8fSBlue Swirl fdatasync=yes 17855f6b9e8fSBlue Swirlfi 17865f6b9e8fSBlue Swirl 1787e86ecd4bSJuan Quintela# End of CC checks 1788e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 1789e86ecd4bSJuan Quintela 1790e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 17911156c669SJuan Quintela CFLAGS="-O2 $CFLAGS" 1792e86ecd4bSJuan Quintelafi 1793a316e378SJuan Quintela 1794e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror 1795e86ecd4bSJuan Quintela# by default. Only enable by default for git builds 1796e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION` 179720ff6c80SAnthony Liguori 179820ff6c80SAnthony Liguoriif test -z "$werror" ; then 1799e86ecd4bSJuan Quintela if test "$z_version" = "50" -a \ 1800e86ecd4bSJuan Quintela "$linux" = "yes" ; then 1801e86ecd4bSJuan Quintela werror="yes" 1802e86ecd4bSJuan Quintela else 1803e86ecd4bSJuan Quintela werror="no" 1804e86ecd4bSJuan Quintela fi 1805e86ecd4bSJuan Quintelafi 1806e86ecd4bSJuan Quintela 180720ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 180820ff6c80SAnthony Liguori# enable/disable 180920ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 181020ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 181120ff6c80SAnthony Liguori zero_malloc="no" 181220ff6c80SAnthony Liguori else 181320ff6c80SAnthony Liguori zero_malloc="yes" 181420ff6c80SAnthony Liguori fi 181520ff6c80SAnthony Liguorifi 181620ff6c80SAnthony Liguori 1817e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then 1818a558ee17SJuan Quintela QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 1819e86ecd4bSJuan Quintelafi 1820e86ecd4bSJuan Quintela 1821e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 1822e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 18231156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 1824e86ecd4bSJuan Quintela fi 1825e86ecd4bSJuan Quintelafi 1826e86ecd4bSJuan Quintela 182711d9f695Sbellardif test "$mingw32" = "yes" ; then 182811d9f695Sbellard if test -z "$prefix" ; then 182955418b96SStefan Weil prefix="c:/Program Files/Qemu" 183011d9f695Sbellard fi 1831308c3593Spbrook mansuffix="" 1832308c3593Spbrook datasuffix="" 1833308c3593Spbrook docsuffix="" 1834308c3593Spbrook binsuffix="" 183511d9f695Sbellardelse 183611d9f695Sbellard if test -z "$prefix" ; then 183711d9f695Sbellard prefix="/usr/local" 183811d9f695Sbellard fi 1839308c3593Spbrook mansuffix="/share/man" 1840308c3593Spbrook datasuffix="/share/qemu" 1841308c3593Spbrook docsuffix="/share/doc/qemu" 1842308c3593Spbrook binsuffix="/bin" 184311d9f695Sbellardfi 18445a67135aSbellard 18457d13299dSbellardecho "Install prefix $prefix" 1846308c3593Spbrookecho "BIOS directory $prefix$datasuffix" 1847308c3593Spbrookecho "binary directory $prefix$binsuffix" 184811d9f695Sbellardif test "$mingw32" = "no" ; then 1849308c3593Spbrookecho "Manual directory $prefix$mansuffix" 185043ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 185111d9f695Sbellardfi 18525a67135aSbellardecho "Source path $source_path" 18537d13299dSbellardecho "C compiler $cc" 185483469015Sbellardecho "Host C compiler $host_cc" 18550c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 1856a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 18570c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 18587d13299dSbellardecho "make $make" 18596a882643Spbrookecho "install $install" 1860a98fd896Sbellardecho "host CPU $cpu" 1861de83cd02Sbellardecho "host big endian $bigendian" 186297a847bcSbellardecho "target list $target_list" 1863ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 18647d13299dSbellardecho "gprof enabled $gprof" 186503b4fe7dSaliguoriecho "sparse enabled $sparse" 18661625af87Saliguoriecho "strip binaries $strip_opt" 186705c2a3e7Sbellardecho "profiler $profiler" 186843ce4dfeSbellardecho "static build $static" 186985aa5189Sbellardecho "-Werror enabled $werror" 18705b0753e0Sbellardif test "$darwin" = "yes" ; then 18715b0753e0Sbellard echo "Cocoa support $cocoa" 18725b0753e0Sbellardfi 187397a847bcSbellardecho "SDL support $sdl" 18744d3b6f6eSbalrogecho "curses support $curses" 1875769ce76dSAlexander Grafecho "curl support $curl" 18765495ed11SLuiz Capitulinoecho "check support $check_utests" 187767b915a5Sbellardecho "mingw32 support $mingw32" 18780c58ac1cSmalcecho "Audio drivers $audio_drv_list" 18790c58ac1cSmalcecho "Extra audio cards $audio_card_list" 1880eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 18818ff9cbf7Smalcecho "Mixer emulation $mixemu" 18828d5d2d4cSthsecho "VNC TLS support $vnc_tls" 18832f9606b3Saliguoriecho "VNC SASL support $vnc_sasl" 18843142255cSblueswir1if test -n "$sparc_cpu"; then 18853142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 18863142255cSblueswir1fi 1887e37630caSaliguoriecho "xen support $xen" 18882e4d9fb1Saurel32echo "brlapi support $brlapi" 1889a20a6f46SJuan Quintelaecho "bluez support $bluez" 1890a25dba17SJuan Quintelaecho "Documentation $docs" 1891c5937220Spbrook[ ! -z "$uname_release" ] && \ 1892c5937220Spbrookecho "uname -r $uname_release" 1893bd0c5661Spbrookecho "NPTL support $nptl" 1894379f6698SPaul Brookecho "GUEST_BASE $guest_base" 189534005a00SKirill A. Shutemovecho "PIE user targets $user_pie" 18968a16d273Sthsecho "vde support $vde" 1897e5d355d1Saliguoriecho "IO thread $io_thread" 18985c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 189977755340Sthsecho "Install blobs $blobs" 1900b31a0277SJuan Quintelaecho "KVM support $kvm" 1901f652e6afSaurel32echo "fdt support $fdt" 1902ceb42de8Saliguoriecho "preadv support $preadv" 19035f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 1904ee682d27SStefan Weilecho "uuid support $uuid" 190567b915a5Sbellard 190697a847bcSbellardif test $sdl_too_old = "yes"; then 190724b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 1908e8cd23deSbellardfi 190997a847bcSbellard 191098ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 19114bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 191297a847bcSbellard 191398ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 191498ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 191598ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 191698ec69acSJuan Quintelaecho >> $config_host_mak 191798ec69acSJuan Quintela 19182358a494SJuan Quintelaecho "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak 1919804edf29SJuan Quintela 19202408a527Saurel32case "$cpu" in 192124e804ecSAlexander Graf i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1922e0da9dd3SJuan Quintela ARCH=$cpu 19232408a527Saurel32 ;; 1924a302c32dSLaurent Desnogues armv4b|armv4l) 192516dbd14fSJuan Quintela ARCH=arm 19262408a527Saurel32 ;; 19272408a527Saurel32 *) 19283142255cSblueswir1 echo "Unsupported CPU = $cpu" 19297d13299dSbellard exit 1 19302408a527Saurel32 ;; 19312408a527Saurel32esac 193298ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 1933f8393946Saurel32if test "$debug_tcg" = "yes" ; then 19342358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 1935f8393946Saurel32fi 1936f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 19372358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 1938f3d08ee6SPaul Brookfi 19391625af87Saliguoriif test "$strip_opt" = "yes" ; then 194098ec69acSJuan Quintela echo "STRIP_OPT=-s" >> $config_host_mak 19411625af87Saliguorifi 19427d13299dSbellardif test "$bigendian" = "yes" ; then 1943e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 194497a847bcSbellardfi 19452358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak 194667b915a5Sbellardif test "$mingw32" = "yes" ; then 194798ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 1948210fa556Spbrookelse 194935f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 1950210fa556Spbrookfi 1951128ab2ffSblueswir1 1952dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 1953dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 1954dffcb71cSMark McLoughlinfi 1955dffcb71cSMark McLoughlin 195683fb7adfSbellardif test "$darwin" = "yes" ; then 195798ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 195883fb7adfSbellardfi 1959b29fe3edSmalc 1960b29fe3edSmalcif test "$aix" = "yes" ; then 196198ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 1962b29fe3edSmalcfi 1963b29fe3edSmalc 1964ec530c81Sbellardif test "$solaris" = "yes" ; then 196598ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 19662358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 19670475a5caSths if test "$needs_libsunmath" = "yes" ; then 196875b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 19690475a5caSths fi 1970ec530c81Sbellardfi 197197a847bcSbellardif test "$static" = "yes" ; then 197298ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 19731156c669SJuan Quintela LDFLAGS="-static $LDFLAGS" 197497a847bcSbellardfi 197505c2a3e7Sbellardif test $profiler = "yes" ; then 19762358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 197705c2a3e7Sbellardfi 1978c20709aaSbellardif test "$slirp" = "yes" ; then 197998ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 1980b6e31c12SJuan Quintela QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS" 1981c20709aaSbellardfi 19828a16d273Sthsif test "$vde" = "yes" ; then 198398ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 19848a16d273Sthsfi 19850c58ac1cSmalcfor card in $audio_card_list; do 1986f6e5889eSpbrook def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` 198798ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 19880c58ac1cSmalcdone 19892358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 19900c58ac1cSmalcfor drv in $audio_drv_list; do 1991f6e5889eSpbrook def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` 199298ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 1993923e4521Smalc if test "$drv" = "fmod"; then 19947aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 1995fb065187Sbellard fi 19960c58ac1cSmalcdone 199767f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 199867f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 199967f86e8eSJuan Quintelafi 2000d5631638Smalcif test "$audio_win_int" = "yes" ; then 2001d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 2002d5631638Smalcfi 2003eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 20048ff9cbf7Smalcif test "$mixemu" = "yes" ; then 200598ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 20068ff9cbf7Smalcfi 20078d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 200898ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 2009525061bfSJuan Quintela echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak 20108d5d2d4cSthsfi 20112f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 201298ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 201360ddf533SJuan Quintela echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak 20142f9606b3Saliguorifi 201576655d6dSaliguoriif test "$fnmatch" = "yes" ; then 20162358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 201776655d6dSaliguorifi 2018ee682d27SStefan Weilif test "$uuid" = "yes" ; then 2019ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 2020ee682d27SStefan Weilfi 2021b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 202298ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 20232358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 202498ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 2025ad064840Spbrookif [ "$source_path_used" = "yes" ]; then 202698ec69acSJuan Quintela echo "VPATH=$source_path" >> $config_host_mak 2027ad064840Spbrookfi 202898ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 2029a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 203098ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 2031cc8ae6deSpbrookfi 20321ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 203398ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 20348ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 203549ecc3faSbellardfi 203649ecc3faSbellardif test "$cocoa" = "yes" ; then 203798ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 203849ecc3faSbellardfi 20394d3b6f6eSbalrogif test "$curses" = "yes" ; then 204098ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 2041ab4e5602SJan Kiszkafi 20423b3f24adSaurel32if test "$atfile" = "yes" ; then 20432358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 20443b3f24adSaurel32fi 2045ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 20462358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 2047ebc996f3SRiku Voipiofi 2048099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 20492358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 2050099d6b0fSRiku Voipiofi 205140ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 205240ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 205340ff6d7eSKevin Wolffi 20543ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 20552358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 20563ce34dfbSvibisreenivasanfi 2057c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 2058c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 2059c2882b96SRiku Voipiofi 2060d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 2061d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 2062d0927938SUlrich Hechtfi 2063d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 2064d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 2065d0927938SUlrich Hechtfi 20663b3f24adSaurel32if test "$inotify" = "yes" ; then 20672358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 20683b3f24adSaurel32fi 20696ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 20706ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 20716ae9a1f4SJuan Quintelafi 20726ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 20736ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 20746ae9a1f4SJuan Quintelafi 2075769ce76dSAlexander Grafif test "$curl" = "yes" ; then 207698ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 2077b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 2078769ce76dSAlexander Graffi 20792e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 208098ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 20812e4d9fb1Saurel32fi 2082fb599c9aSbalrogif test "$bluez" = "yes" ; then 208398ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 2084ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 2085fb599c9aSbalrogfi 2086e37630caSaliguoriif test "$xen" = "yes" ; then 20875647eb74SJuan Quintela echo "CONFIG_XEN=y" >> $config_host_mak 2088e37630caSaliguorifi 2089e5d355d1Saliguoriif test "$io_thread" = "yes" ; then 209098ec69acSJuan Quintela echo "CONFIG_IOTHREAD=y" >> $config_host_mak 2091e5d355d1Saliguorifi 20925c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 20935c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 20945c6c3a6cSChristoph Hellwigfi 209577755340Sthsif test "$blobs" = "yes" ; then 209698ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 209777755340Sthsfi 2098bf9298b9Saliguoriif test "$iovec" = "yes" ; then 20992358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 2100bf9298b9Saliguorifi 2101ceb42de8Saliguoriif test "$preadv" = "yes" ; then 21022358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 2103ceb42de8Saliguorifi 2104f652e6afSaurel32if test "$fdt" = "yes" ; then 21053f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 2106f652e6afSaurel32fi 2107de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then 2108de5071c5SBlue Swirl echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak 2109de5071c5SBlue Swirlfi 2110747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then 2111747bbdf7SBlue Swirl echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak 2112747bbdf7SBlue Swirlfi 21135f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 21145f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 21155f6b9e8fSBlue Swirlfi 211697a847bcSbellard 211783fb7adfSbellard# XXX: suppress that 21187d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 21192358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 21207d3505c5Sbellardfi 21217d3505c5Sbellard 21222358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 2123c5937220Spbrook 212420ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 212520ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 212620ff6c80SAnthony Liguorifi 212720ff6c80SAnthony Liguori 212868063649Sblueswir1# USB host support 212968063649Sblueswir1case "$usb" in 213068063649Sblueswir1linux) 213198ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 213268063649Sblueswir1;; 213368063649Sblueswir1bsd) 213498ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 213568063649Sblueswir1;; 213668063649Sblueswir1*) 213798ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 213868063649Sblueswir1;; 213968063649Sblueswir1esac 214068063649Sblueswir1 2141c39e3338Spbrooktools= 2142c39e3338Spbrookif test `expr "$target_list" : ".*softmmu.*"` != 0 ; then 214386355e07SAurelien Jarno tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 2144*2bff4b6fSBlue Swirl if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 214586355e07SAurelien Jarno tools="qemu-nbd\$(EXESUF) $tools" 21465495ed11SLuiz Capitulino if [ "$check_utests" = "yes" ]; then 21473aa3dcffSLuiz Capitulino tools="check-qint check-qstring check-qdict check-qlist $tools" 2148422c46a8SAnthony Liguori tools="check-qfloat check-qjson $tools" 21495495ed11SLuiz Capitulino fi 21507a5ca864Sbellard fi 2151c39e3338Spbrookfi 215298ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 2153c39e3338Spbrook 2154161294d8SJuan Quintela# Mac OS X ships with a broken assembler 2155253d0942SAlexander Grafroms= 2156161294d8SJuan Quintelaif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 2157ea5ad306SAndreas Faerber "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 2158b461cdc9SBlue Swirl `expr "$target_list" : ".*softmmu.*"` != 0 ; then 2159c05ac895SPaul Brook roms="optionrom" 2160253d0942SAlexander Graffi 216198ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 2162253d0942SAlexander Graf 2163804edf29SJuan Quintelaecho "prefix=$prefix" >> $config_host_mak 2164804edf29SJuan Quintelaecho "bindir=\${prefix}$binsuffix" >> $config_host_mak 2165804edf29SJuan Quintelaecho "mandir=\${prefix}$mansuffix" >> $config_host_mak 2166804edf29SJuan Quintelaecho "datadir=\${prefix}$datasuffix" >> $config_host_mak 2167804edf29SJuan Quintelaecho "docdir=\${prefix}$docsuffix" >> $config_host_mak 2168804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 2169804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 2170804edf29SJuan Quintelaecho "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak 2171804edf29SJuan Quintelaecho "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak 2172804edf29SJuan Quintelaecho "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak 2173804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 2174804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 2175804edf29SJuan Quintelaif test "$sparse" = "yes" ; then 2176804edf29SJuan Quintela echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 2177804edf29SJuan Quintela echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 2178a558ee17SJuan Quintela echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 2179804edf29SJuan Quintelafi 2180804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 2181804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 2182804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 2183e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 2184a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 2185c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak 2186e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 2187a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 2188a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 218973da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 21903e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 2191804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 2192804edf29SJuan Quintela 21934bf6b55bSJuan Quintela# generate list of library paths for linker script 21944bf6b55bSJuan Quintela 21954bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 21964bf6b55bSJuan Quintela 21974bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 21984bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 21994bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 22004bf6b55bSJuan Quintela else 22014bf6b55bSJuan Quintela rm ${config_host_ld}~ 22024bf6b55bSJuan Quintela fi 22034bf6b55bSJuan Quintelafi 22044bf6b55bSJuan Quintela 220597a847bcSbellardfor target in $target_list; do 220697a847bcSbellardtarget_dir="$target" 220725be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 2208600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 220997a847bcSbellardtarget_bigendian="no" 22101f3d3c8fSJuan Quintela 2211ea2d6a39SJuan Quintelacase "$target_arch2" in 221224e804ecSAlexander Graf armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus) 2213ea2d6a39SJuan Quintela target_bigendian=yes 2214ea2d6a39SJuan Quintela ;; 2215ea2d6a39SJuan Quintelaesac 221697a847bcSbellardtarget_softmmu="no" 2217997344f3Sbellardtarget_user_only="no" 2218831b7825Sthstarget_linux_user="no" 2219831b7825Sthstarget_darwin_user="no" 222084778508Sblueswir1target_bsd_user="no" 22219e407a85Spbrookcase "$target" in 2222600309b6SBlue Swirl ${target_arch2}-softmmu) 22239e407a85Spbrook target_softmmu="yes" 22249e407a85Spbrook ;; 2225600309b6SBlue Swirl ${target_arch2}-linux-user) 22269c7a4202SBlue Swirl if test "$linux" != "yes" ; then 22279c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 22289c7a4202SBlue Swirl exit 1 22299c7a4202SBlue Swirl fi 22309e407a85Spbrook target_user_only="yes" 22319e407a85Spbrook target_linux_user="yes" 22329e407a85Spbrook ;; 2233600309b6SBlue Swirl ${target_arch2}-darwin-user) 22349c7a4202SBlue Swirl if test "$darwin" != "yes" ; then 22359c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Darwin host" 22369c7a4202SBlue Swirl exit 1 22379c7a4202SBlue Swirl fi 22389e407a85Spbrook target_user_only="yes" 2239831b7825Sths target_darwin_user="yes" 22409e407a85Spbrook ;; 2241600309b6SBlue Swirl ${target_arch2}-bsd-user) 22429cf55765SBlue Swirl if test "$bsd" != "yes" ; then 22439c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 22449c7a4202SBlue Swirl exit 1 22459c7a4202SBlue Swirl fi 224684778508Sblueswir1 target_user_only="yes" 224784778508Sblueswir1 target_bsd_user="yes" 224884778508Sblueswir1 ;; 22499e407a85Spbrook *) 22509e407a85Spbrook echo "ERROR: Target '$target' not recognised" 22519e407a85Spbrook exit 1 22529e407a85Spbrook ;; 22539e407a85Spbrookesac 2254831b7825Sths 225597a847bcSbellardmkdir -p $target_dir 2256158142c2Sbellardmkdir -p $target_dir/fpu 225757fec1feSbellardmkdir -p $target_dir/tcg 225859f2a787SGerd Hoffmannmkdir -p $target_dir/ide 225984778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then 226069de927cSbellard mkdir -p $target_dir/nwfpe 226169de927cSbellardfi 226269de927cSbellard 2263ec530c81Sbellard# 2264ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link 2265ec530c81Sbellard# 2266ec530c81Sbellardrm -f $target_dir/Makefile 2267ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile 2268ec530c81Sbellard 226997a847bcSbellard 227025be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 227197a847bcSbellard 2272e5fe0c52Spbrookbflt="no" 2273cb33da57Sblueswir1elfload32="no" 2274bd0c5661Spbrooktarget_nptl="no" 2275600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 227625be210fSJuan Quintelaecho "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 227756aebc89Spbrookgdb_xml_files="" 22787ba1e619Saliguori 2279938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 22806acff7daSJuan QuintelaTARGET_BASE_ARCH="" 2281e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 2282e73aae67SJuan Quintela 2283600309b6SBlue Swirlcase "$target_arch2" in 22842408a527Saurel32 i386) 22851ad2134fSPaul Brook target_phys_bits=32 22862408a527Saurel32 ;; 22872408a527Saurel32 x86_64) 22886acff7daSJuan Quintela TARGET_BASE_ARCH=i386 22891ad2134fSPaul Brook target_phys_bits=64 22902408a527Saurel32 ;; 22912408a527Saurel32 alpha) 22921ad2134fSPaul Brook target_phys_bits=64 22932408a527Saurel32 ;; 22942408a527Saurel32 arm|armeb) 2295b498c8a0SJuan Quintela TARGET_ARCH=arm 2296e5fe0c52Spbrook bflt="yes" 2297bd0c5661Spbrook target_nptl="yes" 229856aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 22991ad2134fSPaul Brook target_phys_bits=32 23002408a527Saurel32 ;; 23012408a527Saurel32 cris) 2302253bd7f8Sedgar_igl target_nptl="yes" 23031ad2134fSPaul Brook target_phys_bits=32 23042408a527Saurel32 ;; 23052408a527Saurel32 m68k) 23060938cda5Saurel32 bflt="yes" 230756aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 23081ad2134fSPaul Brook target_phys_bits=32 23092408a527Saurel32 ;; 231072b675caSEdgar E. Iglesias microblaze) 231172b675caSEdgar E. Iglesias bflt="yes" 231272b675caSEdgar E. Iglesias target_nptl="yes" 231372b675caSEdgar E. Iglesias target_phys_bits=32 231472b675caSEdgar E. Iglesias ;; 23152408a527Saurel32 mips|mipsel) 2316b498c8a0SJuan Quintela TARGET_ARCH=mips 231725be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 2318f04dc72fSPaul Brook target_nptl="yes" 23191ad2134fSPaul Brook target_phys_bits=64 23202408a527Saurel32 ;; 23212408a527Saurel32 mipsn32|mipsn32el) 2322b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 23236acff7daSJuan Quintela TARGET_BASE_ARCH=mips 232425be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 23251ad2134fSPaul Brook target_phys_bits=64 23262408a527Saurel32 ;; 23272408a527Saurel32 mips64|mips64el) 2328b498c8a0SJuan Quintela TARGET_ARCH=mips64 23296acff7daSJuan Quintela TARGET_BASE_ARCH=mips 233025be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 23311ad2134fSPaul Brook target_phys_bits=64 23322408a527Saurel32 ;; 23332408a527Saurel32 ppc) 2334c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 23351ad2134fSPaul Brook target_phys_bits=32 2336d6630708SNathan Froyd target_nptl="yes" 23372408a527Saurel32 ;; 23382408a527Saurel32 ppcemb) 23396acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 2340e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 2341c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 23421ad2134fSPaul Brook target_phys_bits=64 2343d6630708SNathan Froyd target_nptl="yes" 23442408a527Saurel32 ;; 23452408a527Saurel32 ppc64) 23466acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 2347e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 2348c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 23491ad2134fSPaul Brook target_phys_bits=64 23502408a527Saurel32 ;; 23512408a527Saurel32 ppc64abi32) 2352b498c8a0SJuan Quintela TARGET_ARCH=ppc64 23536acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 2354e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 235525be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 2356c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 23571ad2134fSPaul Brook target_phys_bits=64 23582408a527Saurel32 ;; 23592408a527Saurel32 sh4|sh4eb) 2360b498c8a0SJuan Quintela TARGET_ARCH=sh4 23614dbed897Spbrook bflt="yes" 23620b6d3ae0Saurel32 target_nptl="yes" 23631ad2134fSPaul Brook target_phys_bits=32 23642408a527Saurel32 ;; 23652408a527Saurel32 sparc) 23661ad2134fSPaul Brook target_phys_bits=64 23672408a527Saurel32 ;; 23682408a527Saurel32 sparc64) 23696acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 23700938cda5Saurel32 elfload32="yes" 23711ad2134fSPaul Brook target_phys_bits=64 23722408a527Saurel32 ;; 23732408a527Saurel32 sparc32plus) 2374b498c8a0SJuan Quintela TARGET_ARCH=sparc64 23756acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 2376e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 237725be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 23781ad2134fSPaul Brook target_phys_bits=64 23792408a527Saurel32 ;; 238024e804ecSAlexander Graf s390x) 238124e804ecSAlexander Graf target_phys_bits=64 238224e804ecSAlexander Graf ;; 23832408a527Saurel32 *) 2384de83cd02Sbellard echo "Unsupported target CPU" 2385de83cd02Sbellard exit 1 23862408a527Saurel32 ;; 23872408a527Saurel32esac 238825be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 2389053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`" 239025be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 239125be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 239242bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 23936acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then 23946acff7daSJuan Quintela TARGET_BASE_ARCH=$TARGET_ARCH 23956acff7daSJuan Quintelafi 239625be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 2397e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 2398e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 2399e6e91b9cSJuan Quintelafi 240025be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 24011ad2134fSPaul Brookif [ $target_phys_bits -lt $hostlongbits ] ; then 24021ad2134fSPaul Brook target_phys_bits=$hostlongbits 24031ad2134fSPaul Brookfi 24041b0c87fcSJuan Quintelacase "$target_arch2" in 24051b0c87fcSJuan Quintela i386|x86_64) 24061b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 240725be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 24081b0c87fcSJuan Quintela fi 24091b0c87fcSJuan Quintelaesac 2410c59249f9SJuan Quintelacase "$target_arch2" in 24110e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 2412c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 2413c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 2414c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 2415c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 24165f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 2417c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 2418c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 241925be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 242025be210fSJuan Quintela echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak 2421c59249f9SJuan Quintela fi 2422c59249f9SJuan Quintelaesac 242325be210fSJuan Quintelaecho "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak 2424de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 242525be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 242697a847bcSbellardfi 242797a847bcSbellardif test "$target_softmmu" = "yes" ; then 242825be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 242925be210fSJuan Quintela echo "LIBS+=$libs_softmmu" >> $config_target_mak 243025be210fSJuan Quintela echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_target_mak 24315791f45bSKirill A. Shutemov echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak 2432de83cd02Sbellardfi 2433997344f3Sbellardif test "$target_user_only" = "yes" ; then 243425be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 2435997344f3Sbellardfi 2436831b7825Sthsif test "$target_linux_user" = "yes" ; then 243725be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 2438831b7825Sthsfi 2439831b7825Sthsif test "$target_darwin_user" = "yes" ; then 244025be210fSJuan Quintela echo "CONFIG_DARWIN_USER=y" >> $config_target_mak 2441831b7825Sthsfi 244256aebc89Spbrooklist="" 244356aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 244456aebc89Spbrook for x in $gdb_xml_files; do 244556aebc89Spbrook list="$list $source_path/gdb-xml/$x" 244656aebc89Spbrook done 244725be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 24483d0f1517SJuan Quintelafi 2449de83cd02Sbellard 2450f57975fbSJuan Quintelacase "$target_arch2" in 2451990b3e19SRichard Henderson alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus) 245225be210fSJuan Quintela echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak 2453f57975fbSJuan Quintela ;; 2454d6b38939SJuan Quintela *) 245525be210fSJuan Quintela echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak 2456d6b38939SJuan Quintela ;; 2457f57975fbSJuan Quintelaesac 2458f57975fbSJuan Quintela 2459e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 246025be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 2461e5fe0c52Spbrookfi 2462bd0c5661Spbrookif test "$target_user_only" = "yes" \ 2463bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 246425be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 2465bd0c5661Spbrookfi 2466cb33da57Sblueswir1# 32 bit ELF loader in addition to native 64 bit loader? 2467cb33da57Sblueswir1if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then 246825be210fSJuan Quintela echo "TARGET_HAS_ELFLOAD32=y" >> $config_target_mak 2469cb33da57Sblueswir1fi 2470379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 247125be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 2472379f6698SPaul Brookfi 247384778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 247425be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 247584778508Sblueswir1fi 24765b0753e0Sbellard 24774afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 2478fa282484SJuan Quintela 24794afddb55SJuan Quintelacflags="" 2480fa282484SJuan Quintelaldflags="" 24819b8e111fSJuan Quintela 248257ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then 248357ddfbf7SJuan Quintela cflags="-I\$(SRC_PATH)/tcg/sparc $cflags" 248424e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 248524e804ecSAlexander Graf cflags="-I\$(SRC_PATH)/tcg/s390 $cflags" 248657ddfbf7SJuan Quintelaelse 248757ddfbf7SJuan Quintela cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags" 248857ddfbf7SJuan Quintelafi 248957ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/tcg $cflags" 249057ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/fpu $cflags" 249157ddfbf7SJuan Quintela 249264656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 249364656024SJuan Quintela case "$i" in 249464656024SJuan Quintela alpha) 249525be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 249664656024SJuan Quintela ;; 249764656024SJuan Quintela arm) 249825be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 249964656024SJuan Quintela ;; 250064656024SJuan Quintela cris) 250125be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 250264656024SJuan Quintela ;; 250364656024SJuan Quintela hppa) 250425be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 250564656024SJuan Quintela ;; 250664656024SJuan Quintela i386|x86_64) 250725be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 250864656024SJuan Quintela ;; 250964656024SJuan Quintela m68k) 251025be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 251164656024SJuan Quintela ;; 251264656024SJuan Quintela microblaze) 251325be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 251464656024SJuan Quintela ;; 251564656024SJuan Quintela mips*) 251625be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 251764656024SJuan Quintela ;; 251864656024SJuan Quintela ppc*) 251925be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 252064656024SJuan Quintela ;; 252124e804ecSAlexander Graf s390*) 252225be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 252364656024SJuan Quintela ;; 252464656024SJuan Quintela sh4) 252525be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 252664656024SJuan Quintela ;; 252764656024SJuan Quintela sparc*) 252825be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 252964656024SJuan Quintela ;; 253064656024SJuan Quintela esac 253164656024SJuan Quinteladone 253264656024SJuan Quintela 25336ee7126fSJuan Quintelacase "$ARCH" in 25346ee7126fSJuan Quintelaalpha) 25356ee7126fSJuan Quintela # Ensure there's only a single GP 25366ee7126fSJuan Quintela cflags="-msmall-data $cflags" 25376ee7126fSJuan Quintela;; 2538c60d0afaSJuan Quintelaia64) 2539c60d0afaSJuan Quintela cflags="-mno-sdata $cflags" 2540c60d0afaSJuan Quintela;; 25416ee7126fSJuan Quintelaesac 25426ee7126fSJuan Quintela 254355d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 254455d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 254555d9c04bSJuan Quintela arm) 254655d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 254755d9c04bSJuan Quintela ;; 254855d9c04bSJuan Quintela i386|mips|ppc) 254955d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 255055d9c04bSJuan Quintela ;; 255155d9c04bSJuan Quintela esac 255255d9c04bSJuan Quintelafi 255355d9c04bSJuan Quintela 255434005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \ 255534005a00SKirill A. Shutemov "$user_pie" = "yes" ; then 255634005a00SKirill A. Shutemov cflags="-fpie $cflags" 255734005a00SKirill A. Shutemov ldflags="-pie $ldflags" 255834005a00SKirill A. Shutemovfi 255934005a00SKirill A. Shutemov 2560471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \ 2561471857ddSJuan Quintela "$TARGET_ARCH" = "microblaze" -o \ 2562471857ddSJuan Quintela "$TARGET_ARCH" = "cris" \) ; then 256325be210fSJuan Quintela echo "CONFIG_NEED_MMU=y" >> $config_target_mak 2564471857ddSJuan Quintelafi 2565471857ddSJuan Quintela 2566d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 256725be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 2568d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 2569d02c1db3SJuan Quintela cflags="-p $cflags" 2570d02c1db3SJuan Quintela ldflags="-p $ldflags" 2571d02c1db3SJuan Quintela fi 2572d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 2573d02c1db3SJuan Quintela ldflags="-p $ldflags" 257425be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 2575d02c1db3SJuan Quintela fi 2576d02c1db3SJuan Quintelafi 2577d02c1db3SJuan Quintela 25786ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" 25799b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 2580fa282484SJuan Quintela case "$ARCH" in 2581fa282484SJuan Quintela sparc) 2582fa282484SJuan Quintela # -static is used to avoid g1/g3 usage by the dynamic linker 2583322e5878SJuan Quintela ldflags="$linker_script -static $ldflags" 2584fa282484SJuan Quintela ;; 2585fa282484SJuan Quintela ia64) 2586322e5878SJuan Quintela ldflags="-Wl,-G0 $linker_script -static $ldflags" 2587fa282484SJuan Quintela ;; 2588df70204dSKirill A. Shutemov i386|x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64) 2589322e5878SJuan Quintela ldflags="$linker_script $ldflags" 2590fa282484SJuan Quintela ;; 2591fa282484SJuan Quintela esac 2592fa282484SJuan Quintelafi 2593fa282484SJuan Quintelaif test "$target_softmmu" = "yes" ; then 2594fa282484SJuan Quintela case "$ARCH" in 2595fa282484SJuan Quintela ia64) 2596322e5878SJuan Quintela ldflags="-Wl,-G0 $linker_script -static $ldflags" 2597fa282484SJuan Quintela ;; 2598fa282484SJuan Quintela esac 2599fa282484SJuan Quintelafi 2600fa282484SJuan Quintela 260125be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 260225be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 2603fa282484SJuan Quintela 260497a847bcSbellarddone # for target in $targets 26057d13299dSbellard 26067d13299dSbellard# build tree in object directory if source path is different from current one 26077d13299dSbellardif test "$source_path_used" = "yes" ; then 2608e1144d00SMark McLoughlin DIRS="tests tests/cris slirp audio block net pc-bios/optionrom" 26092d9f27d2SAnthony Liguori DIRS="$DIRS roms/seabios roms/vgabios" 26107d13299dSbellard FILES="Makefile tests/Makefile" 2611e7daa605Sths FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" 2612e1ffb0f1Sedgar_igl FILES="$FILES tests/test-mmap.c" 26137ea78b74SJan Kiszka FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x" 26142d9f27d2SAnthony Liguori FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 26157ea78b74SJan Kiszka for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do 26167ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 26177ea78b74SJan Kiszka done 26187d13299dSbellard for dir in $DIRS ; do 26197d13299dSbellard mkdir -p $dir 26207d13299dSbellard done 2621ec530c81Sbellard # remove the link and recreate it, as not all "ln -sf" overwrite the link 26227d13299dSbellard for f in $FILES ; do 2623ec530c81Sbellard rm -f $f 2624ec530c81Sbellard ln -s $source_path/$f $f 26257d13299dSbellard done 26267d13299dSbellardfi 26271ad2134fSPaul Brook 2628c34ebfdcSAnthony Liguori# temporary config to build submodules 26292d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 2630c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 2631c34ebfdcSAnthony Liguori echo "# Automatically generated by configure - do not modify" >> $config_mak 2632c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 2633c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 2634c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 2635c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 2636c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 2637c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 2638c34ebfdcSAnthony Liguori echo "HOST_CC=$host_cc" >> $config_mak 2639c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 2640c34ebfdcSAnthony Liguoridone 2641c34ebfdcSAnthony Liguori 26421ad2134fSPaul Brookfor hwlib in 32 64; do 26431ad2134fSPaul Brook d=libhw$hwlib 26441ad2134fSPaul Brook mkdir -p $d 26451ad2134fSPaul Brook rm -f $d/Makefile 26461ad2134fSPaul Brook ln -s $source_path/Makefile.hw $d/Makefile 26471ad2134fSPaul Brook echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak 2648a558ee17SJuan Quintela echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak 26491ad2134fSPaul Brookdone 2650add16157SBlue Swirl 2651add16157SBlue Swirld=libuser 2652add16157SBlue Swirlmkdir -p $d 2653add16157SBlue Swirlrm -f $d/Makefile 2654add16157SBlue Swirlln -s $source_path/Makefile.user $d/Makefile 2655299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then 2656299060a0SKirill A. Shutemov echo "QEMU_CFLAGS+=-fpie" > $d/config.mak 2657299060a0SKirill A. Shutemovfi 2658