blob: b6d18d1453fc36e99e510b9477556e6a137089fc [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 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200130 microblaze)
131 cpu="microblaze"
132 ;;
bellard7d132992003-03-06 23:23:54 +0000133 mips)
134 cpu="mips"
135 ;;
thsfbe4f652007-04-01 11:16:48 +0000136 mips64)
137 cpu="mips64"
138 ;;
malcfdf7ed92009-01-14 18:39:52 +0000139 ppc)
140 cpu="ppc"
141 ;;
142 ppc64)
143 cpu="ppc64"
thse7daa602007-10-08 13:38:27 +0000144 ;;
ths0e7b8a92007-08-01 00:09:31 +0000145 s390*)
bellardfb3e5842003-03-29 17:32:36 +0000146 cpu="s390"
147 ;;
blueswir131422552007-04-16 18:27:06 +0000148 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000149 cpu="sparc"
150 ;;
151 sparc64)
152 cpu="sparc64"
153 ;;
bellard7d132992003-03-06 23:23:54 +0000154 *)
155 cpu="unknown"
156 ;;
157esac
158gprof="no"
aurel32f8393942009-04-13 18:45:38 +0000159debug_tcg="no"
aliguori03b4fe72008-10-07 19:16:17 +0000160sparse="no"
aliguori1625af82009-04-05 17:41:02 +0000161strip_opt="yes"
bellard7d132992003-03-06 23:23:54 +0000162bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000163mingw32="no"
164EXESUF=""
bellard443f1372004-06-04 11:13:20 +0000165slirp="yes"
aliguorie0e6c8c02008-07-23 18:14:33 +0000166vde="yes"
bellard102a52e2004-11-14 19:57:29 +0000167fmod_lib=""
168fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000169oss_lib=""
ths8d5d2d42007-08-25 01:37:51 +0000170vnc_tls="yes"
aliguori2f9606b2009-03-06 20:27:28 +0000171vnc_sasl="yes"
pbrookb1a550a2006-04-16 13:28:56 +0000172bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000173linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000174solaris="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000175kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000176profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000177cocoa="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000178softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000179linux_user="no"
180darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000181bsd_user="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500182build_docs="yes"
pbrookc5937222006-05-14 11:30:38 +0000183uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000184curses="yes"
Alexander Graf769ce762009-05-11 17:41:42 +0200185curl="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000186pthread="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000187aio="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000188io_thread="no"
pbrookbd0c5662008-05-29 14:34:11 +0000189nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000190mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000191bluez="yes"
aliguori7ba1e612008-11-05 16:04:33 +0000192kvm="yes"
aliguorieac30262008-11-05 16:28:56 +0000193kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000194aix="no"
ths77755342008-11-27 15:45:16 +0000195blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000196fdt="yes"
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500197sdl="yes"
aliguori5368a422009-03-03 17:37:21 +0000198sdl_x11="no"
aliguorie37630c2009-04-22 15:19:10 +0000199xen="yes"
pbrook4a19f1e2009-04-07 23:17:49 +0000200pkgversion=""
bellard7d132992003-03-06 23:23:54 +0000201
202# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000203if check_define __linux__ ; then
204 targetos="Linux"
205elif check_define _WIN32 ; then
206 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000207elif check_define __OpenBSD__ ; then
208 targetos='OpenBSD'
209elif check_define __sun__ ; then
210 targetos='SunOS'
aliguoriac0df512008-12-29 17:14:15 +0000211else
212 targetos=`uname -s`
213fi
bellard7d132992003-03-06 23:23:54 +0000214case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000215CYGWIN*)
216mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000217OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000218if [ "$cpu" = "i386" ] ; then
219 kqemu="yes"
220fi
malcc2de5c92008-06-28 19:13:06 +0000221audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000222;;
bellard67b915a2004-03-31 23:37:16 +0000223MINGW32*)
224mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000225if [ "$cpu" = "i386" ] ; then
226 kqemu="yes"
227fi
malcc2de5c92008-06-28 19:13:06 +0000228audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000229;;
ths5c40d2b2007-06-23 16:03:36 +0000230GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000231audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000232audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000233if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
234 kqemu="yes"
235fi
236;;
bellard7d3505c2004-05-12 19:32:15 +0000237FreeBSD)
238bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000239audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000240audio_possible_drivers="oss sdl esd pa"
bellarde99f9062005-07-28 21:45:38 +0000241if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000242 kqemu="yes"
243fi
bellard7d3505c2004-05-12 19:32:15 +0000244;;
blueswir1c5e97232009-03-07 20:06:23 +0000245DragonFly)
246bsd="yes"
247audio_drv_list="oss"
248audio_possible_drivers="oss sdl esd pa"
249if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
250 kqemu="yes"
251fi
252aio="no"
253;;
bellard7d3505c2004-05-12 19:32:15 +0000254NetBSD)
255bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000256audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000257audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000258oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000259;;
260OpenBSD)
261bsd="yes"
blueswir1128ab2f2008-08-15 18:33:42 +0000262openbsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000263audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000264audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000265oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000266;;
bellard83fb7ad2004-07-05 21:25:26 +0000267Darwin)
268bsd="yes"
269darwin="yes"
aliguori1b0f9cc2009-01-26 15:37:40 +0000270# 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 +0000271if [ "$cpu" = "i386" ] ; then
272 is_x86_64=`sysctl -n hw.optional.x86_64`
273 [ "$is_x86_64" = "1" ] && cpu=x86_64
aliguori1b0f9cc2009-01-26 15:37:40 +0000274fi
275if [ "$cpu" = "x86_64" ] ; then
276 OS_CFLAGS="-arch x86_64"
277 LDFLAGS="-arch x86_64"
278else
279 OS_CFLAGS="-mdynamic-no-pic"
280fi
ths831b7822007-01-18 20:06:33 +0000281darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000282cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000283audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000284audio_possible_drivers="coreaudio sdl fmod"
thsc2c59c32008-01-08 00:00:20 +0000285OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
bellard83fb7ad2004-07-05 21:25:26 +0000286;;
bellardec530c82006-04-25 22:36:06 +0000287SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000288 solaris="yes"
289 make="gmake"
290 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000291 needs_libsunmath="no"
blueswir1acda94b2009-04-13 16:23:22 +0000292 kvm="no"
thsc2b84fa2007-02-10 23:21:21 +0000293 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000294 # have to select again, because `uname -m` returns i86pc
295 # even on an x86_64 box.
296 solariscpu=`isainfo -k`
297 if test "${solariscpu}" = "amd64" ; then
298 cpu="x86_64"
299 fi
thsc2b84fa2007-02-10 23:21:21 +0000300 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000301 if test "$solarisrev" -le 9 ; then
302 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
303 needs_libsunmath="yes"
304 else
305 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
306 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
307 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
308 echo "Studio 11 can be downloaded from www.sun.com."
309 exit 1
310 fi
311 fi
312 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000313 kqemu="yes"
314 fi
ths86b2bd92007-02-11 00:31:33 +0000315 fi
ths6b4d2ba2007-05-13 18:02:43 +0000316 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000317 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000318 fi
malcc2de5c92008-06-28 19:13:06 +0000319 audio_possible_drivers="oss sdl"
blueswir114d483e2009-04-13 16:27:08 +0000320 OS_CFLAGS=-std=gnu99
ths86b2bd92007-02-11 00:31:33 +0000321;;
malcb29fe3e2008-11-18 01:42:22 +0000322AIX)
323aix="yes"
324make="gmake"
325;;
bellard1d14ffa2005-10-30 18:58:22 +0000326*)
malc0c58ac12008-06-25 21:04:05 +0000327audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000328audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000329linux="yes"
ths831b7822007-01-18 20:06:33 +0000330linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000331usb="linux"
bellard07f4ddb2005-04-23 17:44:28 +0000332if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000333 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000334 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000335fi
bellardfb065182004-11-09 23:09:44 +0000336;;
bellard7d132992003-03-06 23:23:54 +0000337esac
338
bellard7d3505c2004-05-12 19:32:15 +0000339if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000340 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000341 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000342 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000343 fi
blueswir184778502008-10-26 20:33:16 +0000344 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000345fi
346
bellard7d132992003-03-06 23:23:54 +0000347# find source path
pbrookad064842006-04-16 12:41:07 +0000348source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000349source_path_used="no"
350workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000351if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000352 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000353else
354 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000355fi
pbrook724db112008-02-03 19:20:13 +0000356[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000357
bellard85aa5182007-11-11 20:17:03 +0000358werror="no"
bellard0d1e2392007-11-11 20:24:30 +0000359# generate compile errors on warnings for development builds
360#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
361#werror="yes";
362#fi
bellard85aa5182007-11-11 20:17:03 +0000363
bellard7d132992003-03-06 23:23:54 +0000364for opt do
pbrooka46e4032006-04-29 23:05:22 +0000365 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000366 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000367 --help|-h) show_help=yes
368 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000369 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000370 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000371 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000372 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000373 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000374 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000375 ;;
aliguoriac0df512008-12-29 17:14:15 +0000376 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000377 ;;
aliguoriac0df512008-12-29 17:14:15 +0000378 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000379 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000380 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000381 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000382 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000383 ;;
pbrook6a882642006-04-17 13:57:12 +0000384 --install=*) install="$optarg"
385 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000386 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000387 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000388 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000389 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000390 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000391 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000392 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000393 ;;
bellard7d132992003-03-06 23:23:54 +0000394 --enable-gprof) gprof="yes"
395 ;;
bellard43ce4df2003-06-09 19:53:12 +0000396 --static) static="yes"
397 ;;
bellard97a847b2003-08-10 21:36:04 +0000398 --disable-sdl) sdl="no"
399 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000400 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000401 ;;
malcc2de5c92008-06-28 19:13:06 +0000402 --fmod-inc=*) fmod_inc="$optarg"
403 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000404 --oss-lib=*) oss_lib="$optarg"
405 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000406 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000407 ;;
408 --audio-drv-list=*) audio_drv_list="$optarg"
409 ;;
aurel32f8393942009-04-13 18:45:38 +0000410 --enable-debug-tcg) debug_tcg="yes"
411 ;;
412 --disable-debug-tcg) debug_tcg="no"
413 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000414 --enable-sparse) sparse="yes"
415 ;;
416 --disable-sparse) sparse="no"
417 ;;
aliguori1625af82009-04-05 17:41:02 +0000418 --disable-strip) strip_opt="no"
419 ;;
ths8d5d2d42007-08-25 01:37:51 +0000420 --disable-vnc-tls) vnc_tls="no"
421 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000422 --disable-vnc-sasl) vnc_sasl="no"
423 ;;
bellard443f1372004-06-04 11:13:20 +0000424 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000425 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000426 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000427 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000428 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000429 ;;
aliguorie37630c2009-04-22 15:19:10 +0000430 --disable-xen) xen="no"
431 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000432 --disable-brlapi) brlapi="no"
433 ;;
balrogfb599c92008-09-28 23:49:55 +0000434 --disable-bluez) bluez="no"
435 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000436 --disable-kvm) kvm="no"
437 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000438 --enable-profiler) profiler="yes"
439 ;;
malcc2de5c92008-06-28 19:13:06 +0000440 --enable-cocoa)
441 cocoa="yes" ;
442 sdl="no" ;
443 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000444 ;;
pbrookcad25d62006-03-19 16:31:11 +0000445 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000446 ;;
pbrookcad25d62006-03-19 16:31:11 +0000447 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000448 ;;
ths831b7822007-01-18 20:06:33 +0000449 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000450 ;;
ths831b7822007-01-18 20:06:33 +0000451 --enable-linux-user) linux_user="yes"
452 ;;
453 --disable-darwin-user) darwin_user="no"
454 ;;
455 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000456 ;;
blueswir184778502008-10-26 20:33:16 +0000457 --disable-bsd-user) bsd_user="no"
458 ;;
459 --enable-bsd-user) bsd_user="yes"
460 ;;
pbrookc5937222006-05-14 11:30:38 +0000461 --enable-uname-release=*) uname_release="$optarg"
462 ;;
blueswir131422552007-04-16 18:27:06 +0000463 --sparc_cpu=*)
464 sparc_cpu="$optarg"
465 case $sparc_cpu in
466 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
467 target_cpu="sparc"; cpu="sparc" ;;
468 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
469 target_cpu="sparc"; cpu="sparc" ;;
470 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
471 target_cpu="sparc64"; cpu="sparc64" ;;
472 *) echo "undefined SPARC architecture. Exiting";exit 1;;
473 esac
474 ;;
bellard85aa5182007-11-11 20:17:03 +0000475 --enable-werror) werror="yes"
476 ;;
477 --disable-werror) werror="no"
478 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000479 --disable-curses) curses="no"
480 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200481 --disable-curl) curl="no"
482 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000483 --disable-nptl) nptl="no"
484 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000485 --enable-mixemu) mixemu="yes"
486 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000487 --disable-pthread) pthread="no"
488 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000489 --disable-aio) aio="no"
490 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000491 --enable-io-thread) io_thread="yes"
492 ;;
ths77755342008-11-27 15:45:16 +0000493 --disable-blobs) blobs="no"
494 ;;
aliguorieac30262008-11-05 16:28:56 +0000495 --kerneldir=*) kerneldir="$optarg"
496 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000497 --with-pkgversion=*) pkgversion=" ($optarg)"
498 ;;
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500499 --disable-docs) build_docs="no"
500 ;;
balrog7f1559c2007-11-17 10:24:32 +0000501 *) echo "ERROR: unknown option $opt"; show_help="yes"
502 ;;
bellard7d132992003-03-06 23:23:54 +0000503 esac
504done
505
ths6f30fa82007-01-05 01:00:47 +0000506# default flags for all hosts
blueswir1ac41a622008-09-14 06:46:31 +0000507CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
blueswir1e0e36fe2008-12-07 19:16:27 +0000508CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000509LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000510if test "$werror" = "yes" ; then
511CFLAGS="$CFLAGS -Werror"
512fi
ths6f30fa82007-01-05 01:00:47 +0000513
blueswir1d2c7c9b2008-11-01 14:50:20 +0000514if test "$solaris" = "no" ; then
515 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
516 LDFLAGS="$LDFLAGS -Wl,--warn-common"
517 fi
blueswir149237ac2008-09-17 19:05:19 +0000518fi
519
blueswir131422552007-04-16 18:27:06 +0000520#
521# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
522# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
523#
bellard40293e52008-01-31 11:32:10 +0000524case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000525 sparc) if test -z "$sparc_cpu" ; then
526 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
527 ARCH_LDFLAGS="-m32"
528 else
529 ARCH_CFLAGS="${SP_CFLAGS}"
530 ARCH_LDFLAGS="${SP_LDFLAGS}"
531 fi
blueswir1762e8232009-04-04 09:21:28 +0000532 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
533 if test "$solaris" = "no" ; then
534 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
535 fi
blueswir131422552007-04-16 18:27:06 +0000536 ;;
537 sparc64) if test -z "$sparc_cpu" ; then
538 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
539 ARCH_LDFLAGS="-m64"
540 else
541 ARCH_CFLAGS="${SP_CFLAGS}"
542 ARCH_LDFLAGS="${SP_LDFLAGS}"
543 fi
blueswir1762e8232009-04-04 09:21:28 +0000544 if test "$solaris" = "no" ; then
545 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
546 else
547 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
548 fi
blueswir131422552007-04-16 18:27:06 +0000549 ;;
ths76d83bd2007-11-18 21:22:10 +0000550 s390)
551 ARCH_CFLAGS="-march=z900"
552 ;;
bellard40293e52008-01-31 11:32:10 +0000553 i386)
554 ARCH_CFLAGS="-m32"
555 ARCH_LDFLAGS="-m32"
556 ;;
557 x86_64)
558 ARCH_CFLAGS="-m64"
559 ARCH_LDFLAGS="-m64"
560 ;;
blueswir131422552007-04-16 18:27:06 +0000561esac
562
pbrookaf5db582006-04-08 14:26:41 +0000563if test x"$show_help" = x"yes" ; then
564cat << EOF
565
566Usage: configure [options]
567Options: [defaults in brackets after descriptions]
568
569EOF
570echo "Standard options:"
571echo " --help print this message"
572echo " --prefix=PREFIX install in PREFIX [$prefix]"
573echo " --interp-prefix=PREFIX where to find shared libraries, etc."
574echo " use %M for cpu name [$interp_prefix]"
575echo " --target-list=LIST set target list [$target_list]"
576echo ""
577echo "kqemu kernel acceleration support:"
578echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000579echo ""
580echo "Advanced options (experts only):"
581echo " --source-path=PATH path of source code [$source_path]"
582echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
583echo " --cc=CC use C compiler CC [$cc]"
584echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
aurel322981fa92009-04-07 19:57:17 +0000585echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
586echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000587echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000588echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000589echo " --static enable static build [$static]"
aurel32f8393942009-04-13 18:45:38 +0000590echo " --enable-debug-tcg enable TCG debugging"
591echo " --disable-debug-tcg disable TCG debugging (default)"
aliguori890b1652008-10-07 21:22:41 +0000592echo " --enable-sparse enable sparse checker"
593echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000594echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000595echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000596echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000597echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000598echo " --audio-drv-list=LIST set audio drivers list:"
599echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000600echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
601echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000602echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000603echo " --disable-xen disable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000604echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000605echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000606echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000607echo " --disable-curses disable curses output"
Alexander Graf769ce762009-05-11 17:41:42 +0200608echo " --disable-curl disable curl connectivity"
balrogfb599c92008-09-28 23:49:55 +0000609echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000610echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000611echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000612echo " --enable-system enable all system emulation targets"
613echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000614echo " --enable-linux-user enable all linux usermode emulation targets"
615echo " --disable-linux-user disable all linux usermode emulation targets"
616echo " --enable-darwin-user enable all darwin usermode emulation targets"
617echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000618echo " --enable-bsd-user enable all BSD usermode emulation targets"
619echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000620echo " --fmod-lib path to FMOD library"
621echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000622echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000623echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000624echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000625echo " --disable-vde disable support for vde network"
aliguorie5d355d2009-04-24 18:03:15 +0000626echo " --disable-pthread disable pthread support"
blueswir1414f0da2008-08-15 18:20:52 +0000627echo " --disable-aio disable AIO support"
aliguorie5d355d2009-04-24 18:03:15 +0000628echo " --enable-io-thread enable IO thread"
ths77755342008-11-27 15:45:16 +0000629echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000630echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000631echo ""
ths5bf08932006-12-23 00:33:26 +0000632echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000633exit 1
634fi
635
bellard67b915a2004-03-31 23:37:16 +0000636if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000637 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000638 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000639 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000640 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000641 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000642 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000643fi
644
aliguori03b4fe72008-10-07 19:16:17 +0000645if test ! -x "$(which cgcc 2>/dev/null)"; then
646 sparse="no"
647fi
648
bellardec530c82006-04-25 22:36:06 +0000649#
650# Solaris specific configure tool chain decisions
651#
652if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000653 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
654 if test -z "$solinst" ; then
655 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
656 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
657 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
658 exit 1
659 fi
660 if test "$solinst" = "/usr/sbin/install" ; then
661 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
662 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
663 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
664 exit 1
665 fi
bellardec530c82006-04-25 22:36:06 +0000666 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
667 if test -z "$sol_ar" ; then
668 echo "Error: No path includes ar"
669 if test -f /usr/ccs/bin/ar ; then
670 echo "Add /usr/ccs/bin to your path and rerun configure"
671 fi
672 exit 1
673 fi
ths5fafdf22007-09-16 21:08:06 +0000674fi
bellardec530c82006-04-25 22:36:06 +0000675
676
bellard5327cf42005-01-10 23:18:50 +0000677if test -z "$target_list" ; then
678# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000679 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000680 target_list="\
681i386-softmmu \
682x86_64-softmmu \
683arm-softmmu \
684cris-softmmu \
685m68k-softmmu \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200686microblaze-softmmu \
aurel322408a522008-04-20 20:19:44 +0000687mips-softmmu \
688mipsel-softmmu \
689mips64-softmmu \
690mips64el-softmmu \
691ppc-softmmu \
692ppcemb-softmmu \
693ppc64-softmmu \
694sh4-softmmu \
695sh4eb-softmmu \
696sparc-softmmu \
697"
pbrook0a8e90f2006-03-19 14:54:16 +0000698 fi
bellard5327cf42005-01-10 23:18:50 +0000699# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000700 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000701 target_list="${target_list}\
702i386-linux-user \
703x86_64-linux-user \
704alpha-linux-user \
705arm-linux-user \
706armeb-linux-user \
707cris-linux-user \
708m68k-linux-user \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200709microblaze-linux-user \
aurel322408a522008-04-20 20:19:44 +0000710mips-linux-user \
711mipsel-linux-user \
712ppc-linux-user \
713ppc64-linux-user \
714ppc64abi32-linux-user \
715sh4-linux-user \
716sh4eb-linux-user \
717sparc-linux-user \
718sparc64-linux-user \
719sparc32plus-linux-user \
720"
ths831b7822007-01-18 20:06:33 +0000721 fi
722# the following are Darwin specific
723 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000724 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000725 fi
blueswir184778502008-10-26 20:33:16 +0000726# the following are BSD specific
727 if [ "$bsd_user" = "yes" ] ; then
728 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000729i386-bsd-user \
730x86_64-bsd-user \
731sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000732sparc64-bsd-user \
733"
734 fi
bellard6e20a452005-06-05 15:56:02 +0000735else
pbrookb1a550a2006-04-16 13:28:56 +0000736 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000737fi
pbrook0a8e90f2006-03-19 14:54:16 +0000738if test -z "$target_list" ; then
739 echo "No targets enabled"
740 exit 1
741fi
bellard5327cf42005-01-10 23:18:50 +0000742
bellard7d132992003-03-06 23:23:54 +0000743if test -z "$cross_prefix" ; then
744
745# ---
746# big/little endian test
747cat > $TMPC << EOF
748#include <inttypes.h>
749int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000750 volatile uint32_t i=0x01234567;
751 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000752}
753EOF
754
aurel32178baee2008-12-08 18:11:57 +0000755if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000756$TMPE && bigendian="yes"
757else
758echo big/little test failed
759fi
760
761else
762
763# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000764if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000765 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000766 -o "$cpu" = "m68k" \
767 -o "$cpu" = "mips" \
768 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000769 -o "$cpu" = "ppc" \
770 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000771 -o "$cpu" = "s390" \
772 -o "$cpu" = "sparc" \
773 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000774 bigendian="yes"
775fi
776
777fi
778
bellardb6853692005-06-05 17:10:39 +0000779# host long bits test
780hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000781if test "$cpu" = "x86_64" \
782 -o "$cpu" = "alpha" \
783 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000784 -o "$cpu" = "sparc64" \
785 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000786 hostlongbits="64"
787fi
788
pbrookbd0c5662008-05-29 14:34:11 +0000789# Check host NPTL support
790cat > $TMPC <<EOF
791#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000792#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000793void foo()
794{
795#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
796#error bork
797#endif
798}
799EOF
800
balrog8c7f7572008-12-15 03:15:36 +0000801if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000802 :
803else
804 nptl="no"
805fi
806
bellard11d9f692004-04-02 20:55:59 +0000807##########################################
balrogac629222008-10-11 09:56:04 +0000808# zlib check
809
810cat > $TMPC << EOF
811#include <zlib.h>
812int main(void) { zlibVersion(); return 0; }
813EOF
balrog8c7f7572008-12-15 03:15:36 +0000814if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000815 :
816else
817 echo
818 echo "Error: zlib check failed"
819 echo "Make sure to have the zlib libs and headers installed."
820 echo
821 exit 1
822fi
823
824##########################################
aliguorie37630c2009-04-22 15:19:10 +0000825# xen probe
826
827if test "$xen" = "yes" ; then
828cat > $TMPC <<EOF
829#include <xenctrl.h>
830#include <xs.h>
831int main(void) { xs_daemon_open; xc_interface_open; }
832EOF
Jan Kiszka918a6082009-04-27 17:16:55 +0000833 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null > /dev/null ; then
aliguorie37630c2009-04-22 15:19:10 +0000834 :
835 else
836 xen="no"
837 fi
838fi
839
840##########################################
bellard11d9f692004-04-02 20:55:59 +0000841# SDL probe
842
843sdl_too_old=no
844
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500845if test "$sdl" = "yes" ; then
ths069b0bd2007-07-12 00:27:15 +0000846 sdl_config="sdl-config"
847 sdl=no
848 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000849
850cat > $TMPC << EOF
851#include <SDL.h>
852#undef main /* We don't want SDL to override our main() */
853int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
854EOF
balrog8c7f7572008-12-15 03:15:36 +0000855 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 +0000856 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
857 if test "$_sdlversion" -lt 121 ; then
858 sdl_too_old=yes
859 else
860 if test "$cocoa" = "no" ; then
861 sdl=yes
862 fi
863 fi
864
865 # static link with sdl ?
866 if test "$sdl" = "yes" ; then
867 aa="no"
868 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
869 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
870 if [ "$aa" = "yes" ] ; then
871 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000872 fi
bellard11d9f692004-04-02 20:55:59 +0000873
balrog8c7f7572008-12-15 03:15:36 +0000874 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 +0000875 sdl_static=yes
876 fi
877 fi # static link
878 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000879else
ths069b0bd2007-07-12 00:27:15 +0000880 # Make sure to disable cocoa if sdl was set
881 if test "$sdl" = "yes" ; then
882 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000883 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000884 fi
bellarda6e022a2004-04-02 21:55:47 +0000885fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000886
aliguori5368a422009-03-03 17:37:21 +0000887if test "$sdl" = "yes" ; then
888cat > $TMPC <<EOF
889#include <SDL.h>
890#if defined(SDL_VIDEO_DRIVER_X11)
891#include <X11/XKBlib.h>
892#else
893#error No x11 support
894#endif
895int main(void) { return 0; }
896EOF
897 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
898 sdl_x11="yes"
899 fi
900fi
901
ths8f28f3f2007-01-05 21:25:54 +0000902##########################################
ths8d5d2d42007-08-25 01:37:51 +0000903# VNC TLS detection
904if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000905cat > $TMPC <<EOF
906#include <gnutls/gnutls.h>
907int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
908EOF
909 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
910 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
911 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000912 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000913 :
914 else
915 vnc_tls="no"
916 fi
ths8d5d2d42007-08-25 01:37:51 +0000917fi
918
919##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000920# VNC SASL detection
921if test "$vnc_sasl" = "yes" ; then
922cat > $TMPC <<EOF
923#include <sasl/sasl.h>
924#include <stdio.h>
925int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
926EOF
927 # Assuming Cyrus-SASL installed in /usr prefix
928 vnc_sasl_cflags=""
929 vnc_sasl_libs="-lsasl2"
930 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
Jan Kiszka918a6082009-04-27 17:16:55 +0000931 $vnc_sasl_libs 2> /dev/null > /dev/null ; then
aliguori2f9606b2009-03-06 20:27:28 +0000932 :
933 else
934 vnc_sasl="no"
935 fi
936fi
937
938##########################################
aliguori76655d62009-03-06 20:27:37 +0000939# fnmatch() probe, used for ACL routines
940fnmatch="no"
941cat > $TMPC << EOF
942#include <fnmatch.h>
943int main(void)
944{
945 fnmatch("foo", "foo", 0);
946 return 0;
947}
948EOF
949if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
950 fnmatch="yes"
951fi
952
953##########################################
ths8a16d272008-07-19 09:56:24 +0000954# vde libraries probe
955if test "$vde" = "yes" ; then
956 cat > $TMPC << EOF
957#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000958int main(void)
959{
960 struct vde_open_args a = {0, 0, 0};
961 vde_open("", "", &a);
962 return 0;
963}
ths8a16d272008-07-19 09:56:24 +0000964EOF
balrog8c7f7572008-12-15 03:15:36 +0000965 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000966 :
967 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000968 vde="no"
ths8a16d272008-07-19 09:56:24 +0000969 fi
970fi
971
972##########################################
malcc2de5c92008-06-28 19:13:06 +0000973# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000974
malcc2de5c92008-06-28 19:13:06 +0000975audio_drv_probe()
976{
977 drv=$1
978 hdr=$2
979 lib=$3
980 exp=$4
981 cfl=$5
982 cat > $TMPC << EOF
983#include <$hdr>
984int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000985EOF
balrog8c7f7572008-12-15 03:15:36 +0000986 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000987 :
988 else
989 echo
990 echo "Error: $drv check failed"
991 echo "Make sure to have the $drv libs and headers installed."
992 echo
993 exit 1
994 fi
995}
996
malc2fa7d3b2008-07-29 12:58:44 +0000997audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000998for drv in $audio_drv_list; do
999 case $drv in
1000 alsa)
1001 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1002 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1003 ;;
1004
1005 fmod)
1006 if test -z $fmod_lib || test -z $fmod_inc; then
1007 echo
1008 echo "Error: You must specify path to FMOD library and headers"
1009 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1010 echo
1011 exit 1
1012 fi
1013 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1014 ;;
1015
1016 esd)
1017 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1018 ;;
malcb8e59f12008-07-02 21:03:08 +00001019
1020 pa)
1021 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1022 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1023 ;;
1024
blueswir12f6a1ab2008-08-21 18:00:53 +00001025 oss|sdl|core|wav|dsound)
1026 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1027 ;;
1028
malce4c63a62008-07-19 16:15:16 +00001029 *)
malc1c9b2a52008-07-19 16:57:30 +00001030 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001031 echo
1032 echo "Error: Unknown driver '$drv' selected"
1033 echo "Possible drivers are: $audio_possible_drivers"
1034 echo
1035 exit 1
1036 }
1037 ;;
malcc2de5c92008-06-28 19:13:06 +00001038 esac
1039done
ths8f28f3f2007-01-05 21:25:54 +00001040
balrog4d3b6f62008-02-10 16:33:14 +00001041##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001042# BrlAPI probe
1043
1044if test -z "$brlapi" ; then
1045 brlapi=no
1046cat > $TMPC << EOF
1047#include <brlapi.h>
1048int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1049EOF
aurel32178baee2008-12-08 18:11:57 +00001050 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +00001051 brlapi=yes
1052 fi # brlapi compile test
1053fi # -z $brlapi
1054
1055##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001056# curses probe
1057
1058if test "$curses" = "yes" ; then
1059 curses=no
1060 cat > $TMPC << EOF
1061#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001062#ifdef __OpenBSD__
1063#define resize_term resizeterm
1064#endif
1065int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001066EOF
aurel32178baee2008-12-08 18:11:57 +00001067 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001068 curses=yes
1069 fi
1070fi # test "$curses"
1071
blueswir1414f0da2008-08-15 18:20:52 +00001072##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001073# curl probe
1074
1075if test "$curl" = "yes" ; then
1076 curl=no
1077 cat > $TMPC << EOF
1078#include <curl/curl.h>
1079int main(void) { return curl_easy_init(); }
1080EOF
Paul Brook52368552009-05-22 17:22:38 +01001081 curl_libs=`curl-config --libs 2>/dev/null`
Alexander Graf769ce762009-05-11 17:41:42 +02001082 if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1083 curl=yes
1084 fi
1085fi # test "$curl"
1086
1087##########################################
balrogfb599c92008-09-28 23:49:55 +00001088# bluez support probe
1089if test "$bluez" = "yes" ; then
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001090 `pkg-config bluez 2> /dev/null` || bluez="no"
balrogfb599c92008-09-28 23:49:55 +00001091fi
1092if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001093 cat > $TMPC << EOF
1094#include <bluetooth/bluetooth.h>
1095int main(void) { return bt_error(0); }
1096EOF
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001097 bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1098 bluez_libs=`pkg-config --libs bluez 2> /dev/null`
balrog17e15922008-10-11 12:00:42 +00001099 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001100 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001101 :
1102 else
1103 bluez="no"
1104 fi
balrogfb599c92008-09-28 23:49:55 +00001105fi
1106
1107##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001108# kvm probe
1109if test "$kvm" = "yes" ; then
1110 cat > $TMPC <<EOF
1111#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001112#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001113#error Invalid KVM version
1114#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001115#if !defined(KVM_CAP_USER_MEMORY)
1116#error Missing KVM capability KVM_CAP_USER_MEMORY
1117#endif
1118#if !defined(KVM_CAP_SET_TSS_ADDR)
1119#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1120#endif
1121#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1122#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1123#endif
aliguori7ba1e612008-11-05 16:04:33 +00001124int main(void) { return 0; }
1125EOF
aliguorieac30262008-11-05 16:28:56 +00001126 if test "$kerneldir" != "" ; then
1127 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001128 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1129 -a -d "$kerneldir/arch/x86/include" ; then
1130 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001131 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1132 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001133 elif test -d "$kerneldir/arch/$cpu/include" ; then
1134 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1135 fi
aliguorieac30262008-11-05 16:28:56 +00001136 else
1137 kvm_cflags=""
1138 fi
aliguori7ba1e612008-11-05 16:04:33 +00001139 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001140 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001141 :
1142 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001143 kvm="no";
1144 if [ -x "`which awk 2>/dev/null`" ] && \
1145 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001146 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001147 | grep "error: " \
1148 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1149 if test "$kvmerr" != "" ; then
1150 kvm="no - (${kvmerr})"
1151 fi
1152 fi
aliguori7ba1e612008-11-05 16:04:33 +00001153 fi
1154fi
1155
1156##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001157# pthread probe
1158PTHREADLIBS=""
aliguori3c529d92008-12-12 16:41:40 +00001159
aliguorie5d355d2009-04-24 18:03:15 +00001160if test "$pthread" = yes; then
1161 pthread=no
1162cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001163#include <pthread.h>
blueswir1c9db92f2009-01-17 06:49:15 +00001164int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001165EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001166 if $cc $ARCH_CFLAGS -o $TMPE $PTHREADLIBS $TMPC 2> /dev/null > /dev/null ; then
aliguorie5d355d2009-04-24 18:03:15 +00001167 pthread=yes
1168 PTHREADLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +00001169 fi
1170fi
1171
aliguorie5d355d2009-04-24 18:03:15 +00001172if test "$pthread" = no; then
1173 aio=no
1174 io_thread=no
1175fi
1176
aliguoribf9298b2008-12-05 20:05:26 +00001177##########################################
1178# iovec probe
1179cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001180#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001181#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001182#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001183int main(void) { struct iovec iov; return 0; }
1184EOF
1185iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001186if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001187 iovec=yes
1188fi
1189
aurel32f652e6a2008-12-16 10:43:48 +00001190##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001191# preadv probe
1192cat > $TMPC <<EOF
1193#include <sys/types.h>
1194#include <sys/uio.h>
1195#include <unistd.h>
1196int main(void) { preadv; }
1197EOF
1198preadv=no
1199if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1200 preadv=yes
1201fi
1202
1203##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001204# fdt probe
1205if test "$fdt" = "yes" ; then
1206 fdt=no
1207 cat > $TMPC << EOF
1208int main(void) { return 0; }
1209EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001210 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null > /dev/null ; then
aurel32f652e6a2008-12-16 10:43:48 +00001211 fdt=yes
1212 fi
1213fi
1214
aurel323b3f24a2009-04-15 16:12:13 +00001215#
1216# Check for xxxat() functions when we are building linux-user
1217# emulator. This is done because older glibc versions don't
1218# have syscall stubs for these implemented.
1219#
1220atfile=no
1221if [ "$linux_user" = "yes" ] ; then
1222 cat > $TMPC << EOF
1223#define _ATFILE_SOURCE
1224#include <sys/types.h>
1225#include <fcntl.h>
1226#include <unistd.h>
1227
1228int
1229main(void)
1230{
1231 /* try to unlink nonexisting file */
1232 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1233}
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 atfile=yes
1237 fi
1238fi
1239
aurel3239386ac2009-04-15 19:48:17 +00001240# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001241# emulator. This is done because older glibc versions don't
1242# have syscall stubs for these implemented. In that case we
1243# don't provide them even if kernel supports them.
1244#
1245inotify=no
1246if [ "$linux_user" = "yes" ] ; then
1247 cat > $TMPC << EOF
1248#include <sys/inotify.h>
1249
1250int
1251main(void)
1252{
1253 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001254 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001255}
1256EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001257 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001258 inotify=yes
1259 fi
1260fi
1261
pbrookcc8ae6d2006-04-23 17:57:59 +00001262# Check if tools are available to build documentation.
Anthony Liguori70ec5dc2009-05-14 08:25:04 -05001263if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
1264 build_docs="no"
pbrookcc8ae6d2006-04-23 17:57:59 +00001265fi
1266
aliguorida93a1f2008-12-12 20:02:52 +00001267##########################################
1268# Do we need librt
aliguorie5d355d2009-04-24 18:03:15 +00001269CLOCKLIBS=""
aliguorida93a1f2008-12-12 20:02:52 +00001270cat > $TMPC <<EOF
1271#include <signal.h>
1272#include <time.h>
1273int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1274EOF
1275
1276rt=no
balrog8c7f7572008-12-15 03:15:36 +00001277if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001278 :
balrog8c7f7572008-12-15 03:15:36 +00001279elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001280 rt=yes
1281fi
1282
1283if test "$rt" = "yes" ; then
aliguorie5d355d2009-04-24 18:03:15 +00001284 CLOCKLIBS="-lrt"
aliguorida93a1f2008-12-12 20:02:52 +00001285fi
1286
bellard11d9f692004-04-02 20:55:59 +00001287if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001288 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001289 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001290 fi
1291 mansuffix=""
1292 datasuffix=""
1293 docsuffix=""
1294 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001295else
pbrook308c3592007-02-27 00:52:01 +00001296 if test -z "$prefix" ; then
1297 prefix="/usr/local"
1298 fi
1299 mansuffix="/share/man"
1300 datasuffix="/share/qemu"
1301 docsuffix="/share/doc/qemu"
1302 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001303fi
bellard5a671352003-10-01 00:13:48 +00001304
bellard43ce4df2003-06-09 19:53:12 +00001305echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001306echo "BIOS directory $prefix$datasuffix"
1307echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001308if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001309echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001310echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001311fi
bellard5a671352003-10-01 00:13:48 +00001312echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001313echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001314echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001315echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001316echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001317echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001318echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001319echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001320echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00001321echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00001322echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001323echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001324echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001325echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001326echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001327echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001328if test "$darwin" = "yes" ; then
1329 echo "Cocoa support $cocoa"
1330fi
bellard97a847b2003-08-10 21:36:04 +00001331echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001332if test "$sdl" != "no" ; then
1333 echo "SDL static link $sdl_static"
1334fi
balrog4d3b6f62008-02-10 16:33:14 +00001335echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02001336echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00001337echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001338echo "Audio drivers $audio_drv_list"
1339echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001340echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001341echo "VNC TLS support $vnc_tls"
1342if test "$vnc_tls" = "yes" ; then
1343 echo " TLS CFLAGS $vnc_tls_cflags"
1344 echo " TLS LIBS $vnc_tls_libs"
1345fi
aliguori2f9606b2009-03-06 20:27:28 +00001346echo "VNC SASL support $vnc_sasl"
1347if test "$vnc_sasl" = "yes" ; then
1348 echo " SASL CFLAGS $vnc_sasl_cflags"
1349 echo " SASL LIBS $vnc_sasl_libs"
1350fi
blueswir131422552007-04-16 18:27:06 +00001351if test -n "$sparc_cpu"; then
1352 echo "Target Sparc Arch $sparc_cpu"
1353fi
bellard07f4ddb2005-04-23 17:44:28 +00001354echo "kqemu support $kqemu"
aliguorie37630c2009-04-22 15:19:10 +00001355echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00001356echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001357echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001358[ ! -z "$uname_release" ] && \
1359echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001360echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001361echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001362echo "AIO support $aio"
aliguorie5d355d2009-04-24 18:03:15 +00001363echo "IO thread $io_thread"
ths77755342008-11-27 15:45:16 +00001364echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001365echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001366echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001367echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001368
bellard97a847b2003-08-10 21:36:04 +00001369if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001370echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001371fi
bellard24b55b92005-03-01 22:30:41 +00001372#if test "$sdl_static" = "no"; then
1373# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1374#fi
bellard97a847b2003-08-10 21:36:04 +00001375config_mak="config-host.mak"
1376config_h="config-host.h"
1377
bellard7c1f25b2004-04-22 00:02:08 +00001378#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001379
ths15d9ca02007-07-31 23:07:32 +00001380test -f $config_h && mv $config_h ${config_h}~
1381
bellard97a847b2003-08-10 21:36:04 +00001382echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001383printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001384printf " '%s'" "$0" "$@" >> $config_mak
1385echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001386echo "/* Automatically generated by configure - do not modify */" > $config_h
1387
1388echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001389echo "bindir=\${prefix}$binsuffix" >> $config_mak
1390echo "mandir=\${prefix}$mansuffix" >> $config_mak
1391echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001392echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001393echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001394echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001395echo "INSTALL=$install" >> $config_mak
aliguori58f8aea2009-04-18 15:36:02 +00001396echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1397echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1398echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001399echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001400echo "HOST_CC=$host_cc" >> $config_mak
1401echo "AR=$ar" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001402# XXX: only use CFLAGS and LDFLAGS ?
1403# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1404# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001405echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001406echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1407echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1408echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001409echo "CFLAGS=$CFLAGS" >> $config_mak
1410echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001411echo "EXESUF=$EXESUF" >> $config_mak
aliguorie5d355d2009-04-24 18:03:15 +00001412echo "PTHREADLIBS=$PTHREADLIBS" >> $config_mak
1413echo "CLOCKLIBS=$CLOCKLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001414case "$cpu" in
1415 i386)
1416 echo "ARCH=i386" >> $config_mak
1417 echo "#define HOST_I386 1" >> $config_h
1418 ;;
1419 x86_64)
1420 echo "ARCH=x86_64" >> $config_mak
1421 echo "#define HOST_X86_64 1" >> $config_h
1422 ;;
1423 alpha)
1424 echo "ARCH=alpha" >> $config_mak
1425 echo "#define HOST_ALPHA 1" >> $config_h
1426 ;;
1427 armv4b)
1428 echo "ARCH=arm" >> $config_mak
1429 echo "#define HOST_ARM 1" >> $config_h
1430 ;;
1431 armv4l)
1432 echo "ARCH=arm" >> $config_mak
1433 echo "#define HOST_ARM 1" >> $config_h
1434 ;;
1435 cris)
1436 echo "ARCH=cris" >> $config_mak
1437 echo "#define HOST_CRIS 1" >> $config_h
1438 ;;
1439 hppa)
1440 echo "ARCH=hppa" >> $config_mak
1441 echo "#define HOST_HPPA 1" >> $config_h
1442 ;;
1443 ia64)
1444 echo "ARCH=ia64" >> $config_mak
1445 echo "#define HOST_IA64 1" >> $config_h
1446 ;;
1447 m68k)
1448 echo "ARCH=m68k" >> $config_mak
1449 echo "#define HOST_M68K 1" >> $config_h
1450 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001451 microblaze)
1452 echo "ARCH=microblaze" >> $config_mak
1453 echo "#define HOST_MICROBLAZE 1" >> $config_h
1454 ;;
aurel322408a522008-04-20 20:19:44 +00001455 mips)
1456 echo "ARCH=mips" >> $config_mak
1457 echo "#define HOST_MIPS 1" >> $config_h
1458 ;;
1459 mips64)
1460 echo "ARCH=mips64" >> $config_mak
1461 echo "#define HOST_MIPS64 1" >> $config_h
1462 ;;
malcfdf7ed92009-01-14 18:39:52 +00001463 ppc)
1464 echo "ARCH=ppc" >> $config_mak
1465 echo "#define HOST_PPC 1" >> $config_h
1466 ;;
1467 ppc64)
1468 echo "ARCH=ppc64" >> $config_mak
1469 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001470 ;;
1471 s390)
1472 echo "ARCH=s390" >> $config_mak
1473 echo "#define HOST_S390 1" >> $config_h
1474 ;;
1475 sparc)
1476 echo "ARCH=sparc" >> $config_mak
1477 echo "#define HOST_SPARC 1" >> $config_h
1478 ;;
1479 sparc64)
1480 echo "ARCH=sparc64" >> $config_mak
1481 echo "#define HOST_SPARC64 1" >> $config_h
1482 ;;
1483 *)
1484 echo "Unsupported CPU = $cpu"
1485 exit 1
1486 ;;
1487esac
aurel32f8393942009-04-13 18:45:38 +00001488if test "$debug_tcg" = "yes" ; then
1489 echo "#define DEBUG_TCG 1" >> $config_h
1490fi
aliguori03b4fe72008-10-07 19:16:17 +00001491if test "$sparse" = "yes" ; then
1492 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1493 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1494 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1495fi
aliguori1625af82009-04-05 17:41:02 +00001496if test "$strip_opt" = "yes" ; then
1497 echo "STRIP_OPT=-s" >> $config_mak
1498fi
bellard7d132992003-03-06 23:23:54 +00001499if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001500 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1501 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1502fi
bellardb6853692005-06-05 17:10:39 +00001503echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001504if test "$mingw32" = "yes" ; then
1505 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001506 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001507else
1508 cat > $TMPC << EOF
1509#include <byteswap.h>
1510int main(void) { return bswap_32(0); }
1511EOF
aurel32178baee2008-12-08 18:11:57 +00001512 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001513 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1514 fi
blueswir113606772008-12-05 17:54:09 +00001515 cat > $TMPC << EOF
1516#include <sys/endian.h>
1517#include <sys/types.h>
1518#include <machine/bswap.h>
1519int main(void) { return bswap32(0); }
1520EOF
aurel32178baee2008-12-08 18:11:57 +00001521 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001522 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1523 fi
bellard67b915a2004-03-31 23:37:16 +00001524fi
blueswir1128ab2f2008-08-15 18:33:42 +00001525
1526if [ "$openbsd" = "yes" ] ; then
1527 echo "#define ENOTSUP 4096" >> $config_h
1528fi
1529
bellard83fb7ad2004-07-05 21:25:26 +00001530if test "$darwin" = "yes" ; then
1531 echo "CONFIG_DARWIN=yes" >> $config_mak
1532 echo "#define CONFIG_DARWIN 1" >> $config_h
1533fi
malcb29fe3e2008-11-18 01:42:22 +00001534
1535if test "$aix" = "yes" ; then
1536 echo "CONFIG_AIX=yes" >> $config_mak
1537 echo "#define CONFIG_AIX 1" >> $config_h
1538fi
1539
bellardec530c82006-04-25 22:36:06 +00001540if test "$solaris" = "yes" ; then
1541 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001542 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001543 if test "$needs_libsunmath" = "yes" ; then
1544 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1545 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1546 fi
bellardec530c82006-04-25 22:36:06 +00001547fi
blueswir131422552007-04-16 18:27:06 +00001548if test -n "$sparc_cpu"; then
1549 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1550 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1551fi
bellard97a847b2003-08-10 21:36:04 +00001552if test "$gprof" = "yes" ; then
1553 echo "TARGET_GPROF=yes" >> $config_mak
1554 echo "#define HAVE_GPROF 1" >> $config_h
1555fi
1556if test "$static" = "yes" ; then
1557 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001558 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001559fi
bellard05c2a3e2006-02-08 22:39:17 +00001560if test $profiler = "yes" ; then
1561 echo "#define CONFIG_PROFILER 1" >> $config_h
1562fi
bellardc20709a2004-04-21 23:27:19 +00001563if test "$slirp" = "yes" ; then
1564 echo "CONFIG_SLIRP=yes" >> $config_mak
1565 echo "#define CONFIG_SLIRP 1" >> $config_h
1566fi
ths8a16d272008-07-19 09:56:24 +00001567if test "$vde" = "yes" ; then
1568 echo "CONFIG_VDE=yes" >> $config_mak
1569 echo "#define CONFIG_VDE 1" >> $config_h
1570 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1571fi
malc0c58ac12008-06-25 21:04:05 +00001572for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001573 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001574 echo "$def=yes" >> $config_mak
1575 echo "#define $def 1" >> $config_h
1576done
1577echo "#define AUDIO_DRIVERS \\" >> $config_h
1578for drv in $audio_drv_list; do
1579 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001580 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001581 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001582 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001583 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1584 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001585 elif test "$drv" = "oss"; then
1586 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001587 fi
1588done
1589echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001590if test "$mixemu" = "yes" ; then
1591 echo "CONFIG_MIXEMU=yes" >> $config_mak
1592 echo "#define CONFIG_MIXEMU 1" >> $config_h
1593fi
ths8d5d2d42007-08-25 01:37:51 +00001594if test "$vnc_tls" = "yes" ; then
1595 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1596 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1597 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1598 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1599fi
aliguori2f9606b2009-03-06 20:27:28 +00001600if test "$vnc_sasl" = "yes" ; then
1601 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1602 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1603 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1604 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1605fi
aliguori76655d62009-03-06 20:27:37 +00001606if test "$fnmatch" = "yes" ; then
1607 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1608fi
pbrookb1a550a2006-04-16 13:28:56 +00001609qemu_version=`head $source_path/VERSION`
1610echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001611echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001612
pbrook4a19f1e2009-04-07 23:17:49 +00001613echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1614
bellard97a847b2003-08-10 21:36:04 +00001615echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001616if [ "$source_path_used" = "yes" ]; then
1617 echo "VPATH=$source_path" >> $config_mak
1618fi
bellard97a847b2003-08-10 21:36:04 +00001619echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001620if [ "$build_docs" = "yes" ] ; then
1621 echo "BUILD_DOCS=yes" >> $config_mak
1622fi
bellard49ecc3f2007-11-07 19:25:15 +00001623if test "$static" = "yes"; then
1624 sdl1=$sdl_static
1625else
1626 sdl1=$sdl
1627fi
1628if test "$sdl1" = "yes" ; then
1629 echo "#define CONFIG_SDL 1" >> $config_h
1630 echo "CONFIG_SDL=yes" >> $config_mak
1631 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1632 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001633 elif test "$sdl_x11" = "yes" ; then
1634 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001635 else
1636 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1637 fi
1638 if [ "${aa}" = "yes" ] ; then
1639 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1640 else
1641 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1642 fi
1643fi
1644if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001645 echo "#define CONFIG_COCOA 1" >> $config_h
1646 echo "CONFIG_COCOA=yes" >> $config_mak
1647fi
1648if test "$curses" = "yes" ; then
1649 echo "#define CONFIG_CURSES 1" >> $config_h
1650 echo "CONFIG_CURSES=yes" >> $config_mak
1651 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001652fi
aurel323b3f24a2009-04-15 16:12:13 +00001653if test "$atfile" = "yes" ; then
1654 echo "#define CONFIG_ATFILE 1" >> $config_h
1655fi
1656if test "$inotify" = "yes" ; then
1657 echo "#define CONFIG_INOTIFY 1" >> $config_h
1658fi
Alexander Graf769ce762009-05-11 17:41:42 +02001659if test "$curl" = "yes" ; then
1660 echo "CONFIG_CURL=yes" >> $config_mak
1661 echo "CURL_LIBS=$curl_libs" >> $config_mak
1662 echo "#define CONFIG_CURL 1" >> $config_h
1663fi
aurel322e4d9fb2008-04-08 06:01:02 +00001664if test "$brlapi" = "yes" ; then
1665 echo "CONFIG_BRLAPI=yes" >> $config_mak
1666 echo "#define CONFIG_BRLAPI 1" >> $config_h
1667 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1668fi
balrogfb599c92008-09-28 23:49:55 +00001669if test "$bluez" = "yes" ; then
1670 echo "CONFIG_BLUEZ=yes" >> $config_mak
1671 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1672 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1673 echo "#define CONFIG_BLUEZ 1" >> $config_h
1674fi
aliguorie37630c2009-04-22 15:19:10 +00001675if test "$xen" = "yes" ; then
aliguori9306acb2009-04-22 15:19:44 +00001676 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
aliguorie37630c2009-04-22 15:19:10 +00001677fi
blueswir1414f0da2008-08-15 18:20:52 +00001678if test "$aio" = "yes" ; then
1679 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001680 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001681fi
aliguorie5d355d2009-04-24 18:03:15 +00001682if test "$io_thread" = "yes" ; then
1683 echo "CONFIG_IOTHREAD=yes" >> $config_mak
1684 echo "#define CONFIG_IOTHREAD 1" >> $config_h
1685fi
ths77755342008-11-27 15:45:16 +00001686if test "$blobs" = "yes" ; then
1687 echo "INSTALL_BLOBS=yes" >> $config_mak
1688fi
aliguoribf9298b2008-12-05 20:05:26 +00001689if test "$iovec" = "yes" ; then
1690 echo "#define HAVE_IOVEC 1" >> $config_h
1691fi
aliguoriceb42de2009-04-07 18:43:28 +00001692if test "$preadv" = "yes" ; then
1693 echo "#define HAVE_PREADV 1" >> $config_h
1694fi
aurel32f652e6a2008-12-16 10:43:48 +00001695if test "$fdt" = "yes" ; then
1696 echo "#define HAVE_FDT 1" >> $config_h
1697 echo "FDT_LIBS=-lfdt" >> $config_mak
1698fi
bellard97a847b2003-08-10 21:36:04 +00001699
bellard83fb7ad2004-07-05 21:25:26 +00001700# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001701if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001702 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001703 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001704 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001705fi
1706
pbrookc5937222006-05-14 11:30:38 +00001707echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1708
blueswir168063642008-11-22 21:03:55 +00001709# USB host support
1710case "$usb" in
1711linux)
1712 echo "HOST_USB=linux" >> $config_mak
1713;;
1714bsd)
1715 echo "HOST_USB=bsd" >> $config_mak
1716;;
1717*)
1718 echo "HOST_USB=stub" >> $config_mak
1719;;
1720esac
1721
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001722# Determine what linker flags to use to force archive inclusion
1723check_linker_flags()
1724{
1725 $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 -Wl,$2 >/dev/null 2>/dev/null
1726}
1727
1728cat > $TMPC << EOF
1729int main(void) { }
1730EOF
1731if check_linker_flags --whole-archive --no-whole-archive ; then
1732 # GNU ld
1733 echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_mak
1734 echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_mak
1735elif check_linker_flags -z,allextract -z,defaultextract ; then
1736 # Solaris ld
1737 echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_mak
1738 echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_mak
1739else
1740 echo "Error: your linker does not support --whole-archive or -z."
1741 echo "Please report to qemu-devel@nongnu.org"
1742 exit 1
1743fi
1744
Blue Swirl2567f572009-05-21 15:54:48 +00001745if test "$xen" = "yes" ;
1746 then
1747 echo "CONFIG_XEN=yes" >> $config_mak
1748fi
1749
pbrookc39e3332007-09-22 16:49:14 +00001750tools=
1751if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001752 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001753 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001754 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001755 fi
pbrookc39e3332007-09-22 16:49:14 +00001756fi
1757echo "TOOLS=$tools" >> $config_mak
1758
Paul Brook370ab982009-05-26 15:07:56 +01001759if test -f ${config_h}~ ; then
1760 if cmp -s $config_h ${config_h}~ ; then
1761 mv ${config_h}~ $config_h
1762 else
1763 rm ${config_h}~
1764 fi
1765fi
1766
Paul Brook1ad21342009-05-19 16:17:58 +01001767config_host_mak=${config_mak}
ths15d9ca02007-07-31 23:07:32 +00001768
bellard1d14ffa2005-10-30 18:58:22 +00001769for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001770target_dir="$target"
1771config_mak=$target_dir/config.mak
1772config_h=$target_dir/config.h
1773target_cpu=`echo $target | cut -d '-' -f 1`
1774target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001775[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001776[ "$target_cpu" = "m68k" ] && target_bigendian=yes
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001777[ "$target_cpu" = "microblaze" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001778[ "$target_cpu" = "mips" ] && target_bigendian=yes
1779[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1780[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001781[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001782[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001783[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001784[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001785[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001786[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1787[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1788[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001789target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001790target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001791target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001792target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001793target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001794case "$target" in
1795 ${target_cpu}-softmmu)
1796 target_softmmu="yes"
1797 ;;
1798 ${target_cpu}-linux-user)
1799 target_user_only="yes"
1800 target_linux_user="yes"
1801 ;;
1802 ${target_cpu}-darwin-user)
1803 target_user_only="yes"
1804 target_darwin_user="yes"
1805 ;;
blueswir184778502008-10-26 20:33:16 +00001806 ${target_cpu}-bsd-user)
1807 target_user_only="yes"
1808 target_bsd_user="yes"
1809 ;;
pbrook9e407a82007-05-26 16:38:53 +00001810 *)
1811 echo "ERROR: Target '$target' not recognised"
1812 exit 1
1813 ;;
1814esac
ths831b7822007-01-18 20:06:33 +00001815
bellard7c1f25b2004-04-22 00:02:08 +00001816#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001817
ths15d9ca02007-07-31 23:07:32 +00001818test -f $config_h && mv $config_h ${config_h}~
1819
bellard97a847b2003-08-10 21:36:04 +00001820mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001821mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001822mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001823if 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 +00001824 mkdir -p $target_dir/nwfpe
1825fi
1826
bellardec530c82006-04-25 22:36:06 +00001827#
1828# don't use ln -sf as not all "ln -sf" over write the file/link
1829#
1830rm -f $target_dir/Makefile
1831ln -s $source_path/Makefile.target $target_dir/Makefile
1832
bellard97a847b2003-08-10 21:36:04 +00001833
1834echo "# Automatically generated by configure - do not modify" > $config_mak
1835echo "/* Automatically generated by configure - do not modify */" > $config_h
1836
1837
1838echo "include ../config-host.mak" >> $config_mak
1839echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001840
pbrooke5fe0c52006-06-11 13:32:59 +00001841bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001842elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001843target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001844interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1845echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001846gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001847
aliguori5985ece2008-11-05 19:59:25 +00001848# Make sure the target and host cpus are compatible
1849if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001850 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001851 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1852 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001853 kvm="no"
1854fi
1855# Disable KVM for linux-user
1856if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1857 kvm="no"
1858fi
1859
aurel322408a522008-04-20 20:19:44 +00001860case "$target_cpu" in
1861 i386)
1862 echo "TARGET_ARCH=i386" >> $config_mak
1863 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1864 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001865 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001866 then
blueswir12d6ebb02009-04-18 19:25:43 +00001867 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001868 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001869 fi
aliguori7ba1e612008-11-05 16:04:33 +00001870 if test "$kvm" = "yes" ; then
1871 echo "CONFIG_KVM=yes" >> $config_mak
1872 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001873 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001874 fi
aliguorie37630c2009-04-22 15:19:10 +00001875 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1876 then
1877 echo "CONFIG_XEN=yes" >> $config_mak
1878 echo "#define CONFIG_XEN 1" >> $config_h
1879 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001880 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001881 ;;
1882 x86_64)
1883 echo "TARGET_ARCH=x86_64" >> $config_mak
1884 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1885 echo "#define TARGET_I386 1" >> $config_h
1886 echo "#define TARGET_X86_64 1" >> $config_h
1887 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1888 then
blueswir12d6ebb02009-04-18 19:25:43 +00001889 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001890 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001891 fi
aliguori7ba1e612008-11-05 16:04:33 +00001892 if test "$kvm" = "yes" ; then
1893 echo "CONFIG_KVM=yes" >> $config_mak
1894 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1895 echo "#define CONFIG_KVM 1" >> $config_h
1896 fi
aliguorie37630c2009-04-22 15:19:10 +00001897 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1898 then
1899 echo "CONFIG_XEN=yes" >> $config_mak
1900 echo "#define CONFIG_XEN 1" >> $config_h
1901 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001902 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001903 ;;
1904 alpha)
1905 echo "TARGET_ARCH=alpha" >> $config_mak
1906 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1907 echo "#define TARGET_ALPHA 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001908 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001909 ;;
1910 arm|armeb)
1911 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001912 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1913 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001914 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001915 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001916 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001917 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001918 ;;
1919 cris)
1920 echo "TARGET_ARCH=cris" >> $config_mak
1921 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1922 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001923 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001924 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001925 ;;
1926 m68k)
1927 echo "TARGET_ARCH=m68k" >> $config_mak
1928 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1929 echo "#define TARGET_M68K 1" >> $config_h
1930 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001931 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001932 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001933 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001934 microblaze)
1935 echo "TARGET_ARCH=microblaze" >> $config_mak
1936 echo "#define TARGET_ARCH \"microblaze\"" >> $config_h
1937 echo "#define TARGET_MICROBLAZE 1" >> $config_h
1938 bflt="yes"
1939 target_nptl="yes"
1940 target_phys_bits=32
1941 ;;
1942 mips|mipsel)
aurel322408a522008-04-20 20:19:44 +00001943 echo "TARGET_ARCH=mips" >> $config_mak
1944 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1945 echo "#define TARGET_MIPS 1" >> $config_h
1946 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001947 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001948 ;;
1949 mipsn32|mipsn32el)
1950 echo "TARGET_ARCH=mipsn32" >> $config_mak
1951 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1952 echo "#define TARGET_MIPS 1" >> $config_h
1953 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001954 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001955 ;;
1956 mips64|mips64el)
1957 echo "TARGET_ARCH=mips64" >> $config_mak
1958 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1959 echo "#define TARGET_MIPS 1" >> $config_h
1960 echo "#define TARGET_MIPS64 1" >> $config_h
1961 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001962 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001963 ;;
1964 ppc)
1965 echo "TARGET_ARCH=ppc" >> $config_mak
1966 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1967 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001968 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001969 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001970 ;;
1971 ppcemb)
1972 echo "TARGET_ARCH=ppcemb" >> $config_mak
1973 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1974 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1975 echo "#define TARGET_PPC 1" >> $config_h
1976 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001977 if test "$kvm" = "yes" ; then
1978 echo "CONFIG_KVM=yes" >> $config_mak
1979 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1980 echo "#define CONFIG_KVM 1" >> $config_h
1981 fi
aurel32c8b35322009-01-24 15:07:34 +00001982 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001983 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001984 ;;
1985 ppc64)
1986 echo "TARGET_ARCH=ppc64" >> $config_mak
1987 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1988 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1989 echo "#define TARGET_PPC 1" >> $config_h
1990 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001991 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001992 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001993 ;;
1994 ppc64abi32)
1995 echo "TARGET_ARCH=ppc64" >> $config_mak
1996 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1997 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1998 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1999 echo "#define TARGET_PPC 1" >> $config_h
2000 echo "#define TARGET_PPC64 1" >> $config_h
2001 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00002002 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002003 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002004 ;;
2005 sh4|sh4eb)
2006 echo "TARGET_ARCH=sh4" >> $config_mak
2007 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
2008 echo "#define TARGET_SH4 1" >> $config_h
2009 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00002010 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002011 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002012 ;;
2013 sparc)
2014 echo "TARGET_ARCH=sparc" >> $config_mak
2015 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
2016 echo "#define TARGET_SPARC 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002017 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002018 ;;
2019 sparc64)
2020 echo "TARGET_ARCH=sparc64" >> $config_mak
2021 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2022 echo "#define TARGET_SPARC 1" >> $config_h
2023 echo "#define TARGET_SPARC64 1" >> $config_h
2024 elfload32="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002025 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002026 ;;
2027 sparc32plus)
2028 echo "TARGET_ARCH=sparc64" >> $config_mak
2029 echo "TARGET_ABI_DIR=sparc" >> $config_mak
2030 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
2031 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2032 echo "#define TARGET_SPARC 1" >> $config_h
2033 echo "#define TARGET_SPARC64 1" >> $config_h
2034 echo "#define TARGET_ABI32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002035 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002036 ;;
2037 *)
2038 echo "Unsupported target CPU"
2039 exit 1
2040 ;;
2041esac
Paul Brook1ad21342009-05-19 16:17:58 +01002042if [ $target_phys_bits -lt $hostlongbits ] ; then
2043 target_phys_bits=$hostlongbits
2044fi
2045echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
2046echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h
2047echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00002048if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00002049 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2050 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2051fi
2052if test "$target_softmmu" = "yes" ; then
2053 echo "CONFIG_SOFTMMU=yes" >> $config_mak
2054 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00002055fi
bellard997344f2003-10-27 21:10:39 +00002056if test "$target_user_only" = "yes" ; then
2057 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2058 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2059fi
ths831b7822007-01-18 20:06:33 +00002060if test "$target_linux_user" = "yes" ; then
2061 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2062 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2063fi
2064if test "$target_darwin_user" = "yes" ; then
2065 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2066 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2067fi
pbrook56aebc82008-10-11 17:55:29 +00002068list=""
2069if test ! -z "$gdb_xml_files" ; then
2070 for x in $gdb_xml_files; do
2071 list="$list $source_path/gdb-xml/$x"
2072 done
2073fi
2074echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00002075
aurel320938cda2008-04-11 21:36:06 +00002076if test "$target_cpu" = "arm" \
2077 -o "$target_cpu" = "armeb" \
2078 -o "$target_cpu" = "m68k" \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02002079 -o "$target_cpu" = "microblaze" \
aurel320938cda2008-04-11 21:36:06 +00002080 -o "$target_cpu" = "mips" \
2081 -o "$target_cpu" = "mipsel" \
2082 -o "$target_cpu" = "mipsn32" \
2083 -o "$target_cpu" = "mipsn32el" \
2084 -o "$target_cpu" = "mips64" \
2085 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00002086 -o "$target_cpu" = "ppc" \
2087 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00002088 -o "$target_cpu" = "ppc64abi32" \
2089 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00002090 -o "$target_cpu" = "sparc" \
2091 -o "$target_cpu" = "sparc64" \
2092 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00002093 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2094 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2095fi
pbrooke5fe0c52006-06-11 13:32:59 +00002096if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2097 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2098 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2099fi
pbrookbd0c5662008-05-29 14:34:11 +00002100if test "$target_user_only" = "yes" \
2101 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2102 echo "#define USE_NPTL 1" >> $config_h
2103fi
blueswir1cb33da52007-10-09 16:34:29 +00002104# 32 bit ELF loader in addition to native 64 bit loader?
2105if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2106 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2107 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2108fi
blueswir184778502008-10-26 20:33:16 +00002109if test "$target_bsd_user" = "yes" ; then
2110 echo "CONFIG_BSD_USER=yes" >> $config_mak
2111 echo "#define CONFIG_BSD_USER 1" >> $config_h
2112fi
bellard5b0753e2005-03-01 21:37:28 +00002113
ths15d9ca02007-07-31 23:07:32 +00002114test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2115
bellard97a847b2003-08-10 21:36:04 +00002116done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00002117
2118# build tree in object directory if source path is different from current one
2119if test "$source_path_used" = "yes" ; then
Anthony Liguori019d6b82009-05-09 17:14:19 -05002120 DIRS="tests tests/cris slirp audio block"
bellard7d132992003-03-06 23:23:54 +00002121 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00002122 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00002123 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00002124 for dir in $DIRS ; do
2125 mkdir -p $dir
2126 done
bellardec530c82006-04-25 22:36:06 +00002127 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00002128 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00002129 rm -f $f
2130 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00002131 done
2132fi
Paul Brook1ad21342009-05-19 16:17:58 +01002133
2134for hwlib in 32 64; do
2135 d=libhw$hwlib
2136 mkdir -p $d
2137 rm -f $d/Makefile
2138 ln -s $source_path/Makefile.hw $d/Makefile
2139 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2140 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2141done