xref: /openbmc/qemu/configure (revision 1f50f8d1)
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`
30a541f297Sbellardtarget_list="i386-user i386 i386-softmmu arm-user sparc-user ppc-user ppc-softmmu"
317d13299dSbellardcase "$cpu" in
327d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
3397a847bcSbellard    cpu="i386"
347d13299dSbellard  ;;
357d13299dSbellard  armv4l)
367d13299dSbellard    cpu="armv4l"
377d13299dSbellard  ;;
387d13299dSbellard  alpha)
397d13299dSbellard    cpu="alpha"
407d13299dSbellard  ;;
41295defa5Sbellard  "Power Macintosh"|ppc|ppc64)
427d13299dSbellard    cpu="powerpc"
437d13299dSbellard  ;;
447d13299dSbellard  mips)
457d13299dSbellard    cpu="mips"
467d13299dSbellard  ;;
47fb3e5849Sbellard  s390)
48fb3e5849Sbellard    cpu="s390"
49fb3e5849Sbellard  ;;
50ae228531Sbellard  sparc)
51ae228531Sbellard    cpu="sparc"
52ae228531Sbellard  ;;
53ae228531Sbellard  sparc64)
54ae228531Sbellard    cpu="sparc64"
55ae228531Sbellard  ;;
56a8baa8c5Sbellard  ia64)
57a8baa8c5Sbellard    cpu="ia64"
58a8baa8c5Sbellard  ;;
5938e584a0Sbellard  m68k)
6038e584a0Sbellard    cpu="m68k"
6138e584a0Sbellard  ;;
62bc51c5c9Sbellard  x86_64|amd64)
63bc51c5c9Sbellard    cpu="amd64"
64bc51c5c9Sbellard  ;;
657d13299dSbellard  *)
667d13299dSbellard    cpu="unknown"
677d13299dSbellard  ;;
687d13299dSbellardesac
697d13299dSbellardgprof="no"
707d13299dSbellardbigendian="no"
7167b915a5Sbellardmingw32="no"
7267b915a5SbellardEXESUF=""
7367b915a5Sbellardgdbstub="yes"
74c20709aaSbellardslirp="no"
757d13299dSbellard
767d13299dSbellard# OS specific
777d13299dSbellardtargetos=`uname -s`
787d13299dSbellardcase $targetos in
7967b915a5SbellardMINGW32*)
8067b915a5Sbellardmingw32="yes"
8167b915a5Sbellard;;
827d13299dSbellard*) ;;
837d13299dSbellardesac
847d13299dSbellard
857d13299dSbellard# find source path
867d13299dSbellard# XXX: we assume an absolute path is given when launching configure,
877d13299dSbellard# except in './configure' case.
887d13299dSbellardsource_path=${0%configure}
897d13299dSbellardsource_path=${source_path%/}
907d13299dSbellardsource_path_used="yes"
917d13299dSbellardif test -z "$source_path" -o "$source_path" = "." ; then
927d13299dSbellard    source_path=`pwd`
937d13299dSbellard    source_path_used="no"
947d13299dSbellardfi
957d13299dSbellard
967d13299dSbellardfor opt do
977d13299dSbellard  case "$opt" in
987d13299dSbellard  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
997d13299dSbellard  ;;
10032ce6337Sbellard  --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2`
10132ce6337Sbellard  ;;
1027d13299dSbellard  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
1037d13299dSbellard  ;;
1047d13299dSbellard  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
1057d13299dSbellard  ;;
1067d13299dSbellard  --cc=*) cc=`echo $opt | cut -d '=' -f 2`
1077d13299dSbellard  ;;
1087d13299dSbellard  --make=*) make=`echo $opt | cut -d '=' -f 2`
1097d13299dSbellard  ;;
1107d13299dSbellard  --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
1117d13299dSbellard  ;;
1127d13299dSbellard  --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
1137d13299dSbellard  ;;
1147d13299dSbellard  --extra-libs=*) extralibs=${opt#--extra-libs=}
1157d13299dSbellard  ;;
1167d13299dSbellard  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
1177d13299dSbellard  ;;
11897a847bcSbellard  --target-list=*) target_list=${opt#--target-list=}
119de83cd02Sbellard  ;;
1207d13299dSbellard  --enable-gprof) gprof="yes"
1217d13299dSbellard  ;;
12243ce4dfeSbellard  --static) static="yes"
12343ce4dfeSbellard  ;;
12497a847bcSbellard  --disable-sdl) sdl="no"
12597a847bcSbellard  ;;
12667b915a5Sbellard  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
12767b915a5Sbellard  ;;
128c20709aaSbellard  --enable-slirp) slirp="yes"
129c20709aaSbellard  ;;
1307d13299dSbellard  esac
1317d13299dSbellarddone
1327d13299dSbellard
1337d13299dSbellard# Checking for CFLAGS
1347d13299dSbellardif test -z "$CFLAGS"; then
1357d13299dSbellard    CFLAGS="-O2"
1367d13299dSbellardfi
1377d13299dSbellard
1387d13299dSbellardcc="${cross_prefix}${cc}"
1397d13299dSbellardar="${cross_prefix}${ar}"
1407d13299dSbellardstrip="${cross_prefix}${strip}"
1417d13299dSbellard
14267b915a5Sbellardif test "$mingw32" = "yes" ; then
14367b915a5Sbellard    target_list="i386-softmmu"
14467b915a5Sbellard    EXESUF=".exe"
14567b915a5Sbellard    gdbstub="no"
14667b915a5Sbellardfi
14767b915a5Sbellard
1487d13299dSbellardif test -z "$cross_prefix" ; then
1497d13299dSbellard
1507d13299dSbellard# ---
1517d13299dSbellard# big/little endian test
1527d13299dSbellardcat > $TMPC << EOF
1537d13299dSbellard#include <inttypes.h>
1547d13299dSbellardint main(int argc, char ** argv){
1557d13299dSbellard	volatile uint32_t i=0x01234567;
1567d13299dSbellard	return (*((uint8_t*)(&i))) == 0x67;
1577d13299dSbellard}
1587d13299dSbellardEOF
1597d13299dSbellard
1607d13299dSbellardif $cc -o $TMPE $TMPC 2>/dev/null ; then
1617d13299dSbellard$TMPE && bigendian="yes"
1627d13299dSbellardelse
1637d13299dSbellardecho big/little test failed
1647d13299dSbellardfi
1657d13299dSbellard
1667d13299dSbellardelse
1677d13299dSbellard
1687d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
16938e584a0Sbellardif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k"; then
1707d13299dSbellard    bigendian="yes"
1717d13299dSbellardfi
1727d13299dSbellard
1737d13299dSbellardfi
1747d13299dSbellard
175e8cd23deSbellard# check gcc options support
17604369ff2Sbellardcat > $TMPC <<EOF
17704369ff2Sbellardint main(void) {
17804369ff2Sbellard}
17904369ff2SbellardEOF
18004369ff2Sbellard
181e8cd23deSbellardhave_gcc3_options="no"
182e8cd23deSbellardif $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
183e8cd23deSbellard   have_gcc3_options="yes"
18404369ff2Sbellardfi
185ca735206Sbellard
18611d9f695Sbellard##########################################
18711d9f695Sbellard# SDL probe
18811d9f695Sbellard
18911d9f695Sbellardsdl_too_old=no
19011d9f695Sbellard
19111d9f695Sbellardif test -z "$sdl" ; then
19211d9f695Sbellard
193a6e022adSbellardsdl_config="sdl-config"
194a6e022adSbellardsdl=no
1957c1f25b4Sbellardsdl_static=no
196a6e022adSbellard
197a6e022adSbellardif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
198a6e022adSbellard# win32 cross compilation case
199a6e022adSbellard    sdl_config="i386-mingw32msvc-sdl-config"
200a6e022adSbellard    sdl=yes
201a6e022adSbellardelse
202a6e022adSbellard# normal SDL probe
20311d9f695Sbellardcat > $TMPC << EOF
20411d9f695Sbellard#include <SDL.h>
20511d9f695Sbellard#undef main /* We don't want SDL to override our main() */
20611d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
20711d9f695SbellardEOF
20811d9f695Sbellard
209a6e022adSbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
210a6e022adSbellard_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
21111d9f695Sbellardif test "$_sdlversion" -lt 121 ; then
21211d9f695Sbellardsdl_too_old=yes
21311d9f695Sbellardelse
21411d9f695Sbellardsdl=yes
21511d9f695Sbellardfi
2167c1f25b4Sbellard
2177c1f25b4Sbellard# static link with sdl ?
2187c1f25b4Sbellardif test "$sdl" = "yes" ; then
2197c1f25b4Sbellardaa="no"
2207c1f25b4Sbellard`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
2217c1f25b4Sbellardsdl_static_libs=`$sdl_config --static-libs`
2227c1f25b4Sbellardif [ "$aa" = "yes" ] ; then
223d8d8aa4eSbellard  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
22411d9f695Sbellardfi
22511d9f695Sbellard
2267c1f25b4Sbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
2277c1f25b4Sbellard  sdl_static=yes
2287c1f25b4Sbellardfi
2297c1f25b4Sbellard
2307c1f25b4Sbellardfi # static link
2317c1f25b4Sbellard
2327c1f25b4Sbellardfi # sdl compile test
2337c1f25b4Sbellard
234a6e022adSbellardfi # cross compilation
235a6e022adSbellardfi # -z $sdl
23611d9f695Sbellard
2377d13299dSbellardif test x"$1" = x"-h" -o x"$1" = x"--help" ; then
2387d13299dSbellardcat << EOF
2397d13299dSbellard
2407d13299dSbellardUsage: configure [options]
2417d13299dSbellardOptions: [defaults in brackets after descriptions]
2427d13299dSbellard
2437d13299dSbellardEOF
2447d13299dSbellardecho "Standard options:"
2457d13299dSbellardecho "  --help                   print this message"
2467d13299dSbellardecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
2471e43adfcSbellardecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
2481e43adfcSbellardecho "                           use %M for cpu name [$interp_prefix]"
24997a847bcSbellardecho "  --target-list=LIST       set target list [$target_list]"
2507d13299dSbellardecho ""
2517d13299dSbellardecho "Advanced options (experts only):"
2527d13299dSbellardecho "  --source-path=PATH       path of source code [$source_path]"
2537d13299dSbellardecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
2547d13299dSbellardecho "  --cc=CC                  use C compiler CC [$cc]"
2557d13299dSbellardecho "  --make=MAKE              use specified make [$make]"
25643ce4dfeSbellardecho "  --static                 enable static build [$static]"
25767b915a5Sbellardecho "  --enable-mingw32         enable Win32 cross compilation with mingw32"
2587d13299dSbellardecho ""
2597d13299dSbellardecho "NOTE: The object files are build at the place where configure is launched"
2607d13299dSbellardexit 1
2617d13299dSbellardfi
2627d13299dSbellard
26311d9f695Sbellardif test "$mingw32" = "yes" ; then
26411d9f695Sbellardif test -z "$prefix" ; then
26511d9f695Sbellard    prefix="/c/Program Files/Qemu"
26611d9f695Sbellardfi
26711d9f695Sbellardmandir="$prefix"
26811d9f695Sbellardsharedir="$prefix"
269*1f50f8d1Sbellarddocdir="$prefix"
27011d9f695Sbellardbindir="$prefix"
27111d9f695Sbellardelse
27211d9f695Sbellardif test -z "$prefix" ; then
27311d9f695Sbellard    prefix="/usr/local"
27411d9f695Sbellardfi
2755a67135aSbellardmandir="$prefix/share/man"
2765a67135aSbellardsharedir="$prefix/share/qemu"
277*1f50f8d1Sbellarddocdir="$prefix/share/doc/qemu"
27811d9f695Sbellardbindir="$prefix/bin"
27911d9f695Sbellardfi
2805a67135aSbellard
2817d13299dSbellardecho "Install prefix    $prefix"
2825a67135aSbellardecho "BIOS directory    $sharedir"
28311d9f695Sbellardecho "binary directory  $bindir"
28411d9f695Sbellardif test "$mingw32" = "no" ; then
28511d9f695Sbellardecho "Manual directory  $mandir"
28643ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
28711d9f695Sbellardfi
2885a67135aSbellardecho "Source path       $source_path"
2897d13299dSbellardecho "C compiler        $cc"
2907d13299dSbellardecho "make              $make"
291a98fd896Sbellardecho "host CPU          $cpu"
292de83cd02Sbellardecho "host big endian   $bigendian"
29397a847bcSbellardecho "target list       $target_list"
2947d13299dSbellardecho "gprof enabled     $gprof"
29543ce4dfeSbellardecho "static build      $static"
29697a847bcSbellardecho "SDL support       $sdl"
2977c1f25b4Sbellardecho "SDL static link   $sdl_static"
29867b915a5Sbellardecho "mingw32 support   $mingw32"
29967b915a5Sbellard
30097a847bcSbellardif test $sdl_too_old = "yes"; then
30197a847bcSbellardecho "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
302e8cd23deSbellardfi
3037c1f25b4Sbellardif test "$sdl_static" = "no"; then
3047c1f25b4Sbellard  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
3057c1f25b4Sbellardfi
30697a847bcSbellard
30797a847bcSbellardconfig_mak="config-host.mak"
30897a847bcSbellardconfig_h="config-host.h"
30997a847bcSbellard
3107c1f25b4Sbellard#echo "Creating $config_mak and $config_h"
31197a847bcSbellard
31297a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
31397a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
31497a847bcSbellard
31597a847bcSbellardecho "prefix=$prefix" >> $config_mak
31611d9f695Sbellardecho "bindir=$bindir" >> $config_mak
3175a67135aSbellardecho "mandir=$mandir" >> $config_mak
3185a67135aSbellardecho "sharedir=$sharedir" >> $config_mak
319*1f50f8d1Sbellardecho "docdir=$docdir" >> $config_mak
3205a67135aSbellardecho "#define CONFIG_QEMU_SHAREDIR \"$sharedir\"" >> $config_h
32197a847bcSbellardecho "MAKE=$make" >> $config_mak
32297a847bcSbellardecho "CC=$cc" >> $config_mak
32397a847bcSbellardif test "$have_gcc3_options" = "yes" ; then
32497a847bcSbellard  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
32597a847bcSbellardfi
32697a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak
32797a847bcSbellardecho "AR=$ar" >> $config_mak
32897a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak
32997a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak
33097a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak
33167b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak
33297a847bcSbellardif test "$cpu" = "i386" ; then
33397a847bcSbellard  echo "ARCH=i386" >> $config_mak
33497a847bcSbellard  echo "#define HOST_I386 1" >> $config_h
335bc51c5c9Sbellardelif test "$cpu" = "amd64" ; then
336bc51c5c9Sbellard  echo "ARCH=amd64" >> $config_mak
337bc51c5c9Sbellard  echo "#define HOST_AMD64 1" >> $config_h
3387d13299dSbellardelif test "$cpu" = "armv4l" ; then
33997a847bcSbellard  echo "ARCH=arm" >> $config_mak
34097a847bcSbellard  echo "#define HOST_ARM 1" >> $config_h
3417d13299dSbellardelif test "$cpu" = "powerpc" ; then
34297a847bcSbellard  echo "ARCH=ppc" >> $config_mak
34397a847bcSbellard  echo "#define HOST_PPC 1" >> $config_h
3447d13299dSbellardelif test "$cpu" = "mips" ; then
34597a847bcSbellard  echo "ARCH=mips" >> $config_mak
34697a847bcSbellard  echo "#define HOST_MIPS 1" >> $config_h
347fb3e5849Sbellardelif test "$cpu" = "s390" ; then
34897a847bcSbellard  echo "ARCH=s390" >> $config_mak
34997a847bcSbellard  echo "#define HOST_S390 1" >> $config_h
350295defa5Sbellardelif test "$cpu" = "alpha" ; then
35197a847bcSbellard  echo "ARCH=alpha" >> $config_mak
35297a847bcSbellard  echo "#define HOST_ALPHA 1" >> $config_h
353ae228531Sbellardelif test "$cpu" = "sparc" ; then
35497a847bcSbellard  echo "ARCH=sparc" >> $config_mak
35597a847bcSbellard  echo "#define HOST_SPARC 1" >> $config_h
356ae228531Sbellardelif test "$cpu" = "sparc64" ; then
35797a847bcSbellard  echo "ARCH=sparc64" >> $config_mak
35897a847bcSbellard  echo "#define HOST_SPARC64 1" >> $config_h
359a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then
36097a847bcSbellard  echo "ARCH=ia64" >> $config_mak
36197a847bcSbellard  echo "#define HOST_IA64 1" >> $config_h
36238e584a0Sbellardelif test "$cpu" = "m68k" ; then
36338ca2abcSbellard  echo "ARCH=m68k" >> $config_mak
36438ca2abcSbellard  echo "#define HOST_M68K 1" >> $config_h
3657d13299dSbellardelse
3667d13299dSbellard  echo "Unsupported CPU"
3677d13299dSbellard  exit 1
3687d13299dSbellardfi
3697d13299dSbellardif test "$bigendian" = "yes" ; then
37097a847bcSbellard  echo "WORDS_BIGENDIAN=yes" >> $config_mak
37197a847bcSbellard  echo "#define WORDS_BIGENDIAN 1" >> $config_h
37297a847bcSbellardfi
37367b915a5Sbellardif test "$mingw32" = "yes" ; then
37467b915a5Sbellard  echo "CONFIG_WIN32=yes" >> $config_mak
37511d9f695Sbellard  echo "#define CONFIG_WIN32 1" >> $config_h
37667b915a5Sbellardelse
37797a847bcSbellard  echo "#define HAVE_BYTESWAP_H 1" >> $config_h
37867b915a5Sbellardfi
37967b915a5Sbellardif test "$gdbstub" = "yes" ; then
38067b915a5Sbellard  echo "CONFIG_GDBSTUB=yes" >> $config_mak
38167b915a5Sbellard  echo "#define CONFIG_GDBSTUB 1" >> $config_h
38267b915a5Sbellardfi
38397a847bcSbellardif test "$gprof" = "yes" ; then
38497a847bcSbellard  echo "TARGET_GPROF=yes" >> $config_mak
38597a847bcSbellard  echo "#define HAVE_GPROF 1" >> $config_h
38697a847bcSbellardfi
38797a847bcSbellardif test "$static" = "yes" ; then
38897a847bcSbellard  echo "CONFIG_STATIC=yes" >> $config_mak
38950863472Sbellard  echo "#define CONFIG_STATIC 1" >> $config_h
39097a847bcSbellardfi
391c20709aaSbellardif test "$slirp" = "yes" ; then
392c20709aaSbellard  echo "CONFIG_SLIRP=yes" >> $config_mak
393c20709aaSbellard  echo "#define CONFIG_SLIRP 1" >> $config_h
394c20709aaSbellardfi
39597a847bcSbellardecho -n "VERSION=" >>$config_mak
39697a847bcSbellardhead $source_path/VERSION >>$config_mak
39797a847bcSbellardecho "" >>$config_mak
39897a847bcSbellardecho -n "#define QEMU_VERSION \"" >> $config_h
39997a847bcSbellardhead $source_path/VERSION >> $config_h
40097a847bcSbellardecho "\"" >> $config_h
40197a847bcSbellard
40297a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak
40397a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak
40497a847bcSbellard
40597a847bcSbellardfor target in $target_list; do
40697a847bcSbellard
40797a847bcSbellardtarget_dir="$target"
40897a847bcSbellardconfig_mak=$target_dir/config.mak
40997a847bcSbellardconfig_h=$target_dir/config.h
41097a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1`
41197a847bcSbellardtarget_bigendian="no"
4121e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes
41367867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes
41497a847bcSbellardtarget_softmmu="no"
41597a847bcSbellardif expr $target : '.*-softmmu' > /dev/null ; then
41697a847bcSbellard  target_softmmu="yes"
4177d13299dSbellardfi
418997344f3Sbellardtarget_user_only="no"
419997344f3Sbellardif expr $target : '.*-user' > /dev/null ; then
420997344f3Sbellard  target_user_only="yes"
421997344f3Sbellardfi
422de83cd02Sbellard
4237c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
42497a847bcSbellard
42597a847bcSbellardmkdir -p $target_dir
42669de927cSbellardif test "$target" = "arm-user" ; then
42769de927cSbellard  mkdir -p $target_dir/nwfpe
42869de927cSbellardfi
429a7e61ed4Sbellardif test "$target_user_only" = "no" ; then
430a7e61ed4Sbellard  mkdir -p $target_dir/slirp
431a7e61ed4Sbellardfi
43269de927cSbellard
43397a847bcSbellardln -sf $source_path/Makefile.target $target_dir/Makefile
43497a847bcSbellard
43597a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
43697a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
43797a847bcSbellard
43897a847bcSbellard
43997a847bcSbellardecho "include ../config-host.mak" >> $config_mak
44097a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h
4411e43adfcSbellard
4421e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
4431e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
44497a847bcSbellard
44597a847bcSbellardif test "$target_cpu" = "i386" ; then
44697a847bcSbellard  echo "TARGET_ARCH=i386" >> $config_mak
44797a847bcSbellard  echo "#define TARGET_ARCH \"i386\"" >> $config_h
44897a847bcSbellard  echo "#define TARGET_I386 1" >> $config_h
449de83cd02Sbellardelif test "$target_cpu" = "arm" ; then
45097a847bcSbellard  echo "TARGET_ARCH=arm" >> $config_mak
45197a847bcSbellard  echo "#define TARGET_ARCH \"arm\"" >> $config_h
45297a847bcSbellard  echo "#define TARGET_ARM 1" >> $config_h
4531e43adfcSbellardelif test "$target_cpu" = "sparc" ; then
4541e43adfcSbellard  echo "TARGET_ARCH=sparc" >> $config_mak
4551e43adfcSbellard  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
4561e43adfcSbellard  echo "#define TARGET_SPARC 1" >> $config_h
45767867308Sbellardelif test "$target_cpu" = "ppc" ; then
45867867308Sbellard  echo "TARGET_ARCH=ppc" >> $config_mak
45967867308Sbellard  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
46067867308Sbellard  echo "#define TARGET_PPC 1" >> $config_h
461de83cd02Sbellardelse
462de83cd02Sbellard  echo "Unsupported target CPU"
463de83cd02Sbellard  exit 1
464de83cd02Sbellardfi
465de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
46697a847bcSbellard  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
46797a847bcSbellard  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
46897a847bcSbellardfi
46997a847bcSbellardif test "$target_softmmu" = "yes" ; then
47097a847bcSbellard  echo "CONFIG_SOFTMMU=yes" >> $config_mak
47197a847bcSbellard  echo "#define CONFIG_SOFTMMU 1" >> $config_h
472de83cd02Sbellardfi
473997344f3Sbellardif test "$target_user_only" = "yes" ; then
474997344f3Sbellard  echo "CONFIG_USER_ONLY=yes" >> $config_mak
475997344f3Sbellard  echo "#define CONFIG_USER_ONLY 1" >> $config_h
476997344f3Sbellardfi
477de83cd02Sbellard
4787c1f25b4Sbellard# sdl defines
4797c1f25b4Sbellard
4807c1f25b4Sbellardif test "$target_user_only" = "no"; then
4817c1f25b4Sbellard    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
4827c1f25b4Sbellard        if test "$sdl_static" = "yes" ; then
4837c1f25b4Sbellard            echo "#define CONFIG_SDL 1" >> $config_h
4847c1f25b4Sbellard            echo "CONFIG_SDL=yes" >> $config_mak
4857c1f25b4Sbellard            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
4867c1f25b4Sbellard        fi
4877c1f25b4Sbellard    else
4887c1f25b4Sbellard        if test "$sdl" = "yes" ; then
4897c1f25b4Sbellard            echo "#define CONFIG_SDL 1" >> $config_h
4907c1f25b4Sbellard            echo "CONFIG_SDL=yes" >> $config_mak
4917c1f25b4Sbellard            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
4927c1f25b4Sbellard        fi
4937c1f25b4Sbellard    fi
4947c1f25b4Sbellard    echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
4957c1f25b4Sbellard    if [ "${aa}" = "yes" ] ; then
4967c1f25b4Sbellard        echo -n " `aalib-config --cflags`" >> $config_mak ;
4977c1f25b4Sbellard    fi
4987c1f25b4Sbellard    echo "" >> $config_mak
4997c1f25b4Sbellardfi
5007c1f25b4Sbellard
50197a847bcSbellarddone # for target in $targets
5027d13299dSbellard
5037d13299dSbellard# build tree in object directory if source path is different from current one
5047d13299dSbellardif test "$source_path_used" = "yes" ; then
5057d13299dSbellard    DIRS="tests"
5067d13299dSbellard    FILES="Makefile tests/Makefile"
5077d13299dSbellard    for dir in $DIRS ; do
5087d13299dSbellard            mkdir -p $dir
5097d13299dSbellard    done
5107d13299dSbellard    for f in $FILES ; do
5117d13299dSbellard        ln -sf $source_path/$f $f
5127d13299dSbellard    done
5137d13299dSbellardfi
5147d13299dSbellard
51597a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS
516