blob: 48c8949a4a9e98d6126d6ef796cda3f52a399656 [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"
bellard85aa5182007-11-11 20:17:03 +0000516if test "$werror" = "yes" ; then
517CFLAGS="$CFLAGS -Werror"
518fi
ths6f30fa82007-01-05 01:00:47 +0000519
blueswir1d2c7c9b2008-11-01 14:50:20 +0000520if test "$solaris" = "no" ; then
521 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
522 LDFLAGS="$LDFLAGS -Wl,--warn-common"
523 fi
blueswir149237ac2008-09-17 19:05:19 +0000524fi
525
blueswir131422552007-04-16 18:27:06 +0000526#
527# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
528# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
529#
bellard40293e52008-01-31 11:32:10 +0000530case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000531 sparc) if test -z "$sparc_cpu" ; then
532 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
533 ARCH_LDFLAGS="-m32"
534 else
535 ARCH_CFLAGS="${SP_CFLAGS}"
536 ARCH_LDFLAGS="${SP_LDFLAGS}"
537 fi
blueswir1762e8232009-04-04 09:21:28 +0000538 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
539 if test "$solaris" = "no" ; then
540 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
541 fi
blueswir131422552007-04-16 18:27:06 +0000542 ;;
543 sparc64) if test -z "$sparc_cpu" ; then
544 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
545 ARCH_LDFLAGS="-m64"
546 else
547 ARCH_CFLAGS="${SP_CFLAGS}"
548 ARCH_LDFLAGS="${SP_LDFLAGS}"
549 fi
blueswir1762e8232009-04-04 09:21:28 +0000550 if test "$solaris" = "no" ; then
551 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
552 else
553 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
554 fi
blueswir131422552007-04-16 18:27:06 +0000555 ;;
ths76d83bd2007-11-18 21:22:10 +0000556 s390)
557 ARCH_CFLAGS="-march=z900"
558 ;;
bellard40293e52008-01-31 11:32:10 +0000559 i386)
560 ARCH_CFLAGS="-m32"
561 ARCH_LDFLAGS="-m32"
562 ;;
563 x86_64)
564 ARCH_CFLAGS="-m64"
565 ARCH_LDFLAGS="-m64"
566 ;;
blueswir131422552007-04-16 18:27:06 +0000567esac
568
pbrookaf5db582006-04-08 14:26:41 +0000569if test x"$show_help" = x"yes" ; then
570cat << EOF
571
572Usage: configure [options]
573Options: [defaults in brackets after descriptions]
574
575EOF
576echo "Standard options:"
577echo " --help print this message"
578echo " --prefix=PREFIX install in PREFIX [$prefix]"
579echo " --interp-prefix=PREFIX where to find shared libraries, etc."
580echo " use %M for cpu name [$interp_prefix]"
581echo " --target-list=LIST set target list [$target_list]"
582echo ""
583echo "kqemu kernel acceleration support:"
584echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000585echo ""
586echo "Advanced options (experts only):"
587echo " --source-path=PATH path of source code [$source_path]"
588echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
589echo " --cc=CC use C compiler CC [$cc]"
590echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
aurel322981fa92009-04-07 19:57:17 +0000591echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
592echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000593echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000594echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000595echo " --static enable static build [$static]"
aurel32f8393942009-04-13 18:45:38 +0000596echo " --enable-debug-tcg enable TCG debugging"
597echo " --disable-debug-tcg disable TCG debugging (default)"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100598echo " --disable-debug enable common debug build options"
aliguori890b1652008-10-07 21:22:41 +0000599echo " --enable-sparse enable sparse checker"
600echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000601echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000602echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000603echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000604echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000605echo " --audio-drv-list=LIST set audio drivers list:"
606echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000607echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
608echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000609echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000610echo " --disable-xen disable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000611echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000612echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000613echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000614echo " --disable-curses disable curses output"
Alexander Graf769ce762009-05-11 17:41:42 +0200615echo " --disable-curl disable curl connectivity"
balrogfb599c92008-09-28 23:49:55 +0000616echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000617echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000618echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000619echo " --enable-system enable all system emulation targets"
620echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000621echo " --enable-linux-user enable all linux usermode emulation targets"
622echo " --disable-linux-user disable all linux usermode emulation targets"
623echo " --enable-darwin-user enable all darwin usermode emulation targets"
624echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000625echo " --enable-bsd-user enable all BSD usermode emulation targets"
626echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000627echo " --fmod-lib path to FMOD library"
628echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000629echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000630echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000631echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000632echo " --disable-vde disable support for vde network"
aliguorie5d355d2009-04-24 18:03:15 +0000633echo " --disable-pthread disable pthread support"
blueswir1414f0da2008-08-15 18:20:52 +0000634echo " --disable-aio disable AIO support"
aliguorie5d355d2009-04-24 18:03:15 +0000635echo " --enable-io-thread enable IO thread"
ths77755342008-11-27 15:45:16 +0000636echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000637echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000638echo ""
ths5bf08932006-12-23 00:33:26 +0000639echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000640exit 1
641fi
642
bellard67b915a2004-03-31 23:37:16 +0000643if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000644 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000645 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000646 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000647 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000648 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000649 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000650fi
651
aliguori03b4fe72008-10-07 19:16:17 +0000652if test ! -x "$(which cgcc 2>/dev/null)"; then
653 sparse="no"
654fi
655
Anthony Liguori487fefd2009-06-11 13:28:25 -0500656# Consult white-list to determine whether to enable werror
657# by default. Only enable by default for git builds
658if test -z "$werror" ; then
659 z_version=`cut -f3 -d. $source_path/VERSION`
660 if test "$z_version" = "50" -a \
661 "$linux" = "yes" ; then
662 werror="yes"
663 else
664 werror="no"
665 fi
666fi
667
bellardec530c82006-04-25 22:36:06 +0000668#
669# Solaris specific configure tool chain decisions
670#
671if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000672 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
673 if test -z "$solinst" ; then
674 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
675 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
676 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
677 exit 1
678 fi
679 if test "$solinst" = "/usr/sbin/install" ; then
680 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
681 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
682 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
683 exit 1
684 fi
bellardec530c82006-04-25 22:36:06 +0000685 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
686 if test -z "$sol_ar" ; then
687 echo "Error: No path includes ar"
688 if test -f /usr/ccs/bin/ar ; then
689 echo "Add /usr/ccs/bin to your path and rerun configure"
690 fi
691 exit 1
692 fi
ths5fafdf22007-09-16 21:08:06 +0000693fi
bellardec530c82006-04-25 22:36:06 +0000694
695
bellard5327cf42005-01-10 23:18:50 +0000696if test -z "$target_list" ; then
697# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000698 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000699 target_list="\
700i386-softmmu \
701x86_64-softmmu \
702arm-softmmu \
703cris-softmmu \
704m68k-softmmu \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200705microblaze-softmmu \
aurel322408a522008-04-20 20:19:44 +0000706mips-softmmu \
707mipsel-softmmu \
708mips64-softmmu \
709mips64el-softmmu \
710ppc-softmmu \
711ppcemb-softmmu \
712ppc64-softmmu \
713sh4-softmmu \
714sh4eb-softmmu \
715sparc-softmmu \
716"
pbrook0a8e90f2006-03-19 14:54:16 +0000717 fi
bellard5327cf42005-01-10 23:18:50 +0000718# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000719 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000720 target_list="${target_list}\
721i386-linux-user \
722x86_64-linux-user \
723alpha-linux-user \
724arm-linux-user \
725armeb-linux-user \
726cris-linux-user \
727m68k-linux-user \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200728microblaze-linux-user \
aurel322408a522008-04-20 20:19:44 +0000729mips-linux-user \
730mipsel-linux-user \
731ppc-linux-user \
732ppc64-linux-user \
733ppc64abi32-linux-user \
734sh4-linux-user \
735sh4eb-linux-user \
736sparc-linux-user \
737sparc64-linux-user \
738sparc32plus-linux-user \
739"
ths831b7822007-01-18 20:06:33 +0000740 fi
741# the following are Darwin specific
742 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000743 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000744 fi
blueswir184778502008-10-26 20:33:16 +0000745# the following are BSD specific
746 if [ "$bsd_user" = "yes" ] ; then
747 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000748i386-bsd-user \
749x86_64-bsd-user \
750sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000751sparc64-bsd-user \
752"
753 fi
bellard6e20a452005-06-05 15:56:02 +0000754else
pbrookb1a550a2006-04-16 13:28:56 +0000755 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000756fi
pbrook0a8e90f2006-03-19 14:54:16 +0000757if test -z "$target_list" ; then
758 echo "No targets enabled"
759 exit 1
760fi
bellard5327cf42005-01-10 23:18:50 +0000761
bellard7d132992003-03-06 23:23:54 +0000762if test -z "$cross_prefix" ; then
763
764# ---
765# big/little endian test
766cat > $TMPC << EOF
767#include <inttypes.h>
768int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000769 volatile uint32_t i=0x01234567;
770 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000771}
772EOF
773
aurel32178baee2008-12-08 18:11:57 +0000774if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000775$TMPE && bigendian="yes"
776else
777echo big/little test failed
778fi
779
780else
781
782# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000783if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000784 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000785 -o "$cpu" = "m68k" \
786 -o "$cpu" = "mips" \
787 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000788 -o "$cpu" = "ppc" \
789 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000790 -o "$cpu" = "s390" \
791 -o "$cpu" = "sparc" \
792 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000793 bigendian="yes"
794fi
795
796fi
797
bellardb6853692005-06-05 17:10:39 +0000798# host long bits test
799hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000800if test "$cpu" = "x86_64" \
801 -o "$cpu" = "alpha" \
802 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000803 -o "$cpu" = "sparc64" \
804 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000805 hostlongbits="64"
806fi
807
pbrookbd0c5662008-05-29 14:34:11 +0000808# Check host NPTL support
809cat > $TMPC <<EOF
810#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000811#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000812void foo()
813{
814#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
815#error bork
816#endif
817}
818EOF
819
balrog8c7f7572008-12-15 03:15:36 +0000820if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000821 :
822else
823 nptl="no"
824fi
825
bellard11d9f692004-04-02 20:55:59 +0000826##########################################
balrogac629222008-10-11 09:56:04 +0000827# zlib check
828
829cat > $TMPC << EOF
830#include <zlib.h>
831int main(void) { zlibVersion(); return 0; }
832EOF
balrog8c7f7572008-12-15 03:15:36 +0000833if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000834 :
835else
836 echo
837 echo "Error: zlib check failed"
838 echo "Make sure to have the zlib libs and headers installed."
839 echo
840 exit 1
841fi
842
843##########################################
aliguorie37630c2009-04-22 15:19:10 +0000844# xen probe
845
846if test "$xen" = "yes" ; then
847cat > $TMPC <<EOF
848#include <xenctrl.h>
849#include <xs.h>
850int main(void) { xs_daemon_open; xc_interface_open; }
851EOF
Jan Kiszka918a6082009-04-27 17:16:55 +0000852 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null > /dev/null ; then
aliguorie37630c2009-04-22 15:19:10 +0000853 :
854 else
855 xen="no"
856 fi
857fi
858
859##########################################
bellard11d9f692004-04-02 20:55:59 +0000860# SDL probe
861
862sdl_too_old=no
863
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500864if test "$sdl" = "yes" ; then
ths069b0bd2007-07-12 00:27:15 +0000865 sdl_config="sdl-config"
866 sdl=no
867 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000868
869cat > $TMPC << EOF
870#include <SDL.h>
871#undef main /* We don't want SDL to override our main() */
872int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
873EOF
balrog8c7f7572008-12-15 03:15:36 +0000874 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 +0000875 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
876 if test "$_sdlversion" -lt 121 ; then
877 sdl_too_old=yes
878 else
879 if test "$cocoa" = "no" ; then
880 sdl=yes
881 fi
882 fi
883
884 # static link with sdl ?
885 if test "$sdl" = "yes" ; then
886 aa="no"
887 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
888 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
889 if [ "$aa" = "yes" ] ; then
890 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000891 fi
bellard11d9f692004-04-02 20:55:59 +0000892
balrog8c7f7572008-12-15 03:15:36 +0000893 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 +0000894 sdl_static=yes
895 fi
896 fi # static link
897 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000898else
ths069b0bd2007-07-12 00:27:15 +0000899 # Make sure to disable cocoa if sdl was set
900 if test "$sdl" = "yes" ; then
901 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000902 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000903 fi
bellarda6e022a2004-04-02 21:55:47 +0000904fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000905
aliguori5368a422009-03-03 17:37:21 +0000906if test "$sdl" = "yes" ; then
907cat > $TMPC <<EOF
908#include <SDL.h>
909#if defined(SDL_VIDEO_DRIVER_X11)
910#include <X11/XKBlib.h>
911#else
912#error No x11 support
913#endif
914int main(void) { return 0; }
915EOF
916 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
917 sdl_x11="yes"
918 fi
919fi
920
ths8f28f3f2007-01-05 21:25:54 +0000921##########################################
ths8d5d2d42007-08-25 01:37:51 +0000922# VNC TLS detection
923if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000924cat > $TMPC <<EOF
925#include <gnutls/gnutls.h>
926int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
927EOF
928 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
929 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
930 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000931 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000932 :
933 else
934 vnc_tls="no"
935 fi
ths8d5d2d42007-08-25 01:37:51 +0000936fi
937
938##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000939# VNC SASL detection
940if test "$vnc_sasl" = "yes" ; then
941cat > $TMPC <<EOF
942#include <sasl/sasl.h>
943#include <stdio.h>
944int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
945EOF
946 # Assuming Cyrus-SASL installed in /usr prefix
947 vnc_sasl_cflags=""
948 vnc_sasl_libs="-lsasl2"
949 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
Jan Kiszka918a6082009-04-27 17:16:55 +0000950 $vnc_sasl_libs 2> /dev/null > /dev/null ; then
aliguori2f9606b2009-03-06 20:27:28 +0000951 :
952 else
953 vnc_sasl="no"
954 fi
955fi
956
957##########################################
aliguori76655d62009-03-06 20:27:37 +0000958# fnmatch() probe, used for ACL routines
959fnmatch="no"
960cat > $TMPC << EOF
961#include <fnmatch.h>
962int main(void)
963{
964 fnmatch("foo", "foo", 0);
965 return 0;
966}
967EOF
968if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
969 fnmatch="yes"
970fi
971
972##########################################
ths8a16d272008-07-19 09:56:24 +0000973# vde libraries probe
974if test "$vde" = "yes" ; then
975 cat > $TMPC << EOF
976#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000977int main(void)
978{
979 struct vde_open_args a = {0, 0, 0};
980 vde_open("", "", &a);
981 return 0;
982}
ths8a16d272008-07-19 09:56:24 +0000983EOF
balrog8c7f7572008-12-15 03:15:36 +0000984 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000985 :
986 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000987 vde="no"
ths8a16d272008-07-19 09:56:24 +0000988 fi
989fi
990
991##########################################
malcc2de5c92008-06-28 19:13:06 +0000992# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000993
malcc2de5c92008-06-28 19:13:06 +0000994audio_drv_probe()
995{
996 drv=$1
997 hdr=$2
998 lib=$3
999 exp=$4
1000 cfl=$5
1001 cat > $TMPC << EOF
1002#include <$hdr>
1003int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00001004EOF
balrog8c7f7572008-12-15 03:15:36 +00001005 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +00001006 :
1007 else
1008 echo
1009 echo "Error: $drv check failed"
1010 echo "Make sure to have the $drv libs and headers installed."
1011 echo
1012 exit 1
1013 fi
1014}
1015
malc2fa7d3b2008-07-29 12:58:44 +00001016audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00001017for drv in $audio_drv_list; do
1018 case $drv in
1019 alsa)
1020 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1021 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1022 ;;
1023
1024 fmod)
1025 if test -z $fmod_lib || test -z $fmod_inc; then
1026 echo
1027 echo "Error: You must specify path to FMOD library and headers"
1028 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1029 echo
1030 exit 1
1031 fi
1032 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1033 ;;
1034
1035 esd)
1036 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1037 ;;
malcb8e59f12008-07-02 21:03:08 +00001038
1039 pa)
1040 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1041 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1042 ;;
1043
blueswir12f6a1ab2008-08-21 18:00:53 +00001044 oss|sdl|core|wav|dsound)
1045 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1046 ;;
1047
malce4c63a62008-07-19 16:15:16 +00001048 *)
malc1c9b2a52008-07-19 16:57:30 +00001049 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001050 echo
1051 echo "Error: Unknown driver '$drv' selected"
1052 echo "Possible drivers are: $audio_possible_drivers"
1053 echo
1054 exit 1
1055 }
1056 ;;
malcc2de5c92008-06-28 19:13:06 +00001057 esac
1058done
ths8f28f3f2007-01-05 21:25:54 +00001059
balrog4d3b6f62008-02-10 16:33:14 +00001060##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001061# BrlAPI probe
1062
1063if test -z "$brlapi" ; then
1064 brlapi=no
1065cat > $TMPC << EOF
1066#include <brlapi.h>
1067int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1068EOF
aurel32178baee2008-12-08 18:11:57 +00001069 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +00001070 brlapi=yes
1071 fi # brlapi compile test
1072fi # -z $brlapi
1073
1074##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001075# curses probe
1076
1077if test "$curses" = "yes" ; then
1078 curses=no
1079 cat > $TMPC << EOF
1080#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001081#ifdef __OpenBSD__
1082#define resize_term resizeterm
1083#endif
1084int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001085EOF
aurel32178baee2008-12-08 18:11:57 +00001086 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001087 curses=yes
1088 fi
1089fi # test "$curses"
1090
blueswir1414f0da2008-08-15 18:20:52 +00001091##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001092# curl probe
1093
1094if test "$curl" = "yes" ; then
1095 curl=no
1096 cat > $TMPC << EOF
1097#include <curl/curl.h>
1098int main(void) { return curl_easy_init(); }
1099EOF
Paul Brook52368552009-05-22 17:22:38 +01001100 curl_libs=`curl-config --libs 2>/dev/null`
Alexander Graf769ce762009-05-11 17:41:42 +02001101 if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1102 curl=yes
1103 fi
1104fi # test "$curl"
1105
1106##########################################
balrogfb599c92008-09-28 23:49:55 +00001107# bluez support probe
1108if test "$bluez" = "yes" ; then
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001109 `pkg-config bluez 2> /dev/null` || bluez="no"
balrogfb599c92008-09-28 23:49:55 +00001110fi
1111if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001112 cat > $TMPC << EOF
1113#include <bluetooth/bluetooth.h>
1114int main(void) { return bt_error(0); }
1115EOF
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001116 bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1117 bluez_libs=`pkg-config --libs bluez 2> /dev/null`
balrog17e15922008-10-11 12:00:42 +00001118 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001119 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001120 :
1121 else
1122 bluez="no"
1123 fi
balrogfb599c92008-09-28 23:49:55 +00001124fi
1125
1126##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001127# kvm probe
1128if test "$kvm" = "yes" ; then
1129 cat > $TMPC <<EOF
1130#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001131#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001132#error Invalid KVM version
1133#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001134#if !defined(KVM_CAP_USER_MEMORY)
1135#error Missing KVM capability KVM_CAP_USER_MEMORY
1136#endif
1137#if !defined(KVM_CAP_SET_TSS_ADDR)
1138#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1139#endif
1140#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1141#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1142#endif
aliguori7ba1e612008-11-05 16:04:33 +00001143int main(void) { return 0; }
1144EOF
aliguorieac30262008-11-05 16:28:56 +00001145 if test "$kerneldir" != "" ; then
1146 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001147 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1148 -a -d "$kerneldir/arch/x86/include" ; then
1149 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001150 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1151 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001152 elif test -d "$kerneldir/arch/$cpu/include" ; then
1153 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1154 fi
aliguorieac30262008-11-05 16:28:56 +00001155 else
1156 kvm_cflags=""
1157 fi
aliguori7ba1e612008-11-05 16:04:33 +00001158 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001159 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001160 :
1161 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001162 kvm="no";
1163 if [ -x "`which awk 2>/dev/null`" ] && \
1164 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001165 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001166 | grep "error: " \
1167 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1168 if test "$kvmerr" != "" ; then
Jan Kiszka168ccc12009-06-07 11:30:25 +02001169 kvm="no - (${kvmerr})\n\
1170 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1171recent kvm-kmod from http://sourceforge.net/projects/kvm."
aliguori9fd8d8d2009-01-15 21:57:30 +00001172 fi
1173 fi
aliguori7ba1e612008-11-05 16:04:33 +00001174 fi
1175fi
1176
1177##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001178# pthread probe
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001179PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
aliguorie5d355d2009-04-24 18:03:15 +00001180PTHREADLIBS=""
aliguori3c529d92008-12-12 16:41:40 +00001181
aliguorie5d355d2009-04-24 18:03:15 +00001182if test "$pthread" = yes; then
1183 pthread=no
1184cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001185#include <pthread.h>
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001186int main(void) { pthread_create(0,0,0,0); return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001187EOF
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001188 for pthread_lib in $PTHREADLIBS_LIST; do
1189 if $cc $ARCH_CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null > /dev/null ; then
1190 pthread=yes
1191 PTHREADLIBS="$pthread_lib"
1192 break
1193 fi
1194 done
blueswir1414f0da2008-08-15 18:20:52 +00001195fi
1196
aliguorie5d355d2009-04-24 18:03:15 +00001197if test "$pthread" = no; then
1198 aio=no
1199 io_thread=no
1200fi
1201
aliguoribf9298b2008-12-05 20:05:26 +00001202##########################################
1203# iovec probe
1204cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001205#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001206#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001207#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001208int main(void) { struct iovec iov; return 0; }
1209EOF
1210iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001211if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001212 iovec=yes
1213fi
1214
aurel32f652e6a2008-12-16 10:43:48 +00001215##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001216# preadv probe
1217cat > $TMPC <<EOF
1218#include <sys/types.h>
1219#include <sys/uio.h>
1220#include <unistd.h>
1221int main(void) { preadv; }
1222EOF
1223preadv=no
1224if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1225 preadv=yes
1226fi
1227
1228##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001229# fdt probe
1230if test "$fdt" = "yes" ; then
1231 fdt=no
1232 cat > $TMPC << EOF
1233int main(void) { return 0; }
1234EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001235 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null > /dev/null ; then
aurel32f652e6a2008-12-16 10:43:48 +00001236 fdt=yes
1237 fi
1238fi
1239
aurel323b3f24a2009-04-15 16:12:13 +00001240#
1241# Check for xxxat() functions when we are building linux-user
1242# emulator. This is done because older glibc versions don't
1243# have syscall stubs for these implemented.
1244#
1245atfile=no
1246if [ "$linux_user" = "yes" ] ; then
1247 cat > $TMPC << EOF
1248#define _ATFILE_SOURCE
1249#include <sys/types.h>
1250#include <fcntl.h>
1251#include <unistd.h>
1252
1253int
1254main(void)
1255{
1256 /* try to unlink nonexisting file */
1257 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1258}
1259EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001260 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001261 atfile=yes
1262 fi
1263fi
1264
aurel3239386ac2009-04-15 19:48:17 +00001265# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001266# emulator. This is done because older glibc versions don't
1267# have syscall stubs for these implemented. In that case we
1268# don't provide them even if kernel supports them.
1269#
1270inotify=no
1271if [ "$linux_user" = "yes" ] ; then
1272 cat > $TMPC << EOF
1273#include <sys/inotify.h>
1274
1275int
1276main(void)
1277{
1278 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001279 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001280}
1281EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001282 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001283 inotify=yes
1284 fi
1285fi
1286
pbrookcc8ae6d2006-04-23 17:57:59 +00001287# Check if tools are available to build documentation.
Anthony Liguori70ec5dc2009-05-14 08:25:04 -05001288if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
1289 build_docs="no"
pbrookcc8ae6d2006-04-23 17:57:59 +00001290fi
1291
aliguorida93a1f2008-12-12 20:02:52 +00001292##########################################
1293# Do we need librt
aliguorie5d355d2009-04-24 18:03:15 +00001294CLOCKLIBS=""
aliguorida93a1f2008-12-12 20:02:52 +00001295cat > $TMPC <<EOF
1296#include <signal.h>
1297#include <time.h>
1298int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1299EOF
1300
1301rt=no
balrog8c7f7572008-12-15 03:15:36 +00001302if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001303 :
balrog8c7f7572008-12-15 03:15:36 +00001304elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001305 rt=yes
1306fi
1307
1308if test "$rt" = "yes" ; then
aliguorie5d355d2009-04-24 18:03:15 +00001309 CLOCKLIBS="-lrt"
aliguorida93a1f2008-12-12 20:02:52 +00001310fi
1311
bellard11d9f692004-04-02 20:55:59 +00001312if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001313 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001314 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001315 fi
1316 mansuffix=""
1317 datasuffix=""
1318 docsuffix=""
1319 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001320else
pbrook308c3592007-02-27 00:52:01 +00001321 if test -z "$prefix" ; then
1322 prefix="/usr/local"
1323 fi
1324 mansuffix="/share/man"
1325 datasuffix="/share/qemu"
1326 docsuffix="/share/doc/qemu"
1327 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001328fi
bellard5a671352003-10-01 00:13:48 +00001329
bellard43ce4df2003-06-09 19:53:12 +00001330echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001331echo "BIOS directory $prefix$datasuffix"
1332echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001333if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001334echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001335echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001336fi
bellard5a671352003-10-01 00:13:48 +00001337echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001338echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001339echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001340echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001341echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001342echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001343echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001344echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001345echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00001346echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00001347echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001348echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001349echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001350echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001351echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001352echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001353if test "$darwin" = "yes" ; then
1354 echo "Cocoa support $cocoa"
1355fi
bellard97a847b2003-08-10 21:36:04 +00001356echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001357if test "$sdl" != "no" ; then
1358 echo "SDL static link $sdl_static"
1359fi
balrog4d3b6f62008-02-10 16:33:14 +00001360echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02001361echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00001362echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001363echo "Audio drivers $audio_drv_list"
1364echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001365echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001366echo "VNC TLS support $vnc_tls"
1367if test "$vnc_tls" = "yes" ; then
1368 echo " TLS CFLAGS $vnc_tls_cflags"
1369 echo " TLS LIBS $vnc_tls_libs"
1370fi
aliguori2f9606b2009-03-06 20:27:28 +00001371echo "VNC SASL support $vnc_sasl"
1372if test "$vnc_sasl" = "yes" ; then
1373 echo " SASL CFLAGS $vnc_sasl_cflags"
1374 echo " SASL LIBS $vnc_sasl_libs"
1375fi
blueswir131422552007-04-16 18:27:06 +00001376if test -n "$sparc_cpu"; then
1377 echo "Target Sparc Arch $sparc_cpu"
1378fi
bellard07f4ddb2005-04-23 17:44:28 +00001379echo "kqemu support $kqemu"
aliguorie37630c2009-04-22 15:19:10 +00001380echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00001381echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001382echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001383[ ! -z "$uname_release" ] && \
1384echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001385echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001386echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001387echo "AIO support $aio"
aliguorie5d355d2009-04-24 18:03:15 +00001388echo "IO thread $io_thread"
ths77755342008-11-27 15:45:16 +00001389echo "Install blobs $blobs"
Jan Kiszka168ccc12009-06-07 11:30:25 +02001390echo -e "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001391echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001392echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001393
bellard97a847b2003-08-10 21:36:04 +00001394if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001395echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001396fi
bellard24b55b92005-03-01 22:30:41 +00001397#if test "$sdl_static" = "no"; then
1398# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1399#fi
bellard97a847b2003-08-10 21:36:04 +00001400config_mak="config-host.mak"
1401config_h="config-host.h"
1402
bellard7c1f25b2004-04-22 00:02:08 +00001403#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001404
ths15d9ca02007-07-31 23:07:32 +00001405test -f $config_h && mv $config_h ${config_h}~
1406
bellard97a847b2003-08-10 21:36:04 +00001407echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001408printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001409printf " '%s'" "$0" "$@" >> $config_mak
1410echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001411echo "/* Automatically generated by configure - do not modify */" > $config_h
1412
1413echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001414echo "bindir=\${prefix}$binsuffix" >> $config_mak
1415echo "mandir=\${prefix}$mansuffix" >> $config_mak
1416echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001417echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001418echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001419echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001420echo "INSTALL=$install" >> $config_mak
aliguori58f8aea2009-04-18 15:36:02 +00001421echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1422echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1423echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001424echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001425echo "HOST_CC=$host_cc" >> $config_mak
1426echo "AR=$ar" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001427# XXX: only use CFLAGS and LDFLAGS ?
1428# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1429# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001430echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001431echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1432echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1433echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001434echo "CFLAGS=$CFLAGS" >> $config_mak
1435echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001436echo "EXESUF=$EXESUF" >> $config_mak
aliguorie5d355d2009-04-24 18:03:15 +00001437echo "PTHREADLIBS=$PTHREADLIBS" >> $config_mak
1438echo "CLOCKLIBS=$CLOCKLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001439case "$cpu" in
1440 i386)
1441 echo "ARCH=i386" >> $config_mak
1442 echo "#define HOST_I386 1" >> $config_h
1443 ;;
1444 x86_64)
1445 echo "ARCH=x86_64" >> $config_mak
1446 echo "#define HOST_X86_64 1" >> $config_h
1447 ;;
1448 alpha)
1449 echo "ARCH=alpha" >> $config_mak
1450 echo "#define HOST_ALPHA 1" >> $config_h
1451 ;;
1452 armv4b)
1453 echo "ARCH=arm" >> $config_mak
1454 echo "#define HOST_ARM 1" >> $config_h
1455 ;;
1456 armv4l)
1457 echo "ARCH=arm" >> $config_mak
1458 echo "#define HOST_ARM 1" >> $config_h
1459 ;;
1460 cris)
1461 echo "ARCH=cris" >> $config_mak
1462 echo "#define HOST_CRIS 1" >> $config_h
1463 ;;
1464 hppa)
1465 echo "ARCH=hppa" >> $config_mak
1466 echo "#define HOST_HPPA 1" >> $config_h
1467 ;;
1468 ia64)
1469 echo "ARCH=ia64" >> $config_mak
1470 echo "#define HOST_IA64 1" >> $config_h
1471 ;;
1472 m68k)
1473 echo "ARCH=m68k" >> $config_mak
1474 echo "#define HOST_M68K 1" >> $config_h
1475 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001476 microblaze)
1477 echo "ARCH=microblaze" >> $config_mak
1478 echo "#define HOST_MICROBLAZE 1" >> $config_h
1479 ;;
aurel322408a522008-04-20 20:19:44 +00001480 mips)
1481 echo "ARCH=mips" >> $config_mak
1482 echo "#define HOST_MIPS 1" >> $config_h
1483 ;;
1484 mips64)
1485 echo "ARCH=mips64" >> $config_mak
1486 echo "#define HOST_MIPS64 1" >> $config_h
1487 ;;
malcfdf7ed92009-01-14 18:39:52 +00001488 ppc)
1489 echo "ARCH=ppc" >> $config_mak
1490 echo "#define HOST_PPC 1" >> $config_h
1491 ;;
1492 ppc64)
1493 echo "ARCH=ppc64" >> $config_mak
1494 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001495 ;;
1496 s390)
1497 echo "ARCH=s390" >> $config_mak
1498 echo "#define HOST_S390 1" >> $config_h
1499 ;;
1500 sparc)
1501 echo "ARCH=sparc" >> $config_mak
1502 echo "#define HOST_SPARC 1" >> $config_h
1503 ;;
1504 sparc64)
1505 echo "ARCH=sparc64" >> $config_mak
1506 echo "#define HOST_SPARC64 1" >> $config_h
1507 ;;
1508 *)
1509 echo "Unsupported CPU = $cpu"
1510 exit 1
1511 ;;
1512esac
aurel32f8393942009-04-13 18:45:38 +00001513if test "$debug_tcg" = "yes" ; then
1514 echo "#define DEBUG_TCG 1" >> $config_h
1515fi
Paul Brookf3d08ee2009-06-04 11:39:04 +01001516if test "$debug" = "yes" ; then
1517 echo "#define DEBUG_EXEC 1" >> $config_h
1518fi
aliguori03b4fe72008-10-07 19:16:17 +00001519if test "$sparse" = "yes" ; then
1520 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1521 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1522 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1523fi
aliguori1625af82009-04-05 17:41:02 +00001524if test "$strip_opt" = "yes" ; then
1525 echo "STRIP_OPT=-s" >> $config_mak
1526fi
bellard7d132992003-03-06 23:23:54 +00001527if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001528 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1529 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1530fi
bellardb6853692005-06-05 17:10:39 +00001531echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001532if test "$mingw32" = "yes" ; then
1533 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001534 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001535else
1536 cat > $TMPC << EOF
1537#include <byteswap.h>
1538int main(void) { return bswap_32(0); }
1539EOF
aurel32178baee2008-12-08 18:11:57 +00001540 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001541 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1542 fi
blueswir113606772008-12-05 17:54:09 +00001543 cat > $TMPC << EOF
1544#include <sys/endian.h>
1545#include <sys/types.h>
1546#include <machine/bswap.h>
1547int main(void) { return bswap32(0); }
1548EOF
aurel32178baee2008-12-08 18:11:57 +00001549 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001550 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1551 fi
bellard67b915a2004-03-31 23:37:16 +00001552fi
blueswir1128ab2f2008-08-15 18:33:42 +00001553
1554if [ "$openbsd" = "yes" ] ; then
1555 echo "#define ENOTSUP 4096" >> $config_h
1556fi
1557
bellard83fb7ad2004-07-05 21:25:26 +00001558if test "$darwin" = "yes" ; then
1559 echo "CONFIG_DARWIN=yes" >> $config_mak
1560 echo "#define CONFIG_DARWIN 1" >> $config_h
1561fi
malcb29fe3e2008-11-18 01:42:22 +00001562
1563if test "$aix" = "yes" ; then
1564 echo "CONFIG_AIX=yes" >> $config_mak
1565 echo "#define CONFIG_AIX 1" >> $config_h
1566fi
1567
bellardec530c82006-04-25 22:36:06 +00001568if test "$solaris" = "yes" ; then
1569 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001570 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001571 if test "$needs_libsunmath" = "yes" ; then
1572 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1573 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1574 fi
bellardec530c82006-04-25 22:36:06 +00001575fi
blueswir131422552007-04-16 18:27:06 +00001576if test -n "$sparc_cpu"; then
1577 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1578 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1579fi
bellard97a847b2003-08-10 21:36:04 +00001580if test "$gprof" = "yes" ; then
1581 echo "TARGET_GPROF=yes" >> $config_mak
1582 echo "#define HAVE_GPROF 1" >> $config_h
1583fi
1584if test "$static" = "yes" ; then
1585 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001586 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001587fi
bellard05c2a3e2006-02-08 22:39:17 +00001588if test $profiler = "yes" ; then
1589 echo "#define CONFIG_PROFILER 1" >> $config_h
1590fi
bellardc20709a2004-04-21 23:27:19 +00001591if test "$slirp" = "yes" ; then
1592 echo "CONFIG_SLIRP=yes" >> $config_mak
1593 echo "#define CONFIG_SLIRP 1" >> $config_h
1594fi
ths8a16d272008-07-19 09:56:24 +00001595if test "$vde" = "yes" ; then
1596 echo "CONFIG_VDE=yes" >> $config_mak
1597 echo "#define CONFIG_VDE 1" >> $config_h
1598 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1599fi
malc0c58ac12008-06-25 21:04:05 +00001600for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001601 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001602 echo "$def=yes" >> $config_mak
1603 echo "#define $def 1" >> $config_h
1604done
1605echo "#define AUDIO_DRIVERS \\" >> $config_h
1606for drv in $audio_drv_list; do
1607 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001608 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001609 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001610 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001611 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1612 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001613 elif test "$drv" = "oss"; then
1614 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001615 fi
1616done
1617echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001618if test "$mixemu" = "yes" ; then
1619 echo "CONFIG_MIXEMU=yes" >> $config_mak
1620 echo "#define CONFIG_MIXEMU 1" >> $config_h
1621fi
ths8d5d2d42007-08-25 01:37:51 +00001622if test "$vnc_tls" = "yes" ; then
1623 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1624 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1625 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1626 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1627fi
aliguori2f9606b2009-03-06 20:27:28 +00001628if test "$vnc_sasl" = "yes" ; then
1629 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1630 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1631 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1632 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1633fi
aliguori76655d62009-03-06 20:27:37 +00001634if test "$fnmatch" = "yes" ; then
1635 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1636fi
pbrookb1a550a2006-04-16 13:28:56 +00001637qemu_version=`head $source_path/VERSION`
1638echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001639echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001640
pbrook4a19f1e2009-04-07 23:17:49 +00001641echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1642
bellard97a847b2003-08-10 21:36:04 +00001643echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001644if [ "$source_path_used" = "yes" ]; then
1645 echo "VPATH=$source_path" >> $config_mak
1646fi
bellard97a847b2003-08-10 21:36:04 +00001647echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001648if [ "$build_docs" = "yes" ] ; then
1649 echo "BUILD_DOCS=yes" >> $config_mak
1650fi
bellard49ecc3f2007-11-07 19:25:15 +00001651if test "$static" = "yes"; then
1652 sdl1=$sdl_static
1653else
1654 sdl1=$sdl
1655fi
1656if test "$sdl1" = "yes" ; then
1657 echo "#define CONFIG_SDL 1" >> $config_h
1658 echo "CONFIG_SDL=yes" >> $config_mak
1659 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1660 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001661 elif test "$sdl_x11" = "yes" ; then
1662 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001663 else
1664 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1665 fi
1666 if [ "${aa}" = "yes" ] ; then
1667 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1668 else
1669 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1670 fi
1671fi
1672if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001673 echo "#define CONFIG_COCOA 1" >> $config_h
1674 echo "CONFIG_COCOA=yes" >> $config_mak
1675fi
1676if test "$curses" = "yes" ; then
1677 echo "#define CONFIG_CURSES 1" >> $config_h
1678 echo "CONFIG_CURSES=yes" >> $config_mak
1679 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001680fi
aurel323b3f24a2009-04-15 16:12:13 +00001681if test "$atfile" = "yes" ; then
1682 echo "#define CONFIG_ATFILE 1" >> $config_h
1683fi
1684if test "$inotify" = "yes" ; then
1685 echo "#define CONFIG_INOTIFY 1" >> $config_h
1686fi
Alexander Graf769ce762009-05-11 17:41:42 +02001687if test "$curl" = "yes" ; then
1688 echo "CONFIG_CURL=yes" >> $config_mak
1689 echo "CURL_LIBS=$curl_libs" >> $config_mak
1690 echo "#define CONFIG_CURL 1" >> $config_h
1691fi
aurel322e4d9fb2008-04-08 06:01:02 +00001692if test "$brlapi" = "yes" ; then
1693 echo "CONFIG_BRLAPI=yes" >> $config_mak
1694 echo "#define CONFIG_BRLAPI 1" >> $config_h
1695 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1696fi
balrogfb599c92008-09-28 23:49:55 +00001697if test "$bluez" = "yes" ; then
1698 echo "CONFIG_BLUEZ=yes" >> $config_mak
1699 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1700 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1701 echo "#define CONFIG_BLUEZ 1" >> $config_h
1702fi
aliguorie37630c2009-04-22 15:19:10 +00001703if test "$xen" = "yes" ; then
aliguori9306acb2009-04-22 15:19:44 +00001704 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
aliguorie37630c2009-04-22 15:19:10 +00001705fi
blueswir1414f0da2008-08-15 18:20:52 +00001706if test "$aio" = "yes" ; then
1707 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001708 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001709fi
aliguorie5d355d2009-04-24 18:03:15 +00001710if test "$io_thread" = "yes" ; then
1711 echo "CONFIG_IOTHREAD=yes" >> $config_mak
1712 echo "#define CONFIG_IOTHREAD 1" >> $config_h
1713fi
ths77755342008-11-27 15:45:16 +00001714if test "$blobs" = "yes" ; then
1715 echo "INSTALL_BLOBS=yes" >> $config_mak
1716fi
aliguoribf9298b2008-12-05 20:05:26 +00001717if test "$iovec" = "yes" ; then
1718 echo "#define HAVE_IOVEC 1" >> $config_h
1719fi
aliguoriceb42de2009-04-07 18:43:28 +00001720if test "$preadv" = "yes" ; then
1721 echo "#define HAVE_PREADV 1" >> $config_h
1722fi
aurel32f652e6a2008-12-16 10:43:48 +00001723if test "$fdt" = "yes" ; then
1724 echo "#define HAVE_FDT 1" >> $config_h
1725 echo "FDT_LIBS=-lfdt" >> $config_mak
1726fi
bellard97a847b2003-08-10 21:36:04 +00001727
bellard83fb7ad2004-07-05 21:25:26 +00001728# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001729if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001730 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001731 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001732 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001733fi
1734
pbrookc5937222006-05-14 11:30:38 +00001735echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1736
blueswir168063642008-11-22 21:03:55 +00001737# USB host support
1738case "$usb" in
1739linux)
1740 echo "HOST_USB=linux" >> $config_mak
1741;;
1742bsd)
1743 echo "HOST_USB=bsd" >> $config_mak
1744;;
1745*)
1746 echo "HOST_USB=stub" >> $config_mak
1747;;
1748esac
1749
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001750# Determine what linker flags to use to force archive inclusion
1751check_linker_flags()
1752{
1753 $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 -Wl,$2 >/dev/null 2>/dev/null
1754}
1755
1756cat > $TMPC << EOF
1757int main(void) { }
1758EOF
1759if check_linker_flags --whole-archive --no-whole-archive ; then
1760 # GNU ld
1761 echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_mak
1762 echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_mak
1763elif check_linker_flags -z,allextract -z,defaultextract ; then
1764 # Solaris ld
1765 echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_mak
1766 echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_mak
1767else
1768 echo "Error: your linker does not support --whole-archive or -z."
1769 echo "Please report to qemu-devel@nongnu.org"
1770 exit 1
1771fi
1772
Blue Swirl2567f572009-05-21 15:54:48 +00001773if test "$xen" = "yes" ;
1774 then
1775 echo "CONFIG_XEN=yes" >> $config_mak
1776fi
1777
pbrookc39e3332007-09-22 16:49:14 +00001778tools=
1779if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001780 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001781 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001782 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001783 fi
pbrookc39e3332007-09-22 16:49:14 +00001784fi
1785echo "TOOLS=$tools" >> $config_mak
1786
Paul Brook370ab982009-05-26 15:07:56 +01001787if test -f ${config_h}~ ; then
1788 if cmp -s $config_h ${config_h}~ ; then
1789 mv ${config_h}~ $config_h
1790 else
1791 rm ${config_h}~
1792 fi
1793fi
1794
Paul Brook1ad21342009-05-19 16:17:58 +01001795config_host_mak=${config_mak}
ths15d9ca02007-07-31 23:07:32 +00001796
bellard1d14ffa2005-10-30 18:58:22 +00001797for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001798target_dir="$target"
1799config_mak=$target_dir/config.mak
1800config_h=$target_dir/config.h
1801target_cpu=`echo $target | cut -d '-' -f 1`
1802target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001803[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001804[ "$target_cpu" = "m68k" ] && target_bigendian=yes
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001805[ "$target_cpu" = "microblaze" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001806[ "$target_cpu" = "mips" ] && target_bigendian=yes
1807[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1808[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001809[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001810[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001811[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001812[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001813[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001814[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1815[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1816[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001817target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001818target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001819target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001820target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001821target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001822case "$target" in
1823 ${target_cpu}-softmmu)
1824 target_softmmu="yes"
1825 ;;
1826 ${target_cpu}-linux-user)
1827 target_user_only="yes"
1828 target_linux_user="yes"
1829 ;;
1830 ${target_cpu}-darwin-user)
1831 target_user_only="yes"
1832 target_darwin_user="yes"
1833 ;;
blueswir184778502008-10-26 20:33:16 +00001834 ${target_cpu}-bsd-user)
1835 target_user_only="yes"
1836 target_bsd_user="yes"
1837 ;;
pbrook9e407a82007-05-26 16:38:53 +00001838 *)
1839 echo "ERROR: Target '$target' not recognised"
1840 exit 1
1841 ;;
1842esac
ths831b7822007-01-18 20:06:33 +00001843
bellard7c1f25b2004-04-22 00:02:08 +00001844#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001845
ths15d9ca02007-07-31 23:07:32 +00001846test -f $config_h && mv $config_h ${config_h}~
1847
bellard97a847b2003-08-10 21:36:04 +00001848mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001849mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001850mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001851if 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 +00001852 mkdir -p $target_dir/nwfpe
1853fi
1854
bellardec530c82006-04-25 22:36:06 +00001855#
1856# don't use ln -sf as not all "ln -sf" over write the file/link
1857#
1858rm -f $target_dir/Makefile
1859ln -s $source_path/Makefile.target $target_dir/Makefile
1860
bellard97a847b2003-08-10 21:36:04 +00001861
1862echo "# Automatically generated by configure - do not modify" > $config_mak
1863echo "/* Automatically generated by configure - do not modify */" > $config_h
1864
1865
1866echo "include ../config-host.mak" >> $config_mak
1867echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001868
pbrooke5fe0c52006-06-11 13:32:59 +00001869bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001870elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001871target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001872interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1873echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001874gdb_xml_files=""
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001875target_kvm="$kvm"
bellard97a847b2003-08-10 21:36:04 +00001876
aliguori5985ece2008-11-05 19:59:25 +00001877# Make sure the target and host cpus are compatible
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001878if test ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001879 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001880 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1881 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001882 target_kvm="no"
aliguori7ba1e612008-11-05 16:04:33 +00001883fi
1884# Disable KVM for linux-user
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001885if test "$target_softmmu" = "no" ; then
1886 target_kvm="no"
aliguori7ba1e612008-11-05 16:04:33 +00001887fi
1888
aurel322408a522008-04-20 20:19:44 +00001889case "$target_cpu" in
1890 i386)
1891 echo "TARGET_ARCH=i386" >> $config_mak
1892 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1893 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001894 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001895 then
blueswir12d6ebb02009-04-18 19:25:43 +00001896 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001897 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001898 fi
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001899 if test "$target_kvm" = "yes" ; then
aliguori7ba1e612008-11-05 16:04:33 +00001900 echo "CONFIG_KVM=yes" >> $config_mak
1901 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001902 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001903 fi
aliguorie37630c2009-04-22 15:19:10 +00001904 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1905 then
1906 echo "CONFIG_XEN=yes" >> $config_mak
1907 echo "#define CONFIG_XEN 1" >> $config_h
1908 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001909 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001910 ;;
1911 x86_64)
1912 echo "TARGET_ARCH=x86_64" >> $config_mak
1913 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1914 echo "#define TARGET_I386 1" >> $config_h
1915 echo "#define TARGET_X86_64 1" >> $config_h
1916 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1917 then
blueswir12d6ebb02009-04-18 19:25:43 +00001918 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001919 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001920 fi
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00001921 if test "$target_kvm" = "yes" ; then
aliguori7ba1e612008-11-05 16:04:33 +00001922 echo "CONFIG_KVM=yes" >> $config_mak
1923 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1924 echo "#define CONFIG_KVM 1" >> $config_h
1925 fi
aliguorie37630c2009-04-22 15:19:10 +00001926 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1927 then
1928 echo "CONFIG_XEN=yes" >> $config_mak
1929 echo "#define CONFIG_XEN 1" >> $config_h
1930 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001931 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001932 ;;
1933 alpha)
1934 echo "TARGET_ARCH=alpha" >> $config_mak
1935 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1936 echo "#define TARGET_ALPHA 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001937 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001938 ;;
1939 arm|armeb)
1940 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001941 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1942 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001943 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001944 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001945 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001946 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001947 ;;
1948 cris)
1949 echo "TARGET_ARCH=cris" >> $config_mak
1950 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1951 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001952 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001953 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001954 ;;
1955 m68k)
1956 echo "TARGET_ARCH=m68k" >> $config_mak
1957 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1958 echo "#define TARGET_M68K 1" >> $config_h
1959 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001960 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001961 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001962 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001963 microblaze)
1964 echo "TARGET_ARCH=microblaze" >> $config_mak
1965 echo "#define TARGET_ARCH \"microblaze\"" >> $config_h
1966 echo "#define TARGET_MICROBLAZE 1" >> $config_h
1967 bflt="yes"
1968 target_nptl="yes"
1969 target_phys_bits=32
1970 ;;
1971 mips|mipsel)
aurel322408a522008-04-20 20:19:44 +00001972 echo "TARGET_ARCH=mips" >> $config_mak
1973 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1974 echo "#define TARGET_MIPS 1" >> $config_h
1975 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001976 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001977 ;;
1978 mipsn32|mipsn32el)
1979 echo "TARGET_ARCH=mipsn32" >> $config_mak
1980 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1981 echo "#define TARGET_MIPS 1" >> $config_h
1982 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001983 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001984 ;;
1985 mips64|mips64el)
1986 echo "TARGET_ARCH=mips64" >> $config_mak
1987 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1988 echo "#define TARGET_MIPS 1" >> $config_h
1989 echo "#define TARGET_MIPS64 1" >> $config_h
1990 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001991 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001992 ;;
1993 ppc)
1994 echo "TARGET_ARCH=ppc" >> $config_mak
1995 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1996 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001997 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001998 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001999 ;;
2000 ppcemb)
2001 echo "TARGET_ARCH=ppcemb" >> $config_mak
2002 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2003 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
2004 echo "#define TARGET_PPC 1" >> $config_h
2005 echo "#define TARGET_PPCEMB 1" >> $config_h
Blue Swirl4ca1a9c2009-06-07 13:29:26 +00002006 if test "$target_kvm" = "yes" ; then
aurel32d76d1652008-12-16 10:43:58 +00002007 echo "CONFIG_KVM=yes" >> $config_mak
2008 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2009 echo "#define CONFIG_KVM 1" >> $config_h
2010 fi
aurel32c8b35322009-01-24 15:07:34 +00002011 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002012 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002013 ;;
2014 ppc64)
2015 echo "TARGET_ARCH=ppc64" >> $config_mak
2016 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2017 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2018 echo "#define TARGET_PPC 1" >> $config_h
2019 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00002020 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002021 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002022 ;;
2023 ppc64abi32)
2024 echo "TARGET_ARCH=ppc64" >> $config_mak
2025 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2026 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
2027 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2028 echo "#define TARGET_PPC 1" >> $config_h
2029 echo "#define TARGET_PPC64 1" >> $config_h
2030 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00002031 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002032 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002033 ;;
2034 sh4|sh4eb)
2035 echo "TARGET_ARCH=sh4" >> $config_mak
2036 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
2037 echo "#define TARGET_SH4 1" >> $config_h
2038 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00002039 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002040 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002041 ;;
2042 sparc)
2043 echo "TARGET_ARCH=sparc" >> $config_mak
2044 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
2045 echo "#define TARGET_SPARC 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002046 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002047 ;;
2048 sparc64)
2049 echo "TARGET_ARCH=sparc64" >> $config_mak
2050 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2051 echo "#define TARGET_SPARC 1" >> $config_h
2052 echo "#define TARGET_SPARC64 1" >> $config_h
2053 elfload32="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002054 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002055 ;;
2056 sparc32plus)
2057 echo "TARGET_ARCH=sparc64" >> $config_mak
2058 echo "TARGET_ABI_DIR=sparc" >> $config_mak
2059 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
2060 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2061 echo "#define TARGET_SPARC 1" >> $config_h
2062 echo "#define TARGET_SPARC64 1" >> $config_h
2063 echo "#define TARGET_ABI32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002064 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002065 ;;
2066 *)
2067 echo "Unsupported target CPU"
2068 exit 1
2069 ;;
2070esac
Paul Brook1ad21342009-05-19 16:17:58 +01002071if [ $target_phys_bits -lt $hostlongbits ] ; then
2072 target_phys_bits=$hostlongbits
2073fi
2074echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
2075echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h
2076echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00002077if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00002078 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2079 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2080fi
2081if test "$target_softmmu" = "yes" ; then
2082 echo "CONFIG_SOFTMMU=yes" >> $config_mak
2083 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00002084fi
bellard997344f2003-10-27 21:10:39 +00002085if test "$target_user_only" = "yes" ; then
2086 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2087 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2088fi
ths831b7822007-01-18 20:06:33 +00002089if test "$target_linux_user" = "yes" ; then
2090 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2091 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2092fi
2093if test "$target_darwin_user" = "yes" ; then
2094 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2095 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2096fi
pbrook56aebc82008-10-11 17:55:29 +00002097list=""
2098if test ! -z "$gdb_xml_files" ; then
2099 for x in $gdb_xml_files; do
2100 list="$list $source_path/gdb-xml/$x"
2101 done
2102fi
2103echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00002104
aurel320938cda2008-04-11 21:36:06 +00002105if test "$target_cpu" = "arm" \
2106 -o "$target_cpu" = "armeb" \
2107 -o "$target_cpu" = "m68k" \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02002108 -o "$target_cpu" = "microblaze" \
aurel320938cda2008-04-11 21:36:06 +00002109 -o "$target_cpu" = "mips" \
2110 -o "$target_cpu" = "mipsel" \
2111 -o "$target_cpu" = "mipsn32" \
2112 -o "$target_cpu" = "mipsn32el" \
2113 -o "$target_cpu" = "mips64" \
2114 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00002115 -o "$target_cpu" = "ppc" \
2116 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00002117 -o "$target_cpu" = "ppc64abi32" \
2118 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00002119 -o "$target_cpu" = "sparc" \
2120 -o "$target_cpu" = "sparc64" \
2121 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00002122 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2123 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2124fi
pbrooke5fe0c52006-06-11 13:32:59 +00002125if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2126 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2127 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2128fi
pbrookbd0c5662008-05-29 14:34:11 +00002129if test "$target_user_only" = "yes" \
2130 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2131 echo "#define USE_NPTL 1" >> $config_h
2132fi
blueswir1cb33da52007-10-09 16:34:29 +00002133# 32 bit ELF loader in addition to native 64 bit loader?
2134if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2135 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2136 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2137fi
blueswir184778502008-10-26 20:33:16 +00002138if test "$target_bsd_user" = "yes" ; then
2139 echo "CONFIG_BSD_USER=yes" >> $config_mak
2140 echo "#define CONFIG_BSD_USER 1" >> $config_h
2141fi
bellard5b0753e2005-03-01 21:37:28 +00002142
ths15d9ca02007-07-31 23:07:32 +00002143test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2144
bellard97a847b2003-08-10 21:36:04 +00002145done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00002146
2147# build tree in object directory if source path is different from current one
2148if test "$source_path_used" = "yes" ; then
Anthony Liguori019d6b82009-05-09 17:14:19 -05002149 DIRS="tests tests/cris slirp audio block"
bellard7d132992003-03-06 23:23:54 +00002150 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00002151 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00002152 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00002153 for dir in $DIRS ; do
2154 mkdir -p $dir
2155 done
bellardec530c82006-04-25 22:36:06 +00002156 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00002157 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00002158 rm -f $f
2159 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00002160 done
2161fi
Paul Brook1ad21342009-05-19 16:17:58 +01002162
2163for hwlib in 32 64; do
2164 d=libhw$hwlib
2165 mkdir -p $d
2166 rm -f $d/Makefile
2167 ln -s $source_path/Makefile.hw $d/Makefile
2168 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2169 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2170done