blob: c8868b7e2bb1c4eed8fe67db205badb8d451757f [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001#!/bin/sh
2#
bellard3ef693a2003-03-23 20:17:16 +00003# qemu configure script (c) 2003 Fabrice Bellard
bellard7d132992003-03-06 23:23:54 +00004#
5# set temporary file name
6if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10else
11 TMPDIR1="/tmp"
12fi
13
bellard3ef693a2003-03-23 20:17:16 +000014TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
bellard7d132992003-03-06 23:23:54 +000018
19# default parameters
bellard11d9f692004-04-02 20:55:59 +000020prefix=""
bellard1e43adf2003-09-30 20:54:24 +000021interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000022static="no"
bellard7d132992003-03-06 23:23:54 +000023cross_prefix=""
24cc="gcc"
pbrook328a4242006-12-19 03:31:34 +000025gcc3_search="yes"
balrogfe8f78e2007-10-31 01:03:28 +000026gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
bellard7d132992003-03-06 23:23:54 +000027host_cc="gcc"
28ar="ar"
29make="make"
pbrook6a882642006-04-17 13:57:12 +000030install="install"
bellard7d132992003-03-06 23:23:54 +000031strip="strip"
32cpu=`uname -m`
bellard5327cf42005-01-10 23:18:50 +000033target_list=""
bellard7d132992003-03-06 23:23:54 +000034case "$cpu" in
35 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +000036 cpu="i386"
bellard7d132992003-03-06 23:23:54 +000037 ;;
aurel32aaa5fa12008-04-11 22:04:22 +000038 x86_64|amd64)
39 cpu="x86_64"
40 ;;
41 alpha)
42 cpu="alpha"
43 ;;
bellardba680552005-03-13 09:49:52 +000044 armv*b)
bellard808c4952004-12-19 23:33:47 +000045 cpu="armv4b"
46 ;;
bellardba680552005-03-13 09:49:52 +000047 armv*l)
bellard7d132992003-03-06 23:23:54 +000048 cpu="armv4l"
49 ;;
aurel32aaa5fa12008-04-11 22:04:22 +000050 cris)
51 cpu="cris"
bellard7d132992003-03-06 23:23:54 +000052 ;;
aurel32f54b3f92008-04-12 20:14:54 +000053 parisc|parisc64)
54 cpu="hppa"
55 ;;
aurel32aaa5fa12008-04-11 22:04:22 +000056 ia64)
57 cpu="ia64"
58 ;;
59 m68k)
60 cpu="m68k"
bellard7d132992003-03-06 23:23:54 +000061 ;;
62 mips)
63 cpu="mips"
64 ;;
thsfbe4f652007-04-01 11:16:48 +000065 mips64)
66 cpu="mips64"
67 ;;
aurel32aaa5fa12008-04-11 22:04:22 +000068 "Power Macintosh"|ppc|ppc64)
69 cpu="powerpc"
thse7daa602007-10-08 13:38:27 +000070 ;;
ths0e7b8a92007-08-01 00:09:31 +000071 s390*)
bellardfb3e5842003-03-29 17:32:36 +000072 cpu="s390"
73 ;;
blueswir131422552007-04-16 18:27:06 +000074 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +000075 cpu="sparc"
76 ;;
77 sparc64)
78 cpu="sparc64"
79 ;;
bellard7d132992003-03-06 23:23:54 +000080 *)
81 cpu="unknown"
82 ;;
83esac
84gprof="no"
85bigendian="no"
bellard67b915a2004-03-31 23:37:16 +000086mingw32="no"
87EXESUF=""
88gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +000089slirp="yes"
bellardfb065182004-11-09 23:09:44 +000090adlib="no"
balroge5c9a132008-01-14 04:27:55 +000091ac97="no"
balrog423d65f2008-01-14 22:09:11 +000092gus="no"
bellardfb065182004-11-09 23:09:44 +000093oss="no"
bellard1d14ffa2005-10-30 18:58:22 +000094dsound="no"
95coreaudio="no"
96alsa="no"
balrogca9cc282008-01-14 04:24:29 +000097esd="no"
bellard102a52e2004-11-14 19:57:29 +000098fmod="no"
99fmod_lib=""
100fmod_inc=""
ths8d5d2d42007-08-25 01:37:51 +0000101vnc_tls="yes"
pbrookb1a550a2006-04-16 13:28:56 +0000102bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000103linux="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000104kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000105profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000106cocoa="no"
bellard97ccc682005-07-02 13:32:17 +0000107check_gfx="yes"
bellard1aff3812005-11-02 22:30:45 +0000108check_gcc="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000109softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000110linux_user="no"
111darwin_user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +0000112build_docs="no"
pbrookc5937222006-05-14 11:30:38 +0000113uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000114curses="yes"
bellard7d132992003-03-06 23:23:54 +0000115
116# OS specific
117targetos=`uname -s`
118case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000119CYGWIN*)
120mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000121OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000122if [ "$cpu" = "i386" ] ; then
123 kqemu="yes"
124fi
bellardc326e0a2005-04-23 18:30:28 +0000125;;
bellard67b915a2004-03-31 23:37:16 +0000126MINGW32*)
127mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000128if [ "$cpu" = "i386" ] ; then
129 kqemu="yes"
130fi
bellard67b915a2004-03-31 23:37:16 +0000131;;
ths5c40d2b2007-06-23 16:03:36 +0000132GNU/kFreeBSD)
133oss="yes"
134if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
135 kqemu="yes"
136fi
137;;
bellard7d3505c2004-05-12 19:32:15 +0000138FreeBSD)
139bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000140oss="yes"
bellarde99f9062005-07-28 21:45:38 +0000141if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000142 kqemu="yes"
143fi
bellard7d3505c2004-05-12 19:32:15 +0000144;;
145NetBSD)
146bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000147oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000148;;
149OpenBSD)
150bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000151oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000152;;
bellard83fb7ad2004-07-05 21:25:26 +0000153Darwin)
154bsd="yes"
155darwin="yes"
ths831b7822007-01-18 20:06:33 +0000156darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000157cocoa="yes"
158coreaudio="yes"
ths6f30fa82007-01-05 01:00:47 +0000159OS_CFLAGS="-mdynamic-no-pic"
thsc2c59c32008-01-08 00:00:20 +0000160OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
bellard83fb7ad2004-07-05 21:25:26 +0000161;;
bellardec530c82006-04-25 22:36:06 +0000162SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000163 solaris="yes"
164 make="gmake"
165 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000166 needs_libsunmath="no"
thsc2b84fa2007-02-10 23:21:21 +0000167 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000168 # have to select again, because `uname -m` returns i86pc
169 # even on an x86_64 box.
170 solariscpu=`isainfo -k`
171 if test "${solariscpu}" = "amd64" ; then
172 cpu="x86_64"
173 fi
thsc2b84fa2007-02-10 23:21:21 +0000174 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000175 if test "$solarisrev" -le 9 ; then
176 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
177 needs_libsunmath="yes"
178 else
179 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
180 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
181 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
182 echo "Studio 11 can be downloaded from www.sun.com."
183 exit 1
184 fi
185 fi
186 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000187 kqemu="yes"
188 fi
ths86b2bd92007-02-11 00:31:33 +0000189 fi
ths6b4d2ba2007-05-13 18:02:43 +0000190 if test -f /usr/include/sys/soundcard.h ; then
191 oss=yes
192 fi
ths86b2bd92007-02-11 00:31:33 +0000193;;
bellard1d14ffa2005-10-30 18:58:22 +0000194*)
bellardfb065182004-11-09 23:09:44 +0000195oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000196linux="yes"
ths831b7822007-01-18 20:06:33 +0000197linux_user="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000198if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000199 kqemu="yes"
200fi
bellardfb065182004-11-09 23:09:44 +0000201;;
bellard7d132992003-03-06 23:23:54 +0000202esac
203
bellard7d3505c2004-05-12 19:32:15 +0000204if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000205 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000206 make="gmake"
207 fi
bellard7d3505c2004-05-12 19:32:15 +0000208fi
209
bellard7d132992003-03-06 23:23:54 +0000210# find source path
pbrookad064842006-04-16 12:41:07 +0000211source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000212source_path_used="no"
213workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000214if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000215 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000216else
217 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000218fi
pbrook724db112008-02-03 19:20:13 +0000219[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000220
bellard85aa5182007-11-11 20:17:03 +0000221werror="no"
bellard0d1e2392007-11-11 20:24:30 +0000222# generate compile errors on warnings for development builds
223#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
224#werror="yes";
225#fi
bellard85aa5182007-11-11 20:17:03 +0000226
bellard7d132992003-03-06 23:23:54 +0000227for opt do
pbrooka46e4032006-04-29 23:05:22 +0000228 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000229 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000230 --help|-h) show_help=yes
231 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000232 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000233 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000234 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000235 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000236 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000237 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000238 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000239 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000240 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000241 --cc=*) cc="$optarg"
pbrook328a4242006-12-19 03:31:34 +0000242 gcc3_search="no"
bellard7d132992003-03-06 23:23:54 +0000243 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000244 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000245 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000246 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000247 ;;
pbrook6a882642006-04-17 13:57:12 +0000248 --install=*) install="$optarg"
249 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000250 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000251 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000252 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000253 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000254 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000255 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000256 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000257 ;;
bellard7d132992003-03-06 23:23:54 +0000258 --enable-gprof) gprof="yes"
259 ;;
bellard43ce4df2003-06-09 19:53:12 +0000260 --static) static="yes"
261 ;;
bellard97a847b2003-08-10 21:36:04 +0000262 --disable-sdl) sdl="no"
263 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000264 --enable-coreaudio) coreaudio="yes"
265 ;;
266 --enable-alsa) alsa="yes"
267 ;;
balrogca9cc282008-01-14 04:24:29 +0000268 --enable-esd) esd="yes"
269 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000270 --enable-dsound) dsound="yes"
271 ;;
bellard102a52e2004-11-14 19:57:29 +0000272 --enable-fmod) fmod="yes"
273 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000274 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000275 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000276 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000277 ;;
ths8d5d2d42007-08-25 01:37:51 +0000278 --disable-vnc-tls) vnc_tls="no"
279 ;;
bellardb93aebe2007-02-15 22:58:18 +0000280 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
bellard1d14ffa2005-10-30 18:58:22 +0000281 ;;
bellard443f1372004-06-04 11:13:20 +0000282 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000283 ;;
bellardfb065182004-11-09 23:09:44 +0000284 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000285 ;;
balroge5c9a132008-01-14 04:27:55 +0000286 --enable-ac97) ac97="yes"
287 ;;
balrog423d65f2008-01-14 22:09:11 +0000288 --enable-gus) gus="yes"
289 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000290 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000291 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000292 --disable-brlapi) brlapi="no"
293 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000294 --enable-profiler) profiler="yes"
295 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000296 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
297 ;;
bellard97ccc682005-07-02 13:32:17 +0000298 --disable-gfx-check) check_gfx="no"
299 ;;
bellard1aff3812005-11-02 22:30:45 +0000300 --disable-gcc-check) check_gcc="no"
301 ;;
pbrookcad25d62006-03-19 16:31:11 +0000302 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000303 ;;
pbrookcad25d62006-03-19 16:31:11 +0000304 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000305 ;;
ths831b7822007-01-18 20:06:33 +0000306 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000307 ;;
ths831b7822007-01-18 20:06:33 +0000308 --enable-linux-user) linux_user="yes"
309 ;;
310 --disable-darwin-user) darwin_user="no"
311 ;;
312 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000313 ;;
pbrookc5937222006-05-14 11:30:38 +0000314 --enable-uname-release=*) uname_release="$optarg"
315 ;;
blueswir131422552007-04-16 18:27:06 +0000316 --sparc_cpu=*)
317 sparc_cpu="$optarg"
318 case $sparc_cpu in
319 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
320 target_cpu="sparc"; cpu="sparc" ;;
321 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
322 target_cpu="sparc"; cpu="sparc" ;;
323 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
324 target_cpu="sparc64"; cpu="sparc64" ;;
325 *) echo "undefined SPARC architecture. Exiting";exit 1;;
326 esac
327 ;;
bellard85aa5182007-11-11 20:17:03 +0000328 --enable-werror) werror="yes"
329 ;;
330 --disable-werror) werror="no"
331 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000332 --disable-curses) curses="no"
333 ;;
balrog7f1559c2007-11-17 10:24:32 +0000334 *) echo "ERROR: unknown option $opt"; show_help="yes"
335 ;;
bellard7d132992003-03-06 23:23:54 +0000336 esac
337done
338
ths209afb92007-03-25 20:55:00 +0000339if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
340 AIOLIBS=
341else
ths4259e1a2007-11-05 13:27:21 +0000342 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
343 AIOLIBS="-lrt -lpthread"
ths209afb92007-03-25 20:55:00 +0000344fi
345
ths6f30fa82007-01-05 01:00:47 +0000346# default flags for all hosts
347CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
348LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000349if test "$werror" = "yes" ; then
350CFLAGS="$CFLAGS -Werror"
351fi
ths6f30fa82007-01-05 01:00:47 +0000352
blueswir131422552007-04-16 18:27:06 +0000353#
354# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
355# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
356#
bellard40293e52008-01-31 11:32:10 +0000357case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000358 sparc) if test -z "$sparc_cpu" ; then
359 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
360 ARCH_LDFLAGS="-m32"
361 else
362 ARCH_CFLAGS="${SP_CFLAGS}"
363 ARCH_LDFLAGS="${SP_LDFLAGS}"
364 fi
365 ;;
366 sparc64) if test -z "$sparc_cpu" ; then
367 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
368 ARCH_LDFLAGS="-m64"
369 else
370 ARCH_CFLAGS="${SP_CFLAGS}"
371 ARCH_LDFLAGS="${SP_LDFLAGS}"
372 fi
373 ;;
ths76d83bd2007-11-18 21:22:10 +0000374 s390)
375 ARCH_CFLAGS="-march=z900"
376 ;;
bellard40293e52008-01-31 11:32:10 +0000377 i386)
378 ARCH_CFLAGS="-m32"
379 ARCH_LDFLAGS="-m32"
380 ;;
381 x86_64)
382 ARCH_CFLAGS="-m64"
383 ARCH_LDFLAGS="-m64"
384 ;;
blueswir131422552007-04-16 18:27:06 +0000385esac
386
pbrookaf5db582006-04-08 14:26:41 +0000387if test x"$show_help" = x"yes" ; then
388cat << EOF
389
390Usage: configure [options]
391Options: [defaults in brackets after descriptions]
392
393EOF
394echo "Standard options:"
395echo " --help print this message"
396echo " --prefix=PREFIX install in PREFIX [$prefix]"
397echo " --interp-prefix=PREFIX where to find shared libraries, etc."
398echo " use %M for cpu name [$interp_prefix]"
399echo " --target-list=LIST set target list [$target_list]"
400echo ""
401echo "kqemu kernel acceleration support:"
402echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000403echo ""
404echo "Advanced options (experts only):"
405echo " --source-path=PATH path of source code [$source_path]"
406echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
407echo " --cc=CC use C compiler CC [$cc]"
408echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
409echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000410echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000411echo " --static enable static build [$static]"
bellard85aa5182007-11-11 20:17:03 +0000412echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000413echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000414echo " --enable-cocoa enable COCOA (Mac OS X only)"
415echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
416echo " --enable-adlib enable Adlib emulation"
balroge5c9a132008-01-14 04:27:55 +0000417echo " --enable-ac97 enable AC97 emulation"
balrog423d65f2008-01-14 22:09:11 +0000418echo " --enable-gus enable Gravis Ultrasound emulation"
pbrookaf5db582006-04-08 14:26:41 +0000419echo " --enable-coreaudio enable Coreaudio audio driver"
420echo " --enable-alsa enable ALSA audio driver"
balrogca9cc282008-01-14 04:24:29 +0000421echo " --enable-esd enable EsoundD audio driver"
pbrookaf5db582006-04-08 14:26:41 +0000422echo " --enable-fmod enable FMOD audio driver"
thsed5065e2007-03-25 16:15:21 +0000423echo " --enable-dsound enable DirectSound audio driver"
aurel322e4d9fb2008-04-08 06:01:02 +0000424echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000425echo " --disable-vnc-tls disable TLS encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000426echo " --disable-curses disable curses output"
pbrookaf5db582006-04-08 14:26:41 +0000427echo " --enable-system enable all system emulation targets"
428echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000429echo " --enable-linux-user enable all linux usermode emulation targets"
430echo " --disable-linux-user disable all linux usermode emulation targets"
431echo " --enable-darwin-user enable all darwin usermode emulation targets"
432echo " --disable-darwin-user disable all darwin usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000433echo " --fmod-lib path to FMOD library"
434echo " --fmod-inc path to FMOD includes"
pbrookc5937222006-05-14 11:30:38 +0000435echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000436echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
pbrookaf5db582006-04-08 14:26:41 +0000437echo ""
ths5bf08932006-12-23 00:33:26 +0000438echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000439exit 1
440fi
441
bellard7d132992003-03-06 23:23:54 +0000442cc="${cross_prefix}${cc}"
443ar="${cross_prefix}${ar}"
444strip="${cross_prefix}${strip}"
445
pbrook064aae12006-05-08 00:51:44 +0000446# check that the C compiler works.
447cat > $TMPC <<EOF
448int main(void) {}
449EOF
450
pbrookdb7287e2008-02-03 16:27:13 +0000451if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
pbrook064aae12006-05-08 00:51:44 +0000452 : C compiler works ok
453else
454 echo "ERROR: \"$cc\" either does not exist or does not work"
455 exit 1
bellarda7350fa2006-04-23 14:35:23 +0000456fi
457
bellard67b915a2004-03-31 23:37:16 +0000458if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000459 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000460 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000461 oss="no"
bellard67b915a2004-03-31 23:37:16 +0000462fi
463
ths5fafdf22007-09-16 21:08:06 +0000464# Check for gcc4, error if pre-gcc4
pbrook328a4242006-12-19 03:31:34 +0000465if test "$check_gcc" = "yes" ; then
466 cat > $TMPC <<EOF
467#if __GNUC__ < 4
468#error gcc3
469#endif
470int main(){return 0;}
471EOF
pbrookdb7287e2008-02-03 16:27:13 +0000472 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
pbrook328a4242006-12-19 03:31:34 +0000473 echo "WARNING: \"$cc\" looks like gcc 4.x"
474 found_compat_cc="no"
475 if test "$gcc3_search" = "yes" ; then
476 echo "Looking for gcc 3.x"
477 for compat_cc in $gcc3_list ; do
balrogd4af3de2007-07-26 20:41:46 +0000478 if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
pbrook328a4242006-12-19 03:31:34 +0000479 echo "Found \"$compat_cc\""
pbrook11244262007-02-27 01:03:41 +0000480 cc="$cross_prefix$compat_cc"
pbrook328a4242006-12-19 03:31:34 +0000481 found_compat_cc="yes"
482 break
483 fi
484 done
485 if test "$found_compat_cc" = "no" ; then
486 echo "gcc 3.x not found!"
487 fi
488 fi
489 if test "$found_compat_cc" = "no" ; then
490 echo "QEMU is known to have problems when compiled with gcc 4.x"
491 echo "It is recommended that you use gcc 3.x to build QEMU"
492 echo "To use this compiler anyway, configure with --disable-gcc-check"
493 exit 1;
494 fi
495 fi
496fi
497
bellardec530c82006-04-25 22:36:06 +0000498#
499# Solaris specific configure tool chain decisions
500#
501if test "$solaris" = "yes" ; then
502 #
503 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
504 # override the check with --disable-gcc-check
ths5fafdf22007-09-16 21:08:06 +0000505 #
bellardec530c82006-04-25 22:36:06 +0000506 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
507 solgcc=`which $cc`
508 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
509 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
510 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
511 echo "or get the latest patch from SunSolve for gcc"
512 exit 1
513 fi
514 fi
515 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
516 if test -z "$solinst" ; then
517 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
518 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
519 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
520 exit 1
521 fi
522 if test "$solinst" = "/usr/sbin/install" ; then
523 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
524 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
525 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
526 exit 1
527 fi
bellardec530c82006-04-25 22:36:06 +0000528 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
529 if test -z "$sol_ar" ; then
530 echo "Error: No path includes ar"
531 if test -f /usr/ccs/bin/ar ; then
532 echo "Add /usr/ccs/bin to your path and rerun configure"
533 fi
534 exit 1
535 fi
ths5fafdf22007-09-16 21:08:06 +0000536fi
bellardec530c82006-04-25 22:36:06 +0000537
538
bellard5327cf42005-01-10 23:18:50 +0000539if test -z "$target_list" ; then
540# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000541 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000542 target_list="\
543i386-softmmu \
544x86_64-softmmu \
545arm-softmmu \
546cris-softmmu \
547m68k-softmmu \
548mips-softmmu \
549mipsel-softmmu \
550mips64-softmmu \
551mips64el-softmmu \
552ppc-softmmu \
553ppcemb-softmmu \
554ppc64-softmmu \
555sh4-softmmu \
556sh4eb-softmmu \
557sparc-softmmu \
558"
pbrook0a8e90f2006-03-19 14:54:16 +0000559 fi
bellard5327cf42005-01-10 23:18:50 +0000560# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000561 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000562 target_list="${target_list}\
563i386-linux-user \
564x86_64-linux-user \
565alpha-linux-user \
566arm-linux-user \
567armeb-linux-user \
568cris-linux-user \
569m68k-linux-user \
570mips-linux-user \
571mipsel-linux-user \
572ppc-linux-user \
573ppc64-linux-user \
574ppc64abi32-linux-user \
575sh4-linux-user \
576sh4eb-linux-user \
577sparc-linux-user \
578sparc64-linux-user \
579sparc32plus-linux-user \
580"
ths831b7822007-01-18 20:06:33 +0000581 fi
582# the following are Darwin specific
583 if [ "$darwin_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000584 target_list="$target_list i386-darwin-user ppc-darwin-user"
bellard5327cf42005-01-10 23:18:50 +0000585 fi
bellard6e20a452005-06-05 15:56:02 +0000586else
pbrookb1a550a2006-04-16 13:28:56 +0000587 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000588fi
pbrook0a8e90f2006-03-19 14:54:16 +0000589if test -z "$target_list" ; then
590 echo "No targets enabled"
591 exit 1
592fi
bellard5327cf42005-01-10 23:18:50 +0000593
bellard7d132992003-03-06 23:23:54 +0000594if test -z "$cross_prefix" ; then
595
596# ---
597# big/little endian test
598cat > $TMPC << EOF
599#include <inttypes.h>
600int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000601 volatile uint32_t i=0x01234567;
602 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000603}
604EOF
605
pbrookdb7287e2008-02-03 16:27:13 +0000606if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000607$TMPE && bigendian="yes"
608else
609echo big/little test failed
610fi
611
612else
613
614# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000615if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000616 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000617 -o "$cpu" = "m68k" \
618 -o "$cpu" = "mips" \
619 -o "$cpu" = "mips64" \
620 -o "$cpu" = "powerpc" \
621 -o "$cpu" = "s390" \
622 -o "$cpu" = "sparc" \
623 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000624 bigendian="yes"
625fi
626
627fi
628
bellardb6853692005-06-05 17:10:39 +0000629# host long bits test
630hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000631if test "$cpu" = "x86_64" \
632 -o "$cpu" = "alpha" \
633 -o "$cpu" = "ia64" \
634 -o "$cpu" = "sparc64"; then
bellardb6853692005-06-05 17:10:39 +0000635 hostlongbits="64"
636fi
637
bellarde8cd23d2003-06-25 16:08:13 +0000638# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000639cat > $TMPC <<EOF
640int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000641}
642EOF
643
bellard11d9f692004-04-02 20:55:59 +0000644##########################################
645# SDL probe
646
647sdl_too_old=no
648
649if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000650 sdl_config="sdl-config"
651 sdl=no
652 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000653
ths069b0bd2007-07-12 00:27:15 +0000654 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
655 # win32 cross compilation case
656 sdl_config="i386-mingw32msvc-sdl-config"
657 sdl=yes
658 else
659 # normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000660cat > $TMPC << EOF
661#include <SDL.h>
662#undef main /* We don't want SDL to override our main() */
663int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
664EOF
pbrookdb7287e2008-02-03 16:27:13 +0000665 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
ths069b0bd2007-07-12 00:27:15 +0000666 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
667 if test "$_sdlversion" -lt 121 ; then
668 sdl_too_old=yes
669 else
670 if test "$cocoa" = "no" ; then
671 sdl=yes
672 fi
673 fi
bellard11d9f692004-04-02 20:55:59 +0000674
ths069b0bd2007-07-12 00:27:15 +0000675 # static link with sdl ?
676 if test "$sdl" = "yes" ; then
677 aa="no"
678 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
679 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
680 if [ "$aa" = "yes" ] ; then
681 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
682 fi
683
ths8281db42007-11-18 21:37:07 +0000684 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
ths069b0bd2007-07-12 00:27:15 +0000685 sdl_static=yes
686 fi
687 fi # static link
688 fi # sdl compile test
689 fi # cross compilation
bellard11d9f692004-04-02 20:55:59 +0000690else
ths069b0bd2007-07-12 00:27:15 +0000691 # Make sure to disable cocoa if sdl was set
692 if test "$sdl" = "yes" ; then
693 cocoa="no"
694 coreaudio="no"
695 fi
bellarda6e022a2004-04-02 21:55:47 +0000696fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000697
ths8f28f3f2007-01-05 21:25:54 +0000698##########################################
ths8d5d2d42007-08-25 01:37:51 +0000699# VNC TLS detection
700if test "$vnc_tls" = "yes" ; then
701 `pkg-config gnutls` || vnc_tls="no"
702fi
703if test "$vnc_tls" = "yes" ; then
704 vnc_tls_cflags=`pkg-config --cflags gnutls`
705 vnc_tls_libs=`pkg-config --libs gnutls`
706fi
707
708##########################################
ths8f28f3f2007-01-05 21:25:54 +0000709# alsa sound support libraries
710
711if test "$alsa" = "yes" ; then
712 cat > $TMPC << EOF
713#include <alsa/asoundlib.h>
714int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
715EOF
pbrookdb7287e2008-02-03 16:27:13 +0000716 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lasound 2> /dev/null ; then
ths8f28f3f2007-01-05 21:25:54 +0000717 :
718 else
719 echo
720 echo "Error: Could not find alsa"
721 echo "Make sure to have the alsa libs and headers installed."
722 echo
723 exit 1
724 fi
725fi
726
balrog4d3b6f62008-02-10 16:33:14 +0000727##########################################
aurel322e4d9fb2008-04-08 06:01:02 +0000728# BrlAPI probe
729
730if test -z "$brlapi" ; then
731 brlapi=no
732cat > $TMPC << EOF
733#include <brlapi.h>
734int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
735EOF
aurel32a40e56d2008-05-04 00:50:25 +0000736 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +0000737 brlapi=yes
738 fi # brlapi compile test
739fi # -z $brlapi
740
741##########################################
balrog4d3b6f62008-02-10 16:33:14 +0000742# curses probe
743
744if test "$curses" = "yes" ; then
745 curses=no
746 cat > $TMPC << EOF
747#include <curses.h>
748int main(void) { return curses_version(); }
749EOF
pbrookaf896aa2008-03-23 00:47:42 +0000750 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +0000751 curses=yes
752 fi
753fi # test "$curses"
754
pbrookcc8ae6d2006-04-23 17:57:59 +0000755# Check if tools are available to build documentation.
ths6c591862007-05-09 13:55:03 +0000756if [ -x "`which texi2html 2>/dev/null`" ] && \
757 [ -x "`which pod2man 2>/dev/null`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +0000758 build_docs="yes"
759fi
760
bellard11d9f692004-04-02 20:55:59 +0000761if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +0000762 if test -z "$prefix" ; then
763 prefix="/c/Program Files/Qemu"
764 fi
765 mansuffix=""
766 datasuffix=""
767 docsuffix=""
768 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +0000769else
pbrook308c3592007-02-27 00:52:01 +0000770 if test -z "$prefix" ; then
771 prefix="/usr/local"
772 fi
773 mansuffix="/share/man"
774 datasuffix="/share/qemu"
775 docsuffix="/share/doc/qemu"
776 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +0000777fi
bellard5a671352003-10-01 00:13:48 +0000778
bellard43ce4df2003-06-09 19:53:12 +0000779echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +0000780echo "BIOS directory $prefix$datasuffix"
781echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +0000782if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +0000783echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +0000784echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000785fi
bellard5a671352003-10-01 00:13:48 +0000786echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000787echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000788echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +0000789echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +0000790echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000791echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000792echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000793echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000794echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000795echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000796echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000797echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +0000798echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +0000799if test "$darwin" = "yes" ; then
800 echo "Cocoa support $cocoa"
801fi
bellard97a847b2003-08-10 21:36:04 +0000802echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000803if test "$sdl" != "no" ; then
804 echo "SDL static link $sdl_static"
805fi
balrog4d3b6f62008-02-10 16:33:14 +0000806echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +0000807echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000808echo "Adlib support $adlib"
balroge5c9a132008-01-14 04:27:55 +0000809echo "AC97 support $ac97"
balrog423d65f2008-01-14 22:09:11 +0000810echo "GUS support $gus"
bellard1d14ffa2005-10-30 18:58:22 +0000811echo "CoreAudio support $coreaudio"
812echo "ALSA support $alsa"
balrogca9cc282008-01-14 04:24:29 +0000813echo "EsounD support $esd"
bellard1d14ffa2005-10-30 18:58:22 +0000814echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000815if test "$fmod" = "yes"; then
816 if test -z $fmod_lib || test -z $fmod_inc; then
817 echo
818 echo "Error: You must specify path to FMOD library and headers"
819 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
820 echo
821 exit 1
822 fi
pbrookb1a550a2006-04-16 13:28:56 +0000823 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
824else
825 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000826fi
pbrookb1a550a2006-04-16 13:28:56 +0000827echo "FMOD support $fmod $fmod_support"
ths6b4d2ba2007-05-13 18:02:43 +0000828echo "OSS support $oss"
ths8d5d2d42007-08-25 01:37:51 +0000829echo "VNC TLS support $vnc_tls"
830if test "$vnc_tls" = "yes" ; then
831 echo " TLS CFLAGS $vnc_tls_cflags"
832 echo " TLS LIBS $vnc_tls_libs"
833fi
blueswir131422552007-04-16 18:27:06 +0000834if test -n "$sparc_cpu"; then
835 echo "Target Sparc Arch $sparc_cpu"
836fi
bellard07f4ddb2005-04-23 17:44:28 +0000837echo "kqemu support $kqemu"
aurel322e4d9fb2008-04-08 06:01:02 +0000838echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +0000839echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +0000840[ ! -z "$uname_release" ] && \
841echo "uname -r $uname_release"
bellard67b915a2004-03-31 23:37:16 +0000842
bellard97a847b2003-08-10 21:36:04 +0000843if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000844echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000845fi
ths20b40c62007-07-11 23:39:45 +0000846if [ -s /tmp/qemu-$$-sdl-config.log ]; then
847 echo "The error log from compiling the libSDL test is: "
848 cat /tmp/qemu-$$-sdl-config.log
849fi
850rm -f /tmp/qemu-$$-sdl-config.log
bellard24b55b92005-03-01 22:30:41 +0000851#if test "$sdl_static" = "no"; then
852# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
853#fi
bellard97a847b2003-08-10 21:36:04 +0000854config_mak="config-host.mak"
855config_h="config-host.h"
856
bellard7c1f25b2004-04-22 00:02:08 +0000857#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000858
ths15d9ca02007-07-31 23:07:32 +0000859test -f $config_h && mv $config_h ${config_h}~
860
bellard97a847b2003-08-10 21:36:04 +0000861echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000862echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000863echo "/* Automatically generated by configure - do not modify */" > $config_h
864
865echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +0000866echo "bindir=\${prefix}$binsuffix" >> $config_mak
867echo "mandir=\${prefix}$mansuffix" >> $config_mak
868echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +0000869echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +0000870echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000871echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000872echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000873echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000874echo "HOST_CC=$host_cc" >> $config_mak
875echo "AR=$ar" >> $config_mak
876echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
bellard40293e52008-01-31 11:32:10 +0000877# XXX: only use CFLAGS and LDFLAGS ?
878# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
879# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +0000880echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +0000881echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
882echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
883echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000884echo "CFLAGS=$CFLAGS" >> $config_mak
885echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000886echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +0000887echo "AIOLIBS=$AIOLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +0000888case "$cpu" in
889 i386)
890 echo "ARCH=i386" >> $config_mak
891 echo "#define HOST_I386 1" >> $config_h
892 ;;
893 x86_64)
894 echo "ARCH=x86_64" >> $config_mak
895 echo "#define HOST_X86_64 1" >> $config_h
896 ;;
897 alpha)
898 echo "ARCH=alpha" >> $config_mak
899 echo "#define HOST_ALPHA 1" >> $config_h
900 ;;
901 armv4b)
902 echo "ARCH=arm" >> $config_mak
903 echo "#define HOST_ARM 1" >> $config_h
904 ;;
905 armv4l)
906 echo "ARCH=arm" >> $config_mak
907 echo "#define HOST_ARM 1" >> $config_h
908 ;;
909 cris)
910 echo "ARCH=cris" >> $config_mak
911 echo "#define HOST_CRIS 1" >> $config_h
912 ;;
913 hppa)
914 echo "ARCH=hppa" >> $config_mak
915 echo "#define HOST_HPPA 1" >> $config_h
916 ;;
917 ia64)
918 echo "ARCH=ia64" >> $config_mak
919 echo "#define HOST_IA64 1" >> $config_h
920 ;;
921 m68k)
922 echo "ARCH=m68k" >> $config_mak
923 echo "#define HOST_M68K 1" >> $config_h
924 ;;
925 mips)
926 echo "ARCH=mips" >> $config_mak
927 echo "#define HOST_MIPS 1" >> $config_h
928 ;;
929 mips64)
930 echo "ARCH=mips64" >> $config_mak
931 echo "#define HOST_MIPS64 1" >> $config_h
932 ;;
933 powerpc)
934 echo "ARCH=ppc" >> $config_mak
935 echo "#define HOST_PPC 1" >> $config_h
936 ;;
937 s390)
938 echo "ARCH=s390" >> $config_mak
939 echo "#define HOST_S390 1" >> $config_h
940 ;;
941 sparc)
942 echo "ARCH=sparc" >> $config_mak
943 echo "#define HOST_SPARC 1" >> $config_h
944 ;;
945 sparc64)
946 echo "ARCH=sparc64" >> $config_mak
947 echo "#define HOST_SPARC64 1" >> $config_h
948 ;;
949 *)
950 echo "Unsupported CPU = $cpu"
951 exit 1
952 ;;
953esac
bellard7d132992003-03-06 23:23:54 +0000954if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000955 echo "WORDS_BIGENDIAN=yes" >> $config_mak
956 echo "#define WORDS_BIGENDIAN 1" >> $config_h
957fi
bellardb6853692005-06-05 17:10:39 +0000958echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000959if test "$mingw32" = "yes" ; then
960 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000961 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +0000962else
963 cat > $TMPC << EOF
964#include <byteswap.h>
965int main(void) { return bswap_32(0); }
966EOF
pbrookdb7287e2008-02-03 16:27:13 +0000967 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +0000968 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
969 fi
bellard67b915a2004-03-31 23:37:16 +0000970fi
bellard83fb7ad2004-07-05 21:25:26 +0000971if test "$darwin" = "yes" ; then
972 echo "CONFIG_DARWIN=yes" >> $config_mak
973 echo "#define CONFIG_DARWIN 1" >> $config_h
974fi
bellardec530c82006-04-25 22:36:06 +0000975if test "$solaris" = "yes" ; then
976 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +0000977 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +0000978 if test "$needs_libsunmath" = "yes" ; then
979 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
980 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
981 fi
bellardec530c82006-04-25 22:36:06 +0000982fi
blueswir131422552007-04-16 18:27:06 +0000983if test -n "$sparc_cpu"; then
984 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
985 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
986fi
bellard67b915a2004-03-31 23:37:16 +0000987if test "$gdbstub" = "yes" ; then
988 echo "CONFIG_GDBSTUB=yes" >> $config_mak
989 echo "#define CONFIG_GDBSTUB 1" >> $config_h
990fi
bellard97a847b2003-08-10 21:36:04 +0000991if test "$gprof" = "yes" ; then
992 echo "TARGET_GPROF=yes" >> $config_mak
993 echo "#define HAVE_GPROF 1" >> $config_h
994fi
995if test "$static" = "yes" ; then
996 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000997 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000998fi
bellard05c2a3e2006-02-08 22:39:17 +0000999if test $profiler = "yes" ; then
1000 echo "#define CONFIG_PROFILER 1" >> $config_h
1001fi
bellardc20709a2004-04-21 23:27:19 +00001002if test "$slirp" = "yes" ; then
1003 echo "CONFIG_SLIRP=yes" >> $config_mak
1004 echo "#define CONFIG_SLIRP 1" >> $config_h
1005fi
bellardfb065182004-11-09 23:09:44 +00001006if test "$adlib" = "yes" ; then
1007 echo "CONFIG_ADLIB=yes" >> $config_mak
1008 echo "#define CONFIG_ADLIB 1" >> $config_h
1009fi
balroge5c9a132008-01-14 04:27:55 +00001010if test "$ac97" = "yes" ; then
1011 echo "CONFIG_AC97=yes" >> $config_mak
1012 echo "#define CONFIG_AC97 1" >> $config_h
1013fi
balrog423d65f2008-01-14 22:09:11 +00001014if test "$gus" = "yes" ; then
1015 echo "CONFIG_GUS=yes" >> $config_mak
1016 echo "#define CONFIG_GUS 1" >> $config_h
1017fi
bellardfb065182004-11-09 23:09:44 +00001018if test "$oss" = "yes" ; then
1019 echo "CONFIG_OSS=yes" >> $config_mak
1020 echo "#define CONFIG_OSS 1" >> $config_h
1021fi
bellard1d14ffa2005-10-30 18:58:22 +00001022if test "$coreaudio" = "yes" ; then
1023 echo "CONFIG_COREAUDIO=yes" >> $config_mak
1024 echo "#define CONFIG_COREAUDIO 1" >> $config_h
1025fi
1026if test "$alsa" = "yes" ; then
1027 echo "CONFIG_ALSA=yes" >> $config_mak
1028 echo "#define CONFIG_ALSA 1" >> $config_h
1029fi
balrogca9cc282008-01-14 04:24:29 +00001030if test "$esd" = "yes" ; then
1031 echo "CONFIG_ESD=yes" >> $config_mak
1032 echo "#define CONFIG_ESD 1" >> $config_h
1033fi
bellard1d14ffa2005-10-30 18:58:22 +00001034if test "$dsound" = "yes" ; then
1035 echo "CONFIG_DSOUND=yes" >> $config_mak
1036 echo "#define CONFIG_DSOUND 1" >> $config_h
1037fi
bellard102a52e2004-11-14 19:57:29 +00001038if test "$fmod" = "yes" ; then
1039 echo "CONFIG_FMOD=yes" >> $config_mak
1040 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1041 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1042 echo "#define CONFIG_FMOD 1" >> $config_h
1043fi
ths8d5d2d42007-08-25 01:37:51 +00001044if test "$vnc_tls" = "yes" ; then
1045 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1046 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1047 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1048 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1049fi
pbrookb1a550a2006-04-16 13:28:56 +00001050qemu_version=`head $source_path/VERSION`
1051echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001052echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001053
1054echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001055if [ "$source_path_used" = "yes" ]; then
1056 echo "VPATH=$source_path" >> $config_mak
1057fi
bellard97a847b2003-08-10 21:36:04 +00001058echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001059if [ "$build_docs" = "yes" ] ; then
1060 echo "BUILD_DOCS=yes" >> $config_mak
1061fi
bellard49ecc3f2007-11-07 19:25:15 +00001062if test "$static" = "yes"; then
1063 sdl1=$sdl_static
1064else
1065 sdl1=$sdl
1066fi
1067if test "$sdl1" = "yes" ; then
1068 echo "#define CONFIG_SDL 1" >> $config_h
1069 echo "CONFIG_SDL=yes" >> $config_mak
1070 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1071 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1072 else
1073 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1074 fi
1075 if [ "${aa}" = "yes" ] ; then
1076 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1077 else
1078 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1079 fi
1080fi
1081if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001082 echo "#define CONFIG_COCOA 1" >> $config_h
1083 echo "CONFIG_COCOA=yes" >> $config_mak
1084fi
1085if test "$curses" = "yes" ; then
1086 echo "#define CONFIG_CURSES 1" >> $config_h
1087 echo "CONFIG_CURSES=yes" >> $config_mak
1088 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001089fi
aurel322e4d9fb2008-04-08 06:01:02 +00001090if test "$brlapi" = "yes" ; then
1091 echo "CONFIG_BRLAPI=yes" >> $config_mak
1092 echo "#define CONFIG_BRLAPI 1" >> $config_h
1093 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1094fi
bellard97a847b2003-08-10 21:36:04 +00001095
bellard83fb7ad2004-07-05 21:25:26 +00001096# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001097if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001098 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001099 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001100 echo "#define _BSD 1" >> $config_h
1101fi
1102
pbrookc5937222006-05-14 11:30:38 +00001103echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1104
pbrookc39e3332007-09-22 16:49:14 +00001105tools=
1106if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1107 tools="qemu-img\$(EXESUF) $tools"
1108fi
1109echo "TOOLS=$tools" >> $config_mak
1110
ths15d9ca02007-07-31 23:07:32 +00001111test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1112
bellard1d14ffa2005-10-30 18:58:22 +00001113for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001114target_dir="$target"
1115config_mak=$target_dir/config.mak
1116config_h=$target_dir/config.h
1117target_cpu=`echo $target | cut -d '-' -f 1`
1118target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001119[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001120[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1121[ "$target_cpu" = "mips" ] && target_bigendian=yes
1122[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1123[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001124[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001125[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001126[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001127[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001128[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001129[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1130[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1131[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001132target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001133target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001134target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001135target_darwin_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001136case "$target" in
1137 ${target_cpu}-softmmu)
1138 target_softmmu="yes"
1139 ;;
1140 ${target_cpu}-linux-user)
1141 target_user_only="yes"
1142 target_linux_user="yes"
1143 ;;
1144 ${target_cpu}-darwin-user)
1145 target_user_only="yes"
1146 target_darwin_user="yes"
1147 ;;
1148 *)
1149 echo "ERROR: Target '$target' not recognised"
1150 exit 1
1151 ;;
1152esac
ths831b7822007-01-18 20:06:33 +00001153
bellard97ccc682005-07-02 13:32:17 +00001154if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001155 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001156 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001157 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001158 echo "Note that this will disable all output from the virtual graphics card"
1159 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001160 exit 1;
1161fi
1162
bellard7c1f25b2004-04-22 00:02:08 +00001163#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001164
ths15d9ca02007-07-31 23:07:32 +00001165test -f $config_h && mv $config_h ${config_h}~
1166
bellard97a847b2003-08-10 21:36:04 +00001167mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001168mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001169mkdir -p $target_dir/tcg
ths831b7822007-01-18 20:06:33 +00001170if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
bellard69de9272004-02-16 21:40:43 +00001171 mkdir -p $target_dir/nwfpe
1172fi
1173
bellardec530c82006-04-25 22:36:06 +00001174#
1175# don't use ln -sf as not all "ln -sf" over write the file/link
1176#
1177rm -f $target_dir/Makefile
1178ln -s $source_path/Makefile.target $target_dir/Makefile
1179
bellard97a847b2003-08-10 21:36:04 +00001180
1181echo "# Automatically generated by configure - do not modify" > $config_mak
1182echo "/* Automatically generated by configure - do not modify */" > $config_h
1183
1184
1185echo "include ../config-host.mak" >> $config_mak
1186echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001187
pbrooke5fe0c52006-06-11 13:32:59 +00001188bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001189elfload32="no"
bellard1e43adf2003-09-30 20:54:24 +00001190interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1191echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001192
aurel322408a522008-04-20 20:19:44 +00001193case "$target_cpu" in
1194 i386)
1195 echo "TARGET_ARCH=i386" >> $config_mak
1196 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1197 echo "#define TARGET_I386 1" >> $config_h
1198 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386"
1199 then
1200 echo "#define USE_KQEMU 1" >> $config_h
1201 fi
aurel32f2bf0942008-05-05 06:00:27 +00001202 gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
pbrook11d1fdb2008-05-23 23:16:42 +00001203 if test -n "$gcc3minver" && test $gcc3minver -gt 3
aurel32f2bf0942008-05-05 06:00:27 +00001204 then
1205 echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1206 else
1207 echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1208 fi
aurel322408a522008-04-20 20:19:44 +00001209 ;;
1210 x86_64)
1211 echo "TARGET_ARCH=x86_64" >> $config_mak
1212 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1213 echo "#define TARGET_I386 1" >> $config_h
1214 echo "#define TARGET_X86_64 1" >> $config_h
1215 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1216 then
1217 echo "#define USE_KQEMU 1" >> $config_h
1218 fi
1219 ;;
1220 alpha)
1221 echo "TARGET_ARCH=alpha" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001222 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001223 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1224 echo "#define TARGET_ALPHA 1" >> $config_h
blueswir1bf6247f2008-05-10 12:27:33 +00001225 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001226 ;;
1227 arm|armeb)
1228 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001229 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1230 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001231 bflt="yes"
1232 ;;
1233 cris)
1234 echo "TARGET_ARCH=cris" >> $config_mak
1235 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1236 echo "#define TARGET_CRIS 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001237 ;;
1238 m68k)
1239 echo "TARGET_ARCH=m68k" >> $config_mak
1240 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1241 echo "#define TARGET_M68K 1" >> $config_h
1242 bflt="yes"
1243 ;;
1244 mips|mipsel)
1245 echo "TARGET_ARCH=mips" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001246 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001247 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1248 echo "#define TARGET_MIPS 1" >> $config_h
1249 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
blueswir1bf6247f2008-05-10 12:27:33 +00001250 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001251 ;;
1252 mipsn32|mipsn32el)
1253 echo "TARGET_ARCH=mipsn32" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001254 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001255 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1256 echo "#define TARGET_MIPS 1" >> $config_h
1257 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
blueswir1bf6247f2008-05-10 12:27:33 +00001258 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001259 ;;
1260 mips64|mips64el)
1261 echo "TARGET_ARCH=mips64" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001262 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001263 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1264 echo "#define TARGET_MIPS 1" >> $config_h
1265 echo "#define TARGET_MIPS64 1" >> $config_h
1266 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
blueswir1bf6247f2008-05-10 12:27:33 +00001267 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001268 ;;
1269 ppc)
1270 echo "TARGET_ARCH=ppc" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001271 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001272 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1273 echo "#define TARGET_PPC 1" >> $config_h
blueswir1bf6247f2008-05-10 12:27:33 +00001274 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001275 ;;
1276 ppcemb)
1277 echo "TARGET_ARCH=ppcemb" >> $config_mak
1278 echo "TARGET_ABI_DIR=ppc" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001279 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001280 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1281 echo "#define TARGET_PPC 1" >> $config_h
1282 echo "#define TARGET_PPCEMB 1" >> $config_h
blueswir1ec5b78c2008-05-10 17:23:18 +00001283 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001284 ;;
1285 ppc64)
1286 echo "TARGET_ARCH=ppc64" >> $config_mak
1287 echo "TARGET_ABI_DIR=ppc" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001288 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001289 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1290 echo "#define TARGET_PPC 1" >> $config_h
1291 echo "#define TARGET_PPC64 1" >> $config_h
blueswir1bf6247f2008-05-10 12:27:33 +00001292 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001293 ;;
1294 ppc64abi32)
1295 echo "TARGET_ARCH=ppc64" >> $config_mak
1296 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1297 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001298 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001299 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1300 echo "#define TARGET_PPC 1" >> $config_h
1301 echo "#define TARGET_PPC64 1" >> $config_h
1302 echo "#define TARGET_ABI32 1" >> $config_h
blueswir1bf6247f2008-05-10 12:27:33 +00001303 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001304 ;;
1305 sh4|sh4eb)
1306 echo "TARGET_ARCH=sh4" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001307 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001308 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1309 echo "#define TARGET_SH4 1" >> $config_h
blueswir1bf6247f2008-05-10 12:27:33 +00001310 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001311 bflt="yes"
1312 ;;
1313 sparc)
1314 echo "TARGET_ARCH=sparc" >> $config_mak
1315 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1316 echo "#define TARGET_SPARC 1" >> $config_h
1317 ;;
1318 sparc64)
1319 echo "TARGET_ARCH=sparc64" >> $config_mak
1320 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1321 echo "#define TARGET_SPARC 1" >> $config_h
1322 echo "#define TARGET_SPARC64 1" >> $config_h
1323 elfload32="yes"
1324 ;;
1325 sparc32plus)
1326 echo "TARGET_ARCH=sparc64" >> $config_mak
1327 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1328 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1329 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1330 echo "#define TARGET_SPARC 1" >> $config_h
1331 echo "#define TARGET_SPARC64 1" >> $config_h
1332 echo "#define TARGET_ABI32 1" >> $config_h
1333 ;;
1334 *)
1335 echo "Unsupported target CPU"
1336 exit 1
1337 ;;
1338esac
bellardde83cd02003-06-15 20:25:43 +00001339if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001340 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1341 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1342fi
1343if test "$target_softmmu" = "yes" ; then
1344 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1345 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00001346fi
bellard997344f2003-10-27 21:10:39 +00001347if test "$target_user_only" = "yes" ; then
1348 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1349 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1350fi
ths831b7822007-01-18 20:06:33 +00001351if test "$target_linux_user" = "yes" ; then
1352 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1353 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1354fi
1355if test "$target_darwin_user" = "yes" ; then
1356 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1357 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1358fi
bellardde83cd02003-06-15 20:25:43 +00001359
aurel320938cda2008-04-11 21:36:06 +00001360if test "$target_cpu" = "arm" \
1361 -o "$target_cpu" = "armeb" \
1362 -o "$target_cpu" = "m68k" \
1363 -o "$target_cpu" = "mips" \
1364 -o "$target_cpu" = "mipsel" \
1365 -o "$target_cpu" = "mipsn32" \
1366 -o "$target_cpu" = "mipsn32el" \
1367 -o "$target_cpu" = "mips64" \
1368 -o "$target_cpu" = "mips64el" \
1369 -o "$target_cpu" = "sparc" \
1370 -o "$target_cpu" = "sparc64" \
1371 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00001372 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1373 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1374fi
pbrooke5fe0c52006-06-11 13:32:59 +00001375if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1376 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1377 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1378fi
blueswir1cb33da52007-10-09 16:34:29 +00001379# 32 bit ELF loader in addition to native 64 bit loader?
1380if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1381 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1382 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1383fi
bellard5b0753e2005-03-01 21:37:28 +00001384
ths15d9ca02007-07-31 23:07:32 +00001385test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1386
bellard97a847b2003-08-10 21:36:04 +00001387done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00001388
1389# build tree in object directory if source path is different from current one
1390if test "$source_path_used" = "yes" ; then
bellard49ecc3f2007-11-07 19:25:15 +00001391 DIRS="tests tests/cris slirp audio"
bellard7d132992003-03-06 23:23:54 +00001392 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00001393 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00001394 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00001395 for dir in $DIRS ; do
1396 mkdir -p $dir
1397 done
bellardec530c82006-04-25 22:36:06 +00001398 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001399 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001400 rm -f $f
1401 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001402 done
1403fi
bellard7d132992003-03-06 23:23:54 +00001404
bellard97a847b2003-08-10 21:36:04 +00001405rm -f $TMPO $TMPC $TMPE $TMPS