xref: /openbmc/qemu/configure (revision e6e5906b6e0a81718066ca43aef57515026c6624)
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"
286a882643Spbrookinstall="install"
297d13299dSbellardstrip="strip"
307d13299dSbellardcpu=`uname -m`
315327cf48Sbellardtarget_list=""
327d13299dSbellardcase "$cpu" in
337d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
3497a847bcSbellard    cpu="i386"
357d13299dSbellard  ;;
36ba68055eSbellard  armv*b)
37808c4954Sbellard    cpu="armv4b"
38808c4954Sbellard  ;;
39ba68055eSbellard  armv*l)
407d13299dSbellard    cpu="armv4l"
417d13299dSbellard  ;;
427d13299dSbellard  alpha)
437d13299dSbellard    cpu="alpha"
447d13299dSbellard  ;;
45295defa5Sbellard  "Power Macintosh"|ppc|ppc64)
467d13299dSbellard    cpu="powerpc"
477d13299dSbellard  ;;
487d13299dSbellard  mips)
497d13299dSbellard    cpu="mips"
507d13299dSbellard  ;;
51fb3e5849Sbellard  s390)
52fb3e5849Sbellard    cpu="s390"
53fb3e5849Sbellard  ;;
5494ac5158Spbrook  sparc|sun4[muv])
55ae228531Sbellard    cpu="sparc"
56ae228531Sbellard  ;;
57ae228531Sbellard  sparc64)
58ae228531Sbellard    cpu="sparc64"
59ae228531Sbellard  ;;
60a8baa8c5Sbellard  ia64)
61a8baa8c5Sbellard    cpu="ia64"
62a8baa8c5Sbellard  ;;
6338e584a0Sbellard  m68k)
6438e584a0Sbellard    cpu="m68k"
6538e584a0Sbellard  ;;
66bc51c5c9Sbellard  x86_64|amd64)
670b0babc6Sbellard    cpu="x86_64"
68bc51c5c9Sbellard  ;;
697d13299dSbellard  *)
707d13299dSbellard    cpu="unknown"
717d13299dSbellard  ;;
727d13299dSbellardesac
737d13299dSbellardgprof="no"
747d13299dSbellardbigendian="no"
7567b915a5Sbellardmingw32="no"
7667b915a5SbellardEXESUF=""
7767b915a5Sbellardgdbstub="yes"
78443f1376Sbellardslirp="yes"
79fb065187Sbellardadlib="no"
80fb065187Sbellardoss="no"
811d14ffa9Sbellarddsound="no"
821d14ffa9Sbellardcoreaudio="no"
831d14ffa9Sbellardalsa="no"
84102a52e4Sbellardfmod="no"
85102a52e4Sbellardfmod_lib=""
86102a52e4Sbellardfmod_inc=""
87b1a550a0Spbrookbsd="no"
885327cf48Sbellardlinux="no"
89c9ec1fe4Sbellardkqemu="no"
9005c2a3e7Sbellardprofiler="no"
915b0753e0Sbellardcocoa="no"
9297ccc689Sbellardcheck_gfx="yes"
931aff381fSbellardcheck_gcc="yes"
940a8e90f4Spbrooksoftmmu="yes"
950a8e90f4Spbrookuser="no"
96cc8ae6deSpbrookbuild_docs="no"
97c5937220Spbrookuname_release=""
987d13299dSbellard
997d13299dSbellard# OS specific
1007d13299dSbellardtargetos=`uname -s`
1017d13299dSbellardcase $targetos in
102c326e0afSbellardCYGWIN*)
103c326e0afSbellardmingw32="yes"
104c326e0afSbellardCFLAGS="-O2 -mno-cygwin"
105c326e0afSbellard;;
10667b915a5SbellardMINGW32*)
10767b915a5Sbellardmingw32="yes"
10867b915a5Sbellard;;
1097d3505c5SbellardFreeBSD)
1107d3505c5Sbellardbsd="yes"
111fb065187Sbellardoss="yes"
112e99f9060Sbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
11307f4ddbfSbellard    kqemu="yes"
11407f4ddbfSbellardfi
1157d3505c5Sbellard;;
1167d3505c5SbellardNetBSD)
1177d3505c5Sbellardbsd="yes"
118fb065187Sbellardoss="yes"
1197d3505c5Sbellard;;
1207d3505c5SbellardOpenBSD)
1217d3505c5Sbellardbsd="yes"
122fb065187Sbellardoss="yes"
1237d3505c5Sbellard;;
12483fb7adfSbellardDarwin)
12583fb7adfSbellardbsd="yes"
12683fb7adfSbellarddarwin="yes"
12783fb7adfSbellard;;
128ec530c81SbellardSunOS)
129ec530c81Sbellardsolaris="yes"
130ec530c81Sbellard;;
131fb065187Sbellard*)
132fb065187Sbellardoss="yes"
1335327cf48Sbellardlinux="yes"
1340a8e90f4Spbrookuser="yes"
13507f4ddbfSbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
136c9ec1fe4Sbellard    kqemu="yes"
137c9ec1fe4Sbellardfi
138fb065187Sbellard;;
1397d13299dSbellardesac
1407d13299dSbellard
1417d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
142b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
1437d3505c5Sbellard    make="gmake"
14483fb7adfSbellard  fi
1457d3505c5Sbellardfi
1467d3505c5Sbellard
147ec530c81Sbellardif [ "$solaris" = "yes" ] ; then
148ec530c81Sbellard    make="gmake"
149ec530c81Sbellard    install="ginstall"
150ec530c81Sbellard    solarisrev=`uname -r | cut -f2 -d.`
151ec530c81Sbellardfi
152ec530c81Sbellard
1537d13299dSbellard# find source path
154ad064840Spbrooksource_path=`dirname "$0"`
155ad064840Spbrookif [ -z "$source_path" ]; then
1567d13299dSbellard    source_path=`pwd`
157ad064840Spbrookelse
158ad064840Spbrook    source_path=`cd "$source_path"; pwd`
159ad064840Spbrookfi
160ad064840Spbrookif test "$source_path" = `pwd` ; then
1617d13299dSbellard    source_path_used="no"
162ad064840Spbrookelse
163ad064840Spbrook    source_path_used="yes"
1647d13299dSbellardfi
1657d13299dSbellard
1667d13299dSbellardfor opt do
167a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
1687d13299dSbellard  case "$opt" in
1692efc3265Sbellard  --help|-h) show_help=yes
1702efc3265Sbellard  ;;
171b1a550a0Spbrook  --prefix=*) prefix="$optarg"
1727d13299dSbellard  ;;
173b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
17432ce6337Sbellard  ;;
175b1a550a0Spbrook  --source-path=*) source_path="$optarg"
176ad064840Spbrook  source_path_used="yes"
1777d13299dSbellard  ;;
178b1a550a0Spbrook  --cross-prefix=*) cross_prefix="$optarg"
1797d13299dSbellard  ;;
180b1a550a0Spbrook  --cc=*) cc="$optarg"
1817d13299dSbellard  ;;
182b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
18383469015Sbellard  ;;
184b1a550a0Spbrook  --make=*) make="$optarg"
1857d13299dSbellard  ;;
1866a882643Spbrook  --install=*) install="$optarg"
1876a882643Spbrook  ;;
188b1a550a0Spbrook  --extra-cflags=*) CFLAGS="$optarg"
1897d13299dSbellard  ;;
190b1a550a0Spbrook  --extra-ldflags=*) LDFLAGS="$optarg"
1917d13299dSbellard  ;;
192b1a550a0Spbrook  --cpu=*) cpu="$optarg"
1937d13299dSbellard  ;;
194b1a550a0Spbrook  --target-list=*) target_list="$optarg"
195de83cd02Sbellard  ;;
1967d13299dSbellard  --enable-gprof) gprof="yes"
1977d13299dSbellard  ;;
19843ce4dfeSbellard  --static) static="yes"
19943ce4dfeSbellard  ;;
20097a847bcSbellard  --disable-sdl) sdl="no"
20197a847bcSbellard  ;;
2021d14ffa9Sbellard  --enable-coreaudio) coreaudio="yes"
2031d14ffa9Sbellard  ;;
2041d14ffa9Sbellard  --enable-alsa) alsa="yes"
2051d14ffa9Sbellard  ;;
2061d14ffa9Sbellard  --enable-dsound) dsound="yes"
2071d14ffa9Sbellard  ;;
208102a52e4Sbellard  --enable-fmod) fmod="yes"
209102a52e4Sbellard  ;;
210b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
211102a52e4Sbellard  ;;
212b1a550a0Spbrook  --fmod-inc=*) fmod_inc="$optarg"
213102a52e4Sbellard  ;;
21487ac5427Sbellard  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
21567b915a5Sbellard  ;;
216443f1376Sbellard  --disable-slirp) slirp="no"
217c20709aaSbellard  ;;
218fb065187Sbellard  --enable-adlib) adlib="yes"
219fb065187Sbellard  ;;
220c9ec1fe4Sbellard  --disable-kqemu) kqemu="no"
221c9ec1fe4Sbellard  ;;
22205c2a3e7Sbellard  --enable-profiler) profiler="yes"
22305c2a3e7Sbellard  ;;
2241d14ffa9Sbellard  --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
2255b0753e0Sbellard  ;;
22697ccc689Sbellard  --disable-gfx-check) check_gfx="no"
22797ccc689Sbellard  ;;
2281aff381fSbellard  --disable-gcc-check) check_gcc="no"
2291aff381fSbellard  ;;
230cad25d69Spbrook  --disable-system) softmmu="no"
2310a8e90f4Spbrook  ;;
232cad25d69Spbrook  --enable-system) softmmu="yes"
2330a8e90f4Spbrook  ;;
2340a8e90f4Spbrook  --disable-user) user="no"
2350a8e90f4Spbrook  ;;
2360a8e90f4Spbrook  --enable-user) user="yes"
2370a8e90f4Spbrook  ;;
238c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
239c5937220Spbrook  ;;
2407d13299dSbellard  esac
2417d13299dSbellarddone
2427d13299dSbellard
2437d13299dSbellard# Checking for CFLAGS
2447d13299dSbellardif test -z "$CFLAGS"; then
2457d13299dSbellard    CFLAGS="-O2"
2467d13299dSbellardfi
2477d13299dSbellard
248af5db58eSpbrookif test x"$show_help" = x"yes" ; then
249af5db58eSpbrookcat << EOF
250af5db58eSpbrook
251af5db58eSpbrookUsage: configure [options]
252af5db58eSpbrookOptions: [defaults in brackets after descriptions]
253af5db58eSpbrook
254af5db58eSpbrookEOF
255af5db58eSpbrookecho "Standard options:"
256af5db58eSpbrookecho "  --help                   print this message"
257af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
258af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
259af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
260af5db58eSpbrookecho "  --target-list=LIST       set target list [$target_list]"
261af5db58eSpbrookecho ""
262af5db58eSpbrookecho "kqemu kernel acceleration support:"
263af5db58eSpbrookecho "  --disable-kqemu          disable kqemu support"
264af5db58eSpbrookecho ""
265af5db58eSpbrookecho "Advanced options (experts only):"
266af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
267af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
268af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
269af5db58eSpbrookecho "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
270af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
2716a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
272af5db58eSpbrookecho "  --static                 enable static build [$static]"
273af5db58eSpbrookecho "  --enable-cocoa           enable COCOA (Mac OS X only)"
274af5db58eSpbrookecho "  --enable-mingw32         enable Win32 cross compilation with mingw32"
275af5db58eSpbrookecho "  --enable-adlib           enable Adlib emulation"
276af5db58eSpbrookecho "  --enable-coreaudio       enable Coreaudio audio driver"
277af5db58eSpbrookecho "  --enable-alsa            enable ALSA audio driver"
278af5db58eSpbrookecho "  --enable-fmod            enable FMOD audio driver"
279af5db58eSpbrookecho "  --enabled-dsound         enable DirectSound audio driver"
280af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
281af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
282af5db58eSpbrookecho "  --enable-user            enable all linux usermode emulation targets"
283af5db58eSpbrookecho "  --disable-user           disable all linux usermode emulation targets"
284af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
285af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
286c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
287af5db58eSpbrookecho ""
288af5db58eSpbrookecho "NOTE: The object files are build at the place where configure is launched"
289af5db58eSpbrookexit 1
290af5db58eSpbrookfi
291af5db58eSpbrook
2927d13299dSbellardcc="${cross_prefix}${cc}"
2937d13299dSbellardar="${cross_prefix}${ar}"
2947d13299dSbellardstrip="${cross_prefix}${strip}"
2957d13299dSbellard
296064aae13Spbrook# check that the C compiler works.
297064aae13Spbrookcat > $TMPC <<EOF
298064aae13Spbrookint main(void) {}
299064aae13SpbrookEOF
300064aae13Spbrook
301064aae13Spbrookif $cc -c -o $TMPO $TMPC 2>/dev/null ; then
302064aae13Spbrook  : C compiler works ok
303064aae13Spbrookelse
304064aae13Spbrook    echo "ERROR: \"$cc\" either does not exist or does not work"
305064aae13Spbrook    exit 1
306a7350fa1Sbellardfi
307a7350fa1Sbellard
30867b915a5Sbellardif test "$mingw32" = "yes" ; then
3095327cf48Sbellard    linux="no"
31067b915a5Sbellard    EXESUF=".exe"
3119f059ecaSbellard    oss="no"
31207f4ddbfSbellard    if [ "$cpu" = "i386" ] ; then
31307f4ddbfSbellard        kqemu="yes"
31407f4ddbfSbellard    fi
31567b915a5Sbellardfi
31667b915a5Sbellard
317ec530c81Sbellard#
318ec530c81Sbellard# Solaris specific configure tool chain decisions
319ec530c81Sbellard#
320ec530c81Sbellardif test "$solaris" = "yes" ; then
321ec530c81Sbellard  #
322ec530c81Sbellard  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
323ec530c81Sbellard  # override the check with --disable-gcc-check
324ec530c81Sbellard  #
325ec530c81Sbellard  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
326ec530c81Sbellard    solgcc=`which $cc`
327ec530c81Sbellard    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
328ec530c81Sbellard      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
329ec530c81Sbellard      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
330ec530c81Sbellard      echo "or get the latest patch from SunSolve for gcc"
331ec530c81Sbellard      exit 1
332ec530c81Sbellard    fi
333ec530c81Sbellard  fi
334ec530c81Sbellard  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
335ec530c81Sbellard  if test -z "$solinst" ; then
336ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
337ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
338ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
339ec530c81Sbellard    exit 1
340ec530c81Sbellard  fi
341ec530c81Sbellard  if test "$solinst" = "/usr/sbin/install" ; then
342ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
343ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
344ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
345ec530c81Sbellard    exit 1
346ec530c81Sbellard  fi
347ec530c81Sbellard  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
348ec530c81Sbellard  if test -z "$sol_ar" ; then
349ec530c81Sbellard    echo "Error: No path includes ar"
350ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
351ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
352ec530c81Sbellard    fi
353ec530c81Sbellard    exit 1
354ec530c81Sbellard  fi
355ec530c81Sbellardfi
356ec530c81Sbellard
357ec530c81Sbellard
3585327cf48Sbellardif test -z "$target_list" ; then
3595327cf48Sbellard# these targets are portable
3600a8e90f4Spbrook    if [ "$softmmu" = "yes" ] ; then
36138260998Spbrook        target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
3620a8e90f4Spbrook    fi
3635327cf48Sbellard# the following are Linux specific
3640a8e90f4Spbrook    if [ "$user" = "yes" ] ; then
365*e6e5906bSpbrook        target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user m68k-user $target_list"
3665327cf48Sbellard    fi
3676e20a45fSbellardelse
368b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
3695327cf48Sbellardfi
3700a8e90f4Spbrookif test -z "$target_list" ; then
3710a8e90f4Spbrook    echo "No targets enabled"
3720a8e90f4Spbrook    exit 1
3730a8e90f4Spbrookfi
3745327cf48Sbellard
3757d13299dSbellardif test -z "$cross_prefix" ; then
3767d13299dSbellard
3777d13299dSbellard# ---
3787d13299dSbellard# big/little endian test
3797d13299dSbellardcat > $TMPC << EOF
3807d13299dSbellard#include <inttypes.h>
3817d13299dSbellardint main(int argc, char ** argv){
3827d13299dSbellard        volatile uint32_t i=0x01234567;
3837d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
3847d13299dSbellard}
3857d13299dSbellardEOF
3867d13299dSbellard
3877d13299dSbellardif $cc -o $TMPE $TMPC 2>/dev/null ; then
3887d13299dSbellard$TMPE && bigendian="yes"
3897d13299dSbellardelse
3907d13299dSbellardecho big/little test failed
3917d13299dSbellardfi
3927d13299dSbellard
3937d13299dSbellardelse
3947d13299dSbellard
3957d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
396808c4954Sbellardif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
3977d13299dSbellard    bigendian="yes"
3987d13299dSbellardfi
3997d13299dSbellard
4007d13299dSbellardfi
4017d13299dSbellard
402b6853697Sbellard# host long bits test
403b6853697Sbellardhostlongbits="32"
404b6853697Sbellardif test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
405b6853697Sbellard    hostlongbits="64"
406b6853697Sbellardfi
407b6853697Sbellard
408e8cd23deSbellard# check gcc options support
40904369ff2Sbellardcat > $TMPC <<EOF
41004369ff2Sbellardint main(void) {
41104369ff2Sbellard}
41204369ff2SbellardEOF
41304369ff2Sbellard
414e8cd23deSbellardhave_gcc3_options="no"
415e8cd23deSbellardif $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
416e8cd23deSbellard   have_gcc3_options="yes"
41704369ff2Sbellardfi
418ca735206Sbellard
419b1a550a0Spbrook# Check for gcc4, error if pre-gcc4
4201aff381fSbellardif test "$check_gcc" = "yes" ; then
4211aff381fSbellard    cat > $TMPC <<EOF
422b1a550a0Spbrook#if __GNUC__ < 4
423b1a550a0Spbrook#error gcc3
4241aff381fSbellard#endif
4251aff381fSbellardint main(){return 0;}
4261aff381fSbellardEOF
427b1a550a0Spbrook    if $cc -o $TMPO $TMPC 2>/dev/null ; then
4281aff381fSbellard        echo "ERROR: \"$cc\" looks like gcc 4.x"
4291aff381fSbellard        echo "QEMU is known to have problems when compiled with gcc 4.x"
4301aff381fSbellard        echo "It is recommended that you use gcc 3.x to build QEMU"
4311aff381fSbellard        echo "To use this compiler anyway, configure with --disable-gcc-check"
4321aff381fSbellard        exit 1;
4331aff381fSbellard    fi
4341aff381fSbellardfi
4351aff381fSbellard
43611d9f695Sbellard##########################################
43711d9f695Sbellard# SDL probe
43811d9f695Sbellard
43911d9f695Sbellardsdl_too_old=no
44011d9f695Sbellard
44111d9f695Sbellardif test -z "$sdl" ; then
44211d9f695Sbellard
443a6e022adSbellardsdl_config="sdl-config"
444a6e022adSbellardsdl=no
4457c1f25b4Sbellardsdl_static=no
446a6e022adSbellard
447a6e022adSbellardif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
448a6e022adSbellard# win32 cross compilation case
449a6e022adSbellard    sdl_config="i386-mingw32msvc-sdl-config"
450a6e022adSbellard    sdl=yes
451a6e022adSbellardelse
452a6e022adSbellard# normal SDL probe
45311d9f695Sbellardcat > $TMPC << EOF
45411d9f695Sbellard#include <SDL.h>
45511d9f695Sbellard#undef main /* We don't want SDL to override our main() */
45611d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
45711d9f695SbellardEOF
45811d9f695Sbellard
459a6e022adSbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
460a6e022adSbellard_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
46111d9f695Sbellardif test "$_sdlversion" -lt 121 ; then
46211d9f695Sbellardsdl_too_old=yes
46311d9f695Sbellardelse
46411d9f695Sbellardsdl=yes
46511d9f695Sbellardfi
4667c1f25b4Sbellard
4677c1f25b4Sbellard# static link with sdl ?
4687c1f25b4Sbellardif test "$sdl" = "yes" ; then
4697c1f25b4Sbellardaa="no"
4707c1f25b4Sbellard`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
4717c1f25b4Sbellardsdl_static_libs=`$sdl_config --static-libs`
4727c1f25b4Sbellardif [ "$aa" = "yes" ] ; then
473d8d8aa4eSbellard  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
47411d9f695Sbellardfi
47511d9f695Sbellard
4767c1f25b4Sbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
4777c1f25b4Sbellard  sdl_static=yes
4787c1f25b4Sbellardfi
4797c1f25b4Sbellard
4807c1f25b4Sbellardfi # static link
4817c1f25b4Sbellard
4827c1f25b4Sbellardfi # sdl compile test
4837c1f25b4Sbellard
484a6e022adSbellardfi # cross compilation
485a6e022adSbellardfi # -z $sdl
48611d9f695Sbellard
487cc8ae6deSpbrook# Check if tools are available to build documentation.
48894ac5158Spbrookif [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
489cc8ae6deSpbrook  build_docs="yes"
490cc8ae6deSpbrookfi
491cc8ae6deSpbrook
49211d9f695Sbellardif test "$mingw32" = "yes" ; then
49311d9f695Sbellardif test -z "$prefix" ; then
49411d9f695Sbellard    prefix="/c/Program Files/Qemu"
49511d9f695Sbellardfi
49611d9f695Sbellardmandir="$prefix"
4977efa4387Sbellarddatadir="$prefix"
4981f50f8d1Sbellarddocdir="$prefix"
49911d9f695Sbellardbindir="$prefix"
50011d9f695Sbellardelse
50111d9f695Sbellardif test -z "$prefix" ; then
50211d9f695Sbellard    prefix="/usr/local"
50311d9f695Sbellardfi
5045a67135aSbellardmandir="$prefix/share/man"
5057efa4387Sbellarddatadir="$prefix/share/qemu"
5061f50f8d1Sbellarddocdir="$prefix/share/doc/qemu"
50711d9f695Sbellardbindir="$prefix/bin"
50811d9f695Sbellardfi
5095a67135aSbellard
5107d13299dSbellardecho "Install prefix    $prefix"
5117efa4387Sbellardecho "BIOS directory    $datadir"
51211d9f695Sbellardecho "binary directory  $bindir"
51311d9f695Sbellardif test "$mingw32" = "no" ; then
51411d9f695Sbellardecho "Manual directory  $mandir"
51543ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
51611d9f695Sbellardfi
5175a67135aSbellardecho "Source path       $source_path"
5187d13299dSbellardecho "C compiler        $cc"
51983469015Sbellardecho "Host C compiler   $host_cc"
5207d13299dSbellardecho "make              $make"
5216a882643Spbrookecho "install           $install"
522a98fd896Sbellardecho "host CPU          $cpu"
523de83cd02Sbellardecho "host big endian   $bigendian"
52497a847bcSbellardecho "target list       $target_list"
5257d13299dSbellardecho "gprof enabled     $gprof"
52605c2a3e7Sbellardecho "profiler          $profiler"
52743ce4dfeSbellardecho "static build      $static"
5285b0753e0Sbellardif test "$darwin" = "yes" ; then
5295b0753e0Sbellard    echo "Cocoa support     $cocoa"
5305b0753e0Sbellardfi
53197a847bcSbellardecho "SDL support       $sdl"
532e4afee97Sbellardif test "$sdl" != "no" ; then
5337c1f25b4Sbellard    echo "SDL static link   $sdl_static"
534e4afee97Sbellardfi
53567b915a5Sbellardecho "mingw32 support   $mingw32"
536fb065187Sbellardecho "Adlib support     $adlib"
5371d14ffa9Sbellardecho "CoreAudio support $coreaudio"
5381d14ffa9Sbellardecho "ALSA support      $alsa"
5391d14ffa9Sbellardecho "DSound support    $dsound"
5401d14ffa9Sbellardif test "$fmod" = "yes"; then
5411d14ffa9Sbellard    if test -z $fmod_lib || test -z $fmod_inc; then
5421d14ffa9Sbellard        echo
5431d14ffa9Sbellard        echo "Error: You must specify path to FMOD library and headers"
5441d14ffa9Sbellard        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
5451d14ffa9Sbellard        echo
5461d14ffa9Sbellard        exit 1
5471d14ffa9Sbellard    fi
548b1a550a0Spbrook    fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
549b1a550a0Spbrookelse
550b1a550a0Spbrook    fmod_support=""
551102a52e4Sbellardfi
552b1a550a0Spbrookecho "FMOD support      $fmod $fmod_support"
55307f4ddbfSbellardecho "kqemu support     $kqemu"
554cc8ae6deSpbrookecho "Documentation     $build_docs"
555c5937220Spbrook[ ! -z "$uname_release" ] && \
556c5937220Spbrookecho "uname -r          $uname_release"
55767b915a5Sbellard
55897a847bcSbellardif test $sdl_too_old = "yes"; then
55924b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
560e8cd23deSbellardfi
56124b55b96Sbellard#if test "$sdl_static" = "no"; then
56224b55b96Sbellard#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
56324b55b96Sbellard#fi
56497a847bcSbellardconfig_mak="config-host.mak"
56597a847bcSbellardconfig_h="config-host.h"
56697a847bcSbellard
5677c1f25b4Sbellard#echo "Creating $config_mak and $config_h"
56897a847bcSbellard
56997a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
57029517134Spbrookecho "# Configured with: $0 $@" >> $config_mak
57197a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
57297a847bcSbellard
57397a847bcSbellardecho "prefix=$prefix" >> $config_mak
57411d9f695Sbellardecho "bindir=$bindir" >> $config_mak
5755a67135aSbellardecho "mandir=$mandir" >> $config_mak
5767efa4387Sbellardecho "datadir=$datadir" >> $config_mak
5771f50f8d1Sbellardecho "docdir=$docdir" >> $config_mak
5787efa4387Sbellardecho "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
57997a847bcSbellardecho "MAKE=$make" >> $config_mak
5806a882643Spbrookecho "INSTALL=$install" >> $config_mak
58197a847bcSbellardecho "CC=$cc" >> $config_mak
58297a847bcSbellardif test "$have_gcc3_options" = "yes" ; then
58397a847bcSbellard  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
58497a847bcSbellardfi
58597a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak
58697a847bcSbellardecho "AR=$ar" >> $config_mak
58797a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak
58897a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak
58997a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak
59067b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak
59197a847bcSbellardif test "$cpu" = "i386" ; then
59297a847bcSbellard  echo "ARCH=i386" >> $config_mak
59397a847bcSbellard  echo "#define HOST_I386 1" >> $config_h
5940b0babc6Sbellardelif test "$cpu" = "x86_64" ; then
5950b0babc6Sbellard  echo "ARCH=x86_64" >> $config_mak
5960b0babc6Sbellard  echo "#define HOST_X86_64 1" >> $config_h
597808c4954Sbellardelif test "$cpu" = "armv4b" ; then
598808c4954Sbellard  echo "ARCH=arm" >> $config_mak
599808c4954Sbellard  echo "#define HOST_ARM 1" >> $config_h
6007d13299dSbellardelif test "$cpu" = "armv4l" ; then
60197a847bcSbellard  echo "ARCH=arm" >> $config_mak
60297a847bcSbellard  echo "#define HOST_ARM 1" >> $config_h
6037d13299dSbellardelif test "$cpu" = "powerpc" ; then
60497a847bcSbellard  echo "ARCH=ppc" >> $config_mak
60597a847bcSbellard  echo "#define HOST_PPC 1" >> $config_h
6067d13299dSbellardelif test "$cpu" = "mips" ; then
60797a847bcSbellard  echo "ARCH=mips" >> $config_mak
60897a847bcSbellard  echo "#define HOST_MIPS 1" >> $config_h
609fb3e5849Sbellardelif test "$cpu" = "s390" ; then
61097a847bcSbellard  echo "ARCH=s390" >> $config_mak
61197a847bcSbellard  echo "#define HOST_S390 1" >> $config_h
612295defa5Sbellardelif test "$cpu" = "alpha" ; then
61397a847bcSbellard  echo "ARCH=alpha" >> $config_mak
61497a847bcSbellard  echo "#define HOST_ALPHA 1" >> $config_h
615ae228531Sbellardelif test "$cpu" = "sparc" ; then
61697a847bcSbellard  echo "ARCH=sparc" >> $config_mak
61797a847bcSbellard  echo "#define HOST_SPARC 1" >> $config_h
618ae228531Sbellardelif test "$cpu" = "sparc64" ; then
61997a847bcSbellard  echo "ARCH=sparc64" >> $config_mak
62097a847bcSbellard  echo "#define HOST_SPARC64 1" >> $config_h
621a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then
62297a847bcSbellard  echo "ARCH=ia64" >> $config_mak
62397a847bcSbellard  echo "#define HOST_IA64 1" >> $config_h
62438e584a0Sbellardelif test "$cpu" = "m68k" ; then
62538ca2abcSbellard  echo "ARCH=m68k" >> $config_mak
62638ca2abcSbellard  echo "#define HOST_M68K 1" >> $config_h
6277d13299dSbellardelse
6287d13299dSbellard  echo "Unsupported CPU"
6297d13299dSbellard  exit 1
6307d13299dSbellardfi
6317d13299dSbellardif test "$bigendian" = "yes" ; then
63297a847bcSbellard  echo "WORDS_BIGENDIAN=yes" >> $config_mak
63397a847bcSbellard  echo "#define WORDS_BIGENDIAN 1" >> $config_h
63497a847bcSbellardfi
635b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h
63667b915a5Sbellardif test "$mingw32" = "yes" ; then
63767b915a5Sbellard  echo "CONFIG_WIN32=yes" >> $config_mak
63811d9f695Sbellard  echo "#define CONFIG_WIN32 1" >> $config_h
6397d3505c5Sbellardelif test -f "/usr/include/byteswap.h" ; then
64097a847bcSbellard  echo "#define HAVE_BYTESWAP_H 1" >> $config_h
64167b915a5Sbellardfi
64283fb7adfSbellardif test "$darwin" = "yes" ; then
64383fb7adfSbellard  echo "CONFIG_DARWIN=yes" >> $config_mak
64483fb7adfSbellard  echo "#define CONFIG_DARWIN 1" >> $config_h
64583fb7adfSbellardfi
646ec530c81Sbellardif test "$solaris" = "yes" ; then
647ec530c81Sbellard  echo "CONFIG_SOLARIS=yes" >> $config_mak
64838cfa06cSbellard  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
649ec530c81Sbellardfi
65067b915a5Sbellardif test "$gdbstub" = "yes" ; then
65167b915a5Sbellard  echo "CONFIG_GDBSTUB=yes" >> $config_mak
65267b915a5Sbellard  echo "#define CONFIG_GDBSTUB 1" >> $config_h
65367b915a5Sbellardfi
65497a847bcSbellardif test "$gprof" = "yes" ; then
65597a847bcSbellard  echo "TARGET_GPROF=yes" >> $config_mak
65697a847bcSbellard  echo "#define HAVE_GPROF 1" >> $config_h
65797a847bcSbellardfi
65897a847bcSbellardif test "$static" = "yes" ; then
65997a847bcSbellard  echo "CONFIG_STATIC=yes" >> $config_mak
66050863472Sbellard  echo "#define CONFIG_STATIC 1" >> $config_h
66197a847bcSbellardfi
66205c2a3e7Sbellardif test $profiler = "yes" ; then
66305c2a3e7Sbellard  echo "#define CONFIG_PROFILER 1" >> $config_h
66405c2a3e7Sbellardfi
665c20709aaSbellardif test "$slirp" = "yes" ; then
666c20709aaSbellard  echo "CONFIG_SLIRP=yes" >> $config_mak
667c20709aaSbellard  echo "#define CONFIG_SLIRP 1" >> $config_h
668c20709aaSbellardfi
669fb065187Sbellardif test "$adlib" = "yes" ; then
670fb065187Sbellard  echo "CONFIG_ADLIB=yes" >> $config_mak
671fb065187Sbellard  echo "#define CONFIG_ADLIB 1" >> $config_h
672fb065187Sbellardfi
673fb065187Sbellardif test "$oss" = "yes" ; then
674fb065187Sbellard  echo "CONFIG_OSS=yes" >> $config_mak
675fb065187Sbellard  echo "#define CONFIG_OSS 1" >> $config_h
676fb065187Sbellardfi
6771d14ffa9Sbellardif test "$coreaudio" = "yes" ; then
6781d14ffa9Sbellard  echo "CONFIG_COREAUDIO=yes" >> $config_mak
6791d14ffa9Sbellard  echo "#define CONFIG_COREAUDIO 1" >> $config_h
6801d14ffa9Sbellardfi
6811d14ffa9Sbellardif test "$alsa" = "yes" ; then
6821d14ffa9Sbellard  echo "CONFIG_ALSA=yes" >> $config_mak
6831d14ffa9Sbellard  echo "#define CONFIG_ALSA 1" >> $config_h
6841d14ffa9Sbellardfi
6851d14ffa9Sbellardif test "$dsound" = "yes" ; then
6861d14ffa9Sbellard  echo "CONFIG_DSOUND=yes" >> $config_mak
6871d14ffa9Sbellard  echo "#define CONFIG_DSOUND 1" >> $config_h
6881d14ffa9Sbellardfi
689102a52e4Sbellardif test "$fmod" = "yes" ; then
690102a52e4Sbellard  echo "CONFIG_FMOD=yes" >> $config_mak
691102a52e4Sbellard  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
692102a52e4Sbellard  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
693102a52e4Sbellard  echo "#define CONFIG_FMOD 1" >> $config_h
694102a52e4Sbellardfi
695b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
696b1a550a0Spbrookecho "VERSION=$qemu_version" >>$config_mak
697d4b8f039Spbrookecho "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
69897a847bcSbellard
69997a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak
700ad064840Spbrookif [ "$source_path_used" = "yes" ]; then
701ad064840Spbrook  echo "VPATH=$source_path" >> $config_mak
702ad064840Spbrookfi
70397a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak
704cc8ae6deSpbrookif [ "$build_docs" = "yes" ] ; then
705cc8ae6deSpbrook  echo "BUILD_DOCS=yes" >> $config_mak
706cc8ae6deSpbrookfi
70797a847bcSbellard
70883fb7adfSbellard# XXX: suppress that
7097d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
71043003046Sbellard  echo "#define O_LARGEFILE 0" >> $config_h
71143003046Sbellard  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
7127d3505c5Sbellard  echo "#define _BSD 1" >> $config_h
7137d3505c5Sbellardfi
7147d3505c5Sbellard
715c5937220Spbrookecho "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
716c5937220Spbrook
71797a847bcSbellardfor target in $target_list; do
71897a847bcSbellardtarget_dir="$target"
71997a847bcSbellardconfig_mak=$target_dir/config.mak
72097a847bcSbellardconfig_h=$target_dir/config.h
72197a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1`
72297a847bcSbellardtarget_bigendian="no"
723808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes
7241e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes
72564b3ab24Sbellard[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
72667867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes
727a2458627Sbellard[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
728d3258560Sbellard[ "$target_cpu" = "mips" ] && target_bigendian=yes
729908f52b0Spbrook[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
730*e6e5906bSpbrook[ "$target_cpu" = "m68k" ] && target_bigendian=yes
73197a847bcSbellardtarget_softmmu="no"
73297a847bcSbellardif expr $target : '.*-softmmu' > /dev/null ; then
73397a847bcSbellard  target_softmmu="yes"
7347d13299dSbellardfi
735997344f3Sbellardtarget_user_only="no"
736997344f3Sbellardif expr $target : '.*-user' > /dev/null ; then
737997344f3Sbellard  target_user_only="yes"
738997344f3Sbellardfi
739de83cd02Sbellard
74097ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
74197ccc689Sbellard        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
74297ccc689Sbellard    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
7439c038506Spbrook    echo "To build QEMU without graphical output configure with --disable-gfx-check"
74497ccc689Sbellard    echo "Note that this will disable all output from the virtual graphics card."
74597ccc689Sbellard    exit 1;
74697ccc689Sbellardfi
74797ccc689Sbellard
7487c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
74997a847bcSbellard
75097a847bcSbellardmkdir -p $target_dir
751158142c2Sbellardmkdir -p $target_dir/fpu
752808c4954Sbellardif test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
75369de927cSbellard  mkdir -p $target_dir/nwfpe
75469de927cSbellardfi
755a7e61ed4Sbellardif test "$target_user_only" = "no" ; then
756a7e61ed4Sbellard  mkdir -p $target_dir/slirp
757a7e61ed4Sbellardfi
75869de927cSbellard
759ec530c81Sbellard#
760ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link
761ec530c81Sbellard#
762ec530c81Sbellardrm -f $target_dir/Makefile
763ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile
764ec530c81Sbellard
76597a847bcSbellard
76697a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
76797a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
76897a847bcSbellard
76997a847bcSbellard
77097a847bcSbellardecho "include ../config-host.mak" >> $config_mak
77197a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h
7721e43adfcSbellard
773e5fe0c52Spbrookbflt="no"
7741e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
7751e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
77697a847bcSbellard
77797a847bcSbellardif test "$target_cpu" = "i386" ; then
77897a847bcSbellard  echo "TARGET_ARCH=i386" >> $config_mak
77997a847bcSbellard  echo "#define TARGET_ARCH \"i386\"" >> $config_h
78097a847bcSbellard  echo "#define TARGET_I386 1" >> $config_h
78107f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
782824d560fSbellard    echo "#define USE_KQEMU 1" >> $config_h
783824d560fSbellard  fi
784808c4954Sbellardelif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
78597a847bcSbellard  echo "TARGET_ARCH=arm" >> $config_mak
78697a847bcSbellard  echo "#define TARGET_ARCH \"arm\"" >> $config_h
78797a847bcSbellard  echo "#define TARGET_ARM 1" >> $config_h
788e5fe0c52Spbrook  bflt="yes"
7891e43adfcSbellardelif test "$target_cpu" = "sparc" ; then
7901e43adfcSbellard  echo "TARGET_ARCH=sparc" >> $config_mak
7911e43adfcSbellard  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
7921e43adfcSbellard  echo "#define TARGET_SPARC 1" >> $config_h
79364b3ab24Sbellardelif test "$target_cpu" = "sparc64" ; then
79464b3ab24Sbellard  echo "TARGET_ARCH=sparc64" >> $config_mak
79564b3ab24Sbellard  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
79664b3ab24Sbellard  echo "#define TARGET_SPARC 1" >> $config_h
79764b3ab24Sbellard  echo "#define TARGET_SPARC64 1" >> $config_h
79867867308Sbellardelif test "$target_cpu" = "ppc" ; then
79967867308Sbellard  echo "TARGET_ARCH=ppc" >> $config_mak
80067867308Sbellard  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
80167867308Sbellard  echo "#define TARGET_PPC 1" >> $config_h
802a2458627Sbellardelif test "$target_cpu" = "ppc64" ; then
803a2458627Sbellard  echo "TARGET_ARCH=ppc64" >> $config_mak
804a2458627Sbellard  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
805a2458627Sbellard  echo "#define TARGET_PPC 1" >> $config_h
806a2458627Sbellard  echo "#define TARGET_PPC64 1" >> $config_h
8070b0babc6Sbellardelif test "$target_cpu" = "x86_64" ; then
8080b0babc6Sbellard  echo "TARGET_ARCH=x86_64" >> $config_mak
8090b0babc6Sbellard  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
8100b0babc6Sbellard  echo "#define TARGET_I386 1" >> $config_h
8110b0babc6Sbellard  echo "#define TARGET_X86_64 1" >> $config_h
81207f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
81307f4ddbfSbellard    echo "#define USE_KQEMU 1" >> $config_h
81407f4ddbfSbellard  fi
815c20eb473Sbellardelif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
816d3258560Sbellard  echo "TARGET_ARCH=mips" >> $config_mak
817d3258560Sbellard  echo "#define TARGET_ARCH \"mips\"" >> $config_h
818d3258560Sbellard  echo "#define TARGET_MIPS 1" >> $config_h
8196ea83fedSbellard  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
8206ea83fedSbellard  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
821908f52b0Spbrookelif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
822fdf9b3e8Sbellard  echo "TARGET_ARCH=sh4" >> $config_mak
823fdf9b3e8Sbellard  echo "#define TARGET_ARCH \"sh4\"" >> $config_h
824fdf9b3e8Sbellard  echo "#define TARGET_SH4 1" >> $config_h
8254dbed897Spbrook  bflt="yes"
826*e6e5906bSpbrookelif test "$target_cpu" = "m68k" ; then
827*e6e5906bSpbrook  echo "TARGET_ARCH=m68k" >> $config_mak
828*e6e5906bSpbrook  echo "#define TARGET_ARCH \"m68k\"" >> $config_h
829*e6e5906bSpbrook  echo "#define TARGET_M68K 1" >> $config_h
830*e6e5906bSpbrook  bflt="yes"
831de83cd02Sbellardelse
832de83cd02Sbellard  echo "Unsupported target CPU"
833de83cd02Sbellard  exit 1
834de83cd02Sbellardfi
835de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
83697a847bcSbellard  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
83797a847bcSbellard  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
83897a847bcSbellardfi
83997a847bcSbellardif test "$target_softmmu" = "yes" ; then
84097a847bcSbellard  echo "CONFIG_SOFTMMU=yes" >> $config_mak
84197a847bcSbellard  echo "#define CONFIG_SOFTMMU 1" >> $config_h
842de83cd02Sbellardfi
843997344f3Sbellardif test "$target_user_only" = "yes" ; then
844997344f3Sbellard  echo "CONFIG_USER_ONLY=yes" >> $config_mak
845997344f3Sbellard  echo "#define CONFIG_USER_ONLY 1" >> $config_h
846997344f3Sbellardfi
847de83cd02Sbellard
848*e6e5906bSpbrookif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
849158142c2Sbellard  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
850158142c2Sbellard  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
851158142c2Sbellardfi
852e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
853e5fe0c52Spbrook  echo "TARGET_HAS_BFLT=yes" >> $config_mak
854e5fe0c52Spbrook  echo "#define TARGET_HAS_BFLT 1" >> $config_h
855e5fe0c52Spbrookfi
8567c1f25b4Sbellard# sdl defines
8577c1f25b4Sbellard
8587c1f25b4Sbellardif test "$target_user_only" = "no"; then
8597c1f25b4Sbellard    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
860dbb2c921Sbellard        sdl1=$sdl_static
8617c1f25b4Sbellard    else
862dbb2c921Sbellard        sdl1=$sdl
863dbb2c921Sbellard    fi
864dbb2c921Sbellard    if test "$sdl1" = "yes" ; then
8657c1f25b4Sbellard        echo "#define CONFIG_SDL 1" >> $config_h
8667c1f25b4Sbellard        echo "CONFIG_SDL=yes" >> $config_mak
867dbb2c921Sbellard        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
868dbb2c921Sbellard            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
869dbb2c921Sbellard        else
8707c1f25b4Sbellard            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
8717c1f25b4Sbellard        fi
8727c1f25b4Sbellard        if [ "${aa}" = "yes" ] ; then
873b1a550a0Spbrook            echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
874b1a550a0Spbrook        else
875b1a550a0Spbrook            echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
8767c1f25b4Sbellard        fi
8777c1f25b4Sbellard    fi
878dbb2c921Sbellardfi
8797c1f25b4Sbellard
8805b0753e0Sbellardif test "$cocoa" = "yes" ; then
8815b0753e0Sbellard    echo "#define CONFIG_COCOA 1" >> $config_h
8825b0753e0Sbellard    echo "CONFIG_COCOA=yes" >> $config_mak
8835b0753e0Sbellardfi
8845b0753e0Sbellard
88597a847bcSbellarddone # for target in $targets
8867d13299dSbellard
8877d13299dSbellard# build tree in object directory if source path is different from current one
8887d13299dSbellardif test "$source_path_used" = "yes" ; then
8897d13299dSbellard    DIRS="tests"
8907d13299dSbellard    FILES="Makefile tests/Makefile"
8917d13299dSbellard    for dir in $DIRS ; do
8927d13299dSbellard            mkdir -p $dir
8937d13299dSbellard    done
894ec530c81Sbellard    # remove the link and recreate it, as not all "ln -sf" overwrite the link
8957d13299dSbellard    for f in $FILES ; do
896ec530c81Sbellard        rm -f $f
897ec530c81Sbellard        ln -s $source_path/$f $f
8987d13299dSbellard    done
8997d13299dSbellardfi
9007d13299dSbellard
90197a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS
902