blob: ec761ff95c43e793adf65a571f2536315ed88388 [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"
malcd4742de2008-11-29 22:04:31 +000019TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
bellard7d132992003-03-06 23:23:54 +000020
malcd4742de2008-11-29 22:04:31 +000021trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
malc9ac81bb2008-11-29 20:09:56 +000022
bellard7d132992003-03-06 23:23:54 +000023# default parameters
bellard11d9f692004-04-02 20:55:59 +000024prefix=""
bellard1e43adf2003-09-30 20:54:24 +000025interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000026static="no"
bellard7d132992003-03-06 23:23:54 +000027cross_prefix=""
28cc="gcc"
malc0c58ac12008-06-25 21:04:05 +000029audio_drv_list=""
malc4c9b53e2009-01-09 10:46:34 +000030audio_card_list="ac97 es1370 sb16"
31audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
bellard7d132992003-03-06 23:23:54 +000032host_cc="gcc"
33ar="ar"
34make="make"
pbrook6a882642006-04-17 13:57:12 +000035install="install"
bellard7d132992003-03-06 23:23:54 +000036strip="strip"
aliguoriac0df512008-12-29 17:14:15 +000037
38# parse CC options first
39for opt do
40 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
41 case "$opt" in
42 --cross-prefix=*) cross_prefix="$optarg"
43 ;;
44 --cc=*) cc="$optarg"
45 ;;
46 esac
47done
48
49# OS specific
50# Using uname is really, really broken. Once we have the right set of checks
51# we can eliminate it's usage altogether
52
53cc="${cross_prefix}${cc}"
54ar="${cross_prefix}${ar}"
55strip="${cross_prefix}${strip}"
56
57# check that the C compiler works.
58cat > $TMPC <<EOF
59int main(void) {}
60EOF
61
62if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
63 : C compiler works ok
64else
65 echo "ERROR: \"$cc\" either does not exist or does not work"
66 exit 1
67fi
68
69check_define() {
70cat > $TMPC <<EOF
71#if !defined($1)
72#error Not defined
73#endif
74int main(void) { return 0; }
75EOF
76 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
77}
78
79if check_define __i386__ ; then
80 cpu="i386"
81elif check_define __x86_64__ ; then
82 cpu="x86_64"
blueswir13aa9bd62008-12-31 16:55:26 +000083elif check_define __sparc__ ; then
84 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
85 # They must be specified using --sparc_cpu
86 if check_define __arch64__ ; then
87 cpu="sparc64"
88 else
89 cpu="sparc"
90 fi
malcfdf7ed92009-01-14 18:39:52 +000091elif check_define _ARCH_PPC ; then
92 if check_define _ARCH_PPC64 ; then
93 cpu="ppc64"
94 else
95 cpu="ppc"
96 fi
aliguoriac0df512008-12-29 17:14:15 +000097else
malcfdf7ed92009-01-14 18:39:52 +000098 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +000099fi
100
bellard5327cf42005-01-10 23:18:50 +0000101target_list=""
bellard7d132992003-03-06 23:23:54 +0000102case "$cpu" in
103 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000104 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000105 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000106 x86_64|amd64)
107 cpu="x86_64"
108 ;;
109 alpha)
110 cpu="alpha"
111 ;;
bellardba680552005-03-13 09:49:52 +0000112 armv*b)
bellard808c4952004-12-19 23:33:47 +0000113 cpu="armv4b"
114 ;;
bellardba680552005-03-13 09:49:52 +0000115 armv*l)
bellard7d132992003-03-06 23:23:54 +0000116 cpu="armv4l"
117 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000118 cris)
119 cpu="cris"
bellard7d132992003-03-06 23:23:54 +0000120 ;;
aurel32f54b3f92008-04-12 20:14:54 +0000121 parisc|parisc64)
122 cpu="hppa"
123 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000124 ia64)
125 cpu="ia64"
126 ;;
127 m68k)
128 cpu="m68k"
bellard7d132992003-03-06 23:23:54 +0000129 ;;
130 mips)
131 cpu="mips"
132 ;;
thsfbe4f652007-04-01 11:16:48 +0000133 mips64)
134 cpu="mips64"
135 ;;
malcfdf7ed92009-01-14 18:39:52 +0000136 ppc)
137 cpu="ppc"
138 ;;
139 ppc64)
140 cpu="ppc64"
thse7daa602007-10-08 13:38:27 +0000141 ;;
ths0e7b8a92007-08-01 00:09:31 +0000142 s390*)
bellardfb3e5842003-03-29 17:32:36 +0000143 cpu="s390"
144 ;;
blueswir131422552007-04-16 18:27:06 +0000145 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000146 cpu="sparc"
147 ;;
148 sparc64)
149 cpu="sparc64"
150 ;;
bellard7d132992003-03-06 23:23:54 +0000151 *)
152 cpu="unknown"
153 ;;
154esac
155gprof="no"
aurel32f8393942009-04-13 18:45:38 +0000156debug_tcg="no"
aliguori03b4fe72008-10-07 19:16:17 +0000157sparse="no"
aliguori1625af82009-04-05 17:41:02 +0000158strip_opt="yes"
bellard7d132992003-03-06 23:23:54 +0000159bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000160mingw32="no"
161EXESUF=""
162gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +0000163slirp="yes"
aliguorie0e6c8c02008-07-23 18:14:33 +0000164vde="yes"
bellard102a52e2004-11-14 19:57:29 +0000165fmod_lib=""
166fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000167oss_lib=""
ths8d5d2d42007-08-25 01:37:51 +0000168vnc_tls="yes"
aliguori2f9606b2009-03-06 20:27:28 +0000169vnc_sasl="yes"
pbrookb1a550a2006-04-16 13:28:56 +0000170bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000171linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000172solaris="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000173kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000174profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000175cocoa="no"
bellard97ccc682005-07-02 13:32:17 +0000176check_gfx="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000177softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000178linux_user="no"
179darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000180bsd_user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +0000181build_docs="no"
pbrookc5937222006-05-14 11:30:38 +0000182uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000183curses="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000184aio="yes"
pbrookbd0c5662008-05-29 14:34:11 +0000185nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000186mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000187bluez="yes"
aliguori7ba1e612008-11-05 16:04:33 +0000188kvm="yes"
aliguorieac30262008-11-05 16:28:56 +0000189kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000190aix="no"
ths77755342008-11-27 15:45:16 +0000191blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000192fdt="yes"
aliguori5368a422009-03-03 17:37:21 +0000193sdl_x11="no"
aliguorie37630c2009-04-22 15:19:10 +0000194xen="yes"
pbrook4a19f1e2009-04-07 23:17:49 +0000195pkgversion=""
bellard7d132992003-03-06 23:23:54 +0000196
197# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000198if check_define __linux__ ; then
199 targetos="Linux"
200elif check_define _WIN32 ; then
201 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000202elif check_define __OpenBSD__ ; then
203 targetos='OpenBSD'
204elif check_define __sun__ ; then
205 targetos='SunOS'
aliguoriac0df512008-12-29 17:14:15 +0000206else
207 targetos=`uname -s`
208fi
bellard7d132992003-03-06 23:23:54 +0000209case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000210CYGWIN*)
211mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000212OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000213if [ "$cpu" = "i386" ] ; then
214 kqemu="yes"
215fi
malcc2de5c92008-06-28 19:13:06 +0000216audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000217;;
bellard67b915a2004-03-31 23:37:16 +0000218MINGW32*)
219mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000220if [ "$cpu" = "i386" ] ; then
221 kqemu="yes"
222fi
malcc2de5c92008-06-28 19:13:06 +0000223audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000224;;
ths5c40d2b2007-06-23 16:03:36 +0000225GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000226audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000227audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000228if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
229 kqemu="yes"
230fi
231;;
bellard7d3505c2004-05-12 19:32:15 +0000232FreeBSD)
233bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000234audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000235audio_possible_drivers="oss sdl esd pa"
bellarde99f9062005-07-28 21:45:38 +0000236if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000237 kqemu="yes"
238fi
bellard7d3505c2004-05-12 19:32:15 +0000239;;
blueswir1c5e97232009-03-07 20:06:23 +0000240DragonFly)
241bsd="yes"
242audio_drv_list="oss"
243audio_possible_drivers="oss sdl esd pa"
244if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
245 kqemu="yes"
246fi
247aio="no"
248;;
bellard7d3505c2004-05-12 19:32:15 +0000249NetBSD)
250bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000251audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000252audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000253oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000254;;
255OpenBSD)
256bsd="yes"
blueswir1128ab2f2008-08-15 18:33:42 +0000257openbsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000258audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000259audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000260oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000261;;
bellard83fb7ad2004-07-05 21:25:26 +0000262Darwin)
263bsd="yes"
264darwin="yes"
aliguori1b0f9cc2009-01-26 15:37:40 +0000265# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code
malcaab85882009-02-23 14:11:10 +0000266if [ "$cpu" = "i386" ] ; then
267 is_x86_64=`sysctl -n hw.optional.x86_64`
268 [ "$is_x86_64" = "1" ] && cpu=x86_64
aliguori1b0f9cc2009-01-26 15:37:40 +0000269fi
270if [ "$cpu" = "x86_64" ] ; then
271 OS_CFLAGS="-arch x86_64"
272 LDFLAGS="-arch x86_64"
273else
274 OS_CFLAGS="-mdynamic-no-pic"
275fi
ths831b7822007-01-18 20:06:33 +0000276darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000277cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000278audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000279audio_possible_drivers="coreaudio sdl fmod"
thsc2c59c32008-01-08 00:00:20 +0000280OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
bellard83fb7ad2004-07-05 21:25:26 +0000281;;
bellardec530c82006-04-25 22:36:06 +0000282SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000283 solaris="yes"
284 make="gmake"
285 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000286 needs_libsunmath="no"
blueswir1acda94b2009-04-13 16:23:22 +0000287 kvm="no"
thsc2b84fa2007-02-10 23:21:21 +0000288 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000289 # have to select again, because `uname -m` returns i86pc
290 # even on an x86_64 box.
291 solariscpu=`isainfo -k`
292 if test "${solariscpu}" = "amd64" ; then
293 cpu="x86_64"
294 fi
thsc2b84fa2007-02-10 23:21:21 +0000295 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000296 if test "$solarisrev" -le 9 ; then
297 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
298 needs_libsunmath="yes"
299 else
300 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
301 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
302 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
303 echo "Studio 11 can be downloaded from www.sun.com."
304 exit 1
305 fi
306 fi
307 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000308 kqemu="yes"
309 fi
ths86b2bd92007-02-11 00:31:33 +0000310 fi
ths6b4d2ba2007-05-13 18:02:43 +0000311 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000312 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000313 fi
malcc2de5c92008-06-28 19:13:06 +0000314 audio_possible_drivers="oss sdl"
blueswir114d483e2009-04-13 16:27:08 +0000315 OS_CFLAGS=-std=gnu99
ths86b2bd92007-02-11 00:31:33 +0000316;;
malcb29fe3e2008-11-18 01:42:22 +0000317AIX)
318aix="yes"
319make="gmake"
320;;
bellard1d14ffa2005-10-30 18:58:22 +0000321*)
malc0c58ac12008-06-25 21:04:05 +0000322audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000323audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000324linux="yes"
ths831b7822007-01-18 20:06:33 +0000325linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000326usb="linux"
bellard07f4ddb2005-04-23 17:44:28 +0000327if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000328 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000329 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000330fi
bellardfb065182004-11-09 23:09:44 +0000331;;
bellard7d132992003-03-06 23:23:54 +0000332esac
333
bellard7d3505c2004-05-12 19:32:15 +0000334if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000335 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000336 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000337 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000338 fi
blueswir184778502008-10-26 20:33:16 +0000339 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000340fi
341
bellard7d132992003-03-06 23:23:54 +0000342# find source path
pbrookad064842006-04-16 12:41:07 +0000343source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000344source_path_used="no"
345workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000346if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000347 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000348else
349 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000350fi
pbrook724db112008-02-03 19:20:13 +0000351[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000352
bellard85aa5182007-11-11 20:17:03 +0000353werror="no"
bellard0d1e2392007-11-11 20:24:30 +0000354# generate compile errors on warnings for development builds
355#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
356#werror="yes";
357#fi
bellard85aa5182007-11-11 20:17:03 +0000358
bellard7d132992003-03-06 23:23:54 +0000359for opt do
pbrooka46e4032006-04-29 23:05:22 +0000360 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000361 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000362 --help|-h) show_help=yes
363 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000364 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000365 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000366 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000367 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000368 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000369 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000370 ;;
aliguoriac0df512008-12-29 17:14:15 +0000371 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000372 ;;
aliguoriac0df512008-12-29 17:14:15 +0000373 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000374 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000375 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000376 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000377 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000378 ;;
pbrook6a882642006-04-17 13:57:12 +0000379 --install=*) install="$optarg"
380 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000381 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000382 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000383 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000384 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000385 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000386 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000387 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000388 ;;
bellard7d132992003-03-06 23:23:54 +0000389 --enable-gprof) gprof="yes"
390 ;;
bellard43ce4df2003-06-09 19:53:12 +0000391 --static) static="yes"
392 ;;
bellard97a847b2003-08-10 21:36:04 +0000393 --disable-sdl) sdl="no"
394 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000395 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000396 ;;
malcc2de5c92008-06-28 19:13:06 +0000397 --fmod-inc=*) fmod_inc="$optarg"
398 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000399 --oss-lib=*) oss_lib="$optarg"
400 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000401 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000402 ;;
403 --audio-drv-list=*) audio_drv_list="$optarg"
404 ;;
aurel32f8393942009-04-13 18:45:38 +0000405 --enable-debug-tcg) debug_tcg="yes"
406 ;;
407 --disable-debug-tcg) debug_tcg="no"
408 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000409 --enable-sparse) sparse="yes"
410 ;;
411 --disable-sparse) sparse="no"
412 ;;
aliguori1625af82009-04-05 17:41:02 +0000413 --disable-strip) strip_opt="no"
414 ;;
ths8d5d2d42007-08-25 01:37:51 +0000415 --disable-vnc-tls) vnc_tls="no"
416 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000417 --disable-vnc-sasl) vnc_sasl="no"
418 ;;
bellard443f1372004-06-04 11:13:20 +0000419 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000420 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000421 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000422 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000423 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000424 ;;
aliguorie37630c2009-04-22 15:19:10 +0000425 --disable-xen) xen="no"
426 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000427 --disable-brlapi) brlapi="no"
428 ;;
balrogfb599c92008-09-28 23:49:55 +0000429 --disable-bluez) bluez="no"
430 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000431 --disable-kvm) kvm="no"
432 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000433 --enable-profiler) profiler="yes"
434 ;;
malcc2de5c92008-06-28 19:13:06 +0000435 --enable-cocoa)
436 cocoa="yes" ;
437 sdl="no" ;
438 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000439 ;;
bellard97ccc682005-07-02 13:32:17 +0000440 --disable-gfx-check) check_gfx="no"
441 ;;
pbrookcad25d62006-03-19 16:31:11 +0000442 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000443 ;;
pbrookcad25d62006-03-19 16:31:11 +0000444 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000445 ;;
ths831b7822007-01-18 20:06:33 +0000446 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000447 ;;
ths831b7822007-01-18 20:06:33 +0000448 --enable-linux-user) linux_user="yes"
449 ;;
450 --disable-darwin-user) darwin_user="no"
451 ;;
452 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000453 ;;
blueswir184778502008-10-26 20:33:16 +0000454 --disable-bsd-user) bsd_user="no"
455 ;;
456 --enable-bsd-user) bsd_user="yes"
457 ;;
pbrookc5937222006-05-14 11:30:38 +0000458 --enable-uname-release=*) uname_release="$optarg"
459 ;;
blueswir131422552007-04-16 18:27:06 +0000460 --sparc_cpu=*)
461 sparc_cpu="$optarg"
462 case $sparc_cpu in
463 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
464 target_cpu="sparc"; cpu="sparc" ;;
465 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
466 target_cpu="sparc"; cpu="sparc" ;;
467 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
468 target_cpu="sparc64"; cpu="sparc64" ;;
469 *) echo "undefined SPARC architecture. Exiting";exit 1;;
470 esac
471 ;;
bellard85aa5182007-11-11 20:17:03 +0000472 --enable-werror) werror="yes"
473 ;;
474 --disable-werror) werror="no"
475 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000476 --disable-curses) curses="no"
477 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000478 --disable-nptl) nptl="no"
479 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000480 --enable-mixemu) mixemu="yes"
481 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000482 --disable-aio) aio="no"
483 ;;
ths77755342008-11-27 15:45:16 +0000484 --disable-blobs) blobs="no"
485 ;;
aliguorieac30262008-11-05 16:28:56 +0000486 --kerneldir=*) kerneldir="$optarg"
487 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000488 --with-pkgversion=*) pkgversion=" ($optarg)"
489 ;;
balrog7f1559c2007-11-17 10:24:32 +0000490 *) echo "ERROR: unknown option $opt"; show_help="yes"
491 ;;
bellard7d132992003-03-06 23:23:54 +0000492 esac
493done
494
ths6f30fa82007-01-05 01:00:47 +0000495# default flags for all hosts
blueswir1ac41a622008-09-14 06:46:31 +0000496CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
blueswir1e0e36fe2008-12-07 19:16:27 +0000497CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000498LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000499if test "$werror" = "yes" ; then
500CFLAGS="$CFLAGS -Werror"
501fi
ths6f30fa82007-01-05 01:00:47 +0000502
blueswir1d2c7c9b2008-11-01 14:50:20 +0000503if test "$solaris" = "no" ; then
504 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
505 LDFLAGS="$LDFLAGS -Wl,--warn-common"
506 fi
blueswir149237ac2008-09-17 19:05:19 +0000507fi
508
blueswir131422552007-04-16 18:27:06 +0000509#
510# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
511# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
512#
bellard40293e52008-01-31 11:32:10 +0000513case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000514 sparc) if test -z "$sparc_cpu" ; then
515 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
516 ARCH_LDFLAGS="-m32"
517 else
518 ARCH_CFLAGS="${SP_CFLAGS}"
519 ARCH_LDFLAGS="${SP_LDFLAGS}"
520 fi
blueswir1762e8232009-04-04 09:21:28 +0000521 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
522 if test "$solaris" = "no" ; then
523 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
524 fi
blueswir131422552007-04-16 18:27:06 +0000525 ;;
526 sparc64) if test -z "$sparc_cpu" ; then
527 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
528 ARCH_LDFLAGS="-m64"
529 else
530 ARCH_CFLAGS="${SP_CFLAGS}"
531 ARCH_LDFLAGS="${SP_LDFLAGS}"
532 fi
blueswir1762e8232009-04-04 09:21:28 +0000533 if test "$solaris" = "no" ; then
534 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
535 else
536 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
537 fi
blueswir131422552007-04-16 18:27:06 +0000538 ;;
ths76d83bd2007-11-18 21:22:10 +0000539 s390)
540 ARCH_CFLAGS="-march=z900"
541 ;;
bellard40293e52008-01-31 11:32:10 +0000542 i386)
543 ARCH_CFLAGS="-m32"
544 ARCH_LDFLAGS="-m32"
545 ;;
546 x86_64)
547 ARCH_CFLAGS="-m64"
548 ARCH_LDFLAGS="-m64"
549 ;;
blueswir131422552007-04-16 18:27:06 +0000550esac
551
pbrookaf5db582006-04-08 14:26:41 +0000552if test x"$show_help" = x"yes" ; then
553cat << EOF
554
555Usage: configure [options]
556Options: [defaults in brackets after descriptions]
557
558EOF
559echo "Standard options:"
560echo " --help print this message"
561echo " --prefix=PREFIX install in PREFIX [$prefix]"
562echo " --interp-prefix=PREFIX where to find shared libraries, etc."
563echo " use %M for cpu name [$interp_prefix]"
564echo " --target-list=LIST set target list [$target_list]"
565echo ""
566echo "kqemu kernel acceleration support:"
567echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000568echo ""
569echo "Advanced options (experts only):"
570echo " --source-path=PATH path of source code [$source_path]"
571echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
572echo " --cc=CC use C compiler CC [$cc]"
573echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
aurel322981fa92009-04-07 19:57:17 +0000574echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
575echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000576echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000577echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000578echo " --static enable static build [$static]"
aurel32f8393942009-04-13 18:45:38 +0000579echo " --enable-debug-tcg enable TCG debugging"
580echo " --disable-debug-tcg disable TCG debugging (default)"
aliguori890b1652008-10-07 21:22:41 +0000581echo " --enable-sparse enable sparse checker"
582echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000583echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000584echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000585echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000586echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000587echo " --audio-drv-list=LIST set audio drivers list:"
588echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000589echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
590echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000591echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000592echo " --disable-xen disable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000593echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000594echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000595echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000596echo " --disable-curses disable curses output"
balrogfb599c92008-09-28 23:49:55 +0000597echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000598echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000599echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000600echo " --enable-system enable all system emulation targets"
601echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000602echo " --enable-linux-user enable all linux usermode emulation targets"
603echo " --disable-linux-user disable all linux usermode emulation targets"
604echo " --enable-darwin-user enable all darwin usermode emulation targets"
605echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000606echo " --enable-bsd-user enable all BSD usermode emulation targets"
607echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000608echo " --fmod-lib path to FMOD library"
609echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000610echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000611echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000612echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000613echo " --disable-vde disable support for vde network"
blueswir1414f0da2008-08-15 18:20:52 +0000614echo " --disable-aio disable AIO support"
ths77755342008-11-27 15:45:16 +0000615echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000616echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000617echo ""
ths5bf08932006-12-23 00:33:26 +0000618echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000619exit 1
620fi
621
bellard67b915a2004-03-31 23:37:16 +0000622if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000623 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000624 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000625 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000626 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000627 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000628 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000629fi
630
aliguori03b4fe72008-10-07 19:16:17 +0000631if test ! -x "$(which cgcc 2>/dev/null)"; then
632 sparse="no"
633fi
634
bellardec530c82006-04-25 22:36:06 +0000635#
636# Solaris specific configure tool chain decisions
637#
638if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000639 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
640 if test -z "$solinst" ; then
641 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
642 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
643 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
644 exit 1
645 fi
646 if test "$solinst" = "/usr/sbin/install" ; then
647 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
648 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
649 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
650 exit 1
651 fi
bellardec530c82006-04-25 22:36:06 +0000652 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
653 if test -z "$sol_ar" ; then
654 echo "Error: No path includes ar"
655 if test -f /usr/ccs/bin/ar ; then
656 echo "Add /usr/ccs/bin to your path and rerun configure"
657 fi
658 exit 1
659 fi
ths5fafdf22007-09-16 21:08:06 +0000660fi
bellardec530c82006-04-25 22:36:06 +0000661
662
bellard5327cf42005-01-10 23:18:50 +0000663if test -z "$target_list" ; then
664# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000665 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000666 target_list="\
667i386-softmmu \
668x86_64-softmmu \
669arm-softmmu \
670cris-softmmu \
671m68k-softmmu \
672mips-softmmu \
673mipsel-softmmu \
674mips64-softmmu \
675mips64el-softmmu \
676ppc-softmmu \
677ppcemb-softmmu \
678ppc64-softmmu \
679sh4-softmmu \
680sh4eb-softmmu \
681sparc-softmmu \
682"
pbrook0a8e90f2006-03-19 14:54:16 +0000683 fi
bellard5327cf42005-01-10 23:18:50 +0000684# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000685 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000686 target_list="${target_list}\
687i386-linux-user \
688x86_64-linux-user \
689alpha-linux-user \
690arm-linux-user \
691armeb-linux-user \
692cris-linux-user \
693m68k-linux-user \
694mips-linux-user \
695mipsel-linux-user \
696ppc-linux-user \
697ppc64-linux-user \
698ppc64abi32-linux-user \
699sh4-linux-user \
700sh4eb-linux-user \
701sparc-linux-user \
702sparc64-linux-user \
703sparc32plus-linux-user \
704"
ths831b7822007-01-18 20:06:33 +0000705 fi
706# the following are Darwin specific
707 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000708 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000709 fi
blueswir184778502008-10-26 20:33:16 +0000710# the following are BSD specific
711 if [ "$bsd_user" = "yes" ] ; then
712 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000713i386-bsd-user \
714x86_64-bsd-user \
715sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000716sparc64-bsd-user \
717"
718 fi
bellard6e20a452005-06-05 15:56:02 +0000719else
pbrookb1a550a2006-04-16 13:28:56 +0000720 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000721fi
pbrook0a8e90f2006-03-19 14:54:16 +0000722if test -z "$target_list" ; then
723 echo "No targets enabled"
724 exit 1
725fi
bellard5327cf42005-01-10 23:18:50 +0000726
bellard7d132992003-03-06 23:23:54 +0000727if test -z "$cross_prefix" ; then
728
729# ---
730# big/little endian test
731cat > $TMPC << EOF
732#include <inttypes.h>
733int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000734 volatile uint32_t i=0x01234567;
735 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000736}
737EOF
738
aurel32178baee2008-12-08 18:11:57 +0000739if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000740$TMPE && bigendian="yes"
741else
742echo big/little test failed
743fi
744
745else
746
747# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000748if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000749 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000750 -o "$cpu" = "m68k" \
751 -o "$cpu" = "mips" \
752 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000753 -o "$cpu" = "ppc" \
754 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000755 -o "$cpu" = "s390" \
756 -o "$cpu" = "sparc" \
757 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000758 bigendian="yes"
759fi
760
761fi
762
bellardb6853692005-06-05 17:10:39 +0000763# host long bits test
764hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000765if test "$cpu" = "x86_64" \
766 -o "$cpu" = "alpha" \
767 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000768 -o "$cpu" = "sparc64" \
769 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000770 hostlongbits="64"
771fi
772
pbrookbd0c5662008-05-29 14:34:11 +0000773# Check host NPTL support
774cat > $TMPC <<EOF
775#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000776#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000777void foo()
778{
779#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
780#error bork
781#endif
782}
783EOF
784
balrog8c7f7572008-12-15 03:15:36 +0000785if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000786 :
787else
788 nptl="no"
789fi
790
bellard11d9f692004-04-02 20:55:59 +0000791##########################################
balrogac629222008-10-11 09:56:04 +0000792# zlib check
793
794cat > $TMPC << EOF
795#include <zlib.h>
796int main(void) { zlibVersion(); return 0; }
797EOF
balrog8c7f7572008-12-15 03:15:36 +0000798if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000799 :
800else
801 echo
802 echo "Error: zlib check failed"
803 echo "Make sure to have the zlib libs and headers installed."
804 echo
805 exit 1
806fi
807
808##########################################
aliguorie37630c2009-04-22 15:19:10 +0000809# xen probe
810
811if test "$xen" = "yes" ; then
812cat > $TMPC <<EOF
813#include <xenctrl.h>
814#include <xs.h>
815int main(void) { xs_daemon_open; xc_interface_open; }
816EOF
817 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null ; then
818 :
819 else
820 xen="no"
821 fi
822fi
823
824##########################################
bellard11d9f692004-04-02 20:55:59 +0000825# SDL probe
826
827sdl_too_old=no
828
829if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000830 sdl_config="sdl-config"
831 sdl=no
832 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000833
834cat > $TMPC << EOF
835#include <SDL.h>
836#undef main /* We don't want SDL to override our main() */
837int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
838EOF
balrog8c7f7572008-12-15 03:15:36 +0000839 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
aliguoricd01b4a2008-08-21 19:25:45 +0000840 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
841 if test "$_sdlversion" -lt 121 ; then
842 sdl_too_old=yes
843 else
844 if test "$cocoa" = "no" ; then
845 sdl=yes
846 fi
847 fi
848
849 # static link with sdl ?
850 if test "$sdl" = "yes" ; then
851 aa="no"
852 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
853 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
854 if [ "$aa" = "yes" ] ; then
855 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000856 fi
bellard11d9f692004-04-02 20:55:59 +0000857
balrog8c7f7572008-12-15 03:15:36 +0000858 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
aliguoricd01b4a2008-08-21 19:25:45 +0000859 sdl_static=yes
860 fi
861 fi # static link
862 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000863else
ths069b0bd2007-07-12 00:27:15 +0000864 # Make sure to disable cocoa if sdl was set
865 if test "$sdl" = "yes" ; then
866 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000867 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000868 fi
bellarda6e022a2004-04-02 21:55:47 +0000869fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000870
aliguori5368a422009-03-03 17:37:21 +0000871if test "$sdl" = "yes" ; then
872cat > $TMPC <<EOF
873#include <SDL.h>
874#if defined(SDL_VIDEO_DRIVER_X11)
875#include <X11/XKBlib.h>
876#else
877#error No x11 support
878#endif
879int main(void) { return 0; }
880EOF
881 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then
882 sdl_x11="yes"
883 fi
884fi
885
ths8f28f3f2007-01-05 21:25:54 +0000886##########################################
ths8d5d2d42007-08-25 01:37:51 +0000887# VNC TLS detection
888if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000889cat > $TMPC <<EOF
890#include <gnutls/gnutls.h>
891int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
892EOF
893 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
894 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
895 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000896 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000897 :
898 else
899 vnc_tls="no"
900 fi
ths8d5d2d42007-08-25 01:37:51 +0000901fi
902
903##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000904# VNC SASL detection
905if test "$vnc_sasl" = "yes" ; then
906cat > $TMPC <<EOF
907#include <sasl/sasl.h>
908#include <stdio.h>
909int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
910EOF
911 # Assuming Cyrus-SASL installed in /usr prefix
912 vnc_sasl_cflags=""
913 vnc_sasl_libs="-lsasl2"
914 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
915 $vnc_sasl_libs 2> /dev/null ; then
916 :
917 else
918 vnc_sasl="no"
919 fi
920fi
921
922##########################################
aliguori76655d62009-03-06 20:27:37 +0000923# fnmatch() probe, used for ACL routines
924fnmatch="no"
925cat > $TMPC << EOF
926#include <fnmatch.h>
927int main(void)
928{
929 fnmatch("foo", "foo", 0);
930 return 0;
931}
932EOF
933if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
934 fnmatch="yes"
935fi
936
937##########################################
ths8a16d272008-07-19 09:56:24 +0000938# vde libraries probe
939if test "$vde" = "yes" ; then
940 cat > $TMPC << EOF
941#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000942int main(void)
943{
944 struct vde_open_args a = {0, 0, 0};
945 vde_open("", "", &a);
946 return 0;
947}
ths8a16d272008-07-19 09:56:24 +0000948EOF
balrog8c7f7572008-12-15 03:15:36 +0000949 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000950 :
951 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000952 vde="no"
ths8a16d272008-07-19 09:56:24 +0000953 fi
954fi
955
956##########################################
malcc2de5c92008-06-28 19:13:06 +0000957# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000958
malcc2de5c92008-06-28 19:13:06 +0000959audio_drv_probe()
960{
961 drv=$1
962 hdr=$2
963 lib=$3
964 exp=$4
965 cfl=$5
966 cat > $TMPC << EOF
967#include <$hdr>
968int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000969EOF
balrog8c7f7572008-12-15 03:15:36 +0000970 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000971 :
972 else
973 echo
974 echo "Error: $drv check failed"
975 echo "Make sure to have the $drv libs and headers installed."
976 echo
977 exit 1
978 fi
979}
980
malc2fa7d3b2008-07-29 12:58:44 +0000981audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000982for drv in $audio_drv_list; do
983 case $drv in
984 alsa)
985 audio_drv_probe $drv alsa/asoundlib.h -lasound \
986 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
987 ;;
988
989 fmod)
990 if test -z $fmod_lib || test -z $fmod_inc; then
991 echo
992 echo "Error: You must specify path to FMOD library and headers"
993 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
994 echo
995 exit 1
996 fi
997 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
998 ;;
999
1000 esd)
1001 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1002 ;;
malcb8e59f12008-07-02 21:03:08 +00001003
1004 pa)
1005 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1006 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1007 ;;
1008
blueswir12f6a1ab2008-08-21 18:00:53 +00001009 oss|sdl|core|wav|dsound)
1010 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1011 ;;
1012
malce4c63a62008-07-19 16:15:16 +00001013 *)
malc1c9b2a52008-07-19 16:57:30 +00001014 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001015 echo
1016 echo "Error: Unknown driver '$drv' selected"
1017 echo "Possible drivers are: $audio_possible_drivers"
1018 echo
1019 exit 1
1020 }
1021 ;;
malcc2de5c92008-06-28 19:13:06 +00001022 esac
1023done
ths8f28f3f2007-01-05 21:25:54 +00001024
balrog4d3b6f62008-02-10 16:33:14 +00001025##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001026# BrlAPI probe
1027
1028if test -z "$brlapi" ; then
1029 brlapi=no
1030cat > $TMPC << EOF
1031#include <brlapi.h>
1032int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1033EOF
aurel32178baee2008-12-08 18:11:57 +00001034 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +00001035 brlapi=yes
1036 fi # brlapi compile test
1037fi # -z $brlapi
1038
1039##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001040# curses probe
1041
1042if test "$curses" = "yes" ; then
1043 curses=no
1044 cat > $TMPC << EOF
1045#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001046#ifdef __OpenBSD__
1047#define resize_term resizeterm
1048#endif
1049int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001050EOF
aurel32178baee2008-12-08 18:11:57 +00001051 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001052 curses=yes
1053 fi
1054fi # test "$curses"
1055
blueswir1414f0da2008-08-15 18:20:52 +00001056##########################################
balrogfb599c92008-09-28 23:49:55 +00001057# bluez support probe
1058if test "$bluez" = "yes" ; then
1059 `pkg-config bluez` || bluez="no"
1060fi
1061if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001062 cat > $TMPC << EOF
1063#include <bluetooth/bluetooth.h>
1064int main(void) { return bt_error(0); }
1065EOF
balrogfb599c92008-09-28 23:49:55 +00001066 bluez_cflags=`pkg-config --cflags bluez`
1067 bluez_libs=`pkg-config --libs bluez`
balrog17e15922008-10-11 12:00:42 +00001068 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001069 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001070 :
1071 else
1072 bluez="no"
1073 fi
balrogfb599c92008-09-28 23:49:55 +00001074fi
1075
1076##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001077# kvm probe
1078if test "$kvm" = "yes" ; then
1079 cat > $TMPC <<EOF
1080#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001081#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001082#error Invalid KVM version
1083#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001084#if !defined(KVM_CAP_USER_MEMORY)
1085#error Missing KVM capability KVM_CAP_USER_MEMORY
1086#endif
1087#if !defined(KVM_CAP_SET_TSS_ADDR)
1088#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1089#endif
1090#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1091#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1092#endif
aliguori7ba1e612008-11-05 16:04:33 +00001093int main(void) { return 0; }
1094EOF
aliguorieac30262008-11-05 16:28:56 +00001095 if test "$kerneldir" != "" ; then
1096 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001097 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1098 -a -d "$kerneldir/arch/x86/include" ; then
1099 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001100 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1101 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001102 elif test -d "$kerneldir/arch/$cpu/include" ; then
1103 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1104 fi
aliguorieac30262008-11-05 16:28:56 +00001105 else
1106 kvm_cflags=""
1107 fi
aliguori7ba1e612008-11-05 16:04:33 +00001108 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001109 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001110 :
1111 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001112 kvm="no";
1113 if [ -x "`which awk 2>/dev/null`" ] && \
1114 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001115 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001116 | grep "error: " \
1117 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1118 if test "$kvmerr" != "" ; then
1119 kvm="no - (${kvmerr})"
1120 fi
1121 fi
aliguori7ba1e612008-11-05 16:04:33 +00001122 fi
1123fi
1124
1125##########################################
blueswir1414f0da2008-08-15 18:20:52 +00001126# AIO probe
aliguori3c529d92008-12-12 16:41:40 +00001127AIOLIBS=""
1128
blueswir1414f0da2008-08-15 18:20:52 +00001129if test "$aio" = "yes" ; then
1130 aio=no
1131 cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001132#include <pthread.h>
blueswir1c9db92f2009-01-17 06:49:15 +00001133int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001134EOF
1135 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1136 aio=yes
aliguori3c529d92008-12-12 16:41:40 +00001137 AIOLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +00001138 fi
1139fi
1140
aliguoribf9298b2008-12-05 20:05:26 +00001141##########################################
1142# iovec probe
1143cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001144#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001145#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001146#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001147int main(void) { struct iovec iov; return 0; }
1148EOF
1149iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001150if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001151 iovec=yes
1152fi
1153
aurel32f652e6a2008-12-16 10:43:48 +00001154##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001155# preadv probe
1156cat > $TMPC <<EOF
1157#include <sys/types.h>
1158#include <sys/uio.h>
1159#include <unistd.h>
1160int main(void) { preadv; }
1161EOF
1162preadv=no
1163if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1164 preadv=yes
1165fi
1166
1167##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001168# fdt probe
1169if test "$fdt" = "yes" ; then
1170 fdt=no
1171 cat > $TMPC << EOF
1172int main(void) { return 0; }
1173EOF
1174 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1175 fdt=yes
1176 fi
1177fi
1178
aurel323b3f24a2009-04-15 16:12:13 +00001179#
1180# Check for xxxat() functions when we are building linux-user
1181# emulator. This is done because older glibc versions don't
1182# have syscall stubs for these implemented.
1183#
1184atfile=no
1185if [ "$linux_user" = "yes" ] ; then
1186 cat > $TMPC << EOF
1187#define _ATFILE_SOURCE
1188#include <sys/types.h>
1189#include <fcntl.h>
1190#include <unistd.h>
1191
1192int
1193main(void)
1194{
1195 /* try to unlink nonexisting file */
1196 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1197}
1198EOF
1199 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1200 atfile=yes
1201 fi
1202fi
1203
aurel3239386ac2009-04-15 19:48:17 +00001204# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001205# emulator. This is done because older glibc versions don't
1206# have syscall stubs for these implemented. In that case we
1207# don't provide them even if kernel supports them.
1208#
1209inotify=no
1210if [ "$linux_user" = "yes" ] ; then
1211 cat > $TMPC << EOF
1212#include <sys/inotify.h>
1213
1214int
1215main(void)
1216{
1217 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001218 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001219}
1220EOF
1221 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1222 inotify=yes
1223 fi
1224fi
1225
pbrookcc8ae6d2006-04-23 17:57:59 +00001226# Check if tools are available to build documentation.
ths6c591862007-05-09 13:55:03 +00001227if [ -x "`which texi2html 2>/dev/null`" ] && \
1228 [ -x "`which pod2man 2>/dev/null`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +00001229 build_docs="yes"
1230fi
1231
aliguorida93a1f2008-12-12 20:02:52 +00001232##########################################
1233# Do we need librt
1234cat > $TMPC <<EOF
1235#include <signal.h>
1236#include <time.h>
1237int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1238EOF
1239
1240rt=no
balrog8c7f7572008-12-15 03:15:36 +00001241if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001242 :
balrog8c7f7572008-12-15 03:15:36 +00001243elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001244 rt=yes
1245fi
1246
1247if test "$rt" = "yes" ; then
1248 # Hack, we should have a general purpose LIBS for this sort of thing
1249 AIOLIBS="$AIOLIBS -lrt"
1250fi
1251
bellard11d9f692004-04-02 20:55:59 +00001252if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001253 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001254 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001255 fi
1256 mansuffix=""
1257 datasuffix=""
1258 docsuffix=""
1259 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001260else
pbrook308c3592007-02-27 00:52:01 +00001261 if test -z "$prefix" ; then
1262 prefix="/usr/local"
1263 fi
1264 mansuffix="/share/man"
1265 datasuffix="/share/qemu"
1266 docsuffix="/share/doc/qemu"
1267 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001268fi
bellard5a671352003-10-01 00:13:48 +00001269
bellard43ce4df2003-06-09 19:53:12 +00001270echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001271echo "BIOS directory $prefix$datasuffix"
1272echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001273if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001274echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001275echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001276fi
bellard5a671352003-10-01 00:13:48 +00001277echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001278echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001279echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001280echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001281echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001282echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001283echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001284echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001285echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00001286echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00001287echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001288echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001289echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001290echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001291echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001292echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001293if test "$darwin" = "yes" ; then
1294 echo "Cocoa support $cocoa"
1295fi
bellard97a847b2003-08-10 21:36:04 +00001296echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001297if test "$sdl" != "no" ; then
1298 echo "SDL static link $sdl_static"
1299fi
balrog4d3b6f62008-02-10 16:33:14 +00001300echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001301echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001302echo "Audio drivers $audio_drv_list"
1303echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001304echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001305echo "VNC TLS support $vnc_tls"
1306if test "$vnc_tls" = "yes" ; then
1307 echo " TLS CFLAGS $vnc_tls_cflags"
1308 echo " TLS LIBS $vnc_tls_libs"
1309fi
aliguori2f9606b2009-03-06 20:27:28 +00001310echo "VNC SASL support $vnc_sasl"
1311if test "$vnc_sasl" = "yes" ; then
1312 echo " SASL CFLAGS $vnc_sasl_cflags"
1313 echo " SASL LIBS $vnc_sasl_libs"
1314fi
blueswir131422552007-04-16 18:27:06 +00001315if test -n "$sparc_cpu"; then
1316 echo "Target Sparc Arch $sparc_cpu"
1317fi
bellard07f4ddb2005-04-23 17:44:28 +00001318echo "kqemu support $kqemu"
aliguorie37630c2009-04-22 15:19:10 +00001319echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00001320echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001321echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001322[ ! -z "$uname_release" ] && \
1323echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001324echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001325echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001326echo "AIO support $aio"
ths77755342008-11-27 15:45:16 +00001327echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001328echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001329echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001330echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001331
bellard97a847b2003-08-10 21:36:04 +00001332if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001333echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001334fi
malcd4742de2008-11-29 22:04:31 +00001335if [ -s $TMPSDLLOG ]; then
ths20b40c62007-07-11 23:39:45 +00001336 echo "The error log from compiling the libSDL test is: "
malcd4742de2008-11-29 22:04:31 +00001337 cat $TMPSDLLOG
ths20b40c62007-07-11 23:39:45 +00001338fi
bellard24b55b92005-03-01 22:30:41 +00001339#if test "$sdl_static" = "no"; then
1340# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1341#fi
bellard97a847b2003-08-10 21:36:04 +00001342config_mak="config-host.mak"
1343config_h="config-host.h"
1344
bellard7c1f25b2004-04-22 00:02:08 +00001345#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001346
ths15d9ca02007-07-31 23:07:32 +00001347test -f $config_h && mv $config_h ${config_h}~
1348
bellard97a847b2003-08-10 21:36:04 +00001349echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001350printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001351printf " '%s'" "$0" "$@" >> $config_mak
1352echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001353echo "/* Automatically generated by configure - do not modify */" > $config_h
1354
1355echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001356echo "bindir=\${prefix}$binsuffix" >> $config_mak
1357echo "mandir=\${prefix}$mansuffix" >> $config_mak
1358echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001359echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001360echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001361echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001362echo "INSTALL=$install" >> $config_mak
aliguori58f8aea2009-04-18 15:36:02 +00001363echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1364echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1365echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001366echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001367echo "HOST_CC=$host_cc" >> $config_mak
1368echo "AR=$ar" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001369# XXX: only use CFLAGS and LDFLAGS ?
1370# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1371# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001372echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001373echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1374echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1375echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001376echo "CFLAGS=$CFLAGS" >> $config_mak
1377echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001378echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +00001379echo "AIOLIBS=$AIOLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001380case "$cpu" in
1381 i386)
1382 echo "ARCH=i386" >> $config_mak
1383 echo "#define HOST_I386 1" >> $config_h
1384 ;;
1385 x86_64)
1386 echo "ARCH=x86_64" >> $config_mak
1387 echo "#define HOST_X86_64 1" >> $config_h
1388 ;;
1389 alpha)
1390 echo "ARCH=alpha" >> $config_mak
1391 echo "#define HOST_ALPHA 1" >> $config_h
1392 ;;
1393 armv4b)
1394 echo "ARCH=arm" >> $config_mak
1395 echo "#define HOST_ARM 1" >> $config_h
1396 ;;
1397 armv4l)
1398 echo "ARCH=arm" >> $config_mak
1399 echo "#define HOST_ARM 1" >> $config_h
1400 ;;
1401 cris)
1402 echo "ARCH=cris" >> $config_mak
1403 echo "#define HOST_CRIS 1" >> $config_h
1404 ;;
1405 hppa)
1406 echo "ARCH=hppa" >> $config_mak
1407 echo "#define HOST_HPPA 1" >> $config_h
1408 ;;
1409 ia64)
1410 echo "ARCH=ia64" >> $config_mak
1411 echo "#define HOST_IA64 1" >> $config_h
1412 ;;
1413 m68k)
1414 echo "ARCH=m68k" >> $config_mak
1415 echo "#define HOST_M68K 1" >> $config_h
1416 ;;
1417 mips)
1418 echo "ARCH=mips" >> $config_mak
1419 echo "#define HOST_MIPS 1" >> $config_h
1420 ;;
1421 mips64)
1422 echo "ARCH=mips64" >> $config_mak
1423 echo "#define HOST_MIPS64 1" >> $config_h
1424 ;;
malcfdf7ed92009-01-14 18:39:52 +00001425 ppc)
1426 echo "ARCH=ppc" >> $config_mak
1427 echo "#define HOST_PPC 1" >> $config_h
1428 ;;
1429 ppc64)
1430 echo "ARCH=ppc64" >> $config_mak
1431 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001432 ;;
1433 s390)
1434 echo "ARCH=s390" >> $config_mak
1435 echo "#define HOST_S390 1" >> $config_h
1436 ;;
1437 sparc)
1438 echo "ARCH=sparc" >> $config_mak
1439 echo "#define HOST_SPARC 1" >> $config_h
1440 ;;
1441 sparc64)
1442 echo "ARCH=sparc64" >> $config_mak
1443 echo "#define HOST_SPARC64 1" >> $config_h
1444 ;;
1445 *)
1446 echo "Unsupported CPU = $cpu"
1447 exit 1
1448 ;;
1449esac
aurel32f8393942009-04-13 18:45:38 +00001450if test "$debug_tcg" = "yes" ; then
1451 echo "#define DEBUG_TCG 1" >> $config_h
1452fi
aliguori03b4fe72008-10-07 19:16:17 +00001453if test "$sparse" = "yes" ; then
1454 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1455 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1456 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1457fi
aliguori1625af82009-04-05 17:41:02 +00001458if test "$strip_opt" = "yes" ; then
1459 echo "STRIP_OPT=-s" >> $config_mak
1460fi
bellard7d132992003-03-06 23:23:54 +00001461if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001462 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1463 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1464fi
bellardb6853692005-06-05 17:10:39 +00001465echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001466if test "$mingw32" = "yes" ; then
1467 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001468 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001469else
1470 cat > $TMPC << EOF
1471#include <byteswap.h>
1472int main(void) { return bswap_32(0); }
1473EOF
aurel32178baee2008-12-08 18:11:57 +00001474 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001475 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1476 fi
blueswir113606772008-12-05 17:54:09 +00001477 cat > $TMPC << EOF
1478#include <sys/endian.h>
1479#include <sys/types.h>
1480#include <machine/bswap.h>
1481int main(void) { return bswap32(0); }
1482EOF
aurel32178baee2008-12-08 18:11:57 +00001483 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001484 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1485 fi
bellard67b915a2004-03-31 23:37:16 +00001486fi
blueswir1128ab2f2008-08-15 18:33:42 +00001487
1488if [ "$openbsd" = "yes" ] ; then
1489 echo "#define ENOTSUP 4096" >> $config_h
1490fi
1491
bellard83fb7ad2004-07-05 21:25:26 +00001492if test "$darwin" = "yes" ; then
1493 echo "CONFIG_DARWIN=yes" >> $config_mak
1494 echo "#define CONFIG_DARWIN 1" >> $config_h
1495fi
malcb29fe3e2008-11-18 01:42:22 +00001496
1497if test "$aix" = "yes" ; then
1498 echo "CONFIG_AIX=yes" >> $config_mak
1499 echo "#define CONFIG_AIX 1" >> $config_h
1500fi
1501
bellardec530c82006-04-25 22:36:06 +00001502if test "$solaris" = "yes" ; then
1503 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001504 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001505 if test "$needs_libsunmath" = "yes" ; then
1506 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1507 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1508 fi
bellardec530c82006-04-25 22:36:06 +00001509fi
blueswir131422552007-04-16 18:27:06 +00001510if test -n "$sparc_cpu"; then
1511 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1512 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1513fi
bellard67b915a2004-03-31 23:37:16 +00001514if test "$gdbstub" = "yes" ; then
1515 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1516 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1517fi
bellard97a847b2003-08-10 21:36:04 +00001518if test "$gprof" = "yes" ; then
1519 echo "TARGET_GPROF=yes" >> $config_mak
1520 echo "#define HAVE_GPROF 1" >> $config_h
1521fi
1522if test "$static" = "yes" ; then
1523 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001524 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001525fi
bellard05c2a3e2006-02-08 22:39:17 +00001526if test $profiler = "yes" ; then
1527 echo "#define CONFIG_PROFILER 1" >> $config_h
1528fi
bellardc20709a2004-04-21 23:27:19 +00001529if test "$slirp" = "yes" ; then
1530 echo "CONFIG_SLIRP=yes" >> $config_mak
1531 echo "#define CONFIG_SLIRP 1" >> $config_h
1532fi
ths8a16d272008-07-19 09:56:24 +00001533if test "$vde" = "yes" ; then
1534 echo "CONFIG_VDE=yes" >> $config_mak
1535 echo "#define CONFIG_VDE 1" >> $config_h
1536 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1537fi
malc0c58ac12008-06-25 21:04:05 +00001538for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001539 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001540 echo "$def=yes" >> $config_mak
1541 echo "#define $def 1" >> $config_h
1542done
1543echo "#define AUDIO_DRIVERS \\" >> $config_h
1544for drv in $audio_drv_list; do
1545 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001546 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001547 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001548 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001549 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1550 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001551 elif test "$drv" = "oss"; then
1552 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001553 fi
1554done
1555echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001556if test "$mixemu" = "yes" ; then
1557 echo "CONFIG_MIXEMU=yes" >> $config_mak
1558 echo "#define CONFIG_MIXEMU 1" >> $config_h
1559fi
ths8d5d2d42007-08-25 01:37:51 +00001560if test "$vnc_tls" = "yes" ; then
1561 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1562 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1563 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1564 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1565fi
aliguori2f9606b2009-03-06 20:27:28 +00001566if test "$vnc_sasl" = "yes" ; then
1567 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1568 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1569 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1570 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1571fi
aliguori76655d62009-03-06 20:27:37 +00001572if test "$fnmatch" = "yes" ; then
1573 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1574fi
pbrookb1a550a2006-04-16 13:28:56 +00001575qemu_version=`head $source_path/VERSION`
1576echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001577echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001578
pbrook4a19f1e2009-04-07 23:17:49 +00001579echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1580
bellard97a847b2003-08-10 21:36:04 +00001581echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001582if [ "$source_path_used" = "yes" ]; then
1583 echo "VPATH=$source_path" >> $config_mak
1584fi
bellard97a847b2003-08-10 21:36:04 +00001585echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001586if [ "$build_docs" = "yes" ] ; then
1587 echo "BUILD_DOCS=yes" >> $config_mak
1588fi
bellard49ecc3f2007-11-07 19:25:15 +00001589if test "$static" = "yes"; then
1590 sdl1=$sdl_static
1591else
1592 sdl1=$sdl
1593fi
1594if test "$sdl1" = "yes" ; then
1595 echo "#define CONFIG_SDL 1" >> $config_h
1596 echo "CONFIG_SDL=yes" >> $config_mak
1597 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1598 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001599 elif test "$sdl_x11" = "yes" ; then
1600 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001601 else
1602 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1603 fi
1604 if [ "${aa}" = "yes" ] ; then
1605 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1606 else
1607 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1608 fi
1609fi
1610if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001611 echo "#define CONFIG_COCOA 1" >> $config_h
1612 echo "CONFIG_COCOA=yes" >> $config_mak
1613fi
1614if test "$curses" = "yes" ; then
1615 echo "#define CONFIG_CURSES 1" >> $config_h
1616 echo "CONFIG_CURSES=yes" >> $config_mak
1617 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001618fi
aurel323b3f24a2009-04-15 16:12:13 +00001619if test "$atfile" = "yes" ; then
1620 echo "#define CONFIG_ATFILE 1" >> $config_h
1621fi
1622if test "$inotify" = "yes" ; then
1623 echo "#define CONFIG_INOTIFY 1" >> $config_h
1624fi
aurel322e4d9fb2008-04-08 06:01:02 +00001625if test "$brlapi" = "yes" ; then
1626 echo "CONFIG_BRLAPI=yes" >> $config_mak
1627 echo "#define CONFIG_BRLAPI 1" >> $config_h
1628 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1629fi
balrogfb599c92008-09-28 23:49:55 +00001630if test "$bluez" = "yes" ; then
1631 echo "CONFIG_BLUEZ=yes" >> $config_mak
1632 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1633 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1634 echo "#define CONFIG_BLUEZ 1" >> $config_h
1635fi
aliguorie37630c2009-04-22 15:19:10 +00001636if test "$xen" = "yes" ; then
1637 echo "XEN_LIBS=-lxenstore -lxenctrl" >> $config_mak
1638fi
blueswir1414f0da2008-08-15 18:20:52 +00001639if test "$aio" = "yes" ; then
1640 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001641 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001642fi
ths77755342008-11-27 15:45:16 +00001643if test "$blobs" = "yes" ; then
1644 echo "INSTALL_BLOBS=yes" >> $config_mak
1645fi
aliguoribf9298b2008-12-05 20:05:26 +00001646if test "$iovec" = "yes" ; then
1647 echo "#define HAVE_IOVEC 1" >> $config_h
1648fi
aliguoriceb42de2009-04-07 18:43:28 +00001649if test "$preadv" = "yes" ; then
1650 echo "#define HAVE_PREADV 1" >> $config_h
1651fi
aurel32f652e6a2008-12-16 10:43:48 +00001652if test "$fdt" = "yes" ; then
1653 echo "#define HAVE_FDT 1" >> $config_h
1654 echo "FDT_LIBS=-lfdt" >> $config_mak
1655fi
bellard97a847b2003-08-10 21:36:04 +00001656
bellard83fb7ad2004-07-05 21:25:26 +00001657# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001658if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001659 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001660 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001661 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001662fi
1663
pbrookc5937222006-05-14 11:30:38 +00001664echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1665
blueswir168063642008-11-22 21:03:55 +00001666# USB host support
1667case "$usb" in
1668linux)
1669 echo "HOST_USB=linux" >> $config_mak
1670;;
1671bsd)
1672 echo "HOST_USB=bsd" >> $config_mak
1673;;
1674*)
1675 echo "HOST_USB=stub" >> $config_mak
1676;;
1677esac
1678
pbrookc39e3332007-09-22 16:49:14 +00001679tools=
1680if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001681 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001682 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001683 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001684 fi
pbrookc39e3332007-09-22 16:49:14 +00001685fi
1686echo "TOOLS=$tools" >> $config_mak
1687
ths15d9ca02007-07-31 23:07:32 +00001688test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1689
bellard1d14ffa2005-10-30 18:58:22 +00001690for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001691target_dir="$target"
1692config_mak=$target_dir/config.mak
1693config_h=$target_dir/config.h
1694target_cpu=`echo $target | cut -d '-' -f 1`
1695target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001696[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001697[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1698[ "$target_cpu" = "mips" ] && target_bigendian=yes
1699[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1700[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001701[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001702[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001703[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001704[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001705[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001706[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1707[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1708[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001709target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001710target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001711target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001712target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001713target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001714case "$target" in
1715 ${target_cpu}-softmmu)
1716 target_softmmu="yes"
1717 ;;
1718 ${target_cpu}-linux-user)
1719 target_user_only="yes"
1720 target_linux_user="yes"
1721 ;;
1722 ${target_cpu}-darwin-user)
1723 target_user_only="yes"
1724 target_darwin_user="yes"
1725 ;;
blueswir184778502008-10-26 20:33:16 +00001726 ${target_cpu}-bsd-user)
1727 target_user_only="yes"
1728 target_bsd_user="yes"
1729 ;;
pbrook9e407a82007-05-26 16:38:53 +00001730 *)
1731 echo "ERROR: Target '$target' not recognised"
1732 exit 1
1733 ;;
1734esac
ths831b7822007-01-18 20:06:33 +00001735
bellard97ccc682005-07-02 13:32:17 +00001736if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001737 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001738 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001739 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001740 echo "Note that this will disable all output from the virtual graphics card"
1741 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001742 exit 1;
1743fi
1744
bellard7c1f25b2004-04-22 00:02:08 +00001745#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001746
ths15d9ca02007-07-31 23:07:32 +00001747test -f $config_h && mv $config_h ${config_h}~
1748
bellard97a847b2003-08-10 21:36:04 +00001749mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001750mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001751mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001752if 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 +00001753 mkdir -p $target_dir/nwfpe
1754fi
1755
bellardec530c82006-04-25 22:36:06 +00001756#
1757# don't use ln -sf as not all "ln -sf" over write the file/link
1758#
1759rm -f $target_dir/Makefile
1760ln -s $source_path/Makefile.target $target_dir/Makefile
1761
bellard97a847b2003-08-10 21:36:04 +00001762
1763echo "# Automatically generated by configure - do not modify" > $config_mak
1764echo "/* Automatically generated by configure - do not modify */" > $config_h
1765
1766
1767echo "include ../config-host.mak" >> $config_mak
1768echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001769
pbrooke5fe0c52006-06-11 13:32:59 +00001770bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001771elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001772target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001773interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1774echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001775gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001776
aliguori5985ece2008-11-05 19:59:25 +00001777# Make sure the target and host cpus are compatible
1778if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001779 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001780 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1781 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001782 kvm="no"
1783fi
1784# Disable KVM for linux-user
1785if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1786 kvm="no"
1787fi
1788
aurel322408a522008-04-20 20:19:44 +00001789case "$target_cpu" in
1790 i386)
1791 echo "TARGET_ARCH=i386" >> $config_mak
1792 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1793 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001794 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001795 then
blueswir12d6ebb02009-04-18 19:25:43 +00001796 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001797 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001798 fi
aliguori7ba1e612008-11-05 16:04:33 +00001799 if test "$kvm" = "yes" ; then
1800 echo "CONFIG_KVM=yes" >> $config_mak
1801 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001802 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001803 fi
aliguorie37630c2009-04-22 15:19:10 +00001804 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1805 then
1806 echo "CONFIG_XEN=yes" >> $config_mak
1807 echo "#define CONFIG_XEN 1" >> $config_h
1808 fi
aurel322408a522008-04-20 20:19:44 +00001809 ;;
1810 x86_64)
1811 echo "TARGET_ARCH=x86_64" >> $config_mak
1812 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1813 echo "#define TARGET_I386 1" >> $config_h
1814 echo "#define TARGET_X86_64 1" >> $config_h
1815 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1816 then
blueswir12d6ebb02009-04-18 19:25:43 +00001817 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001818 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001819 fi
aliguori7ba1e612008-11-05 16:04:33 +00001820 if test "$kvm" = "yes" ; then
1821 echo "CONFIG_KVM=yes" >> $config_mak
1822 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1823 echo "#define CONFIG_KVM 1" >> $config_h
1824 fi
aliguorie37630c2009-04-22 15:19:10 +00001825 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1826 then
1827 echo "CONFIG_XEN=yes" >> $config_mak
1828 echo "#define CONFIG_XEN 1" >> $config_h
1829 fi
aurel322408a522008-04-20 20:19:44 +00001830 ;;
1831 alpha)
1832 echo "TARGET_ARCH=alpha" >> $config_mak
1833 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1834 echo "#define TARGET_ALPHA 1" >> $config_h
1835 ;;
1836 arm|armeb)
1837 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001838 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1839 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001840 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001841 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001842 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00001843 ;;
1844 cris)
1845 echo "TARGET_ARCH=cris" >> $config_mak
1846 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1847 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001848 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001849 ;;
1850 m68k)
1851 echo "TARGET_ARCH=m68k" >> $config_mak
1852 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1853 echo "#define TARGET_M68K 1" >> $config_h
1854 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001855 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00001856 ;;
1857 mips|mipsel)
1858 echo "TARGET_ARCH=mips" >> $config_mak
1859 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1860 echo "#define TARGET_MIPS 1" >> $config_h
1861 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1862 ;;
1863 mipsn32|mipsn32el)
1864 echo "TARGET_ARCH=mipsn32" >> $config_mak
1865 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1866 echo "#define TARGET_MIPS 1" >> $config_h
1867 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1868 ;;
1869 mips64|mips64el)
1870 echo "TARGET_ARCH=mips64" >> $config_mak
1871 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1872 echo "#define TARGET_MIPS 1" >> $config_h
1873 echo "#define TARGET_MIPS64 1" >> $config_h
1874 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1875 ;;
1876 ppc)
1877 echo "TARGET_ARCH=ppc" >> $config_mak
1878 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1879 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001880 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001881 ;;
1882 ppcemb)
1883 echo "TARGET_ARCH=ppcemb" >> $config_mak
1884 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1885 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1886 echo "#define TARGET_PPC 1" >> $config_h
1887 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001888 if test "$kvm" = "yes" ; then
1889 echo "CONFIG_KVM=yes" >> $config_mak
1890 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1891 echo "#define CONFIG_KVM 1" >> $config_h
1892 fi
aurel32c8b35322009-01-24 15:07:34 +00001893 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001894 ;;
1895 ppc64)
1896 echo "TARGET_ARCH=ppc64" >> $config_mak
1897 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1898 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1899 echo "#define TARGET_PPC 1" >> $config_h
1900 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001901 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001902 ;;
1903 ppc64abi32)
1904 echo "TARGET_ARCH=ppc64" >> $config_mak
1905 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1906 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1907 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1908 echo "#define TARGET_PPC 1" >> $config_h
1909 echo "#define TARGET_PPC64 1" >> $config_h
1910 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001911 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001912 ;;
1913 sh4|sh4eb)
1914 echo "TARGET_ARCH=sh4" >> $config_mak
1915 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1916 echo "#define TARGET_SH4 1" >> $config_h
1917 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001918 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001919 ;;
1920 sparc)
1921 echo "TARGET_ARCH=sparc" >> $config_mak
1922 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1923 echo "#define TARGET_SPARC 1" >> $config_h
1924 ;;
1925 sparc64)
1926 echo "TARGET_ARCH=sparc64" >> $config_mak
1927 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1928 echo "#define TARGET_SPARC 1" >> $config_h
1929 echo "#define TARGET_SPARC64 1" >> $config_h
1930 elfload32="yes"
1931 ;;
1932 sparc32plus)
1933 echo "TARGET_ARCH=sparc64" >> $config_mak
1934 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1935 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1936 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1937 echo "#define TARGET_SPARC 1" >> $config_h
1938 echo "#define TARGET_SPARC64 1" >> $config_h
1939 echo "#define TARGET_ABI32 1" >> $config_h
1940 ;;
1941 *)
1942 echo "Unsupported target CPU"
1943 exit 1
1944 ;;
1945esac
bellardde83cd02003-06-15 20:25:43 +00001946if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001947 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1948 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1949fi
1950if test "$target_softmmu" = "yes" ; then
1951 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1952 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00001953fi
bellard997344f2003-10-27 21:10:39 +00001954if test "$target_user_only" = "yes" ; then
1955 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1956 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1957fi
ths831b7822007-01-18 20:06:33 +00001958if test "$target_linux_user" = "yes" ; then
1959 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1960 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1961fi
1962if test "$target_darwin_user" = "yes" ; then
1963 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1964 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1965fi
pbrook56aebc82008-10-11 17:55:29 +00001966list=""
1967if test ! -z "$gdb_xml_files" ; then
1968 for x in $gdb_xml_files; do
1969 list="$list $source_path/gdb-xml/$x"
1970 done
1971fi
1972echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00001973
aurel320938cda2008-04-11 21:36:06 +00001974if test "$target_cpu" = "arm" \
1975 -o "$target_cpu" = "armeb" \
1976 -o "$target_cpu" = "m68k" \
1977 -o "$target_cpu" = "mips" \
1978 -o "$target_cpu" = "mipsel" \
1979 -o "$target_cpu" = "mipsn32" \
1980 -o "$target_cpu" = "mipsn32el" \
1981 -o "$target_cpu" = "mips64" \
1982 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00001983 -o "$target_cpu" = "ppc" \
1984 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00001985 -o "$target_cpu" = "ppc64abi32" \
1986 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00001987 -o "$target_cpu" = "sparc" \
1988 -o "$target_cpu" = "sparc64" \
1989 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00001990 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1991 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1992fi
pbrooke5fe0c52006-06-11 13:32:59 +00001993if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1994 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1995 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1996fi
pbrookbd0c5662008-05-29 14:34:11 +00001997if test "$target_user_only" = "yes" \
1998 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1999 echo "#define USE_NPTL 1" >> $config_h
2000fi
blueswir1cb33da52007-10-09 16:34:29 +00002001# 32 bit ELF loader in addition to native 64 bit loader?
2002if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2003 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2004 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2005fi
blueswir184778502008-10-26 20:33:16 +00002006if test "$target_bsd_user" = "yes" ; then
2007 echo "CONFIG_BSD_USER=yes" >> $config_mak
2008 echo "#define CONFIG_BSD_USER 1" >> $config_h
2009fi
bellard5b0753e2005-03-01 21:37:28 +00002010
ths15d9ca02007-07-31 23:07:32 +00002011test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2012
bellard97a847b2003-08-10 21:36:04 +00002013done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00002014
2015# build tree in object directory if source path is different from current one
2016if test "$source_path_used" = "yes" ; then
bellard49ecc3f2007-11-07 19:25:15 +00002017 DIRS="tests tests/cris slirp audio"
bellard7d132992003-03-06 23:23:54 +00002018 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00002019 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00002020 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00002021 for dir in $DIRS ; do
2022 mkdir -p $dir
2023 done
bellardec530c82006-04-25 22:36:06 +00002024 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00002025 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00002026 rm -f $f
2027 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00002028 done
2029fi