blob: 54eb0bf947893014cad0832d827c3eb48c815962 [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"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100160debug="no"
aliguori03b4fe72008-10-07 19:16:17 +0000161sparse="no"
aliguori1625af82009-04-05 17:41:02 +0000162strip_opt="yes"
bellard7d132992003-03-06 23:23:54 +0000163bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000164mingw32="no"
165EXESUF=""
bellard443f1372004-06-04 11:13:20 +0000166slirp="yes"
aliguorie0e6c8c02008-07-23 18:14:33 +0000167vde="yes"
bellard102a52e2004-11-14 19:57:29 +0000168fmod_lib=""
169fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000170oss_lib=""
ths8d5d2d42007-08-25 01:37:51 +0000171vnc_tls="yes"
aliguori2f9606b2009-03-06 20:27:28 +0000172vnc_sasl="yes"
pbrookb1a550a2006-04-16 13:28:56 +0000173bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000174linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000175solaris="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000176kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000177profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000178cocoa="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000179softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000180linux_user="no"
181darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000182bsd_user="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500183build_docs="yes"
pbrookc5937222006-05-14 11:30:38 +0000184uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000185curses="yes"
Alexander Graf769ce762009-05-11 17:41:42 +0200186curl="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000187pthread="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000188aio="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000189io_thread="no"
pbrookbd0c5662008-05-29 14:34:11 +0000190nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000191mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000192bluez="yes"
Jan Kiszkadff840342009-06-14 20:05:02 +0200193kvm="no"
aliguorieac30262008-11-05 16:28:56 +0000194kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000195aix="no"
ths77755342008-11-27 15:45:16 +0000196blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000197fdt="yes"
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500198sdl="yes"
aliguori5368a422009-03-03 17:37:21 +0000199sdl_x11="no"
aliguorie37630c2009-04-22 15:19:10 +0000200xen="yes"
pbrook4a19f1e2009-04-07 23:17:49 +0000201pkgversion=""
bellard7d132992003-03-06 23:23:54 +0000202
203# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000204if check_define __linux__ ; then
205 targetos="Linux"
206elif check_define _WIN32 ; then
207 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000208elif check_define __OpenBSD__ ; then
209 targetos='OpenBSD'
210elif check_define __sun__ ; then
211 targetos='SunOS'
aliguoriac0df512008-12-29 17:14:15 +0000212else
213 targetos=`uname -s`
214fi
bellard7d132992003-03-06 23:23:54 +0000215case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000216CYGWIN*)
217mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000218OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000219if [ "$cpu" = "i386" ] ; then
220 kqemu="yes"
221fi
malcc2de5c92008-06-28 19:13:06 +0000222audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000223;;
bellard67b915a2004-03-31 23:37:16 +0000224MINGW32*)
225mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000226if [ "$cpu" = "i386" ] ; then
227 kqemu="yes"
228fi
malcc2de5c92008-06-28 19:13:06 +0000229audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000230;;
ths5c40d2b2007-06-23 16:03:36 +0000231GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000232audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000233audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000234if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
235 kqemu="yes"
236fi
237;;
bellard7d3505c2004-05-12 19:32:15 +0000238FreeBSD)
239bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000240audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000241audio_possible_drivers="oss sdl esd pa"
bellarde99f9062005-07-28 21:45:38 +0000242if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000243 kqemu="yes"
244fi
bellard7d3505c2004-05-12 19:32:15 +0000245;;
blueswir1c5e97232009-03-07 20:06:23 +0000246DragonFly)
247bsd="yes"
248audio_drv_list="oss"
249audio_possible_drivers="oss sdl esd pa"
250if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
251 kqemu="yes"
252fi
253aio="no"
254;;
bellard7d3505c2004-05-12 19:32:15 +0000255NetBSD)
256bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000257audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000258audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000259oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000260;;
261OpenBSD)
262bsd="yes"
blueswir1128ab2f2008-08-15 18:33:42 +0000263openbsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000264audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000265audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000266oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000267;;
bellard83fb7ad2004-07-05 21:25:26 +0000268Darwin)
269bsd="yes"
270darwin="yes"
aliguori1b0f9cc2009-01-26 15:37:40 +0000271# 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 +0000272if [ "$cpu" = "i386" ] ; then
273 is_x86_64=`sysctl -n hw.optional.x86_64`
274 [ "$is_x86_64" = "1" ] && cpu=x86_64
aliguori1b0f9cc2009-01-26 15:37:40 +0000275fi
276if [ "$cpu" = "x86_64" ] ; then
277 OS_CFLAGS="-arch x86_64"
278 LDFLAGS="-arch x86_64"
279else
280 OS_CFLAGS="-mdynamic-no-pic"
281fi
ths831b7822007-01-18 20:06:33 +0000282darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000283cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000284audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000285audio_possible_drivers="coreaudio sdl fmod"
thsc2c59c32008-01-08 00:00:20 +0000286OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
bellard83fb7ad2004-07-05 21:25:26 +0000287;;
bellardec530c82006-04-25 22:36:06 +0000288SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000289 solaris="yes"
290 make="gmake"
291 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000292 needs_libsunmath="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"
Jan Kiszkadff840342009-06-14 20:05:02 +0200332kvm="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000333if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000334 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000335 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000336fi
bellardfb065182004-11-09 23:09:44 +0000337;;
bellard7d132992003-03-06 23:23:54 +0000338esac
339
bellard7d3505c2004-05-12 19:32:15 +0000340if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000341 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000342 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000343 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000344 fi
blueswir184778502008-10-26 20:33:16 +0000345 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000346fi
347
bellard7d132992003-03-06 23:23:54 +0000348# find source path
pbrookad064842006-04-16 12:41:07 +0000349source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000350source_path_used="no"
351workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000352if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000353 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000354else
355 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000356fi
pbrook724db112008-02-03 19:20:13 +0000357[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000358
Anthony Liguori487fefd2009-06-11 13:28:25 -0500359werror=""
bellard85aa5182007-11-11 20:17:03 +0000360
bellard7d132992003-03-06 23:23:54 +0000361for opt do
pbrooka46e4032006-04-29 23:05:22 +0000362 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000363 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000364 --help|-h) show_help=yes
365 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000366 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000367 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000368 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000369 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000370 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000371 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000372 ;;
aliguoriac0df512008-12-29 17:14:15 +0000373 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000374 ;;
aliguoriac0df512008-12-29 17:14:15 +0000375 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000376 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000377 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000378 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000379 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000380 ;;
pbrook6a882642006-04-17 13:57:12 +0000381 --install=*) install="$optarg"
382 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000383 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000384 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000385 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000386 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000387 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000388 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000389 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000390 ;;
bellard7d132992003-03-06 23:23:54 +0000391 --enable-gprof) gprof="yes"
392 ;;
bellard43ce4df2003-06-09 19:53:12 +0000393 --static) static="yes"
394 ;;
bellard97a847b2003-08-10 21:36:04 +0000395 --disable-sdl) sdl="no"
396 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000397 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000398 ;;
malcc2de5c92008-06-28 19:13:06 +0000399 --fmod-inc=*) fmod_inc="$optarg"
400 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000401 --oss-lib=*) oss_lib="$optarg"
402 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000403 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000404 ;;
405 --audio-drv-list=*) audio_drv_list="$optarg"
406 ;;
aurel32f8393942009-04-13 18:45:38 +0000407 --enable-debug-tcg) debug_tcg="yes"
408 ;;
409 --disable-debug-tcg) debug_tcg="no"
410 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100411 --enable-debug)
412 # Enable debugging options that aren't excessively noisy
413 debug_tcg="yes"
414 debug="yes"
415 strip_opt="no"
416 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000417 --enable-sparse) sparse="yes"
418 ;;
419 --disable-sparse) sparse="no"
420 ;;
aliguori1625af82009-04-05 17:41:02 +0000421 --disable-strip) strip_opt="no"
422 ;;
ths8d5d2d42007-08-25 01:37:51 +0000423 --disable-vnc-tls) vnc_tls="no"
424 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000425 --disable-vnc-sasl) vnc_sasl="no"
426 ;;
bellard443f1372004-06-04 11:13:20 +0000427 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000428 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000429 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000430 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000431 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000432 ;;
aliguorie37630c2009-04-22 15:19:10 +0000433 --disable-xen) xen="no"
434 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000435 --disable-brlapi) brlapi="no"
436 ;;
balrogfb599c92008-09-28 23:49:55 +0000437 --disable-bluez) bluez="no"
438 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000439 --disable-kvm) kvm="no"
440 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000441 --enable-profiler) profiler="yes"
442 ;;
malcc2de5c92008-06-28 19:13:06 +0000443 --enable-cocoa)
444 cocoa="yes" ;
445 sdl="no" ;
446 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000447 ;;
pbrookcad25d62006-03-19 16:31:11 +0000448 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000449 ;;
pbrookcad25d62006-03-19 16:31:11 +0000450 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000451 ;;
ths831b7822007-01-18 20:06:33 +0000452 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000453 ;;
ths831b7822007-01-18 20:06:33 +0000454 --enable-linux-user) linux_user="yes"
455 ;;
456 --disable-darwin-user) darwin_user="no"
457 ;;
458 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000459 ;;
blueswir184778502008-10-26 20:33:16 +0000460 --disable-bsd-user) bsd_user="no"
461 ;;
462 --enable-bsd-user) bsd_user="yes"
463 ;;
pbrookc5937222006-05-14 11:30:38 +0000464 --enable-uname-release=*) uname_release="$optarg"
465 ;;
blueswir131422552007-04-16 18:27:06 +0000466 --sparc_cpu=*)
467 sparc_cpu="$optarg"
468 case $sparc_cpu in
469 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
Blue Swirl600309b2009-07-03 17:44:00 +0000470 target_arch2="sparc"; cpu="sparc" ;;
blueswir131422552007-04-16 18:27:06 +0000471 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
Blue Swirl600309b2009-07-03 17:44:00 +0000472 target_arch2="sparc"; cpu="sparc" ;;
blueswir131422552007-04-16 18:27:06 +0000473 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
Blue Swirl600309b2009-07-03 17:44:00 +0000474 target_arch2="sparc64"; cpu="sparc64" ;;
blueswir131422552007-04-16 18:27:06 +0000475 *) echo "undefined SPARC architecture. Exiting";exit 1;;
476 esac
477 ;;
bellard85aa5182007-11-11 20:17:03 +0000478 --enable-werror) werror="yes"
479 ;;
480 --disable-werror) werror="no"
481 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000482 --disable-curses) curses="no"
483 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200484 --disable-curl) curl="no"
485 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000486 --disable-nptl) nptl="no"
487 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000488 --enable-mixemu) mixemu="yes"
489 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000490 --disable-pthread) pthread="no"
491 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000492 --disable-aio) aio="no"
493 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000494 --enable-io-thread) io_thread="yes"
495 ;;
ths77755342008-11-27 15:45:16 +0000496 --disable-blobs) blobs="no"
497 ;;
aliguorieac30262008-11-05 16:28:56 +0000498 --kerneldir=*) kerneldir="$optarg"
499 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000500 --with-pkgversion=*) pkgversion=" ($optarg)"
501 ;;
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500502 --disable-docs) build_docs="no"
503 ;;
balrog7f1559c2007-11-17 10:24:32 +0000504 *) echo "ERROR: unknown option $opt"; show_help="yes"
505 ;;
bellard7d132992003-03-06 23:23:54 +0000506 esac
507done
508
ths6f30fa82007-01-05 01:00:47 +0000509# default flags for all hosts
Paul Brookf3d08ee2009-06-04 11:39:04 +0100510CFLAGS="$CFLAGS -g -fno-strict-aliasing"
511if test "$debug" = "no" ; then
512 CFLAGS="$CFLAGS -O2"
513fi
blueswir1e0e36fe2008-12-07 19:16:27 +0000514CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000515LDFLAGS="$LDFLAGS -g"
Blue Swirl1172f652009-06-13 15:37:55 +0000516
517# Consult white-list to determine whether to enable werror
518# by default. Only enable by default for git builds
519if test -z "$werror" ; then
520 z_version=`cut -f3 -d. $source_path/VERSION`
521 if test "$z_version" = "50" -a \
522 "$linux" = "yes" ; then
523 werror="yes"
524 else
525 werror="no"
526 fi
527fi
528
bellard85aa5182007-11-11 20:17:03 +0000529if test "$werror" = "yes" ; then
Blue Swirl1172f652009-06-13 15:37:55 +0000530 CFLAGS="$CFLAGS -Werror"
bellard85aa5182007-11-11 20:17:03 +0000531fi
ths6f30fa82007-01-05 01:00:47 +0000532
blueswir1d2c7c9b2008-11-01 14:50:20 +0000533if test "$solaris" = "no" ; then
534 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
535 LDFLAGS="$LDFLAGS -Wl,--warn-common"
536 fi
blueswir149237ac2008-09-17 19:05:19 +0000537fi
538
blueswir131422552007-04-16 18:27:06 +0000539#
540# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
541# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
542#
bellard40293e52008-01-31 11:32:10 +0000543case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000544 sparc) if test -z "$sparc_cpu" ; then
545 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
546 ARCH_LDFLAGS="-m32"
547 else
548 ARCH_CFLAGS="${SP_CFLAGS}"
549 ARCH_LDFLAGS="${SP_LDFLAGS}"
550 fi
blueswir1762e8232009-04-04 09:21:28 +0000551 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
552 if test "$solaris" = "no" ; then
553 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
554 fi
blueswir131422552007-04-16 18:27:06 +0000555 ;;
556 sparc64) if test -z "$sparc_cpu" ; then
557 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
558 ARCH_LDFLAGS="-m64"
559 else
560 ARCH_CFLAGS="${SP_CFLAGS}"
561 ARCH_LDFLAGS="${SP_LDFLAGS}"
562 fi
blueswir1762e8232009-04-04 09:21:28 +0000563 if test "$solaris" = "no" ; then
564 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
565 else
566 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
567 fi
blueswir131422552007-04-16 18:27:06 +0000568 ;;
ths76d83bd2007-11-18 21:22:10 +0000569 s390)
570 ARCH_CFLAGS="-march=z900"
571 ;;
bellard40293e52008-01-31 11:32:10 +0000572 i386)
573 ARCH_CFLAGS="-m32"
574 ARCH_LDFLAGS="-m32"
575 ;;
576 x86_64)
577 ARCH_CFLAGS="-m64"
578 ARCH_LDFLAGS="-m64"
579 ;;
blueswir131422552007-04-16 18:27:06 +0000580esac
581
pbrookaf5db582006-04-08 14:26:41 +0000582if test x"$show_help" = x"yes" ; then
583cat << EOF
584
585Usage: configure [options]
586Options: [defaults in brackets after descriptions]
587
588EOF
589echo "Standard options:"
590echo " --help print this message"
591echo " --prefix=PREFIX install in PREFIX [$prefix]"
592echo " --interp-prefix=PREFIX where to find shared libraries, etc."
593echo " use %M for cpu name [$interp_prefix]"
594echo " --target-list=LIST set target list [$target_list]"
595echo ""
596echo "kqemu kernel acceleration support:"
597echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000598echo ""
599echo "Advanced options (experts only):"
600echo " --source-path=PATH path of source code [$source_path]"
601echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
602echo " --cc=CC use C compiler CC [$cc]"
603echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
aurel322981fa92009-04-07 19:57:17 +0000604echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
605echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000606echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000607echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000608echo " --static enable static build [$static]"
aurel32f8393942009-04-13 18:45:38 +0000609echo " --enable-debug-tcg enable TCG debugging"
610echo " --disable-debug-tcg disable TCG debugging (default)"
Stefan Weil09695a42009-06-06 16:51:30 +0200611echo " --enable-debug enable common debug build options"
aliguori890b1652008-10-07 21:22:41 +0000612echo " --enable-sparse enable sparse checker"
613echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000614echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000615echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000616echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000617echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000618echo " --audio-drv-list=LIST set audio drivers list:"
619echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000620echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
621echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000622echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000623echo " --disable-xen disable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000624echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000625echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000626echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000627echo " --disable-curses disable curses output"
Alexander Graf769ce762009-05-11 17:41:42 +0200628echo " --disable-curl disable curl connectivity"
balrogfb599c92008-09-28 23:49:55 +0000629echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000630echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000631echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000632echo " --enable-system enable all system emulation targets"
633echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000634echo " --enable-linux-user enable all linux usermode emulation targets"
635echo " --disable-linux-user disable all linux usermode emulation targets"
636echo " --enable-darwin-user enable all darwin usermode emulation targets"
637echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000638echo " --enable-bsd-user enable all BSD usermode emulation targets"
639echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000640echo " --fmod-lib path to FMOD library"
641echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000642echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000643echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000644echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000645echo " --disable-vde disable support for vde network"
aliguorie5d355d2009-04-24 18:03:15 +0000646echo " --disable-pthread disable pthread support"
blueswir1414f0da2008-08-15 18:20:52 +0000647echo " --disable-aio disable AIO support"
aliguorie5d355d2009-04-24 18:03:15 +0000648echo " --enable-io-thread enable IO thread"
ths77755342008-11-27 15:45:16 +0000649echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000650echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000651echo ""
ths5bf08932006-12-23 00:33:26 +0000652echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000653exit 1
654fi
655
bellard67b915a2004-03-31 23:37:16 +0000656if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000657 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000658 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000659 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000660 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000661 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000662 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000663fi
664
aliguori03b4fe72008-10-07 19:16:17 +0000665if test ! -x "$(which cgcc 2>/dev/null)"; then
666 sparse="no"
667fi
668
bellardec530c82006-04-25 22:36:06 +0000669#
670# Solaris specific configure tool chain decisions
671#
672if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000673 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
674 if test -z "$solinst" ; then
675 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
676 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
677 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
678 exit 1
679 fi
680 if test "$solinst" = "/usr/sbin/install" ; then
681 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
682 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
683 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
684 exit 1
685 fi
bellardec530c82006-04-25 22:36:06 +0000686 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
687 if test -z "$sol_ar" ; then
688 echo "Error: No path includes ar"
689 if test -f /usr/ccs/bin/ar ; then
690 echo "Add /usr/ccs/bin to your path and rerun configure"
691 fi
692 exit 1
693 fi
ths5fafdf22007-09-16 21:08:06 +0000694fi
bellardec530c82006-04-25 22:36:06 +0000695
696
bellard5327cf42005-01-10 23:18:50 +0000697if test -z "$target_list" ; then
698# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000699 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000700 target_list="\
701i386-softmmu \
702x86_64-softmmu \
703arm-softmmu \
704cris-softmmu \
705m68k-softmmu \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200706microblaze-softmmu \
aurel322408a522008-04-20 20:19:44 +0000707mips-softmmu \
708mipsel-softmmu \
709mips64-softmmu \
710mips64el-softmmu \
711ppc-softmmu \
712ppcemb-softmmu \
713ppc64-softmmu \
714sh4-softmmu \
715sh4eb-softmmu \
716sparc-softmmu \
Igor V. Kovalenko1b64fca2009-06-23 18:04:16 +0000717sparc64-softmmu \
aurel322408a522008-04-20 20:19:44 +0000718"
pbrook0a8e90f2006-03-19 14:54:16 +0000719 fi
bellard5327cf42005-01-10 23:18:50 +0000720# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000721 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000722 target_list="${target_list}\
723i386-linux-user \
724x86_64-linux-user \
725alpha-linux-user \
726arm-linux-user \
727armeb-linux-user \
728cris-linux-user \
729m68k-linux-user \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200730microblaze-linux-user \
aurel322408a522008-04-20 20:19:44 +0000731mips-linux-user \
732mipsel-linux-user \
733ppc-linux-user \
734ppc64-linux-user \
735ppc64abi32-linux-user \
736sh4-linux-user \
737sh4eb-linux-user \
738sparc-linux-user \
739sparc64-linux-user \
740sparc32plus-linux-user \
741"
ths831b7822007-01-18 20:06:33 +0000742 fi
743# the following are Darwin specific
744 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000745 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000746 fi
blueswir184778502008-10-26 20:33:16 +0000747# the following are BSD specific
748 if [ "$bsd_user" = "yes" ] ; then
749 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000750i386-bsd-user \
751x86_64-bsd-user \
752sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000753sparc64-bsd-user \
754"
755 fi
bellard6e20a452005-06-05 15:56:02 +0000756else
pbrookb1a550a2006-04-16 13:28:56 +0000757 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000758fi
pbrook0a8e90f2006-03-19 14:54:16 +0000759if test -z "$target_list" ; then
760 echo "No targets enabled"
761 exit 1
762fi
bellard5327cf42005-01-10 23:18:50 +0000763
bellard7d132992003-03-06 23:23:54 +0000764if test -z "$cross_prefix" ; then
765
766# ---
767# big/little endian test
768cat > $TMPC << EOF
769#include <inttypes.h>
770int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000771 volatile uint32_t i=0x01234567;
772 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000773}
774EOF
775
aurel32178baee2008-12-08 18:11:57 +0000776if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000777$TMPE && bigendian="yes"
778else
779echo big/little test failed
780fi
781
782else
783
784# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000785if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000786 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000787 -o "$cpu" = "m68k" \
788 -o "$cpu" = "mips" \
789 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000790 -o "$cpu" = "ppc" \
791 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000792 -o "$cpu" = "s390" \
793 -o "$cpu" = "sparc" \
794 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000795 bigendian="yes"
796fi
797
798fi
799
bellardb6853692005-06-05 17:10:39 +0000800# host long bits test
801hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000802if test "$cpu" = "x86_64" \
803 -o "$cpu" = "alpha" \
804 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000805 -o "$cpu" = "sparc64" \
806 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000807 hostlongbits="64"
808fi
809
pbrookbd0c5662008-05-29 14:34:11 +0000810# Check host NPTL support
811cat > $TMPC <<EOF
812#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000813#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000814void foo()
815{
816#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
817#error bork
818#endif
819}
820EOF
821
balrog8c7f7572008-12-15 03:15:36 +0000822if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000823 :
824else
825 nptl="no"
826fi
827
bellard11d9f692004-04-02 20:55:59 +0000828##########################################
balrogac629222008-10-11 09:56:04 +0000829# zlib check
830
831cat > $TMPC << EOF
832#include <zlib.h>
833int main(void) { zlibVersion(); return 0; }
834EOF
balrog8c7f7572008-12-15 03:15:36 +0000835if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000836 :
837else
838 echo
839 echo "Error: zlib check failed"
840 echo "Make sure to have the zlib libs and headers installed."
841 echo
842 exit 1
843fi
844
845##########################################
aliguorie37630c2009-04-22 15:19:10 +0000846# xen probe
847
848if test "$xen" = "yes" ; then
849cat > $TMPC <<EOF
850#include <xenctrl.h>
851#include <xs.h>
852int main(void) { xs_daemon_open; xc_interface_open; }
853EOF
Jan Kiszka918a6082009-04-27 17:16:55 +0000854 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null > /dev/null ; then
aliguorie37630c2009-04-22 15:19:10 +0000855 :
856 else
857 xen="no"
858 fi
859fi
860
861##########################################
bellard11d9f692004-04-02 20:55:59 +0000862# SDL probe
863
864sdl_too_old=no
865
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500866if test "$sdl" = "yes" ; then
ths069b0bd2007-07-12 00:27:15 +0000867 sdl_config="sdl-config"
868 sdl=no
869 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000870
871cat > $TMPC << EOF
872#include <SDL.h>
873#undef main /* We don't want SDL to override our main() */
874int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
875EOF
balrog8c7f7572008-12-15 03:15:36 +0000876 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 +0000877 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
878 if test "$_sdlversion" -lt 121 ; then
879 sdl_too_old=yes
880 else
881 if test "$cocoa" = "no" ; then
882 sdl=yes
883 fi
884 fi
885
886 # static link with sdl ?
887 if test "$sdl" = "yes" ; then
888 aa="no"
889 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
890 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
891 if [ "$aa" = "yes" ] ; then
892 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000893 fi
bellard11d9f692004-04-02 20:55:59 +0000894
balrog8c7f7572008-12-15 03:15:36 +0000895 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 +0000896 sdl_static=yes
897 fi
898 fi # static link
899 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000900else
ths069b0bd2007-07-12 00:27:15 +0000901 # Make sure to disable cocoa if sdl was set
902 if test "$sdl" = "yes" ; then
903 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000904 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000905 fi
bellarda6e022a2004-04-02 21:55:47 +0000906fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000907
aliguori5368a422009-03-03 17:37:21 +0000908if test "$sdl" = "yes" ; then
909cat > $TMPC <<EOF
910#include <SDL.h>
911#if defined(SDL_VIDEO_DRIVER_X11)
912#include <X11/XKBlib.h>
913#else
914#error No x11 support
915#endif
916int main(void) { return 0; }
917EOF
918 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
919 sdl_x11="yes"
920 fi
921fi
922
ths8f28f3f2007-01-05 21:25:54 +0000923##########################################
ths8d5d2d42007-08-25 01:37:51 +0000924# VNC TLS detection
925if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000926cat > $TMPC <<EOF
927#include <gnutls/gnutls.h>
928int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
929EOF
930 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
931 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
932 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000933 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000934 :
935 else
936 vnc_tls="no"
937 fi
ths8d5d2d42007-08-25 01:37:51 +0000938fi
939
940##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000941# VNC SASL detection
942if test "$vnc_sasl" = "yes" ; then
943cat > $TMPC <<EOF
944#include <sasl/sasl.h>
945#include <stdio.h>
946int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
947EOF
948 # Assuming Cyrus-SASL installed in /usr prefix
949 vnc_sasl_cflags=""
950 vnc_sasl_libs="-lsasl2"
951 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
Jan Kiszka918a6082009-04-27 17:16:55 +0000952 $vnc_sasl_libs 2> /dev/null > /dev/null ; then
aliguori2f9606b2009-03-06 20:27:28 +0000953 :
954 else
955 vnc_sasl="no"
956 fi
957fi
958
959##########################################
aliguori76655d62009-03-06 20:27:37 +0000960# fnmatch() probe, used for ACL routines
961fnmatch="no"
962cat > $TMPC << EOF
963#include <fnmatch.h>
964int main(void)
965{
966 fnmatch("foo", "foo", 0);
967 return 0;
968}
969EOF
970if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
971 fnmatch="yes"
972fi
973
974##########################################
ths8a16d272008-07-19 09:56:24 +0000975# vde libraries probe
976if test "$vde" = "yes" ; then
977 cat > $TMPC << EOF
978#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000979int main(void)
980{
981 struct vde_open_args a = {0, 0, 0};
982 vde_open("", "", &a);
983 return 0;
984}
ths8a16d272008-07-19 09:56:24 +0000985EOF
balrog8c7f7572008-12-15 03:15:36 +0000986 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000987 :
988 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000989 vde="no"
ths8a16d272008-07-19 09:56:24 +0000990 fi
991fi
992
993##########################################
malcc2de5c92008-06-28 19:13:06 +0000994# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000995
malcc2de5c92008-06-28 19:13:06 +0000996audio_drv_probe()
997{
998 drv=$1
999 hdr=$2
1000 lib=$3
1001 exp=$4
1002 cfl=$5
1003 cat > $TMPC << EOF
1004#include <$hdr>
1005int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00001006EOF
balrog8c7f7572008-12-15 03:15:36 +00001007 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +00001008 :
1009 else
1010 echo
1011 echo "Error: $drv check failed"
1012 echo "Make sure to have the $drv libs and headers installed."
1013 echo
1014 exit 1
1015 fi
1016}
1017
malc2fa7d3b2008-07-29 12:58:44 +00001018audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00001019for drv in $audio_drv_list; do
1020 case $drv in
1021 alsa)
1022 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1023 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1024 ;;
1025
1026 fmod)
1027 if test -z $fmod_lib || test -z $fmod_inc; then
1028 echo
1029 echo "Error: You must specify path to FMOD library and headers"
1030 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1031 echo
1032 exit 1
1033 fi
1034 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1035 ;;
1036
1037 esd)
1038 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1039 ;;
malcb8e59f12008-07-02 21:03:08 +00001040
1041 pa)
1042 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1043 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1044 ;;
1045
blueswir12f6a1ab2008-08-21 18:00:53 +00001046 oss|sdl|core|wav|dsound)
1047 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1048 ;;
1049
malce4c63a62008-07-19 16:15:16 +00001050 *)
malc1c9b2a52008-07-19 16:57:30 +00001051 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001052 echo
1053 echo "Error: Unknown driver '$drv' selected"
1054 echo "Possible drivers are: $audio_possible_drivers"
1055 echo
1056 exit 1
1057 }
1058 ;;
malcc2de5c92008-06-28 19:13:06 +00001059 esac
1060done
ths8f28f3f2007-01-05 21:25:54 +00001061
balrog4d3b6f62008-02-10 16:33:14 +00001062##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001063# BrlAPI probe
1064
1065if test -z "$brlapi" ; then
1066 brlapi=no
1067cat > $TMPC << EOF
1068#include <brlapi.h>
1069int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1070EOF
aurel32178baee2008-12-08 18:11:57 +00001071 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +00001072 brlapi=yes
1073 fi # brlapi compile test
1074fi # -z $brlapi
1075
1076##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001077# curses probe
1078
1079if test "$curses" = "yes" ; then
1080 curses=no
Jan Kiszkaab4e5602009-06-24 12:29:11 +02001081 ncurses=no
balrog4d3b6f62008-02-10 16:33:14 +00001082 cat > $TMPC << EOF
1083#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001084#ifdef __OpenBSD__
1085#define resize_term resizeterm
1086#endif
1087int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001088EOF
Jan Kiszkaab4e5602009-06-24 12:29:11 +02001089 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lncurses > /dev/null 2> /dev/null ; then
1090 curses=yes
1091 ncurses=yes
1092 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001093 curses=yes
1094 fi
1095fi # test "$curses"
1096
blueswir1414f0da2008-08-15 18:20:52 +00001097##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001098# curl probe
1099
1100if test "$curl" = "yes" ; then
1101 curl=no
1102 cat > $TMPC << EOF
1103#include <curl/curl.h>
1104int main(void) { return curl_easy_init(); }
1105EOF
Paul Brook52368552009-05-22 17:22:38 +01001106 curl_libs=`curl-config --libs 2>/dev/null`
Alexander Graf769ce762009-05-11 17:41:42 +02001107 if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1108 curl=yes
1109 fi
1110fi # test "$curl"
1111
1112##########################################
balrogfb599c92008-09-28 23:49:55 +00001113# bluez support probe
1114if test "$bluez" = "yes" ; then
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001115 `pkg-config bluez 2> /dev/null` || bluez="no"
balrogfb599c92008-09-28 23:49:55 +00001116fi
1117if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001118 cat > $TMPC << EOF
1119#include <bluetooth/bluetooth.h>
1120int main(void) { return bt_error(0); }
1121EOF
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001122 bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1123 bluez_libs=`pkg-config --libs bluez 2> /dev/null`
balrog17e15922008-10-11 12:00:42 +00001124 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001125 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001126 :
1127 else
1128 bluez="no"
1129 fi
balrogfb599c92008-09-28 23:49:55 +00001130fi
1131
1132##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001133# kvm probe
1134if test "$kvm" = "yes" ; then
1135 cat > $TMPC <<EOF
1136#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001137#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001138#error Invalid KVM version
1139#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001140#if !defined(KVM_CAP_USER_MEMORY)
1141#error Missing KVM capability KVM_CAP_USER_MEMORY
1142#endif
1143#if !defined(KVM_CAP_SET_TSS_ADDR)
1144#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1145#endif
1146#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1147#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1148#endif
aliguori7ba1e612008-11-05 16:04:33 +00001149int main(void) { return 0; }
1150EOF
aliguorieac30262008-11-05 16:28:56 +00001151 if test "$kerneldir" != "" ; then
1152 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001153 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1154 -a -d "$kerneldir/arch/x86/include" ; then
1155 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001156 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1157 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001158 elif test -d "$kerneldir/arch/$cpu/include" ; then
1159 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1160 fi
aliguorieac30262008-11-05 16:28:56 +00001161 else
1162 kvm_cflags=""
1163 fi
aliguori7ba1e612008-11-05 16:04:33 +00001164 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001165 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001166 :
1167 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001168 kvm="no";
1169 if [ -x "`which awk 2>/dev/null`" ] && \
1170 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001171 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001172 | grep "error: " \
1173 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1174 if test "$kvmerr" != "" ; then
Jan Kiszka168ccc12009-06-07 11:30:25 +02001175 kvm="no - (${kvmerr})\n\
1176 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1177recent kvm-kmod from http://sourceforge.net/projects/kvm."
aliguori9fd8d8d2009-01-15 21:57:30 +00001178 fi
1179 fi
aliguori7ba1e612008-11-05 16:04:33 +00001180 fi
1181fi
1182
1183##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001184# pthread probe
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001185PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
aliguorie5d355d2009-04-24 18:03:15 +00001186PTHREADLIBS=""
aliguori3c529d92008-12-12 16:41:40 +00001187
aliguorie5d355d2009-04-24 18:03:15 +00001188if test "$pthread" = yes; then
1189 pthread=no
1190cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001191#include <pthread.h>
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001192int main(void) { pthread_create(0,0,0,0); return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001193EOF
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001194 for pthread_lib in $PTHREADLIBS_LIST; do
1195 if $cc $ARCH_CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null > /dev/null ; then
1196 pthread=yes
1197 PTHREADLIBS="$pthread_lib"
1198 break
1199 fi
1200 done
blueswir1414f0da2008-08-15 18:20:52 +00001201fi
1202
aliguorie5d355d2009-04-24 18:03:15 +00001203if test "$pthread" = no; then
1204 aio=no
1205 io_thread=no
1206fi
1207
aliguoribf9298b2008-12-05 20:05:26 +00001208##########################################
1209# iovec probe
1210cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001211#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001212#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001213#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001214int main(void) { struct iovec iov; return 0; }
1215EOF
1216iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001217if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001218 iovec=yes
1219fi
1220
aurel32f652e6a2008-12-16 10:43:48 +00001221##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001222# preadv probe
1223cat > $TMPC <<EOF
1224#include <sys/types.h>
1225#include <sys/uio.h>
1226#include <unistd.h>
1227int main(void) { preadv; }
1228EOF
1229preadv=no
1230if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1231 preadv=yes
1232fi
1233
1234##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001235# fdt probe
1236if test "$fdt" = "yes" ; then
1237 fdt=no
1238 cat > $TMPC << EOF
1239int main(void) { return 0; }
1240EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001241 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null > /dev/null ; then
aurel32f652e6a2008-12-16 10:43:48 +00001242 fdt=yes
1243 fi
1244fi
1245
aurel323b3f24a2009-04-15 16:12:13 +00001246#
1247# Check for xxxat() functions when we are building linux-user
1248# emulator. This is done because older glibc versions don't
1249# have syscall stubs for these implemented.
1250#
1251atfile=no
1252if [ "$linux_user" = "yes" ] ; then
1253 cat > $TMPC << EOF
1254#define _ATFILE_SOURCE
1255#include <sys/types.h>
1256#include <fcntl.h>
1257#include <unistd.h>
1258
1259int
1260main(void)
1261{
1262 /* try to unlink nonexisting file */
1263 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1264}
1265EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001266 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001267 atfile=yes
1268 fi
1269fi
1270
aurel3239386ac2009-04-15 19:48:17 +00001271# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001272# emulator. This is done because older glibc versions don't
1273# have syscall stubs for these implemented. In that case we
1274# don't provide them even if kernel supports them.
1275#
1276inotify=no
1277if [ "$linux_user" = "yes" ] ; then
1278 cat > $TMPC << EOF
1279#include <sys/inotify.h>
1280
1281int
1282main(void)
1283{
1284 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001285 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001286}
1287EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001288 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001289 inotify=yes
1290 fi
1291fi
1292
Riku Voipioebc996f2009-04-21 15:01:51 +03001293# check if utimensat and futimens are supported
1294utimens=no
1295cat > $TMPC << EOF
1296#define _ATFILE_SOURCE
1297#define _GNU_SOURCE
1298#include <stddef.h>
1299#include <fcntl.h>
1300
1301int main(void)
1302{
1303 utimensat(AT_FDCWD, "foo", NULL, 0);
1304 futimens(0, NULL);
1305 return 0;
1306}
1307EOF
1308if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1309 utimens=yes
1310fi
1311
Riku Voipio099d6b02009-05-05 12:10:04 +03001312# check if pipe2 is there
1313pipe2=no
1314cat > $TMPC << EOF
1315#define _GNU_SOURCE
1316#include <unistd.h>
1317#include <fcntl.h>
1318
1319int main(void)
1320{
1321 int pipefd[2];
1322 pipe2(pipefd, O_CLOEXEC);
1323 return 0;
1324}
1325EOF
1326if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1327 pipe2=yes
1328fi
1329
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301330# check if tee/splice is there. vmsplice was added same time.
1331splice=no
1332cat > $TMPC << EOF
1333#define _GNU_SOURCE
1334#include <unistd.h>
1335#include <fcntl.h>
1336#include <limits.h>
1337
1338int main(void)
1339{
1340 int len, fd;
1341 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1342 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1343 return 0;
1344}
1345EOF
1346if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1347 splice=yes
1348fi
1349
pbrookcc8ae6d2006-04-23 17:57:59 +00001350# Check if tools are available to build documentation.
Anthony Liguori70ec5dc2009-05-14 08:25:04 -05001351if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
1352 build_docs="no"
pbrookcc8ae6d2006-04-23 17:57:59 +00001353fi
1354
aliguorida93a1f2008-12-12 20:02:52 +00001355##########################################
1356# Do we need librt
aliguorie5d355d2009-04-24 18:03:15 +00001357CLOCKLIBS=""
aliguorida93a1f2008-12-12 20:02:52 +00001358cat > $TMPC <<EOF
1359#include <signal.h>
1360#include <time.h>
1361int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1362EOF
1363
1364rt=no
balrog8c7f7572008-12-15 03:15:36 +00001365if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001366 :
balrog8c7f7572008-12-15 03:15:36 +00001367elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001368 rt=yes
1369fi
1370
1371if test "$rt" = "yes" ; then
aliguorie5d355d2009-04-24 18:03:15 +00001372 CLOCKLIBS="-lrt"
aliguorida93a1f2008-12-12 20:02:52 +00001373fi
1374
bellard11d9f692004-04-02 20:55:59 +00001375if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001376 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001377 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001378 fi
1379 mansuffix=""
1380 datasuffix=""
1381 docsuffix=""
1382 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001383else
pbrook308c3592007-02-27 00:52:01 +00001384 if test -z "$prefix" ; then
1385 prefix="/usr/local"
1386 fi
1387 mansuffix="/share/man"
1388 datasuffix="/share/qemu"
1389 docsuffix="/share/doc/qemu"
1390 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001391fi
bellard5a671352003-10-01 00:13:48 +00001392
bellard43ce4df2003-06-09 19:53:12 +00001393echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001394echo "BIOS directory $prefix$datasuffix"
1395echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001396if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001397echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001398echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001399fi
bellard5a671352003-10-01 00:13:48 +00001400echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001401echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001402echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001403echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001404echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001405echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001406echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001407echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001408echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00001409echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00001410echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001411echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001412echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001413echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001414echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001415echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001416if test "$darwin" = "yes" ; then
1417 echo "Cocoa support $cocoa"
1418fi
bellard97a847b2003-08-10 21:36:04 +00001419echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001420if test "$sdl" != "no" ; then
1421 echo "SDL static link $sdl_static"
1422fi
balrog4d3b6f62008-02-10 16:33:14 +00001423echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02001424echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00001425echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001426echo "Audio drivers $audio_drv_list"
1427echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001428echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001429echo "VNC TLS support $vnc_tls"
1430if test "$vnc_tls" = "yes" ; then
1431 echo " TLS CFLAGS $vnc_tls_cflags"
1432 echo " TLS LIBS $vnc_tls_libs"
1433fi
aliguori2f9606b2009-03-06 20:27:28 +00001434echo "VNC SASL support $vnc_sasl"
1435if test "$vnc_sasl" = "yes" ; then
1436 echo " SASL CFLAGS $vnc_sasl_cflags"
1437 echo " SASL LIBS $vnc_sasl_libs"
1438fi
blueswir131422552007-04-16 18:27:06 +00001439if test -n "$sparc_cpu"; then
1440 echo "Target Sparc Arch $sparc_cpu"
1441fi
bellard07f4ddb2005-04-23 17:44:28 +00001442echo "kqemu support $kqemu"
aliguorie37630c2009-04-22 15:19:10 +00001443echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00001444echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001445echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001446[ ! -z "$uname_release" ] && \
1447echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001448echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001449echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001450echo "AIO support $aio"
aliguorie5d355d2009-04-24 18:03:15 +00001451echo "IO thread $io_thread"
ths77755342008-11-27 15:45:16 +00001452echo "Install blobs $blobs"
Jan Kiszka168ccc12009-06-07 11:30:25 +02001453echo -e "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001454echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001455echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001456
bellard97a847b2003-08-10 21:36:04 +00001457if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001458echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001459fi
bellard24b55b92005-03-01 22:30:41 +00001460#if test "$sdl_static" = "no"; then
1461# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1462#fi
bellard97a847b2003-08-10 21:36:04 +00001463config_mak="config-host.mak"
1464config_h="config-host.h"
1465
bellard7c1f25b2004-04-22 00:02:08 +00001466#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001467
ths15d9ca02007-07-31 23:07:32 +00001468test -f $config_h && mv $config_h ${config_h}~
1469
bellard97a847b2003-08-10 21:36:04 +00001470echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001471printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001472printf " '%s'" "$0" "$@" >> $config_mak
1473echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001474echo "/* Automatically generated by configure - do not modify */" > $config_h
1475
1476echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001477echo "bindir=\${prefix}$binsuffix" >> $config_mak
1478echo "mandir=\${prefix}$mansuffix" >> $config_mak
1479echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001480echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001481echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001482echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001483echo "INSTALL=$install" >> $config_mak
aliguori58f8aea2009-04-18 15:36:02 +00001484echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1485echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1486echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001487echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001488echo "HOST_CC=$host_cc" >> $config_mak
1489echo "AR=$ar" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001490# XXX: only use CFLAGS and LDFLAGS ?
1491# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1492# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001493echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001494echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1495echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1496echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001497echo "CFLAGS=$CFLAGS" >> $config_mak
1498echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001499echo "EXESUF=$EXESUF" >> $config_mak
aliguorie5d355d2009-04-24 18:03:15 +00001500echo "PTHREADLIBS=$PTHREADLIBS" >> $config_mak
1501echo "CLOCKLIBS=$CLOCKLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001502case "$cpu" in
1503 i386)
1504 echo "ARCH=i386" >> $config_mak
1505 echo "#define HOST_I386 1" >> $config_h
1506 ;;
1507 x86_64)
1508 echo "ARCH=x86_64" >> $config_mak
1509 echo "#define HOST_X86_64 1" >> $config_h
1510 ;;
1511 alpha)
1512 echo "ARCH=alpha" >> $config_mak
1513 echo "#define HOST_ALPHA 1" >> $config_h
1514 ;;
1515 armv4b)
1516 echo "ARCH=arm" >> $config_mak
1517 echo "#define HOST_ARM 1" >> $config_h
1518 ;;
1519 armv4l)
1520 echo "ARCH=arm" >> $config_mak
1521 echo "#define HOST_ARM 1" >> $config_h
1522 ;;
1523 cris)
1524 echo "ARCH=cris" >> $config_mak
1525 echo "#define HOST_CRIS 1" >> $config_h
1526 ;;
1527 hppa)
1528 echo "ARCH=hppa" >> $config_mak
1529 echo "#define HOST_HPPA 1" >> $config_h
1530 ;;
1531 ia64)
1532 echo "ARCH=ia64" >> $config_mak
1533 echo "#define HOST_IA64 1" >> $config_h
1534 ;;
1535 m68k)
1536 echo "ARCH=m68k" >> $config_mak
1537 echo "#define HOST_M68K 1" >> $config_h
1538 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001539 microblaze)
1540 echo "ARCH=microblaze" >> $config_mak
1541 echo "#define HOST_MICROBLAZE 1" >> $config_h
1542 ;;
aurel322408a522008-04-20 20:19:44 +00001543 mips)
1544 echo "ARCH=mips" >> $config_mak
1545 echo "#define HOST_MIPS 1" >> $config_h
1546 ;;
1547 mips64)
1548 echo "ARCH=mips64" >> $config_mak
1549 echo "#define HOST_MIPS64 1" >> $config_h
1550 ;;
malcfdf7ed92009-01-14 18:39:52 +00001551 ppc)
1552 echo "ARCH=ppc" >> $config_mak
1553 echo "#define HOST_PPC 1" >> $config_h
1554 ;;
1555 ppc64)
1556 echo "ARCH=ppc64" >> $config_mak
1557 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001558 ;;
1559 s390)
1560 echo "ARCH=s390" >> $config_mak
1561 echo "#define HOST_S390 1" >> $config_h
1562 ;;
1563 sparc)
1564 echo "ARCH=sparc" >> $config_mak
1565 echo "#define HOST_SPARC 1" >> $config_h
1566 ;;
1567 sparc64)
1568 echo "ARCH=sparc64" >> $config_mak
1569 echo "#define HOST_SPARC64 1" >> $config_h
1570 ;;
1571 *)
1572 echo "Unsupported CPU = $cpu"
1573 exit 1
1574 ;;
1575esac
aurel32f8393942009-04-13 18:45:38 +00001576if test "$debug_tcg" = "yes" ; then
1577 echo "#define DEBUG_TCG 1" >> $config_h
1578fi
Paul Brookf3d08ee2009-06-04 11:39:04 +01001579if test "$debug" = "yes" ; then
1580 echo "#define DEBUG_EXEC 1" >> $config_h
1581fi
aliguori03b4fe72008-10-07 19:16:17 +00001582if test "$sparse" = "yes" ; then
1583 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1584 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1585 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1586fi
aliguori1625af82009-04-05 17:41:02 +00001587if test "$strip_opt" = "yes" ; then
1588 echo "STRIP_OPT=-s" >> $config_mak
1589fi
bellard7d132992003-03-06 23:23:54 +00001590if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001591 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1592 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1593fi
bellardb6853692005-06-05 17:10:39 +00001594echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001595if test "$mingw32" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001596 echo "CONFIG_WIN32=y" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001597 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001598else
1599 cat > $TMPC << EOF
1600#include <byteswap.h>
1601int main(void) { return bswap_32(0); }
1602EOF
aurel32178baee2008-12-08 18:11:57 +00001603 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001604 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1605 fi
blueswir113606772008-12-05 17:54:09 +00001606 cat > $TMPC << EOF
1607#include <sys/endian.h>
1608#include <sys/types.h>
1609#include <machine/bswap.h>
1610int main(void) { return bswap32(0); }
1611EOF
aurel32178baee2008-12-08 18:11:57 +00001612 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001613 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1614 fi
bellard67b915a2004-03-31 23:37:16 +00001615fi
blueswir1128ab2f2008-08-15 18:33:42 +00001616
1617if [ "$openbsd" = "yes" ] ; then
1618 echo "#define ENOTSUP 4096" >> $config_h
1619fi
1620
bellard83fb7ad2004-07-05 21:25:26 +00001621if test "$darwin" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001622 echo "CONFIG_DARWIN=y" >> $config_mak
bellard83fb7ad2004-07-05 21:25:26 +00001623 echo "#define CONFIG_DARWIN 1" >> $config_h
1624fi
malcb29fe3e2008-11-18 01:42:22 +00001625
1626if test "$aix" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001627 echo "CONFIG_AIX=y" >> $config_mak
malcb29fe3e2008-11-18 01:42:22 +00001628 echo "#define CONFIG_AIX 1" >> $config_h
1629fi
1630
bellardec530c82006-04-25 22:36:06 +00001631if test "$solaris" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001632 echo "CONFIG_SOLARIS=y" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001633 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001634 if test "$needs_libsunmath" = "yes" ; then
1635 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1636 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1637 fi
bellardec530c82006-04-25 22:36:06 +00001638fi
blueswir131422552007-04-16 18:27:06 +00001639if test -n "$sparc_cpu"; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001640 echo "CONFIG__sparc_${sparc_cpu}__=y" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001641 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1642fi
bellard97a847b2003-08-10 21:36:04 +00001643if test "$gprof" = "yes" ; then
1644 echo "TARGET_GPROF=yes" >> $config_mak
1645 echo "#define HAVE_GPROF 1" >> $config_h
1646fi
1647if test "$static" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001648 echo "CONFIG_STATIC=y" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001649 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001650fi
bellard05c2a3e2006-02-08 22:39:17 +00001651if test $profiler = "yes" ; then
1652 echo "#define CONFIG_PROFILER 1" >> $config_h
1653fi
bellardc20709a2004-04-21 23:27:19 +00001654if test "$slirp" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001655 echo "CONFIG_SLIRP=y" >> $config_mak
bellardc20709a2004-04-21 23:27:19 +00001656 echo "#define CONFIG_SLIRP 1" >> $config_h
1657fi
ths8a16d272008-07-19 09:56:24 +00001658if test "$vde" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001659 echo "CONFIG_VDE=y" >> $config_mak
ths8a16d272008-07-19 09:56:24 +00001660 echo "#define CONFIG_VDE 1" >> $config_h
1661 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1662fi
malc0c58ac12008-06-25 21:04:05 +00001663for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001664 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
Juan Quintelae34af2c2009-06-25 00:08:08 +02001665 echo "$def=y" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001666 echo "#define $def 1" >> $config_h
1667done
1668echo "#define AUDIO_DRIVERS \\" >> $config_h
1669for drv in $audio_drv_list; do
1670 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001671 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
Juan Quintelae34af2c2009-06-25 00:08:08 +02001672 echo "$def=y" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001673 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001674 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1675 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001676 elif test "$drv" = "oss"; then
1677 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001678 fi
1679done
1680echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001681if test "$mixemu" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001682 echo "CONFIG_MIXEMU=y" >> $config_mak
malc8ff9cbf2008-06-23 18:33:30 +00001683 echo "#define CONFIG_MIXEMU 1" >> $config_h
1684fi
ths8d5d2d42007-08-25 01:37:51 +00001685if test "$vnc_tls" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001686 echo "CONFIG_VNC_TLS=y" >> $config_mak
ths8d5d2d42007-08-25 01:37:51 +00001687 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1688 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1689 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1690fi
aliguori2f9606b2009-03-06 20:27:28 +00001691if test "$vnc_sasl" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001692 echo "CONFIG_VNC_SASL=y" >> $config_mak
aliguori2f9606b2009-03-06 20:27:28 +00001693 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1694 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1695 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1696fi
aliguori76655d62009-03-06 20:27:37 +00001697if test "$fnmatch" = "yes" ; then
1698 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1699fi
pbrookb1a550a2006-04-16 13:28:56 +00001700qemu_version=`head $source_path/VERSION`
1701echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001702echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001703
pbrook4a19f1e2009-04-07 23:17:49 +00001704echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1705
bellard97a847b2003-08-10 21:36:04 +00001706echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001707if [ "$source_path_used" = "yes" ]; then
1708 echo "VPATH=$source_path" >> $config_mak
1709fi
bellard97a847b2003-08-10 21:36:04 +00001710echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001711if [ "$build_docs" = "yes" ] ; then
1712 echo "BUILD_DOCS=yes" >> $config_mak
1713fi
bellard49ecc3f2007-11-07 19:25:15 +00001714if test "$static" = "yes"; then
1715 sdl1=$sdl_static
1716else
1717 sdl1=$sdl
1718fi
1719if test "$sdl1" = "yes" ; then
1720 echo "#define CONFIG_SDL 1" >> $config_h
Juan Quintelae34af2c2009-06-25 00:08:08 +02001721 echo "CONFIG_SDL=y" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001722 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1723 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001724 elif test "$sdl_x11" = "yes" ; then
1725 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001726 else
1727 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1728 fi
1729 if [ "${aa}" = "yes" ] ; then
1730 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1731 else
1732 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1733 fi
1734fi
1735if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001736 echo "#define CONFIG_COCOA 1" >> $config_h
Juan Quintelae34af2c2009-06-25 00:08:08 +02001737 echo "CONFIG_COCOA=y" >> $config_mak
balrog4d3b6f62008-02-10 16:33:14 +00001738fi
1739if test "$curses" = "yes" ; then
1740 echo "#define CONFIG_CURSES 1" >> $config_h
Juan Quintelae34af2c2009-06-25 00:08:08 +02001741 echo "CONFIG_CURSES=y" >> $config_mak
Jan Kiszkaab4e5602009-06-24 12:29:11 +02001742 if test "$ncurses" = "yes" ; then
1743 echo "CURSES_LIBS=-lncurses" >> $config_mak
1744 else
1745 echo "CURSES_LIBS=-lcurses" >> $config_mak
1746 fi
bellard49ecc3f2007-11-07 19:25:15 +00001747fi
aurel323b3f24a2009-04-15 16:12:13 +00001748if test "$atfile" = "yes" ; then
1749 echo "#define CONFIG_ATFILE 1" >> $config_h
1750fi
Riku Voipioebc996f2009-04-21 15:01:51 +03001751if test "$utimens" = "yes" ; then
1752 echo "#define CONFIG_UTIMENSAT 1" >> $config_h
1753fi
Riku Voipio099d6b02009-05-05 12:10:04 +03001754if test "$pipe2" = "yes" ; then
1755 echo "#define CONFIG_PIPE2 1" >> $config_h
1756fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301757if test "$splice" = "yes" ; then
1758 echo "#define CONFIG_SPLICE 1" >> $config_h
1759fi
aurel323b3f24a2009-04-15 16:12:13 +00001760if test "$inotify" = "yes" ; then
1761 echo "#define CONFIG_INOTIFY 1" >> $config_h
1762fi
Alexander Graf769ce762009-05-11 17:41:42 +02001763if test "$curl" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001764 echo "CONFIG_CURL=y" >> $config_mak
Alexander Graf769ce762009-05-11 17:41:42 +02001765 echo "CURL_LIBS=$curl_libs" >> $config_mak
1766 echo "#define CONFIG_CURL 1" >> $config_h
1767fi
aurel322e4d9fb2008-04-08 06:01:02 +00001768if test "$brlapi" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001769 echo "CONFIG_BRLAPI=y" >> $config_mak
aurel322e4d9fb2008-04-08 06:01:02 +00001770 echo "#define CONFIG_BRLAPI 1" >> $config_h
1771 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1772fi
balrogfb599c92008-09-28 23:49:55 +00001773if test "$bluez" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001774 echo "CONFIG_BLUEZ=y" >> $config_mak
balrogfb599c92008-09-28 23:49:55 +00001775 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1776 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1777 echo "#define CONFIG_BLUEZ 1" >> $config_h
1778fi
aliguorie37630c2009-04-22 15:19:10 +00001779if test "$xen" = "yes" ; then
aliguori9306acb2009-04-22 15:19:44 +00001780 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
aliguorie37630c2009-04-22 15:19:10 +00001781fi
blueswir1414f0da2008-08-15 18:20:52 +00001782if test "$aio" = "yes" ; then
1783 echo "#define CONFIG_AIO 1" >> $config_h
Juan Quintelae34af2c2009-06-25 00:08:08 +02001784 echo "CONFIG_AIO=y" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001785fi
aliguorie5d355d2009-04-24 18:03:15 +00001786if test "$io_thread" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001787 echo "CONFIG_IOTHREAD=y" >> $config_mak
aliguorie5d355d2009-04-24 18:03:15 +00001788 echo "#define CONFIG_IOTHREAD 1" >> $config_h
1789fi
ths77755342008-11-27 15:45:16 +00001790if test "$blobs" = "yes" ; then
1791 echo "INSTALL_BLOBS=yes" >> $config_mak
1792fi
aliguoribf9298b2008-12-05 20:05:26 +00001793if test "$iovec" = "yes" ; then
1794 echo "#define HAVE_IOVEC 1" >> $config_h
1795fi
aliguoriceb42de2009-04-07 18:43:28 +00001796if test "$preadv" = "yes" ; then
1797 echo "#define HAVE_PREADV 1" >> $config_h
1798fi
aurel32f652e6a2008-12-16 10:43:48 +00001799if test "$fdt" = "yes" ; then
1800 echo "#define HAVE_FDT 1" >> $config_h
1801 echo "FDT_LIBS=-lfdt" >> $config_mak
1802fi
bellard97a847b2003-08-10 21:36:04 +00001803
bellard83fb7ad2004-07-05 21:25:26 +00001804# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001805if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001806 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001807 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001808 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001809fi
1810
pbrookc5937222006-05-14 11:30:38 +00001811echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1812
blueswir168063642008-11-22 21:03:55 +00001813# USB host support
1814case "$usb" in
1815linux)
1816 echo "HOST_USB=linux" >> $config_mak
1817;;
1818bsd)
1819 echo "HOST_USB=bsd" >> $config_mak
1820;;
1821*)
1822 echo "HOST_USB=stub" >> $config_mak
1823;;
1824esac
1825
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001826# Determine what linker flags to use to force archive inclusion
1827check_linker_flags()
1828{
Anthony Liguori08b9d662009-06-18 13:31:51 -05001829 w2=
1830 if test "$2" ; then
1831 w2=-Wl,$2
1832 fi
1833 $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 ${w2} >/dev/null 2>/dev/null
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001834}
1835
1836cat > $TMPC << EOF
1837int main(void) { }
1838EOF
1839if check_linker_flags --whole-archive --no-whole-archive ; then
1840 # GNU ld
1841 echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_mak
1842 echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_mak
1843elif check_linker_flags -z,allextract -z,defaultextract ; then
1844 # Solaris ld
1845 echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_mak
1846 echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_mak
Anthony Liguori08b9d662009-06-18 13:31:51 -05001847elif check_linker_flags -all_load ; then
1848 # Mac OS X
1849 echo "ARLIBS_BEGIN=-all_load" >> $config_mak
1850 echo "ARLIBS_END=" >> $config_mak
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001851else
1852 echo "Error: your linker does not support --whole-archive or -z."
1853 echo "Please report to qemu-devel@nongnu.org"
1854 exit 1
1855fi
1856
Blue Swirl2567f572009-05-21 15:54:48 +00001857if test "$xen" = "yes" ;
1858 then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001859 echo "CONFIG_XEN=y" >> $config_mak
Blue Swirl2567f572009-05-21 15:54:48 +00001860fi
1861
pbrookc39e3332007-09-22 16:49:14 +00001862tools=
1863if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001864 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001865 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001866 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001867 fi
pbrookc39e3332007-09-22 16:49:14 +00001868fi
1869echo "TOOLS=$tools" >> $config_mak
1870
Alexander Graf253d0942009-06-29 15:37:40 +02001871roms=
1872if test "$cpu" = "i386" -o "$cpu" = "x86_64" ; then
1873 roms="pc-bios/optionrom"
1874fi
1875echo "ROMS=$roms" >> $config_mak
1876
Paul Brook370ab982009-05-26 15:07:56 +01001877if test -f ${config_h}~ ; then
1878 if cmp -s $config_h ${config_h}~ ; then
1879 mv ${config_h}~ $config_h
1880 else
1881 rm ${config_h}~
1882 fi
1883fi
1884
Paul Brook1ad21342009-05-19 16:17:58 +01001885config_host_mak=${config_mak}
ths15d9ca02007-07-31 23:07:32 +00001886
bellard1d14ffa2005-10-30 18:58:22 +00001887for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001888target_dir="$target"
1889config_mak=$target_dir/config.mak
1890config_h=$target_dir/config.h
Blue Swirl600309b2009-07-03 17:44:00 +00001891target_arch2=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00001892target_bigendian="no"
Blue Swirl600309b2009-07-03 17:44:00 +00001893[ "$target_arch2" = "armeb" ] && target_bigendian=yes
1894[ "$target_arch2" = "m68k" ] && target_bigendian=yes
1895[ "$target_arch2" = "microblaze" ] && target_bigendian=yes
1896[ "$target_arch2" = "mips" ] && target_bigendian=yes
1897[ "$target_arch2" = "mipsn32" ] && target_bigendian=yes
1898[ "$target_arch2" = "mips64" ] && target_bigendian=yes
1899[ "$target_arch2" = "ppc" ] && target_bigendian=yes
1900[ "$target_arch2" = "ppcemb" ] && target_bigendian=yes
1901[ "$target_arch2" = "ppc64" ] && target_bigendian=yes
1902[ "$target_arch2" = "ppc64abi32" ] && target_bigendian=yes
1903[ "$target_arch2" = "sh4eb" ] && target_bigendian=yes
1904[ "$target_arch2" = "sparc" ] && target_bigendian=yes
1905[ "$target_arch2" = "sparc64" ] && target_bigendian=yes
1906[ "$target_arch2" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001907target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001908target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001909target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001910target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001911target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001912case "$target" in
Blue Swirl600309b2009-07-03 17:44:00 +00001913 ${target_arch2}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00001914 target_softmmu="yes"
1915 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00001916 ${target_arch2}-linux-user)
pbrook9e407a82007-05-26 16:38:53 +00001917 target_user_only="yes"
1918 target_linux_user="yes"
1919 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00001920 ${target_arch2}-darwin-user)
pbrook9e407a82007-05-26 16:38:53 +00001921 target_user_only="yes"
1922 target_darwin_user="yes"
1923 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00001924 ${target_arch2}-bsd-user)
blueswir184778502008-10-26 20:33:16 +00001925 target_user_only="yes"
1926 target_bsd_user="yes"
1927 ;;
pbrook9e407a82007-05-26 16:38:53 +00001928 *)
1929 echo "ERROR: Target '$target' not recognised"
1930 exit 1
1931 ;;
1932esac
ths831b7822007-01-18 20:06:33 +00001933
bellard7c1f25b2004-04-22 00:02:08 +00001934#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001935
ths15d9ca02007-07-31 23:07:32 +00001936test -f $config_h && mv $config_h ${config_h}~
1937
bellard97a847b2003-08-10 21:36:04 +00001938mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001939mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001940mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001941if 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 +00001942 mkdir -p $target_dir/nwfpe
1943fi
1944
bellardec530c82006-04-25 22:36:06 +00001945#
1946# don't use ln -sf as not all "ln -sf" over write the file/link
1947#
1948rm -f $target_dir/Makefile
1949ln -s $source_path/Makefile.target $target_dir/Makefile
1950
bellard97a847b2003-08-10 21:36:04 +00001951
1952echo "# Automatically generated by configure - do not modify" > $config_mak
1953echo "/* Automatically generated by configure - do not modify */" > $config_h
1954
1955
1956echo "include ../config-host.mak" >> $config_mak
1957echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001958
pbrooke5fe0c52006-06-11 13:32:59 +00001959bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001960elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001961target_nptl="no"
Blue Swirl600309b2009-07-03 17:44:00 +00001962interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
bellard1e43adf2003-09-30 20:54:24 +00001963echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001964gdb_xml_files=""
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001965target_kvm="$kvm"
bellard97a847b2003-08-10 21:36:04 +00001966
aliguori5985ece2008-11-05 19:59:25 +00001967# Make sure the target and host cpus are compatible
Blue Swirl600309b2009-07-03 17:44:00 +00001968if test ! \( "$target_arch2" = "$cpu" -o \
1969 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
1970 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
1971 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001972 target_kvm="no"
aliguori7ba1e612008-11-05 16:04:33 +00001973fi
1974# Disable KVM for linux-user
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001975if test "$target_softmmu" = "no" ; then
1976 target_kvm="no"
aliguori7ba1e612008-11-05 16:04:33 +00001977fi
1978
Blue Swirl600309b2009-07-03 17:44:00 +00001979case "$target_arch2" in
aurel322408a522008-04-20 20:19:44 +00001980 i386)
1981 echo "TARGET_ARCH=i386" >> $config_mak
1982 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1983 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001984 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001985 then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001986 echo "CONFIG_KQEMU=y" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001987 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001988 fi
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001989 if test "$target_kvm" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001990 echo "CONFIG_KVM=y" >> $config_mak
aliguori7ba1e612008-11-05 16:04:33 +00001991 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001992 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001993 fi
aliguorie37630c2009-04-22 15:19:10 +00001994 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1995 then
Juan Quintelae34af2c2009-06-25 00:08:08 +02001996 echo "CONFIG_XEN=y" >> $config_mak
aliguorie37630c2009-04-22 15:19:10 +00001997 echo "#define CONFIG_XEN 1" >> $config_h
1998 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001999 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002000 ;;
2001 x86_64)
2002 echo "TARGET_ARCH=x86_64" >> $config_mak
2003 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
2004 echo "#define TARGET_I386 1" >> $config_h
2005 echo "#define TARGET_X86_64 1" >> $config_h
2006 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
2007 then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002008 echo "CONFIG_KQEMU=y" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00002009 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00002010 fi
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00002011 if test "$target_kvm" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002012 echo "CONFIG_KVM=y" >> $config_mak
aliguori7ba1e612008-11-05 16:04:33 +00002013 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2014 echo "#define CONFIG_KVM 1" >> $config_h
2015 fi
aliguorie37630c2009-04-22 15:19:10 +00002016 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
2017 then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002018 echo "CONFIG_XEN=y" >> $config_mak
aliguorie37630c2009-04-22 15:19:10 +00002019 echo "#define CONFIG_XEN 1" >> $config_h
2020 fi
Paul Brook1ad21342009-05-19 16:17:58 +01002021 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002022 ;;
2023 alpha)
2024 echo "TARGET_ARCH=alpha" >> $config_mak
2025 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
2026 echo "#define TARGET_ALPHA 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002027 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002028 ;;
2029 arm|armeb)
2030 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00002031 echo "#define TARGET_ARCH \"arm\"" >> $config_h
2032 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00002033 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00002034 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00002035 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002036 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002037 ;;
2038 cris)
2039 echo "TARGET_ARCH=cris" >> $config_mak
2040 echo "#define TARGET_ARCH \"cris\"" >> $config_h
2041 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00002042 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002043 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002044 ;;
2045 m68k)
2046 echo "TARGET_ARCH=m68k" >> $config_mak
2047 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
2048 echo "#define TARGET_M68K 1" >> $config_h
2049 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00002050 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002051 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002052 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02002053 microblaze)
2054 echo "TARGET_ARCH=microblaze" >> $config_mak
2055 echo "#define TARGET_ARCH \"microblaze\"" >> $config_h
2056 echo "#define TARGET_MICROBLAZE 1" >> $config_h
2057 bflt="yes"
2058 target_nptl="yes"
2059 target_phys_bits=32
2060 ;;
2061 mips|mipsel)
aurel322408a522008-04-20 20:19:44 +00002062 echo "TARGET_ARCH=mips" >> $config_mak
2063 echo "#define TARGET_ARCH \"mips\"" >> $config_h
2064 echo "#define TARGET_MIPS 1" >> $config_h
2065 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002066 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002067 ;;
2068 mipsn32|mipsn32el)
2069 echo "TARGET_ARCH=mipsn32" >> $config_mak
2070 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
2071 echo "#define TARGET_MIPS 1" >> $config_h
2072 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002073 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002074 ;;
2075 mips64|mips64el)
2076 echo "TARGET_ARCH=mips64" >> $config_mak
2077 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
2078 echo "#define TARGET_MIPS 1" >> $config_h
2079 echo "#define TARGET_MIPS64 1" >> $config_h
2080 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002081 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002082 ;;
2083 ppc)
2084 echo "TARGET_ARCH=ppc" >> $config_mak
2085 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
2086 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00002087 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002088 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002089 ;;
2090 ppcemb)
2091 echo "TARGET_ARCH=ppcemb" >> $config_mak
2092 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2093 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
2094 echo "#define TARGET_PPC 1" >> $config_h
2095 echo "#define TARGET_PPCEMB 1" >> $config_h
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00002096 if test "$target_kvm" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002097 echo "CONFIG_KVM=y" >> $config_mak
aurel32d76d1652008-12-16 10:43:58 +00002098 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2099 echo "#define CONFIG_KVM 1" >> $config_h
2100 fi
aurel32c8b35322009-01-24 15:07:34 +00002101 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002102 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002103 ;;
2104 ppc64)
2105 echo "TARGET_ARCH=ppc64" >> $config_mak
2106 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2107 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2108 echo "#define TARGET_PPC 1" >> $config_h
2109 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00002110 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002111 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002112 ;;
2113 ppc64abi32)
2114 echo "TARGET_ARCH=ppc64" >> $config_mak
2115 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2116 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
2117 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2118 echo "#define TARGET_PPC 1" >> $config_h
2119 echo "#define TARGET_PPC64 1" >> $config_h
2120 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00002121 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002122 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002123 ;;
2124 sh4|sh4eb)
2125 echo "TARGET_ARCH=sh4" >> $config_mak
2126 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
2127 echo "#define TARGET_SH4 1" >> $config_h
2128 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00002129 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002130 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002131 ;;
2132 sparc)
2133 echo "TARGET_ARCH=sparc" >> $config_mak
2134 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
2135 echo "#define TARGET_SPARC 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002136 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002137 ;;
2138 sparc64)
2139 echo "TARGET_ARCH=sparc64" >> $config_mak
2140 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2141 echo "#define TARGET_SPARC 1" >> $config_h
2142 echo "#define TARGET_SPARC64 1" >> $config_h
2143 elfload32="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002144 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002145 ;;
2146 sparc32plus)
2147 echo "TARGET_ARCH=sparc64" >> $config_mak
2148 echo "TARGET_ABI_DIR=sparc" >> $config_mak
2149 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
2150 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2151 echo "#define TARGET_SPARC 1" >> $config_h
2152 echo "#define TARGET_SPARC64 1" >> $config_h
2153 echo "#define TARGET_ABI32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002154 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002155 ;;
2156 *)
2157 echo "Unsupported target CPU"
2158 exit 1
2159 ;;
2160esac
Paul Brook1ad21342009-05-19 16:17:58 +01002161if [ $target_phys_bits -lt $hostlongbits ] ; then
2162 target_phys_bits=$hostlongbits
2163fi
2164echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
2165echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h
2166echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00002167if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00002168 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2169 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2170fi
2171if test "$target_softmmu" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002172 echo "CONFIG_SOFTMMU=y" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00002173 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00002174fi
bellard997344f2003-10-27 21:10:39 +00002175if test "$target_user_only" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002176 echo "CONFIG_USER_ONLY=y" >> $config_mak
bellard997344f2003-10-27 21:10:39 +00002177 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2178fi
ths831b7822007-01-18 20:06:33 +00002179if test "$target_linux_user" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002180 echo "CONFIG_LINUX_USER=y" >> $config_mak
ths831b7822007-01-18 20:06:33 +00002181 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2182fi
2183if test "$target_darwin_user" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002184 echo "CONFIG_DARWIN_USER=y" >> $config_mak
ths831b7822007-01-18 20:06:33 +00002185 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2186fi
pbrook56aebc82008-10-11 17:55:29 +00002187list=""
2188if test ! -z "$gdb_xml_files" ; then
2189 for x in $gdb_xml_files; do
2190 list="$list $source_path/gdb-xml/$x"
2191 done
2192fi
2193echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00002194
Blue Swirl600309b2009-07-03 17:44:00 +00002195if test "$target_arch2" = "arm" \
2196 -o "$target_arch2" = "armeb" \
2197 -o "$target_arch2" = "m68k" \
2198 -o "$target_arch2" = "microblaze" \
2199 -o "$target_arch2" = "mips" \
2200 -o "$target_arch2" = "mipsel" \
2201 -o "$target_arch2" = "mipsn32" \
2202 -o "$target_arch2" = "mipsn32el" \
2203 -o "$target_arch2" = "mips64" \
2204 -o "$target_arch2" = "mips64el" \
2205 -o "$target_arch2" = "ppc" \
2206 -o "$target_arch2" = "ppc64" \
2207 -o "$target_arch2" = "ppc64abi32" \
2208 -o "$target_arch2" = "ppcemb" \
2209 -o "$target_arch2" = "sparc" \
2210 -o "$target_arch2" = "sparc64" \
2211 -o "$target_arch2" = "sparc32plus"; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002212 echo "CONFIG_SOFTFLOAT=y" >> $config_mak
bellard158142c2005-03-13 16:54:06 +00002213 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2214fi
pbrooke5fe0c52006-06-11 13:32:59 +00002215if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002216 echo "TARGET_HAS_BFLT=y" >> $config_mak
pbrooke5fe0c52006-06-11 13:32:59 +00002217 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2218fi
pbrookbd0c5662008-05-29 14:34:11 +00002219if test "$target_user_only" = "yes" \
2220 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2221 echo "#define USE_NPTL 1" >> $config_h
2222fi
blueswir1cb33da52007-10-09 16:34:29 +00002223# 32 bit ELF loader in addition to native 64 bit loader?
2224if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002225 echo "TARGET_HAS_ELFLOAD32=y" >> $config_mak
blueswir1cb33da52007-10-09 16:34:29 +00002226 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2227fi
blueswir184778502008-10-26 20:33:16 +00002228if test "$target_bsd_user" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002229 echo "CONFIG_BSD_USER=y" >> $config_mak
blueswir184778502008-10-26 20:33:16 +00002230 echo "#define CONFIG_BSD_USER 1" >> $config_h
2231fi
bellard5b0753e2005-03-01 21:37:28 +00002232
ths15d9ca02007-07-31 23:07:32 +00002233test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2234
bellard97a847b2003-08-10 21:36:04 +00002235done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00002236
2237# build tree in object directory if source path is different from current one
2238if test "$source_path_used" = "yes" ; then
Alexander Graf253d0942009-06-29 15:37:40 +02002239 DIRS="tests tests/cris slirp audio block pc-bios/optionrom"
bellard7d132992003-03-06 23:23:54 +00002240 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00002241 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00002242 FILES="$FILES tests/test-mmap.c"
Alexander Graf253d0942009-06-29 15:37:40 +02002243 FILES="$FILES pc-bios/optionrom/Makefile"
bellard7d132992003-03-06 23:23:54 +00002244 for dir in $DIRS ; do
2245 mkdir -p $dir
2246 done
bellardec530c82006-04-25 22:36:06 +00002247 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00002248 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00002249 rm -f $f
2250 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00002251 done
2252fi
Paul Brook1ad21342009-05-19 16:17:58 +01002253
2254for hwlib in 32 64; do
2255 d=libhw$hwlib
2256 mkdir -p $d
2257 rm -f $d/Makefile
2258 ln -s $source_path/Makefile.hw $d/Makefile
2259 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2260 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2261done