xref: /openbmc/qemu/configure (revision 064aae138b1b26d326603c5c46763e6bde4bf5f2)
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"
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  ;;
21467b915a5Sbellard  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
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  ;;
224b1a550a0Spbrook  --kernel-path=*) kernel_path="$optarg"
225c9ec1fe4Sbellard  ;;
2261d14ffa9Sbellard  --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
2275b0753e0Sbellard  ;;
22897ccc689Sbellard  --disable-gfx-check) check_gfx="no"
22997ccc689Sbellard  ;;
2301aff381fSbellard  --disable-gcc-check) check_gcc="no"
2311aff381fSbellard  ;;
232cad25d69Spbrook  --disable-system) softmmu="no"
2330a8e90f4Spbrook  ;;
234cad25d69Spbrook  --enable-system) softmmu="yes"
2350a8e90f4Spbrook  ;;
2360a8e90f4Spbrook  --disable-user) user="no"
2370a8e90f4Spbrook  ;;
2380a8e90f4Spbrook  --enable-user) user="yes"
2390a8e90f4Spbrook  ;;
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 "  --kernel-path=PATH       set the kernel path (configure probes it)"
265af5db58eSpbrookecho ""
266af5db58eSpbrookecho "Advanced options (experts only):"
267af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
268af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
269af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
270af5db58eSpbrookecho "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
271af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
2726a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
273af5db58eSpbrookecho "  --static                 enable static build [$static]"
274af5db58eSpbrookecho "  --enable-cocoa           enable COCOA (Mac OS X only)"
275af5db58eSpbrookecho "  --enable-mingw32         enable Win32 cross compilation with mingw32"
276af5db58eSpbrookecho "  --enable-adlib           enable Adlib emulation"
277af5db58eSpbrookecho "  --enable-coreaudio       enable Coreaudio audio driver"
278af5db58eSpbrookecho "  --enable-alsa            enable ALSA audio driver"
279af5db58eSpbrookecho "  --enable-fmod            enable FMOD audio driver"
280af5db58eSpbrookecho "  --enabled-dsound         enable DirectSound audio driver"
281af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
282af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
283af5db58eSpbrookecho "  --enable-user            enable all linux usermode emulation targets"
284af5db58eSpbrookecho "  --disable-user           disable all linux usermode emulation targets"
285af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
286af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
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
296*064aae13Spbrook# check that the C compiler works.
297*064aae13Spbrookcat > $TMPC <<EOF
298*064aae13Spbrookint main(void) {}
299*064aae13SpbrookEOF
300*064aae13Spbrook
301*064aae13Spbrookif $cc -c -o $TMPO $TMPC 2>/dev/null ; then
302*064aae13Spbrook  : C compiler works ok
303*064aae13Spbrookelse
304*064aae13Spbrook    echo "ERROR: \"$cc\" either does not exist or does not work"
305*064aae13Spbrook    exit 1
306a7350fa1Sbellardfi
307a7350fa1Sbellard
30867b915a5Sbellardif test "$mingw32" = "yes" ; then
3095327cf48Sbellard    linux="no"
31067b915a5Sbellard    EXESUF=".exe"
31167b915a5Sbellard    gdbstub="no"
3129f059ecaSbellard    oss="no"
31307f4ddbfSbellard    if [ "$cpu" = "i386" ] ; then
31407f4ddbfSbellard        kqemu="yes"
31507f4ddbfSbellard    fi
31667b915a5Sbellardfi
31767b915a5Sbellard
318ec530c81Sbellard#
319ec530c81Sbellard# Solaris specific configure tool chain decisions
320ec530c81Sbellard#
321ec530c81Sbellardif test "$solaris" = "yes" ; then
322ec530c81Sbellard  #
323ec530c81Sbellard  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
324ec530c81Sbellard  # override the check with --disable-gcc-check
325ec530c81Sbellard  #
326ec530c81Sbellard  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
327ec530c81Sbellard    solgcc=`which $cc`
328ec530c81Sbellard    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
329ec530c81Sbellard      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
330ec530c81Sbellard      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
331ec530c81Sbellard      echo "or get the latest patch from SunSolve for gcc"
332ec530c81Sbellard      exit 1
333ec530c81Sbellard    fi
334ec530c81Sbellard  fi
335ec530c81Sbellard  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
336ec530c81Sbellard  if test -z "$solinst" ; then
337ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
338ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
339ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
340ec530c81Sbellard    exit 1
341ec530c81Sbellard  fi
342ec530c81Sbellard  if test "$solinst" = "/usr/sbin/install" ; then
343ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
344ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
345ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
346ec530c81Sbellard    exit 1
347ec530c81Sbellard  fi
348ec530c81Sbellard  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
349ec530c81Sbellard  if test -z "$sol_ar" ; then
350ec530c81Sbellard    echo "Error: No path includes ar"
351ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
352ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
353ec530c81Sbellard    fi
354ec530c81Sbellard    exit 1
355ec530c81Sbellard  fi
356ec530c81Sbellardfi
357ec530c81Sbellard
358ec530c81Sbellard
3595327cf48Sbellardif test -z "$target_list" ; then
3605327cf48Sbellard# these targets are portable
3610a8e90f4Spbrook    if [ "$softmmu" = "yes" ] ; then
36238260998Spbrook        target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
3630a8e90f4Spbrook    fi
3645327cf48Sbellard# the following are Linux specific
3650a8e90f4Spbrook    if [ "$user" = "yes" ] ; then
366215cf0beSbellard        target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
3675327cf48Sbellard    fi
3686e20a45fSbellardelse
369b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
3705327cf48Sbellardfi
3710a8e90f4Spbrookif test -z "$target_list" ; then
3720a8e90f4Spbrook    echo "No targets enabled"
3730a8e90f4Spbrook    exit 1
3740a8e90f4Spbrookfi
3755327cf48Sbellard
3767d13299dSbellardif test -z "$cross_prefix" ; then
3777d13299dSbellard
3787d13299dSbellard# ---
3797d13299dSbellard# big/little endian test
3807d13299dSbellardcat > $TMPC << EOF
3817d13299dSbellard#include <inttypes.h>
3827d13299dSbellardint main(int argc, char ** argv){
3837d13299dSbellard        volatile uint32_t i=0x01234567;
3847d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
3857d13299dSbellard}
3867d13299dSbellardEOF
3877d13299dSbellard
3887d13299dSbellardif $cc -o $TMPE $TMPC 2>/dev/null ; then
3897d13299dSbellard$TMPE && bigendian="yes"
3907d13299dSbellardelse
3917d13299dSbellardecho big/little test failed
3927d13299dSbellardfi
3937d13299dSbellard
3947d13299dSbellardelse
3957d13299dSbellard
3967d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
397808c4954Sbellardif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
3987d13299dSbellard    bigendian="yes"
3997d13299dSbellardfi
4007d13299dSbellard
4017d13299dSbellardfi
4027d13299dSbellard
403b6853697Sbellard# host long bits test
404b6853697Sbellardhostlongbits="32"
405b6853697Sbellardif test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
406b6853697Sbellard    hostlongbits="64"
407b6853697Sbellardfi
408b6853697Sbellard
409e8cd23deSbellard# check gcc options support
41004369ff2Sbellardcat > $TMPC <<EOF
41104369ff2Sbellardint main(void) {
41204369ff2Sbellard}
41304369ff2SbellardEOF
41404369ff2Sbellard
415e8cd23deSbellardhave_gcc3_options="no"
416e8cd23deSbellardif $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
417e8cd23deSbellard   have_gcc3_options="yes"
41804369ff2Sbellardfi
419ca735206Sbellard
420b1a550a0Spbrook# Check for gcc4, error if pre-gcc4
4211aff381fSbellardif test "$check_gcc" = "yes" ; then
4221aff381fSbellard    cat > $TMPC <<EOF
423b1a550a0Spbrook#if __GNUC__ < 4
424b1a550a0Spbrook#error gcc3
4251aff381fSbellard#endif
4261aff381fSbellardint main(){return 0;}
4271aff381fSbellardEOF
428b1a550a0Spbrook    if $cc -o $TMPO $TMPC 2>/dev/null ; then
4291aff381fSbellard        echo "ERROR: \"$cc\" looks like gcc 4.x"
4301aff381fSbellard        echo "QEMU is known to have problems when compiled with gcc 4.x"
4311aff381fSbellard        echo "It is recommended that you use gcc 3.x to build QEMU"
4321aff381fSbellard        echo "To use this compiler anyway, configure with --disable-gcc-check"
4331aff381fSbellard        exit 1;
4341aff381fSbellard    fi
4351aff381fSbellardfi
4361aff381fSbellard
43711d9f695Sbellard##########################################
43811d9f695Sbellard# SDL probe
43911d9f695Sbellard
44011d9f695Sbellardsdl_too_old=no
44111d9f695Sbellard
44211d9f695Sbellardif test -z "$sdl" ; then
44311d9f695Sbellard
444a6e022adSbellardsdl_config="sdl-config"
445a6e022adSbellardsdl=no
4467c1f25b4Sbellardsdl_static=no
447a6e022adSbellard
448a6e022adSbellardif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
449a6e022adSbellard# win32 cross compilation case
450a6e022adSbellard    sdl_config="i386-mingw32msvc-sdl-config"
451a6e022adSbellard    sdl=yes
452a6e022adSbellardelse
453a6e022adSbellard# normal SDL probe
45411d9f695Sbellardcat > $TMPC << EOF
45511d9f695Sbellard#include <SDL.h>
45611d9f695Sbellard#undef main /* We don't want SDL to override our main() */
45711d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
45811d9f695SbellardEOF
45911d9f695Sbellard
460a6e022adSbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
461a6e022adSbellard_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
46211d9f695Sbellardif test "$_sdlversion" -lt 121 ; then
46311d9f695Sbellardsdl_too_old=yes
46411d9f695Sbellardelse
46511d9f695Sbellardsdl=yes
46611d9f695Sbellardfi
4677c1f25b4Sbellard
4687c1f25b4Sbellard# static link with sdl ?
4697c1f25b4Sbellardif test "$sdl" = "yes" ; then
4707c1f25b4Sbellardaa="no"
4717c1f25b4Sbellard`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
4727c1f25b4Sbellardsdl_static_libs=`$sdl_config --static-libs`
4737c1f25b4Sbellardif [ "$aa" = "yes" ] ; then
474d8d8aa4eSbellard  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
47511d9f695Sbellardfi
47611d9f695Sbellard
4777c1f25b4Sbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
4787c1f25b4Sbellard  sdl_static=yes
4797c1f25b4Sbellardfi
4807c1f25b4Sbellard
4817c1f25b4Sbellardfi # static link
4827c1f25b4Sbellard
4837c1f25b4Sbellardfi # sdl compile test
4847c1f25b4Sbellard
485a6e022adSbellardfi # cross compilation
486a6e022adSbellardfi # -z $sdl
48711d9f695Sbellard
488cc8ae6deSpbrook# Check if tools are available to build documentation.
48994ac5158Spbrookif [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
490cc8ae6deSpbrook  build_docs="yes"
491cc8ae6deSpbrookfi
492cc8ae6deSpbrook
49311d9f695Sbellardif test "$mingw32" = "yes" ; then
49411d9f695Sbellardif test -z "$prefix" ; then
49511d9f695Sbellard    prefix="/c/Program Files/Qemu"
49611d9f695Sbellardfi
49711d9f695Sbellardmandir="$prefix"
4987efa4387Sbellarddatadir="$prefix"
4991f50f8d1Sbellarddocdir="$prefix"
50011d9f695Sbellardbindir="$prefix"
50111d9f695Sbellardelse
50211d9f695Sbellardif test -z "$prefix" ; then
50311d9f695Sbellard    prefix="/usr/local"
50411d9f695Sbellardfi
5055a67135aSbellardmandir="$prefix/share/man"
5067efa4387Sbellarddatadir="$prefix/share/qemu"
5071f50f8d1Sbellarddocdir="$prefix/share/doc/qemu"
50811d9f695Sbellardbindir="$prefix/bin"
50911d9f695Sbellardfi
5105a67135aSbellard
5117d13299dSbellardecho "Install prefix    $prefix"
5127efa4387Sbellardecho "BIOS directory    $datadir"
51311d9f695Sbellardecho "binary directory  $bindir"
51411d9f695Sbellardif test "$mingw32" = "no" ; then
51511d9f695Sbellardecho "Manual directory  $mandir"
51643ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
51711d9f695Sbellardfi
5185a67135aSbellardecho "Source path       $source_path"
5197d13299dSbellardecho "C compiler        $cc"
52083469015Sbellardecho "Host C compiler   $host_cc"
5217d13299dSbellardecho "make              $make"
5226a882643Spbrookecho "install           $install"
523a98fd896Sbellardecho "host CPU          $cpu"
524de83cd02Sbellardecho "host big endian   $bigendian"
52597a847bcSbellardecho "target list       $target_list"
5267d13299dSbellardecho "gprof enabled     $gprof"
52705c2a3e7Sbellardecho "profiler          $profiler"
52843ce4dfeSbellardecho "static build      $static"
5295b0753e0Sbellardif test "$darwin" = "yes" ; then
5305b0753e0Sbellard    echo "Cocoa support     $cocoa"
5315b0753e0Sbellardfi
53297a847bcSbellardecho "SDL support       $sdl"
533e4afee97Sbellardif test "$sdl" != "no" ; then
5347c1f25b4Sbellard    echo "SDL static link   $sdl_static"
535e4afee97Sbellardfi
53667b915a5Sbellardecho "mingw32 support   $mingw32"
537fb065187Sbellardecho "Adlib support     $adlib"
5381d14ffa9Sbellardecho "CoreAudio support $coreaudio"
5391d14ffa9Sbellardecho "ALSA support      $alsa"
5401d14ffa9Sbellardecho "DSound support    $dsound"
5411d14ffa9Sbellardif test "$fmod" = "yes"; then
5421d14ffa9Sbellard    if test -z $fmod_lib || test -z $fmod_inc; then
5431d14ffa9Sbellard        echo
5441d14ffa9Sbellard        echo "Error: You must specify path to FMOD library and headers"
5451d14ffa9Sbellard        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
5461d14ffa9Sbellard        echo
5471d14ffa9Sbellard        exit 1
5481d14ffa9Sbellard    fi
549b1a550a0Spbrook    fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
550b1a550a0Spbrookelse
551b1a550a0Spbrook    fmod_support=""
552102a52e4Sbellardfi
553b1a550a0Spbrookecho "FMOD support      $fmod $fmod_support"
55407f4ddbfSbellardecho "kqemu support     $kqemu"
555cc8ae6deSpbrookecho "Documentation     $build_docs"
55667b915a5Sbellard
55797a847bcSbellardif test $sdl_too_old = "yes"; then
55824b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
559e8cd23deSbellardfi
56024b55b96Sbellard#if test "$sdl_static" = "no"; then
56124b55b96Sbellard#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
56224b55b96Sbellard#fi
56397a847bcSbellardconfig_mak="config-host.mak"
56497a847bcSbellardconfig_h="config-host.h"
56597a847bcSbellard
5667c1f25b4Sbellard#echo "Creating $config_mak and $config_h"
56797a847bcSbellard
56897a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
56929517134Spbrookecho "# Configured with: $0 $@" >> $config_mak
57097a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
57197a847bcSbellard
57297a847bcSbellardecho "prefix=$prefix" >> $config_mak
57311d9f695Sbellardecho "bindir=$bindir" >> $config_mak
5745a67135aSbellardecho "mandir=$mandir" >> $config_mak
5757efa4387Sbellardecho "datadir=$datadir" >> $config_mak
5761f50f8d1Sbellardecho "docdir=$docdir" >> $config_mak
5777efa4387Sbellardecho "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
57897a847bcSbellardecho "MAKE=$make" >> $config_mak
5796a882643Spbrookecho "INSTALL=$install" >> $config_mak
58097a847bcSbellardecho "CC=$cc" >> $config_mak
58197a847bcSbellardif test "$have_gcc3_options" = "yes" ; then
58297a847bcSbellard  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
58397a847bcSbellardfi
58497a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak
58597a847bcSbellardecho "AR=$ar" >> $config_mak
58697a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak
58797a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak
58897a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak
58967b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak
59097a847bcSbellardif test "$cpu" = "i386" ; then
59197a847bcSbellard  echo "ARCH=i386" >> $config_mak
59297a847bcSbellard  echo "#define HOST_I386 1" >> $config_h
5930b0babc6Sbellardelif test "$cpu" = "x86_64" ; then
5940b0babc6Sbellard  echo "ARCH=x86_64" >> $config_mak
5950b0babc6Sbellard  echo "#define HOST_X86_64 1" >> $config_h
596808c4954Sbellardelif test "$cpu" = "armv4b" ; then
597808c4954Sbellard  echo "ARCH=arm" >> $config_mak
598808c4954Sbellard  echo "#define HOST_ARM 1" >> $config_h
5997d13299dSbellardelif test "$cpu" = "armv4l" ; then
60097a847bcSbellard  echo "ARCH=arm" >> $config_mak
60197a847bcSbellard  echo "#define HOST_ARM 1" >> $config_h
6027d13299dSbellardelif test "$cpu" = "powerpc" ; then
60397a847bcSbellard  echo "ARCH=ppc" >> $config_mak
60497a847bcSbellard  echo "#define HOST_PPC 1" >> $config_h
6057d13299dSbellardelif test "$cpu" = "mips" ; then
60697a847bcSbellard  echo "ARCH=mips" >> $config_mak
60797a847bcSbellard  echo "#define HOST_MIPS 1" >> $config_h
608fb3e5849Sbellardelif test "$cpu" = "s390" ; then
60997a847bcSbellard  echo "ARCH=s390" >> $config_mak
61097a847bcSbellard  echo "#define HOST_S390 1" >> $config_h
611295defa5Sbellardelif test "$cpu" = "alpha" ; then
61297a847bcSbellard  echo "ARCH=alpha" >> $config_mak
61397a847bcSbellard  echo "#define HOST_ALPHA 1" >> $config_h
614ae228531Sbellardelif test "$cpu" = "sparc" ; then
61597a847bcSbellard  echo "ARCH=sparc" >> $config_mak
61697a847bcSbellard  echo "#define HOST_SPARC 1" >> $config_h
617ae228531Sbellardelif test "$cpu" = "sparc64" ; then
61897a847bcSbellard  echo "ARCH=sparc64" >> $config_mak
61997a847bcSbellard  echo "#define HOST_SPARC64 1" >> $config_h
620a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then
62197a847bcSbellard  echo "ARCH=ia64" >> $config_mak
62297a847bcSbellard  echo "#define HOST_IA64 1" >> $config_h
62338e584a0Sbellardelif test "$cpu" = "m68k" ; then
62438ca2abcSbellard  echo "ARCH=m68k" >> $config_mak
62538ca2abcSbellard  echo "#define HOST_M68K 1" >> $config_h
6267d13299dSbellardelse
6277d13299dSbellard  echo "Unsupported CPU"
6287d13299dSbellard  exit 1
6297d13299dSbellardfi
6307d13299dSbellardif test "$bigendian" = "yes" ; then
63197a847bcSbellard  echo "WORDS_BIGENDIAN=yes" >> $config_mak
63297a847bcSbellard  echo "#define WORDS_BIGENDIAN 1" >> $config_h
63397a847bcSbellardfi
634b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h
63567b915a5Sbellardif test "$mingw32" = "yes" ; then
63667b915a5Sbellard  echo "CONFIG_WIN32=yes" >> $config_mak
63711d9f695Sbellard  echo "#define CONFIG_WIN32 1" >> $config_h
6387d3505c5Sbellardelif test -f "/usr/include/byteswap.h" ; then
63997a847bcSbellard  echo "#define HAVE_BYTESWAP_H 1" >> $config_h
64067b915a5Sbellardfi
64183fb7adfSbellardif test "$darwin" = "yes" ; then
64283fb7adfSbellard  echo "CONFIG_DARWIN=yes" >> $config_mak
64383fb7adfSbellard  echo "#define CONFIG_DARWIN 1" >> $config_h
64483fb7adfSbellardfi
645ec530c81Sbellardif test "$solaris" = "yes" ; then
646ec530c81Sbellard  echo "CONFIG_SOLARIS=yes" >> $config_mak
64738cfa06cSbellard  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
648ec530c81Sbellardfi
64967b915a5Sbellardif test "$gdbstub" = "yes" ; then
65067b915a5Sbellard  echo "CONFIG_GDBSTUB=yes" >> $config_mak
65167b915a5Sbellard  echo "#define CONFIG_GDBSTUB 1" >> $config_h
65267b915a5Sbellardfi
65397a847bcSbellardif test "$gprof" = "yes" ; then
65497a847bcSbellard  echo "TARGET_GPROF=yes" >> $config_mak
65597a847bcSbellard  echo "#define HAVE_GPROF 1" >> $config_h
65697a847bcSbellardfi
65797a847bcSbellardif test "$static" = "yes" ; then
65897a847bcSbellard  echo "CONFIG_STATIC=yes" >> $config_mak
65950863472Sbellard  echo "#define CONFIG_STATIC 1" >> $config_h
66097a847bcSbellardfi
66105c2a3e7Sbellardif test $profiler = "yes" ; then
66205c2a3e7Sbellard  echo "#define CONFIG_PROFILER 1" >> $config_h
66305c2a3e7Sbellardfi
664c20709aaSbellardif test "$slirp" = "yes" ; then
665c20709aaSbellard  echo "CONFIG_SLIRP=yes" >> $config_mak
666c20709aaSbellard  echo "#define CONFIG_SLIRP 1" >> $config_h
667c20709aaSbellardfi
668fb065187Sbellardif test "$adlib" = "yes" ; then
669fb065187Sbellard  echo "CONFIG_ADLIB=yes" >> $config_mak
670fb065187Sbellard  echo "#define CONFIG_ADLIB 1" >> $config_h
671fb065187Sbellardfi
672fb065187Sbellardif test "$oss" = "yes" ; then
673fb065187Sbellard  echo "CONFIG_OSS=yes" >> $config_mak
674fb065187Sbellard  echo "#define CONFIG_OSS 1" >> $config_h
675fb065187Sbellardfi
6761d14ffa9Sbellardif test "$coreaudio" = "yes" ; then
6771d14ffa9Sbellard  echo "CONFIG_COREAUDIO=yes" >> $config_mak
6781d14ffa9Sbellard  echo "#define CONFIG_COREAUDIO 1" >> $config_h
6791d14ffa9Sbellardfi
6801d14ffa9Sbellardif test "$alsa" = "yes" ; then
6811d14ffa9Sbellard  echo "CONFIG_ALSA=yes" >> $config_mak
6821d14ffa9Sbellard  echo "#define CONFIG_ALSA 1" >> $config_h
6831d14ffa9Sbellardfi
6841d14ffa9Sbellardif test "$dsound" = "yes" ; then
6851d14ffa9Sbellard  echo "CONFIG_DSOUND=yes" >> $config_mak
6861d14ffa9Sbellard  echo "#define CONFIG_DSOUND 1" >> $config_h
6871d14ffa9Sbellardfi
688102a52e4Sbellardif test "$fmod" = "yes" ; then
689102a52e4Sbellard  echo "CONFIG_FMOD=yes" >> $config_mak
690102a52e4Sbellard  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
691102a52e4Sbellard  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
692102a52e4Sbellard  echo "#define CONFIG_FMOD 1" >> $config_h
693102a52e4Sbellardfi
694b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
695b1a550a0Spbrookecho "VERSION=$qemu_version" >>$config_mak
696d4b8f039Spbrookecho "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
69797a847bcSbellard
69897a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak
699ad064840Spbrookif [ "$source_path_used" = "yes" ]; then
700ad064840Spbrook  echo "VPATH=$source_path" >> $config_mak
701ad064840Spbrookfi
70297a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak
703cc8ae6deSpbrookif [ "$build_docs" = "yes" ] ; then
704cc8ae6deSpbrook  echo "BUILD_DOCS=yes" >> $config_mak
705cc8ae6deSpbrookfi
70697a847bcSbellard
70783fb7adfSbellard# XXX: suppress that
7087d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
70943003046Sbellard  echo "#define O_LARGEFILE 0" >> $config_h
71043003046Sbellard  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
7117d3505c5Sbellard  echo "#define _BSD 1" >> $config_h
7127d3505c5Sbellardfi
7137d3505c5Sbellard
71497a847bcSbellardfor target in $target_list; do
71597a847bcSbellardtarget_dir="$target"
71697a847bcSbellardconfig_mak=$target_dir/config.mak
71797a847bcSbellardconfig_h=$target_dir/config.h
71897a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1`
71997a847bcSbellardtarget_bigendian="no"
720808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes
7211e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes
72264b3ab24Sbellard[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
72367867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes
724a2458627Sbellard[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
725d3258560Sbellard[ "$target_cpu" = "mips" ] && target_bigendian=yes
72697a847bcSbellardtarget_softmmu="no"
72797a847bcSbellardif expr $target : '.*-softmmu' > /dev/null ; then
72897a847bcSbellard  target_softmmu="yes"
7297d13299dSbellardfi
730997344f3Sbellardtarget_user_only="no"
731997344f3Sbellardif expr $target : '.*-user' > /dev/null ; then
732997344f3Sbellard  target_user_only="yes"
733997344f3Sbellardfi
734de83cd02Sbellard
73597ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
73697ccc689Sbellard        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
73797ccc689Sbellard    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
7389c038506Spbrook    echo "To build QEMU without graphical output configure with --disable-gfx-check"
73997ccc689Sbellard    echo "Note that this will disable all output from the virtual graphics card."
74097ccc689Sbellard    exit 1;
74197ccc689Sbellardfi
74297ccc689Sbellard
7437c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
74497a847bcSbellard
74597a847bcSbellardmkdir -p $target_dir
746158142c2Sbellardmkdir -p $target_dir/fpu
747808c4954Sbellardif test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
74869de927cSbellard  mkdir -p $target_dir/nwfpe
74969de927cSbellardfi
750a7e61ed4Sbellardif test "$target_user_only" = "no" ; then
751a7e61ed4Sbellard  mkdir -p $target_dir/slirp
752a7e61ed4Sbellardfi
75369de927cSbellard
754ec530c81Sbellard#
755ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link
756ec530c81Sbellard#
757ec530c81Sbellardrm -f $target_dir/Makefile
758ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile
759ec530c81Sbellard
76097a847bcSbellard
76197a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
76297a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
76397a847bcSbellard
76497a847bcSbellard
76597a847bcSbellardecho "include ../config-host.mak" >> $config_mak
76697a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h
7671e43adfcSbellard
7681e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
7691e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
77097a847bcSbellard
77197a847bcSbellardif test "$target_cpu" = "i386" ; then
77297a847bcSbellard  echo "TARGET_ARCH=i386" >> $config_mak
77397a847bcSbellard  echo "#define TARGET_ARCH \"i386\"" >> $config_h
77497a847bcSbellard  echo "#define TARGET_I386 1" >> $config_h
77507f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
776824d560fSbellard    echo "#define USE_KQEMU 1" >> $config_h
777824d560fSbellard  fi
778808c4954Sbellardelif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
77997a847bcSbellard  echo "TARGET_ARCH=arm" >> $config_mak
78097a847bcSbellard  echo "#define TARGET_ARCH \"arm\"" >> $config_h
78197a847bcSbellard  echo "#define TARGET_ARM 1" >> $config_h
7821e43adfcSbellardelif test "$target_cpu" = "sparc" ; then
7831e43adfcSbellard  echo "TARGET_ARCH=sparc" >> $config_mak
7841e43adfcSbellard  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
7851e43adfcSbellard  echo "#define TARGET_SPARC 1" >> $config_h
78664b3ab24Sbellardelif test "$target_cpu" = "sparc64" ; then
78764b3ab24Sbellard  echo "TARGET_ARCH=sparc64" >> $config_mak
78864b3ab24Sbellard  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
78964b3ab24Sbellard  echo "#define TARGET_SPARC 1" >> $config_h
79064b3ab24Sbellard  echo "#define TARGET_SPARC64 1" >> $config_h
79167867308Sbellardelif test "$target_cpu" = "ppc" ; then
79267867308Sbellard  echo "TARGET_ARCH=ppc" >> $config_mak
79367867308Sbellard  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
79467867308Sbellard  echo "#define TARGET_PPC 1" >> $config_h
795a2458627Sbellardelif test "$target_cpu" = "ppc64" ; then
796a2458627Sbellard  echo "TARGET_ARCH=ppc64" >> $config_mak
797a2458627Sbellard  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
798a2458627Sbellard  echo "#define TARGET_PPC 1" >> $config_h
799a2458627Sbellard  echo "#define TARGET_PPC64 1" >> $config_h
8000b0babc6Sbellardelif test "$target_cpu" = "x86_64" ; then
8010b0babc6Sbellard  echo "TARGET_ARCH=x86_64" >> $config_mak
8020b0babc6Sbellard  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
8030b0babc6Sbellard  echo "#define TARGET_I386 1" >> $config_h
8040b0babc6Sbellard  echo "#define TARGET_X86_64 1" >> $config_h
80507f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
80607f4ddbfSbellard    echo "#define USE_KQEMU 1" >> $config_h
80707f4ddbfSbellard  fi
808c20eb473Sbellardelif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
809d3258560Sbellard  echo "TARGET_ARCH=mips" >> $config_mak
810d3258560Sbellard  echo "#define TARGET_ARCH \"mips\"" >> $config_h
811d3258560Sbellard  echo "#define TARGET_MIPS 1" >> $config_h
812fdf9b3e8Sbellardelif test "$target_cpu" = "sh4" ; then
813fdf9b3e8Sbellard  echo "TARGET_ARCH=sh4" >> $config_mak
814fdf9b3e8Sbellard  echo "#define TARGET_ARCH \"sh4\"" >> $config_h
815fdf9b3e8Sbellard  echo "#define TARGET_SH4 1" >> $config_h
816de83cd02Sbellardelse
817de83cd02Sbellard  echo "Unsupported target CPU"
818de83cd02Sbellard  exit 1
819de83cd02Sbellardfi
820de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
82197a847bcSbellard  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
82297a847bcSbellard  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
82397a847bcSbellardfi
82497a847bcSbellardif test "$target_softmmu" = "yes" ; then
82597a847bcSbellard  echo "CONFIG_SOFTMMU=yes" >> $config_mak
82697a847bcSbellard  echo "#define CONFIG_SOFTMMU 1" >> $config_h
827de83cd02Sbellardfi
828997344f3Sbellardif test "$target_user_only" = "yes" ; then
829997344f3Sbellard  echo "CONFIG_USER_ONLY=yes" >> $config_mak
830997344f3Sbellard  echo "#define CONFIG_USER_ONLY 1" >> $config_h
831997344f3Sbellardfi
832de83cd02Sbellard
833158142c2Sbellardif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
834158142c2Sbellard  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
835158142c2Sbellard  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
836158142c2Sbellardfi
8377c1f25b4Sbellard# sdl defines
8387c1f25b4Sbellard
8397c1f25b4Sbellardif test "$target_user_only" = "no"; then
8407c1f25b4Sbellard    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
841dbb2c921Sbellard        sdl1=$sdl_static
8427c1f25b4Sbellard    else
843dbb2c921Sbellard        sdl1=$sdl
844dbb2c921Sbellard    fi
845dbb2c921Sbellard    if test "$sdl1" = "yes" ; then
8467c1f25b4Sbellard        echo "#define CONFIG_SDL 1" >> $config_h
8477c1f25b4Sbellard        echo "CONFIG_SDL=yes" >> $config_mak
848dbb2c921Sbellard        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
849dbb2c921Sbellard            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
850dbb2c921Sbellard        else
8517c1f25b4Sbellard            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
8527c1f25b4Sbellard        fi
8537c1f25b4Sbellard        if [ "${aa}" = "yes" ] ; then
854b1a550a0Spbrook            echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
855b1a550a0Spbrook        else
856b1a550a0Spbrook            echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
8577c1f25b4Sbellard        fi
8587c1f25b4Sbellard    fi
859dbb2c921Sbellardfi
8607c1f25b4Sbellard
8615b0753e0Sbellardif test "$cocoa" = "yes" ; then
8625b0753e0Sbellard    echo "#define CONFIG_COCOA 1" >> $config_h
8635b0753e0Sbellard    echo "CONFIG_COCOA=yes" >> $config_mak
8645b0753e0Sbellardfi
8655b0753e0Sbellard
86697a847bcSbellarddone # for target in $targets
8677d13299dSbellard
8687d13299dSbellard# build tree in object directory if source path is different from current one
8697d13299dSbellardif test "$source_path_used" = "yes" ; then
8707d13299dSbellard    DIRS="tests"
8717d13299dSbellard    FILES="Makefile tests/Makefile"
8727d13299dSbellard    for dir in $DIRS ; do
8737d13299dSbellard            mkdir -p $dir
8747d13299dSbellard    done
875ec530c81Sbellard    # remove the link and recreate it, as not all "ln -sf" overwrite the link
8767d13299dSbellard    for f in $FILES ; do
877ec530c81Sbellard        rm -f $f
878ec530c81Sbellard        ln -s $source_path/$f $f
8797d13299dSbellard    done
8807d13299dSbellardfi
8817d13299dSbellard
88297a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS
883