xref: /openbmc/qemu/configure (revision 6ea83fed)
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"
91c9ec1fe4Sbellardkernel_path=""
925b0753e0Sbellardcocoa="no"
9397ccc689Sbellardcheck_gfx="yes"
941aff381fSbellardcheck_gcc="yes"
950a8e90f4Spbrooksoftmmu="yes"
960a8e90f4Spbrookuser="no"
97cc8ae6deSpbrookbuild_docs="no"
98c5937220Spbrookuname_release=""
997d13299dSbellard
1007d13299dSbellard# OS specific
1017d13299dSbellardtargetos=`uname -s`
1027d13299dSbellardcase $targetos in
103c326e0afSbellardCYGWIN*)
104c326e0afSbellardmingw32="yes"
105c326e0afSbellardCFLAGS="-O2 -mno-cygwin"
106c326e0afSbellard;;
10767b915a5SbellardMINGW32*)
10867b915a5Sbellardmingw32="yes"
10967b915a5Sbellard;;
1107d3505c5SbellardFreeBSD)
1117d3505c5Sbellardbsd="yes"
112fb065187Sbellardoss="yes"
113e99f9060Sbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
11407f4ddbfSbellard    kqemu="yes"
11507f4ddbfSbellardfi
1167d3505c5Sbellard;;
1177d3505c5SbellardNetBSD)
1187d3505c5Sbellardbsd="yes"
119fb065187Sbellardoss="yes"
1207d3505c5Sbellard;;
1217d3505c5SbellardOpenBSD)
1227d3505c5Sbellardbsd="yes"
123fb065187Sbellardoss="yes"
1247d3505c5Sbellard;;
12583fb7adfSbellardDarwin)
12683fb7adfSbellardbsd="yes"
12783fb7adfSbellarddarwin="yes"
12883fb7adfSbellard;;
129ec530c81SbellardSunOS)
130ec530c81Sbellardsolaris="yes"
131ec530c81Sbellard;;
132fb065187Sbellard*)
133fb065187Sbellardoss="yes"
1345327cf48Sbellardlinux="yes"
1350a8e90f4Spbrookuser="yes"
13607f4ddbfSbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
137c9ec1fe4Sbellard    kqemu="yes"
138c9ec1fe4Sbellardfi
139fb065187Sbellard;;
1407d13299dSbellardesac
1417d13299dSbellard
1427d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
143b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
1447d3505c5Sbellard    make="gmake"
14583fb7adfSbellard  fi
1467d3505c5Sbellardfi
1477d3505c5Sbellard
148ec530c81Sbellardif [ "$solaris" = "yes" ] ; then
149ec530c81Sbellard    make="gmake"
150ec530c81Sbellard    install="ginstall"
151ec530c81Sbellard    solarisrev=`uname -r | cut -f2 -d.`
152ec530c81Sbellardfi
153ec530c81Sbellard
1547d13299dSbellard# find source path
155ad064840Spbrooksource_path=`dirname "$0"`
156ad064840Spbrookif [ -z "$source_path" ]; then
1577d13299dSbellard    source_path=`pwd`
158ad064840Spbrookelse
159ad064840Spbrook    source_path=`cd "$source_path"; pwd`
160ad064840Spbrookfi
161ad064840Spbrookif test "$source_path" = `pwd` ; then
1627d13299dSbellard    source_path_used="no"
163ad064840Spbrookelse
164ad064840Spbrook    source_path_used="yes"
1657d13299dSbellardfi
1667d13299dSbellard
1677d13299dSbellardfor opt do
168a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
1697d13299dSbellard  case "$opt" in
1702efc3265Sbellard  --help|-h) show_help=yes
1712efc3265Sbellard  ;;
172b1a550a0Spbrook  --prefix=*) prefix="$optarg"
1737d13299dSbellard  ;;
174b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
17532ce6337Sbellard  ;;
176b1a550a0Spbrook  --source-path=*) source_path="$optarg"
177ad064840Spbrook  source_path_used="yes"
1787d13299dSbellard  ;;
179b1a550a0Spbrook  --cross-prefix=*) cross_prefix="$optarg"
1807d13299dSbellard  ;;
181b1a550a0Spbrook  --cc=*) cc="$optarg"
1827d13299dSbellard  ;;
183b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
18483469015Sbellard  ;;
185b1a550a0Spbrook  --make=*) make="$optarg"
1867d13299dSbellard  ;;
1876a882643Spbrook  --install=*) install="$optarg"
1886a882643Spbrook  ;;
189b1a550a0Spbrook  --extra-cflags=*) CFLAGS="$optarg"
1907d13299dSbellard  ;;
191b1a550a0Spbrook  --extra-ldflags=*) LDFLAGS="$optarg"
1927d13299dSbellard  ;;
193b1a550a0Spbrook  --cpu=*) cpu="$optarg"
1947d13299dSbellard  ;;
195b1a550a0Spbrook  --target-list=*) target_list="$optarg"
196de83cd02Sbellard  ;;
1977d13299dSbellard  --enable-gprof) gprof="yes"
1987d13299dSbellard  ;;
19943ce4dfeSbellard  --static) static="yes"
20043ce4dfeSbellard  ;;
20197a847bcSbellard  --disable-sdl) sdl="no"
20297a847bcSbellard  ;;
2031d14ffa9Sbellard  --enable-coreaudio) coreaudio="yes"
2041d14ffa9Sbellard  ;;
2051d14ffa9Sbellard  --enable-alsa) alsa="yes"
2061d14ffa9Sbellard  ;;
2071d14ffa9Sbellard  --enable-dsound) dsound="yes"
2081d14ffa9Sbellard  ;;
209102a52e4Sbellard  --enable-fmod) fmod="yes"
210102a52e4Sbellard  ;;
211b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
212102a52e4Sbellard  ;;
213b1a550a0Spbrook  --fmod-inc=*) fmod_inc="$optarg"
214102a52e4Sbellard  ;;
21567b915a5Sbellard  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
21667b915a5Sbellard  ;;
217443f1376Sbellard  --disable-slirp) slirp="no"
218c20709aaSbellard  ;;
219fb065187Sbellard  --enable-adlib) adlib="yes"
220fb065187Sbellard  ;;
221c9ec1fe4Sbellard  --disable-kqemu) kqemu="no"
222c9ec1fe4Sbellard  ;;
22305c2a3e7Sbellard  --enable-profiler) profiler="yes"
22405c2a3e7Sbellard  ;;
225b1a550a0Spbrook  --kernel-path=*) kernel_path="$optarg"
226c9ec1fe4Sbellard  ;;
2271d14ffa9Sbellard  --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
2285b0753e0Sbellard  ;;
22997ccc689Sbellard  --disable-gfx-check) check_gfx="no"
23097ccc689Sbellard  ;;
2311aff381fSbellard  --disable-gcc-check) check_gcc="no"
2321aff381fSbellard  ;;
233cad25d69Spbrook  --disable-system) softmmu="no"
2340a8e90f4Spbrook  ;;
235cad25d69Spbrook  --enable-system) softmmu="yes"
2360a8e90f4Spbrook  ;;
2370a8e90f4Spbrook  --disable-user) user="no"
2380a8e90f4Spbrook  ;;
2390a8e90f4Spbrook  --enable-user) user="yes"
2400a8e90f4Spbrook  ;;
241c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
242c5937220Spbrook  ;;
2437d13299dSbellard  esac
2447d13299dSbellarddone
2457d13299dSbellard
2467d13299dSbellard# Checking for CFLAGS
2477d13299dSbellardif test -z "$CFLAGS"; then
2487d13299dSbellard    CFLAGS="-O2"
2497d13299dSbellardfi
2507d13299dSbellard
251af5db58eSpbrookif test x"$show_help" = x"yes" ; then
252af5db58eSpbrookcat << EOF
253af5db58eSpbrook
254af5db58eSpbrookUsage: configure [options]
255af5db58eSpbrookOptions: [defaults in brackets after descriptions]
256af5db58eSpbrook
257af5db58eSpbrookEOF
258af5db58eSpbrookecho "Standard options:"
259af5db58eSpbrookecho "  --help                   print this message"
260af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
261af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
262af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
263af5db58eSpbrookecho "  --target-list=LIST       set target list [$target_list]"
264af5db58eSpbrookecho ""
265af5db58eSpbrookecho "kqemu kernel acceleration support:"
266af5db58eSpbrookecho "  --disable-kqemu          disable kqemu support"
267af5db58eSpbrookecho "  --kernel-path=PATH       set the kernel path (configure probes it)"
268af5db58eSpbrookecho ""
269af5db58eSpbrookecho "Advanced options (experts only):"
270af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
271af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
272af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
273af5db58eSpbrookecho "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
274af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
2756a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
276af5db58eSpbrookecho "  --static                 enable static build [$static]"
277af5db58eSpbrookecho "  --enable-cocoa           enable COCOA (Mac OS X only)"
278af5db58eSpbrookecho "  --enable-mingw32         enable Win32 cross compilation with mingw32"
279af5db58eSpbrookecho "  --enable-adlib           enable Adlib emulation"
280af5db58eSpbrookecho "  --enable-coreaudio       enable Coreaudio audio driver"
281af5db58eSpbrookecho "  --enable-alsa            enable ALSA audio driver"
282af5db58eSpbrookecho "  --enable-fmod            enable FMOD audio driver"
283af5db58eSpbrookecho "  --enabled-dsound         enable DirectSound audio driver"
284af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
285af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
286af5db58eSpbrookecho "  --enable-user            enable all linux usermode emulation targets"
287af5db58eSpbrookecho "  --disable-user           disable all linux usermode emulation targets"
288af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
289af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
290c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
291af5db58eSpbrookecho ""
292af5db58eSpbrookecho "NOTE: The object files are build at the place where configure is launched"
293af5db58eSpbrookexit 1
294af5db58eSpbrookfi
295af5db58eSpbrook
2967d13299dSbellardcc="${cross_prefix}${cc}"
2977d13299dSbellardar="${cross_prefix}${ar}"
2987d13299dSbellardstrip="${cross_prefix}${strip}"
2997d13299dSbellard
300064aae13Spbrook# check that the C compiler works.
301064aae13Spbrookcat > $TMPC <<EOF
302064aae13Spbrookint main(void) {}
303064aae13SpbrookEOF
304064aae13Spbrook
305064aae13Spbrookif $cc -c -o $TMPO $TMPC 2>/dev/null ; then
306064aae13Spbrook  : C compiler works ok
307064aae13Spbrookelse
308064aae13Spbrook    echo "ERROR: \"$cc\" either does not exist or does not work"
309064aae13Spbrook    exit 1
310a7350fa1Sbellardfi
311a7350fa1Sbellard
31267b915a5Sbellardif test "$mingw32" = "yes" ; then
3135327cf48Sbellard    linux="no"
31467b915a5Sbellard    EXESUF=".exe"
31567b915a5Sbellard    gdbstub="no"
3169f059ecaSbellard    oss="no"
31707f4ddbfSbellard    if [ "$cpu" = "i386" ] ; then
31807f4ddbfSbellard        kqemu="yes"
31907f4ddbfSbellard    fi
32067b915a5Sbellardfi
32167b915a5Sbellard
322ec530c81Sbellard#
323ec530c81Sbellard# Solaris specific configure tool chain decisions
324ec530c81Sbellard#
325ec530c81Sbellardif test "$solaris" = "yes" ; then
326ec530c81Sbellard  #
327ec530c81Sbellard  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
328ec530c81Sbellard  # override the check with --disable-gcc-check
329ec530c81Sbellard  #
330ec530c81Sbellard  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
331ec530c81Sbellard    solgcc=`which $cc`
332ec530c81Sbellard    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
333ec530c81Sbellard      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
334ec530c81Sbellard      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
335ec530c81Sbellard      echo "or get the latest patch from SunSolve for gcc"
336ec530c81Sbellard      exit 1
337ec530c81Sbellard    fi
338ec530c81Sbellard  fi
339ec530c81Sbellard  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
340ec530c81Sbellard  if test -z "$solinst" ; then
341ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
342ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
343ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
344ec530c81Sbellard    exit 1
345ec530c81Sbellard  fi
346ec530c81Sbellard  if test "$solinst" = "/usr/sbin/install" ; then
347ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
348ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
349ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
350ec530c81Sbellard    exit 1
351ec530c81Sbellard  fi
352ec530c81Sbellard  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
353ec530c81Sbellard  if test -z "$sol_ar" ; then
354ec530c81Sbellard    echo "Error: No path includes ar"
355ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
356ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
357ec530c81Sbellard    fi
358ec530c81Sbellard    exit 1
359ec530c81Sbellard  fi
360ec530c81Sbellardfi
361ec530c81Sbellard
362ec530c81Sbellard
3635327cf48Sbellardif test -z "$target_list" ; then
3645327cf48Sbellard# these targets are portable
3650a8e90f4Spbrook    if [ "$softmmu" = "yes" ] ; then
36638260998Spbrook        target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
3670a8e90f4Spbrook    fi
3685327cf48Sbellard# the following are Linux specific
3690a8e90f4Spbrook    if [ "$user" = "yes" ] ; then
370215cf0beSbellard        target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
3715327cf48Sbellard    fi
3726e20a45fSbellardelse
373b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
3745327cf48Sbellardfi
3750a8e90f4Spbrookif test -z "$target_list" ; then
3760a8e90f4Spbrook    echo "No targets enabled"
3770a8e90f4Spbrook    exit 1
3780a8e90f4Spbrookfi
3795327cf48Sbellard
3807d13299dSbellardif test -z "$cross_prefix" ; then
3817d13299dSbellard
3827d13299dSbellard# ---
3837d13299dSbellard# big/little endian test
3847d13299dSbellardcat > $TMPC << EOF
3857d13299dSbellard#include <inttypes.h>
3867d13299dSbellardint main(int argc, char ** argv){
3877d13299dSbellard        volatile uint32_t i=0x01234567;
3887d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
3897d13299dSbellard}
3907d13299dSbellardEOF
3917d13299dSbellard
3927d13299dSbellardif $cc -o $TMPE $TMPC 2>/dev/null ; then
3937d13299dSbellard$TMPE && bigendian="yes"
3947d13299dSbellardelse
3957d13299dSbellardecho big/little test failed
3967d13299dSbellardfi
3977d13299dSbellard
3987d13299dSbellardelse
3997d13299dSbellard
4007d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
401808c4954Sbellardif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
4027d13299dSbellard    bigendian="yes"
4037d13299dSbellardfi
4047d13299dSbellard
4057d13299dSbellardfi
4067d13299dSbellard
407b6853697Sbellard# host long bits test
408b6853697Sbellardhostlongbits="32"
409b6853697Sbellardif test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
410b6853697Sbellard    hostlongbits="64"
411b6853697Sbellardfi
412b6853697Sbellard
413e8cd23deSbellard# check gcc options support
41404369ff2Sbellardcat > $TMPC <<EOF
41504369ff2Sbellardint main(void) {
41604369ff2Sbellard}
41704369ff2SbellardEOF
41804369ff2Sbellard
419e8cd23deSbellardhave_gcc3_options="no"
420e8cd23deSbellardif $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
421e8cd23deSbellard   have_gcc3_options="yes"
42204369ff2Sbellardfi
423ca735206Sbellard
424b1a550a0Spbrook# Check for gcc4, error if pre-gcc4
4251aff381fSbellardif test "$check_gcc" = "yes" ; then
4261aff381fSbellard    cat > $TMPC <<EOF
427b1a550a0Spbrook#if __GNUC__ < 4
428b1a550a0Spbrook#error gcc3
4291aff381fSbellard#endif
4301aff381fSbellardint main(){return 0;}
4311aff381fSbellardEOF
432b1a550a0Spbrook    if $cc -o $TMPO $TMPC 2>/dev/null ; then
4331aff381fSbellard        echo "ERROR: \"$cc\" looks like gcc 4.x"
4341aff381fSbellard        echo "QEMU is known to have problems when compiled with gcc 4.x"
4351aff381fSbellard        echo "It is recommended that you use gcc 3.x to build QEMU"
4361aff381fSbellard        echo "To use this compiler anyway, configure with --disable-gcc-check"
4371aff381fSbellard        exit 1;
4381aff381fSbellard    fi
4391aff381fSbellardfi
4401aff381fSbellard
44111d9f695Sbellard##########################################
44211d9f695Sbellard# SDL probe
44311d9f695Sbellard
44411d9f695Sbellardsdl_too_old=no
44511d9f695Sbellard
44611d9f695Sbellardif test -z "$sdl" ; then
44711d9f695Sbellard
448a6e022adSbellardsdl_config="sdl-config"
449a6e022adSbellardsdl=no
4507c1f25b4Sbellardsdl_static=no
451a6e022adSbellard
452a6e022adSbellardif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
453a6e022adSbellard# win32 cross compilation case
454a6e022adSbellard    sdl_config="i386-mingw32msvc-sdl-config"
455a6e022adSbellard    sdl=yes
456a6e022adSbellardelse
457a6e022adSbellard# normal SDL probe
45811d9f695Sbellardcat > $TMPC << EOF
45911d9f695Sbellard#include <SDL.h>
46011d9f695Sbellard#undef main /* We don't want SDL to override our main() */
46111d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
46211d9f695SbellardEOF
46311d9f695Sbellard
464a6e022adSbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
465a6e022adSbellard_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
46611d9f695Sbellardif test "$_sdlversion" -lt 121 ; then
46711d9f695Sbellardsdl_too_old=yes
46811d9f695Sbellardelse
46911d9f695Sbellardsdl=yes
47011d9f695Sbellardfi
4717c1f25b4Sbellard
4727c1f25b4Sbellard# static link with sdl ?
4737c1f25b4Sbellardif test "$sdl" = "yes" ; then
4747c1f25b4Sbellardaa="no"
4757c1f25b4Sbellard`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
4767c1f25b4Sbellardsdl_static_libs=`$sdl_config --static-libs`
4777c1f25b4Sbellardif [ "$aa" = "yes" ] ; then
478d8d8aa4eSbellard  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
47911d9f695Sbellardfi
48011d9f695Sbellard
4817c1f25b4Sbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
4827c1f25b4Sbellard  sdl_static=yes
4837c1f25b4Sbellardfi
4847c1f25b4Sbellard
4857c1f25b4Sbellardfi # static link
4867c1f25b4Sbellard
4877c1f25b4Sbellardfi # sdl compile test
4887c1f25b4Sbellard
489a6e022adSbellardfi # cross compilation
490a6e022adSbellardfi # -z $sdl
49111d9f695Sbellard
492cc8ae6deSpbrook# Check if tools are available to build documentation.
49394ac5158Spbrookif [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
494cc8ae6deSpbrook  build_docs="yes"
495cc8ae6deSpbrookfi
496cc8ae6deSpbrook
49711d9f695Sbellardif test "$mingw32" = "yes" ; then
49811d9f695Sbellardif test -z "$prefix" ; then
49911d9f695Sbellard    prefix="/c/Program Files/Qemu"
50011d9f695Sbellardfi
50111d9f695Sbellardmandir="$prefix"
5027efa4387Sbellarddatadir="$prefix"
5031f50f8d1Sbellarddocdir="$prefix"
50411d9f695Sbellardbindir="$prefix"
50511d9f695Sbellardelse
50611d9f695Sbellardif test -z "$prefix" ; then
50711d9f695Sbellard    prefix="/usr/local"
50811d9f695Sbellardfi
5095a67135aSbellardmandir="$prefix/share/man"
5107efa4387Sbellarddatadir="$prefix/share/qemu"
5111f50f8d1Sbellarddocdir="$prefix/share/doc/qemu"
51211d9f695Sbellardbindir="$prefix/bin"
51311d9f695Sbellardfi
5145a67135aSbellard
5157d13299dSbellardecho "Install prefix    $prefix"
5167efa4387Sbellardecho "BIOS directory    $datadir"
51711d9f695Sbellardecho "binary directory  $bindir"
51811d9f695Sbellardif test "$mingw32" = "no" ; then
51911d9f695Sbellardecho "Manual directory  $mandir"
52043ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
52111d9f695Sbellardfi
5225a67135aSbellardecho "Source path       $source_path"
5237d13299dSbellardecho "C compiler        $cc"
52483469015Sbellardecho "Host C compiler   $host_cc"
5257d13299dSbellardecho "make              $make"
5266a882643Spbrookecho "install           $install"
527a98fd896Sbellardecho "host CPU          $cpu"
528de83cd02Sbellardecho "host big endian   $bigendian"
52997a847bcSbellardecho "target list       $target_list"
5307d13299dSbellardecho "gprof enabled     $gprof"
53105c2a3e7Sbellardecho "profiler          $profiler"
53243ce4dfeSbellardecho "static build      $static"
5335b0753e0Sbellardif test "$darwin" = "yes" ; then
5345b0753e0Sbellard    echo "Cocoa support     $cocoa"
5355b0753e0Sbellardfi
53697a847bcSbellardecho "SDL support       $sdl"
537e4afee97Sbellardif test "$sdl" != "no" ; then
5387c1f25b4Sbellard    echo "SDL static link   $sdl_static"
539e4afee97Sbellardfi
54067b915a5Sbellardecho "mingw32 support   $mingw32"
541fb065187Sbellardecho "Adlib support     $adlib"
5421d14ffa9Sbellardecho "CoreAudio support $coreaudio"
5431d14ffa9Sbellardecho "ALSA support      $alsa"
5441d14ffa9Sbellardecho "DSound support    $dsound"
5451d14ffa9Sbellardif test "$fmod" = "yes"; then
5461d14ffa9Sbellard    if test -z $fmod_lib || test -z $fmod_inc; then
5471d14ffa9Sbellard        echo
5481d14ffa9Sbellard        echo "Error: You must specify path to FMOD library and headers"
5491d14ffa9Sbellard        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
5501d14ffa9Sbellard        echo
5511d14ffa9Sbellard        exit 1
5521d14ffa9Sbellard    fi
553b1a550a0Spbrook    fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
554b1a550a0Spbrookelse
555b1a550a0Spbrook    fmod_support=""
556102a52e4Sbellardfi
557b1a550a0Spbrookecho "FMOD support      $fmod $fmod_support"
55807f4ddbfSbellardecho "kqemu support     $kqemu"
559cc8ae6deSpbrookecho "Documentation     $build_docs"
560c5937220Spbrook[ ! -z "$uname_release" ] && \
561c5937220Spbrookecho "uname -r          $uname_release"
56267b915a5Sbellard
56397a847bcSbellardif test $sdl_too_old = "yes"; then
56424b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
565e8cd23deSbellardfi
56624b55b96Sbellard#if test "$sdl_static" = "no"; then
56724b55b96Sbellard#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
56824b55b96Sbellard#fi
56997a847bcSbellardconfig_mak="config-host.mak"
57097a847bcSbellardconfig_h="config-host.h"
57197a847bcSbellard
5727c1f25b4Sbellard#echo "Creating $config_mak and $config_h"
57397a847bcSbellard
57497a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
57529517134Spbrookecho "# Configured with: $0 $@" >> $config_mak
57697a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
57797a847bcSbellard
57897a847bcSbellardecho "prefix=$prefix" >> $config_mak
57911d9f695Sbellardecho "bindir=$bindir" >> $config_mak
5805a67135aSbellardecho "mandir=$mandir" >> $config_mak
5817efa4387Sbellardecho "datadir=$datadir" >> $config_mak
5821f50f8d1Sbellardecho "docdir=$docdir" >> $config_mak
5837efa4387Sbellardecho "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
58497a847bcSbellardecho "MAKE=$make" >> $config_mak
5856a882643Spbrookecho "INSTALL=$install" >> $config_mak
58697a847bcSbellardecho "CC=$cc" >> $config_mak
58797a847bcSbellardif test "$have_gcc3_options" = "yes" ; then
58897a847bcSbellard  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
58997a847bcSbellardfi
59097a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak
59197a847bcSbellardecho "AR=$ar" >> $config_mak
59297a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak
59397a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak
59497a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak
59567b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak
59697a847bcSbellardif test "$cpu" = "i386" ; then
59797a847bcSbellard  echo "ARCH=i386" >> $config_mak
59897a847bcSbellard  echo "#define HOST_I386 1" >> $config_h
5990b0babc6Sbellardelif test "$cpu" = "x86_64" ; then
6000b0babc6Sbellard  echo "ARCH=x86_64" >> $config_mak
6010b0babc6Sbellard  echo "#define HOST_X86_64 1" >> $config_h
602808c4954Sbellardelif test "$cpu" = "armv4b" ; then
603808c4954Sbellard  echo "ARCH=arm" >> $config_mak
604808c4954Sbellard  echo "#define HOST_ARM 1" >> $config_h
6057d13299dSbellardelif test "$cpu" = "armv4l" ; then
60697a847bcSbellard  echo "ARCH=arm" >> $config_mak
60797a847bcSbellard  echo "#define HOST_ARM 1" >> $config_h
6087d13299dSbellardelif test "$cpu" = "powerpc" ; then
60997a847bcSbellard  echo "ARCH=ppc" >> $config_mak
61097a847bcSbellard  echo "#define HOST_PPC 1" >> $config_h
6117d13299dSbellardelif test "$cpu" = "mips" ; then
61297a847bcSbellard  echo "ARCH=mips" >> $config_mak
61397a847bcSbellard  echo "#define HOST_MIPS 1" >> $config_h
614fb3e5849Sbellardelif test "$cpu" = "s390" ; then
61597a847bcSbellard  echo "ARCH=s390" >> $config_mak
61697a847bcSbellard  echo "#define HOST_S390 1" >> $config_h
617295defa5Sbellardelif test "$cpu" = "alpha" ; then
61897a847bcSbellard  echo "ARCH=alpha" >> $config_mak
61997a847bcSbellard  echo "#define HOST_ALPHA 1" >> $config_h
620ae228531Sbellardelif test "$cpu" = "sparc" ; then
62197a847bcSbellard  echo "ARCH=sparc" >> $config_mak
62297a847bcSbellard  echo "#define HOST_SPARC 1" >> $config_h
623ae228531Sbellardelif test "$cpu" = "sparc64" ; then
62497a847bcSbellard  echo "ARCH=sparc64" >> $config_mak
62597a847bcSbellard  echo "#define HOST_SPARC64 1" >> $config_h
626a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then
62797a847bcSbellard  echo "ARCH=ia64" >> $config_mak
62897a847bcSbellard  echo "#define HOST_IA64 1" >> $config_h
62938e584a0Sbellardelif test "$cpu" = "m68k" ; then
63038ca2abcSbellard  echo "ARCH=m68k" >> $config_mak
63138ca2abcSbellard  echo "#define HOST_M68K 1" >> $config_h
6327d13299dSbellardelse
6337d13299dSbellard  echo "Unsupported CPU"
6347d13299dSbellard  exit 1
6357d13299dSbellardfi
6367d13299dSbellardif test "$bigendian" = "yes" ; then
63797a847bcSbellard  echo "WORDS_BIGENDIAN=yes" >> $config_mak
63897a847bcSbellard  echo "#define WORDS_BIGENDIAN 1" >> $config_h
63997a847bcSbellardfi
640b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h
64167b915a5Sbellardif test "$mingw32" = "yes" ; then
64267b915a5Sbellard  echo "CONFIG_WIN32=yes" >> $config_mak
64311d9f695Sbellard  echo "#define CONFIG_WIN32 1" >> $config_h
6447d3505c5Sbellardelif test -f "/usr/include/byteswap.h" ; then
64597a847bcSbellard  echo "#define HAVE_BYTESWAP_H 1" >> $config_h
64667b915a5Sbellardfi
64783fb7adfSbellardif test "$darwin" = "yes" ; then
64883fb7adfSbellard  echo "CONFIG_DARWIN=yes" >> $config_mak
64983fb7adfSbellard  echo "#define CONFIG_DARWIN 1" >> $config_h
65083fb7adfSbellardfi
651ec530c81Sbellardif test "$solaris" = "yes" ; then
652ec530c81Sbellard  echo "CONFIG_SOLARIS=yes" >> $config_mak
65338cfa06cSbellard  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
654ec530c81Sbellardfi
65567b915a5Sbellardif test "$gdbstub" = "yes" ; then
65667b915a5Sbellard  echo "CONFIG_GDBSTUB=yes" >> $config_mak
65767b915a5Sbellard  echo "#define CONFIG_GDBSTUB 1" >> $config_h
65867b915a5Sbellardfi
65997a847bcSbellardif test "$gprof" = "yes" ; then
66097a847bcSbellard  echo "TARGET_GPROF=yes" >> $config_mak
66197a847bcSbellard  echo "#define HAVE_GPROF 1" >> $config_h
66297a847bcSbellardfi
66397a847bcSbellardif test "$static" = "yes" ; then
66497a847bcSbellard  echo "CONFIG_STATIC=yes" >> $config_mak
66550863472Sbellard  echo "#define CONFIG_STATIC 1" >> $config_h
66697a847bcSbellardfi
66705c2a3e7Sbellardif test $profiler = "yes" ; then
66805c2a3e7Sbellard  echo "#define CONFIG_PROFILER 1" >> $config_h
66905c2a3e7Sbellardfi
670c20709aaSbellardif test "$slirp" = "yes" ; then
671c20709aaSbellard  echo "CONFIG_SLIRP=yes" >> $config_mak
672c20709aaSbellard  echo "#define CONFIG_SLIRP 1" >> $config_h
673c20709aaSbellardfi
674fb065187Sbellardif test "$adlib" = "yes" ; then
675fb065187Sbellard  echo "CONFIG_ADLIB=yes" >> $config_mak
676fb065187Sbellard  echo "#define CONFIG_ADLIB 1" >> $config_h
677fb065187Sbellardfi
678fb065187Sbellardif test "$oss" = "yes" ; then
679fb065187Sbellard  echo "CONFIG_OSS=yes" >> $config_mak
680fb065187Sbellard  echo "#define CONFIG_OSS 1" >> $config_h
681fb065187Sbellardfi
6821d14ffa9Sbellardif test "$coreaudio" = "yes" ; then
6831d14ffa9Sbellard  echo "CONFIG_COREAUDIO=yes" >> $config_mak
6841d14ffa9Sbellard  echo "#define CONFIG_COREAUDIO 1" >> $config_h
6851d14ffa9Sbellardfi
6861d14ffa9Sbellardif test "$alsa" = "yes" ; then
6871d14ffa9Sbellard  echo "CONFIG_ALSA=yes" >> $config_mak
6881d14ffa9Sbellard  echo "#define CONFIG_ALSA 1" >> $config_h
6891d14ffa9Sbellardfi
6901d14ffa9Sbellardif test "$dsound" = "yes" ; then
6911d14ffa9Sbellard  echo "CONFIG_DSOUND=yes" >> $config_mak
6921d14ffa9Sbellard  echo "#define CONFIG_DSOUND 1" >> $config_h
6931d14ffa9Sbellardfi
694102a52e4Sbellardif test "$fmod" = "yes" ; then
695102a52e4Sbellard  echo "CONFIG_FMOD=yes" >> $config_mak
696102a52e4Sbellard  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
697102a52e4Sbellard  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
698102a52e4Sbellard  echo "#define CONFIG_FMOD 1" >> $config_h
699102a52e4Sbellardfi
700b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
701b1a550a0Spbrookecho "VERSION=$qemu_version" >>$config_mak
702d4b8f039Spbrookecho "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
70397a847bcSbellard
70497a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak
705ad064840Spbrookif [ "$source_path_used" = "yes" ]; then
706ad064840Spbrook  echo "VPATH=$source_path" >> $config_mak
707ad064840Spbrookfi
70897a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak
709cc8ae6deSpbrookif [ "$build_docs" = "yes" ] ; then
710cc8ae6deSpbrook  echo "BUILD_DOCS=yes" >> $config_mak
711cc8ae6deSpbrookfi
71297a847bcSbellard
71383fb7adfSbellard# XXX: suppress that
7147d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
71543003046Sbellard  echo "#define O_LARGEFILE 0" >> $config_h
71643003046Sbellard  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
7177d3505c5Sbellard  echo "#define _BSD 1" >> $config_h
7187d3505c5Sbellardfi
7197d3505c5Sbellard
720c5937220Spbrookecho "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
721c5937220Spbrook
72297a847bcSbellardfor target in $target_list; do
72397a847bcSbellardtarget_dir="$target"
72497a847bcSbellardconfig_mak=$target_dir/config.mak
72597a847bcSbellardconfig_h=$target_dir/config.h
72697a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1`
72797a847bcSbellardtarget_bigendian="no"
728808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes
7291e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes
73064b3ab24Sbellard[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
73167867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes
732a2458627Sbellard[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
733d3258560Sbellard[ "$target_cpu" = "mips" ] && target_bigendian=yes
73497a847bcSbellardtarget_softmmu="no"
73597a847bcSbellardif expr $target : '.*-softmmu' > /dev/null ; then
73697a847bcSbellard  target_softmmu="yes"
7377d13299dSbellardfi
738997344f3Sbellardtarget_user_only="no"
739997344f3Sbellardif expr $target : '.*-user' > /dev/null ; then
740997344f3Sbellard  target_user_only="yes"
741997344f3Sbellardfi
742de83cd02Sbellard
74397ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
74497ccc689Sbellard        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
74597ccc689Sbellard    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
7469c038506Spbrook    echo "To build QEMU without graphical output configure with --disable-gfx-check"
74797ccc689Sbellard    echo "Note that this will disable all output from the virtual graphics card."
74897ccc689Sbellard    exit 1;
74997ccc689Sbellardfi
75097ccc689Sbellard
7517c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
75297a847bcSbellard
75397a847bcSbellardmkdir -p $target_dir
754158142c2Sbellardmkdir -p $target_dir/fpu
755808c4954Sbellardif test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
75669de927cSbellard  mkdir -p $target_dir/nwfpe
75769de927cSbellardfi
758a7e61ed4Sbellardif test "$target_user_only" = "no" ; then
759a7e61ed4Sbellard  mkdir -p $target_dir/slirp
760a7e61ed4Sbellardfi
76169de927cSbellard
762ec530c81Sbellard#
763ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link
764ec530c81Sbellard#
765ec530c81Sbellardrm -f $target_dir/Makefile
766ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile
767ec530c81Sbellard
76897a847bcSbellard
76997a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
77097a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
77197a847bcSbellard
77297a847bcSbellard
77397a847bcSbellardecho "include ../config-host.mak" >> $config_mak
77497a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h
7751e43adfcSbellard
776e5fe0c52Spbrookbflt="no"
7771e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
7781e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
77997a847bcSbellard
78097a847bcSbellardif test "$target_cpu" = "i386" ; then
78197a847bcSbellard  echo "TARGET_ARCH=i386" >> $config_mak
78297a847bcSbellard  echo "#define TARGET_ARCH \"i386\"" >> $config_h
78397a847bcSbellard  echo "#define TARGET_I386 1" >> $config_h
78407f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
785824d560fSbellard    echo "#define USE_KQEMU 1" >> $config_h
786824d560fSbellard  fi
787808c4954Sbellardelif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
78897a847bcSbellard  echo "TARGET_ARCH=arm" >> $config_mak
78997a847bcSbellard  echo "#define TARGET_ARCH \"arm\"" >> $config_h
79097a847bcSbellard  echo "#define TARGET_ARM 1" >> $config_h
791e5fe0c52Spbrook  bflt="yes"
7921e43adfcSbellardelif test "$target_cpu" = "sparc" ; then
7931e43adfcSbellard  echo "TARGET_ARCH=sparc" >> $config_mak
7941e43adfcSbellard  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
7951e43adfcSbellard  echo "#define TARGET_SPARC 1" >> $config_h
79664b3ab24Sbellardelif test "$target_cpu" = "sparc64" ; then
79764b3ab24Sbellard  echo "TARGET_ARCH=sparc64" >> $config_mak
79864b3ab24Sbellard  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
79964b3ab24Sbellard  echo "#define TARGET_SPARC 1" >> $config_h
80064b3ab24Sbellard  echo "#define TARGET_SPARC64 1" >> $config_h
80167867308Sbellardelif test "$target_cpu" = "ppc" ; then
80267867308Sbellard  echo "TARGET_ARCH=ppc" >> $config_mak
80367867308Sbellard  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
80467867308Sbellard  echo "#define TARGET_PPC 1" >> $config_h
805a2458627Sbellardelif test "$target_cpu" = "ppc64" ; then
806a2458627Sbellard  echo "TARGET_ARCH=ppc64" >> $config_mak
807a2458627Sbellard  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
808a2458627Sbellard  echo "#define TARGET_PPC 1" >> $config_h
809a2458627Sbellard  echo "#define TARGET_PPC64 1" >> $config_h
8100b0babc6Sbellardelif test "$target_cpu" = "x86_64" ; then
8110b0babc6Sbellard  echo "TARGET_ARCH=x86_64" >> $config_mak
8120b0babc6Sbellard  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
8130b0babc6Sbellard  echo "#define TARGET_I386 1" >> $config_h
8140b0babc6Sbellard  echo "#define TARGET_X86_64 1" >> $config_h
81507f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
81607f4ddbfSbellard    echo "#define USE_KQEMU 1" >> $config_h
81707f4ddbfSbellard  fi
818c20eb473Sbellardelif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
819d3258560Sbellard  echo "TARGET_ARCH=mips" >> $config_mak
820d3258560Sbellard  echo "#define TARGET_ARCH \"mips\"" >> $config_h
821d3258560Sbellard  echo "#define TARGET_MIPS 1" >> $config_h
822*6ea83fedSbellard  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
823*6ea83fedSbellard  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
824fdf9b3e8Sbellardelif test "$target_cpu" = "sh4" ; then
825fdf9b3e8Sbellard  echo "TARGET_ARCH=sh4" >> $config_mak
826fdf9b3e8Sbellard  echo "#define TARGET_ARCH \"sh4\"" >> $config_h
827fdf9b3e8Sbellard  echo "#define TARGET_SH4 1" >> $config_h
828de83cd02Sbellardelse
829de83cd02Sbellard  echo "Unsupported target CPU"
830de83cd02Sbellard  exit 1
831de83cd02Sbellardfi
832de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
83397a847bcSbellard  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
83497a847bcSbellard  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
83597a847bcSbellardfi
83697a847bcSbellardif test "$target_softmmu" = "yes" ; then
83797a847bcSbellard  echo "CONFIG_SOFTMMU=yes" >> $config_mak
83897a847bcSbellard  echo "#define CONFIG_SOFTMMU 1" >> $config_h
839de83cd02Sbellardfi
840997344f3Sbellardif test "$target_user_only" = "yes" ; then
841997344f3Sbellard  echo "CONFIG_USER_ONLY=yes" >> $config_mak
842997344f3Sbellard  echo "#define CONFIG_USER_ONLY 1" >> $config_h
843997344f3Sbellardfi
844de83cd02Sbellard
845158142c2Sbellardif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
846158142c2Sbellard  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
847158142c2Sbellard  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
848158142c2Sbellardfi
849e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
850e5fe0c52Spbrook  echo "TARGET_HAS_BFLT=yes" >> $config_mak
851e5fe0c52Spbrook  echo "#define TARGET_HAS_BFLT 1" >> $config_h
852e5fe0c52Spbrookfi
8537c1f25b4Sbellard# sdl defines
8547c1f25b4Sbellard
8557c1f25b4Sbellardif test "$target_user_only" = "no"; then
8567c1f25b4Sbellard    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
857dbb2c921Sbellard        sdl1=$sdl_static
8587c1f25b4Sbellard    else
859dbb2c921Sbellard        sdl1=$sdl
860dbb2c921Sbellard    fi
861dbb2c921Sbellard    if test "$sdl1" = "yes" ; then
8627c1f25b4Sbellard        echo "#define CONFIG_SDL 1" >> $config_h
8637c1f25b4Sbellard        echo "CONFIG_SDL=yes" >> $config_mak
864dbb2c921Sbellard        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
865dbb2c921Sbellard            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
866dbb2c921Sbellard        else
8677c1f25b4Sbellard            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
8687c1f25b4Sbellard        fi
8697c1f25b4Sbellard        if [ "${aa}" = "yes" ] ; then
870b1a550a0Spbrook            echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
871b1a550a0Spbrook        else
872b1a550a0Spbrook            echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
8737c1f25b4Sbellard        fi
8747c1f25b4Sbellard    fi
875dbb2c921Sbellardfi
8767c1f25b4Sbellard
8775b0753e0Sbellardif test "$cocoa" = "yes" ; then
8785b0753e0Sbellard    echo "#define CONFIG_COCOA 1" >> $config_h
8795b0753e0Sbellard    echo "CONFIG_COCOA=yes" >> $config_mak
8805b0753e0Sbellardfi
8815b0753e0Sbellard
88297a847bcSbellarddone # for target in $targets
8837d13299dSbellard
8847d13299dSbellard# build tree in object directory if source path is different from current one
8857d13299dSbellardif test "$source_path_used" = "yes" ; then
8867d13299dSbellard    DIRS="tests"
8877d13299dSbellard    FILES="Makefile tests/Makefile"
8887d13299dSbellard    for dir in $DIRS ; do
8897d13299dSbellard            mkdir -p $dir
8907d13299dSbellard    done
891ec530c81Sbellard    # remove the link and recreate it, as not all "ln -sf" overwrite the link
8927d13299dSbellard    for f in $FILES ; do
893ec530c81Sbellard        rm -f $f
894ec530c81Sbellard        ln -s $source_path/$f $f
8957d13299dSbellard    done
8967d13299dSbellardfi
8977d13299dSbellard
89897a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS
899