xref: /openbmc/qemu/configure (revision 215cf0be)
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
29694ac5158Spbrookif [ ! -x "`which $cc`" ] ; then
297a7350fa1Sbellard    echo "Compiler $cc could not be found"
298a7350fa1Sbellard    exit
299a7350fa1Sbellardfi
300a7350fa1Sbellard
30167b915a5Sbellardif test "$mingw32" = "yes" ; then
3025327cf48Sbellard    linux="no"
30367b915a5Sbellard    EXESUF=".exe"
30467b915a5Sbellard    gdbstub="no"
3059f059ecaSbellard    oss="no"
30607f4ddbfSbellard    if [ "$cpu" = "i386" ] ; then
30707f4ddbfSbellard        kqemu="yes"
30807f4ddbfSbellard    fi
30967b915a5Sbellardfi
31067b915a5Sbellard
311ec530c81Sbellard#
312ec530c81Sbellard# Solaris specific configure tool chain decisions
313ec530c81Sbellard#
314ec530c81Sbellardif test "$solaris" = "yes" ; then
315ec530c81Sbellard  #
316ec530c81Sbellard  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
317ec530c81Sbellard  # override the check with --disable-gcc-check
318ec530c81Sbellard  #
319ec530c81Sbellard  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
320ec530c81Sbellard    solgcc=`which $cc`
321ec530c81Sbellard    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
322ec530c81Sbellard      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
323ec530c81Sbellard      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
324ec530c81Sbellard      echo "or get the latest patch from SunSolve for gcc"
325ec530c81Sbellard      exit 1
326ec530c81Sbellard    fi
327ec530c81Sbellard  fi
328ec530c81Sbellard  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
329ec530c81Sbellard  if test -z "$solinst" ; then
330ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
331ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
332ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
333ec530c81Sbellard    exit 1
334ec530c81Sbellard  fi
335ec530c81Sbellard  if test "$solinst" = "/usr/sbin/install" ; then
336ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
337ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
338ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
339ec530c81Sbellard    exit 1
340ec530c81Sbellard  fi
341ec530c81Sbellard  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
342ec530c81Sbellard  if test -z "$sol_ar" ; then
343ec530c81Sbellard    echo "Error: No path includes ar"
344ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
345ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
346ec530c81Sbellard    fi
347ec530c81Sbellard    exit 1
348ec530c81Sbellard  fi
349ec530c81Sbellardfi
350ec530c81Sbellard
351ec530c81Sbellard
3525327cf48Sbellardif test -z "$target_list" ; then
3535327cf48Sbellard# these targets are portable
3540a8e90f4Spbrook    if [ "$softmmu" = "yes" ] ; then
35538260998Spbrook        target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
3560a8e90f4Spbrook    fi
3575327cf48Sbellard# the following are Linux specific
3580a8e90f4Spbrook    if [ "$user" = "yes" ] ; then
359*215cf0beSbellard        target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
3605327cf48Sbellard    fi
3616e20a45fSbellardelse
362b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
3635327cf48Sbellardfi
3640a8e90f4Spbrookif test -z "$target_list" ; then
3650a8e90f4Spbrook    echo "No targets enabled"
3660a8e90f4Spbrook    exit 1
3670a8e90f4Spbrookfi
3685327cf48Sbellard
3697d13299dSbellardif test -z "$cross_prefix" ; then
3707d13299dSbellard
3717d13299dSbellard# ---
3727d13299dSbellard# big/little endian test
3737d13299dSbellardcat > $TMPC << EOF
3747d13299dSbellard#include <inttypes.h>
3757d13299dSbellardint main(int argc, char ** argv){
3767d13299dSbellard        volatile uint32_t i=0x01234567;
3777d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
3787d13299dSbellard}
3797d13299dSbellardEOF
3807d13299dSbellard
3817d13299dSbellardif $cc -o $TMPE $TMPC 2>/dev/null ; then
3827d13299dSbellard$TMPE && bigendian="yes"
3837d13299dSbellardelse
3847d13299dSbellardecho big/little test failed
3857d13299dSbellardfi
3867d13299dSbellard
3877d13299dSbellardelse
3887d13299dSbellard
3897d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
390808c4954Sbellardif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
3917d13299dSbellard    bigendian="yes"
3927d13299dSbellardfi
3937d13299dSbellard
3947d13299dSbellardfi
3957d13299dSbellard
396b6853697Sbellard# host long bits test
397b6853697Sbellardhostlongbits="32"
398b6853697Sbellardif test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
399b6853697Sbellard    hostlongbits="64"
400b6853697Sbellardfi
401b6853697Sbellard
402e8cd23deSbellard# check gcc options support
40304369ff2Sbellardcat > $TMPC <<EOF
40404369ff2Sbellardint main(void) {
40504369ff2Sbellard}
40604369ff2SbellardEOF
40704369ff2Sbellard
408e8cd23deSbellardhave_gcc3_options="no"
409e8cd23deSbellardif $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
410e8cd23deSbellard   have_gcc3_options="yes"
41104369ff2Sbellardfi
412ca735206Sbellard
413b1a550a0Spbrook# Check for gcc4, error if pre-gcc4
4141aff381fSbellardif test "$check_gcc" = "yes" ; then
4151aff381fSbellard    cat > $TMPC <<EOF
416b1a550a0Spbrook#if __GNUC__ < 4
417b1a550a0Spbrook#error gcc3
4181aff381fSbellard#endif
4191aff381fSbellardint main(){return 0;}
4201aff381fSbellardEOF
421b1a550a0Spbrook    if $cc -o $TMPO $TMPC 2>/dev/null ; then
4221aff381fSbellard        echo "ERROR: \"$cc\" looks like gcc 4.x"
4231aff381fSbellard        echo "QEMU is known to have problems when compiled with gcc 4.x"
4241aff381fSbellard        echo "It is recommended that you use gcc 3.x to build QEMU"
4251aff381fSbellard        echo "To use this compiler anyway, configure with --disable-gcc-check"
4261aff381fSbellard        exit 1;
4271aff381fSbellard    fi
4281aff381fSbellardfi
4291aff381fSbellard
43011d9f695Sbellard##########################################
43111d9f695Sbellard# SDL probe
43211d9f695Sbellard
43311d9f695Sbellardsdl_too_old=no
43411d9f695Sbellard
43511d9f695Sbellardif test -z "$sdl" ; then
43611d9f695Sbellard
437a6e022adSbellardsdl_config="sdl-config"
438a6e022adSbellardsdl=no
4397c1f25b4Sbellardsdl_static=no
440a6e022adSbellard
441a6e022adSbellardif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
442a6e022adSbellard# win32 cross compilation case
443a6e022adSbellard    sdl_config="i386-mingw32msvc-sdl-config"
444a6e022adSbellard    sdl=yes
445a6e022adSbellardelse
446a6e022adSbellard# normal SDL probe
44711d9f695Sbellardcat > $TMPC << EOF
44811d9f695Sbellard#include <SDL.h>
44911d9f695Sbellard#undef main /* We don't want SDL to override our main() */
45011d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
45111d9f695SbellardEOF
45211d9f695Sbellard
453a6e022adSbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
454a6e022adSbellard_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
45511d9f695Sbellardif test "$_sdlversion" -lt 121 ; then
45611d9f695Sbellardsdl_too_old=yes
45711d9f695Sbellardelse
45811d9f695Sbellardsdl=yes
45911d9f695Sbellardfi
4607c1f25b4Sbellard
4617c1f25b4Sbellard# static link with sdl ?
4627c1f25b4Sbellardif test "$sdl" = "yes" ; then
4637c1f25b4Sbellardaa="no"
4647c1f25b4Sbellard`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
4657c1f25b4Sbellardsdl_static_libs=`$sdl_config --static-libs`
4667c1f25b4Sbellardif [ "$aa" = "yes" ] ; then
467d8d8aa4eSbellard  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
46811d9f695Sbellardfi
46911d9f695Sbellard
4707c1f25b4Sbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
4717c1f25b4Sbellard  sdl_static=yes
4727c1f25b4Sbellardfi
4737c1f25b4Sbellard
4747c1f25b4Sbellardfi # static link
4757c1f25b4Sbellard
4767c1f25b4Sbellardfi # sdl compile test
4777c1f25b4Sbellard
478a6e022adSbellardfi # cross compilation
479a6e022adSbellardfi # -z $sdl
48011d9f695Sbellard
481cc8ae6deSpbrook# Check if tools are available to build documentation.
48294ac5158Spbrookif [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
483cc8ae6deSpbrook  build_docs="yes"
484cc8ae6deSpbrookfi
485cc8ae6deSpbrook
48611d9f695Sbellardif test "$mingw32" = "yes" ; then
48711d9f695Sbellardif test -z "$prefix" ; then
48811d9f695Sbellard    prefix="/c/Program Files/Qemu"
48911d9f695Sbellardfi
49011d9f695Sbellardmandir="$prefix"
4917efa4387Sbellarddatadir="$prefix"
4921f50f8d1Sbellarddocdir="$prefix"
49311d9f695Sbellardbindir="$prefix"
49411d9f695Sbellardelse
49511d9f695Sbellardif test -z "$prefix" ; then
49611d9f695Sbellard    prefix="/usr/local"
49711d9f695Sbellardfi
4985a67135aSbellardmandir="$prefix/share/man"
4997efa4387Sbellarddatadir="$prefix/share/qemu"
5001f50f8d1Sbellarddocdir="$prefix/share/doc/qemu"
50111d9f695Sbellardbindir="$prefix/bin"
50211d9f695Sbellardfi
5035a67135aSbellard
5047d13299dSbellardecho "Install prefix    $prefix"
5057efa4387Sbellardecho "BIOS directory    $datadir"
50611d9f695Sbellardecho "binary directory  $bindir"
50711d9f695Sbellardif test "$mingw32" = "no" ; then
50811d9f695Sbellardecho "Manual directory  $mandir"
50943ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
51011d9f695Sbellardfi
5115a67135aSbellardecho "Source path       $source_path"
5127d13299dSbellardecho "C compiler        $cc"
51383469015Sbellardecho "Host C compiler   $host_cc"
5147d13299dSbellardecho "make              $make"
5156a882643Spbrookecho "install           $install"
516a98fd896Sbellardecho "host CPU          $cpu"
517de83cd02Sbellardecho "host big endian   $bigendian"
51897a847bcSbellardecho "target list       $target_list"
5197d13299dSbellardecho "gprof enabled     $gprof"
52005c2a3e7Sbellardecho "profiler          $profiler"
52143ce4dfeSbellardecho "static build      $static"
5225b0753e0Sbellardif test "$darwin" = "yes" ; then
5235b0753e0Sbellard    echo "Cocoa support     $cocoa"
5245b0753e0Sbellardfi
52597a847bcSbellardecho "SDL support       $sdl"
526e4afee97Sbellardif test "$sdl" != "no" ; then
5277c1f25b4Sbellard    echo "SDL static link   $sdl_static"
528e4afee97Sbellardfi
52967b915a5Sbellardecho "mingw32 support   $mingw32"
530fb065187Sbellardecho "Adlib support     $adlib"
5311d14ffa9Sbellardecho "CoreAudio support $coreaudio"
5321d14ffa9Sbellardecho "ALSA support      $alsa"
5331d14ffa9Sbellardecho "DSound support    $dsound"
5341d14ffa9Sbellardif test "$fmod" = "yes"; then
5351d14ffa9Sbellard    if test -z $fmod_lib || test -z $fmod_inc; then
5361d14ffa9Sbellard        echo
5371d14ffa9Sbellard        echo "Error: You must specify path to FMOD library and headers"
5381d14ffa9Sbellard        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
5391d14ffa9Sbellard        echo
5401d14ffa9Sbellard        exit 1
5411d14ffa9Sbellard    fi
542b1a550a0Spbrook    fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
543b1a550a0Spbrookelse
544b1a550a0Spbrook    fmod_support=""
545102a52e4Sbellardfi
546b1a550a0Spbrookecho "FMOD support      $fmod $fmod_support"
54707f4ddbfSbellardecho "kqemu support     $kqemu"
548cc8ae6deSpbrookecho "Documentation     $build_docs"
54967b915a5Sbellard
55097a847bcSbellardif test $sdl_too_old = "yes"; then
55124b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
552e8cd23deSbellardfi
55324b55b96Sbellard#if test "$sdl_static" = "no"; then
55424b55b96Sbellard#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
55524b55b96Sbellard#fi
55697a847bcSbellardconfig_mak="config-host.mak"
55797a847bcSbellardconfig_h="config-host.h"
55897a847bcSbellard
5597c1f25b4Sbellard#echo "Creating $config_mak and $config_h"
56097a847bcSbellard
56197a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
56229517134Spbrookecho "# Configured with: $0 $@" >> $config_mak
56397a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
56497a847bcSbellard
56597a847bcSbellardecho "prefix=$prefix" >> $config_mak
56611d9f695Sbellardecho "bindir=$bindir" >> $config_mak
5675a67135aSbellardecho "mandir=$mandir" >> $config_mak
5687efa4387Sbellardecho "datadir=$datadir" >> $config_mak
5691f50f8d1Sbellardecho "docdir=$docdir" >> $config_mak
5707efa4387Sbellardecho "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
57197a847bcSbellardecho "MAKE=$make" >> $config_mak
5726a882643Spbrookecho "INSTALL=$install" >> $config_mak
57397a847bcSbellardecho "CC=$cc" >> $config_mak
57497a847bcSbellardif test "$have_gcc3_options" = "yes" ; then
57597a847bcSbellard  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
57697a847bcSbellardfi
57797a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak
57897a847bcSbellardecho "AR=$ar" >> $config_mak
57997a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak
58097a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak
58197a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak
58267b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak
58397a847bcSbellardif test "$cpu" = "i386" ; then
58497a847bcSbellard  echo "ARCH=i386" >> $config_mak
58597a847bcSbellard  echo "#define HOST_I386 1" >> $config_h
5860b0babc6Sbellardelif test "$cpu" = "x86_64" ; then
5870b0babc6Sbellard  echo "ARCH=x86_64" >> $config_mak
5880b0babc6Sbellard  echo "#define HOST_X86_64 1" >> $config_h
589808c4954Sbellardelif test "$cpu" = "armv4b" ; then
590808c4954Sbellard  echo "ARCH=arm" >> $config_mak
591808c4954Sbellard  echo "#define HOST_ARM 1" >> $config_h
5927d13299dSbellardelif test "$cpu" = "armv4l" ; then
59397a847bcSbellard  echo "ARCH=arm" >> $config_mak
59497a847bcSbellard  echo "#define HOST_ARM 1" >> $config_h
5957d13299dSbellardelif test "$cpu" = "powerpc" ; then
59697a847bcSbellard  echo "ARCH=ppc" >> $config_mak
59797a847bcSbellard  echo "#define HOST_PPC 1" >> $config_h
5987d13299dSbellardelif test "$cpu" = "mips" ; then
59997a847bcSbellard  echo "ARCH=mips" >> $config_mak
60097a847bcSbellard  echo "#define HOST_MIPS 1" >> $config_h
601fb3e5849Sbellardelif test "$cpu" = "s390" ; then
60297a847bcSbellard  echo "ARCH=s390" >> $config_mak
60397a847bcSbellard  echo "#define HOST_S390 1" >> $config_h
604295defa5Sbellardelif test "$cpu" = "alpha" ; then
60597a847bcSbellard  echo "ARCH=alpha" >> $config_mak
60697a847bcSbellard  echo "#define HOST_ALPHA 1" >> $config_h
607ae228531Sbellardelif test "$cpu" = "sparc" ; then
60897a847bcSbellard  echo "ARCH=sparc" >> $config_mak
60997a847bcSbellard  echo "#define HOST_SPARC 1" >> $config_h
610ae228531Sbellardelif test "$cpu" = "sparc64" ; then
61197a847bcSbellard  echo "ARCH=sparc64" >> $config_mak
61297a847bcSbellard  echo "#define HOST_SPARC64 1" >> $config_h
613a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then
61497a847bcSbellard  echo "ARCH=ia64" >> $config_mak
61597a847bcSbellard  echo "#define HOST_IA64 1" >> $config_h
61638e584a0Sbellardelif test "$cpu" = "m68k" ; then
61738ca2abcSbellard  echo "ARCH=m68k" >> $config_mak
61838ca2abcSbellard  echo "#define HOST_M68K 1" >> $config_h
6197d13299dSbellardelse
6207d13299dSbellard  echo "Unsupported CPU"
6217d13299dSbellard  exit 1
6227d13299dSbellardfi
6237d13299dSbellardif test "$bigendian" = "yes" ; then
62497a847bcSbellard  echo "WORDS_BIGENDIAN=yes" >> $config_mak
62597a847bcSbellard  echo "#define WORDS_BIGENDIAN 1" >> $config_h
62697a847bcSbellardfi
627b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h
62867b915a5Sbellardif test "$mingw32" = "yes" ; then
62967b915a5Sbellard  echo "CONFIG_WIN32=yes" >> $config_mak
63011d9f695Sbellard  echo "#define CONFIG_WIN32 1" >> $config_h
6317d3505c5Sbellardelif test -f "/usr/include/byteswap.h" ; then
63297a847bcSbellard  echo "#define HAVE_BYTESWAP_H 1" >> $config_h
63367b915a5Sbellardfi
63483fb7adfSbellardif test "$darwin" = "yes" ; then
63583fb7adfSbellard  echo "CONFIG_DARWIN=yes" >> $config_mak
63683fb7adfSbellard  echo "#define CONFIG_DARWIN 1" >> $config_h
63783fb7adfSbellardfi
638ec530c81Sbellardif test "$solaris" = "yes" ; then
639ec530c81Sbellard  echo "CONFIG_SOLARIS=yes" >> $config_mak
64038cfa06cSbellard  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
641ec530c81Sbellardfi
64267b915a5Sbellardif test "$gdbstub" = "yes" ; then
64367b915a5Sbellard  echo "CONFIG_GDBSTUB=yes" >> $config_mak
64467b915a5Sbellard  echo "#define CONFIG_GDBSTUB 1" >> $config_h
64567b915a5Sbellardfi
64697a847bcSbellardif test "$gprof" = "yes" ; then
64797a847bcSbellard  echo "TARGET_GPROF=yes" >> $config_mak
64897a847bcSbellard  echo "#define HAVE_GPROF 1" >> $config_h
64997a847bcSbellardfi
65097a847bcSbellardif test "$static" = "yes" ; then
65197a847bcSbellard  echo "CONFIG_STATIC=yes" >> $config_mak
65250863472Sbellard  echo "#define CONFIG_STATIC 1" >> $config_h
65397a847bcSbellardfi
65405c2a3e7Sbellardif test $profiler = "yes" ; then
65505c2a3e7Sbellard  echo "#define CONFIG_PROFILER 1" >> $config_h
65605c2a3e7Sbellardfi
657c20709aaSbellardif test "$slirp" = "yes" ; then
658c20709aaSbellard  echo "CONFIG_SLIRP=yes" >> $config_mak
659c20709aaSbellard  echo "#define CONFIG_SLIRP 1" >> $config_h
660c20709aaSbellardfi
661fb065187Sbellardif test "$adlib" = "yes" ; then
662fb065187Sbellard  echo "CONFIG_ADLIB=yes" >> $config_mak
663fb065187Sbellard  echo "#define CONFIG_ADLIB 1" >> $config_h
664fb065187Sbellardfi
665fb065187Sbellardif test "$oss" = "yes" ; then
666fb065187Sbellard  echo "CONFIG_OSS=yes" >> $config_mak
667fb065187Sbellard  echo "#define CONFIG_OSS 1" >> $config_h
668fb065187Sbellardfi
6691d14ffa9Sbellardif test "$coreaudio" = "yes" ; then
6701d14ffa9Sbellard  echo "CONFIG_COREAUDIO=yes" >> $config_mak
6711d14ffa9Sbellard  echo "#define CONFIG_COREAUDIO 1" >> $config_h
6721d14ffa9Sbellardfi
6731d14ffa9Sbellardif test "$alsa" = "yes" ; then
6741d14ffa9Sbellard  echo "CONFIG_ALSA=yes" >> $config_mak
6751d14ffa9Sbellard  echo "#define CONFIG_ALSA 1" >> $config_h
6761d14ffa9Sbellardfi
6771d14ffa9Sbellardif test "$dsound" = "yes" ; then
6781d14ffa9Sbellard  echo "CONFIG_DSOUND=yes" >> $config_mak
6791d14ffa9Sbellard  echo "#define CONFIG_DSOUND 1" >> $config_h
6801d14ffa9Sbellardfi
681102a52e4Sbellardif test "$fmod" = "yes" ; then
682102a52e4Sbellard  echo "CONFIG_FMOD=yes" >> $config_mak
683102a52e4Sbellard  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
684102a52e4Sbellard  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
685102a52e4Sbellard  echo "#define CONFIG_FMOD 1" >> $config_h
686102a52e4Sbellardfi
687b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
688b1a550a0Spbrookecho "VERSION=$qemu_version" >>$config_mak
689d4b8f039Spbrookecho "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
69097a847bcSbellard
69197a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak
692ad064840Spbrookif [ "$source_path_used" = "yes" ]; then
693ad064840Spbrook  echo "VPATH=$source_path" >> $config_mak
694ad064840Spbrookfi
69597a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak
696cc8ae6deSpbrookif [ "$build_docs" = "yes" ] ; then
697cc8ae6deSpbrook  echo "BUILD_DOCS=yes" >> $config_mak
698cc8ae6deSpbrookfi
69997a847bcSbellard
70083fb7adfSbellard# XXX: suppress that
7017d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
70243003046Sbellard  echo "#define O_LARGEFILE 0" >> $config_h
70343003046Sbellard  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
7047d3505c5Sbellard  echo "#define _BSD 1" >> $config_h
7057d3505c5Sbellardfi
7067d3505c5Sbellard
70797a847bcSbellardfor target in $target_list; do
70897a847bcSbellardtarget_dir="$target"
70997a847bcSbellardconfig_mak=$target_dir/config.mak
71097a847bcSbellardconfig_h=$target_dir/config.h
71197a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1`
71297a847bcSbellardtarget_bigendian="no"
713808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes
7141e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes
71564b3ab24Sbellard[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
71667867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes
717a2458627Sbellard[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
718d3258560Sbellard[ "$target_cpu" = "mips" ] && target_bigendian=yes
71997a847bcSbellardtarget_softmmu="no"
72097a847bcSbellardif expr $target : '.*-softmmu' > /dev/null ; then
72197a847bcSbellard  target_softmmu="yes"
7227d13299dSbellardfi
723997344f3Sbellardtarget_user_only="no"
724997344f3Sbellardif expr $target : '.*-user' > /dev/null ; then
725997344f3Sbellard  target_user_only="yes"
726997344f3Sbellardfi
727de83cd02Sbellard
72897ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
72997ccc689Sbellard        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
73097ccc689Sbellard    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
7319c038506Spbrook    echo "To build QEMU without graphical output configure with --disable-gfx-check"
73297ccc689Sbellard    echo "Note that this will disable all output from the virtual graphics card."
73397ccc689Sbellard    exit 1;
73497ccc689Sbellardfi
73597ccc689Sbellard
7367c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
73797a847bcSbellard
73897a847bcSbellardmkdir -p $target_dir
739158142c2Sbellardmkdir -p $target_dir/fpu
740808c4954Sbellardif test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
74169de927cSbellard  mkdir -p $target_dir/nwfpe
74269de927cSbellardfi
743a7e61ed4Sbellardif test "$target_user_only" = "no" ; then
744a7e61ed4Sbellard  mkdir -p $target_dir/slirp
745a7e61ed4Sbellardfi
74669de927cSbellard
747ec530c81Sbellard#
748ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link
749ec530c81Sbellard#
750ec530c81Sbellardrm -f $target_dir/Makefile
751ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile
752ec530c81Sbellard
75397a847bcSbellard
75497a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
75597a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
75697a847bcSbellard
75797a847bcSbellard
75897a847bcSbellardecho "include ../config-host.mak" >> $config_mak
75997a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h
7601e43adfcSbellard
7611e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
7621e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
76397a847bcSbellard
76497a847bcSbellardif test "$target_cpu" = "i386" ; then
76597a847bcSbellard  echo "TARGET_ARCH=i386" >> $config_mak
76697a847bcSbellard  echo "#define TARGET_ARCH \"i386\"" >> $config_h
76797a847bcSbellard  echo "#define TARGET_I386 1" >> $config_h
76807f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
769824d560fSbellard    echo "#define USE_KQEMU 1" >> $config_h
770824d560fSbellard  fi
771808c4954Sbellardelif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
77297a847bcSbellard  echo "TARGET_ARCH=arm" >> $config_mak
77397a847bcSbellard  echo "#define TARGET_ARCH \"arm\"" >> $config_h
77497a847bcSbellard  echo "#define TARGET_ARM 1" >> $config_h
7751e43adfcSbellardelif test "$target_cpu" = "sparc" ; then
7761e43adfcSbellard  echo "TARGET_ARCH=sparc" >> $config_mak
7771e43adfcSbellard  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
7781e43adfcSbellard  echo "#define TARGET_SPARC 1" >> $config_h
77964b3ab24Sbellardelif test "$target_cpu" = "sparc64" ; then
78064b3ab24Sbellard  echo "TARGET_ARCH=sparc64" >> $config_mak
78164b3ab24Sbellard  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
78264b3ab24Sbellard  echo "#define TARGET_SPARC 1" >> $config_h
78364b3ab24Sbellard  echo "#define TARGET_SPARC64 1" >> $config_h
78467867308Sbellardelif test "$target_cpu" = "ppc" ; then
78567867308Sbellard  echo "TARGET_ARCH=ppc" >> $config_mak
78667867308Sbellard  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
78767867308Sbellard  echo "#define TARGET_PPC 1" >> $config_h
788a2458627Sbellardelif test "$target_cpu" = "ppc64" ; then
789a2458627Sbellard  echo "TARGET_ARCH=ppc64" >> $config_mak
790a2458627Sbellard  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
791a2458627Sbellard  echo "#define TARGET_PPC 1" >> $config_h
792a2458627Sbellard  echo "#define TARGET_PPC64 1" >> $config_h
7930b0babc6Sbellardelif test "$target_cpu" = "x86_64" ; then
7940b0babc6Sbellard  echo "TARGET_ARCH=x86_64" >> $config_mak
7950b0babc6Sbellard  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
7960b0babc6Sbellard  echo "#define TARGET_I386 1" >> $config_h
7970b0babc6Sbellard  echo "#define TARGET_X86_64 1" >> $config_h
79807f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
79907f4ddbfSbellard    echo "#define USE_KQEMU 1" >> $config_h
80007f4ddbfSbellard  fi
801c20eb473Sbellardelif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
802d3258560Sbellard  echo "TARGET_ARCH=mips" >> $config_mak
803d3258560Sbellard  echo "#define TARGET_ARCH \"mips\"" >> $config_h
804d3258560Sbellard  echo "#define TARGET_MIPS 1" >> $config_h
805fdf9b3e8Sbellardelif test "$target_cpu" = "sh4" ; then
806fdf9b3e8Sbellard  echo "TARGET_ARCH=sh4" >> $config_mak
807fdf9b3e8Sbellard  echo "#define TARGET_ARCH \"sh4\"" >> $config_h
808fdf9b3e8Sbellard  echo "#define TARGET_SH4 1" >> $config_h
809de83cd02Sbellardelse
810de83cd02Sbellard  echo "Unsupported target CPU"
811de83cd02Sbellard  exit 1
812de83cd02Sbellardfi
813de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
81497a847bcSbellard  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
81597a847bcSbellard  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
81697a847bcSbellardfi
81797a847bcSbellardif test "$target_softmmu" = "yes" ; then
81897a847bcSbellard  echo "CONFIG_SOFTMMU=yes" >> $config_mak
81997a847bcSbellard  echo "#define CONFIG_SOFTMMU 1" >> $config_h
820de83cd02Sbellardfi
821997344f3Sbellardif test "$target_user_only" = "yes" ; then
822997344f3Sbellard  echo "CONFIG_USER_ONLY=yes" >> $config_mak
823997344f3Sbellard  echo "#define CONFIG_USER_ONLY 1" >> $config_h
824997344f3Sbellardfi
825de83cd02Sbellard
826158142c2Sbellardif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
827158142c2Sbellard  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
828158142c2Sbellard  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
829158142c2Sbellardfi
8307c1f25b4Sbellard# sdl defines
8317c1f25b4Sbellard
8327c1f25b4Sbellardif test "$target_user_only" = "no"; then
8337c1f25b4Sbellard    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
834dbb2c921Sbellard        sdl1=$sdl_static
8357c1f25b4Sbellard    else
836dbb2c921Sbellard        sdl1=$sdl
837dbb2c921Sbellard    fi
838dbb2c921Sbellard    if test "$sdl1" = "yes" ; then
8397c1f25b4Sbellard        echo "#define CONFIG_SDL 1" >> $config_h
8407c1f25b4Sbellard        echo "CONFIG_SDL=yes" >> $config_mak
841dbb2c921Sbellard        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
842dbb2c921Sbellard            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
843dbb2c921Sbellard        else
8447c1f25b4Sbellard            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
8457c1f25b4Sbellard        fi
8467c1f25b4Sbellard        if [ "${aa}" = "yes" ] ; then
847b1a550a0Spbrook            echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
848b1a550a0Spbrook        else
849b1a550a0Spbrook            echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
8507c1f25b4Sbellard        fi
8517c1f25b4Sbellard    fi
852dbb2c921Sbellardfi
8537c1f25b4Sbellard
8545b0753e0Sbellardif test "$cocoa" = "yes" ; then
8555b0753e0Sbellard    echo "#define CONFIG_COCOA 1" >> $config_h
8565b0753e0Sbellard    echo "CONFIG_COCOA=yes" >> $config_mak
8575b0753e0Sbellardfi
8585b0753e0Sbellard
85997a847bcSbellarddone # for target in $targets
8607d13299dSbellard
8617d13299dSbellard# build tree in object directory if source path is different from current one
8627d13299dSbellardif test "$source_path_used" = "yes" ; then
8637d13299dSbellard    DIRS="tests"
8647d13299dSbellard    FILES="Makefile tests/Makefile"
8657d13299dSbellard    for dir in $DIRS ; do
8667d13299dSbellard            mkdir -p $dir
8677d13299dSbellard    done
868ec530c81Sbellard    # remove the link and recreate it, as not all "ln -sf" overwrite the link
8697d13299dSbellard    for f in $FILES ; do
870ec530c81Sbellard        rm -f $f
871ec530c81Sbellard        ln -s $source_path/$f $f
8727d13299dSbellard    done
8737d13299dSbellardfi
8747d13299dSbellard
87597a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS
876