blob: 8fdbc1ccc3d74f58595fd6a051233752e19ed333 [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=""
bellard443f1372004-06-04 11:13:20 +0000162slirp="yes"
aliguorie0e6c8c2008-07-23 18:14:33 +0000163vde="yes"
bellard102a52e2004-11-14 19:57:29 +0000164fmod_lib=""
165fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000166oss_lib=""
ths8d5d2d42007-08-25 01:37:51 +0000167vnc_tls="yes"
aliguori2f9606b2009-03-06 20:27:28 +0000168vnc_sasl="yes"
pbrookb1a550a2006-04-16 13:28:56 +0000169bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000170linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000171solaris="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000172kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000173profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000174cocoa="no"
bellard97ccc682005-07-02 13:32:17 +0000175check_gfx="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000176softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000177linux_user="no"
178darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000179bsd_user="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500180build_docs="yes"
pbrookc5937222006-05-14 11:30:38 +0000181uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000182curses="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000183pthread="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000184aio="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000185io_thread="no"
pbrookbd0c5662008-05-29 14:34:11 +0000186nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000187mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000188bluez="yes"
aliguori7ba1e612008-11-05 16:04:33 +0000189kvm="yes"
aliguorieac30262008-11-05 16:28:56 +0000190kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000191aix="no"
ths77755342008-11-27 15:45:16 +0000192blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000193fdt="yes"
aliguori5368a422009-03-03 17:37:21 +0000194sdl_x11="no"
aliguorie37630c2009-04-22 15:19:10 +0000195xen="yes"
pbrook4a19f1e2009-04-07 23:17:49 +0000196pkgversion=""
bellard7d132992003-03-06 23:23:54 +0000197
198# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000199if check_define __linux__ ; then
200 targetos="Linux"
201elif check_define _WIN32 ; then
202 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000203elif check_define __OpenBSD__ ; then
204 targetos='OpenBSD'
205elif check_define __sun__ ; then
206 targetos='SunOS'
aliguoriac0df512008-12-29 17:14:15 +0000207else
208 targetos=`uname -s`
209fi
bellard7d132992003-03-06 23:23:54 +0000210case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000211CYGWIN*)
212mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000213OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000214if [ "$cpu" = "i386" ] ; then
215 kqemu="yes"
216fi
malcc2de5c92008-06-28 19:13:06 +0000217audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000218;;
bellard67b915a2004-03-31 23:37:16 +0000219MINGW32*)
220mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000221if [ "$cpu" = "i386" ] ; then
222 kqemu="yes"
223fi
malcc2de5c92008-06-28 19:13:06 +0000224audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000225;;
ths5c40d2b2007-06-23 16:03:36 +0000226GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000227audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000228audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000229if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
230 kqemu="yes"
231fi
232;;
bellard7d3505c2004-05-12 19:32:15 +0000233FreeBSD)
234bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000235audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000236audio_possible_drivers="oss sdl esd pa"
bellarde99f9062005-07-28 21:45:38 +0000237if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000238 kqemu="yes"
239fi
bellard7d3505c2004-05-12 19:32:15 +0000240;;
blueswir1c5e97232009-03-07 20:06:23 +0000241DragonFly)
242bsd="yes"
243audio_drv_list="oss"
244audio_possible_drivers="oss sdl esd pa"
245if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
246 kqemu="yes"
247fi
248aio="no"
249;;
bellard7d3505c2004-05-12 19:32:15 +0000250NetBSD)
251bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000252audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000253audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000254oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000255;;
256OpenBSD)
257bsd="yes"
blueswir1128ab2f2008-08-15 18:33:42 +0000258openbsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000259audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000260audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000261oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000262;;
bellard83fb7ad2004-07-05 21:25:26 +0000263Darwin)
264bsd="yes"
265darwin="yes"
aliguori1b0f9cc2009-01-26 15:37:40 +0000266# 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 +0000267if [ "$cpu" = "i386" ] ; then
268 is_x86_64=`sysctl -n hw.optional.x86_64`
269 [ "$is_x86_64" = "1" ] && cpu=x86_64
aliguori1b0f9cc2009-01-26 15:37:40 +0000270fi
271if [ "$cpu" = "x86_64" ] ; then
272 OS_CFLAGS="-arch x86_64"
273 LDFLAGS="-arch x86_64"
274else
275 OS_CFLAGS="-mdynamic-no-pic"
276fi
ths831b7822007-01-18 20:06:33 +0000277darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000278cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000279audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000280audio_possible_drivers="coreaudio sdl fmod"
thsc2c59c32008-01-08 00:00:20 +0000281OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
bellard83fb7ad2004-07-05 21:25:26 +0000282;;
bellardec530c82006-04-25 22:36:06 +0000283SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000284 solaris="yes"
285 make="gmake"
286 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000287 needs_libsunmath="no"
blueswir1acda94b2009-04-13 16:23:22 +0000288 kvm="no"
thsc2b84fa2007-02-10 23:21:21 +0000289 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000290 # have to select again, because `uname -m` returns i86pc
291 # even on an x86_64 box.
292 solariscpu=`isainfo -k`
293 if test "${solariscpu}" = "amd64" ; then
294 cpu="x86_64"
295 fi
thsc2b84fa2007-02-10 23:21:21 +0000296 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000297 if test "$solarisrev" -le 9 ; then
298 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
299 needs_libsunmath="yes"
300 else
301 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
302 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
303 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
304 echo "Studio 11 can be downloaded from www.sun.com."
305 exit 1
306 fi
307 fi
308 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000309 kqemu="yes"
310 fi
ths86b2bd92007-02-11 00:31:33 +0000311 fi
ths6b4d2ba2007-05-13 18:02:43 +0000312 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000313 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000314 fi
malcc2de5c92008-06-28 19:13:06 +0000315 audio_possible_drivers="oss sdl"
blueswir114d483e2009-04-13 16:27:08 +0000316 OS_CFLAGS=-std=gnu99
ths86b2bd92007-02-11 00:31:33 +0000317;;
malcb29fe3e2008-11-18 01:42:22 +0000318AIX)
319aix="yes"
320make="gmake"
321;;
bellard1d14ffa2005-10-30 18:58:22 +0000322*)
malc0c58ac12008-06-25 21:04:05 +0000323audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000324audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000325linux="yes"
ths831b7822007-01-18 20:06:33 +0000326linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000327usb="linux"
bellard07f4ddb2005-04-23 17:44:28 +0000328if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000329 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000330 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000331fi
bellardfb065182004-11-09 23:09:44 +0000332;;
bellard7d132992003-03-06 23:23:54 +0000333esac
334
bellard7d3505c2004-05-12 19:32:15 +0000335if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000336 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000337 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000338 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000339 fi
blueswir184778502008-10-26 20:33:16 +0000340 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000341fi
342
bellard7d132992003-03-06 23:23:54 +0000343# find source path
pbrookad064842006-04-16 12:41:07 +0000344source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000345source_path_used="no"
346workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000347if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000348 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000349else
350 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000351fi
pbrook724db112008-02-03 19:20:13 +0000352[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000353
bellard85aa5182007-11-11 20:17:03 +0000354werror="no"
bellard0d1e2392007-11-11 20:24:30 +0000355# generate compile errors on warnings for development builds
356#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
357#werror="yes";
358#fi
bellard85aa5182007-11-11 20:17:03 +0000359
bellard7d132992003-03-06 23:23:54 +0000360for opt do
pbrooka46e4032006-04-29 23:05:22 +0000361 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000362 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000363 --help|-h) show_help=yes
364 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000365 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000366 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000367 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000368 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000369 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000370 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000371 ;;
aliguoriac0df512008-12-29 17:14:15 +0000372 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000373 ;;
aliguoriac0df512008-12-29 17:14:15 +0000374 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000375 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000376 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000377 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000378 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000379 ;;
pbrook6a882642006-04-17 13:57:12 +0000380 --install=*) install="$optarg"
381 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000382 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000383 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000384 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000385 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000386 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000387 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000388 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000389 ;;
bellard7d132992003-03-06 23:23:54 +0000390 --enable-gprof) gprof="yes"
391 ;;
bellard43ce4df2003-06-09 19:53:12 +0000392 --static) static="yes"
393 ;;
bellard97a847b2003-08-10 21:36:04 +0000394 --disable-sdl) sdl="no"
395 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000396 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000397 ;;
malcc2de5c92008-06-28 19:13:06 +0000398 --fmod-inc=*) fmod_inc="$optarg"
399 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000400 --oss-lib=*) oss_lib="$optarg"
401 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000402 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000403 ;;
404 --audio-drv-list=*) audio_drv_list="$optarg"
405 ;;
aurel32f8393942009-04-13 18:45:38 +0000406 --enable-debug-tcg) debug_tcg="yes"
407 ;;
408 --disable-debug-tcg) debug_tcg="no"
409 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000410 --enable-sparse) sparse="yes"
411 ;;
412 --disable-sparse) sparse="no"
413 ;;
aliguori1625af82009-04-05 17:41:02 +0000414 --disable-strip) strip_opt="no"
415 ;;
ths8d5d2d42007-08-25 01:37:51 +0000416 --disable-vnc-tls) vnc_tls="no"
417 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000418 --disable-vnc-sasl) vnc_sasl="no"
419 ;;
bellard443f1372004-06-04 11:13:20 +0000420 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000421 ;;
aliguorie0e6c8c2008-07-23 18:14:33 +0000422 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000423 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000424 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000425 ;;
aliguorie37630c2009-04-22 15:19:10 +0000426 --disable-xen) xen="no"
427 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000428 --disable-brlapi) brlapi="no"
429 ;;
balrogfb599c92008-09-28 23:49:55 +0000430 --disable-bluez) bluez="no"
431 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000432 --disable-kvm) kvm="no"
433 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000434 --enable-profiler) profiler="yes"
435 ;;
malcc2de5c92008-06-28 19:13:06 +0000436 --enable-cocoa)
437 cocoa="yes" ;
438 sdl="no" ;
439 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000440 ;;
bellard97ccc682005-07-02 13:32:17 +0000441 --disable-gfx-check) check_gfx="no"
442 ;;
pbrookcad25d62006-03-19 16:31:11 +0000443 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000444 ;;
pbrookcad25d62006-03-19 16:31:11 +0000445 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000446 ;;
ths831b7822007-01-18 20:06:33 +0000447 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000448 ;;
ths831b7822007-01-18 20:06:33 +0000449 --enable-linux-user) linux_user="yes"
450 ;;
451 --disable-darwin-user) darwin_user="no"
452 ;;
453 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000454 ;;
blueswir184778502008-10-26 20:33:16 +0000455 --disable-bsd-user) bsd_user="no"
456 ;;
457 --enable-bsd-user) bsd_user="yes"
458 ;;
pbrookc5937222006-05-14 11:30:38 +0000459 --enable-uname-release=*) uname_release="$optarg"
460 ;;
blueswir131422552007-04-16 18:27:06 +0000461 --sparc_cpu=*)
462 sparc_cpu="$optarg"
463 case $sparc_cpu in
464 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
465 target_cpu="sparc"; cpu="sparc" ;;
466 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
467 target_cpu="sparc"; cpu="sparc" ;;
468 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
469 target_cpu="sparc64"; cpu="sparc64" ;;
470 *) echo "undefined SPARC architecture. Exiting";exit 1;;
471 esac
472 ;;
bellard85aa5182007-11-11 20:17:03 +0000473 --enable-werror) werror="yes"
474 ;;
475 --disable-werror) werror="no"
476 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000477 --disable-curses) curses="no"
478 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000479 --disable-nptl) nptl="no"
480 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000481 --enable-mixemu) mixemu="yes"
482 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000483 --disable-pthread) pthread="no"
484 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000485 --disable-aio) aio="no"
486 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000487 --enable-io-thread) io_thread="yes"
488 ;;
ths77755342008-11-27 15:45:16 +0000489 --disable-blobs) blobs="no"
490 ;;
aliguorieac30262008-11-05 16:28:56 +0000491 --kerneldir=*) kerneldir="$optarg"
492 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000493 --with-pkgversion=*) pkgversion=" ($optarg)"
494 ;;
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500495 --disable-docs) build_docs="no"
496 ;;
balrog7f1559c2007-11-17 10:24:32 +0000497 *) echo "ERROR: unknown option $opt"; show_help="yes"
498 ;;
bellard7d132992003-03-06 23:23:54 +0000499 esac
500done
501
ths6f30fa82007-01-05 01:00:47 +0000502# default flags for all hosts
blueswir1ac41a622008-09-14 06:46:31 +0000503CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
blueswir1e0e36fe2008-12-07 19:16:27 +0000504CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000505LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000506if test "$werror" = "yes" ; then
507CFLAGS="$CFLAGS -Werror"
508fi
ths6f30fa82007-01-05 01:00:47 +0000509
blueswir1d2c7c9b2008-11-01 14:50:20 +0000510if test "$solaris" = "no" ; then
511 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
512 LDFLAGS="$LDFLAGS -Wl,--warn-common"
513 fi
blueswir149237ac2008-09-17 19:05:19 +0000514fi
515
blueswir131422552007-04-16 18:27:06 +0000516#
517# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
518# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
519#
bellard40293e52008-01-31 11:32:10 +0000520case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000521 sparc) if test -z "$sparc_cpu" ; then
522 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
523 ARCH_LDFLAGS="-m32"
524 else
525 ARCH_CFLAGS="${SP_CFLAGS}"
526 ARCH_LDFLAGS="${SP_LDFLAGS}"
527 fi
blueswir1762e8232009-04-04 09:21:28 +0000528 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
529 if test "$solaris" = "no" ; then
530 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
531 fi
blueswir131422552007-04-16 18:27:06 +0000532 ;;
533 sparc64) if test -z "$sparc_cpu" ; then
534 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
535 ARCH_LDFLAGS="-m64"
536 else
537 ARCH_CFLAGS="${SP_CFLAGS}"
538 ARCH_LDFLAGS="${SP_LDFLAGS}"
539 fi
blueswir1762e8232009-04-04 09:21:28 +0000540 if test "$solaris" = "no" ; then
541 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
542 else
543 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
544 fi
blueswir131422552007-04-16 18:27:06 +0000545 ;;
ths76d83bd2007-11-18 21:22:10 +0000546 s390)
547 ARCH_CFLAGS="-march=z900"
548 ;;
bellard40293e52008-01-31 11:32:10 +0000549 i386)
550 ARCH_CFLAGS="-m32"
551 ARCH_LDFLAGS="-m32"
552 ;;
553 x86_64)
554 ARCH_CFLAGS="-m64"
555 ARCH_LDFLAGS="-m64"
556 ;;
blueswir131422552007-04-16 18:27:06 +0000557esac
558
pbrookaf5db582006-04-08 14:26:41 +0000559if test x"$show_help" = x"yes" ; then
560cat << EOF
561
562Usage: configure [options]
563Options: [defaults in brackets after descriptions]
564
565EOF
566echo "Standard options:"
567echo " --help print this message"
568echo " --prefix=PREFIX install in PREFIX [$prefix]"
569echo " --interp-prefix=PREFIX where to find shared libraries, etc."
570echo " use %M for cpu name [$interp_prefix]"
571echo " --target-list=LIST set target list [$target_list]"
572echo ""
573echo "kqemu kernel acceleration support:"
574echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000575echo ""
576echo "Advanced options (experts only):"
577echo " --source-path=PATH path of source code [$source_path]"
578echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
579echo " --cc=CC use C compiler CC [$cc]"
580echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
aurel322981fa92009-04-07 19:57:17 +0000581echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
582echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000583echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000584echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000585echo " --static enable static build [$static]"
aurel32f8393942009-04-13 18:45:38 +0000586echo " --enable-debug-tcg enable TCG debugging"
587echo " --disable-debug-tcg disable TCG debugging (default)"
aliguori890b1652008-10-07 21:22:41 +0000588echo " --enable-sparse enable sparse checker"
589echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000590echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000591echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000592echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000593echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000594echo " --audio-drv-list=LIST set audio drivers list:"
595echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000596echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
597echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000598echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000599echo " --disable-xen disable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000600echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000601echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000602echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000603echo " --disable-curses disable curses output"
balrogfb599c92008-09-28 23:49:55 +0000604echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000605echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000606echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000607echo " --enable-system enable all system emulation targets"
608echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000609echo " --enable-linux-user enable all linux usermode emulation targets"
610echo " --disable-linux-user disable all linux usermode emulation targets"
611echo " --enable-darwin-user enable all darwin usermode emulation targets"
612echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000613echo " --enable-bsd-user enable all BSD usermode emulation targets"
614echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000615echo " --fmod-lib path to FMOD library"
616echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000617echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000618echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000619echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c2008-07-23 18:14:33 +0000620echo " --disable-vde disable support for vde network"
aliguorie5d355d2009-04-24 18:03:15 +0000621echo " --disable-pthread disable pthread support"
blueswir1414f0da2008-08-15 18:20:52 +0000622echo " --disable-aio disable AIO support"
aliguorie5d355d2009-04-24 18:03:15 +0000623echo " --enable-io-thread enable IO thread"
ths77755342008-11-27 15:45:16 +0000624echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000625echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000626echo ""
ths5bf08932006-12-23 00:33:26 +0000627echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000628exit 1
629fi
630
bellard67b915a2004-03-31 23:37:16 +0000631if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000632 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000633 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000634 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000635 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000636 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000637 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000638fi
639
aliguori03b4fe72008-10-07 19:16:17 +0000640if test ! -x "$(which cgcc 2>/dev/null)"; then
641 sparse="no"
642fi
643
bellardec530c82006-04-25 22:36:06 +0000644#
645# Solaris specific configure tool chain decisions
646#
647if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000648 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
649 if test -z "$solinst" ; then
650 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
651 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
652 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
653 exit 1
654 fi
655 if test "$solinst" = "/usr/sbin/install" ; then
656 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
657 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
658 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
659 exit 1
660 fi
bellardec530c82006-04-25 22:36:06 +0000661 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
662 if test -z "$sol_ar" ; then
663 echo "Error: No path includes ar"
664 if test -f /usr/ccs/bin/ar ; then
665 echo "Add /usr/ccs/bin to your path and rerun configure"
666 fi
667 exit 1
668 fi
ths5fafdf22007-09-16 21:08:06 +0000669fi
bellardec530c82006-04-25 22:36:06 +0000670
671
bellard5327cf42005-01-10 23:18:50 +0000672if test -z "$target_list" ; then
673# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000674 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000675 target_list="\
676i386-softmmu \
677x86_64-softmmu \
678arm-softmmu \
679cris-softmmu \
680m68k-softmmu \
681mips-softmmu \
682mipsel-softmmu \
683mips64-softmmu \
684mips64el-softmmu \
685ppc-softmmu \
686ppcemb-softmmu \
687ppc64-softmmu \
688sh4-softmmu \
689sh4eb-softmmu \
690sparc-softmmu \
691"
pbrook0a8e90f2006-03-19 14:54:16 +0000692 fi
bellard5327cf42005-01-10 23:18:50 +0000693# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000694 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000695 target_list="${target_list}\
696i386-linux-user \
697x86_64-linux-user \
698alpha-linux-user \
699arm-linux-user \
700armeb-linux-user \
701cris-linux-user \
702m68k-linux-user \
703mips-linux-user \
704mipsel-linux-user \
705ppc-linux-user \
706ppc64-linux-user \
707ppc64abi32-linux-user \
708sh4-linux-user \
709sh4eb-linux-user \
710sparc-linux-user \
711sparc64-linux-user \
712sparc32plus-linux-user \
713"
ths831b7822007-01-18 20:06:33 +0000714 fi
715# the following are Darwin specific
716 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000717 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000718 fi
blueswir184778502008-10-26 20:33:16 +0000719# the following are BSD specific
720 if [ "$bsd_user" = "yes" ] ; then
721 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000722i386-bsd-user \
723x86_64-bsd-user \
724sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000725sparc64-bsd-user \
726"
727 fi
bellard6e20a452005-06-05 15:56:02 +0000728else
pbrookb1a550a2006-04-16 13:28:56 +0000729 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000730fi
pbrook0a8e90f2006-03-19 14:54:16 +0000731if test -z "$target_list" ; then
732 echo "No targets enabled"
733 exit 1
734fi
bellard5327cf42005-01-10 23:18:50 +0000735
bellard7d132992003-03-06 23:23:54 +0000736if test -z "$cross_prefix" ; then
737
738# ---
739# big/little endian test
740cat > $TMPC << EOF
741#include <inttypes.h>
742int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000743 volatile uint32_t i=0x01234567;
744 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000745}
746EOF
747
aurel32178baee2008-12-08 18:11:57 +0000748if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000749$TMPE && bigendian="yes"
750else
751echo big/little test failed
752fi
753
754else
755
756# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000757if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000758 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000759 -o "$cpu" = "m68k" \
760 -o "$cpu" = "mips" \
761 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000762 -o "$cpu" = "ppc" \
763 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000764 -o "$cpu" = "s390" \
765 -o "$cpu" = "sparc" \
766 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000767 bigendian="yes"
768fi
769
770fi
771
bellardb6853692005-06-05 17:10:39 +0000772# host long bits test
773hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000774if test "$cpu" = "x86_64" \
775 -o "$cpu" = "alpha" \
776 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000777 -o "$cpu" = "sparc64" \
778 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000779 hostlongbits="64"
780fi
781
pbrookbd0c5662008-05-29 14:34:11 +0000782# Check host NPTL support
783cat > $TMPC <<EOF
784#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000785#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000786void foo()
787{
788#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
789#error bork
790#endif
791}
792EOF
793
balrog8c7f7572008-12-15 03:15:36 +0000794if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000795 :
796else
797 nptl="no"
798fi
799
bellard11d9f692004-04-02 20:55:59 +0000800##########################################
balrogac629222008-10-11 09:56:04 +0000801# zlib check
802
803cat > $TMPC << EOF
804#include <zlib.h>
805int main(void) { zlibVersion(); return 0; }
806EOF
balrog8c7f7572008-12-15 03:15:36 +0000807if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000808 :
809else
810 echo
811 echo "Error: zlib check failed"
812 echo "Make sure to have the zlib libs and headers installed."
813 echo
814 exit 1
815fi
816
817##########################################
aliguorie37630c2009-04-22 15:19:10 +0000818# xen probe
819
820if test "$xen" = "yes" ; then
821cat > $TMPC <<EOF
822#include <xenctrl.h>
823#include <xs.h>
824int main(void) { xs_daemon_open; xc_interface_open; }
825EOF
Jan Kiszka918a6082009-04-27 17:16:55 +0000826 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null > /dev/null ; then
aliguorie37630c2009-04-22 15:19:10 +0000827 :
828 else
829 xen="no"
830 fi
831fi
832
833##########################################
bellard11d9f692004-04-02 20:55:59 +0000834# SDL probe
835
836sdl_too_old=no
837
838if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000839 sdl_config="sdl-config"
840 sdl=no
841 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000842
843cat > $TMPC << EOF
844#include <SDL.h>
845#undef main /* We don't want SDL to override our main() */
846int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
847EOF
balrog8c7f7572008-12-15 03:15:36 +0000848 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 +0000849 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
850 if test "$_sdlversion" -lt 121 ; then
851 sdl_too_old=yes
852 else
853 if test "$cocoa" = "no" ; then
854 sdl=yes
855 fi
856 fi
857
858 # static link with sdl ?
859 if test "$sdl" = "yes" ; then
860 aa="no"
861 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
862 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
863 if [ "$aa" = "yes" ] ; then
864 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000865 fi
bellard11d9f692004-04-02 20:55:59 +0000866
balrog8c7f7572008-12-15 03:15:36 +0000867 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 +0000868 sdl_static=yes
869 fi
870 fi # static link
871 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000872else
ths069b0bd2007-07-12 00:27:15 +0000873 # Make sure to disable cocoa if sdl was set
874 if test "$sdl" = "yes" ; then
875 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000876 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000877 fi
bellarda6e022a2004-04-02 21:55:47 +0000878fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000879
aliguori5368a422009-03-03 17:37:21 +0000880if test "$sdl" = "yes" ; then
881cat > $TMPC <<EOF
882#include <SDL.h>
883#if defined(SDL_VIDEO_DRIVER_X11)
884#include <X11/XKBlib.h>
885#else
886#error No x11 support
887#endif
888int main(void) { return 0; }
889EOF
890 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
891 sdl_x11="yes"
892 fi
893fi
894
ths8f28f3f2007-01-05 21:25:54 +0000895##########################################
ths8d5d2d42007-08-25 01:37:51 +0000896# VNC TLS detection
897if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000898cat > $TMPC <<EOF
899#include <gnutls/gnutls.h>
900int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
901EOF
902 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
903 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
904 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000905 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000906 :
907 else
908 vnc_tls="no"
909 fi
ths8d5d2d42007-08-25 01:37:51 +0000910fi
911
912##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000913# VNC SASL detection
914if test "$vnc_sasl" = "yes" ; then
915cat > $TMPC <<EOF
916#include <sasl/sasl.h>
917#include <stdio.h>
918int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
919EOF
920 # Assuming Cyrus-SASL installed in /usr prefix
921 vnc_sasl_cflags=""
922 vnc_sasl_libs="-lsasl2"
923 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
Jan Kiszka918a6082009-04-27 17:16:55 +0000924 $vnc_sasl_libs 2> /dev/null > /dev/null ; then
aliguori2f9606b2009-03-06 20:27:28 +0000925 :
926 else
927 vnc_sasl="no"
928 fi
929fi
930
931##########################################
aliguori76655d62009-03-06 20:27:37 +0000932# fnmatch() probe, used for ACL routines
933fnmatch="no"
934cat > $TMPC << EOF
935#include <fnmatch.h>
936int main(void)
937{
938 fnmatch("foo", "foo", 0);
939 return 0;
940}
941EOF
942if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
943 fnmatch="yes"
944fi
945
946##########################################
ths8a16d272008-07-19 09:56:24 +0000947# vde libraries probe
948if test "$vde" = "yes" ; then
949 cat > $TMPC << EOF
950#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000951int main(void)
952{
953 struct vde_open_args a = {0, 0, 0};
954 vde_open("", "", &a);
955 return 0;
956}
ths8a16d272008-07-19 09:56:24 +0000957EOF
balrog8c7f7572008-12-15 03:15:36 +0000958 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000959 :
960 else
aliguorie0e6c8c2008-07-23 18:14:33 +0000961 vde="no"
ths8a16d272008-07-19 09:56:24 +0000962 fi
963fi
964
965##########################################
malcc2de5c92008-06-28 19:13:06 +0000966# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000967
malcc2de5c92008-06-28 19:13:06 +0000968audio_drv_probe()
969{
970 drv=$1
971 hdr=$2
972 lib=$3
973 exp=$4
974 cfl=$5
975 cat > $TMPC << EOF
976#include <$hdr>
977int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000978EOF
balrog8c7f7572008-12-15 03:15:36 +0000979 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000980 :
981 else
982 echo
983 echo "Error: $drv check failed"
984 echo "Make sure to have the $drv libs and headers installed."
985 echo
986 exit 1
987 fi
988}
989
malc2fa7d3b2008-07-29 12:58:44 +0000990audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000991for drv in $audio_drv_list; do
992 case $drv in
993 alsa)
994 audio_drv_probe $drv alsa/asoundlib.h -lasound \
995 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
996 ;;
997
998 fmod)
999 if test -z $fmod_lib || test -z $fmod_inc; then
1000 echo
1001 echo "Error: You must specify path to FMOD library and headers"
1002 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1003 echo
1004 exit 1
1005 fi
1006 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1007 ;;
1008
1009 esd)
1010 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1011 ;;
malcb8e59f12008-07-02 21:03:08 +00001012
1013 pa)
1014 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1015 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1016 ;;
1017
blueswir12f6a1ab2008-08-21 18:00:53 +00001018 oss|sdl|core|wav|dsound)
1019 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1020 ;;
1021
malce4c63a62008-07-19 16:15:16 +00001022 *)
malc1c9b2a52008-07-19 16:57:30 +00001023 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001024 echo
1025 echo "Error: Unknown driver '$drv' selected"
1026 echo "Possible drivers are: $audio_possible_drivers"
1027 echo
1028 exit 1
1029 }
1030 ;;
malcc2de5c92008-06-28 19:13:06 +00001031 esac
1032done
ths8f28f3f2007-01-05 21:25:54 +00001033
balrog4d3b6f62008-02-10 16:33:14 +00001034##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001035# BrlAPI probe
1036
1037if test -z "$brlapi" ; then
1038 brlapi=no
1039cat > $TMPC << EOF
1040#include <brlapi.h>
1041int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1042EOF
aurel32178baee2008-12-08 18:11:57 +00001043 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +00001044 brlapi=yes
1045 fi # brlapi compile test
1046fi # -z $brlapi
1047
1048##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001049# curses probe
1050
1051if test "$curses" = "yes" ; then
1052 curses=no
1053 cat > $TMPC << EOF
1054#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001055#ifdef __OpenBSD__
1056#define resize_term resizeterm
1057#endif
1058int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001059EOF
aurel32178baee2008-12-08 18:11:57 +00001060 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001061 curses=yes
1062 fi
1063fi # test "$curses"
1064
blueswir1414f0da2008-08-15 18:20:52 +00001065##########################################
balrogfb599c92008-09-28 23:49:55 +00001066# bluez support probe
1067if test "$bluez" = "yes" ; then
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001068 `pkg-config bluez 2> /dev/null` || bluez="no"
balrogfb599c92008-09-28 23:49:55 +00001069fi
1070if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001071 cat > $TMPC << EOF
1072#include <bluetooth/bluetooth.h>
1073int main(void) { return bt_error(0); }
1074EOF
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001075 bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1076 bluez_libs=`pkg-config --libs bluez 2> /dev/null`
balrog17e15922008-10-11 12:00:42 +00001077 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001078 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001079 :
1080 else
1081 bluez="no"
1082 fi
balrogfb599c92008-09-28 23:49:55 +00001083fi
1084
1085##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001086# kvm probe
1087if test "$kvm" = "yes" ; then
1088 cat > $TMPC <<EOF
1089#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001090#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001091#error Invalid KVM version
1092#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001093#if !defined(KVM_CAP_USER_MEMORY)
1094#error Missing KVM capability KVM_CAP_USER_MEMORY
1095#endif
1096#if !defined(KVM_CAP_SET_TSS_ADDR)
1097#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1098#endif
1099#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1100#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1101#endif
aliguori7ba1e612008-11-05 16:04:33 +00001102int main(void) { return 0; }
1103EOF
aliguorieac30262008-11-05 16:28:56 +00001104 if test "$kerneldir" != "" ; then
1105 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001106 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1107 -a -d "$kerneldir/arch/x86/include" ; then
1108 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001109 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1110 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001111 elif test -d "$kerneldir/arch/$cpu/include" ; then
1112 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1113 fi
aliguorieac30262008-11-05 16:28:56 +00001114 else
1115 kvm_cflags=""
1116 fi
aliguori7ba1e612008-11-05 16:04:33 +00001117 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001118 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001119 :
1120 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001121 kvm="no";
1122 if [ -x "`which awk 2>/dev/null`" ] && \
1123 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001124 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001125 | grep "error: " \
1126 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1127 if test "$kvmerr" != "" ; then
1128 kvm="no - (${kvmerr})"
1129 fi
1130 fi
aliguori7ba1e612008-11-05 16:04:33 +00001131 fi
1132fi
1133
1134##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001135# pthread probe
1136PTHREADLIBS=""
aliguori3c529d92008-12-12 16:41:40 +00001137
aliguorie5d355d2009-04-24 18:03:15 +00001138if test "$pthread" = yes; then
1139 pthread=no
1140cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001141#include <pthread.h>
blueswir1c9db92f2009-01-17 06:49:15 +00001142int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001143EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001144 if $cc $ARCH_CFLAGS -o $TMPE $PTHREADLIBS $TMPC 2> /dev/null > /dev/null ; then
aliguorie5d355d2009-04-24 18:03:15 +00001145 pthread=yes
1146 PTHREADLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +00001147 fi
1148fi
1149
aliguorie5d355d2009-04-24 18:03:15 +00001150if test "$pthread" = no; then
1151 aio=no
1152 io_thread=no
1153fi
1154
aliguoribf9298b2008-12-05 20:05:26 +00001155##########################################
1156# iovec probe
1157cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001158#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001159#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001160#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001161int main(void) { struct iovec iov; return 0; }
1162EOF
1163iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001164if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001165 iovec=yes
1166fi
1167
aurel32f652e6a2008-12-16 10:43:48 +00001168##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001169# preadv probe
1170cat > $TMPC <<EOF
1171#include <sys/types.h>
1172#include <sys/uio.h>
1173#include <unistd.h>
1174int main(void) { preadv; }
1175EOF
1176preadv=no
1177if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1178 preadv=yes
1179fi
1180
1181##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001182# fdt probe
1183if test "$fdt" = "yes" ; then
1184 fdt=no
1185 cat > $TMPC << EOF
1186int main(void) { return 0; }
1187EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001188 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null > /dev/null ; then
aurel32f652e6a2008-12-16 10:43:48 +00001189 fdt=yes
1190 fi
1191fi
1192
aurel323b3f24a2009-04-15 16:12:13 +00001193#
1194# Check for xxxat() functions when we are building linux-user
1195# emulator. This is done because older glibc versions don't
1196# have syscall stubs for these implemented.
1197#
1198atfile=no
1199if [ "$linux_user" = "yes" ] ; then
1200 cat > $TMPC << EOF
1201#define _ATFILE_SOURCE
1202#include <sys/types.h>
1203#include <fcntl.h>
1204#include <unistd.h>
1205
1206int
1207main(void)
1208{
1209 /* try to unlink nonexisting file */
1210 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1211}
1212EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001213 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001214 atfile=yes
1215 fi
1216fi
1217
aurel3239386ac2009-04-15 19:48:17 +00001218# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001219# emulator. This is done because older glibc versions don't
1220# have syscall stubs for these implemented. In that case we
1221# don't provide them even if kernel supports them.
1222#
1223inotify=no
1224if [ "$linux_user" = "yes" ] ; then
1225 cat > $TMPC << EOF
1226#include <sys/inotify.h>
1227
1228int
1229main(void)
1230{
1231 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001232 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001233}
1234EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001235 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001236 inotify=yes
1237 fi
1238fi
1239
pbrookcc8ae6d2006-04-23 17:57:59 +00001240# Check if tools are available to build documentation.
Anthony Liguori70ec5dc2009-05-14 08:25:04 -05001241if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
1242 build_docs="no"
pbrookcc8ae6d2006-04-23 17:57:59 +00001243fi
1244
aliguorida93a1f2008-12-12 20:02:52 +00001245##########################################
1246# Do we need librt
aliguorie5d355d2009-04-24 18:03:15 +00001247CLOCKLIBS=""
aliguorida93a1f2008-12-12 20:02:52 +00001248cat > $TMPC <<EOF
1249#include <signal.h>
1250#include <time.h>
1251int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1252EOF
1253
1254rt=no
balrog8c7f7572008-12-15 03:15:36 +00001255if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001256 :
balrog8c7f7572008-12-15 03:15:36 +00001257elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001258 rt=yes
1259fi
1260
1261if test "$rt" = "yes" ; then
aliguorie5d355d2009-04-24 18:03:15 +00001262 CLOCKLIBS="-lrt"
aliguorida93a1f2008-12-12 20:02:52 +00001263fi
1264
bellard11d9f692004-04-02 20:55:59 +00001265if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001266 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001267 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001268 fi
1269 mansuffix=""
1270 datasuffix=""
1271 docsuffix=""
1272 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001273else
pbrook308c3592007-02-27 00:52:01 +00001274 if test -z "$prefix" ; then
1275 prefix="/usr/local"
1276 fi
1277 mansuffix="/share/man"
1278 datasuffix="/share/qemu"
1279 docsuffix="/share/doc/qemu"
1280 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001281fi
bellard5a671352003-10-01 00:13:48 +00001282
bellard43ce4df2003-06-09 19:53:12 +00001283echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001284echo "BIOS directory $prefix$datasuffix"
1285echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001286if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001287echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001288echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001289fi
bellard5a671352003-10-01 00:13:48 +00001290echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001291echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001292echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001293echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001294echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001295echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001296echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001297echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001298echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00001299echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00001300echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001301echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001302echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001303echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001304echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001305echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001306if test "$darwin" = "yes" ; then
1307 echo "Cocoa support $cocoa"
1308fi
bellard97a847b2003-08-10 21:36:04 +00001309echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001310if test "$sdl" != "no" ; then
1311 echo "SDL static link $sdl_static"
1312fi
balrog4d3b6f62008-02-10 16:33:14 +00001313echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001314echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001315echo "Audio drivers $audio_drv_list"
1316echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001317echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001318echo "VNC TLS support $vnc_tls"
1319if test "$vnc_tls" = "yes" ; then
1320 echo " TLS CFLAGS $vnc_tls_cflags"
1321 echo " TLS LIBS $vnc_tls_libs"
1322fi
aliguori2f9606b2009-03-06 20:27:28 +00001323echo "VNC SASL support $vnc_sasl"
1324if test "$vnc_sasl" = "yes" ; then
1325 echo " SASL CFLAGS $vnc_sasl_cflags"
1326 echo " SASL LIBS $vnc_sasl_libs"
1327fi
blueswir131422552007-04-16 18:27:06 +00001328if test -n "$sparc_cpu"; then
1329 echo "Target Sparc Arch $sparc_cpu"
1330fi
bellard07f4ddb2005-04-23 17:44:28 +00001331echo "kqemu support $kqemu"
aliguorie37630c2009-04-22 15:19:10 +00001332echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00001333echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001334echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001335[ ! -z "$uname_release" ] && \
1336echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001337echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001338echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001339echo "AIO support $aio"
aliguorie5d355d2009-04-24 18:03:15 +00001340echo "IO thread $io_thread"
ths77755342008-11-27 15:45:16 +00001341echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001342echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001343echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001344echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001345
bellard97a847b2003-08-10 21:36:04 +00001346if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001347echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001348fi
malcd4742de2008-11-29 22:04:31 +00001349if [ -s $TMPSDLLOG ]; then
ths20b40c62007-07-11 23:39:45 +00001350 echo "The error log from compiling the libSDL test is: "
malcd4742de2008-11-29 22:04:31 +00001351 cat $TMPSDLLOG
ths20b40c62007-07-11 23:39:45 +00001352fi
bellard24b55b92005-03-01 22:30:41 +00001353#if test "$sdl_static" = "no"; then
1354# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1355#fi
bellard97a847b2003-08-10 21:36:04 +00001356config_mak="config-host.mak"
1357config_h="config-host.h"
1358
bellard7c1f25b2004-04-22 00:02:08 +00001359#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001360
ths15d9ca02007-07-31 23:07:32 +00001361test -f $config_h && mv $config_h ${config_h}~
1362
bellard97a847b2003-08-10 21:36:04 +00001363echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001364printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001365printf " '%s'" "$0" "$@" >> $config_mak
1366echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001367echo "/* Automatically generated by configure - do not modify */" > $config_h
1368
1369echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001370echo "bindir=\${prefix}$binsuffix" >> $config_mak
1371echo "mandir=\${prefix}$mansuffix" >> $config_mak
1372echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001373echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001374echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001375echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001376echo "INSTALL=$install" >> $config_mak
aliguori58f8aea2009-04-18 15:36:02 +00001377echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1378echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1379echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001380echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001381echo "HOST_CC=$host_cc" >> $config_mak
1382echo "AR=$ar" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001383# XXX: only use CFLAGS and LDFLAGS ?
1384# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1385# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001386echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001387echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1388echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1389echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001390echo "CFLAGS=$CFLAGS" >> $config_mak
1391echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001392echo "EXESUF=$EXESUF" >> $config_mak
aliguorie5d355d2009-04-24 18:03:15 +00001393echo "PTHREADLIBS=$PTHREADLIBS" >> $config_mak
1394echo "CLOCKLIBS=$CLOCKLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001395case "$cpu" in
1396 i386)
1397 echo "ARCH=i386" >> $config_mak
1398 echo "#define HOST_I386 1" >> $config_h
1399 ;;
1400 x86_64)
1401 echo "ARCH=x86_64" >> $config_mak
1402 echo "#define HOST_X86_64 1" >> $config_h
1403 ;;
1404 alpha)
1405 echo "ARCH=alpha" >> $config_mak
1406 echo "#define HOST_ALPHA 1" >> $config_h
1407 ;;
1408 armv4b)
1409 echo "ARCH=arm" >> $config_mak
1410 echo "#define HOST_ARM 1" >> $config_h
1411 ;;
1412 armv4l)
1413 echo "ARCH=arm" >> $config_mak
1414 echo "#define HOST_ARM 1" >> $config_h
1415 ;;
1416 cris)
1417 echo "ARCH=cris" >> $config_mak
1418 echo "#define HOST_CRIS 1" >> $config_h
1419 ;;
1420 hppa)
1421 echo "ARCH=hppa" >> $config_mak
1422 echo "#define HOST_HPPA 1" >> $config_h
1423 ;;
1424 ia64)
1425 echo "ARCH=ia64" >> $config_mak
1426 echo "#define HOST_IA64 1" >> $config_h
1427 ;;
1428 m68k)
1429 echo "ARCH=m68k" >> $config_mak
1430 echo "#define HOST_M68K 1" >> $config_h
1431 ;;
1432 mips)
1433 echo "ARCH=mips" >> $config_mak
1434 echo "#define HOST_MIPS 1" >> $config_h
1435 ;;
1436 mips64)
1437 echo "ARCH=mips64" >> $config_mak
1438 echo "#define HOST_MIPS64 1" >> $config_h
1439 ;;
malcfdf7ed92009-01-14 18:39:52 +00001440 ppc)
1441 echo "ARCH=ppc" >> $config_mak
1442 echo "#define HOST_PPC 1" >> $config_h
1443 ;;
1444 ppc64)
1445 echo "ARCH=ppc64" >> $config_mak
1446 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001447 ;;
1448 s390)
1449 echo "ARCH=s390" >> $config_mak
1450 echo "#define HOST_S390 1" >> $config_h
1451 ;;
1452 sparc)
1453 echo "ARCH=sparc" >> $config_mak
1454 echo "#define HOST_SPARC 1" >> $config_h
1455 ;;
1456 sparc64)
1457 echo "ARCH=sparc64" >> $config_mak
1458 echo "#define HOST_SPARC64 1" >> $config_h
1459 ;;
1460 *)
1461 echo "Unsupported CPU = $cpu"
1462 exit 1
1463 ;;
1464esac
aurel32f8393942009-04-13 18:45:38 +00001465if test "$debug_tcg" = "yes" ; then
1466 echo "#define DEBUG_TCG 1" >> $config_h
1467fi
aliguori03b4fe72008-10-07 19:16:17 +00001468if test "$sparse" = "yes" ; then
1469 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1470 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1471 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1472fi
aliguori1625af82009-04-05 17:41:02 +00001473if test "$strip_opt" = "yes" ; then
1474 echo "STRIP_OPT=-s" >> $config_mak
1475fi
bellard7d132992003-03-06 23:23:54 +00001476if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001477 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1478 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1479fi
bellardb6853692005-06-05 17:10:39 +00001480echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001481if test "$mingw32" = "yes" ; then
1482 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001483 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001484else
1485 cat > $TMPC << EOF
1486#include <byteswap.h>
1487int main(void) { return bswap_32(0); }
1488EOF
aurel32178baee2008-12-08 18:11:57 +00001489 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001490 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1491 fi
blueswir113606772008-12-05 17:54:09 +00001492 cat > $TMPC << EOF
1493#include <sys/endian.h>
1494#include <sys/types.h>
1495#include <machine/bswap.h>
1496int main(void) { return bswap32(0); }
1497EOF
aurel32178baee2008-12-08 18:11:57 +00001498 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001499 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1500 fi
bellard67b915a2004-03-31 23:37:16 +00001501fi
blueswir1128ab2f2008-08-15 18:33:42 +00001502
1503if [ "$openbsd" = "yes" ] ; then
1504 echo "#define ENOTSUP 4096" >> $config_h
1505fi
1506
bellard83fb7ad2004-07-05 21:25:26 +00001507if test "$darwin" = "yes" ; then
1508 echo "CONFIG_DARWIN=yes" >> $config_mak
1509 echo "#define CONFIG_DARWIN 1" >> $config_h
1510fi
malcb29fe3e2008-11-18 01:42:22 +00001511
1512if test "$aix" = "yes" ; then
1513 echo "CONFIG_AIX=yes" >> $config_mak
1514 echo "#define CONFIG_AIX 1" >> $config_h
1515fi
1516
bellardec530c82006-04-25 22:36:06 +00001517if test "$solaris" = "yes" ; then
1518 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001519 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001520 if test "$needs_libsunmath" = "yes" ; then
1521 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1522 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1523 fi
bellardec530c82006-04-25 22:36:06 +00001524fi
blueswir131422552007-04-16 18:27:06 +00001525if test -n "$sparc_cpu"; then
1526 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1527 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1528fi
bellard97a847b2003-08-10 21:36:04 +00001529if test "$gprof" = "yes" ; then
1530 echo "TARGET_GPROF=yes" >> $config_mak
1531 echo "#define HAVE_GPROF 1" >> $config_h
1532fi
1533if test "$static" = "yes" ; then
1534 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001535 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001536fi
bellard05c2a3e2006-02-08 22:39:17 +00001537if test $profiler = "yes" ; then
1538 echo "#define CONFIG_PROFILER 1" >> $config_h
1539fi
bellardc20709a2004-04-21 23:27:19 +00001540if test "$slirp" = "yes" ; then
1541 echo "CONFIG_SLIRP=yes" >> $config_mak
1542 echo "#define CONFIG_SLIRP 1" >> $config_h
1543fi
ths8a16d272008-07-19 09:56:24 +00001544if test "$vde" = "yes" ; then
1545 echo "CONFIG_VDE=yes" >> $config_mak
1546 echo "#define CONFIG_VDE 1" >> $config_h
1547 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1548fi
malc0c58ac12008-06-25 21:04:05 +00001549for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001550 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001551 echo "$def=yes" >> $config_mak
1552 echo "#define $def 1" >> $config_h
1553done
1554echo "#define AUDIO_DRIVERS \\" >> $config_h
1555for drv in $audio_drv_list; do
1556 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001557 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001558 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001559 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001560 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1561 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001562 elif test "$drv" = "oss"; then
1563 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001564 fi
1565done
1566echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001567if test "$mixemu" = "yes" ; then
1568 echo "CONFIG_MIXEMU=yes" >> $config_mak
1569 echo "#define CONFIG_MIXEMU 1" >> $config_h
1570fi
ths8d5d2d42007-08-25 01:37:51 +00001571if test "$vnc_tls" = "yes" ; then
1572 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1573 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1574 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1575 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1576fi
aliguori2f9606b2009-03-06 20:27:28 +00001577if test "$vnc_sasl" = "yes" ; then
1578 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1579 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1580 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1581 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1582fi
aliguori76655d62009-03-06 20:27:37 +00001583if test "$fnmatch" = "yes" ; then
1584 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1585fi
pbrookb1a550a2006-04-16 13:28:56 +00001586qemu_version=`head $source_path/VERSION`
1587echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001588echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001589
pbrook4a19f1e2009-04-07 23:17:49 +00001590echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1591
bellard97a847b2003-08-10 21:36:04 +00001592echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001593if [ "$source_path_used" = "yes" ]; then
1594 echo "VPATH=$source_path" >> $config_mak
1595fi
bellard97a847b2003-08-10 21:36:04 +00001596echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001597if [ "$build_docs" = "yes" ] ; then
1598 echo "BUILD_DOCS=yes" >> $config_mak
1599fi
bellard49ecc3f2007-11-07 19:25:15 +00001600if test "$static" = "yes"; then
1601 sdl1=$sdl_static
1602else
1603 sdl1=$sdl
1604fi
1605if test "$sdl1" = "yes" ; then
1606 echo "#define CONFIG_SDL 1" >> $config_h
1607 echo "CONFIG_SDL=yes" >> $config_mak
1608 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1609 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001610 elif test "$sdl_x11" = "yes" ; then
1611 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001612 else
1613 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1614 fi
1615 if [ "${aa}" = "yes" ] ; then
1616 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1617 else
1618 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1619 fi
1620fi
1621if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001622 echo "#define CONFIG_COCOA 1" >> $config_h
1623 echo "CONFIG_COCOA=yes" >> $config_mak
1624fi
1625if test "$curses" = "yes" ; then
1626 echo "#define CONFIG_CURSES 1" >> $config_h
1627 echo "CONFIG_CURSES=yes" >> $config_mak
1628 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001629fi
aurel323b3f24a2009-04-15 16:12:13 +00001630if test "$atfile" = "yes" ; then
1631 echo "#define CONFIG_ATFILE 1" >> $config_h
1632fi
1633if test "$inotify" = "yes" ; then
1634 echo "#define CONFIG_INOTIFY 1" >> $config_h
1635fi
aurel322e4d9fb2008-04-08 06:01:02 +00001636if test "$brlapi" = "yes" ; then
1637 echo "CONFIG_BRLAPI=yes" >> $config_mak
1638 echo "#define CONFIG_BRLAPI 1" >> $config_h
1639 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1640fi
balrogfb599c92008-09-28 23:49:55 +00001641if test "$bluez" = "yes" ; then
1642 echo "CONFIG_BLUEZ=yes" >> $config_mak
1643 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1644 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1645 echo "#define CONFIG_BLUEZ 1" >> $config_h
1646fi
aliguorie37630c2009-04-22 15:19:10 +00001647if test "$xen" = "yes" ; then
aliguori9306acb2009-04-22 15:19:44 +00001648 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
aliguorie37630c2009-04-22 15:19:10 +00001649fi
blueswir1414f0da2008-08-15 18:20:52 +00001650if test "$aio" = "yes" ; then
1651 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001652 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001653fi
aliguorie5d355d2009-04-24 18:03:15 +00001654if test "$io_thread" = "yes" ; then
1655 echo "CONFIG_IOTHREAD=yes" >> $config_mak
1656 echo "#define CONFIG_IOTHREAD 1" >> $config_h
1657fi
ths77755342008-11-27 15:45:16 +00001658if test "$blobs" = "yes" ; then
1659 echo "INSTALL_BLOBS=yes" >> $config_mak
1660fi
aliguoribf9298b2008-12-05 20:05:26 +00001661if test "$iovec" = "yes" ; then
1662 echo "#define HAVE_IOVEC 1" >> $config_h
1663fi
aliguoriceb42de2009-04-07 18:43:28 +00001664if test "$preadv" = "yes" ; then
1665 echo "#define HAVE_PREADV 1" >> $config_h
1666fi
aurel32f652e6a2008-12-16 10:43:48 +00001667if test "$fdt" = "yes" ; then
1668 echo "#define HAVE_FDT 1" >> $config_h
1669 echo "FDT_LIBS=-lfdt" >> $config_mak
1670fi
bellard97a847b2003-08-10 21:36:04 +00001671
bellard83fb7ad2004-07-05 21:25:26 +00001672# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001673if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001674 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001675 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001676 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001677fi
1678
pbrookc5937222006-05-14 11:30:38 +00001679echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1680
blueswir168063642008-11-22 21:03:55 +00001681# USB host support
1682case "$usb" in
1683linux)
1684 echo "HOST_USB=linux" >> $config_mak
1685;;
1686bsd)
1687 echo "HOST_USB=bsd" >> $config_mak
1688;;
1689*)
1690 echo "HOST_USB=stub" >> $config_mak
1691;;
1692esac
1693
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001694# Determine what linker flags to use to force archive inclusion
1695check_linker_flags()
1696{
1697 $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 -Wl,$2 >/dev/null 2>/dev/null
1698}
1699
1700cat > $TMPC << EOF
1701int main(void) { }
1702EOF
1703if check_linker_flags --whole-archive --no-whole-archive ; then
1704 # GNU ld
1705 echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_mak
1706 echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_mak
1707elif check_linker_flags -z,allextract -z,defaultextract ; then
1708 # Solaris ld
1709 echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_mak
1710 echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_mak
1711else
1712 echo "Error: your linker does not support --whole-archive or -z."
1713 echo "Please report to qemu-devel@nongnu.org"
1714 exit 1
1715fi
1716
pbrookc39e3332007-09-22 16:49:14 +00001717tools=
1718if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001719 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001720 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001721 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001722 fi
pbrookc39e3332007-09-22 16:49:14 +00001723fi
1724echo "TOOLS=$tools" >> $config_mak
1725
ths15d9ca02007-07-31 23:07:32 +00001726test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001727config_host_mak=${config_mak}
ths15d9ca02007-07-31 23:07:32 +00001728
bellard1d14ffa2005-10-30 18:58:22 +00001729for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001730target_dir="$target"
1731config_mak=$target_dir/config.mak
1732config_h=$target_dir/config.h
1733target_cpu=`echo $target | cut -d '-' -f 1`
1734target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001735[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001736[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1737[ "$target_cpu" = "mips" ] && target_bigendian=yes
1738[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1739[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001740[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001741[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001742[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001743[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001744[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001745[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1746[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1747[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001748target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001749target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001750target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001751target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001752target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001753case "$target" in
1754 ${target_cpu}-softmmu)
1755 target_softmmu="yes"
1756 ;;
1757 ${target_cpu}-linux-user)
1758 target_user_only="yes"
1759 target_linux_user="yes"
1760 ;;
1761 ${target_cpu}-darwin-user)
1762 target_user_only="yes"
1763 target_darwin_user="yes"
1764 ;;
blueswir184778502008-10-26 20:33:16 +00001765 ${target_cpu}-bsd-user)
1766 target_user_only="yes"
1767 target_bsd_user="yes"
1768 ;;
pbrook9e407a82007-05-26 16:38:53 +00001769 *)
1770 echo "ERROR: Target '$target' not recognised"
1771 exit 1
1772 ;;
1773esac
ths831b7822007-01-18 20:06:33 +00001774
bellard97ccc682005-07-02 13:32:17 +00001775if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001776 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001777 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001778 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001779 echo "Note that this will disable all output from the virtual graphics card"
1780 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001781 exit 1;
1782fi
1783
bellard7c1f25b2004-04-22 00:02:08 +00001784#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001785
ths15d9ca02007-07-31 23:07:32 +00001786test -f $config_h && mv $config_h ${config_h}~
1787
bellard97a847b2003-08-10 21:36:04 +00001788mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001789mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001790mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001791if 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 +00001792 mkdir -p $target_dir/nwfpe
1793fi
1794
bellardec530c82006-04-25 22:36:06 +00001795#
1796# don't use ln -sf as not all "ln -sf" over write the file/link
1797#
1798rm -f $target_dir/Makefile
1799ln -s $source_path/Makefile.target $target_dir/Makefile
1800
bellard97a847b2003-08-10 21:36:04 +00001801
1802echo "# Automatically generated by configure - do not modify" > $config_mak
1803echo "/* Automatically generated by configure - do not modify */" > $config_h
1804
1805
1806echo "include ../config-host.mak" >> $config_mak
1807echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001808
pbrooke5fe0c52006-06-11 13:32:59 +00001809bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001810elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001811target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001812interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1813echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001814gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001815
aliguori5985ece2008-11-05 19:59:25 +00001816# Make sure the target and host cpus are compatible
1817if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001818 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001819 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1820 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001821 kvm="no"
1822fi
1823# Disable KVM for linux-user
1824if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1825 kvm="no"
1826fi
1827
aurel322408a522008-04-20 20:19:44 +00001828case "$target_cpu" in
1829 i386)
1830 echo "TARGET_ARCH=i386" >> $config_mak
1831 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1832 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001833 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001834 then
blueswir12d6ebb02009-04-18 19:25:43 +00001835 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001836 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001837 fi
aliguori7ba1e612008-11-05 16:04:33 +00001838 if test "$kvm" = "yes" ; then
1839 echo "CONFIG_KVM=yes" >> $config_mak
1840 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001841 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001842 fi
aliguorie37630c2009-04-22 15:19:10 +00001843 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1844 then
1845 echo "CONFIG_XEN=yes" >> $config_mak
1846 echo "#define CONFIG_XEN 1" >> $config_h
1847 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001848 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001849 ;;
1850 x86_64)
1851 echo "TARGET_ARCH=x86_64" >> $config_mak
1852 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1853 echo "#define TARGET_I386 1" >> $config_h
1854 echo "#define TARGET_X86_64 1" >> $config_h
1855 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1856 then
blueswir12d6ebb02009-04-18 19:25:43 +00001857 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001858 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001859 fi
aliguori7ba1e612008-11-05 16:04:33 +00001860 if test "$kvm" = "yes" ; then
1861 echo "CONFIG_KVM=yes" >> $config_mak
1862 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1863 echo "#define CONFIG_KVM 1" >> $config_h
1864 fi
aliguorie37630c2009-04-22 15:19:10 +00001865 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1866 then
1867 echo "CONFIG_XEN=yes" >> $config_mak
1868 echo "#define CONFIG_XEN 1" >> $config_h
1869 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001870 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001871 ;;
1872 alpha)
1873 echo "TARGET_ARCH=alpha" >> $config_mak
1874 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1875 echo "#define TARGET_ALPHA 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001876 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001877 ;;
1878 arm|armeb)
1879 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001880 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1881 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001882 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001883 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001884 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001885 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001886 ;;
1887 cris)
1888 echo "TARGET_ARCH=cris" >> $config_mak
1889 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1890 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001891 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001892 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001893 ;;
1894 m68k)
1895 echo "TARGET_ARCH=m68k" >> $config_mak
1896 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1897 echo "#define TARGET_M68K 1" >> $config_h
1898 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001899 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001900 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001901 ;;
1902 mips|mipsel)
1903 echo "TARGET_ARCH=mips" >> $config_mak
1904 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1905 echo "#define TARGET_MIPS 1" >> $config_h
1906 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001907 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001908 ;;
1909 mipsn32|mipsn32el)
1910 echo "TARGET_ARCH=mipsn32" >> $config_mak
1911 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1912 echo "#define TARGET_MIPS 1" >> $config_h
1913 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001914 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001915 ;;
1916 mips64|mips64el)
1917 echo "TARGET_ARCH=mips64" >> $config_mak
1918 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1919 echo "#define TARGET_MIPS 1" >> $config_h
1920 echo "#define TARGET_MIPS64 1" >> $config_h
1921 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001922 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001923 ;;
1924 ppc)
1925 echo "TARGET_ARCH=ppc" >> $config_mak
1926 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1927 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001928 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001929 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001930 ;;
1931 ppcemb)
1932 echo "TARGET_ARCH=ppcemb" >> $config_mak
1933 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1934 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1935 echo "#define TARGET_PPC 1" >> $config_h
1936 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001937 if test "$kvm" = "yes" ; then
1938 echo "CONFIG_KVM=yes" >> $config_mak
1939 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1940 echo "#define CONFIG_KVM 1" >> $config_h
1941 fi
aurel32c8b35322009-01-24 15:07:34 +00001942 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001943 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001944 ;;
1945 ppc64)
1946 echo "TARGET_ARCH=ppc64" >> $config_mak
1947 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1948 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1949 echo "#define TARGET_PPC 1" >> $config_h
1950 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001951 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001952 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001953 ;;
1954 ppc64abi32)
1955 echo "TARGET_ARCH=ppc64" >> $config_mak
1956 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1957 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1958 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1959 echo "#define TARGET_PPC 1" >> $config_h
1960 echo "#define TARGET_PPC64 1" >> $config_h
1961 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001962 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001963 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001964 ;;
1965 sh4|sh4eb)
1966 echo "TARGET_ARCH=sh4" >> $config_mak
1967 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1968 echo "#define TARGET_SH4 1" >> $config_h
1969 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001970 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001971 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001972 ;;
1973 sparc)
1974 echo "TARGET_ARCH=sparc" >> $config_mak
1975 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1976 echo "#define TARGET_SPARC 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001977 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001978 ;;
1979 sparc64)
1980 echo "TARGET_ARCH=sparc64" >> $config_mak
1981 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1982 echo "#define TARGET_SPARC 1" >> $config_h
1983 echo "#define TARGET_SPARC64 1" >> $config_h
1984 elfload32="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001985 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001986 ;;
1987 sparc32plus)
1988 echo "TARGET_ARCH=sparc64" >> $config_mak
1989 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1990 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1991 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1992 echo "#define TARGET_SPARC 1" >> $config_h
1993 echo "#define TARGET_SPARC64 1" >> $config_h
1994 echo "#define TARGET_ABI32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001995 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001996 ;;
1997 *)
1998 echo "Unsupported target CPU"
1999 exit 1
2000 ;;
2001esac
Paul Brook1ad21342009-05-19 16:17:58 +01002002if [ $target_phys_bits -lt $hostlongbits ] ; then
2003 target_phys_bits=$hostlongbits
2004fi
2005echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
2006echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h
2007echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00002008if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00002009 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2010 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2011fi
2012if test "$target_softmmu" = "yes" ; then
2013 echo "CONFIG_SOFTMMU=yes" >> $config_mak
2014 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00002015fi
bellard997344f2003-10-27 21:10:39 +00002016if test "$target_user_only" = "yes" ; then
2017 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2018 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2019fi
ths831b7822007-01-18 20:06:33 +00002020if test "$target_linux_user" = "yes" ; then
2021 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2022 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2023fi
2024if test "$target_darwin_user" = "yes" ; then
2025 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2026 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2027fi
pbrook56aebc82008-10-11 17:55:29 +00002028list=""
2029if test ! -z "$gdb_xml_files" ; then
2030 for x in $gdb_xml_files; do
2031 list="$list $source_path/gdb-xml/$x"
2032 done
2033fi
2034echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00002035
aurel320938cda2008-04-11 21:36:06 +00002036if test "$target_cpu" = "arm" \
2037 -o "$target_cpu" = "armeb" \
2038 -o "$target_cpu" = "m68k" \
2039 -o "$target_cpu" = "mips" \
2040 -o "$target_cpu" = "mipsel" \
2041 -o "$target_cpu" = "mipsn32" \
2042 -o "$target_cpu" = "mipsn32el" \
2043 -o "$target_cpu" = "mips64" \
2044 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00002045 -o "$target_cpu" = "ppc" \
2046 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00002047 -o "$target_cpu" = "ppc64abi32" \
2048 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00002049 -o "$target_cpu" = "sparc" \
2050 -o "$target_cpu" = "sparc64" \
2051 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00002052 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2053 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2054fi
pbrooke5fe0c52006-06-11 13:32:59 +00002055if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2056 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2057 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2058fi
pbrookbd0c5662008-05-29 14:34:11 +00002059if test "$target_user_only" = "yes" \
2060 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2061 echo "#define USE_NPTL 1" >> $config_h
2062fi
blueswir1cb33da52007-10-09 16:34:29 +00002063# 32 bit ELF loader in addition to native 64 bit loader?
2064if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2065 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2066 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2067fi
blueswir184778502008-10-26 20:33:16 +00002068if test "$target_bsd_user" = "yes" ; then
2069 echo "CONFIG_BSD_USER=yes" >> $config_mak
2070 echo "#define CONFIG_BSD_USER 1" >> $config_h
2071fi
bellard5b0753e2005-03-01 21:37:28 +00002072
ths15d9ca02007-07-31 23:07:32 +00002073test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2074
bellard97a847b2003-08-10 21:36:04 +00002075done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00002076
2077# build tree in object directory if source path is different from current one
2078if test "$source_path_used" = "yes" ; then
Anthony Liguori019d6b82009-05-09 17:14:19 -05002079 DIRS="tests tests/cris slirp audio block"
bellard7d132992003-03-06 23:23:54 +00002080 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00002081 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00002082 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00002083 for dir in $DIRS ; do
2084 mkdir -p $dir
2085 done
bellardec530c82006-04-25 22:36:06 +00002086 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00002087 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00002088 rm -f $f
2089 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00002090 done
2091fi
Paul Brook1ad21342009-05-19 16:17:58 +01002092
2093for hwlib in 32 64; do
2094 d=libhw$hwlib
2095 mkdir -p $d
2096 rm -f $d/Makefile
2097 ln -s $source_path/Makefile.hw $d/Makefile
2098 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2099 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2100done