blob: 186e5357688c8e80756bd7a151fa56b6801360b8 [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"
aliguorie0e6c8c02008-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"
pbrook0a8e90f2006-03-19 14:54:16 +0000175softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000176linux_user="no"
177darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000178bsd_user="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500179build_docs="yes"
pbrookc5937222006-05-14 11:30:38 +0000180uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000181curses="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000182pthread="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000183aio="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000184io_thread="no"
pbrookbd0c5662008-05-29 14:34:11 +0000185nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000186mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000187bluez="yes"
aliguori7ba1e612008-11-05 16:04:33 +0000188kvm="yes"
aliguorieac30262008-11-05 16:28:56 +0000189kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000190aix="no"
ths77755342008-11-27 15:45:16 +0000191blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000192fdt="yes"
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500193sdl="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 ;;
aliguorie0e6c8c02008-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 ;;
pbrookcad25d62006-03-19 16:31:11 +0000441 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000442 ;;
pbrookcad25d62006-03-19 16:31:11 +0000443 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000444 ;;
ths831b7822007-01-18 20:06:33 +0000445 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000446 ;;
ths831b7822007-01-18 20:06:33 +0000447 --enable-linux-user) linux_user="yes"
448 ;;
449 --disable-darwin-user) darwin_user="no"
450 ;;
451 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000452 ;;
blueswir184778502008-10-26 20:33:16 +0000453 --disable-bsd-user) bsd_user="no"
454 ;;
455 --enable-bsd-user) bsd_user="yes"
456 ;;
pbrookc5937222006-05-14 11:30:38 +0000457 --enable-uname-release=*) uname_release="$optarg"
458 ;;
blueswir131422552007-04-16 18:27:06 +0000459 --sparc_cpu=*)
460 sparc_cpu="$optarg"
461 case $sparc_cpu in
462 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
463 target_cpu="sparc"; cpu="sparc" ;;
464 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
465 target_cpu="sparc"; cpu="sparc" ;;
466 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
467 target_cpu="sparc64"; cpu="sparc64" ;;
468 *) echo "undefined SPARC architecture. Exiting";exit 1;;
469 esac
470 ;;
bellard85aa5182007-11-11 20:17:03 +0000471 --enable-werror) werror="yes"
472 ;;
473 --disable-werror) werror="no"
474 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000475 --disable-curses) curses="no"
476 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000477 --disable-nptl) nptl="no"
478 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000479 --enable-mixemu) mixemu="yes"
480 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000481 --disable-pthread) pthread="no"
482 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000483 --disable-aio) aio="no"
484 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000485 --enable-io-thread) io_thread="yes"
486 ;;
ths77755342008-11-27 15:45:16 +0000487 --disable-blobs) blobs="no"
488 ;;
aliguorieac30262008-11-05 16:28:56 +0000489 --kerneldir=*) kerneldir="$optarg"
490 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000491 --with-pkgversion=*) pkgversion=" ($optarg)"
492 ;;
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500493 --disable-docs) build_docs="no"
494 ;;
balrog7f1559c2007-11-17 10:24:32 +0000495 *) echo "ERROR: unknown option $opt"; show_help="yes"
496 ;;
bellard7d132992003-03-06 23:23:54 +0000497 esac
498done
499
ths6f30fa82007-01-05 01:00:47 +0000500# default flags for all hosts
blueswir1ac41a622008-09-14 06:46:31 +0000501CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
blueswir1e0e36fe2008-12-07 19:16:27 +0000502CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000503LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000504if test "$werror" = "yes" ; then
505CFLAGS="$CFLAGS -Werror"
506fi
ths6f30fa82007-01-05 01:00:47 +0000507
blueswir1d2c7c9b2008-11-01 14:50:20 +0000508if test "$solaris" = "no" ; then
509 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
510 LDFLAGS="$LDFLAGS -Wl,--warn-common"
511 fi
blueswir149237ac2008-09-17 19:05:19 +0000512fi
513
blueswir131422552007-04-16 18:27:06 +0000514#
515# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
516# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
517#
bellard40293e52008-01-31 11:32:10 +0000518case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000519 sparc) if test -z "$sparc_cpu" ; then
520 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
521 ARCH_LDFLAGS="-m32"
522 else
523 ARCH_CFLAGS="${SP_CFLAGS}"
524 ARCH_LDFLAGS="${SP_LDFLAGS}"
525 fi
blueswir1762e8232009-04-04 09:21:28 +0000526 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
527 if test "$solaris" = "no" ; then
528 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
529 fi
blueswir131422552007-04-16 18:27:06 +0000530 ;;
531 sparc64) if test -z "$sparc_cpu" ; then
532 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
533 ARCH_LDFLAGS="-m64"
534 else
535 ARCH_CFLAGS="${SP_CFLAGS}"
536 ARCH_LDFLAGS="${SP_LDFLAGS}"
537 fi
blueswir1762e8232009-04-04 09:21:28 +0000538 if test "$solaris" = "no" ; then
539 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
540 else
541 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
542 fi
blueswir131422552007-04-16 18:27:06 +0000543 ;;
ths76d83bd2007-11-18 21:22:10 +0000544 s390)
545 ARCH_CFLAGS="-march=z900"
546 ;;
bellard40293e52008-01-31 11:32:10 +0000547 i386)
548 ARCH_CFLAGS="-m32"
549 ARCH_LDFLAGS="-m32"
550 ;;
551 x86_64)
552 ARCH_CFLAGS="-m64"
553 ARCH_LDFLAGS="-m64"
554 ;;
blueswir131422552007-04-16 18:27:06 +0000555esac
556
pbrookaf5db582006-04-08 14:26:41 +0000557if test x"$show_help" = x"yes" ; then
558cat << EOF
559
560Usage: configure [options]
561Options: [defaults in brackets after descriptions]
562
563EOF
564echo "Standard options:"
565echo " --help print this message"
566echo " --prefix=PREFIX install in PREFIX [$prefix]"
567echo " --interp-prefix=PREFIX where to find shared libraries, etc."
568echo " use %M for cpu name [$interp_prefix]"
569echo " --target-list=LIST set target list [$target_list]"
570echo ""
571echo "kqemu kernel acceleration support:"
572echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000573echo ""
574echo "Advanced options (experts only):"
575echo " --source-path=PATH path of source code [$source_path]"
576echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
577echo " --cc=CC use C compiler CC [$cc]"
578echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
aurel322981fa92009-04-07 19:57:17 +0000579echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
580echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000581echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000582echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000583echo " --static enable static build [$static]"
aurel32f8393942009-04-13 18:45:38 +0000584echo " --enable-debug-tcg enable TCG debugging"
585echo " --disable-debug-tcg disable TCG debugging (default)"
aliguori890b1652008-10-07 21:22:41 +0000586echo " --enable-sparse enable sparse checker"
587echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000588echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000589echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000590echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000591echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000592echo " --audio-drv-list=LIST set audio drivers list:"
593echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000594echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
595echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000596echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000597echo " --disable-xen disable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000598echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000599echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000600echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000601echo " --disable-curses disable curses output"
balrogfb599c92008-09-28 23:49:55 +0000602echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000603echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000604echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000605echo " --enable-system enable all system emulation targets"
606echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000607echo " --enable-linux-user enable all linux usermode emulation targets"
608echo " --disable-linux-user disable all linux usermode emulation targets"
609echo " --enable-darwin-user enable all darwin usermode emulation targets"
610echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000611echo " --enable-bsd-user enable all BSD usermode emulation targets"
612echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000613echo " --fmod-lib path to FMOD library"
614echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000615echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000616echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000617echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000618echo " --disable-vde disable support for vde network"
aliguorie5d355d2009-04-24 18:03:15 +0000619echo " --disable-pthread disable pthread support"
blueswir1414f0da2008-08-15 18:20:52 +0000620echo " --disable-aio disable AIO support"
aliguorie5d355d2009-04-24 18:03:15 +0000621echo " --enable-io-thread enable IO thread"
ths77755342008-11-27 15:45:16 +0000622echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000623echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000624echo ""
ths5bf08932006-12-23 00:33:26 +0000625echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000626exit 1
627fi
628
bellard67b915a2004-03-31 23:37:16 +0000629if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000630 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000631 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000632 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000633 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000634 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000635 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000636fi
637
aliguori03b4fe72008-10-07 19:16:17 +0000638if test ! -x "$(which cgcc 2>/dev/null)"; then
639 sparse="no"
640fi
641
bellardec530c82006-04-25 22:36:06 +0000642#
643# Solaris specific configure tool chain decisions
644#
645if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000646 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
647 if test -z "$solinst" ; then
648 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
649 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
650 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
651 exit 1
652 fi
653 if test "$solinst" = "/usr/sbin/install" ; then
654 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
655 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
656 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
657 exit 1
658 fi
bellardec530c82006-04-25 22:36:06 +0000659 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
660 if test -z "$sol_ar" ; then
661 echo "Error: No path includes ar"
662 if test -f /usr/ccs/bin/ar ; then
663 echo "Add /usr/ccs/bin to your path and rerun configure"
664 fi
665 exit 1
666 fi
ths5fafdf22007-09-16 21:08:06 +0000667fi
bellardec530c82006-04-25 22:36:06 +0000668
669
bellard5327cf42005-01-10 23:18:50 +0000670if test -z "$target_list" ; then
671# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000672 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000673 target_list="\
674i386-softmmu \
675x86_64-softmmu \
676arm-softmmu \
677cris-softmmu \
678m68k-softmmu \
679mips-softmmu \
680mipsel-softmmu \
681mips64-softmmu \
682mips64el-softmmu \
683ppc-softmmu \
684ppcemb-softmmu \
685ppc64-softmmu \
686sh4-softmmu \
687sh4eb-softmmu \
688sparc-softmmu \
689"
pbrook0a8e90f2006-03-19 14:54:16 +0000690 fi
bellard5327cf42005-01-10 23:18:50 +0000691# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000692 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000693 target_list="${target_list}\
694i386-linux-user \
695x86_64-linux-user \
696alpha-linux-user \
697arm-linux-user \
698armeb-linux-user \
699cris-linux-user \
700m68k-linux-user \
701mips-linux-user \
702mipsel-linux-user \
703ppc-linux-user \
704ppc64-linux-user \
705ppc64abi32-linux-user \
706sh4-linux-user \
707sh4eb-linux-user \
708sparc-linux-user \
709sparc64-linux-user \
710sparc32plus-linux-user \
711"
ths831b7822007-01-18 20:06:33 +0000712 fi
713# the following are Darwin specific
714 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000715 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000716 fi
blueswir184778502008-10-26 20:33:16 +0000717# the following are BSD specific
718 if [ "$bsd_user" = "yes" ] ; then
719 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000720i386-bsd-user \
721x86_64-bsd-user \
722sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000723sparc64-bsd-user \
724"
725 fi
bellard6e20a452005-06-05 15:56:02 +0000726else
pbrookb1a550a2006-04-16 13:28:56 +0000727 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000728fi
pbrook0a8e90f2006-03-19 14:54:16 +0000729if test -z "$target_list" ; then
730 echo "No targets enabled"
731 exit 1
732fi
bellard5327cf42005-01-10 23:18:50 +0000733
bellard7d132992003-03-06 23:23:54 +0000734if test -z "$cross_prefix" ; then
735
736# ---
737# big/little endian test
738cat > $TMPC << EOF
739#include <inttypes.h>
740int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000741 volatile uint32_t i=0x01234567;
742 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000743}
744EOF
745
aurel32178baee2008-12-08 18:11:57 +0000746if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000747$TMPE && bigendian="yes"
748else
749echo big/little test failed
750fi
751
752else
753
754# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000755if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000756 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000757 -o "$cpu" = "m68k" \
758 -o "$cpu" = "mips" \
759 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000760 -o "$cpu" = "ppc" \
761 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000762 -o "$cpu" = "s390" \
763 -o "$cpu" = "sparc" \
764 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000765 bigendian="yes"
766fi
767
768fi
769
bellardb6853692005-06-05 17:10:39 +0000770# host long bits test
771hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000772if test "$cpu" = "x86_64" \
773 -o "$cpu" = "alpha" \
774 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000775 -o "$cpu" = "sparc64" \
776 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000777 hostlongbits="64"
778fi
779
pbrookbd0c5662008-05-29 14:34:11 +0000780# Check host NPTL support
781cat > $TMPC <<EOF
782#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000783#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000784void foo()
785{
786#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
787#error bork
788#endif
789}
790EOF
791
balrog8c7f7572008-12-15 03:15:36 +0000792if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000793 :
794else
795 nptl="no"
796fi
797
bellard11d9f692004-04-02 20:55:59 +0000798##########################################
balrogac629222008-10-11 09:56:04 +0000799# zlib check
800
801cat > $TMPC << EOF
802#include <zlib.h>
803int main(void) { zlibVersion(); return 0; }
804EOF
balrog8c7f7572008-12-15 03:15:36 +0000805if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000806 :
807else
808 echo
809 echo "Error: zlib check failed"
810 echo "Make sure to have the zlib libs and headers installed."
811 echo
812 exit 1
813fi
814
815##########################################
aliguorie37630c2009-04-22 15:19:10 +0000816# xen probe
817
818if test "$xen" = "yes" ; then
819cat > $TMPC <<EOF
820#include <xenctrl.h>
821#include <xs.h>
822int main(void) { xs_daemon_open; xc_interface_open; }
823EOF
Jan Kiszka918a6082009-04-27 17:16:55 +0000824 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null > /dev/null ; then
aliguorie37630c2009-04-22 15:19:10 +0000825 :
826 else
827 xen="no"
828 fi
829fi
830
831##########################################
bellard11d9f692004-04-02 20:55:59 +0000832# SDL probe
833
834sdl_too_old=no
835
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500836if test "$sdl" = "yes" ; then
ths069b0bd2007-07-12 00:27:15 +0000837 sdl_config="sdl-config"
838 sdl=no
839 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000840
841cat > $TMPC << EOF
842#include <SDL.h>
843#undef main /* We don't want SDL to override our main() */
844int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
845EOF
balrog8c7f7572008-12-15 03:15:36 +0000846 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 +0000847 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
848 if test "$_sdlversion" -lt 121 ; then
849 sdl_too_old=yes
850 else
851 if test "$cocoa" = "no" ; then
852 sdl=yes
853 fi
854 fi
855
856 # static link with sdl ?
857 if test "$sdl" = "yes" ; then
858 aa="no"
859 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
860 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
861 if [ "$aa" = "yes" ] ; then
862 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000863 fi
bellard11d9f692004-04-02 20:55:59 +0000864
balrog8c7f7572008-12-15 03:15:36 +0000865 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 +0000866 sdl_static=yes
867 fi
868 fi # static link
869 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000870else
ths069b0bd2007-07-12 00:27:15 +0000871 # Make sure to disable cocoa if sdl was set
872 if test "$sdl" = "yes" ; then
873 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000874 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000875 fi
bellarda6e022a2004-04-02 21:55:47 +0000876fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000877
aliguori5368a422009-03-03 17:37:21 +0000878if test "$sdl" = "yes" ; then
879cat > $TMPC <<EOF
880#include <SDL.h>
881#if defined(SDL_VIDEO_DRIVER_X11)
882#include <X11/XKBlib.h>
883#else
884#error No x11 support
885#endif
886int main(void) { return 0; }
887EOF
888 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
889 sdl_x11="yes"
890 fi
891fi
892
ths8f28f3f2007-01-05 21:25:54 +0000893##########################################
ths8d5d2d42007-08-25 01:37:51 +0000894# VNC TLS detection
895if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000896cat > $TMPC <<EOF
897#include <gnutls/gnutls.h>
898int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
899EOF
900 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
901 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
902 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000903 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000904 :
905 else
906 vnc_tls="no"
907 fi
ths8d5d2d42007-08-25 01:37:51 +0000908fi
909
910##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000911# VNC SASL detection
912if test "$vnc_sasl" = "yes" ; then
913cat > $TMPC <<EOF
914#include <sasl/sasl.h>
915#include <stdio.h>
916int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
917EOF
918 # Assuming Cyrus-SASL installed in /usr prefix
919 vnc_sasl_cflags=""
920 vnc_sasl_libs="-lsasl2"
921 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
Jan Kiszka918a6082009-04-27 17:16:55 +0000922 $vnc_sasl_libs 2> /dev/null > /dev/null ; then
aliguori2f9606b2009-03-06 20:27:28 +0000923 :
924 else
925 vnc_sasl="no"
926 fi
927fi
928
929##########################################
aliguori76655d62009-03-06 20:27:37 +0000930# fnmatch() probe, used for ACL routines
931fnmatch="no"
932cat > $TMPC << EOF
933#include <fnmatch.h>
934int main(void)
935{
936 fnmatch("foo", "foo", 0);
937 return 0;
938}
939EOF
940if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
941 fnmatch="yes"
942fi
943
944##########################################
ths8a16d272008-07-19 09:56:24 +0000945# vde libraries probe
946if test "$vde" = "yes" ; then
947 cat > $TMPC << EOF
948#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000949int main(void)
950{
951 struct vde_open_args a = {0, 0, 0};
952 vde_open("", "", &a);
953 return 0;
954}
ths8a16d272008-07-19 09:56:24 +0000955EOF
balrog8c7f7572008-12-15 03:15:36 +0000956 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000957 :
958 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000959 vde="no"
ths8a16d272008-07-19 09:56:24 +0000960 fi
961fi
962
963##########################################
malcc2de5c92008-06-28 19:13:06 +0000964# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000965
malcc2de5c92008-06-28 19:13:06 +0000966audio_drv_probe()
967{
968 drv=$1
969 hdr=$2
970 lib=$3
971 exp=$4
972 cfl=$5
973 cat > $TMPC << EOF
974#include <$hdr>
975int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000976EOF
balrog8c7f7572008-12-15 03:15:36 +0000977 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000978 :
979 else
980 echo
981 echo "Error: $drv check failed"
982 echo "Make sure to have the $drv libs and headers installed."
983 echo
984 exit 1
985 fi
986}
987
malc2fa7d3b2008-07-29 12:58:44 +0000988audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000989for drv in $audio_drv_list; do
990 case $drv in
991 alsa)
992 audio_drv_probe $drv alsa/asoundlib.h -lasound \
993 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
994 ;;
995
996 fmod)
997 if test -z $fmod_lib || test -z $fmod_inc; then
998 echo
999 echo "Error: You must specify path to FMOD library and headers"
1000 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1001 echo
1002 exit 1
1003 fi
1004 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1005 ;;
1006
1007 esd)
1008 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1009 ;;
malcb8e59f12008-07-02 21:03:08 +00001010
1011 pa)
1012 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1013 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1014 ;;
1015
blueswir12f6a1ab2008-08-21 18:00:53 +00001016 oss|sdl|core|wav|dsound)
1017 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1018 ;;
1019
malce4c63a62008-07-19 16:15:16 +00001020 *)
malc1c9b2a52008-07-19 16:57:30 +00001021 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001022 echo
1023 echo "Error: Unknown driver '$drv' selected"
1024 echo "Possible drivers are: $audio_possible_drivers"
1025 echo
1026 exit 1
1027 }
1028 ;;
malcc2de5c92008-06-28 19:13:06 +00001029 esac
1030done
ths8f28f3f2007-01-05 21:25:54 +00001031
balrog4d3b6f62008-02-10 16:33:14 +00001032##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001033# BrlAPI probe
1034
1035if test -z "$brlapi" ; then
1036 brlapi=no
1037cat > $TMPC << EOF
1038#include <brlapi.h>
1039int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1040EOF
aurel32178baee2008-12-08 18:11:57 +00001041 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +00001042 brlapi=yes
1043 fi # brlapi compile test
1044fi # -z $brlapi
1045
1046##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001047# curses probe
1048
1049if test "$curses" = "yes" ; then
1050 curses=no
1051 cat > $TMPC << EOF
1052#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001053#ifdef __OpenBSD__
1054#define resize_term resizeterm
1055#endif
1056int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001057EOF
aurel32178baee2008-12-08 18:11:57 +00001058 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001059 curses=yes
1060 fi
1061fi # test "$curses"
1062
blueswir1414f0da2008-08-15 18:20:52 +00001063##########################################
balrogfb599c92008-09-28 23:49:55 +00001064# bluez support probe
1065if test "$bluez" = "yes" ; then
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001066 `pkg-config bluez 2> /dev/null` || bluez="no"
balrogfb599c92008-09-28 23:49:55 +00001067fi
1068if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001069 cat > $TMPC << EOF
1070#include <bluetooth/bluetooth.h>
1071int main(void) { return bt_error(0); }
1072EOF
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001073 bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1074 bluez_libs=`pkg-config --libs bluez 2> /dev/null`
balrog17e15922008-10-11 12:00:42 +00001075 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001076 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001077 :
1078 else
1079 bluez="no"
1080 fi
balrogfb599c92008-09-28 23:49:55 +00001081fi
1082
1083##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001084# kvm probe
1085if test "$kvm" = "yes" ; then
1086 cat > $TMPC <<EOF
1087#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001088#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001089#error Invalid KVM version
1090#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001091#if !defined(KVM_CAP_USER_MEMORY)
1092#error Missing KVM capability KVM_CAP_USER_MEMORY
1093#endif
1094#if !defined(KVM_CAP_SET_TSS_ADDR)
1095#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1096#endif
1097#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1098#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1099#endif
aliguori7ba1e612008-11-05 16:04:33 +00001100int main(void) { return 0; }
1101EOF
aliguorieac30262008-11-05 16:28:56 +00001102 if test "$kerneldir" != "" ; then
1103 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001104 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1105 -a -d "$kerneldir/arch/x86/include" ; then
1106 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001107 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1108 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001109 elif test -d "$kerneldir/arch/$cpu/include" ; then
1110 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1111 fi
aliguorieac30262008-11-05 16:28:56 +00001112 else
1113 kvm_cflags=""
1114 fi
aliguori7ba1e612008-11-05 16:04:33 +00001115 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001116 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001117 :
1118 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001119 kvm="no";
1120 if [ -x "`which awk 2>/dev/null`" ] && \
1121 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001122 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001123 | grep "error: " \
1124 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1125 if test "$kvmerr" != "" ; then
1126 kvm="no - (${kvmerr})"
1127 fi
1128 fi
aliguori7ba1e612008-11-05 16:04:33 +00001129 fi
1130fi
1131
1132##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001133# pthread probe
1134PTHREADLIBS=""
aliguori3c529d92008-12-12 16:41:40 +00001135
aliguorie5d355d2009-04-24 18:03:15 +00001136if test "$pthread" = yes; then
1137 pthread=no
1138cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001139#include <pthread.h>
blueswir1c9db92f2009-01-17 06:49:15 +00001140int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001141EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001142 if $cc $ARCH_CFLAGS -o $TMPE $PTHREADLIBS $TMPC 2> /dev/null > /dev/null ; then
aliguorie5d355d2009-04-24 18:03:15 +00001143 pthread=yes
1144 PTHREADLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +00001145 fi
1146fi
1147
aliguorie5d355d2009-04-24 18:03:15 +00001148if test "$pthread" = no; then
1149 aio=no
1150 io_thread=no
1151fi
1152
aliguoribf9298b2008-12-05 20:05:26 +00001153##########################################
1154# iovec probe
1155cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001156#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001157#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001158#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001159int main(void) { struct iovec iov; return 0; }
1160EOF
1161iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001162if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001163 iovec=yes
1164fi
1165
aurel32f652e6a2008-12-16 10:43:48 +00001166##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001167# preadv probe
1168cat > $TMPC <<EOF
1169#include <sys/types.h>
1170#include <sys/uio.h>
1171#include <unistd.h>
1172int main(void) { preadv; }
1173EOF
1174preadv=no
1175if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1176 preadv=yes
1177fi
1178
1179##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001180# fdt probe
1181if test "$fdt" = "yes" ; then
1182 fdt=no
1183 cat > $TMPC << EOF
1184int main(void) { return 0; }
1185EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001186 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null > /dev/null ; then
aurel32f652e6a2008-12-16 10:43:48 +00001187 fdt=yes
1188 fi
1189fi
1190
aurel323b3f24a2009-04-15 16:12:13 +00001191#
1192# Check for xxxat() functions when we are building linux-user
1193# emulator. This is done because older glibc versions don't
1194# have syscall stubs for these implemented.
1195#
1196atfile=no
1197if [ "$linux_user" = "yes" ] ; then
1198 cat > $TMPC << EOF
1199#define _ATFILE_SOURCE
1200#include <sys/types.h>
1201#include <fcntl.h>
1202#include <unistd.h>
1203
1204int
1205main(void)
1206{
1207 /* try to unlink nonexisting file */
1208 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1209}
1210EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001211 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001212 atfile=yes
1213 fi
1214fi
1215
aurel3239386ac2009-04-15 19:48:17 +00001216# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001217# emulator. This is done because older glibc versions don't
1218# have syscall stubs for these implemented. In that case we
1219# don't provide them even if kernel supports them.
1220#
1221inotify=no
1222if [ "$linux_user" = "yes" ] ; then
1223 cat > $TMPC << EOF
1224#include <sys/inotify.h>
1225
1226int
1227main(void)
1228{
1229 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001230 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001231}
1232EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001233 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001234 inotify=yes
1235 fi
1236fi
1237
pbrookcc8ae6d2006-04-23 17:57:59 +00001238# Check if tools are available to build documentation.
Anthony Liguori70ec5dc2009-05-14 08:25:04 -05001239if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
1240 build_docs="no"
pbrookcc8ae6d2006-04-23 17:57:59 +00001241fi
1242
aliguorida93a1f2008-12-12 20:02:52 +00001243##########################################
1244# Do we need librt
aliguorie5d355d2009-04-24 18:03:15 +00001245CLOCKLIBS=""
aliguorida93a1f2008-12-12 20:02:52 +00001246cat > $TMPC <<EOF
1247#include <signal.h>
1248#include <time.h>
1249int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1250EOF
1251
1252rt=no
balrog8c7f7572008-12-15 03:15:36 +00001253if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001254 :
balrog8c7f7572008-12-15 03:15:36 +00001255elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001256 rt=yes
1257fi
1258
1259if test "$rt" = "yes" ; then
aliguorie5d355d2009-04-24 18:03:15 +00001260 CLOCKLIBS="-lrt"
aliguorida93a1f2008-12-12 20:02:52 +00001261fi
1262
bellard11d9f692004-04-02 20:55:59 +00001263if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001264 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001265 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001266 fi
1267 mansuffix=""
1268 datasuffix=""
1269 docsuffix=""
1270 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001271else
pbrook308c3592007-02-27 00:52:01 +00001272 if test -z "$prefix" ; then
1273 prefix="/usr/local"
1274 fi
1275 mansuffix="/share/man"
1276 datasuffix="/share/qemu"
1277 docsuffix="/share/doc/qemu"
1278 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001279fi
bellard5a671352003-10-01 00:13:48 +00001280
bellard43ce4df2003-06-09 19:53:12 +00001281echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001282echo "BIOS directory $prefix$datasuffix"
1283echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001284if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001285echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001286echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001287fi
bellard5a671352003-10-01 00:13:48 +00001288echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001289echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001290echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001291echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001292echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001293echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001294echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001295echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001296echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00001297echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00001298echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001299echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001300echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001301echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001302echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001303echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001304if test "$darwin" = "yes" ; then
1305 echo "Cocoa support $cocoa"
1306fi
bellard97a847b2003-08-10 21:36:04 +00001307echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001308if test "$sdl" != "no" ; then
1309 echo "SDL static link $sdl_static"
1310fi
balrog4d3b6f62008-02-10 16:33:14 +00001311echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001312echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001313echo "Audio drivers $audio_drv_list"
1314echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001315echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001316echo "VNC TLS support $vnc_tls"
1317if test "$vnc_tls" = "yes" ; then
1318 echo " TLS CFLAGS $vnc_tls_cflags"
1319 echo " TLS LIBS $vnc_tls_libs"
1320fi
aliguori2f9606b2009-03-06 20:27:28 +00001321echo "VNC SASL support $vnc_sasl"
1322if test "$vnc_sasl" = "yes" ; then
1323 echo " SASL CFLAGS $vnc_sasl_cflags"
1324 echo " SASL LIBS $vnc_sasl_libs"
1325fi
blueswir131422552007-04-16 18:27:06 +00001326if test -n "$sparc_cpu"; then
1327 echo "Target Sparc Arch $sparc_cpu"
1328fi
bellard07f4ddb2005-04-23 17:44:28 +00001329echo "kqemu support $kqemu"
aliguorie37630c2009-04-22 15:19:10 +00001330echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00001331echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001332echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001333[ ! -z "$uname_release" ] && \
1334echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001335echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001336echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001337echo "AIO support $aio"
aliguorie5d355d2009-04-24 18:03:15 +00001338echo "IO thread $io_thread"
ths77755342008-11-27 15:45:16 +00001339echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001340echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001341echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001342echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001343
bellard97a847b2003-08-10 21:36:04 +00001344if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001345echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001346fi
bellard24b55b92005-03-01 22:30:41 +00001347#if test "$sdl_static" = "no"; then
1348# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1349#fi
bellard97a847b2003-08-10 21:36:04 +00001350config_mak="config-host.mak"
1351config_h="config-host.h"
1352
bellard7c1f25b2004-04-22 00:02:08 +00001353#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001354
ths15d9ca02007-07-31 23:07:32 +00001355test -f $config_h && mv $config_h ${config_h}~
1356
bellard97a847b2003-08-10 21:36:04 +00001357echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001358printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001359printf " '%s'" "$0" "$@" >> $config_mak
1360echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001361echo "/* Automatically generated by configure - do not modify */" > $config_h
1362
1363echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001364echo "bindir=\${prefix}$binsuffix" >> $config_mak
1365echo "mandir=\${prefix}$mansuffix" >> $config_mak
1366echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001367echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001368echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001369echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001370echo "INSTALL=$install" >> $config_mak
aliguori58f8aea2009-04-18 15:36:02 +00001371echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1372echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1373echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001374echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001375echo "HOST_CC=$host_cc" >> $config_mak
1376echo "AR=$ar" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001377# XXX: only use CFLAGS and LDFLAGS ?
1378# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1379# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001380echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001381echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1382echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1383echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001384echo "CFLAGS=$CFLAGS" >> $config_mak
1385echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001386echo "EXESUF=$EXESUF" >> $config_mak
aliguorie5d355d2009-04-24 18:03:15 +00001387echo "PTHREADLIBS=$PTHREADLIBS" >> $config_mak
1388echo "CLOCKLIBS=$CLOCKLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001389case "$cpu" in
1390 i386)
1391 echo "ARCH=i386" >> $config_mak
1392 echo "#define HOST_I386 1" >> $config_h
1393 ;;
1394 x86_64)
1395 echo "ARCH=x86_64" >> $config_mak
1396 echo "#define HOST_X86_64 1" >> $config_h
1397 ;;
1398 alpha)
1399 echo "ARCH=alpha" >> $config_mak
1400 echo "#define HOST_ALPHA 1" >> $config_h
1401 ;;
1402 armv4b)
1403 echo "ARCH=arm" >> $config_mak
1404 echo "#define HOST_ARM 1" >> $config_h
1405 ;;
1406 armv4l)
1407 echo "ARCH=arm" >> $config_mak
1408 echo "#define HOST_ARM 1" >> $config_h
1409 ;;
1410 cris)
1411 echo "ARCH=cris" >> $config_mak
1412 echo "#define HOST_CRIS 1" >> $config_h
1413 ;;
1414 hppa)
1415 echo "ARCH=hppa" >> $config_mak
1416 echo "#define HOST_HPPA 1" >> $config_h
1417 ;;
1418 ia64)
1419 echo "ARCH=ia64" >> $config_mak
1420 echo "#define HOST_IA64 1" >> $config_h
1421 ;;
1422 m68k)
1423 echo "ARCH=m68k" >> $config_mak
1424 echo "#define HOST_M68K 1" >> $config_h
1425 ;;
1426 mips)
1427 echo "ARCH=mips" >> $config_mak
1428 echo "#define HOST_MIPS 1" >> $config_h
1429 ;;
1430 mips64)
1431 echo "ARCH=mips64" >> $config_mak
1432 echo "#define HOST_MIPS64 1" >> $config_h
1433 ;;
malcfdf7ed92009-01-14 18:39:52 +00001434 ppc)
1435 echo "ARCH=ppc" >> $config_mak
1436 echo "#define HOST_PPC 1" >> $config_h
1437 ;;
1438 ppc64)
1439 echo "ARCH=ppc64" >> $config_mak
1440 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001441 ;;
1442 s390)
1443 echo "ARCH=s390" >> $config_mak
1444 echo "#define HOST_S390 1" >> $config_h
1445 ;;
1446 sparc)
1447 echo "ARCH=sparc" >> $config_mak
1448 echo "#define HOST_SPARC 1" >> $config_h
1449 ;;
1450 sparc64)
1451 echo "ARCH=sparc64" >> $config_mak
1452 echo "#define HOST_SPARC64 1" >> $config_h
1453 ;;
1454 *)
1455 echo "Unsupported CPU = $cpu"
1456 exit 1
1457 ;;
1458esac
aurel32f8393942009-04-13 18:45:38 +00001459if test "$debug_tcg" = "yes" ; then
1460 echo "#define DEBUG_TCG 1" >> $config_h
1461fi
aliguori03b4fe72008-10-07 19:16:17 +00001462if test "$sparse" = "yes" ; then
1463 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1464 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1465 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1466fi
aliguori1625af82009-04-05 17:41:02 +00001467if test "$strip_opt" = "yes" ; then
1468 echo "STRIP_OPT=-s" >> $config_mak
1469fi
bellard7d132992003-03-06 23:23:54 +00001470if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001471 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1472 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1473fi
bellardb6853692005-06-05 17:10:39 +00001474echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001475if test "$mingw32" = "yes" ; then
1476 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001477 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001478else
1479 cat > $TMPC << EOF
1480#include <byteswap.h>
1481int main(void) { return bswap_32(0); }
1482EOF
aurel32178baee2008-12-08 18:11:57 +00001483 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001484 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1485 fi
blueswir113606772008-12-05 17:54:09 +00001486 cat > $TMPC << EOF
1487#include <sys/endian.h>
1488#include <sys/types.h>
1489#include <machine/bswap.h>
1490int main(void) { return bswap32(0); }
1491EOF
aurel32178baee2008-12-08 18:11:57 +00001492 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001493 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1494 fi
bellard67b915a2004-03-31 23:37:16 +00001495fi
blueswir1128ab2f2008-08-15 18:33:42 +00001496
1497if [ "$openbsd" = "yes" ] ; then
1498 echo "#define ENOTSUP 4096" >> $config_h
1499fi
1500
bellard83fb7ad2004-07-05 21:25:26 +00001501if test "$darwin" = "yes" ; then
1502 echo "CONFIG_DARWIN=yes" >> $config_mak
1503 echo "#define CONFIG_DARWIN 1" >> $config_h
1504fi
malcb29fe3e2008-11-18 01:42:22 +00001505
1506if test "$aix" = "yes" ; then
1507 echo "CONFIG_AIX=yes" >> $config_mak
1508 echo "#define CONFIG_AIX 1" >> $config_h
1509fi
1510
bellardec530c82006-04-25 22:36:06 +00001511if test "$solaris" = "yes" ; then
1512 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001513 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001514 if test "$needs_libsunmath" = "yes" ; then
1515 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1516 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1517 fi
bellardec530c82006-04-25 22:36:06 +00001518fi
blueswir131422552007-04-16 18:27:06 +00001519if test -n "$sparc_cpu"; then
1520 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1521 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1522fi
bellard97a847b2003-08-10 21:36:04 +00001523if test "$gprof" = "yes" ; then
1524 echo "TARGET_GPROF=yes" >> $config_mak
1525 echo "#define HAVE_GPROF 1" >> $config_h
1526fi
1527if test "$static" = "yes" ; then
1528 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001529 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001530fi
bellard05c2a3e2006-02-08 22:39:17 +00001531if test $profiler = "yes" ; then
1532 echo "#define CONFIG_PROFILER 1" >> $config_h
1533fi
bellardc20709a2004-04-21 23:27:19 +00001534if test "$slirp" = "yes" ; then
1535 echo "CONFIG_SLIRP=yes" >> $config_mak
1536 echo "#define CONFIG_SLIRP 1" >> $config_h
1537fi
ths8a16d272008-07-19 09:56:24 +00001538if test "$vde" = "yes" ; then
1539 echo "CONFIG_VDE=yes" >> $config_mak
1540 echo "#define CONFIG_VDE 1" >> $config_h
1541 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1542fi
malc0c58ac12008-06-25 21:04:05 +00001543for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001544 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001545 echo "$def=yes" >> $config_mak
1546 echo "#define $def 1" >> $config_h
1547done
1548echo "#define AUDIO_DRIVERS \\" >> $config_h
1549for drv in $audio_drv_list; do
1550 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001551 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001552 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001553 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001554 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1555 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001556 elif test "$drv" = "oss"; then
1557 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001558 fi
1559done
1560echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001561if test "$mixemu" = "yes" ; then
1562 echo "CONFIG_MIXEMU=yes" >> $config_mak
1563 echo "#define CONFIG_MIXEMU 1" >> $config_h
1564fi
ths8d5d2d42007-08-25 01:37:51 +00001565if test "$vnc_tls" = "yes" ; then
1566 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1567 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1568 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1569 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1570fi
aliguori2f9606b2009-03-06 20:27:28 +00001571if test "$vnc_sasl" = "yes" ; then
1572 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1573 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1574 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1575 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1576fi
aliguori76655d62009-03-06 20:27:37 +00001577if test "$fnmatch" = "yes" ; then
1578 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1579fi
pbrookb1a550a2006-04-16 13:28:56 +00001580qemu_version=`head $source_path/VERSION`
1581echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001582echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001583
pbrook4a19f1e2009-04-07 23:17:49 +00001584echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1585
bellard97a847b2003-08-10 21:36:04 +00001586echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001587if [ "$source_path_used" = "yes" ]; then
1588 echo "VPATH=$source_path" >> $config_mak
1589fi
bellard97a847b2003-08-10 21:36:04 +00001590echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001591if [ "$build_docs" = "yes" ] ; then
1592 echo "BUILD_DOCS=yes" >> $config_mak
1593fi
bellard49ecc3f2007-11-07 19:25:15 +00001594if test "$static" = "yes"; then
1595 sdl1=$sdl_static
1596else
1597 sdl1=$sdl
1598fi
1599if test "$sdl1" = "yes" ; then
1600 echo "#define CONFIG_SDL 1" >> $config_h
1601 echo "CONFIG_SDL=yes" >> $config_mak
1602 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1603 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001604 elif test "$sdl_x11" = "yes" ; then
1605 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001606 else
1607 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1608 fi
1609 if [ "${aa}" = "yes" ] ; then
1610 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1611 else
1612 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1613 fi
1614fi
1615if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001616 echo "#define CONFIG_COCOA 1" >> $config_h
1617 echo "CONFIG_COCOA=yes" >> $config_mak
1618fi
1619if test "$curses" = "yes" ; then
1620 echo "#define CONFIG_CURSES 1" >> $config_h
1621 echo "CONFIG_CURSES=yes" >> $config_mak
1622 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001623fi
aurel323b3f24a2009-04-15 16:12:13 +00001624if test "$atfile" = "yes" ; then
1625 echo "#define CONFIG_ATFILE 1" >> $config_h
1626fi
1627if test "$inotify" = "yes" ; then
1628 echo "#define CONFIG_INOTIFY 1" >> $config_h
1629fi
aurel322e4d9fb2008-04-08 06:01:02 +00001630if test "$brlapi" = "yes" ; then
1631 echo "CONFIG_BRLAPI=yes" >> $config_mak
1632 echo "#define CONFIG_BRLAPI 1" >> $config_h
1633 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1634fi
balrogfb599c92008-09-28 23:49:55 +00001635if test "$bluez" = "yes" ; then
1636 echo "CONFIG_BLUEZ=yes" >> $config_mak
1637 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1638 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1639 echo "#define CONFIG_BLUEZ 1" >> $config_h
1640fi
aliguorie37630c2009-04-22 15:19:10 +00001641if test "$xen" = "yes" ; then
aliguori9306acb2009-04-22 15:19:44 +00001642 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
aliguorie37630c2009-04-22 15:19:10 +00001643fi
blueswir1414f0da2008-08-15 18:20:52 +00001644if test "$aio" = "yes" ; then
1645 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001646 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001647fi
aliguorie5d355d2009-04-24 18:03:15 +00001648if test "$io_thread" = "yes" ; then
1649 echo "CONFIG_IOTHREAD=yes" >> $config_mak
1650 echo "#define CONFIG_IOTHREAD 1" >> $config_h
1651fi
ths77755342008-11-27 15:45:16 +00001652if test "$blobs" = "yes" ; then
1653 echo "INSTALL_BLOBS=yes" >> $config_mak
1654fi
aliguoribf9298b2008-12-05 20:05:26 +00001655if test "$iovec" = "yes" ; then
1656 echo "#define HAVE_IOVEC 1" >> $config_h
1657fi
aliguoriceb42de2009-04-07 18:43:28 +00001658if test "$preadv" = "yes" ; then
1659 echo "#define HAVE_PREADV 1" >> $config_h
1660fi
aurel32f652e6a2008-12-16 10:43:48 +00001661if test "$fdt" = "yes" ; then
1662 echo "#define HAVE_FDT 1" >> $config_h
1663 echo "FDT_LIBS=-lfdt" >> $config_mak
1664fi
bellard97a847b2003-08-10 21:36:04 +00001665
bellard83fb7ad2004-07-05 21:25:26 +00001666# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001667if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001668 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001669 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001670 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001671fi
1672
pbrookc5937222006-05-14 11:30:38 +00001673echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1674
blueswir168063642008-11-22 21:03:55 +00001675# USB host support
1676case "$usb" in
1677linux)
1678 echo "HOST_USB=linux" >> $config_mak
1679;;
1680bsd)
1681 echo "HOST_USB=bsd" >> $config_mak
1682;;
1683*)
1684 echo "HOST_USB=stub" >> $config_mak
1685;;
1686esac
1687
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001688# Determine what linker flags to use to force archive inclusion
1689check_linker_flags()
1690{
1691 $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 -Wl,$2 >/dev/null 2>/dev/null
1692}
1693
1694cat > $TMPC << EOF
1695int main(void) { }
1696EOF
1697if check_linker_flags --whole-archive --no-whole-archive ; then
1698 # GNU ld
1699 echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_mak
1700 echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_mak
1701elif check_linker_flags -z,allextract -z,defaultextract ; then
1702 # Solaris ld
1703 echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_mak
1704 echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_mak
1705else
1706 echo "Error: your linker does not support --whole-archive or -z."
1707 echo "Please report to qemu-devel@nongnu.org"
1708 exit 1
1709fi
1710
pbrookc39e3332007-09-22 16:49:14 +00001711tools=
1712if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001713 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001714 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001715 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001716 fi
pbrookc39e3332007-09-22 16:49:14 +00001717fi
1718echo "TOOLS=$tools" >> $config_mak
1719
ths15d9ca02007-07-31 23:07:32 +00001720test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001721config_host_mak=${config_mak}
ths15d9ca02007-07-31 23:07:32 +00001722
bellard1d14ffa2005-10-30 18:58:22 +00001723for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001724target_dir="$target"
1725config_mak=$target_dir/config.mak
1726config_h=$target_dir/config.h
1727target_cpu=`echo $target | cut -d '-' -f 1`
1728target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001729[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001730[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1731[ "$target_cpu" = "mips" ] && target_bigendian=yes
1732[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1733[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001734[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001735[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001736[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001737[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001738[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001739[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1740[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1741[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001742target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001743target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001744target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001745target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001746target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001747case "$target" in
1748 ${target_cpu}-softmmu)
1749 target_softmmu="yes"
1750 ;;
1751 ${target_cpu}-linux-user)
1752 target_user_only="yes"
1753 target_linux_user="yes"
1754 ;;
1755 ${target_cpu}-darwin-user)
1756 target_user_only="yes"
1757 target_darwin_user="yes"
1758 ;;
blueswir184778502008-10-26 20:33:16 +00001759 ${target_cpu}-bsd-user)
1760 target_user_only="yes"
1761 target_bsd_user="yes"
1762 ;;
pbrook9e407a82007-05-26 16:38:53 +00001763 *)
1764 echo "ERROR: Target '$target' not recognised"
1765 exit 1
1766 ;;
1767esac
ths831b7822007-01-18 20:06:33 +00001768
bellard7c1f25b2004-04-22 00:02:08 +00001769#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001770
ths15d9ca02007-07-31 23:07:32 +00001771test -f $config_h && mv $config_h ${config_h}~
1772
bellard97a847b2003-08-10 21:36:04 +00001773mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001774mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001775mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001776if 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 +00001777 mkdir -p $target_dir/nwfpe
1778fi
1779
bellardec530c82006-04-25 22:36:06 +00001780#
1781# don't use ln -sf as not all "ln -sf" over write the file/link
1782#
1783rm -f $target_dir/Makefile
1784ln -s $source_path/Makefile.target $target_dir/Makefile
1785
bellard97a847b2003-08-10 21:36:04 +00001786
1787echo "# Automatically generated by configure - do not modify" > $config_mak
1788echo "/* Automatically generated by configure - do not modify */" > $config_h
1789
1790
1791echo "include ../config-host.mak" >> $config_mak
1792echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001793
pbrooke5fe0c52006-06-11 13:32:59 +00001794bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001795elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001796target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001797interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1798echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001799gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001800
aliguori5985ece2008-11-05 19:59:25 +00001801# Make sure the target and host cpus are compatible
1802if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001803 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001804 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1805 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001806 kvm="no"
1807fi
1808# Disable KVM for linux-user
1809if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1810 kvm="no"
1811fi
1812
aurel322408a522008-04-20 20:19:44 +00001813case "$target_cpu" in
1814 i386)
1815 echo "TARGET_ARCH=i386" >> $config_mak
1816 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1817 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001818 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001819 then
blueswir12d6ebb02009-04-18 19:25:43 +00001820 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001821 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001822 fi
aliguori7ba1e612008-11-05 16:04:33 +00001823 if test "$kvm" = "yes" ; then
1824 echo "CONFIG_KVM=yes" >> $config_mak
1825 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001826 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001827 fi
aliguorie37630c2009-04-22 15:19:10 +00001828 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1829 then
1830 echo "CONFIG_XEN=yes" >> $config_mak
1831 echo "#define CONFIG_XEN 1" >> $config_h
1832 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001833 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001834 ;;
1835 x86_64)
1836 echo "TARGET_ARCH=x86_64" >> $config_mak
1837 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1838 echo "#define TARGET_I386 1" >> $config_h
1839 echo "#define TARGET_X86_64 1" >> $config_h
1840 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1841 then
blueswir12d6ebb02009-04-18 19:25:43 +00001842 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001843 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001844 fi
aliguori7ba1e612008-11-05 16:04:33 +00001845 if test "$kvm" = "yes" ; then
1846 echo "CONFIG_KVM=yes" >> $config_mak
1847 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1848 echo "#define CONFIG_KVM 1" >> $config_h
1849 fi
aliguorie37630c2009-04-22 15:19:10 +00001850 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1851 then
1852 echo "CONFIG_XEN=yes" >> $config_mak
1853 echo "#define CONFIG_XEN 1" >> $config_h
1854 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001855 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001856 ;;
1857 alpha)
1858 echo "TARGET_ARCH=alpha" >> $config_mak
1859 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1860 echo "#define TARGET_ALPHA 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001861 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001862 ;;
1863 arm|armeb)
1864 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001865 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1866 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001867 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001868 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001869 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001870 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001871 ;;
1872 cris)
1873 echo "TARGET_ARCH=cris" >> $config_mak
1874 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1875 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001876 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001877 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001878 ;;
1879 m68k)
1880 echo "TARGET_ARCH=m68k" >> $config_mak
1881 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1882 echo "#define TARGET_M68K 1" >> $config_h
1883 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001884 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001885 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001886 ;;
1887 mips|mipsel)
1888 echo "TARGET_ARCH=mips" >> $config_mak
1889 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1890 echo "#define TARGET_MIPS 1" >> $config_h
1891 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001892 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001893 ;;
1894 mipsn32|mipsn32el)
1895 echo "TARGET_ARCH=mipsn32" >> $config_mak
1896 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1897 echo "#define TARGET_MIPS 1" >> $config_h
1898 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001899 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001900 ;;
1901 mips64|mips64el)
1902 echo "TARGET_ARCH=mips64" >> $config_mak
1903 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1904 echo "#define TARGET_MIPS 1" >> $config_h
1905 echo "#define TARGET_MIPS64 1" >> $config_h
1906 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001907 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001908 ;;
1909 ppc)
1910 echo "TARGET_ARCH=ppc" >> $config_mak
1911 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1912 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001913 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001914 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001915 ;;
1916 ppcemb)
1917 echo "TARGET_ARCH=ppcemb" >> $config_mak
1918 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1919 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1920 echo "#define TARGET_PPC 1" >> $config_h
1921 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001922 if test "$kvm" = "yes" ; then
1923 echo "CONFIG_KVM=yes" >> $config_mak
1924 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1925 echo "#define CONFIG_KVM 1" >> $config_h
1926 fi
aurel32c8b35322009-01-24 15:07:34 +00001927 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001928 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001929 ;;
1930 ppc64)
1931 echo "TARGET_ARCH=ppc64" >> $config_mak
1932 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1933 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1934 echo "#define TARGET_PPC 1" >> $config_h
1935 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001936 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001937 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001938 ;;
1939 ppc64abi32)
1940 echo "TARGET_ARCH=ppc64" >> $config_mak
1941 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1942 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1943 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1944 echo "#define TARGET_PPC 1" >> $config_h
1945 echo "#define TARGET_PPC64 1" >> $config_h
1946 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001947 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001948 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001949 ;;
1950 sh4|sh4eb)
1951 echo "TARGET_ARCH=sh4" >> $config_mak
1952 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1953 echo "#define TARGET_SH4 1" >> $config_h
1954 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001955 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001956 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001957 ;;
1958 sparc)
1959 echo "TARGET_ARCH=sparc" >> $config_mak
1960 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1961 echo "#define TARGET_SPARC 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001962 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001963 ;;
1964 sparc64)
1965 echo "TARGET_ARCH=sparc64" >> $config_mak
1966 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1967 echo "#define TARGET_SPARC 1" >> $config_h
1968 echo "#define TARGET_SPARC64 1" >> $config_h
1969 elfload32="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001970 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001971 ;;
1972 sparc32plus)
1973 echo "TARGET_ARCH=sparc64" >> $config_mak
1974 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1975 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1976 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1977 echo "#define TARGET_SPARC 1" >> $config_h
1978 echo "#define TARGET_SPARC64 1" >> $config_h
1979 echo "#define TARGET_ABI32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001980 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001981 ;;
1982 *)
1983 echo "Unsupported target CPU"
1984 exit 1
1985 ;;
1986esac
Paul Brook1ad21342009-05-19 16:17:58 +01001987if [ $target_phys_bits -lt $hostlongbits ] ; then
1988 target_phys_bits=$hostlongbits
1989fi
1990echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
1991echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h
1992echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00001993if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001994 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1995 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1996fi
1997if test "$target_softmmu" = "yes" ; then
1998 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1999 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00002000fi
bellard997344f2003-10-27 21:10:39 +00002001if test "$target_user_only" = "yes" ; then
2002 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2003 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2004fi
ths831b7822007-01-18 20:06:33 +00002005if test "$target_linux_user" = "yes" ; then
2006 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2007 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2008fi
2009if test "$target_darwin_user" = "yes" ; then
2010 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2011 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2012fi
pbrook56aebc82008-10-11 17:55:29 +00002013list=""
2014if test ! -z "$gdb_xml_files" ; then
2015 for x in $gdb_xml_files; do
2016 list="$list $source_path/gdb-xml/$x"
2017 done
2018fi
2019echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00002020
aurel320938cda2008-04-11 21:36:06 +00002021if test "$target_cpu" = "arm" \
2022 -o "$target_cpu" = "armeb" \
2023 -o "$target_cpu" = "m68k" \
2024 -o "$target_cpu" = "mips" \
2025 -o "$target_cpu" = "mipsel" \
2026 -o "$target_cpu" = "mipsn32" \
2027 -o "$target_cpu" = "mipsn32el" \
2028 -o "$target_cpu" = "mips64" \
2029 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00002030 -o "$target_cpu" = "ppc" \
2031 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00002032 -o "$target_cpu" = "ppc64abi32" \
2033 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00002034 -o "$target_cpu" = "sparc" \
2035 -o "$target_cpu" = "sparc64" \
2036 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00002037 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2038 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2039fi
pbrooke5fe0c52006-06-11 13:32:59 +00002040if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2041 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2042 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2043fi
pbrookbd0c5662008-05-29 14:34:11 +00002044if test "$target_user_only" = "yes" \
2045 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2046 echo "#define USE_NPTL 1" >> $config_h
2047fi
blueswir1cb33da52007-10-09 16:34:29 +00002048# 32 bit ELF loader in addition to native 64 bit loader?
2049if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2050 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2051 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2052fi
blueswir184778502008-10-26 20:33:16 +00002053if test "$target_bsd_user" = "yes" ; then
2054 echo "CONFIG_BSD_USER=yes" >> $config_mak
2055 echo "#define CONFIG_BSD_USER 1" >> $config_h
2056fi
bellard5b0753e2005-03-01 21:37:28 +00002057
ths15d9ca02007-07-31 23:07:32 +00002058test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2059
bellard97a847b2003-08-10 21:36:04 +00002060done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00002061
2062# build tree in object directory if source path is different from current one
2063if test "$source_path_used" = "yes" ; then
Anthony Liguori019d6b82009-05-09 17:14:19 -05002064 DIRS="tests tests/cris slirp audio block"
bellard7d132992003-03-06 23:23:54 +00002065 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00002066 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00002067 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00002068 for dir in $DIRS ; do
2069 mkdir -p $dir
2070 done
bellardec530c82006-04-25 22:36:06 +00002071 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00002072 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00002073 rm -f $f
2074 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00002075 done
2076fi
Paul Brook1ad21342009-05-19 16:17:58 +01002077
2078for hwlib in 32 64; do
2079 d=libhw$hwlib
2080 mkdir -p $d
2081 rm -f $d/Makefile
2082 ln -s $source_path/Makefile.hw $d/Makefile
2083 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2084 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2085done