blob: 68c3fcc7b679293b50b338aa33d137d652677f2a [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.`
ths605686c2007-01-17 23:31:19 +0000154 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
155 if test "$solarisrev" -gt 10 ; then
156 kqemu="yes"
157 fi
158 fi
bellardec530c82006-04-25 22:36:06 +0000159fi
160
bellard7d132992003-03-06 23:23:54 +0000161# find source path
pbrookad064842006-04-16 12:41:07 +0000162source_path=`dirname "$0"`
163if [ -z "$source_path" ]; then
bellard7d132992003-03-06 23:23:54 +0000164 source_path=`pwd`
pbrookad064842006-04-16 12:41:07 +0000165else
166 source_path=`cd "$source_path"; pwd`
167fi
168if test "$source_path" = `pwd` ; then
bellard7d132992003-03-06 23:23:54 +0000169 source_path_used="no"
pbrookad064842006-04-16 12:41:07 +0000170else
171 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000172fi
173
174for opt do
pbrooka46e4032006-04-29 23:05:22 +0000175 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000176 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000177 --help|-h) show_help=yes
178 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000179 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000180 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000181 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000182 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000183 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000184 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000185 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000186 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000187 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000188 --cc=*) cc="$optarg"
pbrook328a4242006-12-19 03:31:34 +0000189 gcc3_search="no"
bellard7d132992003-03-06 23:23:54 +0000190 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000191 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000192 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000193 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000194 ;;
pbrook6a882642006-04-17 13:57:12 +0000195 --install=*) install="$optarg"
196 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000197 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000198 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000199 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000200 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000201 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000202 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000203 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000204 ;;
bellard7d132992003-03-06 23:23:54 +0000205 --enable-gprof) gprof="yes"
206 ;;
bellard43ce4df2003-06-09 19:53:12 +0000207 --static) static="yes"
208 ;;
bellard97a847b2003-08-10 21:36:04 +0000209 --disable-sdl) sdl="no"
210 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000211 --enable-coreaudio) coreaudio="yes"
212 ;;
213 --enable-alsa) alsa="yes"
214 ;;
215 --enable-dsound) dsound="yes"
216 ;;
bellard102a52e2004-11-14 19:57:29 +0000217 --enable-fmod) fmod="yes"
218 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000219 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000220 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000221 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000222 ;;
bellard87ac5422006-06-25 17:35:56 +0000223 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
bellard1d14ffa2005-10-30 18:58:22 +0000224 ;;
bellard443f1372004-06-04 11:13:20 +0000225 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000226 ;;
bellardfb065182004-11-09 23:09:44 +0000227 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000228 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000229 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000230 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000231 --enable-profiler) profiler="yes"
232 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000233 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
234 ;;
bellard97ccc682005-07-02 13:32:17 +0000235 --disable-gfx-check) check_gfx="no"
236 ;;
bellard1aff3812005-11-02 22:30:45 +0000237 --disable-gcc-check) check_gcc="no"
238 ;;
pbrookcad25d62006-03-19 16:31:11 +0000239 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000240 ;;
pbrookcad25d62006-03-19 16:31:11 +0000241 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000242 ;;
243 --disable-user) user="no"
244 ;;
245 --enable-user) user="yes"
246 ;;
pbrookc5937222006-05-14 11:30:38 +0000247 --enable-uname-release=*) uname_release="$optarg"
248 ;;
bellard7d132992003-03-06 23:23:54 +0000249 esac
250done
251
ths6f30fa82007-01-05 01:00:47 +0000252# default flags for all hosts
253CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
254LDFLAGS="$LDFLAGS -g"
255
pbrookaf5db582006-04-08 14:26:41 +0000256if test x"$show_help" = x"yes" ; then
257cat << EOF
258
259Usage: configure [options]
260Options: [defaults in brackets after descriptions]
261
262EOF
263echo "Standard options:"
264echo " --help print this message"
265echo " --prefix=PREFIX install in PREFIX [$prefix]"
266echo " --interp-prefix=PREFIX where to find shared libraries, etc."
267echo " use %M for cpu name [$interp_prefix]"
268echo " --target-list=LIST set target list [$target_list]"
269echo ""
270echo "kqemu kernel acceleration support:"
271echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000272echo ""
273echo "Advanced options (experts only):"
274echo " --source-path=PATH path of source code [$source_path]"
275echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
276echo " --cc=CC use C compiler CC [$cc]"
277echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
278echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000279echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000280echo " --static enable static build [$static]"
281echo " --enable-cocoa enable COCOA (Mac OS X only)"
282echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
283echo " --enable-adlib enable Adlib emulation"
284echo " --enable-coreaudio enable Coreaudio audio driver"
285echo " --enable-alsa enable ALSA audio driver"
286echo " --enable-fmod enable FMOD audio driver"
287echo " --enabled-dsound enable DirectSound audio driver"
288echo " --enable-system enable all system emulation targets"
289echo " --disable-system disable all system emulation targets"
290echo " --enable-user enable all linux usermode emulation targets"
291echo " --disable-user disable all linux usermode emulation targets"
292echo " --fmod-lib path to FMOD library"
293echo " --fmod-inc path to FMOD includes"
pbrookc5937222006-05-14 11:30:38 +0000294echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
pbrookaf5db582006-04-08 14:26:41 +0000295echo ""
ths5bf08932006-12-23 00:33:26 +0000296echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000297exit 1
298fi
299
bellard7d132992003-03-06 23:23:54 +0000300cc="${cross_prefix}${cc}"
301ar="${cross_prefix}${ar}"
302strip="${cross_prefix}${strip}"
303
pbrook064aae12006-05-08 00:51:44 +0000304# check that the C compiler works.
305cat > $TMPC <<EOF
306int main(void) {}
307EOF
308
309if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
310 : C compiler works ok
311else
312 echo "ERROR: \"$cc\" either does not exist or does not work"
313 exit 1
bellarda7350fa2006-04-23 14:35:23 +0000314fi
315
bellard67b915a2004-03-31 23:37:16 +0000316if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000317 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000318 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000319 oss="no"
bellard07f4ddb2005-04-23 17:44:28 +0000320 if [ "$cpu" = "i386" ] ; then
321 kqemu="yes"
322 fi
bellard67b915a2004-03-31 23:37:16 +0000323fi
324
pbrook328a4242006-12-19 03:31:34 +0000325# Check for gcc4, error if pre-gcc4
326if test "$check_gcc" = "yes" ; then
327 cat > $TMPC <<EOF
328#if __GNUC__ < 4
329#error gcc3
330#endif
331int main(){return 0;}
332EOF
333 check_cc() {
334 which "$1" >&/dev/null
335 return $?
336 }
337
338 if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
339 echo "WARNING: \"$cc\" looks like gcc 4.x"
340 found_compat_cc="no"
341 if test "$gcc3_search" = "yes" ; then
342 echo "Looking for gcc 3.x"
343 for compat_cc in $gcc3_list ; do
344 if check_cc "$compat_cc" ; then
345 echo "Found \"$compat_cc\""
346 cc="$compat_cc"
347 found_compat_cc="yes"
348 break
349 fi
350 done
351 if test "$found_compat_cc" = "no" ; then
352 echo "gcc 3.x not found!"
353 fi
354 fi
355 if test "$found_compat_cc" = "no" ; then
356 echo "QEMU is known to have problems when compiled with gcc 4.x"
357 echo "It is recommended that you use gcc 3.x to build QEMU"
358 echo "To use this compiler anyway, configure with --disable-gcc-check"
359 exit 1;
360 fi
361 fi
362fi
363
bellardec530c82006-04-25 22:36:06 +0000364#
365# Solaris specific configure tool chain decisions
366#
367if test "$solaris" = "yes" ; then
368 #
369 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
370 # override the check with --disable-gcc-check
371 #
372 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
373 solgcc=`which $cc`
374 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
375 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
376 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
377 echo "or get the latest patch from SunSolve for gcc"
378 exit 1
379 fi
380 fi
381 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
382 if test -z "$solinst" ; then
383 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
384 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
385 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
386 exit 1
387 fi
388 if test "$solinst" = "/usr/sbin/install" ; then
389 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
390 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
391 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
392 exit 1
393 fi
bellardec530c82006-04-25 22:36:06 +0000394 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
395 if test -z "$sol_ar" ; then
396 echo "Error: No path includes ar"
397 if test -f /usr/ccs/bin/ar ; then
398 echo "Add /usr/ccs/bin to your path and rerun configure"
399 fi
400 exit 1
401 fi
402fi
403
404
bellard5327cf42005-01-10 23:18:50 +0000405if test -z "$target_list" ; then
406# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000407 if [ "$softmmu" = "yes" ] ; then
408 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
409 fi
bellard5327cf42005-01-10 23:18:50 +0000410# the following are Linux specific
pbrook0a8e90f2006-03-19 14:54:16 +0000411 if [ "$user" = "yes" ] ; then
pbrooke6e59062006-10-22 00:18:54 +0000412 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 +0000413 fi
bellard6e20a452005-06-05 15:56:02 +0000414else
pbrookb1a550a2006-04-16 13:28:56 +0000415 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000416fi
pbrook0a8e90f2006-03-19 14:54:16 +0000417if test -z "$target_list" ; then
418 echo "No targets enabled"
419 exit 1
420fi
bellard5327cf42005-01-10 23:18:50 +0000421
bellard7d132992003-03-06 23:23:54 +0000422if test -z "$cross_prefix" ; then
423
424# ---
425# big/little endian test
426cat > $TMPC << EOF
427#include <inttypes.h>
428int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000429 volatile uint32_t i=0x01234567;
430 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000431}
432EOF
433
434if $cc -o $TMPE $TMPC 2>/dev/null ; then
435$TMPE && bigendian="yes"
436else
437echo big/little test failed
438fi
439
440else
441
442# if cross compiling, cannot launch a program, so make a static guess
bellard808c4952004-12-19 23:33:47 +0000443if 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 +0000444 bigendian="yes"
445fi
446
447fi
448
bellardb6853692005-06-05 17:10:39 +0000449# host long bits test
450hostlongbits="32"
451if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
452 hostlongbits="64"
453fi
454
bellarde8cd23d2003-06-25 16:08:13 +0000455# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000456cat > $TMPC <<EOF
457int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000458}
459EOF
460
bellarde8cd23d2003-06-25 16:08:13 +0000461have_gcc3_options="no"
462if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
463 have_gcc3_options="yes"
bellard04369ff2003-03-20 22:33:23 +0000464fi
bellardca735202003-03-18 20:41:34 +0000465
bellard11d9f692004-04-02 20:55:59 +0000466##########################################
467# SDL probe
468
469sdl_too_old=no
470
471if test -z "$sdl" ; then
472
bellarda6e022a2004-04-02 21:55:47 +0000473sdl_config="sdl-config"
474sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000475sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000476
477if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
478# win32 cross compilation case
479 sdl_config="i386-mingw32msvc-sdl-config"
480 sdl=yes
481else
482# normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000483cat > $TMPC << EOF
484#include <SDL.h>
485#undef main /* We don't want SDL to override our main() */
486int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
487EOF
488
bellarda6e022a2004-04-02 21:55:47 +0000489if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
490_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
bellard11d9f692004-04-02 20:55:59 +0000491if test "$_sdlversion" -lt 121 ; then
492sdl_too_old=yes
493else
494sdl=yes
495fi
bellard7c1f25b2004-04-22 00:02:08 +0000496
497# static link with sdl ?
498if test "$sdl" = "yes" ; then
499aa="no"
500`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
501sdl_static_libs=`$sdl_config --static-libs`
502if [ "$aa" = "yes" ] ; then
bellardd8d8aa42004-04-29 20:14:07 +0000503 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000504fi
505
bellard7c1f25b2004-04-22 00:02:08 +0000506if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
507 sdl_static=yes
508fi
509
510fi # static link
511
512fi # sdl compile test
513
bellarda6e022a2004-04-02 21:55:47 +0000514fi # cross compilation
515fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000516
ths8f28f3f2007-01-05 21:25:54 +0000517##########################################
518# alsa sound support libraries
519
520if test "$alsa" = "yes" ; then
521 cat > $TMPC << EOF
522#include <alsa/asoundlib.h>
523int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
524EOF
525 if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
526 :
527 else
528 echo
529 echo "Error: Could not find alsa"
530 echo "Make sure to have the alsa libs and headers installed."
531 echo
532 exit 1
533 fi
534fi
535
pbrookcc8ae6d2006-04-23 17:57:59 +0000536# Check if tools are available to build documentation.
pbrook94ac5152006-04-26 16:07:35 +0000537if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +0000538 build_docs="yes"
539fi
540
bellard11d9f692004-04-02 20:55:59 +0000541if test "$mingw32" = "yes" ; then
542if test -z "$prefix" ; then
543 prefix="/c/Program Files/Qemu"
544fi
545mandir="$prefix"
bellard7efa4382004-05-12 18:54:06 +0000546datadir="$prefix"
bellard1f50f8d2004-05-08 14:44:43 +0000547docdir="$prefix"
bellard11d9f692004-04-02 20:55:59 +0000548bindir="$prefix"
549else
550if test -z "$prefix" ; then
551 prefix="/usr/local"
552fi
bellard5a671352003-10-01 00:13:48 +0000553mandir="$prefix/share/man"
bellard7efa4382004-05-12 18:54:06 +0000554datadir="$prefix/share/qemu"
bellard1f50f8d2004-05-08 14:44:43 +0000555docdir="$prefix/share/doc/qemu"
bellard11d9f692004-04-02 20:55:59 +0000556bindir="$prefix/bin"
557fi
bellard5a671352003-10-01 00:13:48 +0000558
bellard43ce4df2003-06-09 19:53:12 +0000559echo "Install prefix $prefix"
bellard7efa4382004-05-12 18:54:06 +0000560echo "BIOS directory $datadir"
bellard11d9f692004-04-02 20:55:59 +0000561echo "binary directory $bindir"
562if test "$mingw32" = "no" ; then
563echo "Manual directory $mandir"
bellard43ce4df2003-06-09 19:53:12 +0000564echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000565fi
bellard5a671352003-10-01 00:13:48 +0000566echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000567echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000568echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000569echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000570echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000571echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000572echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000573echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000574echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000575echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000576echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000577if test "$darwin" = "yes" ; then
578 echo "Cocoa support $cocoa"
579fi
bellard97a847b2003-08-10 21:36:04 +0000580echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000581if test "$sdl" != "no" ; then
582 echo "SDL static link $sdl_static"
583fi
bellard67b915a2004-03-31 23:37:16 +0000584echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000585echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000586echo "CoreAudio support $coreaudio"
587echo "ALSA support $alsa"
588echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000589if test "$fmod" = "yes"; then
590 if test -z $fmod_lib || test -z $fmod_inc; then
591 echo
592 echo "Error: You must specify path to FMOD library and headers"
593 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
594 echo
595 exit 1
596 fi
pbrookb1a550a2006-04-16 13:28:56 +0000597 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
598else
599 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000600fi
pbrookb1a550a2006-04-16 13:28:56 +0000601echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000602echo "kqemu support $kqemu"
pbrookcc8ae6d2006-04-23 17:57:59 +0000603echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +0000604[ ! -z "$uname_release" ] && \
605echo "uname -r $uname_release"
bellard67b915a2004-03-31 23:37:16 +0000606
bellard97a847b2003-08-10 21:36:04 +0000607if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000608echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000609fi
bellard24b55b92005-03-01 22:30:41 +0000610#if test "$sdl_static" = "no"; then
611# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
612#fi
bellard97a847b2003-08-10 21:36:04 +0000613config_mak="config-host.mak"
614config_h="config-host.h"
615
bellard7c1f25b2004-04-22 00:02:08 +0000616#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000617
618echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000619echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000620echo "/* Automatically generated by configure - do not modify */" > $config_h
621
622echo "prefix=$prefix" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000623echo "bindir=$bindir" >> $config_mak
bellard5a671352003-10-01 00:13:48 +0000624echo "mandir=$mandir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000625echo "datadir=$datadir" >> $config_mak
bellard1f50f8d2004-05-08 14:44:43 +0000626echo "docdir=$docdir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000627echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000628echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000629echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000630echo "CC=$cc" >> $config_mak
631if test "$have_gcc3_options" = "yes" ; then
632 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
633fi
634echo "HOST_CC=$host_cc" >> $config_mak
635echo "AR=$ar" >> $config_mak
636echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
ths6f30fa82007-01-05 01:00:47 +0000637echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000638echo "CFLAGS=$CFLAGS" >> $config_mak
639echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000640echo "EXESUF=$EXESUF" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000641if test "$cpu" = "i386" ; then
642 echo "ARCH=i386" >> $config_mak
643 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000644elif test "$cpu" = "x86_64" ; then
645 echo "ARCH=x86_64" >> $config_mak
646 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000647elif test "$cpu" = "armv4b" ; then
648 echo "ARCH=arm" >> $config_mak
649 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000650elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000651 echo "ARCH=arm" >> $config_mak
652 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000653elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000654 echo "ARCH=ppc" >> $config_mak
655 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000656elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000657 echo "ARCH=mips" >> $config_mak
658 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000659elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000660 echo "ARCH=s390" >> $config_mak
661 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000662elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000663 echo "ARCH=alpha" >> $config_mak
664 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000665elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000666 echo "ARCH=sparc" >> $config_mak
667 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000668elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000669 echo "ARCH=sparc64" >> $config_mak
670 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000671elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000672 echo "ARCH=ia64" >> $config_mak
673 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000674elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000675 echo "ARCH=m68k" >> $config_mak
676 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000677else
678 echo "Unsupported CPU"
679 exit 1
680fi
681if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000682 echo "WORDS_BIGENDIAN=yes" >> $config_mak
683 echo "#define WORDS_BIGENDIAN 1" >> $config_h
684fi
bellardb6853692005-06-05 17:10:39 +0000685echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000686if test "$mingw32" = "yes" ; then
687 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000688 echo "#define CONFIG_WIN32 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000689elif test -f "/usr/include/byteswap.h" ; then
bellard67b915a2004-03-31 23:37:16 +0000690 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
691fi
bellard83fb7ad2004-07-05 21:25:26 +0000692if test "$darwin" = "yes" ; then
693 echo "CONFIG_DARWIN=yes" >> $config_mak
694 echo "#define CONFIG_DARWIN 1" >> $config_h
695fi
bellardec530c82006-04-25 22:36:06 +0000696if test "$solaris" = "yes" ; then
697 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +0000698 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
bellardec530c82006-04-25 22:36:06 +0000699fi
bellard67b915a2004-03-31 23:37:16 +0000700if test "$gdbstub" = "yes" ; then
701 echo "CONFIG_GDBSTUB=yes" >> $config_mak
702 echo "#define CONFIG_GDBSTUB 1" >> $config_h
703fi
bellard97a847b2003-08-10 21:36:04 +0000704if test "$gprof" = "yes" ; then
705 echo "TARGET_GPROF=yes" >> $config_mak
706 echo "#define HAVE_GPROF 1" >> $config_h
707fi
708if test "$static" = "yes" ; then
709 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000710 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000711fi
bellard05c2a3e2006-02-08 22:39:17 +0000712if test $profiler = "yes" ; then
713 echo "#define CONFIG_PROFILER 1" >> $config_h
714fi
bellardc20709a2004-04-21 23:27:19 +0000715if test "$slirp" = "yes" ; then
716 echo "CONFIG_SLIRP=yes" >> $config_mak
717 echo "#define CONFIG_SLIRP 1" >> $config_h
718fi
bellardfb065182004-11-09 23:09:44 +0000719if test "$adlib" = "yes" ; then
720 echo "CONFIG_ADLIB=yes" >> $config_mak
721 echo "#define CONFIG_ADLIB 1" >> $config_h
722fi
723if test "$oss" = "yes" ; then
724 echo "CONFIG_OSS=yes" >> $config_mak
725 echo "#define CONFIG_OSS 1" >> $config_h
726fi
bellard1d14ffa2005-10-30 18:58:22 +0000727if test "$coreaudio" = "yes" ; then
728 echo "CONFIG_COREAUDIO=yes" >> $config_mak
729 echo "#define CONFIG_COREAUDIO 1" >> $config_h
730fi
731if test "$alsa" = "yes" ; then
732 echo "CONFIG_ALSA=yes" >> $config_mak
733 echo "#define CONFIG_ALSA 1" >> $config_h
734fi
735if test "$dsound" = "yes" ; then
736 echo "CONFIG_DSOUND=yes" >> $config_mak
737 echo "#define CONFIG_DSOUND 1" >> $config_h
738fi
bellard102a52e2004-11-14 19:57:29 +0000739if test "$fmod" = "yes" ; then
740 echo "CONFIG_FMOD=yes" >> $config_mak
741 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
742 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
743 echo "#define CONFIG_FMOD 1" >> $config_h
744fi
pbrookb1a550a2006-04-16 13:28:56 +0000745qemu_version=`head $source_path/VERSION`
746echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +0000747echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000748
749echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000750if [ "$source_path_used" = "yes" ]; then
751 echo "VPATH=$source_path" >> $config_mak
752fi
bellard97a847b2003-08-10 21:36:04 +0000753echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +0000754if [ "$build_docs" = "yes" ] ; then
755 echo "BUILD_DOCS=yes" >> $config_mak
756fi
bellard97a847b2003-08-10 21:36:04 +0000757
bellard83fb7ad2004-07-05 21:25:26 +0000758# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000759if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000760 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000761 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000762 echo "#define _BSD 1" >> $config_h
763fi
764
pbrookc5937222006-05-14 11:30:38 +0000765echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
766
bellard1d14ffa2005-10-30 18:58:22 +0000767for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000768target_dir="$target"
769config_mak=$target_dir/config.mak
770config_h=$target_dir/config.h
771target_cpu=`echo $target | cut -d '-' -f 1`
772target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000773[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000774[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000775[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000776[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000777[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000778[ "$target_cpu" = "mips" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +0000779[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
pbrooke6e59062006-10-22 00:18:54 +0000780[ "$target_cpu" = "m68k" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000781target_softmmu="no"
782if expr $target : '.*-softmmu' > /dev/null ; then
783 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000784fi
bellard997344f2003-10-27 21:10:39 +0000785target_user_only="no"
786if expr $target : '.*-user' > /dev/null ; then
787 target_user_only="yes"
788fi
bellardde83cd02003-06-15 20:25:43 +0000789
bellard97ccc682005-07-02 13:32:17 +0000790if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000791 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000792 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +0000793 echo "To build QEMU without graphical output configure with --disable-gfx-check"
bellard97ccc682005-07-02 13:32:17 +0000794 echo "Note that this will disable all output from the virtual graphics card."
795 exit 1;
796fi
797
bellard7c1f25b2004-04-22 00:02:08 +0000798#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000799
800mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000801mkdir -p $target_dir/fpu
bellard808c4952004-12-19 23:33:47 +0000802if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
bellard69de9272004-02-16 21:40:43 +0000803 mkdir -p $target_dir/nwfpe
804fi
bellarda7e61ed2004-04-22 21:46:47 +0000805if test "$target_user_only" = "no" ; then
806 mkdir -p $target_dir/slirp
807fi
bellard69de9272004-02-16 21:40:43 +0000808
bellardec530c82006-04-25 22:36:06 +0000809#
810# don't use ln -sf as not all "ln -sf" over write the file/link
811#
812rm -f $target_dir/Makefile
813ln -s $source_path/Makefile.target $target_dir/Makefile
814
bellard97a847b2003-08-10 21:36:04 +0000815
816echo "# Automatically generated by configure - do not modify" > $config_mak
817echo "/* Automatically generated by configure - do not modify */" > $config_h
818
819
820echo "include ../config-host.mak" >> $config_mak
821echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000822
pbrooke5fe0c52006-06-11 13:32:59 +0000823bflt="no"
bellard1e43adf2003-09-30 20:54:24 +0000824interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
825echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000826
827if test "$target_cpu" = "i386" ; then
828 echo "TARGET_ARCH=i386" >> $config_mak
829 echo "#define TARGET_ARCH \"i386\"" >> $config_h
830 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000831 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000832 echo "#define USE_KQEMU 1" >> $config_h
833 fi
bellard808c4952004-12-19 23:33:47 +0000834elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000835 echo "TARGET_ARCH=arm" >> $config_mak
836 echo "#define TARGET_ARCH \"arm\"" >> $config_h
837 echo "#define TARGET_ARM 1" >> $config_h
pbrooke5fe0c52006-06-11 13:32:59 +0000838 bflt="yes"
bellard1e43adf2003-09-30 20:54:24 +0000839elif test "$target_cpu" = "sparc" ; then
840 echo "TARGET_ARCH=sparc" >> $config_mak
841 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
842 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000843elif test "$target_cpu" = "sparc64" ; then
844 echo "TARGET_ARCH=sparc64" >> $config_mak
845 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
846 echo "#define TARGET_SPARC 1" >> $config_h
847 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000848elif test "$target_cpu" = "ppc" ; then
849 echo "TARGET_ARCH=ppc" >> $config_mak
850 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
851 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000852elif test "$target_cpu" = "ppc64" ; then
853 echo "TARGET_ARCH=ppc64" >> $config_mak
854 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
855 echo "#define TARGET_PPC 1" >> $config_h
856 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000857elif test "$target_cpu" = "x86_64" ; then
858 echo "TARGET_ARCH=x86_64" >> $config_mak
859 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
860 echo "#define TARGET_I386 1" >> $config_h
861 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000862 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
863 echo "#define USE_KQEMU 1" >> $config_h
864 fi
bellardc20eb472005-12-06 21:42:55 +0000865elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000866 echo "TARGET_ARCH=mips" >> $config_mak
867 echo "#define TARGET_ARCH \"mips\"" >> $config_h
868 echo "#define TARGET_MIPS 1" >> $config_h
bellard6ea83fe2006-06-14 12:56:19 +0000869 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
870 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
pbrook908f52b2006-06-18 19:16:53 +0000871elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
bellardfdf9b3e2006-04-27 21:07:38 +0000872 echo "TARGET_ARCH=sh4" >> $config_mak
873 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
874 echo "#define TARGET_SH4 1" >> $config_h
pbrook4dbed892006-06-17 20:01:14 +0000875 bflt="yes"
pbrooke6e59062006-10-22 00:18:54 +0000876elif test "$target_cpu" = "m68k" ; then
877 echo "TARGET_ARCH=m68k" >> $config_mak
878 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
879 echo "#define TARGET_M68K 1" >> $config_h
880 bflt="yes"
bellardde83cd02003-06-15 20:25:43 +0000881else
882 echo "Unsupported target CPU"
883 exit 1
884fi
885if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000886 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
887 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
888fi
889if test "$target_softmmu" = "yes" ; then
890 echo "CONFIG_SOFTMMU=yes" >> $config_mak
891 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000892fi
bellard997344f2003-10-27 21:10:39 +0000893if test "$target_user_only" = "yes" ; then
894 echo "CONFIG_USER_ONLY=yes" >> $config_mak
895 echo "#define CONFIG_USER_ONLY 1" >> $config_h
896fi
bellardde83cd02003-06-15 20:25:43 +0000897
pbrooke6e59062006-10-22 00:18:54 +0000898if 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 +0000899 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
900 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
901fi
pbrooke5fe0c52006-06-11 13:32:59 +0000902if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
903 echo "TARGET_HAS_BFLT=yes" >> $config_mak
904 echo "#define TARGET_HAS_BFLT 1" >> $config_h
905fi
bellard7c1f25b2004-04-22 00:02:08 +0000906# sdl defines
907
908if test "$target_user_only" = "no"; then
909 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000910 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000911 else
bellarddbb2c922004-10-24 22:17:47 +0000912 sdl1=$sdl
913 fi
914 if test "$sdl1" = "yes" ; then
915 echo "#define CONFIG_SDL 1" >> $config_h
916 echo "CONFIG_SDL=yes" >> $config_mak
917 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
918 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
919 else
bellard7c1f25b2004-04-22 00:02:08 +0000920 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
921 fi
bellarddbb2c922004-10-24 22:17:47 +0000922 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000923 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
924 else
925 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000926 fi
bellard7c1f25b2004-04-22 00:02:08 +0000927 fi
bellard7c1f25b2004-04-22 00:02:08 +0000928fi
929
bellard5b0753e2005-03-01 21:37:28 +0000930if test "$cocoa" = "yes" ; then
931 echo "#define CONFIG_COCOA 1" >> $config_h
932 echo "CONFIG_COCOA=yes" >> $config_mak
933fi
934
bellard97a847b2003-08-10 21:36:04 +0000935done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000936
937# build tree in object directory if source path is different from current one
938if test "$source_path_used" = "yes" ; then
939 DIRS="tests"
940 FILES="Makefile tests/Makefile"
941 for dir in $DIRS ; do
942 mkdir -p $dir
943 done
bellardec530c82006-04-25 22:36:06 +0000944 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +0000945 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +0000946 rm -f $f
947 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +0000948 done
949fi
bellard7d132992003-03-06 23:23:54 +0000950
bellard97a847b2003-08-10 21:36:04 +0000951rm -f $TMPO $TMPC $TMPE $TMPS