blob: 93bbe7b78b85d4de7e77f09439703d4d89cc3789 [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001#!/bin/sh
2#
bellard3ef693a2003-03-23 20:17:16 +00003# qemu configure script (c) 2003 Fabrice Bellard
bellard7d132992003-03-06 23:23:54 +00004#
5# set temporary file name
6if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10else
11 TMPDIR1="/tmp"
12fi
13
bellard3ef693a2003-03-23 20:17:16 +000014TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
bellard7d132992003-03-06 23:23:54 +000018
19# default parameters
bellard11d9f692004-04-02 20:55:59 +000020prefix=""
bellard1e43adf2003-09-30 20:54:24 +000021interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000022static="no"
bellard7d132992003-03-06 23:23:54 +000023cross_prefix=""
24cc="gcc"
pbrook328a4242006-12-19 03:31:34 +000025gcc3_search="yes"
26gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
bellard7d132992003-03-06 23:23:54 +000027host_cc="gcc"
28ar="ar"
29make="make"
pbrook6a882642006-04-17 13:57:12 +000030install="install"
bellard7d132992003-03-06 23:23:54 +000031strip="strip"
32cpu=`uname -m`
bellard5327cf42005-01-10 23:18:50 +000033target_list=""
bellard7d132992003-03-06 23:23:54 +000034case "$cpu" in
35 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +000036 cpu="i386"
bellard7d132992003-03-06 23:23:54 +000037 ;;
bellardba680552005-03-13 09:49:52 +000038 armv*b)
bellard808c4952004-12-19 23:33:47 +000039 cpu="armv4b"
40 ;;
bellardba680552005-03-13 09:49:52 +000041 armv*l)
bellard7d132992003-03-06 23:23:54 +000042 cpu="armv4l"
43 ;;
44 alpha)
45 cpu="alpha"
46 ;;
bellard295defa2003-04-07 21:31:29 +000047 "Power Macintosh"|ppc|ppc64)
bellard7d132992003-03-06 23:23:54 +000048 cpu="powerpc"
49 ;;
50 mips)
51 cpu="mips"
52 ;;
bellardfb3e5842003-03-29 17:32:36 +000053 s390)
54 cpu="s390"
55 ;;
pbrook94ac5152006-04-26 16:07:35 +000056 sparc|sun4[muv])
bellardae228532003-05-13 18:59:59 +000057 cpu="sparc"
58 ;;
59 sparc64)
60 cpu="sparc64"
61 ;;
bellarda8baa8c2003-04-29 20:53:31 +000062 ia64)
63 cpu="ia64"
64 ;;
bellard38e584a2003-08-10 22:14:22 +000065 m68k)
66 cpu="m68k"
67 ;;
bellardbc51c5c2004-03-17 23:46:04 +000068 x86_64|amd64)
bellard0b0babc2005-01-03 23:38:40 +000069 cpu="x86_64"
bellardbc51c5c2004-03-17 23:46:04 +000070 ;;
bellard7d132992003-03-06 23:23:54 +000071 *)
72 cpu="unknown"
73 ;;
74esac
75gprof="no"
76bigendian="no"
bellard67b915a2004-03-31 23:37:16 +000077mingw32="no"
78EXESUF=""
79gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +000080slirp="yes"
bellardfb065182004-11-09 23:09:44 +000081adlib="no"
82oss="no"
bellard1d14ffa2005-10-30 18:58:22 +000083dsound="no"
84coreaudio="no"
85alsa="no"
bellard102a52e2004-11-14 19:57:29 +000086fmod="no"
87fmod_lib=""
88fmod_inc=""
pbrookb1a550a2006-04-16 13:28:56 +000089bsd="no"
bellard5327cf42005-01-10 23:18:50 +000090linux="no"
bellardc9ec1fe2005-02-10 21:55:30 +000091kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +000092profiler="no"
bellard5b0753e2005-03-01 21:37:28 +000093cocoa="no"
bellard97ccc682005-07-02 13:32:17 +000094check_gfx="yes"
bellard1aff3812005-11-02 22:30:45 +000095check_gcc="yes"
pbrook0a8e90f2006-03-19 14:54:16 +000096softmmu="yes"
97user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +000098build_docs="no"
pbrookc5937222006-05-14 11:30:38 +000099uname_release=""
bellard7d132992003-03-06 23:23:54 +0000100
101# OS specific
102targetos=`uname -s`
103case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000104CYGWIN*)
105mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000106OS_CFLAGS="-mno-cygwin"
bellardc326e0a2005-04-23 18:30:28 +0000107;;
bellard67b915a2004-03-31 23:37:16 +0000108MINGW32*)
109mingw32="yes"
110;;
bellard7d3505c2004-05-12 19:32:15 +0000111FreeBSD)
112bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000113oss="yes"
bellarde99f9062005-07-28 21:45:38 +0000114if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000115 kqemu="yes"
116fi
bellard7d3505c2004-05-12 19:32:15 +0000117;;
118NetBSD)
119bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000120oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000121;;
122OpenBSD)
123bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000124oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000125;;
bellard83fb7ad2004-07-05 21:25:26 +0000126Darwin)
127bsd="yes"
128darwin="yes"
ths6f30fa82007-01-05 01:00:47 +0000129OS_CFLAGS="-mdynamic-no-pic"
bellard83fb7ad2004-07-05 21:25:26 +0000130;;
bellardec530c82006-04-25 22:36:06 +0000131SunOS)
132solaris="yes"
133;;
bellard1d14ffa2005-10-30 18:58:22 +0000134*)
bellardfb065182004-11-09 23:09:44 +0000135oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000136linux="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000137user="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000138if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000139 kqemu="yes"
140fi
bellardfb065182004-11-09 23:09:44 +0000141;;
bellard7d132992003-03-06 23:23:54 +0000142esac
143
bellard7d3505c2004-05-12 19:32:15 +0000144if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000145 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000146 make="gmake"
147 fi
bellard7d3505c2004-05-12 19:32:15 +0000148fi
149
bellardec530c82006-04-25 22:36:06 +0000150if [ "$solaris" = "yes" ] ; then
151 make="gmake"
152 install="ginstall"
153 solarisrev=`uname -r | cut -f2 -d.`
bellardec530c82006-04-25 22:36:06 +0000154fi
155
bellard7d132992003-03-06 23:23:54 +0000156# find source path
pbrookad064842006-04-16 12:41:07 +0000157source_path=`dirname "$0"`
158if [ -z "$source_path" ]; then
bellard7d132992003-03-06 23:23:54 +0000159 source_path=`pwd`
pbrookad064842006-04-16 12:41:07 +0000160else
161 source_path=`cd "$source_path"; pwd`
162fi
163if test "$source_path" = `pwd` ; then
bellard7d132992003-03-06 23:23:54 +0000164 source_path_used="no"
pbrookad064842006-04-16 12:41:07 +0000165else
166 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000167fi
168
169for opt do
pbrooka46e4032006-04-29 23:05:22 +0000170 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000171 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000172 --help|-h) show_help=yes
173 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000174 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000175 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000176 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000177 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000178 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000179 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000180 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000181 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000182 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000183 --cc=*) cc="$optarg"
pbrook328a4242006-12-19 03:31:34 +0000184 gcc3_search="no"
bellard7d132992003-03-06 23:23:54 +0000185 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000186 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000187 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000188 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000189 ;;
pbrook6a882642006-04-17 13:57:12 +0000190 --install=*) install="$optarg"
191 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000192 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000193 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000194 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000195 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000196 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000197 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000198 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000199 ;;
bellard7d132992003-03-06 23:23:54 +0000200 --enable-gprof) gprof="yes"
201 ;;
bellard43ce4df2003-06-09 19:53:12 +0000202 --static) static="yes"
203 ;;
bellard97a847b2003-08-10 21:36:04 +0000204 --disable-sdl) sdl="no"
205 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000206 --enable-coreaudio) coreaudio="yes"
207 ;;
208 --enable-alsa) alsa="yes"
209 ;;
210 --enable-dsound) dsound="yes"
211 ;;
bellard102a52e2004-11-14 19:57:29 +0000212 --enable-fmod) fmod="yes"
213 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000214 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000215 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000216 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000217 ;;
bellard87ac5422006-06-25 17:35:56 +0000218 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
bellard1d14ffa2005-10-30 18:58:22 +0000219 ;;
bellard443f1372004-06-04 11:13:20 +0000220 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000221 ;;
bellardfb065182004-11-09 23:09:44 +0000222 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000223 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000224 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000225 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000226 --enable-profiler) profiler="yes"
227 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000228 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
229 ;;
bellard97ccc682005-07-02 13:32:17 +0000230 --disable-gfx-check) check_gfx="no"
231 ;;
bellard1aff3812005-11-02 22:30:45 +0000232 --disable-gcc-check) check_gcc="no"
233 ;;
pbrookcad25d62006-03-19 16:31:11 +0000234 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000235 ;;
pbrookcad25d62006-03-19 16:31:11 +0000236 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000237 ;;
238 --disable-user) user="no"
239 ;;
240 --enable-user) user="yes"
241 ;;
pbrookc5937222006-05-14 11:30:38 +0000242 --enable-uname-release=*) uname_release="$optarg"
243 ;;
bellard7d132992003-03-06 23:23:54 +0000244 esac
245done
246
ths6f30fa82007-01-05 01:00:47 +0000247# default flags for all hosts
248CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
249LDFLAGS="$LDFLAGS -g"
250
pbrookaf5db582006-04-08 14:26:41 +0000251if test x"$show_help" = x"yes" ; then
252cat << EOF
253
254Usage: configure [options]
255Options: [defaults in brackets after descriptions]
256
257EOF
258echo "Standard options:"
259echo " --help print this message"
260echo " --prefix=PREFIX install in PREFIX [$prefix]"
261echo " --interp-prefix=PREFIX where to find shared libraries, etc."
262echo " use %M for cpu name [$interp_prefix]"
263echo " --target-list=LIST set target list [$target_list]"
264echo ""
265echo "kqemu kernel acceleration support:"
266echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000267echo ""
268echo "Advanced options (experts only):"
269echo " --source-path=PATH path of source code [$source_path]"
270echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
271echo " --cc=CC use C compiler CC [$cc]"
272echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
273echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000274echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000275echo " --static enable static build [$static]"
276echo " --enable-cocoa enable COCOA (Mac OS X only)"
277echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
278echo " --enable-adlib enable Adlib emulation"
279echo " --enable-coreaudio enable Coreaudio audio driver"
280echo " --enable-alsa enable ALSA audio driver"
281echo " --enable-fmod enable FMOD audio driver"
282echo " --enabled-dsound enable DirectSound audio driver"
283echo " --enable-system enable all system emulation targets"
284echo " --disable-system disable all system emulation targets"
285echo " --enable-user enable all linux usermode emulation targets"
286echo " --disable-user disable all linux usermode emulation targets"
287echo " --fmod-lib path to FMOD library"
288echo " --fmod-inc path to FMOD includes"
pbrookc5937222006-05-14 11:30:38 +0000289echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
pbrookaf5db582006-04-08 14:26:41 +0000290echo ""
ths5bf08932006-12-23 00:33:26 +0000291echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000292exit 1
293fi
294
bellard7d132992003-03-06 23:23:54 +0000295cc="${cross_prefix}${cc}"
296ar="${cross_prefix}${ar}"
297strip="${cross_prefix}${strip}"
298
pbrook064aae12006-05-08 00:51:44 +0000299# check that the C compiler works.
300cat > $TMPC <<EOF
301int main(void) {}
302EOF
303
304if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
305 : C compiler works ok
306else
307 echo "ERROR: \"$cc\" either does not exist or does not work"
308 exit 1
bellarda7350fa2006-04-23 14:35:23 +0000309fi
310
bellard67b915a2004-03-31 23:37:16 +0000311if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000312 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000313 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000314 oss="no"
bellard07f4ddb2005-04-23 17:44:28 +0000315 if [ "$cpu" = "i386" ] ; then
316 kqemu="yes"
317 fi
bellard67b915a2004-03-31 23:37:16 +0000318fi
319
pbrook328a4242006-12-19 03:31:34 +0000320# Check for gcc4, error if pre-gcc4
321if test "$check_gcc" = "yes" ; then
322 cat > $TMPC <<EOF
323#if __GNUC__ < 4
324#error gcc3
325#endif
326int main(){return 0;}
327EOF
328 check_cc() {
329 which "$1" >&/dev/null
330 return $?
331 }
332
333 if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
334 echo "WARNING: \"$cc\" looks like gcc 4.x"
335 found_compat_cc="no"
336 if test "$gcc3_search" = "yes" ; then
337 echo "Looking for gcc 3.x"
338 for compat_cc in $gcc3_list ; do
339 if check_cc "$compat_cc" ; then
340 echo "Found \"$compat_cc\""
341 cc="$compat_cc"
342 found_compat_cc="yes"
343 break
344 fi
345 done
346 if test "$found_compat_cc" = "no" ; then
347 echo "gcc 3.x not found!"
348 fi
349 fi
350 if test "$found_compat_cc" = "no" ; then
351 echo "QEMU is known to have problems when compiled with gcc 4.x"
352 echo "It is recommended that you use gcc 3.x to build QEMU"
353 echo "To use this compiler anyway, configure with --disable-gcc-check"
354 exit 1;
355 fi
356 fi
357fi
358
bellardec530c82006-04-25 22:36:06 +0000359#
360# Solaris specific configure tool chain decisions
361#
362if test "$solaris" = "yes" ; then
363 #
364 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
365 # override the check with --disable-gcc-check
366 #
367 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
368 solgcc=`which $cc`
369 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
370 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
371 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
372 echo "or get the latest patch from SunSolve for gcc"
373 exit 1
374 fi
375 fi
376 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
377 if test -z "$solinst" ; then
378 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
379 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
380 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
381 exit 1
382 fi
383 if test "$solinst" = "/usr/sbin/install" ; then
384 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
385 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
386 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
387 exit 1
388 fi
bellardec530c82006-04-25 22:36:06 +0000389 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
390 if test -z "$sol_ar" ; then
391 echo "Error: No path includes ar"
392 if test -f /usr/ccs/bin/ar ; then
393 echo "Add /usr/ccs/bin to your path and rerun configure"
394 fi
395 exit 1
396 fi
397fi
398
399
bellard5327cf42005-01-10 23:18:50 +0000400if test -z "$target_list" ; then
401# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000402 if [ "$softmmu" = "yes" ] ; then
403 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
404 fi
bellard5327cf42005-01-10 23:18:50 +0000405# the following are Linux specific
pbrook0a8e90f2006-03-19 14:54:16 +0000406 if [ "$user" = "yes" ] ; then
pbrooke6e59062006-10-22 00:18:54 +0000407 target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user m68k-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000408 fi
bellard6e20a452005-06-05 15:56:02 +0000409else
pbrookb1a550a2006-04-16 13:28:56 +0000410 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000411fi
pbrook0a8e90f2006-03-19 14:54:16 +0000412if test -z "$target_list" ; then
413 echo "No targets enabled"
414 exit 1
415fi
bellard5327cf42005-01-10 23:18:50 +0000416
bellard7d132992003-03-06 23:23:54 +0000417if test -z "$cross_prefix" ; then
418
419# ---
420# big/little endian test
421cat > $TMPC << EOF
422#include <inttypes.h>
423int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000424 volatile uint32_t i=0x01234567;
425 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000426}
427EOF
428
429if $cc -o $TMPE $TMPC 2>/dev/null ; then
430$TMPE && bigendian="yes"
431else
432echo big/little test failed
433fi
434
435else
436
437# if cross compiling, cannot launch a program, so make a static guess
bellard808c4952004-12-19 23:33:47 +0000438if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
bellard7d132992003-03-06 23:23:54 +0000439 bigendian="yes"
440fi
441
442fi
443
bellardb6853692005-06-05 17:10:39 +0000444# host long bits test
445hostlongbits="32"
446if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
447 hostlongbits="64"
448fi
449
bellarde8cd23d2003-06-25 16:08:13 +0000450# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000451cat > $TMPC <<EOF
452int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000453}
454EOF
455
bellarde8cd23d2003-06-25 16:08:13 +0000456have_gcc3_options="no"
457if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
458 have_gcc3_options="yes"
bellard04369ff2003-03-20 22:33:23 +0000459fi
bellardca735202003-03-18 20:41:34 +0000460
bellard11d9f692004-04-02 20:55:59 +0000461##########################################
462# SDL probe
463
464sdl_too_old=no
465
466if test -z "$sdl" ; then
467
bellarda6e022a2004-04-02 21:55:47 +0000468sdl_config="sdl-config"
469sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000470sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000471
472if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
473# win32 cross compilation case
474 sdl_config="i386-mingw32msvc-sdl-config"
475 sdl=yes
476else
477# normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000478cat > $TMPC << EOF
479#include <SDL.h>
480#undef main /* We don't want SDL to override our main() */
481int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
482EOF
483
bellarda6e022a2004-04-02 21:55:47 +0000484if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
485_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
bellard11d9f692004-04-02 20:55:59 +0000486if test "$_sdlversion" -lt 121 ; then
487sdl_too_old=yes
488else
489sdl=yes
490fi
bellard7c1f25b2004-04-22 00:02:08 +0000491
492# static link with sdl ?
493if test "$sdl" = "yes" ; then
494aa="no"
495`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
496sdl_static_libs=`$sdl_config --static-libs`
497if [ "$aa" = "yes" ] ; then
bellardd8d8aa42004-04-29 20:14:07 +0000498 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000499fi
500
bellard7c1f25b2004-04-22 00:02:08 +0000501if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
502 sdl_static=yes
503fi
504
505fi # static link
506
507fi # sdl compile test
508
bellarda6e022a2004-04-02 21:55:47 +0000509fi # cross compilation
510fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000511
ths8f28f3f2007-01-05 21:25:54 +0000512##########################################
513# alsa sound support libraries
514
515if test "$alsa" = "yes" ; then
516 cat > $TMPC << EOF
517#include <alsa/asoundlib.h>
518int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
519EOF
520 if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
521 :
522 else
523 echo
524 echo "Error: Could not find alsa"
525 echo "Make sure to have the alsa libs and headers installed."
526 echo
527 exit 1
528 fi
529fi
530
pbrookcc8ae6d2006-04-23 17:57:59 +0000531# Check if tools are available to build documentation.
pbrook94ac5152006-04-26 16:07:35 +0000532if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +0000533 build_docs="yes"
534fi
535
bellard11d9f692004-04-02 20:55:59 +0000536if test "$mingw32" = "yes" ; then
537if test -z "$prefix" ; then
538 prefix="/c/Program Files/Qemu"
539fi
540mandir="$prefix"
bellard7efa4382004-05-12 18:54:06 +0000541datadir="$prefix"
bellard1f50f8d2004-05-08 14:44:43 +0000542docdir="$prefix"
bellard11d9f692004-04-02 20:55:59 +0000543bindir="$prefix"
544else
545if test -z "$prefix" ; then
546 prefix="/usr/local"
547fi
bellard5a671352003-10-01 00:13:48 +0000548mandir="$prefix/share/man"
bellard7efa4382004-05-12 18:54:06 +0000549datadir="$prefix/share/qemu"
bellard1f50f8d2004-05-08 14:44:43 +0000550docdir="$prefix/share/doc/qemu"
bellard11d9f692004-04-02 20:55:59 +0000551bindir="$prefix/bin"
552fi
bellard5a671352003-10-01 00:13:48 +0000553
bellard43ce4df2003-06-09 19:53:12 +0000554echo "Install prefix $prefix"
bellard7efa4382004-05-12 18:54:06 +0000555echo "BIOS directory $datadir"
bellard11d9f692004-04-02 20:55:59 +0000556echo "binary directory $bindir"
557if test "$mingw32" = "no" ; then
558echo "Manual directory $mandir"
bellard43ce4df2003-06-09 19:53:12 +0000559echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000560fi
bellard5a671352003-10-01 00:13:48 +0000561echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000562echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000563echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000564echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000565echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000566echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000567echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000568echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000569echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000570echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000571echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000572if test "$darwin" = "yes" ; then
573 echo "Cocoa support $cocoa"
574fi
bellard97a847b2003-08-10 21:36:04 +0000575echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000576if test "$sdl" != "no" ; then
577 echo "SDL static link $sdl_static"
578fi
bellard67b915a2004-03-31 23:37:16 +0000579echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000580echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000581echo "CoreAudio support $coreaudio"
582echo "ALSA support $alsa"
583echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000584if test "$fmod" = "yes"; then
585 if test -z $fmod_lib || test -z $fmod_inc; then
586 echo
587 echo "Error: You must specify path to FMOD library and headers"
588 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
589 echo
590 exit 1
591 fi
pbrookb1a550a2006-04-16 13:28:56 +0000592 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
593else
594 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000595fi
pbrookb1a550a2006-04-16 13:28:56 +0000596echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000597echo "kqemu support $kqemu"
pbrookcc8ae6d2006-04-23 17:57:59 +0000598echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +0000599[ ! -z "$uname_release" ] && \
600echo "uname -r $uname_release"
bellard67b915a2004-03-31 23:37:16 +0000601
bellard97a847b2003-08-10 21:36:04 +0000602if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000603echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000604fi
bellard24b55b92005-03-01 22:30:41 +0000605#if test "$sdl_static" = "no"; then
606# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
607#fi
bellard97a847b2003-08-10 21:36:04 +0000608config_mak="config-host.mak"
609config_h="config-host.h"
610
bellard7c1f25b2004-04-22 00:02:08 +0000611#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000612
613echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000614echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000615echo "/* Automatically generated by configure - do not modify */" > $config_h
616
617echo "prefix=$prefix" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000618echo "bindir=$bindir" >> $config_mak
bellard5a671352003-10-01 00:13:48 +0000619echo "mandir=$mandir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000620echo "datadir=$datadir" >> $config_mak
bellard1f50f8d2004-05-08 14:44:43 +0000621echo "docdir=$docdir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000622echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000623echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000624echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000625echo "CC=$cc" >> $config_mak
626if test "$have_gcc3_options" = "yes" ; then
627 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
628fi
629echo "HOST_CC=$host_cc" >> $config_mak
630echo "AR=$ar" >> $config_mak
631echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
ths6f30fa82007-01-05 01:00:47 +0000632echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000633echo "CFLAGS=$CFLAGS" >> $config_mak
634echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000635echo "EXESUF=$EXESUF" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000636if test "$cpu" = "i386" ; then
637 echo "ARCH=i386" >> $config_mak
638 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000639elif test "$cpu" = "x86_64" ; then
640 echo "ARCH=x86_64" >> $config_mak
641 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000642elif test "$cpu" = "armv4b" ; then
643 echo "ARCH=arm" >> $config_mak
644 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000645elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000646 echo "ARCH=arm" >> $config_mak
647 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000648elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000649 echo "ARCH=ppc" >> $config_mak
650 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000651elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000652 echo "ARCH=mips" >> $config_mak
653 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000654elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000655 echo "ARCH=s390" >> $config_mak
656 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000657elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000658 echo "ARCH=alpha" >> $config_mak
659 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000660elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000661 echo "ARCH=sparc" >> $config_mak
662 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000663elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000664 echo "ARCH=sparc64" >> $config_mak
665 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000666elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000667 echo "ARCH=ia64" >> $config_mak
668 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000669elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000670 echo "ARCH=m68k" >> $config_mak
671 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000672else
673 echo "Unsupported CPU"
674 exit 1
675fi
676if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000677 echo "WORDS_BIGENDIAN=yes" >> $config_mak
678 echo "#define WORDS_BIGENDIAN 1" >> $config_h
679fi
bellardb6853692005-06-05 17:10:39 +0000680echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000681if test "$mingw32" = "yes" ; then
682 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000683 echo "#define CONFIG_WIN32 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000684elif test -f "/usr/include/byteswap.h" ; then
bellard67b915a2004-03-31 23:37:16 +0000685 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
686fi
bellard83fb7ad2004-07-05 21:25:26 +0000687if test "$darwin" = "yes" ; then
688 echo "CONFIG_DARWIN=yes" >> $config_mak
689 echo "#define CONFIG_DARWIN 1" >> $config_h
690fi
bellardec530c82006-04-25 22:36:06 +0000691if test "$solaris" = "yes" ; then
692 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +0000693 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
bellardec530c82006-04-25 22:36:06 +0000694fi
bellard67b915a2004-03-31 23:37:16 +0000695if test "$gdbstub" = "yes" ; then
696 echo "CONFIG_GDBSTUB=yes" >> $config_mak
697 echo "#define CONFIG_GDBSTUB 1" >> $config_h
698fi
bellard97a847b2003-08-10 21:36:04 +0000699if test "$gprof" = "yes" ; then
700 echo "TARGET_GPROF=yes" >> $config_mak
701 echo "#define HAVE_GPROF 1" >> $config_h
702fi
703if test "$static" = "yes" ; then
704 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000705 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000706fi
bellard05c2a3e2006-02-08 22:39:17 +0000707if test $profiler = "yes" ; then
708 echo "#define CONFIG_PROFILER 1" >> $config_h
709fi
bellardc20709a2004-04-21 23:27:19 +0000710if test "$slirp" = "yes" ; then
711 echo "CONFIG_SLIRP=yes" >> $config_mak
712 echo "#define CONFIG_SLIRP 1" >> $config_h
713fi
bellardfb065182004-11-09 23:09:44 +0000714if test "$adlib" = "yes" ; then
715 echo "CONFIG_ADLIB=yes" >> $config_mak
716 echo "#define CONFIG_ADLIB 1" >> $config_h
717fi
718if test "$oss" = "yes" ; then
719 echo "CONFIG_OSS=yes" >> $config_mak
720 echo "#define CONFIG_OSS 1" >> $config_h
721fi
bellard1d14ffa2005-10-30 18:58:22 +0000722if test "$coreaudio" = "yes" ; then
723 echo "CONFIG_COREAUDIO=yes" >> $config_mak
724 echo "#define CONFIG_COREAUDIO 1" >> $config_h
725fi
726if test "$alsa" = "yes" ; then
727 echo "CONFIG_ALSA=yes" >> $config_mak
728 echo "#define CONFIG_ALSA 1" >> $config_h
729fi
730if test "$dsound" = "yes" ; then
731 echo "CONFIG_DSOUND=yes" >> $config_mak
732 echo "#define CONFIG_DSOUND 1" >> $config_h
733fi
bellard102a52e2004-11-14 19:57:29 +0000734if test "$fmod" = "yes" ; then
735 echo "CONFIG_FMOD=yes" >> $config_mak
736 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
737 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
738 echo "#define CONFIG_FMOD 1" >> $config_h
739fi
pbrookb1a550a2006-04-16 13:28:56 +0000740qemu_version=`head $source_path/VERSION`
741echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +0000742echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000743
744echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000745if [ "$source_path_used" = "yes" ]; then
746 echo "VPATH=$source_path" >> $config_mak
747fi
bellard97a847b2003-08-10 21:36:04 +0000748echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +0000749if [ "$build_docs" = "yes" ] ; then
750 echo "BUILD_DOCS=yes" >> $config_mak
751fi
bellard97a847b2003-08-10 21:36:04 +0000752
bellard83fb7ad2004-07-05 21:25:26 +0000753# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000754if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000755 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000756 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000757 echo "#define _BSD 1" >> $config_h
758fi
759
pbrookc5937222006-05-14 11:30:38 +0000760echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
761
bellard1d14ffa2005-10-30 18:58:22 +0000762for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000763target_dir="$target"
764config_mak=$target_dir/config.mak
765config_h=$target_dir/config.h
766target_cpu=`echo $target | cut -d '-' -f 1`
767target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000768[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000769[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000770[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000771[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000772[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000773[ "$target_cpu" = "mips" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +0000774[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
pbrooke6e59062006-10-22 00:18:54 +0000775[ "$target_cpu" = "m68k" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000776target_softmmu="no"
777if expr $target : '.*-softmmu' > /dev/null ; then
778 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000779fi
bellard997344f2003-10-27 21:10:39 +0000780target_user_only="no"
781if expr $target : '.*-user' > /dev/null ; then
782 target_user_only="yes"
783fi
bellardde83cd02003-06-15 20:25:43 +0000784
bellard97ccc682005-07-02 13:32:17 +0000785if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000786 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000787 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +0000788 echo "To build QEMU without graphical output configure with --disable-gfx-check"
bellard97ccc682005-07-02 13:32:17 +0000789 echo "Note that this will disable all output from the virtual graphics card."
790 exit 1;
791fi
792
bellard7c1f25b2004-04-22 00:02:08 +0000793#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000794
795mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000796mkdir -p $target_dir/fpu
bellard808c4952004-12-19 23:33:47 +0000797if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
bellard69de9272004-02-16 21:40:43 +0000798 mkdir -p $target_dir/nwfpe
799fi
bellarda7e61ed2004-04-22 21:46:47 +0000800if test "$target_user_only" = "no" ; then
801 mkdir -p $target_dir/slirp
802fi
bellard69de9272004-02-16 21:40:43 +0000803
bellardec530c82006-04-25 22:36:06 +0000804#
805# don't use ln -sf as not all "ln -sf" over write the file/link
806#
807rm -f $target_dir/Makefile
808ln -s $source_path/Makefile.target $target_dir/Makefile
809
bellard97a847b2003-08-10 21:36:04 +0000810
811echo "# Automatically generated by configure - do not modify" > $config_mak
812echo "/* Automatically generated by configure - do not modify */" > $config_h
813
814
815echo "include ../config-host.mak" >> $config_mak
816echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000817
pbrooke5fe0c52006-06-11 13:32:59 +0000818bflt="no"
bellard1e43adf2003-09-30 20:54:24 +0000819interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
820echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000821
822if test "$target_cpu" = "i386" ; then
823 echo "TARGET_ARCH=i386" >> $config_mak
824 echo "#define TARGET_ARCH \"i386\"" >> $config_h
825 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000826 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000827 echo "#define USE_KQEMU 1" >> $config_h
828 fi
bellard808c4952004-12-19 23:33:47 +0000829elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000830 echo "TARGET_ARCH=arm" >> $config_mak
831 echo "#define TARGET_ARCH \"arm\"" >> $config_h
832 echo "#define TARGET_ARM 1" >> $config_h
pbrooke5fe0c52006-06-11 13:32:59 +0000833 bflt="yes"
bellard1e43adf2003-09-30 20:54:24 +0000834elif test "$target_cpu" = "sparc" ; then
835 echo "TARGET_ARCH=sparc" >> $config_mak
836 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
837 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000838elif test "$target_cpu" = "sparc64" ; then
839 echo "TARGET_ARCH=sparc64" >> $config_mak
840 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
841 echo "#define TARGET_SPARC 1" >> $config_h
842 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000843elif test "$target_cpu" = "ppc" ; then
844 echo "TARGET_ARCH=ppc" >> $config_mak
845 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
846 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000847elif test "$target_cpu" = "ppc64" ; then
848 echo "TARGET_ARCH=ppc64" >> $config_mak
849 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
850 echo "#define TARGET_PPC 1" >> $config_h
851 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000852elif test "$target_cpu" = "x86_64" ; then
853 echo "TARGET_ARCH=x86_64" >> $config_mak
854 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
855 echo "#define TARGET_I386 1" >> $config_h
856 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000857 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
858 echo "#define USE_KQEMU 1" >> $config_h
859 fi
bellardc20eb472005-12-06 21:42:55 +0000860elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000861 echo "TARGET_ARCH=mips" >> $config_mak
862 echo "#define TARGET_ARCH \"mips\"" >> $config_h
863 echo "#define TARGET_MIPS 1" >> $config_h
bellard6ea83fe2006-06-14 12:56:19 +0000864 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
865 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
pbrook908f52b2006-06-18 19:16:53 +0000866elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
bellardfdf9b3e2006-04-27 21:07:38 +0000867 echo "TARGET_ARCH=sh4" >> $config_mak
868 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
869 echo "#define TARGET_SH4 1" >> $config_h
pbrook4dbed892006-06-17 20:01:14 +0000870 bflt="yes"
pbrooke6e59062006-10-22 00:18:54 +0000871elif test "$target_cpu" = "m68k" ; then
872 echo "TARGET_ARCH=m68k" >> $config_mak
873 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
874 echo "#define TARGET_M68K 1" >> $config_h
875 bflt="yes"
bellardde83cd02003-06-15 20:25:43 +0000876else
877 echo "Unsupported target CPU"
878 exit 1
879fi
880if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000881 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
882 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
883fi
884if test "$target_softmmu" = "yes" ; then
885 echo "CONFIG_SOFTMMU=yes" >> $config_mak
886 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000887fi
bellard997344f2003-10-27 21:10:39 +0000888if test "$target_user_only" = "yes" ; then
889 echo "CONFIG_USER_ONLY=yes" >> $config_mak
890 echo "#define CONFIG_USER_ONLY 1" >> $config_h
891fi
bellardde83cd02003-06-15 20:25:43 +0000892
pbrooke6e59062006-10-22 00:18:54 +0000893if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
bellard158142c2005-03-13 16:54:06 +0000894 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
895 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
896fi
pbrooke5fe0c52006-06-11 13:32:59 +0000897if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
898 echo "TARGET_HAS_BFLT=yes" >> $config_mak
899 echo "#define TARGET_HAS_BFLT 1" >> $config_h
900fi
bellard7c1f25b2004-04-22 00:02:08 +0000901# sdl defines
902
903if test "$target_user_only" = "no"; then
904 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000905 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000906 else
bellarddbb2c922004-10-24 22:17:47 +0000907 sdl1=$sdl
908 fi
909 if test "$sdl1" = "yes" ; then
910 echo "#define CONFIG_SDL 1" >> $config_h
911 echo "CONFIG_SDL=yes" >> $config_mak
912 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
913 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
914 else
bellard7c1f25b2004-04-22 00:02:08 +0000915 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
916 fi
bellarddbb2c922004-10-24 22:17:47 +0000917 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000918 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
919 else
920 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000921 fi
bellard7c1f25b2004-04-22 00:02:08 +0000922 fi
bellard7c1f25b2004-04-22 00:02:08 +0000923fi
924
bellard5b0753e2005-03-01 21:37:28 +0000925if test "$cocoa" = "yes" ; then
926 echo "#define CONFIG_COCOA 1" >> $config_h
927 echo "CONFIG_COCOA=yes" >> $config_mak
928fi
929
bellard97a847b2003-08-10 21:36:04 +0000930done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000931
932# build tree in object directory if source path is different from current one
933if test "$source_path_used" = "yes" ; then
934 DIRS="tests"
935 FILES="Makefile tests/Makefile"
936 for dir in $DIRS ; do
937 mkdir -p $dir
938 done
bellardec530c82006-04-25 22:36:06 +0000939 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +0000940 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +0000941 rm -f $f
942 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +0000943 done
944fi
bellard7d132992003-03-06 23:23:54 +0000945
bellard97a847b2003-08-10 21:36:04 +0000946rm -f $TMPO $TMPC $TMPE $TMPS