blob: 9ab270e2896850eeb7353096d44a1ea0965f6499 [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"
bellardce05c322006-06-14 18:17:46 +000098build_acpi_tables="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"
106CFLAGS="-O2 -mno-cygwin"
107;;
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"
129;;
bellardec530c82006-04-25 22:36:06 +0000130SunOS)
131solaris="yes"
132;;
bellard1d14ffa2005-10-30 18:58:22 +0000133*)
bellardfb065182004-11-09 23:09:44 +0000134oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000135linux="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000136user="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000137if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000138 kqemu="yes"
139fi
bellardfb065182004-11-09 23:09:44 +0000140;;
bellard7d132992003-03-06 23:23:54 +0000141esac
142
bellard7d3505c2004-05-12 19:32:15 +0000143if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000144 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000145 make="gmake"
146 fi
bellard7d3505c2004-05-12 19:32:15 +0000147fi
148
bellardec530c82006-04-25 22:36:06 +0000149if [ "$solaris" = "yes" ] ; then
150 make="gmake"
151 install="ginstall"
152 solarisrev=`uname -r | cut -f2 -d.`
bellardec530c82006-04-25 22:36:06 +0000153fi
154
bellard7d132992003-03-06 23:23:54 +0000155# find source path
pbrookad064842006-04-16 12:41:07 +0000156source_path=`dirname "$0"`
157if [ -z "$source_path" ]; then
bellard7d132992003-03-06 23:23:54 +0000158 source_path=`pwd`
pbrookad064842006-04-16 12:41:07 +0000159else
160 source_path=`cd "$source_path"; pwd`
161fi
162if test "$source_path" = `pwd` ; then
bellard7d132992003-03-06 23:23:54 +0000163 source_path_used="no"
pbrookad064842006-04-16 12:41:07 +0000164else
165 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000166fi
167
168for opt do
pbrooka46e4032006-04-29 23:05:22 +0000169 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000170 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000171 --help|-h) show_help=yes
172 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000173 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000174 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000175 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000176 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000177 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000178 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000179 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000180 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000181 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000182 --cc=*) cc="$optarg"
bellard7d132992003-03-06 23:23:54 +0000183 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000184 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000185 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000186 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000187 ;;
pbrook6a882642006-04-17 13:57:12 +0000188 --install=*) install="$optarg"
189 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000190 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000191 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000192 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000193 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000194 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000195 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000196 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000197 ;;
bellard7d132992003-03-06 23:23:54 +0000198 --enable-gprof) gprof="yes"
199 ;;
bellard43ce4df2003-06-09 19:53:12 +0000200 --static) static="yes"
201 ;;
bellard97a847b2003-08-10 21:36:04 +0000202 --disable-sdl) sdl="no"
203 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000204 --enable-coreaudio) coreaudio="yes"
205 ;;
206 --enable-alsa) alsa="yes"
207 ;;
208 --enable-dsound) dsound="yes"
209 ;;
bellard102a52e2004-11-14 19:57:29 +0000210 --enable-fmod) fmod="yes"
211 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000212 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000213 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000214 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000215 ;;
bellard67b915a2004-03-31 23:37:16 +0000216 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
bellard1d14ffa2005-10-30 18:58:22 +0000217 ;;
bellard443f1372004-06-04 11:13:20 +0000218 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000219 ;;
bellardfb065182004-11-09 23:09:44 +0000220 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000221 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000222 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000223 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000224 --enable-profiler) profiler="yes"
225 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000226 --kernel-path=*) kernel_path="$optarg"
bellard1d14ffa2005-10-30 18:58:22 +0000227 ;;
228 --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 ;;
bellardce05c322006-06-14 18:17:46 +0000244 --enable-iasl) build_acpi_tables="yes"
245 ;;
bellard7d132992003-03-06 23:23:54 +0000246 esac
247done
248
249# Checking for CFLAGS
250if test -z "$CFLAGS"; then
251 CFLAGS="-O2"
252fi
253
pbrookaf5db582006-04-08 14:26:41 +0000254if test x"$show_help" = x"yes" ; then
255cat << EOF
256
257Usage: configure [options]
258Options: [defaults in brackets after descriptions]
259
260EOF
261echo "Standard options:"
262echo " --help print this message"
263echo " --prefix=PREFIX install in PREFIX [$prefix]"
264echo " --interp-prefix=PREFIX where to find shared libraries, etc."
265echo " use %M for cpu name [$interp_prefix]"
266echo " --target-list=LIST set target list [$target_list]"
267echo ""
268echo "kqemu kernel acceleration support:"
269echo " --disable-kqemu disable kqemu support"
270echo " --kernel-path=PATH set the kernel path (configure probes it)"
271echo ""
272echo "Advanced options (experts only):"
273echo " --source-path=PATH path of source code [$source_path]"
274echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
275echo " --cc=CC use C compiler CC [$cc]"
276echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
277echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000278echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000279echo " --static enable static build [$static]"
280echo " --enable-cocoa enable COCOA (Mac OS X only)"
281echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
282echo " --enable-adlib enable Adlib emulation"
283echo " --enable-coreaudio enable Coreaudio audio driver"
284echo " --enable-alsa enable ALSA audio driver"
285echo " --enable-fmod enable FMOD audio driver"
286echo " --enabled-dsound enable DirectSound audio driver"
287echo " --enable-system enable all system emulation targets"
288echo " --disable-system disable all system emulation targets"
289echo " --enable-user enable all linux usermode emulation targets"
290echo " --disable-user disable all linux usermode emulation targets"
291echo " --fmod-lib path to FMOD library"
292echo " --fmod-inc path to FMOD includes"
pbrookc5937222006-05-14 11:30:38 +0000293echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
bellardce05c322006-06-14 18:17:46 +0000294echo " --enable-iasl compilation of ACPI tables with the IASL compiler"
pbrookaf5db582006-04-08 14:26:41 +0000295echo ""
296echo "NOTE: The object files are build at the place where configure is launched"
297exit 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
bellardec530c82006-04-25 22:36:06 +0000325#
326# Solaris specific configure tool chain decisions
327#
328if test "$solaris" = "yes" ; then
329 #
330 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
331 # override the check with --disable-gcc-check
332 #
333 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
334 solgcc=`which $cc`
335 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
336 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
337 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
338 echo "or get the latest patch from SunSolve for gcc"
339 exit 1
340 fi
341 fi
342 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
343 if test -z "$solinst" ; then
344 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
345 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
346 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
347 exit 1
348 fi
349 if test "$solinst" = "/usr/sbin/install" ; then
350 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
351 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
352 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
353 exit 1
354 fi
bellardec530c82006-04-25 22:36:06 +0000355 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
356 if test -z "$sol_ar" ; then
357 echo "Error: No path includes ar"
358 if test -f /usr/ccs/bin/ar ; then
359 echo "Add /usr/ccs/bin to your path and rerun configure"
360 fi
361 exit 1
362 fi
363fi
364
365
bellard5327cf42005-01-10 23:18:50 +0000366if test -z "$target_list" ; then
367# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000368 if [ "$softmmu" = "yes" ] ; then
369 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
370 fi
bellard5327cf42005-01-10 23:18:50 +0000371# the following are Linux specific
pbrook0a8e90f2006-03-19 14:54:16 +0000372 if [ "$user" = "yes" ] ; then
bellard215cf0b2006-05-03 20:18:43 +0000373 target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000374 fi
bellard6e20a452005-06-05 15:56:02 +0000375else
pbrookb1a550a2006-04-16 13:28:56 +0000376 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000377fi
pbrook0a8e90f2006-03-19 14:54:16 +0000378if test -z "$target_list" ; then
379 echo "No targets enabled"
380 exit 1
381fi
bellard5327cf42005-01-10 23:18:50 +0000382
bellard7d132992003-03-06 23:23:54 +0000383if test -z "$cross_prefix" ; then
384
385# ---
386# big/little endian test
387cat > $TMPC << EOF
388#include <inttypes.h>
389int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000390 volatile uint32_t i=0x01234567;
391 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000392}
393EOF
394
395if $cc -o $TMPE $TMPC 2>/dev/null ; then
396$TMPE && bigendian="yes"
397else
398echo big/little test failed
399fi
400
401else
402
403# if cross compiling, cannot launch a program, so make a static guess
bellard808c4952004-12-19 23:33:47 +0000404if 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 +0000405 bigendian="yes"
406fi
407
408fi
409
bellardb6853692005-06-05 17:10:39 +0000410# host long bits test
411hostlongbits="32"
412if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
413 hostlongbits="64"
414fi
415
bellarde8cd23d2003-06-25 16:08:13 +0000416# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000417cat > $TMPC <<EOF
418int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000419}
420EOF
421
bellarde8cd23d2003-06-25 16:08:13 +0000422have_gcc3_options="no"
423if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
424 have_gcc3_options="yes"
bellard04369ff2003-03-20 22:33:23 +0000425fi
bellardca735202003-03-18 20:41:34 +0000426
pbrookb1a550a2006-04-16 13:28:56 +0000427# Check for gcc4, error if pre-gcc4
bellard1aff3812005-11-02 22:30:45 +0000428if test "$check_gcc" = "yes" ; then
429 cat > $TMPC <<EOF
pbrookb1a550a2006-04-16 13:28:56 +0000430#if __GNUC__ < 4
431#error gcc3
bellard1aff3812005-11-02 22:30:45 +0000432#endif
433int main(){return 0;}
434EOF
pbrookb1a550a2006-04-16 13:28:56 +0000435 if $cc -o $TMPO $TMPC 2>/dev/null ; then
bellard1aff3812005-11-02 22:30:45 +0000436 echo "ERROR: \"$cc\" looks like gcc 4.x"
437 echo "QEMU is known to have problems when compiled with gcc 4.x"
438 echo "It is recommended that you use gcc 3.x to build QEMU"
439 echo "To use this compiler anyway, configure with --disable-gcc-check"
440 exit 1;
441 fi
442fi
443
bellard11d9f692004-04-02 20:55:59 +0000444##########################################
445# SDL probe
446
447sdl_too_old=no
448
449if test -z "$sdl" ; then
450
bellarda6e022a2004-04-02 21:55:47 +0000451sdl_config="sdl-config"
452sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000453sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000454
455if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
456# win32 cross compilation case
457 sdl_config="i386-mingw32msvc-sdl-config"
458 sdl=yes
459else
460# normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000461cat > $TMPC << EOF
462#include <SDL.h>
463#undef main /* We don't want SDL to override our main() */
464int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
465EOF
466
bellarda6e022a2004-04-02 21:55:47 +0000467if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
468_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
bellard11d9f692004-04-02 20:55:59 +0000469if test "$_sdlversion" -lt 121 ; then
470sdl_too_old=yes
471else
472sdl=yes
473fi
bellard7c1f25b2004-04-22 00:02:08 +0000474
475# static link with sdl ?
476if test "$sdl" = "yes" ; then
477aa="no"
478`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
479sdl_static_libs=`$sdl_config --static-libs`
480if [ "$aa" = "yes" ] ; then
bellardd8d8aa42004-04-29 20:14:07 +0000481 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000482fi
483
bellard7c1f25b2004-04-22 00:02:08 +0000484if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
485 sdl_static=yes
486fi
487
488fi # static link
489
490fi # sdl compile test
491
bellarda6e022a2004-04-02 21:55:47 +0000492fi # cross compilation
493fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000494
pbrookcc8ae6d2006-04-23 17:57:59 +0000495# Check if tools are available to build documentation.
pbrook94ac5152006-04-26 16:07:35 +0000496if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +0000497 build_docs="yes"
498fi
499
bellard11d9f692004-04-02 20:55:59 +0000500if test "$mingw32" = "yes" ; then
501if test -z "$prefix" ; then
502 prefix="/c/Program Files/Qemu"
503fi
504mandir="$prefix"
bellard7efa4382004-05-12 18:54:06 +0000505datadir="$prefix"
bellard1f50f8d2004-05-08 14:44:43 +0000506docdir="$prefix"
bellard11d9f692004-04-02 20:55:59 +0000507bindir="$prefix"
508else
509if test -z "$prefix" ; then
510 prefix="/usr/local"
511fi
bellard5a671352003-10-01 00:13:48 +0000512mandir="$prefix/share/man"
bellard7efa4382004-05-12 18:54:06 +0000513datadir="$prefix/share/qemu"
bellard1f50f8d2004-05-08 14:44:43 +0000514docdir="$prefix/share/doc/qemu"
bellard11d9f692004-04-02 20:55:59 +0000515bindir="$prefix/bin"
516fi
bellard5a671352003-10-01 00:13:48 +0000517
bellard43ce4df2003-06-09 19:53:12 +0000518echo "Install prefix $prefix"
bellard7efa4382004-05-12 18:54:06 +0000519echo "BIOS directory $datadir"
bellard11d9f692004-04-02 20:55:59 +0000520echo "binary directory $bindir"
521if test "$mingw32" = "no" ; then
522echo "Manual directory $mandir"
bellard43ce4df2003-06-09 19:53:12 +0000523echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000524fi
bellard5a671352003-10-01 00:13:48 +0000525echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000526echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000527echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000528echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000529echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000530echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000531echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000532echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000533echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000534echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000535echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000536if test "$darwin" = "yes" ; then
537 echo "Cocoa support $cocoa"
538fi
bellard97a847b2003-08-10 21:36:04 +0000539echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000540if test "$sdl" != "no" ; then
541 echo "SDL static link $sdl_static"
542fi
bellard67b915a2004-03-31 23:37:16 +0000543echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000544echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000545echo "CoreAudio support $coreaudio"
546echo "ALSA support $alsa"
547echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000548if test "$fmod" = "yes"; then
549 if test -z $fmod_lib || test -z $fmod_inc; then
550 echo
551 echo "Error: You must specify path to FMOD library and headers"
552 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
553 echo
554 exit 1
555 fi
pbrookb1a550a2006-04-16 13:28:56 +0000556 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
557else
558 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000559fi
pbrookb1a550a2006-04-16 13:28:56 +0000560echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000561echo "kqemu support $kqemu"
pbrookcc8ae6d2006-04-23 17:57:59 +0000562echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +0000563[ ! -z "$uname_release" ] && \
564echo "uname -r $uname_release"
bellard67b915a2004-03-31 23:37:16 +0000565
bellard97a847b2003-08-10 21:36:04 +0000566if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000567echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000568fi
bellard24b55b92005-03-01 22:30:41 +0000569#if test "$sdl_static" = "no"; then
570# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
571#fi
bellard97a847b2003-08-10 21:36:04 +0000572config_mak="config-host.mak"
573config_h="config-host.h"
574
bellard7c1f25b2004-04-22 00:02:08 +0000575#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000576
577echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000578echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000579echo "/* Automatically generated by configure - do not modify */" > $config_h
580
581echo "prefix=$prefix" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000582echo "bindir=$bindir" >> $config_mak
bellard5a671352003-10-01 00:13:48 +0000583echo "mandir=$mandir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000584echo "datadir=$datadir" >> $config_mak
bellard1f50f8d2004-05-08 14:44:43 +0000585echo "docdir=$docdir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000586echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000587echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000588echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000589echo "CC=$cc" >> $config_mak
590if test "$have_gcc3_options" = "yes" ; then
591 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
592fi
593echo "HOST_CC=$host_cc" >> $config_mak
594echo "AR=$ar" >> $config_mak
595echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
596echo "CFLAGS=$CFLAGS" >> $config_mak
597echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000598echo "EXESUF=$EXESUF" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000599if test "$cpu" = "i386" ; then
600 echo "ARCH=i386" >> $config_mak
601 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000602elif test "$cpu" = "x86_64" ; then
603 echo "ARCH=x86_64" >> $config_mak
604 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000605elif test "$cpu" = "armv4b" ; then
606 echo "ARCH=arm" >> $config_mak
607 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000608elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000609 echo "ARCH=arm" >> $config_mak
610 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000611elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000612 echo "ARCH=ppc" >> $config_mak
613 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000614elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000615 echo "ARCH=mips" >> $config_mak
616 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000617elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000618 echo "ARCH=s390" >> $config_mak
619 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000620elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000621 echo "ARCH=alpha" >> $config_mak
622 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000623elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000624 echo "ARCH=sparc" >> $config_mak
625 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000626elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000627 echo "ARCH=sparc64" >> $config_mak
628 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000629elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000630 echo "ARCH=ia64" >> $config_mak
631 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000632elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000633 echo "ARCH=m68k" >> $config_mak
634 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000635else
636 echo "Unsupported CPU"
637 exit 1
638fi
639if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000640 echo "WORDS_BIGENDIAN=yes" >> $config_mak
641 echo "#define WORDS_BIGENDIAN 1" >> $config_h
642fi
bellardb6853692005-06-05 17:10:39 +0000643echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000644if test "$mingw32" = "yes" ; then
645 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000646 echo "#define CONFIG_WIN32 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000647elif test -f "/usr/include/byteswap.h" ; then
bellard67b915a2004-03-31 23:37:16 +0000648 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
649fi
bellard83fb7ad2004-07-05 21:25:26 +0000650if test "$darwin" = "yes" ; then
651 echo "CONFIG_DARWIN=yes" >> $config_mak
652 echo "#define CONFIG_DARWIN 1" >> $config_h
653fi
bellardec530c82006-04-25 22:36:06 +0000654if test "$solaris" = "yes" ; then
655 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +0000656 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
bellardec530c82006-04-25 22:36:06 +0000657fi
bellard67b915a2004-03-31 23:37:16 +0000658if test "$gdbstub" = "yes" ; then
659 echo "CONFIG_GDBSTUB=yes" >> $config_mak
660 echo "#define CONFIG_GDBSTUB 1" >> $config_h
661fi
bellard97a847b2003-08-10 21:36:04 +0000662if test "$gprof" = "yes" ; then
663 echo "TARGET_GPROF=yes" >> $config_mak
664 echo "#define HAVE_GPROF 1" >> $config_h
665fi
666if test "$static" = "yes" ; then
667 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000668 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000669fi
bellard05c2a3e2006-02-08 22:39:17 +0000670if test $profiler = "yes" ; then
671 echo "#define CONFIG_PROFILER 1" >> $config_h
672fi
bellardc20709a2004-04-21 23:27:19 +0000673if test "$slirp" = "yes" ; then
674 echo "CONFIG_SLIRP=yes" >> $config_mak
675 echo "#define CONFIG_SLIRP 1" >> $config_h
676fi
bellardfb065182004-11-09 23:09:44 +0000677if test "$adlib" = "yes" ; then
678 echo "CONFIG_ADLIB=yes" >> $config_mak
679 echo "#define CONFIG_ADLIB 1" >> $config_h
680fi
681if test "$oss" = "yes" ; then
682 echo "CONFIG_OSS=yes" >> $config_mak
683 echo "#define CONFIG_OSS 1" >> $config_h
684fi
bellard1d14ffa2005-10-30 18:58:22 +0000685if test "$coreaudio" = "yes" ; then
686 echo "CONFIG_COREAUDIO=yes" >> $config_mak
687 echo "#define CONFIG_COREAUDIO 1" >> $config_h
688fi
689if test "$alsa" = "yes" ; then
690 echo "CONFIG_ALSA=yes" >> $config_mak
691 echo "#define CONFIG_ALSA 1" >> $config_h
692fi
693if test "$dsound" = "yes" ; then
694 echo "CONFIG_DSOUND=yes" >> $config_mak
695 echo "#define CONFIG_DSOUND 1" >> $config_h
696fi
bellard102a52e2004-11-14 19:57:29 +0000697if test "$fmod" = "yes" ; then
698 echo "CONFIG_FMOD=yes" >> $config_mak
699 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
700 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
701 echo "#define CONFIG_FMOD 1" >> $config_h
702fi
pbrookb1a550a2006-04-16 13:28:56 +0000703qemu_version=`head $source_path/VERSION`
704echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +0000705echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000706
707echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000708if [ "$source_path_used" = "yes" ]; then
709 echo "VPATH=$source_path" >> $config_mak
710fi
bellard97a847b2003-08-10 21:36:04 +0000711echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +0000712if [ "$build_docs" = "yes" ] ; then
713 echo "BUILD_DOCS=yes" >> $config_mak
714fi
bellardce05c322006-06-14 18:17:46 +0000715if [ "$build_acpi_tables" = "yes" ] ; then
716 echo "BUILD_ACPI_TABLES=yes" >> $config_mak
717fi
bellard97a847b2003-08-10 21:36:04 +0000718
bellard83fb7ad2004-07-05 21:25:26 +0000719# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000720if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000721 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000722 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000723 echo "#define _BSD 1" >> $config_h
724fi
725
pbrookc5937222006-05-14 11:30:38 +0000726echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
727
bellard1d14ffa2005-10-30 18:58:22 +0000728for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000729target_dir="$target"
730config_mak=$target_dir/config.mak
731config_h=$target_dir/config.h
732target_cpu=`echo $target | cut -d '-' -f 1`
733target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000734[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000735[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000736[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000737[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000738[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000739[ "$target_cpu" = "mips" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000740target_softmmu="no"
741if expr $target : '.*-softmmu' > /dev/null ; then
742 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000743fi
bellard997344f2003-10-27 21:10:39 +0000744target_user_only="no"
745if expr $target : '.*-user' > /dev/null ; then
746 target_user_only="yes"
747fi
bellardde83cd02003-06-15 20:25:43 +0000748
bellard97ccc682005-07-02 13:32:17 +0000749if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000750 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000751 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +0000752 echo "To build QEMU without graphical output configure with --disable-gfx-check"
bellard97ccc682005-07-02 13:32:17 +0000753 echo "Note that this will disable all output from the virtual graphics card."
754 exit 1;
755fi
756
bellard7c1f25b2004-04-22 00:02:08 +0000757#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000758
759mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000760mkdir -p $target_dir/fpu
bellard808c4952004-12-19 23:33:47 +0000761if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
bellard69de9272004-02-16 21:40:43 +0000762 mkdir -p $target_dir/nwfpe
763fi
bellarda7e61ed2004-04-22 21:46:47 +0000764if test "$target_user_only" = "no" ; then
765 mkdir -p $target_dir/slirp
766fi
bellard69de9272004-02-16 21:40:43 +0000767
bellardec530c82006-04-25 22:36:06 +0000768#
769# don't use ln -sf as not all "ln -sf" over write the file/link
770#
771rm -f $target_dir/Makefile
772ln -s $source_path/Makefile.target $target_dir/Makefile
773
bellard97a847b2003-08-10 21:36:04 +0000774
775echo "# Automatically generated by configure - do not modify" > $config_mak
776echo "/* Automatically generated by configure - do not modify */" > $config_h
777
778
779echo "include ../config-host.mak" >> $config_mak
780echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000781
pbrooke5fe0c52006-06-11 13:32:59 +0000782bflt="no"
bellard1e43adf2003-09-30 20:54:24 +0000783interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
784echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000785
786if test "$target_cpu" = "i386" ; then
787 echo "TARGET_ARCH=i386" >> $config_mak
788 echo "#define TARGET_ARCH \"i386\"" >> $config_h
789 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000790 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000791 echo "#define USE_KQEMU 1" >> $config_h
792 fi
bellard808c4952004-12-19 23:33:47 +0000793elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000794 echo "TARGET_ARCH=arm" >> $config_mak
795 echo "#define TARGET_ARCH \"arm\"" >> $config_h
796 echo "#define TARGET_ARM 1" >> $config_h
pbrooke5fe0c52006-06-11 13:32:59 +0000797 bflt="yes"
bellard1e43adf2003-09-30 20:54:24 +0000798elif test "$target_cpu" = "sparc" ; then
799 echo "TARGET_ARCH=sparc" >> $config_mak
800 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
801 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000802elif test "$target_cpu" = "sparc64" ; then
803 echo "TARGET_ARCH=sparc64" >> $config_mak
804 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
805 echo "#define TARGET_SPARC 1" >> $config_h
806 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000807elif test "$target_cpu" = "ppc" ; then
808 echo "TARGET_ARCH=ppc" >> $config_mak
809 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
810 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000811elif test "$target_cpu" = "ppc64" ; then
812 echo "TARGET_ARCH=ppc64" >> $config_mak
813 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
814 echo "#define TARGET_PPC 1" >> $config_h
815 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000816elif test "$target_cpu" = "x86_64" ; then
817 echo "TARGET_ARCH=x86_64" >> $config_mak
818 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
819 echo "#define TARGET_I386 1" >> $config_h
820 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000821 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
822 echo "#define USE_KQEMU 1" >> $config_h
823 fi
bellardc20eb472005-12-06 21:42:55 +0000824elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000825 echo "TARGET_ARCH=mips" >> $config_mak
826 echo "#define TARGET_ARCH \"mips\"" >> $config_h
827 echo "#define TARGET_MIPS 1" >> $config_h
bellard6ea83fe2006-06-14 12:56:19 +0000828 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
829 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
bellardfdf9b3e2006-04-27 21:07:38 +0000830elif test "$target_cpu" = "sh4" ; then
831 echo "TARGET_ARCH=sh4" >> $config_mak
832 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
833 echo "#define TARGET_SH4 1" >> $config_h
pbrook4dbed892006-06-17 20:01:14 +0000834 bflt="yes"
bellardde83cd02003-06-15 20:25:43 +0000835else
836 echo "Unsupported target CPU"
837 exit 1
838fi
839if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000840 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
841 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
842fi
843if test "$target_softmmu" = "yes" ; then
844 echo "CONFIG_SOFTMMU=yes" >> $config_mak
845 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000846fi
bellard997344f2003-10-27 21:10:39 +0000847if test "$target_user_only" = "yes" ; then
848 echo "CONFIG_USER_ONLY=yes" >> $config_mak
849 echo "#define CONFIG_USER_ONLY 1" >> $config_h
850fi
bellardde83cd02003-06-15 20:25:43 +0000851
bellard158142c2005-03-13 16:54:06 +0000852if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
853 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
854 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
855fi
pbrooke5fe0c52006-06-11 13:32:59 +0000856if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
857 echo "TARGET_HAS_BFLT=yes" >> $config_mak
858 echo "#define TARGET_HAS_BFLT 1" >> $config_h
859fi
bellard7c1f25b2004-04-22 00:02:08 +0000860# sdl defines
861
862if test "$target_user_only" = "no"; then
863 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000864 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000865 else
bellarddbb2c922004-10-24 22:17:47 +0000866 sdl1=$sdl
867 fi
868 if test "$sdl1" = "yes" ; then
869 echo "#define CONFIG_SDL 1" >> $config_h
870 echo "CONFIG_SDL=yes" >> $config_mak
871 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
872 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
873 else
bellard7c1f25b2004-04-22 00:02:08 +0000874 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
875 fi
bellarddbb2c922004-10-24 22:17:47 +0000876 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000877 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
878 else
879 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000880 fi
bellard7c1f25b2004-04-22 00:02:08 +0000881 fi
bellard7c1f25b2004-04-22 00:02:08 +0000882fi
883
bellard5b0753e2005-03-01 21:37:28 +0000884if test "$cocoa" = "yes" ; then
885 echo "#define CONFIG_COCOA 1" >> $config_h
886 echo "CONFIG_COCOA=yes" >> $config_mak
887fi
888
bellard97a847b2003-08-10 21:36:04 +0000889done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000890
891# build tree in object directory if source path is different from current one
892if test "$source_path_used" = "yes" ; then
893 DIRS="tests"
894 FILES="Makefile tests/Makefile"
895 for dir in $DIRS ; do
896 mkdir -p $dir
897 done
bellardec530c82006-04-25 22:36:06 +0000898 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +0000899 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +0000900 rm -f $f
901 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +0000902 done
903fi
bellard7d132992003-03-06 23:23:54 +0000904
bellard97a847b2003-08-10 21:36:04 +0000905rm -f $TMPO $TMPC $TMPE $TMPS