blob: f9417a6fa3cdece1f43b767330dbee32e0f2ac5d [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"
pbrookc5937222006-05-14 11:30:38 +000098uname_release=""
bellard7d132992003-03-06 23:23:54 +000099
100# OS specific
101targetos=`uname -s`
102case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000103CYGWIN*)
104mingw32="yes"
105CFLAGS="-O2 -mno-cygwin"
106;;
bellard67b915a2004-03-31 23:37:16 +0000107MINGW32*)
108mingw32="yes"
109;;
bellard7d3505c2004-05-12 19:32:15 +0000110FreeBSD)
111bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000112oss="yes"
bellarde99f9062005-07-28 21:45:38 +0000113if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000114 kqemu="yes"
115fi
bellard7d3505c2004-05-12 19:32:15 +0000116;;
117NetBSD)
118bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000119oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000120;;
121OpenBSD)
122bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000123oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000124;;
bellard83fb7ad2004-07-05 21:25:26 +0000125Darwin)
126bsd="yes"
127darwin="yes"
128;;
bellardec530c82006-04-25 22:36:06 +0000129SunOS)
130solaris="yes"
131;;
bellard1d14ffa2005-10-30 18:58:22 +0000132*)
bellardfb065182004-11-09 23:09:44 +0000133oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000134linux="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000135user="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000136if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000137 kqemu="yes"
138fi
bellardfb065182004-11-09 23:09:44 +0000139;;
bellard7d132992003-03-06 23:23:54 +0000140esac
141
bellard7d3505c2004-05-12 19:32:15 +0000142if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000143 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000144 make="gmake"
145 fi
bellard7d3505c2004-05-12 19:32:15 +0000146fi
147
bellardec530c82006-04-25 22:36:06 +0000148if [ "$solaris" = "yes" ] ; then
149 make="gmake"
150 install="ginstall"
151 solarisrev=`uname -r | cut -f2 -d.`
bellardec530c82006-04-25 22:36:06 +0000152fi
153
bellard7d132992003-03-06 23:23:54 +0000154# find source path
pbrookad064842006-04-16 12:41:07 +0000155source_path=`dirname "$0"`
156if [ -z "$source_path" ]; then
bellard7d132992003-03-06 23:23:54 +0000157 source_path=`pwd`
pbrookad064842006-04-16 12:41:07 +0000158else
159 source_path=`cd "$source_path"; pwd`
160fi
161if test "$source_path" = `pwd` ; then
bellard7d132992003-03-06 23:23:54 +0000162 source_path_used="no"
pbrookad064842006-04-16 12:41:07 +0000163else
164 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000165fi
166
167for opt do
pbrooka46e4032006-04-29 23:05:22 +0000168 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000169 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000170 --help|-h) show_help=yes
171 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000172 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000173 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000174 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000175 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000176 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000177 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000178 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000179 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000180 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000181 --cc=*) cc="$optarg"
bellard7d132992003-03-06 23:23:54 +0000182 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000183 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000184 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000185 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000186 ;;
pbrook6a882642006-04-17 13:57:12 +0000187 --install=*) install="$optarg"
188 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000189 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000190 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000191 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000192 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000193 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000194 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000195 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000196 ;;
bellard7d132992003-03-06 23:23:54 +0000197 --enable-gprof) gprof="yes"
198 ;;
bellard43ce4df2003-06-09 19:53:12 +0000199 --static) static="yes"
200 ;;
bellard97a847b2003-08-10 21:36:04 +0000201 --disable-sdl) sdl="no"
202 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000203 --enable-coreaudio) coreaudio="yes"
204 ;;
205 --enable-alsa) alsa="yes"
206 ;;
207 --enable-dsound) dsound="yes"
208 ;;
bellard102a52e2004-11-14 19:57:29 +0000209 --enable-fmod) fmod="yes"
210 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000211 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000212 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000213 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000214 ;;
bellard67b915a2004-03-31 23:37:16 +0000215 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
bellard1d14ffa2005-10-30 18:58:22 +0000216 ;;
bellard443f1372004-06-04 11:13:20 +0000217 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000218 ;;
bellardfb065182004-11-09 23:09:44 +0000219 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000220 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000221 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000222 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000223 --enable-profiler) profiler="yes"
224 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000225 --kernel-path=*) kernel_path="$optarg"
bellard1d14ffa2005-10-30 18:58:22 +0000226 ;;
227 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
228 ;;
bellard97ccc682005-07-02 13:32:17 +0000229 --disable-gfx-check) check_gfx="no"
230 ;;
bellard1aff3812005-11-02 22:30:45 +0000231 --disable-gcc-check) check_gcc="no"
232 ;;
pbrookcad25d62006-03-19 16:31:11 +0000233 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000234 ;;
pbrookcad25d62006-03-19 16:31:11 +0000235 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000236 ;;
237 --disable-user) user="no"
238 ;;
239 --enable-user) user="yes"
240 ;;
pbrookc5937222006-05-14 11:30:38 +0000241 --enable-uname-release=*) uname_release="$optarg"
242 ;;
bellard7d132992003-03-06 23:23:54 +0000243 esac
244done
245
246# Checking for CFLAGS
247if test -z "$CFLAGS"; then
248 CFLAGS="-O2"
249fi
250
pbrookaf5db582006-04-08 14:26:41 +0000251if test x"$show_help" = x"yes" ; then
252cat << EOF
253
254Usage: configure [options]
255Options: [defaults in brackets after descriptions]
256
257EOF
258echo "Standard options:"
259echo " --help print this message"
260echo " --prefix=PREFIX install in PREFIX [$prefix]"
261echo " --interp-prefix=PREFIX where to find shared libraries, etc."
262echo " use %M for cpu name [$interp_prefix]"
263echo " --target-list=LIST set target list [$target_list]"
264echo ""
265echo "kqemu kernel acceleration support:"
266echo " --disable-kqemu disable kqemu support"
267echo " --kernel-path=PATH set the kernel path (configure probes it)"
268echo ""
269echo "Advanced options (experts only):"
270echo " --source-path=PATH path of source code [$source_path]"
271echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
272echo " --cc=CC use C compiler CC [$cc]"
273echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
274echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000275echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000276echo " --static enable static build [$static]"
277echo " --enable-cocoa enable COCOA (Mac OS X only)"
278echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
279echo " --enable-adlib enable Adlib emulation"
280echo " --enable-coreaudio enable Coreaudio audio driver"
281echo " --enable-alsa enable ALSA audio driver"
282echo " --enable-fmod enable FMOD audio driver"
283echo " --enabled-dsound enable DirectSound audio driver"
284echo " --enable-system enable all system emulation targets"
285echo " --disable-system disable all system emulation targets"
286echo " --enable-user enable all linux usermode emulation targets"
287echo " --disable-user disable all linux usermode emulation targets"
288echo " --fmod-lib path to FMOD library"
289echo " --fmod-inc path to FMOD includes"
pbrookc5937222006-05-14 11:30:38 +0000290echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
pbrookaf5db582006-04-08 14:26:41 +0000291echo ""
292echo "NOTE: The object files are build at the place where configure is launched"
293exit 1
294fi
295
bellard7d132992003-03-06 23:23:54 +0000296cc="${cross_prefix}${cc}"
297ar="${cross_prefix}${ar}"
298strip="${cross_prefix}${strip}"
299
pbrook064aae12006-05-08 00:51:44 +0000300# check that the C compiler works.
301cat > $TMPC <<EOF
302int main(void) {}
303EOF
304
305if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
306 : C compiler works ok
307else
308 echo "ERROR: \"$cc\" either does not exist or does not work"
309 exit 1
bellarda7350fa2006-04-23 14:35:23 +0000310fi
311
bellard67b915a2004-03-31 23:37:16 +0000312if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000313 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000314 EXESUF=".exe"
315 gdbstub="no"
bellard9f059ec2004-11-14 18:59:52 +0000316 oss="no"
bellard07f4ddb2005-04-23 17:44:28 +0000317 if [ "$cpu" = "i386" ] ; then
318 kqemu="yes"
319 fi
bellard67b915a2004-03-31 23:37:16 +0000320fi
321
bellardec530c82006-04-25 22:36:06 +0000322#
323# Solaris specific configure tool chain decisions
324#
325if test "$solaris" = "yes" ; then
326 #
327 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
328 # override the check with --disable-gcc-check
329 #
330 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
331 solgcc=`which $cc`
332 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
333 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
334 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
335 echo "or get the latest patch from SunSolve for gcc"
336 exit 1
337 fi
338 fi
339 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
340 if test -z "$solinst" ; then
341 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
342 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
343 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
344 exit 1
345 fi
346 if test "$solinst" = "/usr/sbin/install" ; then
347 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
348 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
349 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
350 exit 1
351 fi
bellardec530c82006-04-25 22:36:06 +0000352 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
353 if test -z "$sol_ar" ; then
354 echo "Error: No path includes ar"
355 if test -f /usr/ccs/bin/ar ; then
356 echo "Add /usr/ccs/bin to your path and rerun configure"
357 fi
358 exit 1
359 fi
360fi
361
362
bellard5327cf42005-01-10 23:18:50 +0000363if test -z "$target_list" ; then
364# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000365 if [ "$softmmu" = "yes" ] ; then
366 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
367 fi
bellard5327cf42005-01-10 23:18:50 +0000368# the following are Linux specific
pbrook0a8e90f2006-03-19 14:54:16 +0000369 if [ "$user" = "yes" ] ; then
bellard215cf0b2006-05-03 20:18:43 +0000370 target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000371 fi
bellard6e20a452005-06-05 15:56:02 +0000372else
pbrookb1a550a2006-04-16 13:28:56 +0000373 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000374fi
pbrook0a8e90f2006-03-19 14:54:16 +0000375if test -z "$target_list" ; then
376 echo "No targets enabled"
377 exit 1
378fi
bellard5327cf42005-01-10 23:18:50 +0000379
bellard7d132992003-03-06 23:23:54 +0000380if test -z "$cross_prefix" ; then
381
382# ---
383# big/little endian test
384cat > $TMPC << EOF
385#include <inttypes.h>
386int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000387 volatile uint32_t i=0x01234567;
388 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000389}
390EOF
391
392if $cc -o $TMPE $TMPC 2>/dev/null ; then
393$TMPE && bigendian="yes"
394else
395echo big/little test failed
396fi
397
398else
399
400# if cross compiling, cannot launch a program, so make a static guess
bellard808c4952004-12-19 23:33:47 +0000401if 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 +0000402 bigendian="yes"
403fi
404
405fi
406
bellardb6853692005-06-05 17:10:39 +0000407# host long bits test
408hostlongbits="32"
409if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
410 hostlongbits="64"
411fi
412
bellarde8cd23d2003-06-25 16:08:13 +0000413# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000414cat > $TMPC <<EOF
415int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000416}
417EOF
418
bellarde8cd23d2003-06-25 16:08:13 +0000419have_gcc3_options="no"
420if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
421 have_gcc3_options="yes"
bellard04369ff2003-03-20 22:33:23 +0000422fi
bellardca735202003-03-18 20:41:34 +0000423
pbrookb1a550a2006-04-16 13:28:56 +0000424# Check for gcc4, error if pre-gcc4
bellard1aff3812005-11-02 22:30:45 +0000425if test "$check_gcc" = "yes" ; then
426 cat > $TMPC <<EOF
pbrookb1a550a2006-04-16 13:28:56 +0000427#if __GNUC__ < 4
428#error gcc3
bellard1aff3812005-11-02 22:30:45 +0000429#endif
430int main(){return 0;}
431EOF
pbrookb1a550a2006-04-16 13:28:56 +0000432 if $cc -o $TMPO $TMPC 2>/dev/null ; then
bellard1aff3812005-11-02 22:30:45 +0000433 echo "ERROR: \"$cc\" looks like gcc 4.x"
434 echo "QEMU is known to have problems when compiled with gcc 4.x"
435 echo "It is recommended that you use gcc 3.x to build QEMU"
436 echo "To use this compiler anyway, configure with --disable-gcc-check"
437 exit 1;
438 fi
439fi
440
bellard11d9f692004-04-02 20:55:59 +0000441##########################################
442# SDL probe
443
444sdl_too_old=no
445
446if test -z "$sdl" ; then
447
bellarda6e022a2004-04-02 21:55:47 +0000448sdl_config="sdl-config"
449sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000450sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000451
452if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
453# win32 cross compilation case
454 sdl_config="i386-mingw32msvc-sdl-config"
455 sdl=yes
456else
457# normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000458cat > $TMPC << EOF
459#include <SDL.h>
460#undef main /* We don't want SDL to override our main() */
461int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
462EOF
463
bellarda6e022a2004-04-02 21:55:47 +0000464if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
465_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
bellard11d9f692004-04-02 20:55:59 +0000466if test "$_sdlversion" -lt 121 ; then
467sdl_too_old=yes
468else
469sdl=yes
470fi
bellard7c1f25b2004-04-22 00:02:08 +0000471
472# static link with sdl ?
473if test "$sdl" = "yes" ; then
474aa="no"
475`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
476sdl_static_libs=`$sdl_config --static-libs`
477if [ "$aa" = "yes" ] ; then
bellardd8d8aa42004-04-29 20:14:07 +0000478 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000479fi
480
bellard7c1f25b2004-04-22 00:02:08 +0000481if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
482 sdl_static=yes
483fi
484
485fi # static link
486
487fi # sdl compile test
488
bellarda6e022a2004-04-02 21:55:47 +0000489fi # cross compilation
490fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000491
pbrookcc8ae6d2006-04-23 17:57:59 +0000492# Check if tools are available to build documentation.
pbrook94ac5152006-04-26 16:07:35 +0000493if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +0000494 build_docs="yes"
495fi
496
bellard11d9f692004-04-02 20:55:59 +0000497if test "$mingw32" = "yes" ; then
498if test -z "$prefix" ; then
499 prefix="/c/Program Files/Qemu"
500fi
501mandir="$prefix"
bellard7efa4382004-05-12 18:54:06 +0000502datadir="$prefix"
bellard1f50f8d2004-05-08 14:44:43 +0000503docdir="$prefix"
bellard11d9f692004-04-02 20:55:59 +0000504bindir="$prefix"
505else
506if test -z "$prefix" ; then
507 prefix="/usr/local"
508fi
bellard5a671352003-10-01 00:13:48 +0000509mandir="$prefix/share/man"
bellard7efa4382004-05-12 18:54:06 +0000510datadir="$prefix/share/qemu"
bellard1f50f8d2004-05-08 14:44:43 +0000511docdir="$prefix/share/doc/qemu"
bellard11d9f692004-04-02 20:55:59 +0000512bindir="$prefix/bin"
513fi
bellard5a671352003-10-01 00:13:48 +0000514
bellard43ce4df2003-06-09 19:53:12 +0000515echo "Install prefix $prefix"
bellard7efa4382004-05-12 18:54:06 +0000516echo "BIOS directory $datadir"
bellard11d9f692004-04-02 20:55:59 +0000517echo "binary directory $bindir"
518if test "$mingw32" = "no" ; then
519echo "Manual directory $mandir"
bellard43ce4df2003-06-09 19:53:12 +0000520echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000521fi
bellard5a671352003-10-01 00:13:48 +0000522echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000523echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000524echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000525echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000526echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000527echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000528echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000529echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000530echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000531echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000532echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000533if test "$darwin" = "yes" ; then
534 echo "Cocoa support $cocoa"
535fi
bellard97a847b2003-08-10 21:36:04 +0000536echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000537if test "$sdl" != "no" ; then
538 echo "SDL static link $sdl_static"
539fi
bellard67b915a2004-03-31 23:37:16 +0000540echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000541echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000542echo "CoreAudio support $coreaudio"
543echo "ALSA support $alsa"
544echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000545if test "$fmod" = "yes"; then
546 if test -z $fmod_lib || test -z $fmod_inc; then
547 echo
548 echo "Error: You must specify path to FMOD library and headers"
549 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
550 echo
551 exit 1
552 fi
pbrookb1a550a2006-04-16 13:28:56 +0000553 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
554else
555 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000556fi
pbrookb1a550a2006-04-16 13:28:56 +0000557echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000558echo "kqemu support $kqemu"
pbrookcc8ae6d2006-04-23 17:57:59 +0000559echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +0000560[ ! -z "$uname_release" ] && \
561echo "uname -r $uname_release"
bellard67b915a2004-03-31 23:37:16 +0000562
bellard97a847b2003-08-10 21:36:04 +0000563if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000564echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000565fi
bellard24b55b92005-03-01 22:30:41 +0000566#if test "$sdl_static" = "no"; then
567# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
568#fi
bellard97a847b2003-08-10 21:36:04 +0000569config_mak="config-host.mak"
570config_h="config-host.h"
571
bellard7c1f25b2004-04-22 00:02:08 +0000572#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000573
574echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000575echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000576echo "/* Automatically generated by configure - do not modify */" > $config_h
577
578echo "prefix=$prefix" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000579echo "bindir=$bindir" >> $config_mak
bellard5a671352003-10-01 00:13:48 +0000580echo "mandir=$mandir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000581echo "datadir=$datadir" >> $config_mak
bellard1f50f8d2004-05-08 14:44:43 +0000582echo "docdir=$docdir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000583echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000584echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000585echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000586echo "CC=$cc" >> $config_mak
587if test "$have_gcc3_options" = "yes" ; then
588 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
589fi
590echo "HOST_CC=$host_cc" >> $config_mak
591echo "AR=$ar" >> $config_mak
592echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
593echo "CFLAGS=$CFLAGS" >> $config_mak
594echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000595echo "EXESUF=$EXESUF" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000596if test "$cpu" = "i386" ; then
597 echo "ARCH=i386" >> $config_mak
598 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000599elif test "$cpu" = "x86_64" ; then
600 echo "ARCH=x86_64" >> $config_mak
601 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000602elif test "$cpu" = "armv4b" ; then
603 echo "ARCH=arm" >> $config_mak
604 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000605elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000606 echo "ARCH=arm" >> $config_mak
607 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000608elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000609 echo "ARCH=ppc" >> $config_mak
610 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000611elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000612 echo "ARCH=mips" >> $config_mak
613 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000614elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000615 echo "ARCH=s390" >> $config_mak
616 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000617elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000618 echo "ARCH=alpha" >> $config_mak
619 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000620elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000621 echo "ARCH=sparc" >> $config_mak
622 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000623elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000624 echo "ARCH=sparc64" >> $config_mak
625 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000626elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000627 echo "ARCH=ia64" >> $config_mak
628 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000629elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000630 echo "ARCH=m68k" >> $config_mak
631 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000632else
633 echo "Unsupported CPU"
634 exit 1
635fi
636if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000637 echo "WORDS_BIGENDIAN=yes" >> $config_mak
638 echo "#define WORDS_BIGENDIAN 1" >> $config_h
639fi
bellardb6853692005-06-05 17:10:39 +0000640echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000641if test "$mingw32" = "yes" ; then
642 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000643 echo "#define CONFIG_WIN32 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000644elif test -f "/usr/include/byteswap.h" ; then
bellard67b915a2004-03-31 23:37:16 +0000645 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
646fi
bellard83fb7ad2004-07-05 21:25:26 +0000647if test "$darwin" = "yes" ; then
648 echo "CONFIG_DARWIN=yes" >> $config_mak
649 echo "#define CONFIG_DARWIN 1" >> $config_h
650fi
bellardec530c82006-04-25 22:36:06 +0000651if test "$solaris" = "yes" ; then
652 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +0000653 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
bellardec530c82006-04-25 22:36:06 +0000654fi
bellard67b915a2004-03-31 23:37:16 +0000655if test "$gdbstub" = "yes" ; then
656 echo "CONFIG_GDBSTUB=yes" >> $config_mak
657 echo "#define CONFIG_GDBSTUB 1" >> $config_h
658fi
bellard97a847b2003-08-10 21:36:04 +0000659if test "$gprof" = "yes" ; then
660 echo "TARGET_GPROF=yes" >> $config_mak
661 echo "#define HAVE_GPROF 1" >> $config_h
662fi
663if test "$static" = "yes" ; then
664 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000665 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000666fi
bellard05c2a3e2006-02-08 22:39:17 +0000667if test $profiler = "yes" ; then
668 echo "#define CONFIG_PROFILER 1" >> $config_h
669fi
bellardc20709a2004-04-21 23:27:19 +0000670if test "$slirp" = "yes" ; then
671 echo "CONFIG_SLIRP=yes" >> $config_mak
672 echo "#define CONFIG_SLIRP 1" >> $config_h
673fi
bellardfb065182004-11-09 23:09:44 +0000674if test "$adlib" = "yes" ; then
675 echo "CONFIG_ADLIB=yes" >> $config_mak
676 echo "#define CONFIG_ADLIB 1" >> $config_h
677fi
678if test "$oss" = "yes" ; then
679 echo "CONFIG_OSS=yes" >> $config_mak
680 echo "#define CONFIG_OSS 1" >> $config_h
681fi
bellard1d14ffa2005-10-30 18:58:22 +0000682if test "$coreaudio" = "yes" ; then
683 echo "CONFIG_COREAUDIO=yes" >> $config_mak
684 echo "#define CONFIG_COREAUDIO 1" >> $config_h
685fi
686if test "$alsa" = "yes" ; then
687 echo "CONFIG_ALSA=yes" >> $config_mak
688 echo "#define CONFIG_ALSA 1" >> $config_h
689fi
690if test "$dsound" = "yes" ; then
691 echo "CONFIG_DSOUND=yes" >> $config_mak
692 echo "#define CONFIG_DSOUND 1" >> $config_h
693fi
bellard102a52e2004-11-14 19:57:29 +0000694if test "$fmod" = "yes" ; then
695 echo "CONFIG_FMOD=yes" >> $config_mak
696 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
697 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
698 echo "#define CONFIG_FMOD 1" >> $config_h
699fi
pbrookb1a550a2006-04-16 13:28:56 +0000700qemu_version=`head $source_path/VERSION`
701echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +0000702echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000703
704echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000705if [ "$source_path_used" = "yes" ]; then
706 echo "VPATH=$source_path" >> $config_mak
707fi
bellard97a847b2003-08-10 21:36:04 +0000708echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +0000709if [ "$build_docs" = "yes" ] ; then
710 echo "BUILD_DOCS=yes" >> $config_mak
711fi
bellard97a847b2003-08-10 21:36:04 +0000712
bellard83fb7ad2004-07-05 21:25:26 +0000713# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000714if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000715 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000716 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000717 echo "#define _BSD 1" >> $config_h
718fi
719
pbrookc5937222006-05-14 11:30:38 +0000720echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
721
bellard1d14ffa2005-10-30 18:58:22 +0000722for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000723target_dir="$target"
724config_mak=$target_dir/config.mak
725config_h=$target_dir/config.h
726target_cpu=`echo $target | cut -d '-' -f 1`
727target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000728[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000729[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000730[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000731[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000732[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000733[ "$target_cpu" = "mips" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000734target_softmmu="no"
735if expr $target : '.*-softmmu' > /dev/null ; then
736 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000737fi
bellard997344f2003-10-27 21:10:39 +0000738target_user_only="no"
739if expr $target : '.*-user' > /dev/null ; then
740 target_user_only="yes"
741fi
bellardde83cd02003-06-15 20:25:43 +0000742
bellard97ccc682005-07-02 13:32:17 +0000743if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000744 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000745 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +0000746 echo "To build QEMU without graphical output configure with --disable-gfx-check"
bellard97ccc682005-07-02 13:32:17 +0000747 echo "Note that this will disable all output from the virtual graphics card."
748 exit 1;
749fi
750
bellard7c1f25b2004-04-22 00:02:08 +0000751#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000752
753mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000754mkdir -p $target_dir/fpu
bellard808c4952004-12-19 23:33:47 +0000755if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
bellard69de9272004-02-16 21:40:43 +0000756 mkdir -p $target_dir/nwfpe
757fi
bellarda7e61ed2004-04-22 21:46:47 +0000758if test "$target_user_only" = "no" ; then
759 mkdir -p $target_dir/slirp
760fi
bellard69de9272004-02-16 21:40:43 +0000761
bellardec530c82006-04-25 22:36:06 +0000762#
763# don't use ln -sf as not all "ln -sf" over write the file/link
764#
765rm -f $target_dir/Makefile
766ln -s $source_path/Makefile.target $target_dir/Makefile
767
bellard97a847b2003-08-10 21:36:04 +0000768
769echo "# Automatically generated by configure - do not modify" > $config_mak
770echo "/* Automatically generated by configure - do not modify */" > $config_h
771
772
773echo "include ../config-host.mak" >> $config_mak
774echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000775
pbrooke5fe0c52006-06-11 13:32:59 +0000776bflt="no"
bellard1e43adf2003-09-30 20:54:24 +0000777interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
778echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000779
780if test "$target_cpu" = "i386" ; then
781 echo "TARGET_ARCH=i386" >> $config_mak
782 echo "#define TARGET_ARCH \"i386\"" >> $config_h
783 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000784 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000785 echo "#define USE_KQEMU 1" >> $config_h
786 fi
bellard808c4952004-12-19 23:33:47 +0000787elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000788 echo "TARGET_ARCH=arm" >> $config_mak
789 echo "#define TARGET_ARCH \"arm\"" >> $config_h
790 echo "#define TARGET_ARM 1" >> $config_h
pbrooke5fe0c52006-06-11 13:32:59 +0000791 bflt="yes"
bellard1e43adf2003-09-30 20:54:24 +0000792elif test "$target_cpu" = "sparc" ; then
793 echo "TARGET_ARCH=sparc" >> $config_mak
794 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
795 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000796elif test "$target_cpu" = "sparc64" ; then
797 echo "TARGET_ARCH=sparc64" >> $config_mak
798 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
799 echo "#define TARGET_SPARC 1" >> $config_h
800 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000801elif test "$target_cpu" = "ppc" ; then
802 echo "TARGET_ARCH=ppc" >> $config_mak
803 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
804 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000805elif test "$target_cpu" = "ppc64" ; then
806 echo "TARGET_ARCH=ppc64" >> $config_mak
807 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
808 echo "#define TARGET_PPC 1" >> $config_h
809 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000810elif test "$target_cpu" = "x86_64" ; then
811 echo "TARGET_ARCH=x86_64" >> $config_mak
812 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
813 echo "#define TARGET_I386 1" >> $config_h
814 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000815 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
816 echo "#define USE_KQEMU 1" >> $config_h
817 fi
bellardc20eb472005-12-06 21:42:55 +0000818elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000819 echo "TARGET_ARCH=mips" >> $config_mak
820 echo "#define TARGET_ARCH \"mips\"" >> $config_h
821 echo "#define TARGET_MIPS 1" >> $config_h
bellard6ea83fe2006-06-14 12:56:19 +0000822 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
823 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
bellardfdf9b3e2006-04-27 21:07:38 +0000824elif test "$target_cpu" = "sh4" ; then
825 echo "TARGET_ARCH=sh4" >> $config_mak
826 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
827 echo "#define TARGET_SH4 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000828else
829 echo "Unsupported target CPU"
830 exit 1
831fi
832if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000833 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
834 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
835fi
836if test "$target_softmmu" = "yes" ; then
837 echo "CONFIG_SOFTMMU=yes" >> $config_mak
838 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000839fi
bellard997344f2003-10-27 21:10:39 +0000840if test "$target_user_only" = "yes" ; then
841 echo "CONFIG_USER_ONLY=yes" >> $config_mak
842 echo "#define CONFIG_USER_ONLY 1" >> $config_h
843fi
bellardde83cd02003-06-15 20:25:43 +0000844
bellard158142c2005-03-13 16:54:06 +0000845if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
846 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
847 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
848fi
pbrooke5fe0c52006-06-11 13:32:59 +0000849if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
850 echo "TARGET_HAS_BFLT=yes" >> $config_mak
851 echo "#define TARGET_HAS_BFLT 1" >> $config_h
852fi
bellard7c1f25b2004-04-22 00:02:08 +0000853# sdl defines
854
855if test "$target_user_only" = "no"; then
856 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000857 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000858 else
bellarddbb2c922004-10-24 22:17:47 +0000859 sdl1=$sdl
860 fi
861 if test "$sdl1" = "yes" ; then
862 echo "#define CONFIG_SDL 1" >> $config_h
863 echo "CONFIG_SDL=yes" >> $config_mak
864 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
865 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
866 else
bellard7c1f25b2004-04-22 00:02:08 +0000867 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
868 fi
bellarddbb2c922004-10-24 22:17:47 +0000869 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000870 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
871 else
872 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000873 fi
bellard7c1f25b2004-04-22 00:02:08 +0000874 fi
bellard7c1f25b2004-04-22 00:02:08 +0000875fi
876
bellard5b0753e2005-03-01 21:37:28 +0000877if test "$cocoa" = "yes" ; then
878 echo "#define CONFIG_COCOA 1" >> $config_h
879 echo "CONFIG_COCOA=yes" >> $config_mak
880fi
881
bellard97a847b2003-08-10 21:36:04 +0000882done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000883
884# build tree in object directory if source path is different from current one
885if test "$source_path_used" = "yes" ; then
886 DIRS="tests"
887 FILES="Makefile tests/Makefile"
888 for dir in $DIRS ; do
889 mkdir -p $dir
890 done
bellardec530c82006-04-25 22:36:06 +0000891 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +0000892 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +0000893 rm -f $f
894 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +0000895 done
896fi
bellard7d132992003-03-06 23:23:54 +0000897
bellard97a847b2003-08-10 21:36:04 +0000898rm -f $TMPO $TMPC $TMPE $TMPS