blob: f03edd16c765942df16fded5294e3341ec27ced9 [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
pbrookcc8ae6d2006-04-23 17:57:59 +0000512# Check if tools are available to build documentation.
pbrook94ac5152006-04-26 16:07:35 +0000513if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +0000514 build_docs="yes"
515fi
516
bellard11d9f692004-04-02 20:55:59 +0000517if test "$mingw32" = "yes" ; then
518if test -z "$prefix" ; then
519 prefix="/c/Program Files/Qemu"
520fi
521mandir="$prefix"
bellard7efa4382004-05-12 18:54:06 +0000522datadir="$prefix"
bellard1f50f8d2004-05-08 14:44:43 +0000523docdir="$prefix"
bellard11d9f692004-04-02 20:55:59 +0000524bindir="$prefix"
525else
526if test -z "$prefix" ; then
527 prefix="/usr/local"
528fi
bellard5a671352003-10-01 00:13:48 +0000529mandir="$prefix/share/man"
bellard7efa4382004-05-12 18:54:06 +0000530datadir="$prefix/share/qemu"
bellard1f50f8d2004-05-08 14:44:43 +0000531docdir="$prefix/share/doc/qemu"
bellard11d9f692004-04-02 20:55:59 +0000532bindir="$prefix/bin"
533fi
bellard5a671352003-10-01 00:13:48 +0000534
bellard43ce4df2003-06-09 19:53:12 +0000535echo "Install prefix $prefix"
bellard7efa4382004-05-12 18:54:06 +0000536echo "BIOS directory $datadir"
bellard11d9f692004-04-02 20:55:59 +0000537echo "binary directory $bindir"
538if test "$mingw32" = "no" ; then
539echo "Manual directory $mandir"
bellard43ce4df2003-06-09 19:53:12 +0000540echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000541fi
bellard5a671352003-10-01 00:13:48 +0000542echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000543echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000544echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000545echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000546echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000547echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000548echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000549echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000550echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000551echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000552echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000553if test "$darwin" = "yes" ; then
554 echo "Cocoa support $cocoa"
555fi
bellard97a847b2003-08-10 21:36:04 +0000556echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000557if test "$sdl" != "no" ; then
558 echo "SDL static link $sdl_static"
559fi
bellard67b915a2004-03-31 23:37:16 +0000560echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000561echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000562echo "CoreAudio support $coreaudio"
563echo "ALSA support $alsa"
564echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000565if test "$fmod" = "yes"; then
566 if test -z $fmod_lib || test -z $fmod_inc; then
567 echo
568 echo "Error: You must specify path to FMOD library and headers"
569 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
570 echo
571 exit 1
572 fi
pbrookb1a550a2006-04-16 13:28:56 +0000573 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
574else
575 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000576fi
pbrookb1a550a2006-04-16 13:28:56 +0000577echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000578echo "kqemu support $kqemu"
pbrookcc8ae6d2006-04-23 17:57:59 +0000579echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +0000580[ ! -z "$uname_release" ] && \
581echo "uname -r $uname_release"
bellard67b915a2004-03-31 23:37:16 +0000582
bellard97a847b2003-08-10 21:36:04 +0000583if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000584echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000585fi
bellard24b55b92005-03-01 22:30:41 +0000586#if test "$sdl_static" = "no"; then
587# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
588#fi
bellard97a847b2003-08-10 21:36:04 +0000589config_mak="config-host.mak"
590config_h="config-host.h"
591
bellard7c1f25b2004-04-22 00:02:08 +0000592#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000593
594echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000595echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000596echo "/* Automatically generated by configure - do not modify */" > $config_h
597
598echo "prefix=$prefix" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000599echo "bindir=$bindir" >> $config_mak
bellard5a671352003-10-01 00:13:48 +0000600echo "mandir=$mandir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000601echo "datadir=$datadir" >> $config_mak
bellard1f50f8d2004-05-08 14:44:43 +0000602echo "docdir=$docdir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000603echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000604echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000605echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000606echo "CC=$cc" >> $config_mak
607if test "$have_gcc3_options" = "yes" ; then
608 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
609fi
610echo "HOST_CC=$host_cc" >> $config_mak
611echo "AR=$ar" >> $config_mak
612echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
ths6f30fa82007-01-05 01:00:47 +0000613echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000614echo "CFLAGS=$CFLAGS" >> $config_mak
615echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000616echo "EXESUF=$EXESUF" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000617if test "$cpu" = "i386" ; then
618 echo "ARCH=i386" >> $config_mak
619 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000620elif test "$cpu" = "x86_64" ; then
621 echo "ARCH=x86_64" >> $config_mak
622 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000623elif test "$cpu" = "armv4b" ; then
624 echo "ARCH=arm" >> $config_mak
625 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000626elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000627 echo "ARCH=arm" >> $config_mak
628 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000629elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000630 echo "ARCH=ppc" >> $config_mak
631 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000632elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000633 echo "ARCH=mips" >> $config_mak
634 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000635elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000636 echo "ARCH=s390" >> $config_mak
637 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000638elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000639 echo "ARCH=alpha" >> $config_mak
640 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000641elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000642 echo "ARCH=sparc" >> $config_mak
643 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000644elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000645 echo "ARCH=sparc64" >> $config_mak
646 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000647elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000648 echo "ARCH=ia64" >> $config_mak
649 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000650elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000651 echo "ARCH=m68k" >> $config_mak
652 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000653else
654 echo "Unsupported CPU"
655 exit 1
656fi
657if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000658 echo "WORDS_BIGENDIAN=yes" >> $config_mak
659 echo "#define WORDS_BIGENDIAN 1" >> $config_h
660fi
bellardb6853692005-06-05 17:10:39 +0000661echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000662if test "$mingw32" = "yes" ; then
663 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000664 echo "#define CONFIG_WIN32 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000665elif test -f "/usr/include/byteswap.h" ; then
bellard67b915a2004-03-31 23:37:16 +0000666 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
667fi
bellard83fb7ad2004-07-05 21:25:26 +0000668if test "$darwin" = "yes" ; then
669 echo "CONFIG_DARWIN=yes" >> $config_mak
670 echo "#define CONFIG_DARWIN 1" >> $config_h
671fi
bellardec530c82006-04-25 22:36:06 +0000672if test "$solaris" = "yes" ; then
673 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +0000674 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
bellardec530c82006-04-25 22:36:06 +0000675fi
bellard67b915a2004-03-31 23:37:16 +0000676if test "$gdbstub" = "yes" ; then
677 echo "CONFIG_GDBSTUB=yes" >> $config_mak
678 echo "#define CONFIG_GDBSTUB 1" >> $config_h
679fi
bellard97a847b2003-08-10 21:36:04 +0000680if test "$gprof" = "yes" ; then
681 echo "TARGET_GPROF=yes" >> $config_mak
682 echo "#define HAVE_GPROF 1" >> $config_h
683fi
684if test "$static" = "yes" ; then
685 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000686 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000687fi
bellard05c2a3e2006-02-08 22:39:17 +0000688if test $profiler = "yes" ; then
689 echo "#define CONFIG_PROFILER 1" >> $config_h
690fi
bellardc20709a2004-04-21 23:27:19 +0000691if test "$slirp" = "yes" ; then
692 echo "CONFIG_SLIRP=yes" >> $config_mak
693 echo "#define CONFIG_SLIRP 1" >> $config_h
694fi
bellardfb065182004-11-09 23:09:44 +0000695if test "$adlib" = "yes" ; then
696 echo "CONFIG_ADLIB=yes" >> $config_mak
697 echo "#define CONFIG_ADLIB 1" >> $config_h
698fi
699if test "$oss" = "yes" ; then
700 echo "CONFIG_OSS=yes" >> $config_mak
701 echo "#define CONFIG_OSS 1" >> $config_h
702fi
bellard1d14ffa2005-10-30 18:58:22 +0000703if test "$coreaudio" = "yes" ; then
704 echo "CONFIG_COREAUDIO=yes" >> $config_mak
705 echo "#define CONFIG_COREAUDIO 1" >> $config_h
706fi
707if test "$alsa" = "yes" ; then
708 echo "CONFIG_ALSA=yes" >> $config_mak
709 echo "#define CONFIG_ALSA 1" >> $config_h
710fi
711if test "$dsound" = "yes" ; then
712 echo "CONFIG_DSOUND=yes" >> $config_mak
713 echo "#define CONFIG_DSOUND 1" >> $config_h
714fi
bellard102a52e2004-11-14 19:57:29 +0000715if test "$fmod" = "yes" ; then
716 echo "CONFIG_FMOD=yes" >> $config_mak
717 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
718 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
719 echo "#define CONFIG_FMOD 1" >> $config_h
720fi
pbrookb1a550a2006-04-16 13:28:56 +0000721qemu_version=`head $source_path/VERSION`
722echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +0000723echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000724
725echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000726if [ "$source_path_used" = "yes" ]; then
727 echo "VPATH=$source_path" >> $config_mak
728fi
bellard97a847b2003-08-10 21:36:04 +0000729echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +0000730if [ "$build_docs" = "yes" ] ; then
731 echo "BUILD_DOCS=yes" >> $config_mak
732fi
bellard97a847b2003-08-10 21:36:04 +0000733
bellard83fb7ad2004-07-05 21:25:26 +0000734# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000735if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000736 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000737 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000738 echo "#define _BSD 1" >> $config_h
739fi
740
pbrookc5937222006-05-14 11:30:38 +0000741echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
742
bellard1d14ffa2005-10-30 18:58:22 +0000743for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000744target_dir="$target"
745config_mak=$target_dir/config.mak
746config_h=$target_dir/config.h
747target_cpu=`echo $target | cut -d '-' -f 1`
748target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000749[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000750[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000751[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000752[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000753[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000754[ "$target_cpu" = "mips" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +0000755[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
pbrooke6e59062006-10-22 00:18:54 +0000756[ "$target_cpu" = "m68k" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000757target_softmmu="no"
758if expr $target : '.*-softmmu' > /dev/null ; then
759 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000760fi
bellard997344f2003-10-27 21:10:39 +0000761target_user_only="no"
762if expr $target : '.*-user' > /dev/null ; then
763 target_user_only="yes"
764fi
bellardde83cd02003-06-15 20:25:43 +0000765
bellard97ccc682005-07-02 13:32:17 +0000766if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000767 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000768 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +0000769 echo "To build QEMU without graphical output configure with --disable-gfx-check"
bellard97ccc682005-07-02 13:32:17 +0000770 echo "Note that this will disable all output from the virtual graphics card."
771 exit 1;
772fi
773
bellard7c1f25b2004-04-22 00:02:08 +0000774#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000775
776mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000777mkdir -p $target_dir/fpu
bellard808c4952004-12-19 23:33:47 +0000778if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
bellard69de9272004-02-16 21:40:43 +0000779 mkdir -p $target_dir/nwfpe
780fi
bellarda7e61ed2004-04-22 21:46:47 +0000781if test "$target_user_only" = "no" ; then
782 mkdir -p $target_dir/slirp
783fi
bellard69de9272004-02-16 21:40:43 +0000784
bellardec530c82006-04-25 22:36:06 +0000785#
786# don't use ln -sf as not all "ln -sf" over write the file/link
787#
788rm -f $target_dir/Makefile
789ln -s $source_path/Makefile.target $target_dir/Makefile
790
bellard97a847b2003-08-10 21:36:04 +0000791
792echo "# Automatically generated by configure - do not modify" > $config_mak
793echo "/* Automatically generated by configure - do not modify */" > $config_h
794
795
796echo "include ../config-host.mak" >> $config_mak
797echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000798
pbrooke5fe0c52006-06-11 13:32:59 +0000799bflt="no"
bellard1e43adf2003-09-30 20:54:24 +0000800interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
801echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000802
803if test "$target_cpu" = "i386" ; then
804 echo "TARGET_ARCH=i386" >> $config_mak
805 echo "#define TARGET_ARCH \"i386\"" >> $config_h
806 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000807 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000808 echo "#define USE_KQEMU 1" >> $config_h
809 fi
bellard808c4952004-12-19 23:33:47 +0000810elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000811 echo "TARGET_ARCH=arm" >> $config_mak
812 echo "#define TARGET_ARCH \"arm\"" >> $config_h
813 echo "#define TARGET_ARM 1" >> $config_h
pbrooke5fe0c52006-06-11 13:32:59 +0000814 bflt="yes"
bellard1e43adf2003-09-30 20:54:24 +0000815elif test "$target_cpu" = "sparc" ; then
816 echo "TARGET_ARCH=sparc" >> $config_mak
817 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
818 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000819elif test "$target_cpu" = "sparc64" ; then
820 echo "TARGET_ARCH=sparc64" >> $config_mak
821 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
822 echo "#define TARGET_SPARC 1" >> $config_h
823 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000824elif test "$target_cpu" = "ppc" ; then
825 echo "TARGET_ARCH=ppc" >> $config_mak
826 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
827 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000828elif test "$target_cpu" = "ppc64" ; then
829 echo "TARGET_ARCH=ppc64" >> $config_mak
830 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
831 echo "#define TARGET_PPC 1" >> $config_h
832 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000833elif test "$target_cpu" = "x86_64" ; then
834 echo "TARGET_ARCH=x86_64" >> $config_mak
835 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
836 echo "#define TARGET_I386 1" >> $config_h
837 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000838 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
839 echo "#define USE_KQEMU 1" >> $config_h
840 fi
bellardc20eb472005-12-06 21:42:55 +0000841elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000842 echo "TARGET_ARCH=mips" >> $config_mak
843 echo "#define TARGET_ARCH \"mips\"" >> $config_h
844 echo "#define TARGET_MIPS 1" >> $config_h
bellard6ea83fe2006-06-14 12:56:19 +0000845 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
846 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
pbrook908f52b2006-06-18 19:16:53 +0000847elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
bellardfdf9b3e2006-04-27 21:07:38 +0000848 echo "TARGET_ARCH=sh4" >> $config_mak
849 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
850 echo "#define TARGET_SH4 1" >> $config_h
pbrook4dbed892006-06-17 20:01:14 +0000851 bflt="yes"
pbrooke6e59062006-10-22 00:18:54 +0000852elif test "$target_cpu" = "m68k" ; then
853 echo "TARGET_ARCH=m68k" >> $config_mak
854 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
855 echo "#define TARGET_M68K 1" >> $config_h
856 bflt="yes"
bellardde83cd02003-06-15 20:25:43 +0000857else
858 echo "Unsupported target CPU"
859 exit 1
860fi
861if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000862 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
863 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
864fi
865if test "$target_softmmu" = "yes" ; then
866 echo "CONFIG_SOFTMMU=yes" >> $config_mak
867 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000868fi
bellard997344f2003-10-27 21:10:39 +0000869if test "$target_user_only" = "yes" ; then
870 echo "CONFIG_USER_ONLY=yes" >> $config_mak
871 echo "#define CONFIG_USER_ONLY 1" >> $config_h
872fi
bellardde83cd02003-06-15 20:25:43 +0000873
pbrooke6e59062006-10-22 00:18:54 +0000874if 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 +0000875 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
876 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
877fi
pbrooke5fe0c52006-06-11 13:32:59 +0000878if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
879 echo "TARGET_HAS_BFLT=yes" >> $config_mak
880 echo "#define TARGET_HAS_BFLT 1" >> $config_h
881fi
bellard7c1f25b2004-04-22 00:02:08 +0000882# sdl defines
883
884if test "$target_user_only" = "no"; then
885 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000886 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000887 else
bellarddbb2c922004-10-24 22:17:47 +0000888 sdl1=$sdl
889 fi
890 if test "$sdl1" = "yes" ; then
891 echo "#define CONFIG_SDL 1" >> $config_h
892 echo "CONFIG_SDL=yes" >> $config_mak
893 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
894 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
895 else
bellard7c1f25b2004-04-22 00:02:08 +0000896 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
897 fi
bellarddbb2c922004-10-24 22:17:47 +0000898 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000899 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
900 else
901 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000902 fi
bellard7c1f25b2004-04-22 00:02:08 +0000903 fi
bellard7c1f25b2004-04-22 00:02:08 +0000904fi
905
bellard5b0753e2005-03-01 21:37:28 +0000906if test "$cocoa" = "yes" ; then
907 echo "#define CONFIG_COCOA 1" >> $config_h
908 echo "CONFIG_COCOA=yes" >> $config_mak
909fi
910
bellard97a847b2003-08-10 21:36:04 +0000911done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000912
913# build tree in object directory if source path is different from current one
914if test "$source_path_used" = "yes" ; then
915 DIRS="tests"
916 FILES="Makefile tests/Makefile"
917 for dir in $DIRS ; do
918 mkdir -p $dir
919 done
bellardec530c82006-04-25 22:36:06 +0000920 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +0000921 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +0000922 rm -f $f
923 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +0000924 done
925fi
bellard7d132992003-03-06 23:23:54 +0000926
bellard97a847b2003-08-10 21:36:04 +0000927rm -f $TMPO $TMPC $TMPE $TMPS