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" 163ef693a0SbellardTMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}" 173ef693a0SbellardTMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S" 187d13299dSbellard 197d13299dSbellard# default parameters 2011d9f695Sbellardprefix="" 211e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 2243ce4dfeSbellardstatic="no" 237d13299dSbellardcross_prefix="" 247d13299dSbellardcc="gcc" 257d13299dSbellardhost_cc="gcc" 267d13299dSbellardar="ar" 277d13299dSbellardmake="make" 287d13299dSbellardstrip="strip" 297d13299dSbellardcpu=`uname -m` 305327cf48Sbellardtarget_list="" 317d13299dSbellardcase "$cpu" in 327d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 3397a847bcSbellard cpu="i386" 347d13299dSbellard ;; 35ba68055eSbellard armv*b) 36808c4954Sbellard cpu="armv4b" 37808c4954Sbellard ;; 38ba68055eSbellard armv*l) 397d13299dSbellard cpu="armv4l" 407d13299dSbellard ;; 417d13299dSbellard alpha) 427d13299dSbellard cpu="alpha" 437d13299dSbellard ;; 44295defa5Sbellard "Power Macintosh"|ppc|ppc64) 457d13299dSbellard cpu="powerpc" 467d13299dSbellard ;; 477d13299dSbellard mips) 487d13299dSbellard cpu="mips" 497d13299dSbellard ;; 50fb3e5849Sbellard s390) 51fb3e5849Sbellard cpu="s390" 52fb3e5849Sbellard ;; 53ae228531Sbellard sparc) 54ae228531Sbellard cpu="sparc" 55ae228531Sbellard ;; 56ae228531Sbellard sparc64) 57ae228531Sbellard cpu="sparc64" 58ae228531Sbellard ;; 59a8baa8c5Sbellard ia64) 60a8baa8c5Sbellard cpu="ia64" 61a8baa8c5Sbellard ;; 6238e584a0Sbellard m68k) 6338e584a0Sbellard cpu="m68k" 6438e584a0Sbellard ;; 65bc51c5c9Sbellard x86_64|amd64) 660b0babc6Sbellard cpu="x86_64" 67bc51c5c9Sbellard ;; 687d13299dSbellard *) 697d13299dSbellard cpu="unknown" 707d13299dSbellard ;; 717d13299dSbellardesac 727d13299dSbellardgprof="no" 737d13299dSbellardbigendian="no" 7467b915a5Sbellardmingw32="no" 7567b915a5SbellardEXESUF="" 7667b915a5Sbellardgdbstub="yes" 77443f1376Sbellardslirp="yes" 78fb065187Sbellardadlib="no" 79fb065187Sbellardoss="no" 801d14ffa9Sbellarddsound="no" 811d14ffa9Sbellardcoreaudio="no" 821d14ffa9Sbellardalsa="no" 83102a52e4Sbellardfmod="no" 84102a52e4Sbellardfmod_lib="" 85102a52e4Sbellardfmod_inc="" 865327cf48Sbellardlinux="no" 87c9ec1fe4Sbellardkqemu="no" 8805c2a3e7Sbellardprofiler="no" 89c9ec1fe4Sbellardkernel_path="" 905b0753e0Sbellardcocoa="no" 9197ccc689Sbellardcheck_gfx="yes" 921aff381fSbellardcheck_gcc="yes" 93*0a8e90f4Spbrooksoftmmu="yes" 94*0a8e90f4Spbrookuser="no" 957d13299dSbellard 967d13299dSbellard# OS specific 977d13299dSbellardtargetos=`uname -s` 987d13299dSbellardcase $targetos in 99c326e0afSbellardCYGWIN*) 100c326e0afSbellardmingw32="yes" 101c326e0afSbellardCFLAGS="-O2 -mno-cygwin" 102c326e0afSbellard;; 10367b915a5SbellardMINGW32*) 10467b915a5Sbellardmingw32="yes" 10567b915a5Sbellard;; 1067d3505c5SbellardFreeBSD) 1077d3505c5Sbellardbsd="yes" 108fb065187Sbellardoss="yes" 109e99f9060Sbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 11007f4ddbfSbellard kqemu="yes" 11107f4ddbfSbellardfi 1127d3505c5Sbellard;; 1137d3505c5SbellardNetBSD) 1147d3505c5Sbellardbsd="yes" 115fb065187Sbellardoss="yes" 1167d3505c5Sbellard;; 1177d3505c5SbellardOpenBSD) 1187d3505c5Sbellardbsd="yes" 119fb065187Sbellardoss="yes" 1207d3505c5Sbellard;; 12183fb7adfSbellardDarwin) 12283fb7adfSbellardbsd="yes" 12383fb7adfSbellarddarwin="yes" 12483fb7adfSbellard;; 125fb065187Sbellard*) 126fb065187Sbellardoss="yes" 1275327cf48Sbellardlinux="yes" 128*0a8e90f4Spbrookuser="yes" 12907f4ddbfSbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 130c9ec1fe4Sbellard kqemu="yes" 131c9ec1fe4Sbellardfi 132fb065187Sbellard;; 1337d13299dSbellardesac 1347d13299dSbellard 1357d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 13683fb7adfSbellard if [ ! "$darwin" = "yes" ] ; then 1377d3505c5Sbellard make="gmake" 13883fb7adfSbellard fi 1397d3505c5Sbellardfi 1407d3505c5Sbellard 1417d13299dSbellard# find source path 1427d13299dSbellard# XXX: we assume an absolute path is given when launching configure, 1437d13299dSbellard# except in './configure' case. 1447d13299dSbellardsource_path=${0%configure} 1457d13299dSbellardsource_path=${source_path%/} 1467d13299dSbellardsource_path_used="yes" 1477d13299dSbellardif test -z "$source_path" -o "$source_path" = "." ; then 1487d13299dSbellard source_path=`pwd` 1497d13299dSbellard source_path_used="no" 1507d13299dSbellardfi 1517d13299dSbellard 1527d13299dSbellardfor opt do 1537d13299dSbellard case "$opt" in 1542efc3265Sbellard --help|-h) show_help=yes 1552efc3265Sbellard ;; 1567d13299dSbellard --prefix=*) prefix=`echo $opt | cut -d '=' -f 2` 1577d13299dSbellard ;; 15832ce6337Sbellard --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2` 15932ce6337Sbellard ;; 1607d13299dSbellard --source-path=*) source_path=`echo $opt | cut -d '=' -f 2` 1617d13299dSbellard ;; 1627d13299dSbellard --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2` 1637d13299dSbellard ;; 1647d13299dSbellard --cc=*) cc=`echo $opt | cut -d '=' -f 2` 1657d13299dSbellard ;; 16683469015Sbellard --host-cc=*) host_cc=`echo $opt | cut -d '=' -f 2` 16783469015Sbellard ;; 1687d13299dSbellard --make=*) make=`echo $opt | cut -d '=' -f 2` 1697d13299dSbellard ;; 1707d13299dSbellard --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}" 1717d13299dSbellard ;; 1727d13299dSbellard --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}" 1737d13299dSbellard ;; 1747d13299dSbellard --cpu=*) cpu=`echo $opt | cut -d '=' -f 2` 1757d13299dSbellard ;; 17697a847bcSbellard --target-list=*) target_list=${opt#--target-list=} 177de83cd02Sbellard ;; 1787d13299dSbellard --enable-gprof) gprof="yes" 1797d13299dSbellard ;; 18043ce4dfeSbellard --static) static="yes" 18143ce4dfeSbellard ;; 18297a847bcSbellard --disable-sdl) sdl="no" 18397a847bcSbellard ;; 1841d14ffa9Sbellard --enable-coreaudio) coreaudio="yes" 1851d14ffa9Sbellard ;; 1861d14ffa9Sbellard --enable-alsa) alsa="yes" 1871d14ffa9Sbellard ;; 1881d14ffa9Sbellard --enable-dsound) dsound="yes" 1891d14ffa9Sbellard ;; 190102a52e4Sbellard --enable-fmod) fmod="yes" 191102a52e4Sbellard ;; 192102a52e4Sbellard --fmod-lib=*) fmod_lib=${opt#--fmod-lib=} 193102a52e4Sbellard ;; 194102a52e4Sbellard --fmod-inc=*) fmod_inc=${opt#--fmod-inc=} 195102a52e4Sbellard ;; 19667b915a5Sbellard --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" 19767b915a5Sbellard ;; 198443f1376Sbellard --disable-slirp) slirp="no" 199c20709aaSbellard ;; 200fb065187Sbellard --enable-adlib) adlib="yes" 201fb065187Sbellard ;; 202c9ec1fe4Sbellard --disable-kqemu) kqemu="no" 203c9ec1fe4Sbellard ;; 20405c2a3e7Sbellard --enable-profiler) profiler="yes" 20505c2a3e7Sbellard ;; 206c9ec1fe4Sbellard --kernel-path=*) kernel_path=${opt#--kernel-path=} 207c9ec1fe4Sbellard ;; 2081d14ffa9Sbellard --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no" 2095b0753e0Sbellard ;; 21097ccc689Sbellard --disable-gfx-check) check_gfx="no" 21197ccc689Sbellard ;; 2121aff381fSbellard --disable-gcc-check) check_gcc="no" 2131aff381fSbellard ;; 214*0a8e90f4Spbrook --disable-softmmu) softmmu="no" 215*0a8e90f4Spbrook ;; 216*0a8e90f4Spbrook --enable-softmmu) softmmu="yes" 217*0a8e90f4Spbrook ;; 218*0a8e90f4Spbrook --disable-user) user="no" 219*0a8e90f4Spbrook ;; 220*0a8e90f4Spbrook --enable-user) user="yes" 221*0a8e90f4Spbrook ;; 2227d13299dSbellard esac 2237d13299dSbellarddone 2247d13299dSbellard 2257d13299dSbellard# Checking for CFLAGS 2267d13299dSbellardif test -z "$CFLAGS"; then 2277d13299dSbellard CFLAGS="-O2" 2287d13299dSbellardfi 2297d13299dSbellard 2307d13299dSbellardcc="${cross_prefix}${cc}" 2317d13299dSbellardar="${cross_prefix}${ar}" 2327d13299dSbellardstrip="${cross_prefix}${strip}" 2337d13299dSbellard 23467b915a5Sbellardif test "$mingw32" = "yes" ; then 2355327cf48Sbellard linux="no" 23667b915a5Sbellard EXESUF=".exe" 23767b915a5Sbellard gdbstub="no" 2389f059ecaSbellard oss="no" 23907f4ddbfSbellard if [ "$cpu" = "i386" ] ; then 24007f4ddbfSbellard kqemu="yes" 24107f4ddbfSbellard fi 24267b915a5Sbellardfi 24367b915a5Sbellard 2445327cf48Sbellardif test -z "$target_list" ; then 2455327cf48Sbellard# these targets are portable 246*0a8e90f4Spbrook if [ "$softmmu" = "yes" ] ; then 24738260998Spbrook target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu" 248*0a8e90f4Spbrook fi 2495327cf48Sbellard# the following are Linux specific 250*0a8e90f4Spbrook if [ "$user" = "yes" ] ; then 251c20eb473Sbellard target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list" 2525327cf48Sbellard fi 2536e20a45fSbellardelse 2546e20a45fSbellard target_list=$(echo "$target_list" | sed -e 's/,/ /g') 2555327cf48Sbellardfi 256*0a8e90f4Spbrookif test -z "$target_list" ; then 257*0a8e90f4Spbrook echo "No targets enabled" 258*0a8e90f4Spbrook exit 1 259*0a8e90f4Spbrookfi 2605327cf48Sbellard 2617d13299dSbellardif test -z "$cross_prefix" ; then 2627d13299dSbellard 2637d13299dSbellard# --- 2647d13299dSbellard# big/little endian test 2657d13299dSbellardcat > $TMPC << EOF 2667d13299dSbellard#include <inttypes.h> 2677d13299dSbellardint main(int argc, char ** argv){ 2687d13299dSbellard volatile uint32_t i=0x01234567; 2697d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 2707d13299dSbellard} 2717d13299dSbellardEOF 2727d13299dSbellard 2737d13299dSbellardif $cc -o $TMPE $TMPC 2>/dev/null ; then 2747d13299dSbellard$TMPE && bigendian="yes" 2757d13299dSbellardelse 2767d13299dSbellardecho big/little test failed 2777d13299dSbellardfi 2787d13299dSbellard 2797d13299dSbellardelse 2807d13299dSbellard 2817d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 282808c4954Sbellardif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then 2837d13299dSbellard bigendian="yes" 2847d13299dSbellardfi 2857d13299dSbellard 2867d13299dSbellardfi 2877d13299dSbellard 288b6853697Sbellard# host long bits test 289b6853697Sbellardhostlongbits="32" 290b6853697Sbellardif test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then 291b6853697Sbellard hostlongbits="64" 292b6853697Sbellardfi 293b6853697Sbellard 294e8cd23deSbellard# check gcc options support 29504369ff2Sbellardcat > $TMPC <<EOF 29604369ff2Sbellardint main(void) { 29704369ff2Sbellard} 29804369ff2SbellardEOF 29904369ff2Sbellard 300e8cd23deSbellardhave_gcc3_options="no" 301e8cd23deSbellardif $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then 302e8cd23deSbellard have_gcc3_options="yes" 30304369ff2Sbellardfi 304ca735206Sbellard 3051aff381fSbellard# Check for gcc4 3061aff381fSbellardif test "$check_gcc" = "yes" ; then 3071aff381fSbellard cat > $TMPC <<EOF 3081aff381fSbellard#if __GNUC__ >= 4 3091aff381fSbellard#error gcc4 3101aff381fSbellard#endif 3111aff381fSbellardint main(){return 0;} 3121aff381fSbellardEOF 3131aff381fSbellard if ! $cc -o $TMPO $TMPC 2>/dev/null ; then 3141aff381fSbellard echo "ERROR: \"$cc\" looks like gcc 4.x" 3151aff381fSbellard echo "QEMU is known to have problems when compiled with gcc 4.x" 3161aff381fSbellard echo "It is recommended that you use gcc 3.x to build QEMU" 3171aff381fSbellard echo "To use this compiler anyway, configure with --disable-gcc-check" 3181aff381fSbellard exit 1; 3191aff381fSbellard fi 3201aff381fSbellardfi 3211aff381fSbellard 32211d9f695Sbellard########################################## 32311d9f695Sbellard# SDL probe 32411d9f695Sbellard 32511d9f695Sbellardsdl_too_old=no 32611d9f695Sbellard 32711d9f695Sbellardif test -z "$sdl" ; then 32811d9f695Sbellard 329a6e022adSbellardsdl_config="sdl-config" 330a6e022adSbellardsdl=no 3317c1f25b4Sbellardsdl_static=no 332a6e022adSbellard 333a6e022adSbellardif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then 334a6e022adSbellard# win32 cross compilation case 335a6e022adSbellard sdl_config="i386-mingw32msvc-sdl-config" 336a6e022adSbellard sdl=yes 337a6e022adSbellardelse 338a6e022adSbellard# normal SDL probe 33911d9f695Sbellardcat > $TMPC << EOF 34011d9f695Sbellard#include <SDL.h> 34111d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 34211d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 34311d9f695SbellardEOF 34411d9f695Sbellard 345a6e022adSbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then 346a6e022adSbellard_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` 34711d9f695Sbellardif test "$_sdlversion" -lt 121 ; then 34811d9f695Sbellardsdl_too_old=yes 34911d9f695Sbellardelse 35011d9f695Sbellardsdl=yes 35111d9f695Sbellardfi 3527c1f25b4Sbellard 3537c1f25b4Sbellard# static link with sdl ? 3547c1f25b4Sbellardif test "$sdl" = "yes" ; then 3557c1f25b4Sbellardaa="no" 3567c1f25b4Sbellard`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes" 3577c1f25b4Sbellardsdl_static_libs=`$sdl_config --static-libs` 3587c1f25b4Sbellardif [ "$aa" = "yes" ] ; then 359d8d8aa4eSbellard sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`" 36011d9f695Sbellardfi 36111d9f695Sbellard 3627c1f25b4Sbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then 3637c1f25b4Sbellard sdl_static=yes 3647c1f25b4Sbellardfi 3657c1f25b4Sbellard 3667c1f25b4Sbellardfi # static link 3677c1f25b4Sbellard 3687c1f25b4Sbellardfi # sdl compile test 3697c1f25b4Sbellard 370a6e022adSbellardfi # cross compilation 371a6e022adSbellardfi # -z $sdl 37211d9f695Sbellard 3732efc3265Sbellardif test x"$show_help" = x"yes" ; then 3747d13299dSbellardcat << EOF 3757d13299dSbellard 3767d13299dSbellardUsage: configure [options] 3777d13299dSbellardOptions: [defaults in brackets after descriptions] 3787d13299dSbellard 3797d13299dSbellardEOF 3807d13299dSbellardecho "Standard options:" 3817d13299dSbellardecho " --help print this message" 3827d13299dSbellardecho " --prefix=PREFIX install in PREFIX [$prefix]" 3831e43adfcSbellardecho " --interp-prefix=PREFIX where to find shared libraries, etc." 3841e43adfcSbellardecho " use %M for cpu name [$interp_prefix]" 38597a847bcSbellardecho " --target-list=LIST set target list [$target_list]" 3867d13299dSbellardecho "" 387c9ec1fe4Sbellardecho "kqemu kernel acceleration support:" 38805c2a3e7Sbellardecho " --disable-kqemu disable kqemu support" 389c9ec1fe4Sbellardecho " --kernel-path=PATH set the kernel path (configure probes it)" 390c9ec1fe4Sbellardecho "" 3917d13299dSbellardecho "Advanced options (experts only):" 3927d13299dSbellardecho " --source-path=PATH path of source code [$source_path]" 3937d13299dSbellardecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 3947d13299dSbellardecho " --cc=CC use C compiler CC [$cc]" 3952efc3265Sbellardecho " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc." 3967d13299dSbellardecho " --make=MAKE use specified make [$make]" 39743ce4dfeSbellardecho " --static enable static build [$static]" 3988147cfcaSbellardecho " --enable-cocoa enable COCOA (Mac OS X only)" 39967b915a5Sbellardecho " --enable-mingw32 enable Win32 cross compilation with mingw32" 400d37282adSbellardecho " --enable-adlib enable Adlib emulation" 4011d14ffa9Sbellardecho " --enable-coreaudio enable Coreaudio audio driver" 4021d14ffa9Sbellardecho " --enable-alsa enable ALSA audio driver" 4031d14ffa9Sbellardecho " --enable-fmod enable FMOD audio driver" 4041d14ffa9Sbellardecho " --enabled-dsound enable DirectSound audio driver" 405*0a8e90f4Spbrookecho " --enable-system enable all system emulation targets" 406*0a8e90f4Spbrookecho " --disable-system disable all system emulation targets" 407*0a8e90f4Spbrookecho " --enable-user enable all linux usermode emulation targets" 408*0a8e90f4Spbrookecho " --disable-user disable all linux usermode emulation targets" 409102a52e4Sbellardecho " --fmod-lib path to FMOD library" 410102a52e4Sbellardecho " --fmod-inc path to FMOD includes" 4117d13299dSbellardecho "" 4127d13299dSbellardecho "NOTE: The object files are build at the place where configure is launched" 4137d13299dSbellardexit 1 4147d13299dSbellardfi 4157d13299dSbellard 41611d9f695Sbellardif test "$mingw32" = "yes" ; then 41711d9f695Sbellardif test -z "$prefix" ; then 41811d9f695Sbellard prefix="/c/Program Files/Qemu" 41911d9f695Sbellardfi 42011d9f695Sbellardmandir="$prefix" 4217efa4387Sbellarddatadir="$prefix" 4221f50f8d1Sbellarddocdir="$prefix" 42311d9f695Sbellardbindir="$prefix" 42411d9f695Sbellardelse 42511d9f695Sbellardif test -z "$prefix" ; then 42611d9f695Sbellard prefix="/usr/local" 42711d9f695Sbellardfi 4285a67135aSbellardmandir="$prefix/share/man" 4297efa4387Sbellarddatadir="$prefix/share/qemu" 4301f50f8d1Sbellarddocdir="$prefix/share/doc/qemu" 43111d9f695Sbellardbindir="$prefix/bin" 43211d9f695Sbellardfi 4335a67135aSbellard 4347d13299dSbellardecho "Install prefix $prefix" 4357efa4387Sbellardecho "BIOS directory $datadir" 43611d9f695Sbellardecho "binary directory $bindir" 43711d9f695Sbellardif test "$mingw32" = "no" ; then 43811d9f695Sbellardecho "Manual directory $mandir" 43943ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 44011d9f695Sbellardfi 4415a67135aSbellardecho "Source path $source_path" 4427d13299dSbellardecho "C compiler $cc" 44383469015Sbellardecho "Host C compiler $host_cc" 4447d13299dSbellardecho "make $make" 445a98fd896Sbellardecho "host CPU $cpu" 446de83cd02Sbellardecho "host big endian $bigendian" 44797a847bcSbellardecho "target list $target_list" 4487d13299dSbellardecho "gprof enabled $gprof" 44905c2a3e7Sbellardecho "profiler $profiler" 45043ce4dfeSbellardecho "static build $static" 4515b0753e0Sbellardif test "$darwin" = "yes" ; then 4525b0753e0Sbellard echo "Cocoa support $cocoa" 4535b0753e0Sbellardfi 45497a847bcSbellardecho "SDL support $sdl" 455e4afee97Sbellardif test "$sdl" != "no" ; then 4567c1f25b4Sbellard echo "SDL static link $sdl_static" 457e4afee97Sbellardfi 45867b915a5Sbellardecho "mingw32 support $mingw32" 459fb065187Sbellardecho "Adlib support $adlib" 4601d14ffa9Sbellardecho "CoreAudio support $coreaudio" 4611d14ffa9Sbellardecho "ALSA support $alsa" 4621d14ffa9Sbellardecho "DSound support $dsound" 463102a52e4Sbellardecho -n "FMOD support $fmod" 4641d14ffa9Sbellardif test "$fmod" = "yes"; then 4651d14ffa9Sbellard if test -z $fmod_lib || test -z $fmod_inc; then 4661d14ffa9Sbellard echo 4671d14ffa9Sbellard echo "Error: You must specify path to FMOD library and headers" 4681d14ffa9Sbellard echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 4691d14ffa9Sbellard echo 4701d14ffa9Sbellard exit 1 4711d14ffa9Sbellard fi 472102a52e4Sbellard echo -n " (lib='$fmod_lib' include='$fmod_inc')" 473102a52e4Sbellardfi 474102a52e4Sbellardecho "" 47507f4ddbfSbellardecho "kqemu support $kqemu" 47667b915a5Sbellard 47797a847bcSbellardif test $sdl_too_old = "yes"; then 47824b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 479e8cd23deSbellardfi 48024b55b96Sbellard#if test "$sdl_static" = "no"; then 48124b55b96Sbellard# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output" 48224b55b96Sbellard#fi 48397a847bcSbellard 48497a847bcSbellardconfig_mak="config-host.mak" 48597a847bcSbellardconfig_h="config-host.h" 48697a847bcSbellard 4877c1f25b4Sbellard#echo "Creating $config_mak and $config_h" 48897a847bcSbellard 48997a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 49029517134Spbrookecho "# Configured with: $0 $@" >> $config_mak 49197a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 49297a847bcSbellard 49397a847bcSbellardecho "prefix=$prefix" >> $config_mak 49411d9f695Sbellardecho "bindir=$bindir" >> $config_mak 4955a67135aSbellardecho "mandir=$mandir" >> $config_mak 4967efa4387Sbellardecho "datadir=$datadir" >> $config_mak 4971f50f8d1Sbellardecho "docdir=$docdir" >> $config_mak 4987efa4387Sbellardecho "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h 49997a847bcSbellardecho "MAKE=$make" >> $config_mak 50097a847bcSbellardecho "CC=$cc" >> $config_mak 50197a847bcSbellardif test "$have_gcc3_options" = "yes" ; then 50297a847bcSbellard echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak 50397a847bcSbellardfi 50497a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak 50597a847bcSbellardecho "AR=$ar" >> $config_mak 50697a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak 50797a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak 50897a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak 50967b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak 51097a847bcSbellardif test "$cpu" = "i386" ; then 51197a847bcSbellard echo "ARCH=i386" >> $config_mak 51297a847bcSbellard echo "#define HOST_I386 1" >> $config_h 5130b0babc6Sbellardelif test "$cpu" = "x86_64" ; then 5140b0babc6Sbellard echo "ARCH=x86_64" >> $config_mak 5150b0babc6Sbellard echo "#define HOST_X86_64 1" >> $config_h 516808c4954Sbellardelif test "$cpu" = "armv4b" ; then 517808c4954Sbellard echo "ARCH=arm" >> $config_mak 518808c4954Sbellard echo "#define HOST_ARM 1" >> $config_h 5197d13299dSbellardelif test "$cpu" = "armv4l" ; then 52097a847bcSbellard echo "ARCH=arm" >> $config_mak 52197a847bcSbellard echo "#define HOST_ARM 1" >> $config_h 5227d13299dSbellardelif test "$cpu" = "powerpc" ; then 52397a847bcSbellard echo "ARCH=ppc" >> $config_mak 52497a847bcSbellard echo "#define HOST_PPC 1" >> $config_h 5257d13299dSbellardelif test "$cpu" = "mips" ; then 52697a847bcSbellard echo "ARCH=mips" >> $config_mak 52797a847bcSbellard echo "#define HOST_MIPS 1" >> $config_h 528fb3e5849Sbellardelif test "$cpu" = "s390" ; then 52997a847bcSbellard echo "ARCH=s390" >> $config_mak 53097a847bcSbellard echo "#define HOST_S390 1" >> $config_h 531295defa5Sbellardelif test "$cpu" = "alpha" ; then 53297a847bcSbellard echo "ARCH=alpha" >> $config_mak 53397a847bcSbellard echo "#define HOST_ALPHA 1" >> $config_h 534ae228531Sbellardelif test "$cpu" = "sparc" ; then 53597a847bcSbellard echo "ARCH=sparc" >> $config_mak 53697a847bcSbellard echo "#define HOST_SPARC 1" >> $config_h 537ae228531Sbellardelif test "$cpu" = "sparc64" ; then 53897a847bcSbellard echo "ARCH=sparc64" >> $config_mak 53997a847bcSbellard echo "#define HOST_SPARC64 1" >> $config_h 540a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then 54197a847bcSbellard echo "ARCH=ia64" >> $config_mak 54297a847bcSbellard echo "#define HOST_IA64 1" >> $config_h 54338e584a0Sbellardelif test "$cpu" = "m68k" ; then 54438ca2abcSbellard echo "ARCH=m68k" >> $config_mak 54538ca2abcSbellard echo "#define HOST_M68K 1" >> $config_h 5467d13299dSbellardelse 5477d13299dSbellard echo "Unsupported CPU" 5487d13299dSbellard exit 1 5497d13299dSbellardfi 5507d13299dSbellardif test "$bigendian" = "yes" ; then 55197a847bcSbellard echo "WORDS_BIGENDIAN=yes" >> $config_mak 55297a847bcSbellard echo "#define WORDS_BIGENDIAN 1" >> $config_h 55397a847bcSbellardfi 554b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h 55567b915a5Sbellardif test "$mingw32" = "yes" ; then 55667b915a5Sbellard echo "CONFIG_WIN32=yes" >> $config_mak 55711d9f695Sbellard echo "#define CONFIG_WIN32 1" >> $config_h 5587d3505c5Sbellardelif test -f "/usr/include/byteswap.h" ; then 55997a847bcSbellard echo "#define HAVE_BYTESWAP_H 1" >> $config_h 56067b915a5Sbellardfi 56183fb7adfSbellardif test "$darwin" = "yes" ; then 56283fb7adfSbellard echo "CONFIG_DARWIN=yes" >> $config_mak 56383fb7adfSbellard echo "#define CONFIG_DARWIN 1" >> $config_h 56483fb7adfSbellardfi 56567b915a5Sbellardif test "$gdbstub" = "yes" ; then 56667b915a5Sbellard echo "CONFIG_GDBSTUB=yes" >> $config_mak 56767b915a5Sbellard echo "#define CONFIG_GDBSTUB 1" >> $config_h 56867b915a5Sbellardfi 56997a847bcSbellardif test "$gprof" = "yes" ; then 57097a847bcSbellard echo "TARGET_GPROF=yes" >> $config_mak 57197a847bcSbellard echo "#define HAVE_GPROF 1" >> $config_h 57297a847bcSbellardfi 57397a847bcSbellardif test "$static" = "yes" ; then 57497a847bcSbellard echo "CONFIG_STATIC=yes" >> $config_mak 57550863472Sbellard echo "#define CONFIG_STATIC 1" >> $config_h 57697a847bcSbellardfi 57705c2a3e7Sbellardif test $profiler = "yes" ; then 57805c2a3e7Sbellard echo "#define CONFIG_PROFILER 1" >> $config_h 57905c2a3e7Sbellardfi 580c20709aaSbellardif test "$slirp" = "yes" ; then 581c20709aaSbellard echo "CONFIG_SLIRP=yes" >> $config_mak 582c20709aaSbellard echo "#define CONFIG_SLIRP 1" >> $config_h 583c20709aaSbellardfi 584fb065187Sbellardif test "$adlib" = "yes" ; then 585fb065187Sbellard echo "CONFIG_ADLIB=yes" >> $config_mak 586fb065187Sbellard echo "#define CONFIG_ADLIB 1" >> $config_h 587fb065187Sbellardfi 588fb065187Sbellardif test "$oss" = "yes" ; then 589fb065187Sbellard echo "CONFIG_OSS=yes" >> $config_mak 590fb065187Sbellard echo "#define CONFIG_OSS 1" >> $config_h 591fb065187Sbellardfi 5921d14ffa9Sbellardif test "$coreaudio" = "yes" ; then 5931d14ffa9Sbellard echo "CONFIG_COREAUDIO=yes" >> $config_mak 5941d14ffa9Sbellard echo "#define CONFIG_COREAUDIO 1" >> $config_h 5951d14ffa9Sbellardfi 5961d14ffa9Sbellardif test "$alsa" = "yes" ; then 5971d14ffa9Sbellard echo "CONFIG_ALSA=yes" >> $config_mak 5981d14ffa9Sbellard echo "#define CONFIG_ALSA 1" >> $config_h 5991d14ffa9Sbellardfi 6001d14ffa9Sbellardif test "$dsound" = "yes" ; then 6011d14ffa9Sbellard echo "CONFIG_DSOUND=yes" >> $config_mak 6021d14ffa9Sbellard echo "#define CONFIG_DSOUND 1" >> $config_h 6031d14ffa9Sbellardfi 604102a52e4Sbellardif test "$fmod" = "yes" ; then 605102a52e4Sbellard echo "CONFIG_FMOD=yes" >> $config_mak 606102a52e4Sbellard echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak 607102a52e4Sbellard echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak 608102a52e4Sbellard echo "#define CONFIG_FMOD 1" >> $config_h 609102a52e4Sbellardfi 61097a847bcSbellardecho -n "VERSION=" >>$config_mak 61197a847bcSbellardhead $source_path/VERSION >>$config_mak 61297a847bcSbellardecho "" >>$config_mak 61397a847bcSbellardecho -n "#define QEMU_VERSION \"" >> $config_h 61497a847bcSbellardhead $source_path/VERSION >> $config_h 61597a847bcSbellardecho "\"" >> $config_h 61697a847bcSbellard 61797a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak 61897a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak 61997a847bcSbellard 62083fb7adfSbellard# XXX: suppress that 6217d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 62243003046Sbellard echo "#define O_LARGEFILE 0" >> $config_h 62343003046Sbellard echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h 6247d3505c5Sbellard echo "#define _BSD 1" >> $config_h 6257d3505c5Sbellardfi 6267d3505c5Sbellard 62797a847bcSbellardfor target in $target_list; do 62897a847bcSbellard 62997a847bcSbellardtarget_dir="$target" 63097a847bcSbellardconfig_mak=$target_dir/config.mak 63197a847bcSbellardconfig_h=$target_dir/config.h 63297a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1` 63397a847bcSbellardtarget_bigendian="no" 634808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes 6351e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes 63664b3ab24Sbellard[ "$target_cpu" = "sparc64" ] && target_bigendian=yes 63767867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes 638a2458627Sbellard[ "$target_cpu" = "ppc64" ] && target_bigendian=yes 639d3258560Sbellard[ "$target_cpu" = "mips" ] && target_bigendian=yes 64097a847bcSbellardtarget_softmmu="no" 64197a847bcSbellardif expr $target : '.*-softmmu' > /dev/null ; then 64297a847bcSbellard target_softmmu="yes" 6437d13299dSbellardfi 644997344f3Sbellardtarget_user_only="no" 645997344f3Sbellardif expr $target : '.*-user' > /dev/null ; then 646997344f3Sbellard target_user_only="yes" 647997344f3Sbellardfi 648de83cd02Sbellard 64997ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \ 65097ccc689Sbellard -a "$sdl" = "no" -a "$cocoa" = "no" ; then 65197ccc689Sbellard echo "ERROR: QEMU requires SDL or Cocoa for graphical output" 65297ccc689Sbellard echo "To build QEMU with graphical output configure with --disable-gfx-check" 65397ccc689Sbellard echo "Note that this will disable all output from the virtual graphics card." 65497ccc689Sbellard exit 1; 65597ccc689Sbellardfi 65697ccc689Sbellard 6577c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile" 65897a847bcSbellard 65997a847bcSbellardmkdir -p $target_dir 660158142c2Sbellardmkdir -p $target_dir/fpu 661808c4954Sbellardif test "$target" = "arm-user" -o "$target" = "armeb-user" ; then 66269de927cSbellard mkdir -p $target_dir/nwfpe 66369de927cSbellardfi 664a7e61ed4Sbellardif test "$target_user_only" = "no" ; then 665a7e61ed4Sbellard mkdir -p $target_dir/slirp 666a7e61ed4Sbellardfi 66769de927cSbellard 66897a847bcSbellardln -sf $source_path/Makefile.target $target_dir/Makefile 66997a847bcSbellard 67097a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 67197a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 67297a847bcSbellard 67397a847bcSbellard 67497a847bcSbellardecho "include ../config-host.mak" >> $config_mak 67597a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h 6761e43adfcSbellard 6771e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"` 6781e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h 67997a847bcSbellard 68097a847bcSbellardif test "$target_cpu" = "i386" ; then 68197a847bcSbellard echo "TARGET_ARCH=i386" >> $config_mak 68297a847bcSbellard echo "#define TARGET_ARCH \"i386\"" >> $config_h 68397a847bcSbellard echo "#define TARGET_I386 1" >> $config_h 68407f4ddbfSbellard if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then 685824d560fSbellard echo "#define USE_KQEMU 1" >> $config_h 686824d560fSbellard fi 687808c4954Sbellardelif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then 68897a847bcSbellard echo "TARGET_ARCH=arm" >> $config_mak 68997a847bcSbellard echo "#define TARGET_ARCH \"arm\"" >> $config_h 69097a847bcSbellard echo "#define TARGET_ARM 1" >> $config_h 6911e43adfcSbellardelif test "$target_cpu" = "sparc" ; then 6921e43adfcSbellard echo "TARGET_ARCH=sparc" >> $config_mak 6931e43adfcSbellard echo "#define TARGET_ARCH \"sparc\"" >> $config_h 6941e43adfcSbellard echo "#define TARGET_SPARC 1" >> $config_h 69564b3ab24Sbellardelif test "$target_cpu" = "sparc64" ; then 69664b3ab24Sbellard echo "TARGET_ARCH=sparc64" >> $config_mak 69764b3ab24Sbellard echo "#define TARGET_ARCH \"sparc64\"" >> $config_h 69864b3ab24Sbellard echo "#define TARGET_SPARC 1" >> $config_h 69964b3ab24Sbellard echo "#define TARGET_SPARC64 1" >> $config_h 70067867308Sbellardelif test "$target_cpu" = "ppc" ; then 70167867308Sbellard echo "TARGET_ARCH=ppc" >> $config_mak 70267867308Sbellard echo "#define TARGET_ARCH \"ppc\"" >> $config_h 70367867308Sbellard echo "#define TARGET_PPC 1" >> $config_h 704a2458627Sbellardelif test "$target_cpu" = "ppc64" ; then 705a2458627Sbellard echo "TARGET_ARCH=ppc64" >> $config_mak 706a2458627Sbellard echo "#define TARGET_ARCH \"ppc64\"" >> $config_h 707a2458627Sbellard echo "#define TARGET_PPC 1" >> $config_h 708a2458627Sbellard echo "#define TARGET_PPC64 1" >> $config_h 7090b0babc6Sbellardelif test "$target_cpu" = "x86_64" ; then 7100b0babc6Sbellard echo "TARGET_ARCH=x86_64" >> $config_mak 7110b0babc6Sbellard echo "#define TARGET_ARCH \"x86_64\"" >> $config_h 7120b0babc6Sbellard echo "#define TARGET_I386 1" >> $config_h 7130b0babc6Sbellard echo "#define TARGET_X86_64 1" >> $config_h 71407f4ddbfSbellard if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then 71507f4ddbfSbellard echo "#define USE_KQEMU 1" >> $config_h 71607f4ddbfSbellard fi 717c20eb473Sbellardelif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then 718d3258560Sbellard echo "TARGET_ARCH=mips" >> $config_mak 719d3258560Sbellard echo "#define TARGET_ARCH \"mips\"" >> $config_h 720d3258560Sbellard echo "#define TARGET_MIPS 1" >> $config_h 721de83cd02Sbellardelse 722de83cd02Sbellard echo "Unsupported target CPU" 723de83cd02Sbellard exit 1 724de83cd02Sbellardfi 725de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 72697a847bcSbellard echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak 72797a847bcSbellard echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h 72897a847bcSbellardfi 72997a847bcSbellardif test "$target_softmmu" = "yes" ; then 73097a847bcSbellard echo "CONFIG_SOFTMMU=yes" >> $config_mak 73197a847bcSbellard echo "#define CONFIG_SOFTMMU 1" >> $config_h 732de83cd02Sbellardfi 733997344f3Sbellardif test "$target_user_only" = "yes" ; then 734997344f3Sbellard echo "CONFIG_USER_ONLY=yes" >> $config_mak 735997344f3Sbellard echo "#define CONFIG_USER_ONLY 1" >> $config_h 736997344f3Sbellardfi 737de83cd02Sbellard 738158142c2Sbellardif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then 739158142c2Sbellard echo "CONFIG_SOFTFLOAT=yes" >> $config_mak 740158142c2Sbellard echo "#define CONFIG_SOFTFLOAT 1" >> $config_h 741158142c2Sbellardfi 7427c1f25b4Sbellard# sdl defines 7437c1f25b4Sbellard 7447c1f25b4Sbellardif test "$target_user_only" = "no"; then 7457c1f25b4Sbellard if test "$target_softmmu" = "no" -o "$static" = "yes"; then 746dbb2c921Sbellard sdl1=$sdl_static 7477c1f25b4Sbellard else 748dbb2c921Sbellard sdl1=$sdl 749dbb2c921Sbellard fi 750dbb2c921Sbellard if test "$sdl1" = "yes" ; then 7517c1f25b4Sbellard echo "#define CONFIG_SDL 1" >> $config_h 7527c1f25b4Sbellard echo "CONFIG_SDL=yes" >> $config_mak 753dbb2c921Sbellard if test "$target_softmmu" = "no" -o "$static" = "yes"; then 754dbb2c921Sbellard echo "SDL_LIBS=$sdl_static_libs" >> $config_mak 755dbb2c921Sbellard else 7567c1f25b4Sbellard echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak 7577c1f25b4Sbellard fi 7587c1f25b4Sbellard echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak 7597c1f25b4Sbellard if [ "${aa}" = "yes" ] ; then 7607c1f25b4Sbellard echo -n " `aalib-config --cflags`" >> $config_mak ; 7617c1f25b4Sbellard fi 7627c1f25b4Sbellard echo "" >> $config_mak 7637c1f25b4Sbellard fi 764dbb2c921Sbellardfi 7657c1f25b4Sbellard 7665b0753e0Sbellardif test "$cocoa" = "yes" ; then 7675b0753e0Sbellard echo "#define CONFIG_COCOA 1" >> $config_h 7685b0753e0Sbellard echo "CONFIG_COCOA=yes" >> $config_mak 7695b0753e0Sbellardfi 7705b0753e0Sbellard 77197a847bcSbellarddone # for target in $targets 7727d13299dSbellard 7737d13299dSbellard# build tree in object directory if source path is different from current one 7747d13299dSbellardif test "$source_path_used" = "yes" ; then 7757d13299dSbellard DIRS="tests" 7767d13299dSbellard FILES="Makefile tests/Makefile" 7777d13299dSbellard for dir in $DIRS ; do 7787d13299dSbellard mkdir -p $dir 7797d13299dSbellard done 7807d13299dSbellard for f in $FILES ; do 7817d13299dSbellard ln -sf $source_path/$f $f 7827d13299dSbellard done 7837d13299dSbellardfi 7847d13299dSbellard 78597a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS 786