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" 937d13299dSbellard 947d13299dSbellard# OS specific 957d13299dSbellardtargetos=`uname -s` 967d13299dSbellardcase $targetos in 97c326e0afSbellardCYGWIN*) 98c326e0afSbellardmingw32="yes" 99c326e0afSbellardCFLAGS="-O2 -mno-cygwin" 100c326e0afSbellard;; 10167b915a5SbellardMINGW32*) 10267b915a5Sbellardmingw32="yes" 10367b915a5Sbellard;; 1047d3505c5SbellardFreeBSD) 1057d3505c5Sbellardbsd="yes" 106fb065187Sbellardoss="yes" 107e99f9060Sbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 10807f4ddbfSbellard kqemu="yes" 10907f4ddbfSbellardfi 1107d3505c5Sbellard;; 1117d3505c5SbellardNetBSD) 1127d3505c5Sbellardbsd="yes" 113fb065187Sbellardoss="yes" 1147d3505c5Sbellard;; 1157d3505c5SbellardOpenBSD) 1167d3505c5Sbellardbsd="yes" 117fb065187Sbellardoss="yes" 1187d3505c5Sbellard;; 11983fb7adfSbellardDarwin) 12083fb7adfSbellardbsd="yes" 12183fb7adfSbellarddarwin="yes" 12283fb7adfSbellard;; 123fb065187Sbellard*) 124fb065187Sbellardoss="yes" 1255327cf48Sbellardlinux="yes" 12607f4ddbfSbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 127c9ec1fe4Sbellard kqemu="yes" 128c9ec1fe4Sbellardfi 129fb065187Sbellard;; 1307d13299dSbellardesac 1317d13299dSbellard 1327d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 13383fb7adfSbellard if [ ! "$darwin" = "yes" ] ; then 1347d3505c5Sbellard make="gmake" 13583fb7adfSbellard fi 1367d3505c5Sbellardfi 1377d3505c5Sbellard 1387d13299dSbellard# find source path 1397d13299dSbellard# XXX: we assume an absolute path is given when launching configure, 1407d13299dSbellard# except in './configure' case. 1417d13299dSbellardsource_path=${0%configure} 1427d13299dSbellardsource_path=${source_path%/} 1437d13299dSbellardsource_path_used="yes" 1447d13299dSbellardif test -z "$source_path" -o "$source_path" = "." ; then 1457d13299dSbellard source_path=`pwd` 1467d13299dSbellard source_path_used="no" 1477d13299dSbellardfi 1487d13299dSbellard 1497d13299dSbellardfor opt do 1507d13299dSbellard case "$opt" in 1512efc3265Sbellard --help|-h) show_help=yes 1522efc3265Sbellard ;; 1537d13299dSbellard --prefix=*) prefix=`echo $opt | cut -d '=' -f 2` 1547d13299dSbellard ;; 15532ce6337Sbellard --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2` 15632ce6337Sbellard ;; 1577d13299dSbellard --source-path=*) source_path=`echo $opt | cut -d '=' -f 2` 1587d13299dSbellard ;; 1597d13299dSbellard --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2` 1607d13299dSbellard ;; 1617d13299dSbellard --cc=*) cc=`echo $opt | cut -d '=' -f 2` 1627d13299dSbellard ;; 16383469015Sbellard --host-cc=*) host_cc=`echo $opt | cut -d '=' -f 2` 16483469015Sbellard ;; 1657d13299dSbellard --make=*) make=`echo $opt | cut -d '=' -f 2` 1667d13299dSbellard ;; 1677d13299dSbellard --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}" 1687d13299dSbellard ;; 1697d13299dSbellard --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}" 1707d13299dSbellard ;; 1717d13299dSbellard --cpu=*) cpu=`echo $opt | cut -d '=' -f 2` 1727d13299dSbellard ;; 17397a847bcSbellard --target-list=*) target_list=${opt#--target-list=} 174de83cd02Sbellard ;; 1757d13299dSbellard --enable-gprof) gprof="yes" 1767d13299dSbellard ;; 17743ce4dfeSbellard --static) static="yes" 17843ce4dfeSbellard ;; 17997a847bcSbellard --disable-sdl) sdl="no" 18097a847bcSbellard ;; 1811d14ffa9Sbellard --enable-coreaudio) coreaudio="yes" 1821d14ffa9Sbellard ;; 1831d14ffa9Sbellard --enable-alsa) alsa="yes" 1841d14ffa9Sbellard ;; 1851d14ffa9Sbellard --enable-dsound) dsound="yes" 1861d14ffa9Sbellard ;; 187102a52e4Sbellard --enable-fmod) fmod="yes" 188102a52e4Sbellard ;; 189102a52e4Sbellard --fmod-lib=*) fmod_lib=${opt#--fmod-lib=} 190102a52e4Sbellard ;; 191102a52e4Sbellard --fmod-inc=*) fmod_inc=${opt#--fmod-inc=} 192102a52e4Sbellard ;; 19367b915a5Sbellard --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" 19467b915a5Sbellard ;; 195443f1376Sbellard --disable-slirp) slirp="no" 196c20709aaSbellard ;; 197fb065187Sbellard --enable-adlib) adlib="yes" 198fb065187Sbellard ;; 199c9ec1fe4Sbellard --disable-kqemu) kqemu="no" 200c9ec1fe4Sbellard ;; 20105c2a3e7Sbellard --enable-profiler) profiler="yes" 20205c2a3e7Sbellard ;; 203c9ec1fe4Sbellard --kernel-path=*) kernel_path=${opt#--kernel-path=} 204c9ec1fe4Sbellard ;; 2051d14ffa9Sbellard --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no" 2065b0753e0Sbellard ;; 20797ccc689Sbellard --disable-gfx-check) check_gfx="no" 20897ccc689Sbellard ;; 2091aff381fSbellard --disable-gcc-check) check_gcc="no" 2101aff381fSbellard ;; 2117d13299dSbellard esac 2127d13299dSbellarddone 2137d13299dSbellard 2147d13299dSbellard# Checking for CFLAGS 2157d13299dSbellardif test -z "$CFLAGS"; then 2167d13299dSbellard CFLAGS="-O2" 2177d13299dSbellardfi 2187d13299dSbellard 2197d13299dSbellardcc="${cross_prefix}${cc}" 2207d13299dSbellardar="${cross_prefix}${ar}" 2217d13299dSbellardstrip="${cross_prefix}${strip}" 2227d13299dSbellard 22367b915a5Sbellardif test "$mingw32" = "yes" ; then 2245327cf48Sbellard linux="no" 22567b915a5Sbellard EXESUF=".exe" 22667b915a5Sbellard gdbstub="no" 2279f059ecaSbellard oss="no" 22807f4ddbfSbellard if [ "$cpu" = "i386" ] ; then 22907f4ddbfSbellard kqemu="yes" 23007f4ddbfSbellard fi 23167b915a5Sbellardfi 23267b915a5Sbellard 2335327cf48Sbellardif test -z "$target_list" ; then 2345327cf48Sbellard# these targets are portable 235b5ff1b31Sbellard target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu arm-softmmu" 2365327cf48Sbellard# the following are Linux specific 2375327cf48Sbellard if [ "$linux" = "yes" ] ; then 238c20eb473Sbellard target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list" 2395327cf48Sbellard fi 2406e20a45fSbellardelse 2416e20a45fSbellard target_list=$(echo "$target_list" | sed -e 's/,/ /g') 2425327cf48Sbellardfi 2435327cf48Sbellard 2447d13299dSbellardif test -z "$cross_prefix" ; then 2457d13299dSbellard 2467d13299dSbellard# --- 2477d13299dSbellard# big/little endian test 2487d13299dSbellardcat > $TMPC << EOF 2497d13299dSbellard#include <inttypes.h> 2507d13299dSbellardint main(int argc, char ** argv){ 2517d13299dSbellard volatile uint32_t i=0x01234567; 2527d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 2537d13299dSbellard} 2547d13299dSbellardEOF 2557d13299dSbellard 2567d13299dSbellardif $cc -o $TMPE $TMPC 2>/dev/null ; then 2577d13299dSbellard$TMPE && bigendian="yes" 2587d13299dSbellardelse 2597d13299dSbellardecho big/little test failed 2607d13299dSbellardfi 2617d13299dSbellard 2627d13299dSbellardelse 2637d13299dSbellard 2647d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 265808c4954Sbellardif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then 2667d13299dSbellard bigendian="yes" 2677d13299dSbellardfi 2687d13299dSbellard 2697d13299dSbellardfi 2707d13299dSbellard 271b6853697Sbellard# host long bits test 272b6853697Sbellardhostlongbits="32" 273b6853697Sbellardif test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then 274b6853697Sbellard hostlongbits="64" 275b6853697Sbellardfi 276b6853697Sbellard 277e8cd23deSbellard# check gcc options support 27804369ff2Sbellardcat > $TMPC <<EOF 27904369ff2Sbellardint main(void) { 28004369ff2Sbellard} 28104369ff2SbellardEOF 28204369ff2Sbellard 283e8cd23deSbellardhave_gcc3_options="no" 284e8cd23deSbellardif $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then 285e8cd23deSbellard have_gcc3_options="yes" 28604369ff2Sbellardfi 287ca735206Sbellard 2881aff381fSbellard# Check for gcc4 2891aff381fSbellardif test "$check_gcc" = "yes" ; then 2901aff381fSbellard cat > $TMPC <<EOF 2911aff381fSbellard#if __GNUC__ >= 4 2921aff381fSbellard#error gcc4 2931aff381fSbellard#endif 2941aff381fSbellardint main(){return 0;} 2951aff381fSbellardEOF 2961aff381fSbellard if ! $cc -o $TMPO $TMPC 2>/dev/null ; then 2971aff381fSbellard echo "ERROR: \"$cc\" looks like gcc 4.x" 2981aff381fSbellard echo "QEMU is known to have problems when compiled with gcc 4.x" 2991aff381fSbellard echo "It is recommended that you use gcc 3.x to build QEMU" 3001aff381fSbellard echo "To use this compiler anyway, configure with --disable-gcc-check" 3011aff381fSbellard exit 1; 3021aff381fSbellard fi 3031aff381fSbellardfi 3041aff381fSbellard 30511d9f695Sbellard########################################## 30611d9f695Sbellard# SDL probe 30711d9f695Sbellard 30811d9f695Sbellardsdl_too_old=no 30911d9f695Sbellard 31011d9f695Sbellardif test -z "$sdl" ; then 31111d9f695Sbellard 312a6e022adSbellardsdl_config="sdl-config" 313a6e022adSbellardsdl=no 3147c1f25b4Sbellardsdl_static=no 315a6e022adSbellard 316a6e022adSbellardif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then 317a6e022adSbellard# win32 cross compilation case 318a6e022adSbellard sdl_config="i386-mingw32msvc-sdl-config" 319a6e022adSbellard sdl=yes 320a6e022adSbellardelse 321a6e022adSbellard# normal SDL probe 32211d9f695Sbellardcat > $TMPC << EOF 32311d9f695Sbellard#include <SDL.h> 32411d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 32511d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 32611d9f695SbellardEOF 32711d9f695Sbellard 328a6e022adSbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then 329a6e022adSbellard_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` 33011d9f695Sbellardif test "$_sdlversion" -lt 121 ; then 33111d9f695Sbellardsdl_too_old=yes 33211d9f695Sbellardelse 33311d9f695Sbellardsdl=yes 33411d9f695Sbellardfi 3357c1f25b4Sbellard 3367c1f25b4Sbellard# static link with sdl ? 3377c1f25b4Sbellardif test "$sdl" = "yes" ; then 3387c1f25b4Sbellardaa="no" 3397c1f25b4Sbellard`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes" 3407c1f25b4Sbellardsdl_static_libs=`$sdl_config --static-libs` 3417c1f25b4Sbellardif [ "$aa" = "yes" ] ; then 342d8d8aa4eSbellard sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`" 34311d9f695Sbellardfi 34411d9f695Sbellard 3457c1f25b4Sbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then 3467c1f25b4Sbellard sdl_static=yes 3477c1f25b4Sbellardfi 3487c1f25b4Sbellard 3497c1f25b4Sbellardfi # static link 3507c1f25b4Sbellard 3517c1f25b4Sbellardfi # sdl compile test 3527c1f25b4Sbellard 353a6e022adSbellardfi # cross compilation 354a6e022adSbellardfi # -z $sdl 35511d9f695Sbellard 3562efc3265Sbellardif test x"$show_help" = x"yes" ; then 3577d13299dSbellardcat << EOF 3587d13299dSbellard 3597d13299dSbellardUsage: configure [options] 3607d13299dSbellardOptions: [defaults in brackets after descriptions] 3617d13299dSbellard 3627d13299dSbellardEOF 3637d13299dSbellardecho "Standard options:" 3647d13299dSbellardecho " --help print this message" 3657d13299dSbellardecho " --prefix=PREFIX install in PREFIX [$prefix]" 3661e43adfcSbellardecho " --interp-prefix=PREFIX where to find shared libraries, etc." 3671e43adfcSbellardecho " use %M for cpu name [$interp_prefix]" 36897a847bcSbellardecho " --target-list=LIST set target list [$target_list]" 3697d13299dSbellardecho "" 370c9ec1fe4Sbellardecho "kqemu kernel acceleration support:" 37105c2a3e7Sbellardecho " --disable-kqemu disable kqemu support" 372c9ec1fe4Sbellardecho " --kernel-path=PATH set the kernel path (configure probes it)" 373c9ec1fe4Sbellardecho "" 3747d13299dSbellardecho "Advanced options (experts only):" 3757d13299dSbellardecho " --source-path=PATH path of source code [$source_path]" 3767d13299dSbellardecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 3777d13299dSbellardecho " --cc=CC use C compiler CC [$cc]" 3782efc3265Sbellardecho " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc." 3797d13299dSbellardecho " --make=MAKE use specified make [$make]" 38043ce4dfeSbellardecho " --static enable static build [$static]" 3818147cfcaSbellardecho " --enable-cocoa enable COCOA (Mac OS X only)" 38267b915a5Sbellardecho " --enable-mingw32 enable Win32 cross compilation with mingw32" 383d37282adSbellardecho " --enable-adlib enable Adlib emulation" 3841d14ffa9Sbellardecho " --enable-coreaudio enable Coreaudio audio driver" 3851d14ffa9Sbellardecho " --enable-alsa enable ALSA audio driver" 3861d14ffa9Sbellardecho " --enable-fmod enable FMOD audio driver" 3871d14ffa9Sbellardecho " --enabled-dsound enable DirectSound audio driver" 388102a52e4Sbellardecho " --fmod-lib path to FMOD library" 389102a52e4Sbellardecho " --fmod-inc path to FMOD includes" 3907d13299dSbellardecho "" 3917d13299dSbellardecho "NOTE: The object files are build at the place where configure is launched" 3927d13299dSbellardexit 1 3937d13299dSbellardfi 3947d13299dSbellard 39511d9f695Sbellardif test "$mingw32" = "yes" ; then 39611d9f695Sbellardif test -z "$prefix" ; then 39711d9f695Sbellard prefix="/c/Program Files/Qemu" 39811d9f695Sbellardfi 39911d9f695Sbellardmandir="$prefix" 4007efa4387Sbellarddatadir="$prefix" 4011f50f8d1Sbellarddocdir="$prefix" 40211d9f695Sbellardbindir="$prefix" 40311d9f695Sbellardelse 40411d9f695Sbellardif test -z "$prefix" ; then 40511d9f695Sbellard prefix="/usr/local" 40611d9f695Sbellardfi 4075a67135aSbellardmandir="$prefix/share/man" 4087efa4387Sbellarddatadir="$prefix/share/qemu" 4091f50f8d1Sbellarddocdir="$prefix/share/doc/qemu" 41011d9f695Sbellardbindir="$prefix/bin" 41111d9f695Sbellardfi 4125a67135aSbellard 4137d13299dSbellardecho "Install prefix $prefix" 4147efa4387Sbellardecho "BIOS directory $datadir" 41511d9f695Sbellardecho "binary directory $bindir" 41611d9f695Sbellardif test "$mingw32" = "no" ; then 41711d9f695Sbellardecho "Manual directory $mandir" 41843ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 41911d9f695Sbellardfi 4205a67135aSbellardecho "Source path $source_path" 4217d13299dSbellardecho "C compiler $cc" 42283469015Sbellardecho "Host C compiler $host_cc" 4237d13299dSbellardecho "make $make" 424a98fd896Sbellardecho "host CPU $cpu" 425de83cd02Sbellardecho "host big endian $bigendian" 42697a847bcSbellardecho "target list $target_list" 4277d13299dSbellardecho "gprof enabled $gprof" 42805c2a3e7Sbellardecho "profiler $profiler" 42943ce4dfeSbellardecho "static build $static" 4305b0753e0Sbellardif test "$darwin" = "yes" ; then 4315b0753e0Sbellard echo "Cocoa support $cocoa" 4325b0753e0Sbellardfi 43397a847bcSbellardecho "SDL support $sdl" 434e4afee97Sbellardif test "$sdl" != "no" ; then 4357c1f25b4Sbellard echo "SDL static link $sdl_static" 436e4afee97Sbellardfi 43767b915a5Sbellardecho "mingw32 support $mingw32" 438fb065187Sbellardecho "Adlib support $adlib" 4391d14ffa9Sbellardecho "CoreAudio support $coreaudio" 4401d14ffa9Sbellardecho "ALSA support $alsa" 4411d14ffa9Sbellardecho "DSound support $dsound" 442102a52e4Sbellardecho -n "FMOD support $fmod" 4431d14ffa9Sbellardif test "$fmod" = "yes"; then 4441d14ffa9Sbellard if test -z $fmod_lib || test -z $fmod_inc; then 4451d14ffa9Sbellard echo 4461d14ffa9Sbellard echo "Error: You must specify path to FMOD library and headers" 4471d14ffa9Sbellard echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 4481d14ffa9Sbellard echo 4491d14ffa9Sbellard exit 1 4501d14ffa9Sbellard fi 451102a52e4Sbellard echo -n " (lib='$fmod_lib' include='$fmod_inc')" 452102a52e4Sbellardfi 453102a52e4Sbellardecho "" 45407f4ddbfSbellardecho "kqemu support $kqemu" 45567b915a5Sbellard 45697a847bcSbellardif test $sdl_too_old = "yes"; then 45724b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 458e8cd23deSbellardfi 45924b55b96Sbellard#if test "$sdl_static" = "no"; then 46024b55b96Sbellard# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output" 46124b55b96Sbellard#fi 46297a847bcSbellard 46397a847bcSbellardconfig_mak="config-host.mak" 46497a847bcSbellardconfig_h="config-host.h" 46597a847bcSbellard 4667c1f25b4Sbellard#echo "Creating $config_mak and $config_h" 46797a847bcSbellard 46897a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 469*29517134Spbrookecho "# Configured with: $0 $@" >> $config_mak 47097a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 47197a847bcSbellard 47297a847bcSbellardecho "prefix=$prefix" >> $config_mak 47311d9f695Sbellardecho "bindir=$bindir" >> $config_mak 4745a67135aSbellardecho "mandir=$mandir" >> $config_mak 4757efa4387Sbellardecho "datadir=$datadir" >> $config_mak 4761f50f8d1Sbellardecho "docdir=$docdir" >> $config_mak 4777efa4387Sbellardecho "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h 47897a847bcSbellardecho "MAKE=$make" >> $config_mak 47997a847bcSbellardecho "CC=$cc" >> $config_mak 48097a847bcSbellardif test "$have_gcc3_options" = "yes" ; then 48197a847bcSbellard echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak 48297a847bcSbellardfi 48397a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak 48497a847bcSbellardecho "AR=$ar" >> $config_mak 48597a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak 48697a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak 48797a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak 48867b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak 48997a847bcSbellardif test "$cpu" = "i386" ; then 49097a847bcSbellard echo "ARCH=i386" >> $config_mak 49197a847bcSbellard echo "#define HOST_I386 1" >> $config_h 4920b0babc6Sbellardelif test "$cpu" = "x86_64" ; then 4930b0babc6Sbellard echo "ARCH=x86_64" >> $config_mak 4940b0babc6Sbellard echo "#define HOST_X86_64 1" >> $config_h 495808c4954Sbellardelif test "$cpu" = "armv4b" ; then 496808c4954Sbellard echo "ARCH=arm" >> $config_mak 497808c4954Sbellard echo "#define HOST_ARM 1" >> $config_h 4987d13299dSbellardelif test "$cpu" = "armv4l" ; then 49997a847bcSbellard echo "ARCH=arm" >> $config_mak 50097a847bcSbellard echo "#define HOST_ARM 1" >> $config_h 5017d13299dSbellardelif test "$cpu" = "powerpc" ; then 50297a847bcSbellard echo "ARCH=ppc" >> $config_mak 50397a847bcSbellard echo "#define HOST_PPC 1" >> $config_h 5047d13299dSbellardelif test "$cpu" = "mips" ; then 50597a847bcSbellard echo "ARCH=mips" >> $config_mak 50697a847bcSbellard echo "#define HOST_MIPS 1" >> $config_h 507fb3e5849Sbellardelif test "$cpu" = "s390" ; then 50897a847bcSbellard echo "ARCH=s390" >> $config_mak 50997a847bcSbellard echo "#define HOST_S390 1" >> $config_h 510295defa5Sbellardelif test "$cpu" = "alpha" ; then 51197a847bcSbellard echo "ARCH=alpha" >> $config_mak 51297a847bcSbellard echo "#define HOST_ALPHA 1" >> $config_h 513ae228531Sbellardelif test "$cpu" = "sparc" ; then 51497a847bcSbellard echo "ARCH=sparc" >> $config_mak 51597a847bcSbellard echo "#define HOST_SPARC 1" >> $config_h 516ae228531Sbellardelif test "$cpu" = "sparc64" ; then 51797a847bcSbellard echo "ARCH=sparc64" >> $config_mak 51897a847bcSbellard echo "#define HOST_SPARC64 1" >> $config_h 519a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then 52097a847bcSbellard echo "ARCH=ia64" >> $config_mak 52197a847bcSbellard echo "#define HOST_IA64 1" >> $config_h 52238e584a0Sbellardelif test "$cpu" = "m68k" ; then 52338ca2abcSbellard echo "ARCH=m68k" >> $config_mak 52438ca2abcSbellard echo "#define HOST_M68K 1" >> $config_h 5257d13299dSbellardelse 5267d13299dSbellard echo "Unsupported CPU" 5277d13299dSbellard exit 1 5287d13299dSbellardfi 5297d13299dSbellardif test "$bigendian" = "yes" ; then 53097a847bcSbellard echo "WORDS_BIGENDIAN=yes" >> $config_mak 53197a847bcSbellard echo "#define WORDS_BIGENDIAN 1" >> $config_h 53297a847bcSbellardfi 533b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h 53467b915a5Sbellardif test "$mingw32" = "yes" ; then 53567b915a5Sbellard echo "CONFIG_WIN32=yes" >> $config_mak 53611d9f695Sbellard echo "#define CONFIG_WIN32 1" >> $config_h 5377d3505c5Sbellardelif test -f "/usr/include/byteswap.h" ; then 53897a847bcSbellard echo "#define HAVE_BYTESWAP_H 1" >> $config_h 53967b915a5Sbellardfi 54083fb7adfSbellardif test "$darwin" = "yes" ; then 54183fb7adfSbellard echo "CONFIG_DARWIN=yes" >> $config_mak 54283fb7adfSbellard echo "#define CONFIG_DARWIN 1" >> $config_h 54383fb7adfSbellardfi 54467b915a5Sbellardif test "$gdbstub" = "yes" ; then 54567b915a5Sbellard echo "CONFIG_GDBSTUB=yes" >> $config_mak 54667b915a5Sbellard echo "#define CONFIG_GDBSTUB 1" >> $config_h 54767b915a5Sbellardfi 54897a847bcSbellardif test "$gprof" = "yes" ; then 54997a847bcSbellard echo "TARGET_GPROF=yes" >> $config_mak 55097a847bcSbellard echo "#define HAVE_GPROF 1" >> $config_h 55197a847bcSbellardfi 55297a847bcSbellardif test "$static" = "yes" ; then 55397a847bcSbellard echo "CONFIG_STATIC=yes" >> $config_mak 55450863472Sbellard echo "#define CONFIG_STATIC 1" >> $config_h 55597a847bcSbellardfi 55605c2a3e7Sbellardif test $profiler = "yes" ; then 55705c2a3e7Sbellard echo "#define CONFIG_PROFILER 1" >> $config_h 55805c2a3e7Sbellardfi 559c20709aaSbellardif test "$slirp" = "yes" ; then 560c20709aaSbellard echo "CONFIG_SLIRP=yes" >> $config_mak 561c20709aaSbellard echo "#define CONFIG_SLIRP 1" >> $config_h 562c20709aaSbellardfi 563fb065187Sbellardif test "$adlib" = "yes" ; then 564fb065187Sbellard echo "CONFIG_ADLIB=yes" >> $config_mak 565fb065187Sbellard echo "#define CONFIG_ADLIB 1" >> $config_h 566fb065187Sbellardfi 567fb065187Sbellardif test "$oss" = "yes" ; then 568fb065187Sbellard echo "CONFIG_OSS=yes" >> $config_mak 569fb065187Sbellard echo "#define CONFIG_OSS 1" >> $config_h 570fb065187Sbellardfi 5711d14ffa9Sbellardif test "$coreaudio" = "yes" ; then 5721d14ffa9Sbellard echo "CONFIG_COREAUDIO=yes" >> $config_mak 5731d14ffa9Sbellard echo "#define CONFIG_COREAUDIO 1" >> $config_h 5741d14ffa9Sbellardfi 5751d14ffa9Sbellardif test "$alsa" = "yes" ; then 5761d14ffa9Sbellard echo "CONFIG_ALSA=yes" >> $config_mak 5771d14ffa9Sbellard echo "#define CONFIG_ALSA 1" >> $config_h 5781d14ffa9Sbellardfi 5791d14ffa9Sbellardif test "$dsound" = "yes" ; then 5801d14ffa9Sbellard echo "CONFIG_DSOUND=yes" >> $config_mak 5811d14ffa9Sbellard echo "#define CONFIG_DSOUND 1" >> $config_h 5821d14ffa9Sbellardfi 583102a52e4Sbellardif test "$fmod" = "yes" ; then 584102a52e4Sbellard echo "CONFIG_FMOD=yes" >> $config_mak 585102a52e4Sbellard echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak 586102a52e4Sbellard echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak 587102a52e4Sbellard echo "#define CONFIG_FMOD 1" >> $config_h 588102a52e4Sbellardfi 58997a847bcSbellardecho -n "VERSION=" >>$config_mak 59097a847bcSbellardhead $source_path/VERSION >>$config_mak 59197a847bcSbellardecho "" >>$config_mak 59297a847bcSbellardecho -n "#define QEMU_VERSION \"" >> $config_h 59397a847bcSbellardhead $source_path/VERSION >> $config_h 59497a847bcSbellardecho "\"" >> $config_h 59597a847bcSbellard 59697a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak 59797a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak 59897a847bcSbellard 59983fb7adfSbellard# XXX: suppress that 6007d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 60143003046Sbellard echo "#define O_LARGEFILE 0" >> $config_h 60243003046Sbellard echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h 6037d3505c5Sbellard echo "#define _BSD 1" >> $config_h 6047d3505c5Sbellardfi 6057d3505c5Sbellard 60697a847bcSbellardfor target in $target_list; do 60797a847bcSbellard 60897a847bcSbellardtarget_dir="$target" 60997a847bcSbellardconfig_mak=$target_dir/config.mak 61097a847bcSbellardconfig_h=$target_dir/config.h 61197a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1` 61297a847bcSbellardtarget_bigendian="no" 613808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes 6141e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes 61564b3ab24Sbellard[ "$target_cpu" = "sparc64" ] && target_bigendian=yes 61667867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes 617a2458627Sbellard[ "$target_cpu" = "ppc64" ] && target_bigendian=yes 618d3258560Sbellard[ "$target_cpu" = "mips" ] && target_bigendian=yes 61997a847bcSbellardtarget_softmmu="no" 62097a847bcSbellardif expr $target : '.*-softmmu' > /dev/null ; then 62197a847bcSbellard target_softmmu="yes" 6227d13299dSbellardfi 623997344f3Sbellardtarget_user_only="no" 624997344f3Sbellardif expr $target : '.*-user' > /dev/null ; then 625997344f3Sbellard target_user_only="yes" 626997344f3Sbellardfi 627de83cd02Sbellard 62897ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \ 62997ccc689Sbellard -a "$sdl" = "no" -a "$cocoa" = "no" ; then 63097ccc689Sbellard echo "ERROR: QEMU requires SDL or Cocoa for graphical output" 63197ccc689Sbellard echo "To build QEMU with graphical output configure with --disable-gfx-check" 63297ccc689Sbellard echo "Note that this will disable all output from the virtual graphics card." 63397ccc689Sbellard exit 1; 63497ccc689Sbellardfi 63597ccc689Sbellard 6367c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile" 63797a847bcSbellard 63897a847bcSbellardmkdir -p $target_dir 639158142c2Sbellardmkdir -p $target_dir/fpu 640808c4954Sbellardif test "$target" = "arm-user" -o "$target" = "armeb-user" ; then 64169de927cSbellard mkdir -p $target_dir/nwfpe 64269de927cSbellardfi 643a7e61ed4Sbellardif test "$target_user_only" = "no" ; then 644a7e61ed4Sbellard mkdir -p $target_dir/slirp 645a7e61ed4Sbellardfi 64669de927cSbellard 64797a847bcSbellardln -sf $source_path/Makefile.target $target_dir/Makefile 64897a847bcSbellard 64997a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 65097a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 65197a847bcSbellard 65297a847bcSbellard 65397a847bcSbellardecho "include ../config-host.mak" >> $config_mak 65497a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h 6551e43adfcSbellard 6561e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"` 6571e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h 65897a847bcSbellard 65997a847bcSbellardif test "$target_cpu" = "i386" ; then 66097a847bcSbellard echo "TARGET_ARCH=i386" >> $config_mak 66197a847bcSbellard echo "#define TARGET_ARCH \"i386\"" >> $config_h 66297a847bcSbellard echo "#define TARGET_I386 1" >> $config_h 66307f4ddbfSbellard if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then 664824d560fSbellard echo "#define USE_KQEMU 1" >> $config_h 665824d560fSbellard fi 666808c4954Sbellardelif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then 66797a847bcSbellard echo "TARGET_ARCH=arm" >> $config_mak 66897a847bcSbellard echo "#define TARGET_ARCH \"arm\"" >> $config_h 66997a847bcSbellard echo "#define TARGET_ARM 1" >> $config_h 6701e43adfcSbellardelif test "$target_cpu" = "sparc" ; then 6711e43adfcSbellard echo "TARGET_ARCH=sparc" >> $config_mak 6721e43adfcSbellard echo "#define TARGET_ARCH \"sparc\"" >> $config_h 6731e43adfcSbellard echo "#define TARGET_SPARC 1" >> $config_h 67464b3ab24Sbellardelif test "$target_cpu" = "sparc64" ; then 67564b3ab24Sbellard echo "TARGET_ARCH=sparc64" >> $config_mak 67664b3ab24Sbellard echo "#define TARGET_ARCH \"sparc64\"" >> $config_h 67764b3ab24Sbellard echo "#define TARGET_SPARC 1" >> $config_h 67864b3ab24Sbellard echo "#define TARGET_SPARC64 1" >> $config_h 67967867308Sbellardelif test "$target_cpu" = "ppc" ; then 68067867308Sbellard echo "TARGET_ARCH=ppc" >> $config_mak 68167867308Sbellard echo "#define TARGET_ARCH \"ppc\"" >> $config_h 68267867308Sbellard echo "#define TARGET_PPC 1" >> $config_h 683a2458627Sbellardelif test "$target_cpu" = "ppc64" ; then 684a2458627Sbellard echo "TARGET_ARCH=ppc64" >> $config_mak 685a2458627Sbellard echo "#define TARGET_ARCH \"ppc64\"" >> $config_h 686a2458627Sbellard echo "#define TARGET_PPC 1" >> $config_h 687a2458627Sbellard echo "#define TARGET_PPC64 1" >> $config_h 6880b0babc6Sbellardelif test "$target_cpu" = "x86_64" ; then 6890b0babc6Sbellard echo "TARGET_ARCH=x86_64" >> $config_mak 6900b0babc6Sbellard echo "#define TARGET_ARCH \"x86_64\"" >> $config_h 6910b0babc6Sbellard echo "#define TARGET_I386 1" >> $config_h 6920b0babc6Sbellard echo "#define TARGET_X86_64 1" >> $config_h 69307f4ddbfSbellard if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then 69407f4ddbfSbellard echo "#define USE_KQEMU 1" >> $config_h 69505c2a3e7Sbellard if test $kqemu_profile = "yes" ; then 69605c2a3e7Sbellard echo "#define CONFIG_KQEMU_PROFILE 1" >> $config_h 69705c2a3e7Sbellard fi 69807f4ddbfSbellard fi 699c20eb473Sbellardelif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then 700d3258560Sbellard echo "TARGET_ARCH=mips" >> $config_mak 701d3258560Sbellard echo "#define TARGET_ARCH \"mips\"" >> $config_h 702d3258560Sbellard echo "#define TARGET_MIPS 1" >> $config_h 703de83cd02Sbellardelse 704de83cd02Sbellard echo "Unsupported target CPU" 705de83cd02Sbellard exit 1 706de83cd02Sbellardfi 707de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 70897a847bcSbellard echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak 70997a847bcSbellard echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h 71097a847bcSbellardfi 71197a847bcSbellardif test "$target_softmmu" = "yes" ; then 71297a847bcSbellard echo "CONFIG_SOFTMMU=yes" >> $config_mak 71397a847bcSbellard echo "#define CONFIG_SOFTMMU 1" >> $config_h 714de83cd02Sbellardfi 715997344f3Sbellardif test "$target_user_only" = "yes" ; then 716997344f3Sbellard echo "CONFIG_USER_ONLY=yes" >> $config_mak 717997344f3Sbellard echo "#define CONFIG_USER_ONLY 1" >> $config_h 718997344f3Sbellardfi 719de83cd02Sbellard 720158142c2Sbellardif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then 721158142c2Sbellard echo "CONFIG_SOFTFLOAT=yes" >> $config_mak 722158142c2Sbellard echo "#define CONFIG_SOFTFLOAT 1" >> $config_h 723158142c2Sbellardfi 7247c1f25b4Sbellard# sdl defines 7257c1f25b4Sbellard 7267c1f25b4Sbellardif test "$target_user_only" = "no"; then 7277c1f25b4Sbellard if test "$target_softmmu" = "no" -o "$static" = "yes"; then 728dbb2c921Sbellard sdl1=$sdl_static 7297c1f25b4Sbellard else 730dbb2c921Sbellard sdl1=$sdl 731dbb2c921Sbellard fi 732dbb2c921Sbellard if test "$sdl1" = "yes" ; then 7337c1f25b4Sbellard echo "#define CONFIG_SDL 1" >> $config_h 7347c1f25b4Sbellard echo "CONFIG_SDL=yes" >> $config_mak 735dbb2c921Sbellard if test "$target_softmmu" = "no" -o "$static" = "yes"; then 736dbb2c921Sbellard echo "SDL_LIBS=$sdl_static_libs" >> $config_mak 737dbb2c921Sbellard else 7387c1f25b4Sbellard echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak 7397c1f25b4Sbellard fi 7407c1f25b4Sbellard echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak 7417c1f25b4Sbellard if [ "${aa}" = "yes" ] ; then 7427c1f25b4Sbellard echo -n " `aalib-config --cflags`" >> $config_mak ; 7437c1f25b4Sbellard fi 7447c1f25b4Sbellard echo "" >> $config_mak 7457c1f25b4Sbellard fi 746dbb2c921Sbellardfi 7477c1f25b4Sbellard 7485b0753e0Sbellardif test "$cocoa" = "yes" ; then 7495b0753e0Sbellard echo "#define CONFIG_COCOA 1" >> $config_h 7505b0753e0Sbellard echo "CONFIG_COCOA=yes" >> $config_mak 7515b0753e0Sbellardfi 7525b0753e0Sbellard 75397a847bcSbellarddone # for target in $targets 7547d13299dSbellard 7557d13299dSbellard# build tree in object directory if source path is different from current one 7567d13299dSbellardif test "$source_path_used" = "yes" ; then 7577d13299dSbellard DIRS="tests" 7587d13299dSbellard FILES="Makefile tests/Makefile" 7597d13299dSbellard for dir in $DIRS ; do 7607d13299dSbellard mkdir -p $dir 7617d13299dSbellard done 7627d13299dSbellard for f in $FILES ; do 7637d13299dSbellard ln -sf $source_path/$f $f 7647d13299dSbellard done 7657d13299dSbellardfi 7667d13299dSbellard 76797a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS 768