blob: 3e890c15b7df1e5aa34f25d60dbd7d3cfe02aa89 [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"
malc9d56d2d2008-09-30 19:44:32 +000018TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
bellard7d132992003-03-06 23:23:54 +000019
20# default parameters
bellard11d9f692004-04-02 20:55:59 +000021prefix=""
bellard1e43adf2003-09-30 20:54:24 +000022interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000023static="no"
bellard7d132992003-03-06 23:23:54 +000024cross_prefix=""
25cc="gcc"
pbrook328a4242006-12-19 03:31:34 +000026gcc3_search="yes"
balrogfe8f78e2007-10-31 01:03:28 +000027gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
malc0c58ac12008-06-25 21:04:05 +000028audio_drv_list=""
29audio_card_list=""
bellard7d132992003-03-06 23:23:54 +000030host_cc="gcc"
31ar="ar"
32make="make"
pbrook6a882642006-04-17 13:57:12 +000033install="install"
bellard7d132992003-03-06 23:23:54 +000034strip="strip"
malcb29fe3e2008-11-18 01:42:22 +000035cpu=`test $(uname -s) = AIX && uname -p || uname -m`
bellard5327cf42005-01-10 23:18:50 +000036target_list=""
bellard7d132992003-03-06 23:23:54 +000037case "$cpu" in
38 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +000039 cpu="i386"
bellard7d132992003-03-06 23:23:54 +000040 ;;
aurel32aaa5fa12008-04-11 22:04:22 +000041 x86_64|amd64)
42 cpu="x86_64"
43 ;;
44 alpha)
45 cpu="alpha"
46 ;;
bellardba680552005-03-13 09:49:52 +000047 armv*b)
bellard808c4952004-12-19 23:33:47 +000048 cpu="armv4b"
49 ;;
bellardba680552005-03-13 09:49:52 +000050 armv*l)
bellard7d132992003-03-06 23:23:54 +000051 cpu="armv4l"
52 ;;
aurel32aaa5fa12008-04-11 22:04:22 +000053 cris)
54 cpu="cris"
bellard7d132992003-03-06 23:23:54 +000055 ;;
aurel32f54b3f92008-04-12 20:14:54 +000056 parisc|parisc64)
57 cpu="hppa"
58 ;;
aurel32aaa5fa12008-04-11 22:04:22 +000059 ia64)
60 cpu="ia64"
61 ;;
62 m68k)
63 cpu="m68k"
bellard7d132992003-03-06 23:23:54 +000064 ;;
65 mips)
66 cpu="mips"
67 ;;
thsfbe4f652007-04-01 11:16:48 +000068 mips64)
69 cpu="mips64"
70 ;;
malcb29fe3e2008-11-18 01:42:22 +000071 "Power Macintosh"|ppc|ppc64|powerpc)
aurel32aaa5fa12008-04-11 22:04:22 +000072 cpu="powerpc"
thse7daa602007-10-08 13:38:27 +000073 ;;
ths0e7b8a92007-08-01 00:09:31 +000074 s390*)
bellardfb3e5842003-03-29 17:32:36 +000075 cpu="s390"
76 ;;
blueswir131422552007-04-16 18:27:06 +000077 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +000078 cpu="sparc"
79 ;;
80 sparc64)
81 cpu="sparc64"
82 ;;
bellard7d132992003-03-06 23:23:54 +000083 *)
84 cpu="unknown"
85 ;;
86esac
87gprof="no"
aliguori03b4fe72008-10-07 19:16:17 +000088sparse="no"
bellard7d132992003-03-06 23:23:54 +000089bigendian="no"
bellard67b915a2004-03-31 23:37:16 +000090mingw32="no"
91EXESUF=""
92gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +000093slirp="yes"
aliguorie0e6c8c02008-07-23 18:14:33 +000094vde="yes"
bellard102a52e2004-11-14 19:57:29 +000095fmod_lib=""
96fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +000097oss_lib=""
ths8d5d2d42007-08-25 01:37:51 +000098vnc_tls="yes"
pbrookb1a550a2006-04-16 13:28:56 +000099bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000100linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000101solaris="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000102kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000103profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000104cocoa="no"
bellard97ccc682005-07-02 13:32:17 +0000105check_gfx="yes"
bellard1aff3812005-11-02 22:30:45 +0000106check_gcc="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000107softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000108linux_user="no"
109darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000110bsd_user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +0000111build_docs="no"
pbrookc5937222006-05-14 11:30:38 +0000112uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000113curses="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000114aio="yes"
pbrookbd0c5662008-05-29 14:34:11 +0000115nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000116mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000117bluez="yes"
aliguori7ba1e612008-11-05 16:04:33 +0000118kvm="yes"
aliguorieac30262008-11-05 16:28:56 +0000119kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000120aix="no"
ths77755342008-11-27 15:45:16 +0000121blobs="yes"
bellard7d132992003-03-06 23:23:54 +0000122
123# OS specific
124targetos=`uname -s`
125case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000126CYGWIN*)
127mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000128OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000129if [ "$cpu" = "i386" ] ; then
130 kqemu="yes"
131fi
malcc2de5c92008-06-28 19:13:06 +0000132audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000133;;
bellard67b915a2004-03-31 23:37:16 +0000134MINGW32*)
135mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000136if [ "$cpu" = "i386" ] ; then
137 kqemu="yes"
138fi
malcc2de5c92008-06-28 19:13:06 +0000139audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000140;;
ths5c40d2b2007-06-23 16:03:36 +0000141GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000142audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000143audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000144if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
145 kqemu="yes"
146fi
147;;
bellard7d3505c2004-05-12 19:32:15 +0000148FreeBSD)
149bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000150audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000151audio_possible_drivers="oss sdl esd pa"
blueswir1f4887912008-11-23 07:27:59 +0000152aio_lib="-lpthread"
bellarde99f9062005-07-28 21:45:38 +0000153if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000154 kqemu="yes"
155fi
bellard7d3505c2004-05-12 19:32:15 +0000156;;
157NetBSD)
158bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000159audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000160audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000161oss_lib="-lossaudio"
162aio_lib="-lrt -lpthread"
bellard7d3505c2004-05-12 19:32:15 +0000163;;
164OpenBSD)
165bsd="yes"
blueswir1128ab2f2008-08-15 18:33:42 +0000166openbsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000167audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000168audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000169oss_lib="-lossaudio"
blueswir18ef92a82008-11-22 20:24:29 +0000170aio_lib="-lpthread"
bellard7d3505c2004-05-12 19:32:15 +0000171;;
bellard83fb7ad2004-07-05 21:25:26 +0000172Darwin)
173bsd="yes"
174darwin="yes"
ths831b7822007-01-18 20:06:33 +0000175darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000176cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000177audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000178audio_possible_drivers="coreaudio sdl fmod"
ths6f30fa82007-01-05 01:00:47 +0000179OS_CFLAGS="-mdynamic-no-pic"
thsc2c59c32008-01-08 00:00:20 +0000180OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
blueswir18ef92a82008-11-22 20:24:29 +0000181aio_lib="-lpthread"
bellard83fb7ad2004-07-05 21:25:26 +0000182;;
bellardec530c82006-04-25 22:36:06 +0000183SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000184 solaris="yes"
185 make="gmake"
186 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000187 needs_libsunmath="no"
thsc2b84fa2007-02-10 23:21:21 +0000188 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000189 # have to select again, because `uname -m` returns i86pc
190 # even on an x86_64 box.
191 solariscpu=`isainfo -k`
192 if test "${solariscpu}" = "amd64" ; then
193 cpu="x86_64"
194 fi
thsc2b84fa2007-02-10 23:21:21 +0000195 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000196 if test "$solarisrev" -le 9 ; then
197 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
198 needs_libsunmath="yes"
199 else
200 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
201 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
202 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
203 echo "Studio 11 can be downloaded from www.sun.com."
204 exit 1
205 fi
206 fi
207 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000208 kqemu="yes"
209 fi
ths86b2bd92007-02-11 00:31:33 +0000210 fi
ths6b4d2ba2007-05-13 18:02:43 +0000211 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000212 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000213 fi
malcc2de5c92008-06-28 19:13:06 +0000214 audio_possible_drivers="oss sdl"
ths86b2bd92007-02-11 00:31:33 +0000215;;
malcb29fe3e2008-11-18 01:42:22 +0000216AIX)
217aix="yes"
218make="gmake"
219;;
bellard1d14ffa2005-10-30 18:58:22 +0000220*)
malc0c58ac12008-06-25 21:04:05 +0000221audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000222audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000223linux="yes"
ths831b7822007-01-18 20:06:33 +0000224linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000225usb="linux"
bellard07f4ddb2005-04-23 17:44:28 +0000226if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000227 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000228 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000229fi
bellardfb065182004-11-09 23:09:44 +0000230;;
bellard7d132992003-03-06 23:23:54 +0000231esac
232
bellard7d3505c2004-05-12 19:32:15 +0000233if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000234 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000235 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000236 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000237 fi
blueswir184778502008-10-26 20:33:16 +0000238 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000239fi
240
bellard7d132992003-03-06 23:23:54 +0000241# find source path
pbrookad064842006-04-16 12:41:07 +0000242source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000243source_path_used="no"
244workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000245if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000246 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000247else
248 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000249fi
pbrook724db112008-02-03 19:20:13 +0000250[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000251
bellard85aa5182007-11-11 20:17:03 +0000252werror="no"
bellard0d1e2392007-11-11 20:24:30 +0000253# generate compile errors on warnings for development builds
254#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
255#werror="yes";
256#fi
bellard85aa5182007-11-11 20:17:03 +0000257
bellard7d132992003-03-06 23:23:54 +0000258for opt do
pbrooka46e4032006-04-29 23:05:22 +0000259 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000260 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000261 --help|-h) show_help=yes
262 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000263 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000264 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000265 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000266 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000267 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000268 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000269 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000270 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000271 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000272 --cc=*) cc="$optarg"
pbrook328a4242006-12-19 03:31:34 +0000273 gcc3_search="no"
bellard7d132992003-03-06 23:23:54 +0000274 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000275 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000276 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000277 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000278 ;;
pbrook6a882642006-04-17 13:57:12 +0000279 --install=*) install="$optarg"
280 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000281 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000282 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000283 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000284 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000285 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000286 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000287 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000288 ;;
bellard7d132992003-03-06 23:23:54 +0000289 --enable-gprof) gprof="yes"
290 ;;
bellard43ce4df2003-06-09 19:53:12 +0000291 --static) static="yes"
292 ;;
bellard97a847b2003-08-10 21:36:04 +0000293 --disable-sdl) sdl="no"
294 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000295 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000296 ;;
malcc2de5c92008-06-28 19:13:06 +0000297 --fmod-inc=*) fmod_inc="$optarg"
298 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000299 --oss-lib=*) oss_lib="$optarg"
300 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000301 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000302 ;;
303 --audio-drv-list=*) audio_drv_list="$optarg"
304 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000305 --enable-sparse) sparse="yes"
306 ;;
307 --disable-sparse) sparse="no"
308 ;;
ths8d5d2d42007-08-25 01:37:51 +0000309 --disable-vnc-tls) vnc_tls="no"
310 ;;
bellard443f1372004-06-04 11:13:20 +0000311 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000312 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000313 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000314 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000315 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000316 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000317 --disable-brlapi) brlapi="no"
318 ;;
balrogfb599c92008-09-28 23:49:55 +0000319 --disable-bluez) bluez="no"
320 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000321 --disable-kvm) kvm="no"
322 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000323 --enable-profiler) profiler="yes"
324 ;;
malcc2de5c92008-06-28 19:13:06 +0000325 --enable-cocoa)
326 cocoa="yes" ;
327 sdl="no" ;
328 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000329 ;;
bellard97ccc682005-07-02 13:32:17 +0000330 --disable-gfx-check) check_gfx="no"
331 ;;
bellard1aff3812005-11-02 22:30:45 +0000332 --disable-gcc-check) check_gcc="no"
333 ;;
pbrookcad25d62006-03-19 16:31:11 +0000334 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000335 ;;
pbrookcad25d62006-03-19 16:31:11 +0000336 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000337 ;;
ths831b7822007-01-18 20:06:33 +0000338 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000339 ;;
ths831b7822007-01-18 20:06:33 +0000340 --enable-linux-user) linux_user="yes"
341 ;;
342 --disable-darwin-user) darwin_user="no"
343 ;;
344 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000345 ;;
blueswir184778502008-10-26 20:33:16 +0000346 --disable-bsd-user) bsd_user="no"
347 ;;
348 --enable-bsd-user) bsd_user="yes"
349 ;;
pbrookc5937222006-05-14 11:30:38 +0000350 --enable-uname-release=*) uname_release="$optarg"
351 ;;
blueswir131422552007-04-16 18:27:06 +0000352 --sparc_cpu=*)
353 sparc_cpu="$optarg"
354 case $sparc_cpu in
355 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
356 target_cpu="sparc"; cpu="sparc" ;;
357 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
358 target_cpu="sparc"; cpu="sparc" ;;
359 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
360 target_cpu="sparc64"; cpu="sparc64" ;;
361 *) echo "undefined SPARC architecture. Exiting";exit 1;;
362 esac
363 ;;
bellard85aa5182007-11-11 20:17:03 +0000364 --enable-werror) werror="yes"
365 ;;
366 --disable-werror) werror="no"
367 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000368 --disable-curses) curses="no"
369 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000370 --disable-nptl) nptl="no"
371 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000372 --enable-mixemu) mixemu="yes"
373 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000374 --disable-aio) aio="no"
375 ;;
ths77755342008-11-27 15:45:16 +0000376 --disable-blobs) blobs="no"
377 ;;
aliguorieac30262008-11-05 16:28:56 +0000378 --kerneldir=*) kerneldir="$optarg"
379 ;;
balrog7f1559c2007-11-17 10:24:32 +0000380 *) echo "ERROR: unknown option $opt"; show_help="yes"
381 ;;
bellard7d132992003-03-06 23:23:54 +0000382 esac
383done
384
ths6f30fa82007-01-05 01:00:47 +0000385# default flags for all hosts
blueswir1ac41a622008-09-14 06:46:31 +0000386CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
387CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings"
ths6f30fa82007-01-05 01:00:47 +0000388LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000389if test "$werror" = "yes" ; then
390CFLAGS="$CFLAGS -Werror"
391fi
ths6f30fa82007-01-05 01:00:47 +0000392
blueswir1d2c7c9b2008-11-01 14:50:20 +0000393if test "$solaris" = "no" ; then
394 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
395 LDFLAGS="$LDFLAGS -Wl,--warn-common"
396 fi
blueswir149237ac2008-09-17 19:05:19 +0000397fi
398
blueswir131422552007-04-16 18:27:06 +0000399#
400# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
401# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
402#
bellard40293e52008-01-31 11:32:10 +0000403case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000404 sparc) if test -z "$sparc_cpu" ; then
405 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
406 ARCH_LDFLAGS="-m32"
407 else
408 ARCH_CFLAGS="${SP_CFLAGS}"
409 ARCH_LDFLAGS="${SP_LDFLAGS}"
410 fi
411 ;;
412 sparc64) if test -z "$sparc_cpu" ; then
413 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
414 ARCH_LDFLAGS="-m64"
415 else
416 ARCH_CFLAGS="${SP_CFLAGS}"
417 ARCH_LDFLAGS="${SP_LDFLAGS}"
418 fi
419 ;;
ths76d83bd2007-11-18 21:22:10 +0000420 s390)
421 ARCH_CFLAGS="-march=z900"
422 ;;
bellard40293e52008-01-31 11:32:10 +0000423 i386)
424 ARCH_CFLAGS="-m32"
425 ARCH_LDFLAGS="-m32"
426 ;;
427 x86_64)
428 ARCH_CFLAGS="-m64"
429 ARCH_LDFLAGS="-m64"
430 ;;
blueswir131422552007-04-16 18:27:06 +0000431esac
432
pbrookaf5db582006-04-08 14:26:41 +0000433if test x"$show_help" = x"yes" ; then
434cat << EOF
435
436Usage: configure [options]
437Options: [defaults in brackets after descriptions]
438
439EOF
440echo "Standard options:"
441echo " --help print this message"
442echo " --prefix=PREFIX install in PREFIX [$prefix]"
443echo " --interp-prefix=PREFIX where to find shared libraries, etc."
444echo " use %M for cpu name [$interp_prefix]"
445echo " --target-list=LIST set target list [$target_list]"
446echo ""
447echo "kqemu kernel acceleration support:"
448echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000449echo ""
450echo "Advanced options (experts only):"
451echo " --source-path=PATH path of source code [$source_path]"
452echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
453echo " --cc=CC use C compiler CC [$cc]"
454echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
455echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000456echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000457echo " --static enable static build [$static]"
aliguori890b1652008-10-07 21:22:41 +0000458echo " --enable-sparse enable sparse checker"
459echo " --disable-sparse disable sparse checker (default)"
bellard85aa5182007-11-11 20:17:03 +0000460echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000461echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000462echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000463echo " --audio-drv-list=LIST set audio drivers list:"
464echo " Available drivers: $audio_possible_drivers"
465echo " --audio-card-list=LIST set list of additional emulated audio cards"
466echo " Available cards: ac97 adlib cs4231a gus"
malc8ff9cbf2008-06-23 18:33:30 +0000467echo " --enable-mixemu enable mixer emulation"
aurel322e4d9fb2008-04-08 06:01:02 +0000468echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000469echo " --disable-vnc-tls disable TLS encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000470echo " --disable-curses disable curses output"
balrogfb599c92008-09-28 23:49:55 +0000471echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000472echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000473echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000474echo " --enable-system enable all system emulation targets"
475echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000476echo " --enable-linux-user enable all linux usermode emulation targets"
477echo " --disable-linux-user disable all linux usermode emulation targets"
478echo " --enable-darwin-user enable all darwin usermode emulation targets"
479echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000480echo " --enable-bsd-user enable all BSD usermode emulation targets"
481echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000482echo " --fmod-lib path to FMOD library"
483echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000484echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000485echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000486echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000487echo " --disable-vde disable support for vde network"
blueswir1414f0da2008-08-15 18:20:52 +0000488echo " --disable-aio disable AIO support"
ths77755342008-11-27 15:45:16 +0000489echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000490echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000491echo ""
ths5bf08932006-12-23 00:33:26 +0000492echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000493exit 1
494fi
495
bellard7d132992003-03-06 23:23:54 +0000496cc="${cross_prefix}${cc}"
497ar="${cross_prefix}${ar}"
498strip="${cross_prefix}${strip}"
499
pbrook064aae12006-05-08 00:51:44 +0000500# check that the C compiler works.
501cat > $TMPC <<EOF
502int main(void) {}
503EOF
504
pbrookdb7287e2008-02-03 16:27:13 +0000505if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
pbrook064aae12006-05-08 00:51:44 +0000506 : C compiler works ok
507else
508 echo "ERROR: \"$cc\" either does not exist or does not work"
509 exit 1
bellarda7350fa2006-04-23 14:35:23 +0000510fi
511
aliguoricd01b4a2008-08-21 19:25:45 +0000512# check compiler to see if we're on mingw32
513cat > $TMPC <<EOF
514#include <windows.h>
515#ifndef _WIN32
516#error not windows
517#endif
518int main(void) {}
519EOF
520
521if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
522 mingw32="yes"
523fi
524
bellard67b915a2004-03-31 23:37:16 +0000525if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000526 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000527 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000528 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000529 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000530 bsd_user="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000531fi
532
aliguori997306f2008-09-26 15:52:17 +0000533if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
aliguoricd01b4a2008-08-21 19:25:45 +0000534 AIOLIBS=
aliguori997306f2008-09-26 15:52:17 +0000535elif [ "$bsd" = "yes" ]; then
blueswir18ef92a82008-11-22 20:24:29 +0000536 AIOLIBS="$aio_lib"
aliguoricd01b4a2008-08-21 19:25:45 +0000537else
538 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
539 AIOLIBS="-lrt -lpthread"
bellard67b915a2004-03-31 23:37:16 +0000540fi
541
ths5fafdf22007-09-16 21:08:06 +0000542# Check for gcc4, error if pre-gcc4
pbrook328a4242006-12-19 03:31:34 +0000543if test "$check_gcc" = "yes" ; then
544 cat > $TMPC <<EOF
545#if __GNUC__ < 4
546#error gcc3
547#endif
548int main(){return 0;}
549EOF
pbrookdb7287e2008-02-03 16:27:13 +0000550 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
pbrook328a4242006-12-19 03:31:34 +0000551 echo "WARNING: \"$cc\" looks like gcc 4.x"
552 found_compat_cc="no"
553 if test "$gcc3_search" = "yes" ; then
554 echo "Looking for gcc 3.x"
555 for compat_cc in $gcc3_list ; do
balrogd4af3de2007-07-26 20:41:46 +0000556 if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
pbrook328a4242006-12-19 03:31:34 +0000557 echo "Found \"$compat_cc\""
pbrook11244262007-02-27 01:03:41 +0000558 cc="$cross_prefix$compat_cc"
pbrook328a4242006-12-19 03:31:34 +0000559 found_compat_cc="yes"
560 break
561 fi
562 done
563 if test "$found_compat_cc" = "no" ; then
564 echo "gcc 3.x not found!"
565 fi
566 fi
567 if test "$found_compat_cc" = "no" ; then
568 echo "QEMU is known to have problems when compiled with gcc 4.x"
569 echo "It is recommended that you use gcc 3.x to build QEMU"
570 echo "To use this compiler anyway, configure with --disable-gcc-check"
571 exit 1;
572 fi
573 fi
574fi
575
aliguori03b4fe72008-10-07 19:16:17 +0000576if test ! -x "$(which cgcc 2>/dev/null)"; then
577 sparse="no"
578fi
579
bellardec530c82006-04-25 22:36:06 +0000580#
581# Solaris specific configure tool chain decisions
582#
583if test "$solaris" = "yes" ; then
584 #
585 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
586 # override the check with --disable-gcc-check
ths5fafdf22007-09-16 21:08:06 +0000587 #
bellardec530c82006-04-25 22:36:06 +0000588 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
589 solgcc=`which $cc`
590 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
591 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
592 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
593 echo "or get the latest patch from SunSolve for gcc"
594 exit 1
595 fi
596 fi
597 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
598 if test -z "$solinst" ; then
599 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
600 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
601 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
602 exit 1
603 fi
604 if test "$solinst" = "/usr/sbin/install" ; then
605 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
606 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
607 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
608 exit 1
609 fi
bellardec530c82006-04-25 22:36:06 +0000610 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
611 if test -z "$sol_ar" ; then
612 echo "Error: No path includes ar"
613 if test -f /usr/ccs/bin/ar ; then
614 echo "Add /usr/ccs/bin to your path and rerun configure"
615 fi
616 exit 1
617 fi
ths5fafdf22007-09-16 21:08:06 +0000618fi
bellardec530c82006-04-25 22:36:06 +0000619
620
bellard5327cf42005-01-10 23:18:50 +0000621if test -z "$target_list" ; then
622# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000623 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000624 target_list="\
625i386-softmmu \
626x86_64-softmmu \
627arm-softmmu \
628cris-softmmu \
629m68k-softmmu \
630mips-softmmu \
631mipsel-softmmu \
632mips64-softmmu \
633mips64el-softmmu \
634ppc-softmmu \
635ppcemb-softmmu \
636ppc64-softmmu \
637sh4-softmmu \
638sh4eb-softmmu \
639sparc-softmmu \
640"
pbrook0a8e90f2006-03-19 14:54:16 +0000641 fi
bellard5327cf42005-01-10 23:18:50 +0000642# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000643 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000644 target_list="${target_list}\
645i386-linux-user \
646x86_64-linux-user \
647alpha-linux-user \
648arm-linux-user \
649armeb-linux-user \
650cris-linux-user \
651m68k-linux-user \
652mips-linux-user \
653mipsel-linux-user \
654ppc-linux-user \
655ppc64-linux-user \
656ppc64abi32-linux-user \
657sh4-linux-user \
658sh4eb-linux-user \
659sparc-linux-user \
660sparc64-linux-user \
661sparc32plus-linux-user \
662"
ths831b7822007-01-18 20:06:33 +0000663 fi
664# the following are Darwin specific
665 if [ "$darwin_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000666 target_list="$target_list i386-darwin-user ppc-darwin-user"
bellard5327cf42005-01-10 23:18:50 +0000667 fi
blueswir184778502008-10-26 20:33:16 +0000668# the following are BSD specific
669 if [ "$bsd_user" = "yes" ] ; then
670 target_list="${target_list}\
671sparc64-bsd-user \
672"
673 fi
bellard6e20a452005-06-05 15:56:02 +0000674else
pbrookb1a550a2006-04-16 13:28:56 +0000675 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000676fi
pbrook0a8e90f2006-03-19 14:54:16 +0000677if test -z "$target_list" ; then
678 echo "No targets enabled"
679 exit 1
680fi
bellard5327cf42005-01-10 23:18:50 +0000681
bellard7d132992003-03-06 23:23:54 +0000682if test -z "$cross_prefix" ; then
683
684# ---
685# big/little endian test
686cat > $TMPC << EOF
687#include <inttypes.h>
688int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000689 volatile uint32_t i=0x01234567;
690 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000691}
692EOF
693
pbrookdb7287e2008-02-03 16:27:13 +0000694if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000695$TMPE && bigendian="yes"
696else
697echo big/little test failed
698fi
699
700else
701
702# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000703if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000704 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000705 -o "$cpu" = "m68k" \
706 -o "$cpu" = "mips" \
707 -o "$cpu" = "mips64" \
708 -o "$cpu" = "powerpc" \
709 -o "$cpu" = "s390" \
710 -o "$cpu" = "sparc" \
711 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000712 bigendian="yes"
713fi
714
715fi
716
bellardb6853692005-06-05 17:10:39 +0000717# host long bits test
718hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000719if test "$cpu" = "x86_64" \
720 -o "$cpu" = "alpha" \
721 -o "$cpu" = "ia64" \
722 -o "$cpu" = "sparc64"; then
bellardb6853692005-06-05 17:10:39 +0000723 hostlongbits="64"
724fi
725
malc810260a2008-07-23 19:17:46 +0000726# ppc specific hostlongbits selection
727if test "$cpu" = "powerpc" ; then
malc9d56d2d2008-09-30 19:44:32 +0000728 if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
729 grep -q __powerpc64__ $TMPI && hostlongbits=64
malc810260a2008-07-23 19:17:46 +0000730 else
731 echo hostlongbits test failed
malcba69a082008-07-24 17:51:36 +0000732 exit 1
malc810260a2008-07-23 19:17:46 +0000733 fi
734fi
735
bellarde8cd23d2003-06-25 16:08:13 +0000736# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000737cat > $TMPC <<EOF
738int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000739}
740EOF
741
pbrookbd0c5662008-05-29 14:34:11 +0000742# Check host NPTL support
743cat > $TMPC <<EOF
744#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000745#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000746void foo()
747{
748#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
749#error bork
750#endif
751}
752EOF
753
754if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
755 :
756else
757 nptl="no"
758fi
759
bellard11d9f692004-04-02 20:55:59 +0000760##########################################
balrogac629222008-10-11 09:56:04 +0000761# zlib check
762
763cat > $TMPC << EOF
764#include <zlib.h>
765int main(void) { zlibVersion(); return 0; }
766EOF
balrog17e15922008-10-11 12:00:42 +0000767if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000768 :
769else
770 echo
771 echo "Error: zlib check failed"
772 echo "Make sure to have the zlib libs and headers installed."
773 echo
774 exit 1
775fi
776
777##########################################
bellard11d9f692004-04-02 20:55:59 +0000778# SDL probe
779
780sdl_too_old=no
781
782if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000783 sdl_config="sdl-config"
784 sdl=no
785 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000786
787cat > $TMPC << EOF
788#include <SDL.h>
789#undef main /* We don't want SDL to override our main() */
790int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
791EOF
aliguoricd01b4a2008-08-21 19:25:45 +0000792 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
793 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
794 if test "$_sdlversion" -lt 121 ; then
795 sdl_too_old=yes
796 else
797 if test "$cocoa" = "no" ; then
798 sdl=yes
799 fi
800 fi
801
802 # static link with sdl ?
803 if test "$sdl" = "yes" ; then
804 aa="no"
805 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
806 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
807 if [ "$aa" = "yes" ] ; then
808 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000809 fi
bellard11d9f692004-04-02 20:55:59 +0000810
aliguoricd01b4a2008-08-21 19:25:45 +0000811 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
812 sdl_static=yes
813 fi
814 fi # static link
815 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000816else
ths069b0bd2007-07-12 00:27:15 +0000817 # Make sure to disable cocoa if sdl was set
818 if test "$sdl" = "yes" ; then
819 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000820 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000821 fi
bellarda6e022a2004-04-02 21:55:47 +0000822fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000823
ths8f28f3f2007-01-05 21:25:54 +0000824##########################################
ths8d5d2d42007-08-25 01:37:51 +0000825# VNC TLS detection
826if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000827cat > $TMPC <<EOF
828#include <gnutls/gnutls.h>
829int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
830EOF
831 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
832 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
833 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
834 $vnc_tls_libs 2> /dev/null ; then
835 :
836 else
837 vnc_tls="no"
838 fi
ths8d5d2d42007-08-25 01:37:51 +0000839fi
840
841##########################################
ths8a16d272008-07-19 09:56:24 +0000842# vde libraries probe
843if test "$vde" = "yes" ; then
844 cat > $TMPC << EOF
845#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000846int main(void)
847{
848 struct vde_open_args a = {0, 0, 0};
849 vde_open("", "", &a);
850 return 0;
851}
ths8a16d272008-07-19 09:56:24 +0000852EOF
pbrook4a7f0e02008-09-07 16:42:53 +0000853 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000854 :
855 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000856 vde="no"
ths8a16d272008-07-19 09:56:24 +0000857 fi
858fi
859
860##########################################
malcc2de5c92008-06-28 19:13:06 +0000861# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000862
malcc2de5c92008-06-28 19:13:06 +0000863audio_drv_probe()
864{
865 drv=$1
866 hdr=$2
867 lib=$3
868 exp=$4
869 cfl=$5
870 cat > $TMPC << EOF
871#include <$hdr>
872int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000873EOF
malcc2de5c92008-06-28 19:13:06 +0000874 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib 2> /dev/null ; then
875 :
876 else
877 echo
878 echo "Error: $drv check failed"
879 echo "Make sure to have the $drv libs and headers installed."
880 echo
881 exit 1
882 fi
883}
884
malc2fa7d3b2008-07-29 12:58:44 +0000885audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000886for drv in $audio_drv_list; do
887 case $drv in
888 alsa)
889 audio_drv_probe $drv alsa/asoundlib.h -lasound \
890 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
891 ;;
892
893 fmod)
894 if test -z $fmod_lib || test -z $fmod_inc; then
895 echo
896 echo "Error: You must specify path to FMOD library and headers"
897 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
898 echo
899 exit 1
900 fi
901 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
902 ;;
903
904 esd)
905 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
906 ;;
malcb8e59f12008-07-02 21:03:08 +0000907
908 pa)
909 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
910 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
911 ;;
912
blueswir12f6a1ab2008-08-21 18:00:53 +0000913 oss|sdl|core|wav|dsound)
914 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
915 ;;
916
malce4c63a62008-07-19 16:15:16 +0000917 *)
malc1c9b2a52008-07-19 16:57:30 +0000918 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +0000919 echo
920 echo "Error: Unknown driver '$drv' selected"
921 echo "Possible drivers are: $audio_possible_drivers"
922 echo
923 exit 1
924 }
925 ;;
malcc2de5c92008-06-28 19:13:06 +0000926 esac
927done
ths8f28f3f2007-01-05 21:25:54 +0000928
balrog4d3b6f62008-02-10 16:33:14 +0000929##########################################
aurel322e4d9fb2008-04-08 06:01:02 +0000930# BrlAPI probe
931
932if test -z "$brlapi" ; then
933 brlapi=no
934cat > $TMPC << EOF
935#include <brlapi.h>
936int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
937EOF
aurel32a40e56d2008-05-04 00:50:25 +0000938 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +0000939 brlapi=yes
940 fi # brlapi compile test
941fi # -z $brlapi
942
943##########################################
balrog4d3b6f62008-02-10 16:33:14 +0000944# curses probe
945
946if test "$curses" = "yes" ; then
947 curses=no
948 cat > $TMPC << EOF
949#include <curses.h>
950int main(void) { return curses_version(); }
951EOF
pbrookaf896aa2008-03-23 00:47:42 +0000952 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +0000953 curses=yes
954 fi
955fi # test "$curses"
956
blueswir1414f0da2008-08-15 18:20:52 +0000957##########################################
balrogfb599c92008-09-28 23:49:55 +0000958# bluez support probe
959if test "$bluez" = "yes" ; then
960 `pkg-config bluez` || bluez="no"
961fi
962if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +0000963 cat > $TMPC << EOF
964#include <bluetooth/bluetooth.h>
965int main(void) { return bt_error(0); }
966EOF
balrogfb599c92008-09-28 23:49:55 +0000967 bluez_cflags=`pkg-config --cflags bluez`
968 bluez_libs=`pkg-config --libs bluez`
balrog17e15922008-10-11 12:00:42 +0000969 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balroge820e3f2008-09-30 02:27:44 +0000970 $bluez_libs 2> /dev/null ; then
971 :
972 else
973 bluez="no"
974 fi
balrogfb599c92008-09-28 23:49:55 +0000975fi
976
977##########################################
aliguori7ba1e612008-11-05 16:04:33 +0000978# kvm probe
979if test "$kvm" = "yes" ; then
980 cat > $TMPC <<EOF
981#include <linux/kvm.h>
982#if !defined(KVM_API_VERSION) || \
983 KVM_API_VERSION < 12 || \
984 KVM_API_VERSION > 12 || \
985 !defined(KVM_CAP_USER_MEMORY) || \
986 !defined(KVM_CAP_SET_TSS_ADDR)
987#error Invalid KVM version
988#endif
989int main(void) { return 0; }
990EOF
aliguorieac30262008-11-05 16:28:56 +0000991 if test "$kerneldir" != "" ; then
992 kvm_cflags=-I"$kerneldir"/include
993 else
994 kvm_cflags=""
995 fi
aliguori7ba1e612008-11-05 16:04:33 +0000996 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
997 2>/dev/null ; then
998 :
999 else
1000 kvm="no"
1001 fi
1002fi
1003
1004##########################################
blueswir1414f0da2008-08-15 18:20:52 +00001005# AIO probe
1006if test "$aio" = "yes" ; then
1007 aio=no
1008 cat > $TMPC << EOF
1009#include <aio.h>
1010int main(void) { return aio_write(NULL); }
1011EOF
1012 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1013 aio=yes
1014 fi
1015fi
1016
pbrookcc8ae6d2006-04-23 17:57:59 +00001017# Check if tools are available to build documentation.
ths6c591862007-05-09 13:55:03 +00001018if [ -x "`which texi2html 2>/dev/null`" ] && \
1019 [ -x "`which pod2man 2>/dev/null`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +00001020 build_docs="yes"
1021fi
1022
bellard11d9f692004-04-02 20:55:59 +00001023if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001024 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001025 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001026 fi
1027 mansuffix=""
1028 datasuffix=""
1029 docsuffix=""
1030 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001031else
pbrook308c3592007-02-27 00:52:01 +00001032 if test -z "$prefix" ; then
1033 prefix="/usr/local"
1034 fi
1035 mansuffix="/share/man"
1036 datasuffix="/share/qemu"
1037 docsuffix="/share/doc/qemu"
1038 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001039fi
bellard5a671352003-10-01 00:13:48 +00001040
bellard43ce4df2003-06-09 19:53:12 +00001041echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001042echo "BIOS directory $prefix$datasuffix"
1043echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001044if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001045echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001046echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001047fi
bellard5a671352003-10-01 00:13:48 +00001048echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001049echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001050echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001051echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001052echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001053echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001054echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001055echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001056echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00001057echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001058echo "sparse enabled $sparse"
bellard05c2a3e2006-02-08 22:39:17 +00001059echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001060echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001061echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001062if test "$darwin" = "yes" ; then
1063 echo "Cocoa support $cocoa"
1064fi
bellard97a847b2003-08-10 21:36:04 +00001065echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001066if test "$sdl" != "no" ; then
1067 echo "SDL static link $sdl_static"
1068fi
balrog4d3b6f62008-02-10 16:33:14 +00001069echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001070echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001071echo "Audio drivers $audio_drv_list"
1072echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001073echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001074echo "VNC TLS support $vnc_tls"
1075if test "$vnc_tls" = "yes" ; then
1076 echo " TLS CFLAGS $vnc_tls_cflags"
1077 echo " TLS LIBS $vnc_tls_libs"
1078fi
blueswir131422552007-04-16 18:27:06 +00001079if test -n "$sparc_cpu"; then
1080 echo "Target Sparc Arch $sparc_cpu"
1081fi
bellard07f4ddb2005-04-23 17:44:28 +00001082echo "kqemu support $kqemu"
aurel322e4d9fb2008-04-08 06:01:02 +00001083echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001084echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001085[ ! -z "$uname_release" ] && \
1086echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001087echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001088echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001089echo "AIO support $aio"
ths77755342008-11-27 15:45:16 +00001090echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001091echo "KVM support $kvm"
bellard67b915a2004-03-31 23:37:16 +00001092
bellard97a847b2003-08-10 21:36:04 +00001093if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001094echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001095fi
ths20b40c62007-07-11 23:39:45 +00001096if [ -s /tmp/qemu-$$-sdl-config.log ]; then
1097 echo "The error log from compiling the libSDL test is: "
1098 cat /tmp/qemu-$$-sdl-config.log
1099fi
1100rm -f /tmp/qemu-$$-sdl-config.log
bellard24b55b92005-03-01 22:30:41 +00001101#if test "$sdl_static" = "no"; then
1102# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1103#fi
bellard97a847b2003-08-10 21:36:04 +00001104config_mak="config-host.mak"
1105config_h="config-host.h"
1106
bellard7c1f25b2004-04-22 00:02:08 +00001107#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001108
ths15d9ca02007-07-31 23:07:32 +00001109test -f $config_h && mv $config_h ${config_h}~
1110
bellard97a847b2003-08-10 21:36:04 +00001111echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +00001112echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001113echo "/* Automatically generated by configure - do not modify */" > $config_h
1114
1115echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001116echo "bindir=\${prefix}$binsuffix" >> $config_mak
1117echo "mandir=\${prefix}$mansuffix" >> $config_mak
1118echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001119echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001120echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001121echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001122echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001123echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001124echo "HOST_CC=$host_cc" >> $config_mak
1125echo "AR=$ar" >> $config_mak
1126echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001127# XXX: only use CFLAGS and LDFLAGS ?
1128# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1129# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001130echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001131echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1132echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1133echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001134echo "CFLAGS=$CFLAGS" >> $config_mak
1135echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001136echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +00001137echo "AIOLIBS=$AIOLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001138case "$cpu" in
1139 i386)
1140 echo "ARCH=i386" >> $config_mak
1141 echo "#define HOST_I386 1" >> $config_h
1142 ;;
1143 x86_64)
1144 echo "ARCH=x86_64" >> $config_mak
1145 echo "#define HOST_X86_64 1" >> $config_h
1146 ;;
1147 alpha)
1148 echo "ARCH=alpha" >> $config_mak
1149 echo "#define HOST_ALPHA 1" >> $config_h
1150 ;;
1151 armv4b)
1152 echo "ARCH=arm" >> $config_mak
1153 echo "#define HOST_ARM 1" >> $config_h
1154 ;;
1155 armv4l)
1156 echo "ARCH=arm" >> $config_mak
1157 echo "#define HOST_ARM 1" >> $config_h
1158 ;;
1159 cris)
1160 echo "ARCH=cris" >> $config_mak
1161 echo "#define HOST_CRIS 1" >> $config_h
1162 ;;
1163 hppa)
1164 echo "ARCH=hppa" >> $config_mak
1165 echo "#define HOST_HPPA 1" >> $config_h
1166 ;;
1167 ia64)
1168 echo "ARCH=ia64" >> $config_mak
1169 echo "#define HOST_IA64 1" >> $config_h
1170 ;;
1171 m68k)
1172 echo "ARCH=m68k" >> $config_mak
1173 echo "#define HOST_M68K 1" >> $config_h
1174 ;;
1175 mips)
1176 echo "ARCH=mips" >> $config_mak
1177 echo "#define HOST_MIPS 1" >> $config_h
1178 ;;
1179 mips64)
1180 echo "ARCH=mips64" >> $config_mak
1181 echo "#define HOST_MIPS64 1" >> $config_h
1182 ;;
1183 powerpc)
malc810260a2008-07-23 19:17:46 +00001184 if test "$hostlongbits" = "32"; then
1185 echo "ARCH=ppc" >> $config_mak
1186 echo "#define HOST_PPC 1" >> $config_h
1187 else
1188 echo "ARCH=ppc64" >> $config_mak
1189 echo "#define HOST_PPC64 1" >> $config_h
1190 fi
aurel322408a522008-04-20 20:19:44 +00001191 ;;
1192 s390)
1193 echo "ARCH=s390" >> $config_mak
1194 echo "#define HOST_S390 1" >> $config_h
1195 ;;
1196 sparc)
1197 echo "ARCH=sparc" >> $config_mak
1198 echo "#define HOST_SPARC 1" >> $config_h
1199 ;;
1200 sparc64)
1201 echo "ARCH=sparc64" >> $config_mak
1202 echo "#define HOST_SPARC64 1" >> $config_h
1203 ;;
1204 *)
1205 echo "Unsupported CPU = $cpu"
1206 exit 1
1207 ;;
1208esac
aliguori03b4fe72008-10-07 19:16:17 +00001209if test "$sparse" = "yes" ; then
1210 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1211 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1212 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1213fi
bellard7d132992003-03-06 23:23:54 +00001214if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001215 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1216 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1217fi
bellardb6853692005-06-05 17:10:39 +00001218echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001219if test "$mingw32" = "yes" ; then
1220 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001221 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001222else
1223 cat > $TMPC << EOF
1224#include <byteswap.h>
1225int main(void) { return bswap_32(0); }
1226EOF
pbrookdb7287e2008-02-03 16:27:13 +00001227 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001228 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1229 fi
bellard67b915a2004-03-31 23:37:16 +00001230fi
blueswir1128ab2f2008-08-15 18:33:42 +00001231
1232if [ "$openbsd" = "yes" ] ; then
1233 echo "#define ENOTSUP 4096" >> $config_h
1234fi
1235
bellard83fb7ad2004-07-05 21:25:26 +00001236if test "$darwin" = "yes" ; then
1237 echo "CONFIG_DARWIN=yes" >> $config_mak
1238 echo "#define CONFIG_DARWIN 1" >> $config_h
1239fi
malcb29fe3e2008-11-18 01:42:22 +00001240
1241if test "$aix" = "yes" ; then
1242 echo "CONFIG_AIX=yes" >> $config_mak
1243 echo "#define CONFIG_AIX 1" >> $config_h
1244fi
1245
bellardec530c82006-04-25 22:36:06 +00001246if test "$solaris" = "yes" ; then
1247 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001248 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001249 if test "$needs_libsunmath" = "yes" ; then
1250 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1251 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1252 fi
bellardec530c82006-04-25 22:36:06 +00001253fi
blueswir131422552007-04-16 18:27:06 +00001254if test -n "$sparc_cpu"; then
1255 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1256 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1257fi
bellard67b915a2004-03-31 23:37:16 +00001258if test "$gdbstub" = "yes" ; then
1259 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1260 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1261fi
bellard97a847b2003-08-10 21:36:04 +00001262if test "$gprof" = "yes" ; then
1263 echo "TARGET_GPROF=yes" >> $config_mak
1264 echo "#define HAVE_GPROF 1" >> $config_h
1265fi
1266if test "$static" = "yes" ; then
1267 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001268 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001269fi
bellard05c2a3e2006-02-08 22:39:17 +00001270if test $profiler = "yes" ; then
1271 echo "#define CONFIG_PROFILER 1" >> $config_h
1272fi
bellardc20709a2004-04-21 23:27:19 +00001273if test "$slirp" = "yes" ; then
1274 echo "CONFIG_SLIRP=yes" >> $config_mak
1275 echo "#define CONFIG_SLIRP 1" >> $config_h
1276fi
ths8a16d272008-07-19 09:56:24 +00001277if test "$vde" = "yes" ; then
1278 echo "CONFIG_VDE=yes" >> $config_mak
1279 echo "#define CONFIG_VDE 1" >> $config_h
1280 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1281fi
malc0c58ac12008-06-25 21:04:05 +00001282for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001283 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001284 echo "$def=yes" >> $config_mak
1285 echo "#define $def 1" >> $config_h
1286done
1287echo "#define AUDIO_DRIVERS \\" >> $config_h
1288for drv in $audio_drv_list; do
1289 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001290 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001291 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001292 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001293 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1294 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001295 elif test "$drv" = "oss"; then
1296 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001297 fi
1298done
1299echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001300if test "$mixemu" = "yes" ; then
1301 echo "CONFIG_MIXEMU=yes" >> $config_mak
1302 echo "#define CONFIG_MIXEMU 1" >> $config_h
1303fi
ths8d5d2d42007-08-25 01:37:51 +00001304if test "$vnc_tls" = "yes" ; then
1305 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1306 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1307 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1308 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1309fi
pbrookb1a550a2006-04-16 13:28:56 +00001310qemu_version=`head $source_path/VERSION`
1311echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001312echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001313
1314echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001315if [ "$source_path_used" = "yes" ]; then
1316 echo "VPATH=$source_path" >> $config_mak
1317fi
bellard97a847b2003-08-10 21:36:04 +00001318echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001319if [ "$build_docs" = "yes" ] ; then
1320 echo "BUILD_DOCS=yes" >> $config_mak
1321fi
bellard49ecc3f2007-11-07 19:25:15 +00001322if test "$static" = "yes"; then
1323 sdl1=$sdl_static
1324else
1325 sdl1=$sdl
1326fi
1327if test "$sdl1" = "yes" ; then
1328 echo "#define CONFIG_SDL 1" >> $config_h
1329 echo "CONFIG_SDL=yes" >> $config_mak
1330 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1331 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1332 else
1333 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1334 fi
1335 if [ "${aa}" = "yes" ] ; then
1336 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1337 else
1338 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1339 fi
1340fi
1341if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001342 echo "#define CONFIG_COCOA 1" >> $config_h
1343 echo "CONFIG_COCOA=yes" >> $config_mak
1344fi
1345if test "$curses" = "yes" ; then
1346 echo "#define CONFIG_CURSES 1" >> $config_h
1347 echo "CONFIG_CURSES=yes" >> $config_mak
1348 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001349fi
aurel322e4d9fb2008-04-08 06:01:02 +00001350if test "$brlapi" = "yes" ; then
1351 echo "CONFIG_BRLAPI=yes" >> $config_mak
1352 echo "#define CONFIG_BRLAPI 1" >> $config_h
1353 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1354fi
balrogfb599c92008-09-28 23:49:55 +00001355if test "$bluez" = "yes" ; then
1356 echo "CONFIG_BLUEZ=yes" >> $config_mak
1357 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1358 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1359 echo "#define CONFIG_BLUEZ 1" >> $config_h
1360fi
blueswir1414f0da2008-08-15 18:20:52 +00001361if test "$aio" = "yes" ; then
1362 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001363 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001364fi
ths77755342008-11-27 15:45:16 +00001365if test "$blobs" = "yes" ; then
1366 echo "INSTALL_BLOBS=yes" >> $config_mak
1367fi
bellard97a847b2003-08-10 21:36:04 +00001368
bellard83fb7ad2004-07-05 21:25:26 +00001369# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001370if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001371 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001372 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001373 echo "#define _BSD 1" >> $config_h
1374fi
1375
pbrookc5937222006-05-14 11:30:38 +00001376echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1377
blueswir168063642008-11-22 21:03:55 +00001378# USB host support
1379case "$usb" in
1380linux)
1381 echo "HOST_USB=linux" >> $config_mak
1382;;
1383bsd)
1384 echo "HOST_USB=bsd" >> $config_mak
1385;;
1386*)
1387 echo "HOST_USB=stub" >> $config_mak
1388;;
1389esac
1390
pbrookc39e3332007-09-22 16:49:14 +00001391tools=
1392if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1393 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001394 if [ "$linux" = "yes" ] ; then
1395 tools="qemu-nbd\$(EXESUF) $tools"
1396 fi
pbrookc39e3332007-09-22 16:49:14 +00001397fi
1398echo "TOOLS=$tools" >> $config_mak
1399
ths15d9ca02007-07-31 23:07:32 +00001400test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1401
bellard1d14ffa2005-10-30 18:58:22 +00001402for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001403target_dir="$target"
1404config_mak=$target_dir/config.mak
1405config_h=$target_dir/config.h
1406target_cpu=`echo $target | cut -d '-' -f 1`
1407target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001408[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001409[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1410[ "$target_cpu" = "mips" ] && target_bigendian=yes
1411[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1412[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001413[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001414[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001415[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001416[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001417[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001418[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1419[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1420[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001421target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001422target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001423target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001424target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001425target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001426case "$target" in
1427 ${target_cpu}-softmmu)
1428 target_softmmu="yes"
1429 ;;
1430 ${target_cpu}-linux-user)
1431 target_user_only="yes"
1432 target_linux_user="yes"
1433 ;;
1434 ${target_cpu}-darwin-user)
1435 target_user_only="yes"
1436 target_darwin_user="yes"
1437 ;;
blueswir184778502008-10-26 20:33:16 +00001438 ${target_cpu}-bsd-user)
1439 target_user_only="yes"
1440 target_bsd_user="yes"
1441 ;;
pbrook9e407a82007-05-26 16:38:53 +00001442 *)
1443 echo "ERROR: Target '$target' not recognised"
1444 exit 1
1445 ;;
1446esac
ths831b7822007-01-18 20:06:33 +00001447
bellard97ccc682005-07-02 13:32:17 +00001448if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001449 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001450 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001451 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001452 echo "Note that this will disable all output from the virtual graphics card"
1453 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001454 exit 1;
1455fi
1456
bellard7c1f25b2004-04-22 00:02:08 +00001457#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001458
ths15d9ca02007-07-31 23:07:32 +00001459test -f $config_h && mv $config_h ${config_h}~
1460
bellard97a847b2003-08-10 21:36:04 +00001461mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001462mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001463mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001464if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
bellard69de9272004-02-16 21:40:43 +00001465 mkdir -p $target_dir/nwfpe
1466fi
1467
bellardec530c82006-04-25 22:36:06 +00001468#
1469# don't use ln -sf as not all "ln -sf" over write the file/link
1470#
1471rm -f $target_dir/Makefile
1472ln -s $source_path/Makefile.target $target_dir/Makefile
1473
bellard97a847b2003-08-10 21:36:04 +00001474
1475echo "# Automatically generated by configure - do not modify" > $config_mak
1476echo "/* Automatically generated by configure - do not modify */" > $config_h
1477
1478
1479echo "include ../config-host.mak" >> $config_mak
1480echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001481
pbrooke5fe0c52006-06-11 13:32:59 +00001482bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001483elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001484target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001485interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1486echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001487gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001488
aliguori5985ece2008-11-05 19:59:25 +00001489# Make sure the target and host cpus are compatible
1490if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1491 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1492 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001493 kvm="no"
1494fi
1495# Disable KVM for linux-user
1496if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1497 kvm="no"
1498fi
1499
aurel322408a522008-04-20 20:19:44 +00001500case "$target_cpu" in
1501 i386)
1502 echo "TARGET_ARCH=i386" >> $config_mak
1503 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1504 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001505 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001506 then
1507 echo "#define USE_KQEMU 1" >> $config_h
1508 fi
aliguori7ba1e612008-11-05 16:04:33 +00001509 if test "$kvm" = "yes" ; then
1510 echo "CONFIG_KVM=yes" >> $config_mak
1511 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001512 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001513 fi
aurel32f2bf0942008-05-05 06:00:27 +00001514 gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
pbrook11d1fdb2008-05-23 23:16:42 +00001515 if test -n "$gcc3minver" && test $gcc3minver -gt 3
aurel32f2bf0942008-05-05 06:00:27 +00001516 then
1517 echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1518 else
1519 echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1520 fi
aurel322408a522008-04-20 20:19:44 +00001521 ;;
1522 x86_64)
1523 echo "TARGET_ARCH=x86_64" >> $config_mak
1524 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1525 echo "#define TARGET_I386 1" >> $config_h
1526 echo "#define TARGET_X86_64 1" >> $config_h
1527 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1528 then
1529 echo "#define USE_KQEMU 1" >> $config_h
1530 fi
aliguori7ba1e612008-11-05 16:04:33 +00001531 if test "$kvm" = "yes" ; then
1532 echo "CONFIG_KVM=yes" >> $config_mak
1533 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1534 echo "#define CONFIG_KVM 1" >> $config_h
1535 fi
aurel322408a522008-04-20 20:19:44 +00001536 ;;
1537 alpha)
1538 echo "TARGET_ARCH=alpha" >> $config_mak
1539 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1540 echo "#define TARGET_ALPHA 1" >> $config_h
1541 ;;
1542 arm|armeb)
1543 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001544 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1545 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001546 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001547 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001548 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00001549 ;;
1550 cris)
1551 echo "TARGET_ARCH=cris" >> $config_mak
1552 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1553 echo "#define TARGET_CRIS 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001554 ;;
1555 m68k)
1556 echo "TARGET_ARCH=m68k" >> $config_mak
1557 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1558 echo "#define TARGET_M68K 1" >> $config_h
1559 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001560 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00001561 ;;
1562 mips|mipsel)
1563 echo "TARGET_ARCH=mips" >> $config_mak
1564 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1565 echo "#define TARGET_MIPS 1" >> $config_h
1566 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1567 ;;
1568 mipsn32|mipsn32el)
1569 echo "TARGET_ARCH=mipsn32" >> $config_mak
1570 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1571 echo "#define TARGET_MIPS 1" >> $config_h
1572 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1573 ;;
1574 mips64|mips64el)
1575 echo "TARGET_ARCH=mips64" >> $config_mak
1576 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1577 echo "#define TARGET_MIPS 1" >> $config_h
1578 echo "#define TARGET_MIPS64 1" >> $config_h
1579 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1580 ;;
1581 ppc)
1582 echo "TARGET_ARCH=ppc" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001583 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001584 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1585 echo "#define TARGET_PPC 1" >> $config_h
blueswir1bf6247f2008-05-10 12:27:33 +00001586 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001587 ;;
1588 ppcemb)
1589 echo "TARGET_ARCH=ppcemb" >> $config_mak
1590 echo "TARGET_ABI_DIR=ppc" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001591 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001592 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1593 echo "#define TARGET_PPC 1" >> $config_h
1594 echo "#define TARGET_PPCEMB 1" >> $config_h
blueswir1ec5b78c2008-05-10 17:23:18 +00001595 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001596 ;;
1597 ppc64)
1598 echo "TARGET_ARCH=ppc64" >> $config_mak
1599 echo "TARGET_ABI_DIR=ppc" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001600 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001601 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1602 echo "#define TARGET_PPC 1" >> $config_h
1603 echo "#define TARGET_PPC64 1" >> $config_h
blueswir1bf6247f2008-05-10 12:27:33 +00001604 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001605 ;;
1606 ppc64abi32)
1607 echo "TARGET_ARCH=ppc64" >> $config_mak
1608 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1609 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
blueswir1bf6247f2008-05-10 12:27:33 +00001610 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001611 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1612 echo "#define TARGET_PPC 1" >> $config_h
1613 echo "#define TARGET_PPC64 1" >> $config_h
1614 echo "#define TARGET_ABI32 1" >> $config_h
blueswir1bf6247f2008-05-10 12:27:33 +00001615 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001616 ;;
1617 sh4|sh4eb)
1618 echo "TARGET_ARCH=sh4" >> $config_mak
1619 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1620 echo "#define TARGET_SH4 1" >> $config_h
1621 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001622 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001623 ;;
1624 sparc)
1625 echo "TARGET_ARCH=sparc" >> $config_mak
1626 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1627 echo "#define TARGET_SPARC 1" >> $config_h
1628 ;;
1629 sparc64)
1630 echo "TARGET_ARCH=sparc64" >> $config_mak
1631 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1632 echo "#define TARGET_SPARC 1" >> $config_h
1633 echo "#define TARGET_SPARC64 1" >> $config_h
1634 elfload32="yes"
1635 ;;
1636 sparc32plus)
1637 echo "TARGET_ARCH=sparc64" >> $config_mak
1638 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1639 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1640 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1641 echo "#define TARGET_SPARC 1" >> $config_h
1642 echo "#define TARGET_SPARC64 1" >> $config_h
1643 echo "#define TARGET_ABI32 1" >> $config_h
1644 ;;
1645 *)
1646 echo "Unsupported target CPU"
1647 exit 1
1648 ;;
1649esac
bellardde83cd02003-06-15 20:25:43 +00001650if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001651 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1652 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1653fi
1654if test "$target_softmmu" = "yes" ; then
1655 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1656 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00001657fi
bellard997344f2003-10-27 21:10:39 +00001658if test "$target_user_only" = "yes" ; then
1659 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1660 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1661fi
ths831b7822007-01-18 20:06:33 +00001662if test "$target_linux_user" = "yes" ; then
1663 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1664 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1665fi
1666if test "$target_darwin_user" = "yes" ; then
1667 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1668 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1669fi
pbrook56aebc82008-10-11 17:55:29 +00001670list=""
1671if test ! -z "$gdb_xml_files" ; then
1672 for x in $gdb_xml_files; do
1673 list="$list $source_path/gdb-xml/$x"
1674 done
1675fi
1676echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00001677
aurel320938cda2008-04-11 21:36:06 +00001678if test "$target_cpu" = "arm" \
1679 -o "$target_cpu" = "armeb" \
1680 -o "$target_cpu" = "m68k" \
1681 -o "$target_cpu" = "mips" \
1682 -o "$target_cpu" = "mipsel" \
1683 -o "$target_cpu" = "mipsn32" \
1684 -o "$target_cpu" = "mipsn32el" \
1685 -o "$target_cpu" = "mips64" \
1686 -o "$target_cpu" = "mips64el" \
1687 -o "$target_cpu" = "sparc" \
1688 -o "$target_cpu" = "sparc64" \
1689 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00001690 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1691 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1692fi
pbrooke5fe0c52006-06-11 13:32:59 +00001693if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1694 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1695 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1696fi
pbrookbd0c5662008-05-29 14:34:11 +00001697if test "$target_user_only" = "yes" \
1698 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1699 echo "#define USE_NPTL 1" >> $config_h
1700fi
blueswir1cb33da52007-10-09 16:34:29 +00001701# 32 bit ELF loader in addition to native 64 bit loader?
1702if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1703 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1704 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1705fi
blueswir184778502008-10-26 20:33:16 +00001706if test "$target_bsd_user" = "yes" ; then
1707 echo "CONFIG_BSD_USER=yes" >> $config_mak
1708 echo "#define CONFIG_BSD_USER 1" >> $config_h
1709fi
bellard5b0753e2005-03-01 21:37:28 +00001710
ths15d9ca02007-07-31 23:07:32 +00001711test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1712
bellard97a847b2003-08-10 21:36:04 +00001713done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00001714
1715# build tree in object directory if source path is different from current one
1716if test "$source_path_used" = "yes" ; then
bellard49ecc3f2007-11-07 19:25:15 +00001717 DIRS="tests tests/cris slirp audio"
bellard7d132992003-03-06 23:23:54 +00001718 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00001719 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00001720 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00001721 for dir in $DIRS ; do
1722 mkdir -p $dir
1723 done
bellardec530c82006-04-25 22:36:06 +00001724 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001725 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001726 rm -f $f
1727 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001728 done
1729fi
bellard7d132992003-03-06 23:23:54 +00001730
malc9d56d2d2008-09-30 19:44:32 +00001731rm -f $TMPO $TMPC $TMPE $TMPS $TMPI