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` 30*0b0babc6Sbellardtarget_list="i386-user i386 i386-softmmu arm-user armeb-user sparc-user ppc-user ppc-softmmu sparc-softmmu x86_64-softmmu" 317d13299dSbellardcase "$cpu" in 327d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 3397a847bcSbellard cpu="i386" 347d13299dSbellard ;; 35808c4954Sbellard armv4b) 36808c4954Sbellard cpu="armv4b" 37808c4954Sbellard ;; 387d13299dSbellard armv4l) 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) 66*0b0babc6Sbellard 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" 80102a52e4Sbellardfmod="no" 81102a52e4Sbellardfmod_lib="" 82102a52e4Sbellardfmod_inc="" 837d13299dSbellard 847d13299dSbellard# OS specific 857d13299dSbellardtargetos=`uname -s` 867d13299dSbellardcase $targetos in 8767b915a5SbellardMINGW32*) 8867b915a5Sbellardmingw32="yes" 8967b915a5Sbellard;; 907d3505c5SbellardFreeBSD) 917d3505c5Sbellardbsd="yes" 92fb065187Sbellardoss="yes" 937d3505c5Sbellard;; 947d3505c5SbellardNetBSD) 957d3505c5Sbellardbsd="yes" 96fb065187Sbellardoss="yes" 977d3505c5Sbellard;; 987d3505c5SbellardOpenBSD) 997d3505c5Sbellardbsd="yes" 100fb065187Sbellardoss="yes" 1017d3505c5Sbellard;; 10283fb7adfSbellardDarwin) 10383fb7adfSbellardbsd="yes" 10483fb7adfSbellarddarwin="yes" 10583fb7adfSbellard;; 106fb065187Sbellard*) 107fb065187Sbellardoss="yes" 108fb065187Sbellard;; 1097d13299dSbellardesac 1107d13299dSbellard 1117d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 11283fb7adfSbellard if [ ! "$darwin" = "yes" ] ; then 1137d3505c5Sbellard make="gmake" 11483fb7adfSbellard fi 115e95c8d51Sbellard target_list="i386-softmmu ppc-softmmu sparc-softmmu" 1167d3505c5Sbellardfi 1177d3505c5Sbellard 1187d13299dSbellard# find source path 1197d13299dSbellard# XXX: we assume an absolute path is given when launching configure, 1207d13299dSbellard# except in './configure' case. 1217d13299dSbellardsource_path=${0%configure} 1227d13299dSbellardsource_path=${source_path%/} 1237d13299dSbellardsource_path_used="yes" 1247d13299dSbellardif test -z "$source_path" -o "$source_path" = "." ; then 1257d13299dSbellard source_path=`pwd` 1267d13299dSbellard source_path_used="no" 1277d13299dSbellardfi 1287d13299dSbellard 1297d13299dSbellardfor opt do 1307d13299dSbellard case "$opt" in 1317d13299dSbellard --prefix=*) prefix=`echo $opt | cut -d '=' -f 2` 1327d13299dSbellard ;; 13332ce6337Sbellard --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2` 13432ce6337Sbellard ;; 1357d13299dSbellard --source-path=*) source_path=`echo $opt | cut -d '=' -f 2` 1367d13299dSbellard ;; 1377d13299dSbellard --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2` 1387d13299dSbellard ;; 1397d13299dSbellard --cc=*) cc=`echo $opt | cut -d '=' -f 2` 1407d13299dSbellard ;; 1417d13299dSbellard --make=*) make=`echo $opt | cut -d '=' -f 2` 1427d13299dSbellard ;; 1437d13299dSbellard --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}" 1447d13299dSbellard ;; 1457d13299dSbellard --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}" 1467d13299dSbellard ;; 1477d13299dSbellard --extra-libs=*) extralibs=${opt#--extra-libs=} 1487d13299dSbellard ;; 1497d13299dSbellard --cpu=*) cpu=`echo $opt | cut -d '=' -f 2` 1507d13299dSbellard ;; 15197a847bcSbellard --target-list=*) target_list=${opt#--target-list=} 152de83cd02Sbellard ;; 1537d13299dSbellard --enable-gprof) gprof="yes" 1547d13299dSbellard ;; 15543ce4dfeSbellard --static) static="yes" 15643ce4dfeSbellard ;; 15797a847bcSbellard --disable-sdl) sdl="no" 15897a847bcSbellard ;; 159102a52e4Sbellard --enable-fmod) fmod="yes" 160102a52e4Sbellard ;; 161102a52e4Sbellard --fmod-lib=*) fmod_lib=${opt#--fmod-lib=} 162102a52e4Sbellard ;; 163102a52e4Sbellard --fmod-inc=*) fmod_inc=${opt#--fmod-inc=} 164102a52e4Sbellard ;; 16567b915a5Sbellard --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" 16667b915a5Sbellard ;; 167443f1376Sbellard --disable-slirp) slirp="no" 168c20709aaSbellard ;; 169fb065187Sbellard --enable-adlib) adlib="yes" 170fb065187Sbellard ;; 1717d13299dSbellard esac 1727d13299dSbellarddone 1737d13299dSbellard 1747d13299dSbellard# Checking for CFLAGS 1757d13299dSbellardif test -z "$CFLAGS"; then 1767d13299dSbellard CFLAGS="-O2" 1777d13299dSbellardfi 1787d13299dSbellard 1797d13299dSbellardcc="${cross_prefix}${cc}" 1807d13299dSbellardar="${cross_prefix}${ar}" 1817d13299dSbellardstrip="${cross_prefix}${strip}" 1827d13299dSbellard 18367b915a5Sbellardif test "$mingw32" = "yes" ; then 184e95c8d51Sbellard target_list="i386-softmmu ppc-softmmu sparc-softmmu" 18567b915a5Sbellard EXESUF=".exe" 18667b915a5Sbellard gdbstub="no" 1879f059ecaSbellard oss="no" 18867b915a5Sbellardfi 18967b915a5Sbellard 1907d13299dSbellardif test -z "$cross_prefix" ; then 1917d13299dSbellard 1927d13299dSbellard# --- 1937d13299dSbellard# big/little endian test 1947d13299dSbellardcat > $TMPC << EOF 1957d13299dSbellard#include <inttypes.h> 1967d13299dSbellardint main(int argc, char ** argv){ 1977d13299dSbellard volatile uint32_t i=0x01234567; 1987d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 1997d13299dSbellard} 2007d13299dSbellardEOF 2017d13299dSbellard 2027d13299dSbellardif $cc -o $TMPE $TMPC 2>/dev/null ; then 2037d13299dSbellard$TMPE && bigendian="yes" 2047d13299dSbellardelse 2057d13299dSbellardecho big/little test failed 2067d13299dSbellardfi 2077d13299dSbellard 2087d13299dSbellardelse 2097d13299dSbellard 2107d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 211808c4954Sbellardif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then 2127d13299dSbellard bigendian="yes" 2137d13299dSbellardfi 2147d13299dSbellard 2157d13299dSbellardfi 2167d13299dSbellard 217e8cd23deSbellard# check gcc options support 21804369ff2Sbellardcat > $TMPC <<EOF 21904369ff2Sbellardint main(void) { 22004369ff2Sbellard} 22104369ff2SbellardEOF 22204369ff2Sbellard 223e8cd23deSbellardhave_gcc3_options="no" 224e8cd23deSbellardif $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then 225e8cd23deSbellard have_gcc3_options="yes" 22604369ff2Sbellardfi 227ca735206Sbellard 22811d9f695Sbellard########################################## 22911d9f695Sbellard# SDL probe 23011d9f695Sbellard 23111d9f695Sbellardsdl_too_old=no 23211d9f695Sbellard 23311d9f695Sbellardif test -z "$sdl" ; then 23411d9f695Sbellard 235a6e022adSbellardsdl_config="sdl-config" 236a6e022adSbellardsdl=no 2377c1f25b4Sbellardsdl_static=no 238a6e022adSbellard 239a6e022adSbellardif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then 240a6e022adSbellard# win32 cross compilation case 241a6e022adSbellard sdl_config="i386-mingw32msvc-sdl-config" 242a6e022adSbellard sdl=yes 243a6e022adSbellardelse 244a6e022adSbellard# normal SDL probe 24511d9f695Sbellardcat > $TMPC << EOF 24611d9f695Sbellard#include <SDL.h> 24711d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 24811d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 24911d9f695SbellardEOF 25011d9f695Sbellard 251a6e022adSbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then 252a6e022adSbellard_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` 25311d9f695Sbellardif test "$_sdlversion" -lt 121 ; then 25411d9f695Sbellardsdl_too_old=yes 25511d9f695Sbellardelse 25611d9f695Sbellardsdl=yes 25711d9f695Sbellardfi 2587c1f25b4Sbellard 2597c1f25b4Sbellard# static link with sdl ? 2607c1f25b4Sbellardif test "$sdl" = "yes" ; then 2617c1f25b4Sbellardaa="no" 2627c1f25b4Sbellard`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes" 2637c1f25b4Sbellardsdl_static_libs=`$sdl_config --static-libs` 2647c1f25b4Sbellardif [ "$aa" = "yes" ] ; then 265d8d8aa4eSbellard sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`" 26611d9f695Sbellardfi 26711d9f695Sbellard 2687c1f25b4Sbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then 2697c1f25b4Sbellard sdl_static=yes 2707c1f25b4Sbellardfi 2717c1f25b4Sbellard 2727c1f25b4Sbellardfi # static link 2737c1f25b4Sbellard 2747c1f25b4Sbellardfi # sdl compile test 2757c1f25b4Sbellard 276a6e022adSbellardfi # cross compilation 277a6e022adSbellardfi # -z $sdl 27811d9f695Sbellard 2797d13299dSbellardif test x"$1" = x"-h" -o x"$1" = x"--help" ; then 2807d13299dSbellardcat << EOF 2817d13299dSbellard 2827d13299dSbellardUsage: configure [options] 2837d13299dSbellardOptions: [defaults in brackets after descriptions] 2847d13299dSbellard 2857d13299dSbellardEOF 2867d13299dSbellardecho "Standard options:" 2877d13299dSbellardecho " --help print this message" 2887d13299dSbellardecho " --prefix=PREFIX install in PREFIX [$prefix]" 2891e43adfcSbellardecho " --interp-prefix=PREFIX where to find shared libraries, etc." 2901e43adfcSbellardecho " use %M for cpu name [$interp_prefix]" 29197a847bcSbellardecho " --target-list=LIST set target list [$target_list]" 2927d13299dSbellardecho "" 2937d13299dSbellardecho "Advanced options (experts only):" 2947d13299dSbellardecho " --source-path=PATH path of source code [$source_path]" 2957d13299dSbellardecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 2967d13299dSbellardecho " --cc=CC use C compiler CC [$cc]" 2977d13299dSbellardecho " --make=MAKE use specified make [$make]" 29843ce4dfeSbellardecho " --static enable static build [$static]" 29967b915a5Sbellardecho " --enable-mingw32 enable Win32 cross compilation with mingw32" 300102a52e4Sbellardecho " --enable-fmod enable FMOD audio output driver" 301102a52e4Sbellardecho " --fmod-lib path to FMOD library" 302102a52e4Sbellardecho " --fmod-inc path to FMOD includes" 3037d13299dSbellardecho "" 3047d13299dSbellardecho "NOTE: The object files are build at the place where configure is launched" 3057d13299dSbellardexit 1 3067d13299dSbellardfi 3077d13299dSbellard 30811d9f695Sbellardif test "$mingw32" = "yes" ; then 30911d9f695Sbellardif test -z "$prefix" ; then 31011d9f695Sbellard prefix="/c/Program Files/Qemu" 31111d9f695Sbellardfi 31211d9f695Sbellardmandir="$prefix" 3137efa4387Sbellarddatadir="$prefix" 3141f50f8d1Sbellarddocdir="$prefix" 31511d9f695Sbellardbindir="$prefix" 31611d9f695Sbellardelse 31711d9f695Sbellardif test -z "$prefix" ; then 31811d9f695Sbellard prefix="/usr/local" 31911d9f695Sbellardfi 3205a67135aSbellardmandir="$prefix/share/man" 3217efa4387Sbellarddatadir="$prefix/share/qemu" 3221f50f8d1Sbellarddocdir="$prefix/share/doc/qemu" 32311d9f695Sbellardbindir="$prefix/bin" 32411d9f695Sbellardfi 3255a67135aSbellard 3267d13299dSbellardecho "Install prefix $prefix" 3277efa4387Sbellardecho "BIOS directory $datadir" 32811d9f695Sbellardecho "binary directory $bindir" 32911d9f695Sbellardif test "$mingw32" = "no" ; then 33011d9f695Sbellardecho "Manual directory $mandir" 33143ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 33211d9f695Sbellardfi 3335a67135aSbellardecho "Source path $source_path" 3347d13299dSbellardecho "C compiler $cc" 3357d13299dSbellardecho "make $make" 336a98fd896Sbellardecho "host CPU $cpu" 337de83cd02Sbellardecho "host big endian $bigendian" 33897a847bcSbellardecho "target list $target_list" 3397d13299dSbellardecho "gprof enabled $gprof" 34043ce4dfeSbellardecho "static build $static" 34197a847bcSbellardecho "SDL support $sdl" 3427c1f25b4Sbellardecho "SDL static link $sdl_static" 34367b915a5Sbellardecho "mingw32 support $mingw32" 344fb065187Sbellardecho "Adlib support $adlib" 345102a52e4Sbellardecho -n "FMOD support $fmod" 346102a52e4Sbellardif test $fmod = "yes"; then 347102a52e4Sbellard echo -n " (lib='$fmod_lib' include='$fmod_inc')" 348102a52e4Sbellardfi 349102a52e4Sbellardecho "" 35067b915a5Sbellard 35197a847bcSbellardif test $sdl_too_old = "yes"; then 35297a847bcSbellardecho "-> Your SDL version is too old - please upgrade to have FFplay/SDL support" 353e8cd23deSbellardfi 3547c1f25b4Sbellardif test "$sdl_static" = "no"; then 3557c1f25b4Sbellard echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output" 3567c1f25b4Sbellardfi 35797a847bcSbellard 35897a847bcSbellardconfig_mak="config-host.mak" 35997a847bcSbellardconfig_h="config-host.h" 36097a847bcSbellard 3617c1f25b4Sbellard#echo "Creating $config_mak and $config_h" 36297a847bcSbellard 36397a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 36497a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 36597a847bcSbellard 36697a847bcSbellardecho "prefix=$prefix" >> $config_mak 36711d9f695Sbellardecho "bindir=$bindir" >> $config_mak 3685a67135aSbellardecho "mandir=$mandir" >> $config_mak 3697efa4387Sbellardecho "datadir=$datadir" >> $config_mak 3701f50f8d1Sbellardecho "docdir=$docdir" >> $config_mak 3717efa4387Sbellardecho "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h 37297a847bcSbellardecho "MAKE=$make" >> $config_mak 37397a847bcSbellardecho "CC=$cc" >> $config_mak 37497a847bcSbellardif test "$have_gcc3_options" = "yes" ; then 37597a847bcSbellard echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak 37697a847bcSbellardfi 37797a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak 37897a847bcSbellardecho "AR=$ar" >> $config_mak 37997a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak 38097a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak 38197a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak 38267b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak 38397a847bcSbellardif test "$cpu" = "i386" ; then 38497a847bcSbellard echo "ARCH=i386" >> $config_mak 38597a847bcSbellard echo "#define HOST_I386 1" >> $config_h 386*0b0babc6Sbellardelif test "$cpu" = "x86_64" ; then 387*0b0babc6Sbellard echo "ARCH=x86_64" >> $config_mak 388*0b0babc6Sbellard echo "#define HOST_X86_64 1" >> $config_h 389808c4954Sbellardelif test "$cpu" = "armv4b" ; then 390808c4954Sbellard echo "ARCH=arm" >> $config_mak 391808c4954Sbellard echo "#define HOST_ARM 1" >> $config_h 3927d13299dSbellardelif test "$cpu" = "armv4l" ; then 39397a847bcSbellard echo "ARCH=arm" >> $config_mak 39497a847bcSbellard echo "#define HOST_ARM 1" >> $config_h 3957d13299dSbellardelif test "$cpu" = "powerpc" ; then 39697a847bcSbellard echo "ARCH=ppc" >> $config_mak 39797a847bcSbellard echo "#define HOST_PPC 1" >> $config_h 3987d13299dSbellardelif test "$cpu" = "mips" ; then 39997a847bcSbellard echo "ARCH=mips" >> $config_mak 40097a847bcSbellard echo "#define HOST_MIPS 1" >> $config_h 401fb3e5849Sbellardelif test "$cpu" = "s390" ; then 40297a847bcSbellard echo "ARCH=s390" >> $config_mak 40397a847bcSbellard echo "#define HOST_S390 1" >> $config_h 404295defa5Sbellardelif test "$cpu" = "alpha" ; then 40597a847bcSbellard echo "ARCH=alpha" >> $config_mak 40697a847bcSbellard echo "#define HOST_ALPHA 1" >> $config_h 407ae228531Sbellardelif test "$cpu" = "sparc" ; then 40897a847bcSbellard echo "ARCH=sparc" >> $config_mak 40997a847bcSbellard echo "#define HOST_SPARC 1" >> $config_h 410ae228531Sbellardelif test "$cpu" = "sparc64" ; then 41197a847bcSbellard echo "ARCH=sparc64" >> $config_mak 41297a847bcSbellard echo "#define HOST_SPARC64 1" >> $config_h 413a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then 41497a847bcSbellard echo "ARCH=ia64" >> $config_mak 41597a847bcSbellard echo "#define HOST_IA64 1" >> $config_h 41638e584a0Sbellardelif test "$cpu" = "m68k" ; then 41738ca2abcSbellard echo "ARCH=m68k" >> $config_mak 41838ca2abcSbellard echo "#define HOST_M68K 1" >> $config_h 4197d13299dSbellardelse 4207d13299dSbellard echo "Unsupported CPU" 4217d13299dSbellard exit 1 4227d13299dSbellardfi 4237d13299dSbellardif test "$bigendian" = "yes" ; then 42497a847bcSbellard echo "WORDS_BIGENDIAN=yes" >> $config_mak 42597a847bcSbellard echo "#define WORDS_BIGENDIAN 1" >> $config_h 42697a847bcSbellardfi 42767b915a5Sbellardif test "$mingw32" = "yes" ; then 42867b915a5Sbellard echo "CONFIG_WIN32=yes" >> $config_mak 42911d9f695Sbellard echo "#define CONFIG_WIN32 1" >> $config_h 4307d3505c5Sbellardelif test -f "/usr/include/byteswap.h" ; then 43197a847bcSbellard echo "#define HAVE_BYTESWAP_H 1" >> $config_h 43267b915a5Sbellardfi 43383fb7adfSbellardif test "$darwin" = "yes" ; then 43483fb7adfSbellard echo "CONFIG_DARWIN=yes" >> $config_mak 43583fb7adfSbellard echo "#define CONFIG_DARWIN 1" >> $config_h 43683fb7adfSbellardfi 43767b915a5Sbellardif test "$gdbstub" = "yes" ; then 43867b915a5Sbellard echo "CONFIG_GDBSTUB=yes" >> $config_mak 43967b915a5Sbellard echo "#define CONFIG_GDBSTUB 1" >> $config_h 44067b915a5Sbellardfi 44197a847bcSbellardif test "$gprof" = "yes" ; then 44297a847bcSbellard echo "TARGET_GPROF=yes" >> $config_mak 44397a847bcSbellard echo "#define HAVE_GPROF 1" >> $config_h 44497a847bcSbellardfi 44597a847bcSbellardif test "$static" = "yes" ; then 44697a847bcSbellard echo "CONFIG_STATIC=yes" >> $config_mak 44750863472Sbellard echo "#define CONFIG_STATIC 1" >> $config_h 44897a847bcSbellardfi 449c20709aaSbellardif test "$slirp" = "yes" ; then 450c20709aaSbellard echo "CONFIG_SLIRP=yes" >> $config_mak 451c20709aaSbellard echo "#define CONFIG_SLIRP 1" >> $config_h 452c20709aaSbellardfi 453fb065187Sbellardif test "$adlib" = "yes" ; then 454fb065187Sbellard echo "CONFIG_ADLIB=yes" >> $config_mak 455fb065187Sbellard echo "#define CONFIG_ADLIB 1" >> $config_h 456fb065187Sbellardfi 457fb065187Sbellardif test "$oss" = "yes" ; then 458fb065187Sbellard echo "CONFIG_OSS=yes" >> $config_mak 459fb065187Sbellard echo "#define CONFIG_OSS 1" >> $config_h 460fb065187Sbellardfi 461102a52e4Sbellardif test "$fmod" = "yes" ; then 462102a52e4Sbellard echo "CONFIG_FMOD=yes" >> $config_mak 463102a52e4Sbellard echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak 464102a52e4Sbellard echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak 465102a52e4Sbellard echo "#define CONFIG_FMOD 1" >> $config_h 466102a52e4Sbellardfi 46797a847bcSbellardecho -n "VERSION=" >>$config_mak 46897a847bcSbellardhead $source_path/VERSION >>$config_mak 46997a847bcSbellardecho "" >>$config_mak 47097a847bcSbellardecho -n "#define QEMU_VERSION \"" >> $config_h 47197a847bcSbellardhead $source_path/VERSION >> $config_h 47297a847bcSbellardecho "\"" >> $config_h 47397a847bcSbellard 47497a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak 47597a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak 47697a847bcSbellard 47783fb7adfSbellard# XXX: suppress that 4787d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 47943003046Sbellard echo "#define O_LARGEFILE 0" >> $config_h 48043003046Sbellard echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h 4817d3505c5Sbellard echo "#define _BSD 1" >> $config_h 4827d3505c5Sbellardfi 4837d3505c5Sbellard 48497a847bcSbellardfor target in $target_list; do 48597a847bcSbellard 48697a847bcSbellardtarget_dir="$target" 48797a847bcSbellardconfig_mak=$target_dir/config.mak 48897a847bcSbellardconfig_h=$target_dir/config.h 48997a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1` 49097a847bcSbellardtarget_bigendian="no" 491808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes 4921e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes 49367867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes 49497a847bcSbellardtarget_softmmu="no" 49597a847bcSbellardif expr $target : '.*-softmmu' > /dev/null ; then 49697a847bcSbellard target_softmmu="yes" 4977d13299dSbellardfi 498997344f3Sbellardtarget_user_only="no" 499997344f3Sbellardif expr $target : '.*-user' > /dev/null ; then 500997344f3Sbellard target_user_only="yes" 501997344f3Sbellardfi 502de83cd02Sbellard 5037c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile" 50497a847bcSbellard 50597a847bcSbellardmkdir -p $target_dir 506808c4954Sbellardif test "$target" = "arm-user" -o "$target" = "armeb-user" ; then 50769de927cSbellard mkdir -p $target_dir/nwfpe 50869de927cSbellardfi 509a7e61ed4Sbellardif test "$target_user_only" = "no" ; then 510a7e61ed4Sbellard mkdir -p $target_dir/slirp 511a7e61ed4Sbellardfi 51269de927cSbellard 51397a847bcSbellardln -sf $source_path/Makefile.target $target_dir/Makefile 51497a847bcSbellard 51597a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 51697a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 51797a847bcSbellard 51897a847bcSbellard 51997a847bcSbellardecho "include ../config-host.mak" >> $config_mak 52097a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h 5211e43adfcSbellard 5221e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"` 5231e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h 52497a847bcSbellard 52597a847bcSbellardif test "$target_cpu" = "i386" ; then 52697a847bcSbellard echo "TARGET_ARCH=i386" >> $config_mak 52797a847bcSbellard echo "#define TARGET_ARCH \"i386\"" >> $config_h 52897a847bcSbellard echo "#define TARGET_I386 1" >> $config_h 529808c4954Sbellardelif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then 53097a847bcSbellard echo "TARGET_ARCH=arm" >> $config_mak 53197a847bcSbellard echo "#define TARGET_ARCH \"arm\"" >> $config_h 53297a847bcSbellard echo "#define TARGET_ARM 1" >> $config_h 5331e43adfcSbellardelif test "$target_cpu" = "sparc" ; then 5341e43adfcSbellard echo "TARGET_ARCH=sparc" >> $config_mak 5351e43adfcSbellard echo "#define TARGET_ARCH \"sparc\"" >> $config_h 5361e43adfcSbellard echo "#define TARGET_SPARC 1" >> $config_h 53767867308Sbellardelif test "$target_cpu" = "ppc" ; then 53867867308Sbellard echo "TARGET_ARCH=ppc" >> $config_mak 53967867308Sbellard echo "#define TARGET_ARCH \"ppc\"" >> $config_h 54067867308Sbellard echo "#define TARGET_PPC 1" >> $config_h 541*0b0babc6Sbellardelif test "$target_cpu" = "x86_64" ; then 542*0b0babc6Sbellard echo "TARGET_ARCH=x86_64" >> $config_mak 543*0b0babc6Sbellard echo "#define TARGET_ARCH \"x86_64\"" >> $config_h 544*0b0babc6Sbellard echo "#define TARGET_I386 1" >> $config_h 545*0b0babc6Sbellard echo "#define TARGET_X86_64 1" >> $config_h 546de83cd02Sbellardelse 547de83cd02Sbellard echo "Unsupported target CPU" 548de83cd02Sbellard exit 1 549de83cd02Sbellardfi 550de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 55197a847bcSbellard echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak 55297a847bcSbellard echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h 55397a847bcSbellardfi 55497a847bcSbellardif test "$target_softmmu" = "yes" ; then 55597a847bcSbellard echo "CONFIG_SOFTMMU=yes" >> $config_mak 55697a847bcSbellard echo "#define CONFIG_SOFTMMU 1" >> $config_h 557de83cd02Sbellardfi 558997344f3Sbellardif test "$target_user_only" = "yes" ; then 559997344f3Sbellard echo "CONFIG_USER_ONLY=yes" >> $config_mak 560997344f3Sbellard echo "#define CONFIG_USER_ONLY 1" >> $config_h 561997344f3Sbellardfi 562de83cd02Sbellard 5637c1f25b4Sbellard# sdl defines 5647c1f25b4Sbellard 5657c1f25b4Sbellardif test "$target_user_only" = "no"; then 5667c1f25b4Sbellard if test "$target_softmmu" = "no" -o "$static" = "yes"; then 567dbb2c921Sbellard sdl1=$sdl_static 5687c1f25b4Sbellard else 569dbb2c921Sbellard sdl1=$sdl 570dbb2c921Sbellard fi 571dbb2c921Sbellard if test "$sdl1" = "yes" ; then 5727c1f25b4Sbellard echo "#define CONFIG_SDL 1" >> $config_h 5737c1f25b4Sbellard echo "CONFIG_SDL=yes" >> $config_mak 574dbb2c921Sbellard if test "$target_softmmu" = "no" -o "$static" = "yes"; then 575dbb2c921Sbellard echo "SDL_LIBS=$sdl_static_libs" >> $config_mak 576dbb2c921Sbellard else 5777c1f25b4Sbellard echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak 5787c1f25b4Sbellard fi 5797c1f25b4Sbellard echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak 5807c1f25b4Sbellard if [ "${aa}" = "yes" ] ; then 5817c1f25b4Sbellard echo -n " `aalib-config --cflags`" >> $config_mak ; 5827c1f25b4Sbellard fi 5837c1f25b4Sbellard echo "" >> $config_mak 5847c1f25b4Sbellard fi 585dbb2c921Sbellardfi 5867c1f25b4Sbellard 58797a847bcSbellarddone # for target in $targets 5887d13299dSbellard 5897d13299dSbellard# build tree in object directory if source path is different from current one 5907d13299dSbellardif test "$source_path_used" = "yes" ; then 5917d13299dSbellard DIRS="tests" 5927d13299dSbellard FILES="Makefile tests/Makefile" 5937d13299dSbellard for dir in $DIRS ; do 5947d13299dSbellard mkdir -p $dir 5957d13299dSbellard done 5967d13299dSbellard for f in $FILES ; do 5977d13299dSbellard ln -sf $source_path/$f $f 5987d13299dSbellard done 5997d13299dSbellardfi 6007d13299dSbellard 60197a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS 602