blob: b68cc2056faa0943d60fa11cf260ac23a94f4b31 [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"
aliguori7ba1e612008-11-05 16:04:33 +0000193kvm="yes"
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"
blueswir1acda94b2009-04-13 16:23:22 +0000293 kvm="no"
thsc2b84fa2007-02-10 23:21:21 +0000294 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000295 # have to select again, because `uname -m` returns i86pc
296 # even on an x86_64 box.
297 solariscpu=`isainfo -k`
298 if test "${solariscpu}" = "amd64" ; then
299 cpu="x86_64"
300 fi
thsc2b84fa2007-02-10 23:21:21 +0000301 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000302 if test "$solarisrev" -le 9 ; then
303 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
304 needs_libsunmath="yes"
305 else
306 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
307 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
308 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
309 echo "Studio 11 can be downloaded from www.sun.com."
310 exit 1
311 fi
312 fi
313 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000314 kqemu="yes"
315 fi
ths86b2bd92007-02-11 00:31:33 +0000316 fi
ths6b4d2ba2007-05-13 18:02:43 +0000317 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000318 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000319 fi
malcc2de5c92008-06-28 19:13:06 +0000320 audio_possible_drivers="oss sdl"
blueswir114d483e2009-04-13 16:27:08 +0000321 OS_CFLAGS=-std=gnu99
ths86b2bd92007-02-11 00:31:33 +0000322;;
malcb29fe3e2008-11-18 01:42:22 +0000323AIX)
324aix="yes"
325make="gmake"
326;;
bellard1d14ffa2005-10-30 18:58:22 +0000327*)
malc0c58ac12008-06-25 21:04:05 +0000328audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000329audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000330linux="yes"
ths831b7822007-01-18 20:06:33 +0000331linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000332usb="linux"
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"
470 target_cpu="sparc"; cpu="sparc" ;;
471 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
472 target_cpu="sparc"; cpu="sparc" ;;
473 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
474 target_cpu="sparc64"; cpu="sparc64" ;;
475 *) 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)"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100611echo " --disable-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 \
717"
pbrook0a8e90f2006-03-19 14:54:16 +0000718 fi
bellard5327cf42005-01-10 23:18:50 +0000719# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000720 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000721 target_list="${target_list}\
722i386-linux-user \
723x86_64-linux-user \
724alpha-linux-user \
725arm-linux-user \
726armeb-linux-user \
727cris-linux-user \
728m68k-linux-user \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200729microblaze-linux-user \
aurel322408a522008-04-20 20:19:44 +0000730mips-linux-user \
731mipsel-linux-user \
732ppc-linux-user \
733ppc64-linux-user \
734ppc64abi32-linux-user \
735sh4-linux-user \
736sh4eb-linux-user \
737sparc-linux-user \
738sparc64-linux-user \
739sparc32plus-linux-user \
740"
ths831b7822007-01-18 20:06:33 +0000741 fi
742# the following are Darwin specific
743 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000744 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000745 fi
blueswir184778502008-10-26 20:33:16 +0000746# the following are BSD specific
747 if [ "$bsd_user" = "yes" ] ; then
748 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000749i386-bsd-user \
750x86_64-bsd-user \
751sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000752sparc64-bsd-user \
753"
754 fi
bellard6e20a452005-06-05 15:56:02 +0000755else
pbrookb1a550a2006-04-16 13:28:56 +0000756 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000757fi
pbrook0a8e90f2006-03-19 14:54:16 +0000758if test -z "$target_list" ; then
759 echo "No targets enabled"
760 exit 1
761fi
bellard5327cf42005-01-10 23:18:50 +0000762
bellard7d132992003-03-06 23:23:54 +0000763if test -z "$cross_prefix" ; then
764
765# ---
766# big/little endian test
767cat > $TMPC << EOF
768#include <inttypes.h>
769int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000770 volatile uint32_t i=0x01234567;
771 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000772}
773EOF
774
aurel32178baee2008-12-08 18:11:57 +0000775if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000776$TMPE && bigendian="yes"
777else
778echo big/little test failed
779fi
780
781else
782
783# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000784if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000785 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000786 -o "$cpu" = "m68k" \
787 -o "$cpu" = "mips" \
788 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000789 -o "$cpu" = "ppc" \
790 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000791 -o "$cpu" = "s390" \
792 -o "$cpu" = "sparc" \
793 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000794 bigendian="yes"
795fi
796
797fi
798
bellardb6853692005-06-05 17:10:39 +0000799# host long bits test
800hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000801if test "$cpu" = "x86_64" \
802 -o "$cpu" = "alpha" \
803 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000804 -o "$cpu" = "sparc64" \
805 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000806 hostlongbits="64"
807fi
808
pbrookbd0c5662008-05-29 14:34:11 +0000809# Check host NPTL support
810cat > $TMPC <<EOF
811#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000812#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000813void foo()
814{
815#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
816#error bork
817#endif
818}
819EOF
820
balrog8c7f7572008-12-15 03:15:36 +0000821if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000822 :
823else
824 nptl="no"
825fi
826
bellard11d9f692004-04-02 20:55:59 +0000827##########################################
balrogac629222008-10-11 09:56:04 +0000828# zlib check
829
830cat > $TMPC << EOF
831#include <zlib.h>
832int main(void) { zlibVersion(); return 0; }
833EOF
balrog8c7f7572008-12-15 03:15:36 +0000834if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000835 :
836else
837 echo
838 echo "Error: zlib check failed"
839 echo "Make sure to have the zlib libs and headers installed."
840 echo
841 exit 1
842fi
843
844##########################################
aliguorie37630c2009-04-22 15:19:10 +0000845# xen probe
846
847if test "$xen" = "yes" ; then
848cat > $TMPC <<EOF
849#include <xenctrl.h>
850#include <xs.h>
851int main(void) { xs_daemon_open; xc_interface_open; }
852EOF
Jan Kiszka918a6082009-04-27 17:16:55 +0000853 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null > /dev/null ; then
aliguorie37630c2009-04-22 15:19:10 +0000854 :
855 else
856 xen="no"
857 fi
858fi
859
860##########################################
bellard11d9f692004-04-02 20:55:59 +0000861# SDL probe
862
863sdl_too_old=no
864
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500865if test "$sdl" = "yes" ; then
ths069b0bd2007-07-12 00:27:15 +0000866 sdl_config="sdl-config"
867 sdl=no
868 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000869
870cat > $TMPC << EOF
871#include <SDL.h>
872#undef main /* We don't want SDL to override our main() */
873int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
874EOF
balrog8c7f7572008-12-15 03:15:36 +0000875 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 +0000876 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
877 if test "$_sdlversion" -lt 121 ; then
878 sdl_too_old=yes
879 else
880 if test "$cocoa" = "no" ; then
881 sdl=yes
882 fi
883 fi
884
885 # static link with sdl ?
886 if test "$sdl" = "yes" ; then
887 aa="no"
888 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
889 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
890 if [ "$aa" = "yes" ] ; then
891 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000892 fi
bellard11d9f692004-04-02 20:55:59 +0000893
balrog8c7f7572008-12-15 03:15:36 +0000894 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 +0000895 sdl_static=yes
896 fi
897 fi # static link
898 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000899else
ths069b0bd2007-07-12 00:27:15 +0000900 # Make sure to disable cocoa if sdl was set
901 if test "$sdl" = "yes" ; then
902 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000903 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000904 fi
bellarda6e022a2004-04-02 21:55:47 +0000905fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000906
aliguori5368a422009-03-03 17:37:21 +0000907if test "$sdl" = "yes" ; then
908cat > $TMPC <<EOF
909#include <SDL.h>
910#if defined(SDL_VIDEO_DRIVER_X11)
911#include <X11/XKBlib.h>
912#else
913#error No x11 support
914#endif
915int main(void) { return 0; }
916EOF
917 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
918 sdl_x11="yes"
919 fi
920fi
921
ths8f28f3f2007-01-05 21:25:54 +0000922##########################################
ths8d5d2d42007-08-25 01:37:51 +0000923# VNC TLS detection
924if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000925cat > $TMPC <<EOF
926#include <gnutls/gnutls.h>
927int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
928EOF
929 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
930 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
931 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000932 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000933 :
934 else
935 vnc_tls="no"
936 fi
ths8d5d2d42007-08-25 01:37:51 +0000937fi
938
939##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000940# VNC SASL detection
941if test "$vnc_sasl" = "yes" ; then
942cat > $TMPC <<EOF
943#include <sasl/sasl.h>
944#include <stdio.h>
945int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
946EOF
947 # Assuming Cyrus-SASL installed in /usr prefix
948 vnc_sasl_cflags=""
949 vnc_sasl_libs="-lsasl2"
950 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
Jan Kiszka918a6082009-04-27 17:16:55 +0000951 $vnc_sasl_libs 2> /dev/null > /dev/null ; then
aliguori2f9606b2009-03-06 20:27:28 +0000952 :
953 else
954 vnc_sasl="no"
955 fi
956fi
957
958##########################################
aliguori76655d62009-03-06 20:27:37 +0000959# fnmatch() probe, used for ACL routines
960fnmatch="no"
961cat > $TMPC << EOF
962#include <fnmatch.h>
963int main(void)
964{
965 fnmatch("foo", "foo", 0);
966 return 0;
967}
968EOF
969if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
970 fnmatch="yes"
971fi
972
973##########################################
ths8a16d272008-07-19 09:56:24 +0000974# vde libraries probe
975if test "$vde" = "yes" ; then
976 cat > $TMPC << EOF
977#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000978int main(void)
979{
980 struct vde_open_args a = {0, 0, 0};
981 vde_open("", "", &a);
982 return 0;
983}
ths8a16d272008-07-19 09:56:24 +0000984EOF
balrog8c7f7572008-12-15 03:15:36 +0000985 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000986 :
987 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000988 vde="no"
ths8a16d272008-07-19 09:56:24 +0000989 fi
990fi
991
992##########################################
malcc2de5c92008-06-28 19:13:06 +0000993# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000994
malcc2de5c92008-06-28 19:13:06 +0000995audio_drv_probe()
996{
997 drv=$1
998 hdr=$2
999 lib=$3
1000 exp=$4
1001 cfl=$5
1002 cat > $TMPC << EOF
1003#include <$hdr>
1004int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00001005EOF
balrog8c7f7572008-12-15 03:15:36 +00001006 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +00001007 :
1008 else
1009 echo
1010 echo "Error: $drv check failed"
1011 echo "Make sure to have the $drv libs and headers installed."
1012 echo
1013 exit 1
1014 fi
1015}
1016
malc2fa7d3b2008-07-29 12:58:44 +00001017audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00001018for drv in $audio_drv_list; do
1019 case $drv in
1020 alsa)
1021 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1022 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1023 ;;
1024
1025 fmod)
1026 if test -z $fmod_lib || test -z $fmod_inc; then
1027 echo
1028 echo "Error: You must specify path to FMOD library and headers"
1029 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1030 echo
1031 exit 1
1032 fi
1033 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1034 ;;
1035
1036 esd)
1037 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1038 ;;
malcb8e59f12008-07-02 21:03:08 +00001039
1040 pa)
1041 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1042 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1043 ;;
1044
blueswir12f6a1ab2008-08-21 18:00:53 +00001045 oss|sdl|core|wav|dsound)
1046 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1047 ;;
1048
malce4c63a62008-07-19 16:15:16 +00001049 *)
malc1c9b2a52008-07-19 16:57:30 +00001050 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001051 echo
1052 echo "Error: Unknown driver '$drv' selected"
1053 echo "Possible drivers are: $audio_possible_drivers"
1054 echo
1055 exit 1
1056 }
1057 ;;
malcc2de5c92008-06-28 19:13:06 +00001058 esac
1059done
ths8f28f3f2007-01-05 21:25:54 +00001060
balrog4d3b6f62008-02-10 16:33:14 +00001061##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001062# BrlAPI probe
1063
1064if test -z "$brlapi" ; then
1065 brlapi=no
1066cat > $TMPC << EOF
1067#include <brlapi.h>
1068int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1069EOF
aurel32178baee2008-12-08 18:11:57 +00001070 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +00001071 brlapi=yes
1072 fi # brlapi compile test
1073fi # -z $brlapi
1074
1075##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001076# curses probe
1077
1078if test "$curses" = "yes" ; then
1079 curses=no
1080 cat > $TMPC << EOF
1081#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001082#ifdef __OpenBSD__
1083#define resize_term resizeterm
1084#endif
1085int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001086EOF
aurel32178baee2008-12-08 18:11:57 +00001087 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001088 curses=yes
1089 fi
1090fi # test "$curses"
1091
blueswir1414f0da2008-08-15 18:20:52 +00001092##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001093# curl probe
1094
1095if test "$curl" = "yes" ; then
1096 curl=no
1097 cat > $TMPC << EOF
1098#include <curl/curl.h>
1099int main(void) { return curl_easy_init(); }
1100EOF
Paul Brook52368552009-05-22 17:22:38 +01001101 curl_libs=`curl-config --libs 2>/dev/null`
Alexander Graf769ce762009-05-11 17:41:42 +02001102 if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1103 curl=yes
1104 fi
1105fi # test "$curl"
1106
1107##########################################
balrogfb599c92008-09-28 23:49:55 +00001108# bluez support probe
1109if test "$bluez" = "yes" ; then
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001110 `pkg-config bluez 2> /dev/null` || bluez="no"
balrogfb599c92008-09-28 23:49:55 +00001111fi
1112if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001113 cat > $TMPC << EOF
1114#include <bluetooth/bluetooth.h>
1115int main(void) { return bt_error(0); }
1116EOF
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001117 bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1118 bluez_libs=`pkg-config --libs bluez 2> /dev/null`
balrog17e15922008-10-11 12:00:42 +00001119 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001120 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001121 :
1122 else
1123 bluez="no"
1124 fi
balrogfb599c92008-09-28 23:49:55 +00001125fi
1126
1127##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001128# kvm probe
1129if test "$kvm" = "yes" ; then
1130 cat > $TMPC <<EOF
1131#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001132#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001133#error Invalid KVM version
1134#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001135#if !defined(KVM_CAP_USER_MEMORY)
1136#error Missing KVM capability KVM_CAP_USER_MEMORY
1137#endif
1138#if !defined(KVM_CAP_SET_TSS_ADDR)
1139#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1140#endif
1141#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1142#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1143#endif
aliguori7ba1e612008-11-05 16:04:33 +00001144int main(void) { return 0; }
1145EOF
aliguorieac30262008-11-05 16:28:56 +00001146 if test "$kerneldir" != "" ; then
1147 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001148 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1149 -a -d "$kerneldir/arch/x86/include" ; then
1150 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001151 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1152 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001153 elif test -d "$kerneldir/arch/$cpu/include" ; then
1154 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1155 fi
aliguorieac30262008-11-05 16:28:56 +00001156 else
1157 kvm_cflags=""
1158 fi
aliguori7ba1e612008-11-05 16:04:33 +00001159 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001160 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001161 :
1162 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001163 kvm="no";
1164 if [ -x "`which awk 2>/dev/null`" ] && \
1165 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001166 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001167 | grep "error: " \
1168 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1169 if test "$kvmerr" != "" ; then
Jan Kiszka168ccc12009-06-07 11:30:25 +02001170 kvm="no - (${kvmerr})\n\
1171 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1172recent kvm-kmod from http://sourceforge.net/projects/kvm."
aliguori9fd8d8d2009-01-15 21:57:30 +00001173 fi
1174 fi
aliguori7ba1e612008-11-05 16:04:33 +00001175 fi
1176fi
1177
1178##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001179# pthread probe
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001180PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
aliguorie5d355d2009-04-24 18:03:15 +00001181PTHREADLIBS=""
aliguori3c529d92008-12-12 16:41:40 +00001182
aliguorie5d355d2009-04-24 18:03:15 +00001183if test "$pthread" = yes; then
1184 pthread=no
1185cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001186#include <pthread.h>
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001187int main(void) { pthread_create(0,0,0,0); return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001188EOF
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001189 for pthread_lib in $PTHREADLIBS_LIST; do
1190 if $cc $ARCH_CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null > /dev/null ; then
1191 pthread=yes
1192 PTHREADLIBS="$pthread_lib"
1193 break
1194 fi
1195 done
blueswir1414f0da2008-08-15 18:20:52 +00001196fi
1197
aliguorie5d355d2009-04-24 18:03:15 +00001198if test "$pthread" = no; then
1199 aio=no
1200 io_thread=no
1201fi
1202
aliguoribf9298b2008-12-05 20:05:26 +00001203##########################################
1204# iovec probe
1205cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001206#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001207#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001208#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001209int main(void) { struct iovec iov; return 0; }
1210EOF
1211iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001212if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001213 iovec=yes
1214fi
1215
aurel32f652e6a2008-12-16 10:43:48 +00001216##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001217# preadv probe
1218cat > $TMPC <<EOF
1219#include <sys/types.h>
1220#include <sys/uio.h>
1221#include <unistd.h>
1222int main(void) { preadv; }
1223EOF
1224preadv=no
1225if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1226 preadv=yes
1227fi
1228
1229##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001230# fdt probe
1231if test "$fdt" = "yes" ; then
1232 fdt=no
1233 cat > $TMPC << EOF
1234int main(void) { return 0; }
1235EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001236 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null > /dev/null ; then
aurel32f652e6a2008-12-16 10:43:48 +00001237 fdt=yes
1238 fi
1239fi
1240
aurel323b3f24a2009-04-15 16:12:13 +00001241#
1242# Check for xxxat() functions when we are building linux-user
1243# emulator. This is done because older glibc versions don't
1244# have syscall stubs for these implemented.
1245#
1246atfile=no
1247if [ "$linux_user" = "yes" ] ; then
1248 cat > $TMPC << EOF
1249#define _ATFILE_SOURCE
1250#include <sys/types.h>
1251#include <fcntl.h>
1252#include <unistd.h>
1253
1254int
1255main(void)
1256{
1257 /* try to unlink nonexisting file */
1258 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1259}
1260EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001261 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001262 atfile=yes
1263 fi
1264fi
1265
aurel3239386ac2009-04-15 19:48:17 +00001266# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001267# emulator. This is done because older glibc versions don't
1268# have syscall stubs for these implemented. In that case we
1269# don't provide them even if kernel supports them.
1270#
1271inotify=no
1272if [ "$linux_user" = "yes" ] ; then
1273 cat > $TMPC << EOF
1274#include <sys/inotify.h>
1275
1276int
1277main(void)
1278{
1279 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001280 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001281}
1282EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001283 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001284 inotify=yes
1285 fi
1286fi
1287
Riku Voipioebc996f2009-04-21 15:01:51 +03001288# check if utimensat and futimens are supported
1289utimens=no
1290cat > $TMPC << EOF
1291#define _ATFILE_SOURCE
1292#define _GNU_SOURCE
1293#include <stddef.h>
1294#include <fcntl.h>
1295
1296int main(void)
1297{
1298 utimensat(AT_FDCWD, "foo", NULL, 0);
1299 futimens(0, NULL);
1300 return 0;
1301}
1302EOF
1303if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1304 utimens=yes
1305fi
1306
Riku Voipio099d6b02009-05-05 12:10:04 +03001307# check if pipe2 is there
1308pipe2=no
1309cat > $TMPC << EOF
1310#define _GNU_SOURCE
1311#include <unistd.h>
1312#include <fcntl.h>
1313
1314int main(void)
1315{
1316 int pipefd[2];
1317 pipe2(pipefd, O_CLOEXEC);
1318 return 0;
1319}
1320EOF
1321if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1322 pipe2=yes
1323fi
1324
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301325# check if tee/splice is there. vmsplice was added same time.
1326splice=no
1327cat > $TMPC << EOF
1328#define _GNU_SOURCE
1329#include <unistd.h>
1330#include <fcntl.h>
1331#include <limits.h>
1332
1333int main(void)
1334{
1335 int len, fd;
1336 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1337 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1338 return 0;
1339}
1340EOF
1341if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1342 splice=yes
1343fi
1344
pbrookcc8ae6d2006-04-23 17:57:59 +00001345# Check if tools are available to build documentation.
Anthony Liguori70ec5dc2009-05-14 08:25:04 -05001346if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
1347 build_docs="no"
pbrookcc8ae6d2006-04-23 17:57:59 +00001348fi
1349
aliguorida93a1f2008-12-12 20:02:52 +00001350##########################################
1351# Do we need librt
aliguorie5d355d2009-04-24 18:03:15 +00001352CLOCKLIBS=""
aliguorida93a1f2008-12-12 20:02:52 +00001353cat > $TMPC <<EOF
1354#include <signal.h>
1355#include <time.h>
1356int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1357EOF
1358
1359rt=no
balrog8c7f7572008-12-15 03:15:36 +00001360if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001361 :
balrog8c7f7572008-12-15 03:15:36 +00001362elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001363 rt=yes
1364fi
1365
1366if test "$rt" = "yes" ; then
aliguorie5d355d2009-04-24 18:03:15 +00001367 CLOCKLIBS="-lrt"
aliguorida93a1f2008-12-12 20:02:52 +00001368fi
1369
bellard11d9f692004-04-02 20:55:59 +00001370if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001371 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001372 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001373 fi
1374 mansuffix=""
1375 datasuffix=""
1376 docsuffix=""
1377 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001378else
pbrook308c3592007-02-27 00:52:01 +00001379 if test -z "$prefix" ; then
1380 prefix="/usr/local"
1381 fi
1382 mansuffix="/share/man"
1383 datasuffix="/share/qemu"
1384 docsuffix="/share/doc/qemu"
1385 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001386fi
bellard5a671352003-10-01 00:13:48 +00001387
bellard43ce4df2003-06-09 19:53:12 +00001388echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001389echo "BIOS directory $prefix$datasuffix"
1390echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001391if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001392echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001393echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001394fi
bellard5a671352003-10-01 00:13:48 +00001395echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001396echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001397echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001398echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001399echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001400echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001401echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001402echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001403echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00001404echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00001405echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001406echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001407echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001408echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001409echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001410echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001411if test "$darwin" = "yes" ; then
1412 echo "Cocoa support $cocoa"
1413fi
bellard97a847b2003-08-10 21:36:04 +00001414echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001415if test "$sdl" != "no" ; then
1416 echo "SDL static link $sdl_static"
1417fi
balrog4d3b6f62008-02-10 16:33:14 +00001418echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02001419echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00001420echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001421echo "Audio drivers $audio_drv_list"
1422echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001423echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001424echo "VNC TLS support $vnc_tls"
1425if test "$vnc_tls" = "yes" ; then
1426 echo " TLS CFLAGS $vnc_tls_cflags"
1427 echo " TLS LIBS $vnc_tls_libs"
1428fi
aliguori2f9606b2009-03-06 20:27:28 +00001429echo "VNC SASL support $vnc_sasl"
1430if test "$vnc_sasl" = "yes" ; then
1431 echo " SASL CFLAGS $vnc_sasl_cflags"
1432 echo " SASL LIBS $vnc_sasl_libs"
1433fi
blueswir131422552007-04-16 18:27:06 +00001434if test -n "$sparc_cpu"; then
1435 echo "Target Sparc Arch $sparc_cpu"
1436fi
bellard07f4ddb2005-04-23 17:44:28 +00001437echo "kqemu support $kqemu"
aliguorie37630c2009-04-22 15:19:10 +00001438echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00001439echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001440echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001441[ ! -z "$uname_release" ] && \
1442echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001443echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001444echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001445echo "AIO support $aio"
aliguorie5d355d2009-04-24 18:03:15 +00001446echo "IO thread $io_thread"
ths77755342008-11-27 15:45:16 +00001447echo "Install blobs $blobs"
Jan Kiszka168ccc12009-06-07 11:30:25 +02001448echo -e "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001449echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001450echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001451
bellard97a847b2003-08-10 21:36:04 +00001452if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001453echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001454fi
bellard24b55b92005-03-01 22:30:41 +00001455#if test "$sdl_static" = "no"; then
1456# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1457#fi
bellard97a847b2003-08-10 21:36:04 +00001458config_mak="config-host.mak"
1459config_h="config-host.h"
1460
bellard7c1f25b2004-04-22 00:02:08 +00001461#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001462
ths15d9ca02007-07-31 23:07:32 +00001463test -f $config_h && mv $config_h ${config_h}~
1464
bellard97a847b2003-08-10 21:36:04 +00001465echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001466printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001467printf " '%s'" "$0" "$@" >> $config_mak
1468echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001469echo "/* Automatically generated by configure - do not modify */" > $config_h
1470
1471echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001472echo "bindir=\${prefix}$binsuffix" >> $config_mak
1473echo "mandir=\${prefix}$mansuffix" >> $config_mak
1474echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001475echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001476echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001477echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001478echo "INSTALL=$install" >> $config_mak
aliguori58f8aea2009-04-18 15:36:02 +00001479echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1480echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1481echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001482echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001483echo "HOST_CC=$host_cc" >> $config_mak
1484echo "AR=$ar" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001485# XXX: only use CFLAGS and LDFLAGS ?
1486# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1487# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001488echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001489echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1490echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1491echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001492echo "CFLAGS=$CFLAGS" >> $config_mak
1493echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001494echo "EXESUF=$EXESUF" >> $config_mak
aliguorie5d355d2009-04-24 18:03:15 +00001495echo "PTHREADLIBS=$PTHREADLIBS" >> $config_mak
1496echo "CLOCKLIBS=$CLOCKLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001497case "$cpu" in
1498 i386)
1499 echo "ARCH=i386" >> $config_mak
1500 echo "#define HOST_I386 1" >> $config_h
1501 ;;
1502 x86_64)
1503 echo "ARCH=x86_64" >> $config_mak
1504 echo "#define HOST_X86_64 1" >> $config_h
1505 ;;
1506 alpha)
1507 echo "ARCH=alpha" >> $config_mak
1508 echo "#define HOST_ALPHA 1" >> $config_h
1509 ;;
1510 armv4b)
1511 echo "ARCH=arm" >> $config_mak
1512 echo "#define HOST_ARM 1" >> $config_h
1513 ;;
1514 armv4l)
1515 echo "ARCH=arm" >> $config_mak
1516 echo "#define HOST_ARM 1" >> $config_h
1517 ;;
1518 cris)
1519 echo "ARCH=cris" >> $config_mak
1520 echo "#define HOST_CRIS 1" >> $config_h
1521 ;;
1522 hppa)
1523 echo "ARCH=hppa" >> $config_mak
1524 echo "#define HOST_HPPA 1" >> $config_h
1525 ;;
1526 ia64)
1527 echo "ARCH=ia64" >> $config_mak
1528 echo "#define HOST_IA64 1" >> $config_h
1529 ;;
1530 m68k)
1531 echo "ARCH=m68k" >> $config_mak
1532 echo "#define HOST_M68K 1" >> $config_h
1533 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001534 microblaze)
1535 echo "ARCH=microblaze" >> $config_mak
1536 echo "#define HOST_MICROBLAZE 1" >> $config_h
1537 ;;
aurel322408a522008-04-20 20:19:44 +00001538 mips)
1539 echo "ARCH=mips" >> $config_mak
1540 echo "#define HOST_MIPS 1" >> $config_h
1541 ;;
1542 mips64)
1543 echo "ARCH=mips64" >> $config_mak
1544 echo "#define HOST_MIPS64 1" >> $config_h
1545 ;;
malcfdf7ed92009-01-14 18:39:52 +00001546 ppc)
1547 echo "ARCH=ppc" >> $config_mak
1548 echo "#define HOST_PPC 1" >> $config_h
1549 ;;
1550 ppc64)
1551 echo "ARCH=ppc64" >> $config_mak
1552 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001553 ;;
1554 s390)
1555 echo "ARCH=s390" >> $config_mak
1556 echo "#define HOST_S390 1" >> $config_h
1557 ;;
1558 sparc)
1559 echo "ARCH=sparc" >> $config_mak
1560 echo "#define HOST_SPARC 1" >> $config_h
1561 ;;
1562 sparc64)
1563 echo "ARCH=sparc64" >> $config_mak
1564 echo "#define HOST_SPARC64 1" >> $config_h
1565 ;;
1566 *)
1567 echo "Unsupported CPU = $cpu"
1568 exit 1
1569 ;;
1570esac
aurel32f8393942009-04-13 18:45:38 +00001571if test "$debug_tcg" = "yes" ; then
1572 echo "#define DEBUG_TCG 1" >> $config_h
1573fi
Paul Brookf3d08ee2009-06-04 11:39:04 +01001574if test "$debug" = "yes" ; then
1575 echo "#define DEBUG_EXEC 1" >> $config_h
1576fi
aliguori03b4fe72008-10-07 19:16:17 +00001577if test "$sparse" = "yes" ; then
1578 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1579 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1580 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1581fi
aliguori1625af82009-04-05 17:41:02 +00001582if test "$strip_opt" = "yes" ; then
1583 echo "STRIP_OPT=-s" >> $config_mak
1584fi
bellard7d132992003-03-06 23:23:54 +00001585if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001586 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1587 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1588fi
bellardb6853692005-06-05 17:10:39 +00001589echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001590if test "$mingw32" = "yes" ; then
1591 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001592 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001593else
1594 cat > $TMPC << EOF
1595#include <byteswap.h>
1596int main(void) { return bswap_32(0); }
1597EOF
aurel32178baee2008-12-08 18:11:57 +00001598 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001599 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1600 fi
blueswir113606772008-12-05 17:54:09 +00001601 cat > $TMPC << EOF
1602#include <sys/endian.h>
1603#include <sys/types.h>
1604#include <machine/bswap.h>
1605int main(void) { return bswap32(0); }
1606EOF
aurel32178baee2008-12-08 18:11:57 +00001607 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001608 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1609 fi
bellard67b915a2004-03-31 23:37:16 +00001610fi
blueswir1128ab2f2008-08-15 18:33:42 +00001611
1612if [ "$openbsd" = "yes" ] ; then
1613 echo "#define ENOTSUP 4096" >> $config_h
1614fi
1615
bellard83fb7ad2004-07-05 21:25:26 +00001616if test "$darwin" = "yes" ; then
1617 echo "CONFIG_DARWIN=yes" >> $config_mak
1618 echo "#define CONFIG_DARWIN 1" >> $config_h
1619fi
malcb29fe3e2008-11-18 01:42:22 +00001620
1621if test "$aix" = "yes" ; then
1622 echo "CONFIG_AIX=yes" >> $config_mak
1623 echo "#define CONFIG_AIX 1" >> $config_h
1624fi
1625
bellardec530c82006-04-25 22:36:06 +00001626if test "$solaris" = "yes" ; then
1627 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001628 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001629 if test "$needs_libsunmath" = "yes" ; then
1630 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1631 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1632 fi
bellardec530c82006-04-25 22:36:06 +00001633fi
blueswir131422552007-04-16 18:27:06 +00001634if test -n "$sparc_cpu"; then
1635 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1636 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1637fi
bellard97a847b2003-08-10 21:36:04 +00001638if test "$gprof" = "yes" ; then
1639 echo "TARGET_GPROF=yes" >> $config_mak
1640 echo "#define HAVE_GPROF 1" >> $config_h
1641fi
1642if test "$static" = "yes" ; then
1643 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001644 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001645fi
bellard05c2a3e2006-02-08 22:39:17 +00001646if test $profiler = "yes" ; then
1647 echo "#define CONFIG_PROFILER 1" >> $config_h
1648fi
bellardc20709a2004-04-21 23:27:19 +00001649if test "$slirp" = "yes" ; then
1650 echo "CONFIG_SLIRP=yes" >> $config_mak
1651 echo "#define CONFIG_SLIRP 1" >> $config_h
1652fi
ths8a16d272008-07-19 09:56:24 +00001653if test "$vde" = "yes" ; then
1654 echo "CONFIG_VDE=yes" >> $config_mak
1655 echo "#define CONFIG_VDE 1" >> $config_h
1656 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1657fi
malc0c58ac12008-06-25 21:04:05 +00001658for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001659 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001660 echo "$def=yes" >> $config_mak
1661 echo "#define $def 1" >> $config_h
1662done
1663echo "#define AUDIO_DRIVERS \\" >> $config_h
1664for drv in $audio_drv_list; do
1665 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001666 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001667 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001668 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001669 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1670 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001671 elif test "$drv" = "oss"; then
1672 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001673 fi
1674done
1675echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001676if test "$mixemu" = "yes" ; then
1677 echo "CONFIG_MIXEMU=yes" >> $config_mak
1678 echo "#define CONFIG_MIXEMU 1" >> $config_h
1679fi
ths8d5d2d42007-08-25 01:37:51 +00001680if test "$vnc_tls" = "yes" ; then
1681 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1682 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1683 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1684 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1685fi
aliguori2f9606b2009-03-06 20:27:28 +00001686if test "$vnc_sasl" = "yes" ; then
1687 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1688 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1689 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1690 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1691fi
aliguori76655d62009-03-06 20:27:37 +00001692if test "$fnmatch" = "yes" ; then
1693 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1694fi
pbrookb1a550a2006-04-16 13:28:56 +00001695qemu_version=`head $source_path/VERSION`
1696echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001697echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001698
pbrook4a19f1e2009-04-07 23:17:49 +00001699echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1700
bellard97a847b2003-08-10 21:36:04 +00001701echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001702if [ "$source_path_used" = "yes" ]; then
1703 echo "VPATH=$source_path" >> $config_mak
1704fi
bellard97a847b2003-08-10 21:36:04 +00001705echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001706if [ "$build_docs" = "yes" ] ; then
1707 echo "BUILD_DOCS=yes" >> $config_mak
1708fi
bellard49ecc3f2007-11-07 19:25:15 +00001709if test "$static" = "yes"; then
1710 sdl1=$sdl_static
1711else
1712 sdl1=$sdl
1713fi
1714if test "$sdl1" = "yes" ; then
1715 echo "#define CONFIG_SDL 1" >> $config_h
1716 echo "CONFIG_SDL=yes" >> $config_mak
1717 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1718 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001719 elif test "$sdl_x11" = "yes" ; then
1720 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001721 else
1722 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1723 fi
1724 if [ "${aa}" = "yes" ] ; then
1725 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1726 else
1727 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1728 fi
1729fi
1730if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001731 echo "#define CONFIG_COCOA 1" >> $config_h
1732 echo "CONFIG_COCOA=yes" >> $config_mak
1733fi
1734if test "$curses" = "yes" ; then
1735 echo "#define CONFIG_CURSES 1" >> $config_h
1736 echo "CONFIG_CURSES=yes" >> $config_mak
1737 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001738fi
aurel323b3f24a2009-04-15 16:12:13 +00001739if test "$atfile" = "yes" ; then
1740 echo "#define CONFIG_ATFILE 1" >> $config_h
1741fi
Riku Voipioebc996f2009-04-21 15:01:51 +03001742if test "$utimens" = "yes" ; then
1743 echo "#define CONFIG_UTIMENSAT 1" >> $config_h
1744fi
Riku Voipio099d6b02009-05-05 12:10:04 +03001745if test "$pipe2" = "yes" ; then
1746 echo "#define CONFIG_PIPE2 1" >> $config_h
1747fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301748if test "$splice" = "yes" ; then
1749 echo "#define CONFIG_SPLICE 1" >> $config_h
1750fi
aurel323b3f24a2009-04-15 16:12:13 +00001751if test "$inotify" = "yes" ; then
1752 echo "#define CONFIG_INOTIFY 1" >> $config_h
1753fi
Alexander Graf769ce762009-05-11 17:41:42 +02001754if test "$curl" = "yes" ; then
1755 echo "CONFIG_CURL=yes" >> $config_mak
1756 echo "CURL_LIBS=$curl_libs" >> $config_mak
1757 echo "#define CONFIG_CURL 1" >> $config_h
1758fi
aurel322e4d9fb2008-04-08 06:01:02 +00001759if test "$brlapi" = "yes" ; then
1760 echo "CONFIG_BRLAPI=yes" >> $config_mak
1761 echo "#define CONFIG_BRLAPI 1" >> $config_h
1762 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1763fi
balrogfb599c92008-09-28 23:49:55 +00001764if test "$bluez" = "yes" ; then
1765 echo "CONFIG_BLUEZ=yes" >> $config_mak
1766 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1767 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1768 echo "#define CONFIG_BLUEZ 1" >> $config_h
1769fi
aliguorie37630c2009-04-22 15:19:10 +00001770if test "$xen" = "yes" ; then
aliguori9306acb2009-04-22 15:19:44 +00001771 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
aliguorie37630c2009-04-22 15:19:10 +00001772fi
blueswir1414f0da2008-08-15 18:20:52 +00001773if test "$aio" = "yes" ; then
1774 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001775 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001776fi
aliguorie5d355d2009-04-24 18:03:15 +00001777if test "$io_thread" = "yes" ; then
1778 echo "CONFIG_IOTHREAD=yes" >> $config_mak
1779 echo "#define CONFIG_IOTHREAD 1" >> $config_h
1780fi
ths77755342008-11-27 15:45:16 +00001781if test "$blobs" = "yes" ; then
1782 echo "INSTALL_BLOBS=yes" >> $config_mak
1783fi
aliguoribf9298b2008-12-05 20:05:26 +00001784if test "$iovec" = "yes" ; then
1785 echo "#define HAVE_IOVEC 1" >> $config_h
1786fi
aliguoriceb42de2009-04-07 18:43:28 +00001787if test "$preadv" = "yes" ; then
1788 echo "#define HAVE_PREADV 1" >> $config_h
1789fi
aurel32f652e6a2008-12-16 10:43:48 +00001790if test "$fdt" = "yes" ; then
1791 echo "#define HAVE_FDT 1" >> $config_h
1792 echo "FDT_LIBS=-lfdt" >> $config_mak
1793fi
bellard97a847b2003-08-10 21:36:04 +00001794
bellard83fb7ad2004-07-05 21:25:26 +00001795# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001796if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001797 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001798 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001799 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001800fi
1801
pbrookc5937222006-05-14 11:30:38 +00001802echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1803
blueswir168063642008-11-22 21:03:55 +00001804# USB host support
1805case "$usb" in
1806linux)
1807 echo "HOST_USB=linux" >> $config_mak
1808;;
1809bsd)
1810 echo "HOST_USB=bsd" >> $config_mak
1811;;
1812*)
1813 echo "HOST_USB=stub" >> $config_mak
1814;;
1815esac
1816
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001817# Determine what linker flags to use to force archive inclusion
1818check_linker_flags()
1819{
1820 $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 -Wl,$2 >/dev/null 2>/dev/null
1821}
1822
1823cat > $TMPC << EOF
1824int main(void) { }
1825EOF
1826if check_linker_flags --whole-archive --no-whole-archive ; then
1827 # GNU ld
1828 echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_mak
1829 echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_mak
1830elif check_linker_flags -z,allextract -z,defaultextract ; then
1831 # Solaris ld
1832 echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_mak
1833 echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_mak
1834else
1835 echo "Error: your linker does not support --whole-archive or -z."
1836 echo "Please report to qemu-devel@nongnu.org"
1837 exit 1
1838fi
1839
Blue Swirl2567f572009-05-21 15:54:48 +00001840if test "$xen" = "yes" ;
1841 then
1842 echo "CONFIG_XEN=yes" >> $config_mak
1843fi
1844
pbrookc39e3332007-09-22 16:49:14 +00001845tools=
1846if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001847 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001848 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001849 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001850 fi
pbrookc39e3332007-09-22 16:49:14 +00001851fi
1852echo "TOOLS=$tools" >> $config_mak
1853
Paul Brook370ab982009-05-26 15:07:56 +01001854if test -f ${config_h}~ ; then
1855 if cmp -s $config_h ${config_h}~ ; then
1856 mv ${config_h}~ $config_h
1857 else
1858 rm ${config_h}~
1859 fi
1860fi
1861
Paul Brook1ad21342009-05-19 16:17:58 +01001862config_host_mak=${config_mak}
ths15d9ca02007-07-31 23:07:32 +00001863
bellard1d14ffa2005-10-30 18:58:22 +00001864for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001865target_dir="$target"
1866config_mak=$target_dir/config.mak
1867config_h=$target_dir/config.h
1868target_cpu=`echo $target | cut -d '-' -f 1`
1869target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001870[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001871[ "$target_cpu" = "m68k" ] && target_bigendian=yes
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001872[ "$target_cpu" = "microblaze" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001873[ "$target_cpu" = "mips" ] && target_bigendian=yes
1874[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1875[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001876[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001877[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001878[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001879[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001880[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001881[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1882[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1883[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001884target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001885target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001886target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001887target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001888target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001889case "$target" in
1890 ${target_cpu}-softmmu)
1891 target_softmmu="yes"
1892 ;;
1893 ${target_cpu}-linux-user)
1894 target_user_only="yes"
1895 target_linux_user="yes"
1896 ;;
1897 ${target_cpu}-darwin-user)
1898 target_user_only="yes"
1899 target_darwin_user="yes"
1900 ;;
blueswir184778502008-10-26 20:33:16 +00001901 ${target_cpu}-bsd-user)
1902 target_user_only="yes"
1903 target_bsd_user="yes"
1904 ;;
pbrook9e407a82007-05-26 16:38:53 +00001905 *)
1906 echo "ERROR: Target '$target' not recognised"
1907 exit 1
1908 ;;
1909esac
ths831b7822007-01-18 20:06:33 +00001910
bellard7c1f25b2004-04-22 00:02:08 +00001911#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001912
ths15d9ca02007-07-31 23:07:32 +00001913test -f $config_h && mv $config_h ${config_h}~
1914
bellard97a847b2003-08-10 21:36:04 +00001915mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001916mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001917mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001918if 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 +00001919 mkdir -p $target_dir/nwfpe
1920fi
1921
bellardec530c82006-04-25 22:36:06 +00001922#
1923# don't use ln -sf as not all "ln -sf" over write the file/link
1924#
1925rm -f $target_dir/Makefile
1926ln -s $source_path/Makefile.target $target_dir/Makefile
1927
bellard97a847b2003-08-10 21:36:04 +00001928
1929echo "# Automatically generated by configure - do not modify" > $config_mak
1930echo "/* Automatically generated by configure - do not modify */" > $config_h
1931
1932
1933echo "include ../config-host.mak" >> $config_mak
1934echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001935
pbrooke5fe0c52006-06-11 13:32:59 +00001936bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001937elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001938target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001939interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1940echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001941gdb_xml_files=""
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001942target_kvm="$kvm"
bellard97a847b2003-08-10 21:36:04 +00001943
aliguori5985ece2008-11-05 19:59:25 +00001944# Make sure the target and host cpus are compatible
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001945if test ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001946 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001947 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1948 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001949 target_kvm="no"
aliguori7ba1e612008-11-05 16:04:33 +00001950fi
1951# Disable KVM for linux-user
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001952if test "$target_softmmu" = "no" ; then
1953 target_kvm="no"
aliguori7ba1e612008-11-05 16:04:33 +00001954fi
1955
aurel322408a522008-04-20 20:19:44 +00001956case "$target_cpu" in
1957 i386)
1958 echo "TARGET_ARCH=i386" >> $config_mak
1959 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1960 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001961 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001962 then
blueswir12d6ebb02009-04-18 19:25:43 +00001963 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001964 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001965 fi
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001966 if test "$target_kvm" = "yes" ; then
aliguori7ba1e612008-11-05 16:04:33 +00001967 echo "CONFIG_KVM=yes" >> $config_mak
1968 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001969 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001970 fi
aliguorie37630c2009-04-22 15:19:10 +00001971 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1972 then
1973 echo "CONFIG_XEN=yes" >> $config_mak
1974 echo "#define CONFIG_XEN 1" >> $config_h
1975 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001976 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001977 ;;
1978 x86_64)
1979 echo "TARGET_ARCH=x86_64" >> $config_mak
1980 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1981 echo "#define TARGET_I386 1" >> $config_h
1982 echo "#define TARGET_X86_64 1" >> $config_h
1983 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1984 then
blueswir12d6ebb02009-04-18 19:25:43 +00001985 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001986 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001987 fi
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001988 if test "$target_kvm" = "yes" ; then
aliguori7ba1e612008-11-05 16:04:33 +00001989 echo "CONFIG_KVM=yes" >> $config_mak
1990 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1991 echo "#define CONFIG_KVM 1" >> $config_h
1992 fi
aliguorie37630c2009-04-22 15:19:10 +00001993 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1994 then
1995 echo "CONFIG_XEN=yes" >> $config_mak
1996 echo "#define CONFIG_XEN 1" >> $config_h
1997 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001998 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001999 ;;
2000 alpha)
2001 echo "TARGET_ARCH=alpha" >> $config_mak
2002 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
2003 echo "#define TARGET_ALPHA 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002004 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002005 ;;
2006 arm|armeb)
2007 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00002008 echo "#define TARGET_ARCH \"arm\"" >> $config_h
2009 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00002010 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00002011 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00002012 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002013 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002014 ;;
2015 cris)
2016 echo "TARGET_ARCH=cris" >> $config_mak
2017 echo "#define TARGET_ARCH \"cris\"" >> $config_h
2018 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00002019 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002020 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002021 ;;
2022 m68k)
2023 echo "TARGET_ARCH=m68k" >> $config_mak
2024 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
2025 echo "#define TARGET_M68K 1" >> $config_h
2026 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00002027 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002028 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002029 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02002030 microblaze)
2031 echo "TARGET_ARCH=microblaze" >> $config_mak
2032 echo "#define TARGET_ARCH \"microblaze\"" >> $config_h
2033 echo "#define TARGET_MICROBLAZE 1" >> $config_h
2034 bflt="yes"
2035 target_nptl="yes"
2036 target_phys_bits=32
2037 ;;
2038 mips|mipsel)
aurel322408a522008-04-20 20:19:44 +00002039 echo "TARGET_ARCH=mips" >> $config_mak
2040 echo "#define TARGET_ARCH \"mips\"" >> $config_h
2041 echo "#define TARGET_MIPS 1" >> $config_h
2042 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002043 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002044 ;;
2045 mipsn32|mipsn32el)
2046 echo "TARGET_ARCH=mipsn32" >> $config_mak
2047 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
2048 echo "#define TARGET_MIPS 1" >> $config_h
2049 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002050 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002051 ;;
2052 mips64|mips64el)
2053 echo "TARGET_ARCH=mips64" >> $config_mak
2054 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
2055 echo "#define TARGET_MIPS 1" >> $config_h
2056 echo "#define TARGET_MIPS64 1" >> $config_h
2057 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002058 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002059 ;;
2060 ppc)
2061 echo "TARGET_ARCH=ppc" >> $config_mak
2062 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
2063 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00002064 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002065 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002066 ;;
2067 ppcemb)
2068 echo "TARGET_ARCH=ppcemb" >> $config_mak
2069 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2070 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
2071 echo "#define TARGET_PPC 1" >> $config_h
2072 echo "#define TARGET_PPCEMB 1" >> $config_h
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00002073 if test "$target_kvm" = "yes" ; then
aurel32d76d1652008-12-16 10:43:58 +00002074 echo "CONFIG_KVM=yes" >> $config_mak
2075 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2076 echo "#define CONFIG_KVM 1" >> $config_h
2077 fi
aurel32c8b35322009-01-24 15:07:34 +00002078 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002079 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002080 ;;
2081 ppc64)
2082 echo "TARGET_ARCH=ppc64" >> $config_mak
2083 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2084 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2085 echo "#define TARGET_PPC 1" >> $config_h
2086 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00002087 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002088 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002089 ;;
2090 ppc64abi32)
2091 echo "TARGET_ARCH=ppc64" >> $config_mak
2092 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2093 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
2094 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2095 echo "#define TARGET_PPC 1" >> $config_h
2096 echo "#define TARGET_PPC64 1" >> $config_h
2097 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00002098 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002099 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002100 ;;
2101 sh4|sh4eb)
2102 echo "TARGET_ARCH=sh4" >> $config_mak
2103 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
2104 echo "#define TARGET_SH4 1" >> $config_h
2105 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00002106 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002107 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002108 ;;
2109 sparc)
2110 echo "TARGET_ARCH=sparc" >> $config_mak
2111 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
2112 echo "#define TARGET_SPARC 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002113 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002114 ;;
2115 sparc64)
2116 echo "TARGET_ARCH=sparc64" >> $config_mak
2117 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2118 echo "#define TARGET_SPARC 1" >> $config_h
2119 echo "#define TARGET_SPARC64 1" >> $config_h
2120 elfload32="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002121 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002122 ;;
2123 sparc32plus)
2124 echo "TARGET_ARCH=sparc64" >> $config_mak
2125 echo "TARGET_ABI_DIR=sparc" >> $config_mak
2126 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
2127 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2128 echo "#define TARGET_SPARC 1" >> $config_h
2129 echo "#define TARGET_SPARC64 1" >> $config_h
2130 echo "#define TARGET_ABI32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002131 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002132 ;;
2133 *)
2134 echo "Unsupported target CPU"
2135 exit 1
2136 ;;
2137esac
Paul Brook1ad21342009-05-19 16:17:58 +01002138if [ $target_phys_bits -lt $hostlongbits ] ; then
2139 target_phys_bits=$hostlongbits
2140fi
2141echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
2142echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h
2143echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00002144if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00002145 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2146 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2147fi
2148if test "$target_softmmu" = "yes" ; then
2149 echo "CONFIG_SOFTMMU=yes" >> $config_mak
2150 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00002151fi
bellard997344f2003-10-27 21:10:39 +00002152if test "$target_user_only" = "yes" ; then
2153 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2154 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2155fi
ths831b7822007-01-18 20:06:33 +00002156if test "$target_linux_user" = "yes" ; then
2157 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2158 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2159fi
2160if test "$target_darwin_user" = "yes" ; then
2161 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2162 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2163fi
pbrook56aebc82008-10-11 17:55:29 +00002164list=""
2165if test ! -z "$gdb_xml_files" ; then
2166 for x in $gdb_xml_files; do
2167 list="$list $source_path/gdb-xml/$x"
2168 done
2169fi
2170echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00002171
aurel320938cda2008-04-11 21:36:06 +00002172if test "$target_cpu" = "arm" \
2173 -o "$target_cpu" = "armeb" \
2174 -o "$target_cpu" = "m68k" \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02002175 -o "$target_cpu" = "microblaze" \
aurel320938cda2008-04-11 21:36:06 +00002176 -o "$target_cpu" = "mips" \
2177 -o "$target_cpu" = "mipsel" \
2178 -o "$target_cpu" = "mipsn32" \
2179 -o "$target_cpu" = "mipsn32el" \
2180 -o "$target_cpu" = "mips64" \
2181 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00002182 -o "$target_cpu" = "ppc" \
2183 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00002184 -o "$target_cpu" = "ppc64abi32" \
2185 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00002186 -o "$target_cpu" = "sparc" \
2187 -o "$target_cpu" = "sparc64" \
2188 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00002189 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2190 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2191fi
pbrooke5fe0c52006-06-11 13:32:59 +00002192if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2193 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2194 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2195fi
pbrookbd0c5662008-05-29 14:34:11 +00002196if test "$target_user_only" = "yes" \
2197 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2198 echo "#define USE_NPTL 1" >> $config_h
2199fi
blueswir1cb33da52007-10-09 16:34:29 +00002200# 32 bit ELF loader in addition to native 64 bit loader?
2201if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2202 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2203 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2204fi
blueswir184778502008-10-26 20:33:16 +00002205if test "$target_bsd_user" = "yes" ; then
2206 echo "CONFIG_BSD_USER=yes" >> $config_mak
2207 echo "#define CONFIG_BSD_USER 1" >> $config_h
2208fi
bellard5b0753e2005-03-01 21:37:28 +00002209
ths15d9ca02007-07-31 23:07:32 +00002210test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2211
bellard97a847b2003-08-10 21:36:04 +00002212done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00002213
2214# build tree in object directory if source path is different from current one
2215if test "$source_path_used" = "yes" ; then
Anthony Liguori019d6b82009-05-09 17:14:19 -05002216 DIRS="tests tests/cris slirp audio block"
bellard7d132992003-03-06 23:23:54 +00002217 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00002218 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00002219 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00002220 for dir in $DIRS ; do
2221 mkdir -p $dir
2222 done
bellardec530c82006-04-25 22:36:06 +00002223 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00002224 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00002225 rm -f $f
2226 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00002227 done
2228fi
Paul Brook1ad21342009-05-19 16:17:58 +01002229
2230for hwlib in 32 64; do
2231 d=libhw$hwlib
2232 mkdir -p $d
2233 rm -f $d/Makefile
2234 ln -s $source_path/Makefile.hw $d/Makefile
2235 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2236 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2237done