blob: 6845fccca606015298989109ed17c27b5cb416d8 [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"
25host_cc="gcc"
26ar="ar"
27make="make"
pbrook6a882642006-04-17 13:57:12 +000028install="install"
bellard7d132992003-03-06 23:23:54 +000029strip="strip"
30cpu=`uname -m`
bellard5327cf42005-01-10 23:18:50 +000031target_list=""
bellard7d132992003-03-06 23:23:54 +000032case "$cpu" in
33 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +000034 cpu="i386"
bellard7d132992003-03-06 23:23:54 +000035 ;;
bellardba680552005-03-13 09:49:52 +000036 armv*b)
bellard808c4952004-12-19 23:33:47 +000037 cpu="armv4b"
38 ;;
bellardba680552005-03-13 09:49:52 +000039 armv*l)
bellard7d132992003-03-06 23:23:54 +000040 cpu="armv4l"
41 ;;
42 alpha)
43 cpu="alpha"
44 ;;
bellard295defa2003-04-07 21:31:29 +000045 "Power Macintosh"|ppc|ppc64)
bellard7d132992003-03-06 23:23:54 +000046 cpu="powerpc"
47 ;;
48 mips)
49 cpu="mips"
50 ;;
bellardfb3e5842003-03-29 17:32:36 +000051 s390)
52 cpu="s390"
53 ;;
pbrook94ac5152006-04-26 16:07:35 +000054 sparc|sun4[muv])
bellardae228532003-05-13 18:59:59 +000055 cpu="sparc"
56 ;;
57 sparc64)
58 cpu="sparc64"
59 ;;
bellarda8baa8c2003-04-29 20:53:31 +000060 ia64)
61 cpu="ia64"
62 ;;
bellard38e584a2003-08-10 22:14:22 +000063 m68k)
64 cpu="m68k"
65 ;;
bellardbc51c5c2004-03-17 23:46:04 +000066 x86_64|amd64)
bellard0b0babc2005-01-03 23:38:40 +000067 cpu="x86_64"
bellardbc51c5c2004-03-17 23:46:04 +000068 ;;
bellard7d132992003-03-06 23:23:54 +000069 *)
70 cpu="unknown"
71 ;;
72esac
73gprof="no"
74bigendian="no"
bellard67b915a2004-03-31 23:37:16 +000075mingw32="no"
76EXESUF=""
77gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +000078slirp="yes"
bellardfb065182004-11-09 23:09:44 +000079adlib="no"
80oss="no"
bellard1d14ffa2005-10-30 18:58:22 +000081dsound="no"
82coreaudio="no"
83alsa="no"
bellard102a52e2004-11-14 19:57:29 +000084fmod="no"
85fmod_lib=""
86fmod_inc=""
pbrookb1a550a2006-04-16 13:28:56 +000087bsd="no"
bellard5327cf42005-01-10 23:18:50 +000088linux="no"
bellardc9ec1fe2005-02-10 21:55:30 +000089kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +000090profiler="no"
bellardc9ec1fe2005-02-10 21:55:30 +000091kernel_path=""
bellard5b0753e2005-03-01 21:37:28 +000092cocoa="no"
bellard97ccc682005-07-02 13:32:17 +000093check_gfx="yes"
bellard1aff3812005-11-02 22:30:45 +000094check_gcc="yes"
pbrook0a8e90f2006-03-19 14:54:16 +000095softmmu="yes"
96user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +000097build_docs="no"
bellard7d132992003-03-06 23:23:54 +000098
99# OS specific
100targetos=`uname -s`
101case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000102CYGWIN*)
103mingw32="yes"
104CFLAGS="-O2 -mno-cygwin"
105;;
bellard67b915a2004-03-31 23:37:16 +0000106MINGW32*)
107mingw32="yes"
108;;
bellard7d3505c2004-05-12 19:32:15 +0000109FreeBSD)
110bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000111oss="yes"
bellarde99f9062005-07-28 21:45:38 +0000112if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000113 kqemu="yes"
114fi
bellard7d3505c2004-05-12 19:32:15 +0000115;;
116NetBSD)
117bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000118oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000119;;
120OpenBSD)
121bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000122oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000123;;
bellard83fb7ad2004-07-05 21:25:26 +0000124Darwin)
125bsd="yes"
126darwin="yes"
127;;
bellardec530c82006-04-25 22:36:06 +0000128SunOS)
129solaris="yes"
130;;
bellard1d14ffa2005-10-30 18:58:22 +0000131*)
bellardfb065182004-11-09 23:09:44 +0000132oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000133linux="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000134user="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000135if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000136 kqemu="yes"
137fi
bellardfb065182004-11-09 23:09:44 +0000138;;
bellard7d132992003-03-06 23:23:54 +0000139esac
140
bellard7d3505c2004-05-12 19:32:15 +0000141if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000142 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000143 make="gmake"
144 fi
bellard7d3505c2004-05-12 19:32:15 +0000145fi
146
bellardec530c82006-04-25 22:36:06 +0000147if [ "$solaris" = "yes" ] ; then
148 make="gmake"
149 install="ginstall"
150 solarisrev=`uname -r | cut -f2 -d.`
bellardec530c82006-04-25 22:36:06 +0000151fi
152
bellard7d132992003-03-06 23:23:54 +0000153# find source path
pbrookad064842006-04-16 12:41:07 +0000154source_path=`dirname "$0"`
155if [ -z "$source_path" ]; then
bellard7d132992003-03-06 23:23:54 +0000156 source_path=`pwd`
pbrookad064842006-04-16 12:41:07 +0000157else
158 source_path=`cd "$source_path"; pwd`
159fi
160if test "$source_path" = `pwd` ; then
bellard7d132992003-03-06 23:23:54 +0000161 source_path_used="no"
pbrookad064842006-04-16 12:41:07 +0000162else
163 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000164fi
165
166for opt do
pbrooka46e4032006-04-29 23:05:22 +0000167 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000168 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000169 --help|-h) show_help=yes
170 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000171 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000172 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000173 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000174 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000175 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000176 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000177 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000178 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000179 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000180 --cc=*) cc="$optarg"
bellard7d132992003-03-06 23:23:54 +0000181 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000182 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000183 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000184 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000185 ;;
pbrook6a882642006-04-17 13:57:12 +0000186 --install=*) install="$optarg"
187 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000188 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000189 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000190 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000191 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000192 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000193 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000194 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000195 ;;
bellard7d132992003-03-06 23:23:54 +0000196 --enable-gprof) gprof="yes"
197 ;;
bellard43ce4df2003-06-09 19:53:12 +0000198 --static) static="yes"
199 ;;
bellard97a847b2003-08-10 21:36:04 +0000200 --disable-sdl) sdl="no"
201 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000202 --enable-coreaudio) coreaudio="yes"
203 ;;
204 --enable-alsa) alsa="yes"
205 ;;
206 --enable-dsound) dsound="yes"
207 ;;
bellard102a52e2004-11-14 19:57:29 +0000208 --enable-fmod) fmod="yes"
209 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000210 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000211 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000212 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000213 ;;
bellard67b915a2004-03-31 23:37:16 +0000214 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
bellard1d14ffa2005-10-30 18:58:22 +0000215 ;;
bellard443f1372004-06-04 11:13:20 +0000216 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000217 ;;
bellardfb065182004-11-09 23:09:44 +0000218 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000219 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000220 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000221 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000222 --enable-profiler) profiler="yes"
223 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000224 --kernel-path=*) kernel_path="$optarg"
bellard1d14ffa2005-10-30 18:58:22 +0000225 ;;
226 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
227 ;;
bellard97ccc682005-07-02 13:32:17 +0000228 --disable-gfx-check) check_gfx="no"
229 ;;
bellard1aff3812005-11-02 22:30:45 +0000230 --disable-gcc-check) check_gcc="no"
231 ;;
pbrookcad25d62006-03-19 16:31:11 +0000232 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000233 ;;
pbrookcad25d62006-03-19 16:31:11 +0000234 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000235 ;;
236 --disable-user) user="no"
237 ;;
238 --enable-user) user="yes"
239 ;;
bellard7d132992003-03-06 23:23:54 +0000240 esac
241done
242
243# Checking for CFLAGS
244if test -z "$CFLAGS"; then
245 CFLAGS="-O2"
246fi
247
pbrookaf5db582006-04-08 14:26:41 +0000248if test x"$show_help" = x"yes" ; then
249cat << EOF
250
251Usage: configure [options]
252Options: [defaults in brackets after descriptions]
253
254EOF
255echo "Standard options:"
256echo " --help print this message"
257echo " --prefix=PREFIX install in PREFIX [$prefix]"
258echo " --interp-prefix=PREFIX where to find shared libraries, etc."
259echo " use %M for cpu name [$interp_prefix]"
260echo " --target-list=LIST set target list [$target_list]"
261echo ""
262echo "kqemu kernel acceleration support:"
263echo " --disable-kqemu disable kqemu support"
264echo " --kernel-path=PATH set the kernel path (configure probes it)"
265echo ""
266echo "Advanced options (experts only):"
267echo " --source-path=PATH path of source code [$source_path]"
268echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
269echo " --cc=CC use C compiler CC [$cc]"
270echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
271echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000272echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000273echo " --static enable static build [$static]"
274echo " --enable-cocoa enable COCOA (Mac OS X only)"
275echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
276echo " --enable-adlib enable Adlib emulation"
277echo " --enable-coreaudio enable Coreaudio audio driver"
278echo " --enable-alsa enable ALSA audio driver"
279echo " --enable-fmod enable FMOD audio driver"
280echo " --enabled-dsound enable DirectSound audio driver"
281echo " --enable-system enable all system emulation targets"
282echo " --disable-system disable all system emulation targets"
283echo " --enable-user enable all linux usermode emulation targets"
284echo " --disable-user disable all linux usermode emulation targets"
285echo " --fmod-lib path to FMOD library"
286echo " --fmod-inc path to FMOD includes"
287echo ""
288echo "NOTE: The object files are build at the place where configure is launched"
289exit 1
290fi
291
bellard7d132992003-03-06 23:23:54 +0000292cc="${cross_prefix}${cc}"
293ar="${cross_prefix}${ar}"
294strip="${cross_prefix}${strip}"
295
pbrook94ac5152006-04-26 16:07:35 +0000296if [ ! -x "`which $cc`" ] ; then
bellarda7350fa2006-04-23 14:35:23 +0000297 echo "Compiler $cc could not be found"
298 exit
299fi
300
bellard67b915a2004-03-31 23:37:16 +0000301if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000302 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000303 EXESUF=".exe"
304 gdbstub="no"
bellard9f059ec2004-11-14 18:59:52 +0000305 oss="no"
bellard07f4ddb2005-04-23 17:44:28 +0000306 if [ "$cpu" = "i386" ] ; then
307 kqemu="yes"
308 fi
bellard67b915a2004-03-31 23:37:16 +0000309fi
310
bellardec530c82006-04-25 22:36:06 +0000311#
312# Solaris specific configure tool chain decisions
313#
314if test "$solaris" = "yes" ; then
315 #
316 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
317 # override the check with --disable-gcc-check
318 #
319 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
320 solgcc=`which $cc`
321 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
322 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
323 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
324 echo "or get the latest patch from SunSolve for gcc"
325 exit 1
326 fi
327 fi
328 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
329 if test -z "$solinst" ; then
330 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
331 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
332 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
333 exit 1
334 fi
335 if test "$solinst" = "/usr/sbin/install" ; then
336 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
337 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
338 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
339 exit 1
340 fi
bellardec530c82006-04-25 22:36:06 +0000341 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
342 if test -z "$sol_ar" ; then
343 echo "Error: No path includes ar"
344 if test -f /usr/ccs/bin/ar ; then
345 echo "Add /usr/ccs/bin to your path and rerun configure"
346 fi
347 exit 1
348 fi
349fi
350
351
bellard5327cf42005-01-10 23:18:50 +0000352if test -z "$target_list" ; then
353# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000354 if [ "$softmmu" = "yes" ] ; then
355 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
356 fi
bellard5327cf42005-01-10 23:18:50 +0000357# the following are Linux specific
pbrook0a8e90f2006-03-19 14:54:16 +0000358 if [ "$user" = "yes" ] ; then
bellardfdf9b3e2006-04-27 21:07:38 +0000359 target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user sh4-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000360 fi
bellard6e20a452005-06-05 15:56:02 +0000361else
pbrookb1a550a2006-04-16 13:28:56 +0000362 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000363fi
pbrook0a8e90f2006-03-19 14:54:16 +0000364if test -z "$target_list" ; then
365 echo "No targets enabled"
366 exit 1
367fi
bellard5327cf42005-01-10 23:18:50 +0000368
bellard7d132992003-03-06 23:23:54 +0000369if test -z "$cross_prefix" ; then
370
371# ---
372# big/little endian test
373cat > $TMPC << EOF
374#include <inttypes.h>
375int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000376 volatile uint32_t i=0x01234567;
377 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000378}
379EOF
380
381if $cc -o $TMPE $TMPC 2>/dev/null ; then
382$TMPE && bigendian="yes"
383else
384echo big/little test failed
385fi
386
387else
388
389# if cross compiling, cannot launch a program, so make a static guess
bellard808c4952004-12-19 23:33:47 +0000390if 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 +0000391 bigendian="yes"
392fi
393
394fi
395
bellardb6853692005-06-05 17:10:39 +0000396# host long bits test
397hostlongbits="32"
398if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
399 hostlongbits="64"
400fi
401
bellarde8cd23d2003-06-25 16:08:13 +0000402# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000403cat > $TMPC <<EOF
404int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000405}
406EOF
407
bellarde8cd23d2003-06-25 16:08:13 +0000408have_gcc3_options="no"
409if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
410 have_gcc3_options="yes"
bellard04369ff2003-03-20 22:33:23 +0000411fi
bellardca735202003-03-18 20:41:34 +0000412
pbrookb1a550a2006-04-16 13:28:56 +0000413# Check for gcc4, error if pre-gcc4
bellard1aff3812005-11-02 22:30:45 +0000414if test "$check_gcc" = "yes" ; then
415 cat > $TMPC <<EOF
pbrookb1a550a2006-04-16 13:28:56 +0000416#if __GNUC__ < 4
417#error gcc3
bellard1aff3812005-11-02 22:30:45 +0000418#endif
419int main(){return 0;}
420EOF
pbrookb1a550a2006-04-16 13:28:56 +0000421 if $cc -o $TMPO $TMPC 2>/dev/null ; then
bellard1aff3812005-11-02 22:30:45 +0000422 echo "ERROR: \"$cc\" looks like gcc 4.x"
423 echo "QEMU is known to have problems when compiled with gcc 4.x"
424 echo "It is recommended that you use gcc 3.x to build QEMU"
425 echo "To use this compiler anyway, configure with --disable-gcc-check"
426 exit 1;
427 fi
428fi
429
bellard11d9f692004-04-02 20:55:59 +0000430##########################################
431# SDL probe
432
433sdl_too_old=no
434
435if test -z "$sdl" ; then
436
bellarda6e022a2004-04-02 21:55:47 +0000437sdl_config="sdl-config"
438sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000439sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000440
441if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
442# win32 cross compilation case
443 sdl_config="i386-mingw32msvc-sdl-config"
444 sdl=yes
445else
446# normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000447cat > $TMPC << EOF
448#include <SDL.h>
449#undef main /* We don't want SDL to override our main() */
450int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
451EOF
452
bellarda6e022a2004-04-02 21:55:47 +0000453if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
454_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
bellard11d9f692004-04-02 20:55:59 +0000455if test "$_sdlversion" -lt 121 ; then
456sdl_too_old=yes
457else
458sdl=yes
459fi
bellard7c1f25b2004-04-22 00:02:08 +0000460
461# static link with sdl ?
462if test "$sdl" = "yes" ; then
463aa="no"
464`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
465sdl_static_libs=`$sdl_config --static-libs`
466if [ "$aa" = "yes" ] ; then
bellardd8d8aa42004-04-29 20:14:07 +0000467 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000468fi
469
bellard7c1f25b2004-04-22 00:02:08 +0000470if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
471 sdl_static=yes
472fi
473
474fi # static link
475
476fi # sdl compile test
477
bellarda6e022a2004-04-02 21:55:47 +0000478fi # cross compilation
479fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000480
pbrookcc8ae6d2006-04-23 17:57:59 +0000481# Check if tools are available to build documentation.
pbrook94ac5152006-04-26 16:07:35 +0000482if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +0000483 build_docs="yes"
484fi
485
bellard11d9f692004-04-02 20:55:59 +0000486if test "$mingw32" = "yes" ; then
487if test -z "$prefix" ; then
488 prefix="/c/Program Files/Qemu"
489fi
490mandir="$prefix"
bellard7efa4382004-05-12 18:54:06 +0000491datadir="$prefix"
bellard1f50f8d2004-05-08 14:44:43 +0000492docdir="$prefix"
bellard11d9f692004-04-02 20:55:59 +0000493bindir="$prefix"
494else
495if test -z "$prefix" ; then
496 prefix="/usr/local"
497fi
bellard5a671352003-10-01 00:13:48 +0000498mandir="$prefix/share/man"
bellard7efa4382004-05-12 18:54:06 +0000499datadir="$prefix/share/qemu"
bellard1f50f8d2004-05-08 14:44:43 +0000500docdir="$prefix/share/doc/qemu"
bellard11d9f692004-04-02 20:55:59 +0000501bindir="$prefix/bin"
502fi
bellard5a671352003-10-01 00:13:48 +0000503
bellard43ce4df2003-06-09 19:53:12 +0000504echo "Install prefix $prefix"
bellard7efa4382004-05-12 18:54:06 +0000505echo "BIOS directory $datadir"
bellard11d9f692004-04-02 20:55:59 +0000506echo "binary directory $bindir"
507if test "$mingw32" = "no" ; then
508echo "Manual directory $mandir"
bellard43ce4df2003-06-09 19:53:12 +0000509echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000510fi
bellard5a671352003-10-01 00:13:48 +0000511echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000512echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000513echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000514echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000515echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000516echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000517echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000518echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000519echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000520echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000521echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000522if test "$darwin" = "yes" ; then
523 echo "Cocoa support $cocoa"
524fi
bellard97a847b2003-08-10 21:36:04 +0000525echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000526if test "$sdl" != "no" ; then
527 echo "SDL static link $sdl_static"
528fi
bellard67b915a2004-03-31 23:37:16 +0000529echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000530echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000531echo "CoreAudio support $coreaudio"
532echo "ALSA support $alsa"
533echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000534if test "$fmod" = "yes"; then
535 if test -z $fmod_lib || test -z $fmod_inc; then
536 echo
537 echo "Error: You must specify path to FMOD library and headers"
538 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
539 echo
540 exit 1
541 fi
pbrookb1a550a2006-04-16 13:28:56 +0000542 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
543else
544 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000545fi
pbrookb1a550a2006-04-16 13:28:56 +0000546echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000547echo "kqemu support $kqemu"
pbrookcc8ae6d2006-04-23 17:57:59 +0000548echo "Documentation $build_docs"
bellard67b915a2004-03-31 23:37:16 +0000549
bellard97a847b2003-08-10 21:36:04 +0000550if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000551echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000552fi
bellard24b55b92005-03-01 22:30:41 +0000553#if test "$sdl_static" = "no"; then
554# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
555#fi
bellard97a847b2003-08-10 21:36:04 +0000556config_mak="config-host.mak"
557config_h="config-host.h"
558
bellard7c1f25b2004-04-22 00:02:08 +0000559#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000560
561echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000562echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000563echo "/* Automatically generated by configure - do not modify */" > $config_h
564
565echo "prefix=$prefix" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000566echo "bindir=$bindir" >> $config_mak
bellard5a671352003-10-01 00:13:48 +0000567echo "mandir=$mandir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000568echo "datadir=$datadir" >> $config_mak
bellard1f50f8d2004-05-08 14:44:43 +0000569echo "docdir=$docdir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000570echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000571echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000572echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000573echo "CC=$cc" >> $config_mak
574if test "$have_gcc3_options" = "yes" ; then
575 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
576fi
577echo "HOST_CC=$host_cc" >> $config_mak
578echo "AR=$ar" >> $config_mak
579echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
580echo "CFLAGS=$CFLAGS" >> $config_mak
581echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000582echo "EXESUF=$EXESUF" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000583if test "$cpu" = "i386" ; then
584 echo "ARCH=i386" >> $config_mak
585 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000586elif test "$cpu" = "x86_64" ; then
587 echo "ARCH=x86_64" >> $config_mak
588 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000589elif test "$cpu" = "armv4b" ; then
590 echo "ARCH=arm" >> $config_mak
591 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000592elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000593 echo "ARCH=arm" >> $config_mak
594 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000595elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000596 echo "ARCH=ppc" >> $config_mak
597 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000598elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000599 echo "ARCH=mips" >> $config_mak
600 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000601elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000602 echo "ARCH=s390" >> $config_mak
603 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000604elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000605 echo "ARCH=alpha" >> $config_mak
606 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000607elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000608 echo "ARCH=sparc" >> $config_mak
609 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000610elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000611 echo "ARCH=sparc64" >> $config_mak
612 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000613elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000614 echo "ARCH=ia64" >> $config_mak
615 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000616elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000617 echo "ARCH=m68k" >> $config_mak
618 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000619else
620 echo "Unsupported CPU"
621 exit 1
622fi
623if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000624 echo "WORDS_BIGENDIAN=yes" >> $config_mak
625 echo "#define WORDS_BIGENDIAN 1" >> $config_h
626fi
bellardb6853692005-06-05 17:10:39 +0000627echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000628if test "$mingw32" = "yes" ; then
629 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000630 echo "#define CONFIG_WIN32 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000631elif test -f "/usr/include/byteswap.h" ; then
bellard67b915a2004-03-31 23:37:16 +0000632 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
633fi
bellard83fb7ad2004-07-05 21:25:26 +0000634if test "$darwin" = "yes" ; then
635 echo "CONFIG_DARWIN=yes" >> $config_mak
636 echo "#define CONFIG_DARWIN 1" >> $config_h
637fi
bellardec530c82006-04-25 22:36:06 +0000638if test "$solaris" = "yes" ; then
639 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +0000640 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
bellardec530c82006-04-25 22:36:06 +0000641fi
bellard67b915a2004-03-31 23:37:16 +0000642if test "$gdbstub" = "yes" ; then
643 echo "CONFIG_GDBSTUB=yes" >> $config_mak
644 echo "#define CONFIG_GDBSTUB 1" >> $config_h
645fi
bellard97a847b2003-08-10 21:36:04 +0000646if test "$gprof" = "yes" ; then
647 echo "TARGET_GPROF=yes" >> $config_mak
648 echo "#define HAVE_GPROF 1" >> $config_h
649fi
650if test "$static" = "yes" ; then
651 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000652 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000653fi
bellard05c2a3e2006-02-08 22:39:17 +0000654if test $profiler = "yes" ; then
655 echo "#define CONFIG_PROFILER 1" >> $config_h
656fi
bellardc20709a2004-04-21 23:27:19 +0000657if test "$slirp" = "yes" ; then
658 echo "CONFIG_SLIRP=yes" >> $config_mak
659 echo "#define CONFIG_SLIRP 1" >> $config_h
660fi
bellardfb065182004-11-09 23:09:44 +0000661if test "$adlib" = "yes" ; then
662 echo "CONFIG_ADLIB=yes" >> $config_mak
663 echo "#define CONFIG_ADLIB 1" >> $config_h
664fi
665if test "$oss" = "yes" ; then
666 echo "CONFIG_OSS=yes" >> $config_mak
667 echo "#define CONFIG_OSS 1" >> $config_h
668fi
bellard1d14ffa2005-10-30 18:58:22 +0000669if test "$coreaudio" = "yes" ; then
670 echo "CONFIG_COREAUDIO=yes" >> $config_mak
671 echo "#define CONFIG_COREAUDIO 1" >> $config_h
672fi
673if test "$alsa" = "yes" ; then
674 echo "CONFIG_ALSA=yes" >> $config_mak
675 echo "#define CONFIG_ALSA 1" >> $config_h
676fi
677if test "$dsound" = "yes" ; then
678 echo "CONFIG_DSOUND=yes" >> $config_mak
679 echo "#define CONFIG_DSOUND 1" >> $config_h
680fi
bellard102a52e2004-11-14 19:57:29 +0000681if test "$fmod" = "yes" ; then
682 echo "CONFIG_FMOD=yes" >> $config_mak
683 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
684 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
685 echo "#define CONFIG_FMOD 1" >> $config_h
686fi
pbrookb1a550a2006-04-16 13:28:56 +0000687qemu_version=`head $source_path/VERSION`
688echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +0000689echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000690
691echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000692if [ "$source_path_used" = "yes" ]; then
693 echo "VPATH=$source_path" >> $config_mak
694fi
bellard97a847b2003-08-10 21:36:04 +0000695echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +0000696if [ "$build_docs" = "yes" ] ; then
697 echo "BUILD_DOCS=yes" >> $config_mak
698fi
bellard97a847b2003-08-10 21:36:04 +0000699
bellard83fb7ad2004-07-05 21:25:26 +0000700# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000701if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000702 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000703 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000704 echo "#define _BSD 1" >> $config_h
705fi
706
bellard1d14ffa2005-10-30 18:58:22 +0000707for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000708target_dir="$target"
709config_mak=$target_dir/config.mak
710config_h=$target_dir/config.h
711target_cpu=`echo $target | cut -d '-' -f 1`
712target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000713[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000714[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000715[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000716[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000717[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000718[ "$target_cpu" = "mips" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000719target_softmmu="no"
720if expr $target : '.*-softmmu' > /dev/null ; then
721 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000722fi
bellard997344f2003-10-27 21:10:39 +0000723target_user_only="no"
724if expr $target : '.*-user' > /dev/null ; then
725 target_user_only="yes"
726fi
bellardde83cd02003-06-15 20:25:43 +0000727
bellard97ccc682005-07-02 13:32:17 +0000728if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000729 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000730 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +0000731 echo "To build QEMU without graphical output configure with --disable-gfx-check"
bellard97ccc682005-07-02 13:32:17 +0000732 echo "Note that this will disable all output from the virtual graphics card."
733 exit 1;
734fi
735
bellard7c1f25b2004-04-22 00:02:08 +0000736#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000737
738mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000739mkdir -p $target_dir/fpu
bellard808c4952004-12-19 23:33:47 +0000740if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
bellard69de9272004-02-16 21:40:43 +0000741 mkdir -p $target_dir/nwfpe
742fi
bellarda7e61ed2004-04-22 21:46:47 +0000743if test "$target_user_only" = "no" ; then
744 mkdir -p $target_dir/slirp
745fi
bellard69de9272004-02-16 21:40:43 +0000746
bellardec530c82006-04-25 22:36:06 +0000747#
748# don't use ln -sf as not all "ln -sf" over write the file/link
749#
750rm -f $target_dir/Makefile
751ln -s $source_path/Makefile.target $target_dir/Makefile
752
bellard97a847b2003-08-10 21:36:04 +0000753
754echo "# Automatically generated by configure - do not modify" > $config_mak
755echo "/* Automatically generated by configure - do not modify */" > $config_h
756
757
758echo "include ../config-host.mak" >> $config_mak
759echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000760
761interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
762echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000763
764if test "$target_cpu" = "i386" ; then
765 echo "TARGET_ARCH=i386" >> $config_mak
766 echo "#define TARGET_ARCH \"i386\"" >> $config_h
767 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000768 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000769 echo "#define USE_KQEMU 1" >> $config_h
770 fi
bellard808c4952004-12-19 23:33:47 +0000771elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000772 echo "TARGET_ARCH=arm" >> $config_mak
773 echo "#define TARGET_ARCH \"arm\"" >> $config_h
774 echo "#define TARGET_ARM 1" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000775elif test "$target_cpu" = "sparc" ; then
776 echo "TARGET_ARCH=sparc" >> $config_mak
777 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
778 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000779elif test "$target_cpu" = "sparc64" ; then
780 echo "TARGET_ARCH=sparc64" >> $config_mak
781 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
782 echo "#define TARGET_SPARC 1" >> $config_h
783 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000784elif test "$target_cpu" = "ppc" ; then
785 echo "TARGET_ARCH=ppc" >> $config_mak
786 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
787 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000788elif test "$target_cpu" = "ppc64" ; then
789 echo "TARGET_ARCH=ppc64" >> $config_mak
790 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
791 echo "#define TARGET_PPC 1" >> $config_h
792 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000793elif test "$target_cpu" = "x86_64" ; then
794 echo "TARGET_ARCH=x86_64" >> $config_mak
795 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
796 echo "#define TARGET_I386 1" >> $config_h
797 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000798 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
799 echo "#define USE_KQEMU 1" >> $config_h
800 fi
bellardc20eb472005-12-06 21:42:55 +0000801elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000802 echo "TARGET_ARCH=mips" >> $config_mak
803 echo "#define TARGET_ARCH \"mips\"" >> $config_h
804 echo "#define TARGET_MIPS 1" >> $config_h
bellardfdf9b3e2006-04-27 21:07:38 +0000805elif test "$target_cpu" = "sh4" ; then
806 echo "TARGET_ARCH=sh4" >> $config_mak
807 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
808 echo "#define TARGET_SH4 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000809else
810 echo "Unsupported target CPU"
811 exit 1
812fi
813if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000814 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
815 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
816fi
817if test "$target_softmmu" = "yes" ; then
818 echo "CONFIG_SOFTMMU=yes" >> $config_mak
819 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000820fi
bellard997344f2003-10-27 21:10:39 +0000821if test "$target_user_only" = "yes" ; then
822 echo "CONFIG_USER_ONLY=yes" >> $config_mak
823 echo "#define CONFIG_USER_ONLY 1" >> $config_h
824fi
bellardde83cd02003-06-15 20:25:43 +0000825
bellard158142c2005-03-13 16:54:06 +0000826if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
827 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
828 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
829fi
bellard7c1f25b2004-04-22 00:02:08 +0000830# sdl defines
831
832if test "$target_user_only" = "no"; then
833 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000834 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000835 else
bellarddbb2c922004-10-24 22:17:47 +0000836 sdl1=$sdl
837 fi
838 if test "$sdl1" = "yes" ; then
839 echo "#define CONFIG_SDL 1" >> $config_h
840 echo "CONFIG_SDL=yes" >> $config_mak
841 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
842 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
843 else
bellard7c1f25b2004-04-22 00:02:08 +0000844 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
845 fi
bellarddbb2c922004-10-24 22:17:47 +0000846 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000847 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
848 else
849 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000850 fi
bellard7c1f25b2004-04-22 00:02:08 +0000851 fi
bellard7c1f25b2004-04-22 00:02:08 +0000852fi
853
bellard5b0753e2005-03-01 21:37:28 +0000854if test "$cocoa" = "yes" ; then
855 echo "#define CONFIG_COCOA 1" >> $config_h
856 echo "CONFIG_COCOA=yes" >> $config_mak
857fi
858
bellard97a847b2003-08-10 21:36:04 +0000859done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000860
861# build tree in object directory if source path is different from current one
862if test "$source_path_used" = "yes" ; then
863 DIRS="tests"
864 FILES="Makefile tests/Makefile"
865 for dir in $DIRS ; do
866 mkdir -p $dir
867 done
bellardec530c82006-04-25 22:36:06 +0000868 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +0000869 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +0000870 rm -f $f
871 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +0000872 done
873fi
bellard7d132992003-03-06 23:23:54 +0000874
bellard97a847b2003-08-10 21:36:04 +0000875rm -f $TMPO $TMPC $TMPE $TMPS