blob: bcf9297d29622fe19ad086578fb57a4f80692f5f [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}"
bellard7d132992003-03-06 23:23:54 +000017
Juan Quintela9784cde2009-08-03 14:46:04 +020018trap "rm -f $TMPC $TMPO $TMPE ; exit" 0 2 3 15
malc9ac81bb2008-11-29 20:09:56 +000019
Juan Quintela52166aa2009-08-03 14:46:03 +020020compile_object() {
21 $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
22}
23
24compile_prog() {
25 local_cflags="$1"
26 local_ldflags="$2"
27 $cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null
28}
29
bellard7d132992003-03-06 23:23:54 +000030# default parameters
Juan Quintela2ff6b912009-08-03 14:45:55 +020031cpu=""
bellard11d9f692004-04-02 20:55:59 +000032prefix=""
bellard1e43adf2003-09-30 20:54:24 +000033interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000034static="no"
bellard7d132992003-03-06 23:23:54 +000035cross_prefix=""
36cc="gcc"
malc0c58ac12008-06-25 21:04:05 +000037audio_drv_list=""
malc4c9b53e2009-01-09 10:46:34 +000038audio_card_list="ac97 es1370 sb16"
39audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
bellard7d132992003-03-06 23:23:54 +000040host_cc="gcc"
41ar="ar"
42make="make"
pbrook6a882642006-04-17 13:57:12 +000043install="install"
Anthony Liguori7aa486f2009-07-11 08:48:29 -050044objcopy="objcopy"
45ld="ld"
aliguoriac0df512008-12-29 17:14:15 +000046
47# parse CC options first
48for opt do
49 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
50 case "$opt" in
51 --cross-prefix=*) cross_prefix="$optarg"
52 ;;
53 --cc=*) cc="$optarg"
54 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +020055 --cpu=*) cpu="$optarg"
56 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +020057 --extra-cflags=*) CFLAGS="$optarg $CFLAGS"
58 ;;
59 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
60 ;;
Juan Quintela50e7b1a2009-08-03 14:46:10 +020061 --sparc_cpu=*)
62 sparc_cpu="$optarg"
63 case $sparc_cpu in
64 v7|v8)
65 CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $CFLAGS"
66 LDFLAGS="-m32 $LDFLAGS"
67 cpu="sparc"
68 ;;
69 v8plus|v8plusa)
70 CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS"
71 LDFLAGS="-m32 $LDFLAGS"
72 cpu="sparc"
73 ;;
74 v9)
75 CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS"
76 LDFLAGS="-m64 $LDFLAGS"
77 cpu="sparc64"
78 ;;
79 *)
80 echo "undefined SPARC architecture. Exiting";
81 exit 1
82 ;;
83 esac
84 ;;
aliguoriac0df512008-12-29 17:14:15 +000085 esac
86done
87
88# OS specific
89# Using uname is really, really broken. Once we have the right set of checks
90# we can eliminate it's usage altogether
91
92cc="${cross_prefix}${cc}"
93ar="${cross_prefix}${ar}"
Anthony Liguori7aa486f2009-07-11 08:48:29 -050094objcopy="${cross_prefix}${objcopy}"
95ld="${cross_prefix}${ld}"
aliguoriac0df512008-12-29 17:14:15 +000096
97# check that the C compiler works.
98cat > $TMPC <<EOF
99int main(void) {}
100EOF
101
Juan Quintela52166aa2009-08-03 14:46:03 +0200102if compile_object ; then
aliguoriac0df512008-12-29 17:14:15 +0000103 : C compiler works ok
104else
105 echo "ERROR: \"$cc\" either does not exist or does not work"
106 exit 1
107fi
108
109check_define() {
110cat > $TMPC <<EOF
111#if !defined($1)
112#error Not defined
113#endif
114int main(void) { return 0; }
115EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200116 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000117}
118
Juan Quintela2ff6b912009-08-03 14:45:55 +0200119if test ! -z "$cpu" ; then
120 # command line argument
121 :
122elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000123 cpu="i386"
124elif check_define __x86_64__ ; then
125 cpu="x86_64"
blueswir13aa9bd62008-12-31 16:55:26 +0000126elif check_define __sparc__ ; then
127 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
128 # They must be specified using --sparc_cpu
129 if check_define __arch64__ ; then
130 cpu="sparc64"
131 else
132 cpu="sparc"
133 fi
malcfdf7ed92009-01-14 18:39:52 +0000134elif check_define _ARCH_PPC ; then
135 if check_define _ARCH_PPC64 ; then
136 cpu="ppc64"
137 else
138 cpu="ppc"
139 fi
aliguoriac0df512008-12-29 17:14:15 +0000140else
malcfdf7ed92009-01-14 18:39:52 +0000141 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +0000142fi
143
bellard5327cf42005-01-10 23:18:50 +0000144target_list=""
bellard7d132992003-03-06 23:23:54 +0000145case "$cpu" in
146 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000147 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000148 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000149 x86_64|amd64)
150 cpu="x86_64"
151 ;;
152 alpha)
153 cpu="alpha"
154 ;;
bellardba680552005-03-13 09:49:52 +0000155 armv*b)
bellard808c4952004-12-19 23:33:47 +0000156 cpu="armv4b"
157 ;;
bellardba680552005-03-13 09:49:52 +0000158 armv*l)
bellard7d132992003-03-06 23:23:54 +0000159 cpu="armv4l"
160 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000161 cris)
162 cpu="cris"
bellard7d132992003-03-06 23:23:54 +0000163 ;;
aurel32f54b3f92008-04-12 20:14:54 +0000164 parisc|parisc64)
165 cpu="hppa"
166 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000167 ia64)
168 cpu="ia64"
169 ;;
170 m68k)
171 cpu="m68k"
bellard7d132992003-03-06 23:23:54 +0000172 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200173 microblaze)
174 cpu="microblaze"
175 ;;
bellard7d132992003-03-06 23:23:54 +0000176 mips)
177 cpu="mips"
178 ;;
thsfbe4f652007-04-01 11:16:48 +0000179 mips64)
180 cpu="mips64"
181 ;;
malcfdf7ed92009-01-14 18:39:52 +0000182 ppc)
183 cpu="ppc"
184 ;;
185 ppc64)
186 cpu="ppc64"
thse7daa602007-10-08 13:38:27 +0000187 ;;
ths0e7b8a92007-08-01 00:09:31 +0000188 s390*)
bellardfb3e5842003-03-29 17:32:36 +0000189 cpu="s390"
190 ;;
blueswir131422552007-04-16 18:27:06 +0000191 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000192 cpu="sparc"
193 ;;
194 sparc64)
195 cpu="sparc64"
196 ;;
bellard7d132992003-03-06 23:23:54 +0000197 *)
198 cpu="unknown"
199 ;;
200esac
Juan Quintelaeb822842009-07-27 16:13:18 +0200201brlapi="yes"
bellard7d132992003-03-06 23:23:54 +0000202gprof="no"
aurel32f8393942009-04-13 18:45:38 +0000203debug_tcg="no"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100204debug="no"
aliguori03b4fe72008-10-07 19:16:17 +0000205sparse="no"
aliguori1625af82009-04-05 17:41:02 +0000206strip_opt="yes"
bellard7d132992003-03-06 23:23:54 +0000207bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000208mingw32="no"
209EXESUF=""
bellard443f1372004-06-04 11:13:20 +0000210slirp="yes"
aliguorie0e6c8c02008-07-23 18:14:33 +0000211vde="yes"
bellard102a52e2004-11-14 19:57:29 +0000212fmod_lib=""
213fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000214oss_lib=""
ths8d5d2d42007-08-25 01:37:51 +0000215vnc_tls="yes"
aliguori2f9606b2009-03-06 20:27:28 +0000216vnc_sasl="yes"
pbrookb1a550a2006-04-16 13:28:56 +0000217bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000218linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000219solaris="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000220kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000221profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000222cocoa="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000223softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000224linux_user="no"
225darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000226bsd_user="no"
Paul Brook379f6692009-07-17 12:48:08 +0100227guest_base=""
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500228build_docs="yes"
pbrookc5937222006-05-14 11:30:38 +0000229uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000230curses="yes"
Alexander Graf769ce762009-05-11 17:41:42 +0200231curl="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000232pthread="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000233aio="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000234io_thread="no"
pbrookbd0c5662008-05-29 14:34:11 +0000235nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000236mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000237bluez="yes"
Jan Kiszkadff840342009-06-14 20:05:02 +0200238kvm="no"
aliguorieac30262008-11-05 16:28:56 +0000239kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000240aix="no"
ths77755342008-11-27 15:45:16 +0000241blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000242fdt="yes"
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500243sdl="yes"
aliguorie37630c2009-04-22 15:19:10 +0000244xen="yes"
pbrook4a19f1e2009-04-07 23:17:49 +0000245pkgversion=""
bellard7d132992003-03-06 23:23:54 +0000246
247# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000248if check_define __linux__ ; then
249 targetos="Linux"
250elif check_define _WIN32 ; then
251 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000252elif check_define __OpenBSD__ ; then
253 targetos='OpenBSD'
254elif check_define __sun__ ; then
255 targetos='SunOS'
aliguoriac0df512008-12-29 17:14:15 +0000256else
257 targetos=`uname -s`
258fi
bellard7d132992003-03-06 23:23:54 +0000259case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000260CYGWIN*)
261mingw32="yes"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200262CFLAGS="-mno-cygwin $CFLAGS"
malcc2de5c92008-06-28 19:13:06 +0000263audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000264;;
bellard67b915a2004-03-31 23:37:16 +0000265MINGW32*)
266mingw32="yes"
malcc2de5c92008-06-28 19:13:06 +0000267audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000268;;
ths5c40d2b2007-06-23 16:03:36 +0000269GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000270audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000271audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000272if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
273 kqemu="yes"
274fi
275;;
bellard7d3505c2004-05-12 19:32:15 +0000276FreeBSD)
277bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000278audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000279audio_possible_drivers="oss sdl esd pa"
bellarde99f9062005-07-28 21:45:38 +0000280if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000281 kqemu="yes"
282fi
bellard7d3505c2004-05-12 19:32:15 +0000283;;
blueswir1c5e97232009-03-07 20:06:23 +0000284DragonFly)
285bsd="yes"
286audio_drv_list="oss"
287audio_possible_drivers="oss sdl esd pa"
288if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
289 kqemu="yes"
290fi
291aio="no"
292;;
bellard7d3505c2004-05-12 19:32:15 +0000293NetBSD)
294bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000295audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000296audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000297oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000298;;
299OpenBSD)
300bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000301audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000302audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000303oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000304;;
bellard83fb7ad2004-07-05 21:25:26 +0000305Darwin)
306bsd="yes"
307darwin="yes"
aliguori1b0f9cc2009-01-26 15:37:40 +0000308# 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 +0000309if [ "$cpu" = "i386" ] ; then
310 is_x86_64=`sysctl -n hw.optional.x86_64`
311 [ "$is_x86_64" = "1" ] && cpu=x86_64
aliguori1b0f9cc2009-01-26 15:37:40 +0000312fi
313if [ "$cpu" = "x86_64" ] ; then
Juan Quintela0c439cb2009-08-03 14:46:01 +0200314 CFLAGS="-arch x86_64 $CFLAGS"
315 LDFLAGS="-arch x86_64 $LDFLAGS"
aliguori1b0f9cc2009-01-26 15:37:40 +0000316else
Juan Quintela0c439cb2009-08-03 14:46:01 +0200317 CFLAGS="-mdynamic-no-pic $CFLAGS"
aliguori1b0f9cc2009-01-26 15:37:40 +0000318fi
ths831b7822007-01-18 20:06:33 +0000319darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000320cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000321audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000322audio_possible_drivers="coreaudio sdl fmod"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200323LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
bellard83fb7ad2004-07-05 21:25:26 +0000324;;
bellardec530c82006-04-25 22:36:06 +0000325SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000326 solaris="yes"
327 make="gmake"
328 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000329 needs_libsunmath="no"
thsc2b84fa2007-02-10 23:21:21 +0000330 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000331 # have to select again, because `uname -m` returns i86pc
332 # even on an x86_64 box.
333 solariscpu=`isainfo -k`
334 if test "${solariscpu}" = "amd64" ; then
335 cpu="x86_64"
336 fi
thsc2b84fa2007-02-10 23:21:21 +0000337 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000338 if test "$solarisrev" -le 9 ; then
339 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
340 needs_libsunmath="yes"
341 else
342 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
343 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
344 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
345 echo "Studio 11 can be downloaded from www.sun.com."
346 exit 1
347 fi
348 fi
349 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000350 kqemu="yes"
351 fi
ths86b2bd92007-02-11 00:31:33 +0000352 fi
ths6b4d2ba2007-05-13 18:02:43 +0000353 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000354 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000355 fi
malcc2de5c92008-06-28 19:13:06 +0000356 audio_possible_drivers="oss sdl"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200357 CFLAGS="-std=gnu99 $CFLAGS"
ths86b2bd92007-02-11 00:31:33 +0000358;;
malcb29fe3e2008-11-18 01:42:22 +0000359AIX)
360aix="yes"
361make="gmake"
362;;
bellard1d14ffa2005-10-30 18:58:22 +0000363*)
malc0c58ac12008-06-25 21:04:05 +0000364audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000365audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000366linux="yes"
ths831b7822007-01-18 20:06:33 +0000367linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000368usb="linux"
Jan Kiszkadff840342009-06-14 20:05:02 +0200369kvm="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000370if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000371 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000372 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000373fi
bellardfb065182004-11-09 23:09:44 +0000374;;
bellard7d132992003-03-06 23:23:54 +0000375esac
376
bellard7d3505c2004-05-12 19:32:15 +0000377if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000378 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000379 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000380 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000381 fi
blueswir184778502008-10-26 20:33:16 +0000382 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000383fi
384
Juan Quintela3457a3f2009-08-03 14:46:07 +0200385if test "$mingw32" = "yes" ; then
Juan Quintelafecde402009-08-03 14:46:09 +0200386 if [ "$cpu" = "i386" ] ; then
387 kqemu="yes"
388 fi
Juan Quintela3457a3f2009-08-03 14:46:07 +0200389 EXESUF=".exe"
Juan Quintela3457a3f2009-08-03 14:46:07 +0200390 CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $CFLAGS"
391fi
392
bellard7d132992003-03-06 23:23:54 +0000393# find source path
pbrookad064842006-04-16 12:41:07 +0000394source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000395source_path_used="no"
396workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000397if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000398 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000399else
400 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000401fi
pbrook724db112008-02-03 19:20:13 +0000402[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000403
Anthony Liguori487fefd2009-06-11 13:28:25 -0500404werror=""
bellard85aa5182007-11-11 20:17:03 +0000405
bellard7d132992003-03-06 23:23:54 +0000406for opt do
pbrooka46e4032006-04-29 23:05:22 +0000407 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000408 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000409 --help|-h) show_help=yes
410 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000411 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000412 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000413 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000414 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000415 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000416 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000417 ;;
aliguoriac0df512008-12-29 17:14:15 +0000418 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000419 ;;
aliguoriac0df512008-12-29 17:14:15 +0000420 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000421 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000422 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000423 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000424 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000425 ;;
pbrook6a882642006-04-17 13:57:12 +0000426 --install=*) install="$optarg"
427 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200428 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000429 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200430 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000431 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200432 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000433 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000434 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000435 ;;
bellard7d132992003-03-06 23:23:54 +0000436 --enable-gprof) gprof="yes"
437 ;;
bellard43ce4df2003-06-09 19:53:12 +0000438 --static) static="yes"
439 ;;
bellard97a847b2003-08-10 21:36:04 +0000440 --disable-sdl) sdl="no"
441 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000442 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000443 ;;
malcc2de5c92008-06-28 19:13:06 +0000444 --fmod-inc=*) fmod_inc="$optarg"
445 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000446 --oss-lib=*) oss_lib="$optarg"
447 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000448 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000449 ;;
450 --audio-drv-list=*) audio_drv_list="$optarg"
451 ;;
aurel32f8393942009-04-13 18:45:38 +0000452 --enable-debug-tcg) debug_tcg="yes"
453 ;;
454 --disable-debug-tcg) debug_tcg="no"
455 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100456 --enable-debug)
457 # Enable debugging options that aren't excessively noisy
458 debug_tcg="yes"
459 debug="yes"
460 strip_opt="no"
461 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000462 --enable-sparse) sparse="yes"
463 ;;
464 --disable-sparse) sparse="no"
465 ;;
aliguori1625af82009-04-05 17:41:02 +0000466 --disable-strip) strip_opt="no"
467 ;;
ths8d5d2d42007-08-25 01:37:51 +0000468 --disable-vnc-tls) vnc_tls="no"
469 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000470 --disable-vnc-sasl) vnc_sasl="no"
471 ;;
bellard443f1372004-06-04 11:13:20 +0000472 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000473 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000474 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000475 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000476 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000477 ;;
aliguorie37630c2009-04-22 15:19:10 +0000478 --disable-xen) xen="no"
479 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000480 --disable-brlapi) brlapi="no"
481 ;;
balrogfb599c92008-09-28 23:49:55 +0000482 --disable-bluez) bluez="no"
483 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000484 --disable-kvm) kvm="no"
485 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000486 --enable-profiler) profiler="yes"
487 ;;
malcc2de5c92008-06-28 19:13:06 +0000488 --enable-cocoa)
489 cocoa="yes" ;
490 sdl="no" ;
491 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000492 ;;
pbrookcad25d62006-03-19 16:31:11 +0000493 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000494 ;;
pbrookcad25d62006-03-19 16:31:11 +0000495 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000496 ;;
ths831b7822007-01-18 20:06:33 +0000497 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000498 ;;
ths831b7822007-01-18 20:06:33 +0000499 --enable-linux-user) linux_user="yes"
500 ;;
501 --disable-darwin-user) darwin_user="no"
502 ;;
503 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000504 ;;
blueswir184778502008-10-26 20:33:16 +0000505 --disable-bsd-user) bsd_user="no"
506 ;;
507 --enable-bsd-user) bsd_user="yes"
508 ;;
Paul Brook379f6692009-07-17 12:48:08 +0100509 --enable-guest-base) guest_base="yes"
510 ;;
511 --disable-guest-base) guest_base="no"
512 ;;
pbrookc5937222006-05-14 11:30:38 +0000513 --enable-uname-release=*) uname_release="$optarg"
514 ;;
blueswir131422552007-04-16 18:27:06 +0000515 --sparc_cpu=*)
blueswir131422552007-04-16 18:27:06 +0000516 ;;
bellard85aa5182007-11-11 20:17:03 +0000517 --enable-werror) werror="yes"
518 ;;
519 --disable-werror) werror="no"
520 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000521 --disable-curses) curses="no"
522 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200523 --disable-curl) curl="no"
524 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000525 --disable-nptl) nptl="no"
526 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000527 --enable-mixemu) mixemu="yes"
528 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000529 --disable-pthread) pthread="no"
530 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000531 --disable-aio) aio="no"
532 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000533 --enable-io-thread) io_thread="yes"
534 ;;
ths77755342008-11-27 15:45:16 +0000535 --disable-blobs) blobs="no"
536 ;;
aliguorieac30262008-11-05 16:28:56 +0000537 --kerneldir=*) kerneldir="$optarg"
538 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000539 --with-pkgversion=*) pkgversion=" ($optarg)"
540 ;;
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500541 --disable-docs) build_docs="no"
542 ;;
balrog7f1559c2007-11-17 10:24:32 +0000543 *) echo "ERROR: unknown option $opt"; show_help="yes"
544 ;;
bellard7d132992003-03-06 23:23:54 +0000545 esac
546done
547
blueswir131422552007-04-16 18:27:06 +0000548#
549# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
Juan Quintela0c439cb2009-08-03 14:46:01 +0200550# CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
blueswir131422552007-04-16 18:27:06 +0000551#
Paul Brook379f6692009-07-17 12:48:08 +0100552host_guest_base="no"
bellard40293e52008-01-31 11:32:10 +0000553case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000554 sparc) if test -z "$sparc_cpu" ; then
Juan Quintela0c439cb2009-08-03 14:46:01 +0200555 CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__ $CFLAGS"
556 LDFLAGS="-m32 $LDFLAGS"
blueswir131422552007-04-16 18:27:06 +0000557 fi
Juan Quintela0c439cb2009-08-03 14:46:01 +0200558 CFLAGS="-ffixed-g2 -ffixed-g3 $CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000559 if test "$solaris" = "no" ; then
Juan Quintela0c439cb2009-08-03 14:46:01 +0200560 CFLAGS="-ffixed-g1 -ffixed-g6 $CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000561 fi
blueswir131422552007-04-16 18:27:06 +0000562 ;;
563 sparc64) if test -z "$sparc_cpu" ; then
Juan Quintela0c439cb2009-08-03 14:46:01 +0200564 CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $CFLAGS"
565 LDFLAGS="-m64 $LDFLAGS"
blueswir131422552007-04-16 18:27:06 +0000566 fi
blueswir1762e8232009-04-04 09:21:28 +0000567 if test "$solaris" = "no" ; then
Juan Quintela0c439cb2009-08-03 14:46:01 +0200568 CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000569 else
Juan Quintela0c439cb2009-08-03 14:46:01 +0200570 CFLAGS="-ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7 $CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000571 fi
blueswir131422552007-04-16 18:27:06 +0000572 ;;
ths76d83bd2007-11-18 21:22:10 +0000573 s390)
Juan Quintela0c439cb2009-08-03 14:46:01 +0200574 CFLAGS="-march=z900 $CFLAGS"
ths76d83bd2007-11-18 21:22:10 +0000575 ;;
bellard40293e52008-01-31 11:32:10 +0000576 i386)
Juan Quintela0c439cb2009-08-03 14:46:01 +0200577 CFLAGS="-m32 $CFLAGS"
578 LDFLAGS="-m32 $LDFLAGS"
Paul Brook379f6692009-07-17 12:48:08 +0100579 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000580 ;;
581 x86_64)
Juan Quintela0c439cb2009-08-03 14:46:01 +0200582 CFLAGS="-m64 $CFLAGS"
583 LDFLAGS="-m64 $LDFLAGS"
Paul Brook379f6692009-07-17 12:48:08 +0100584 host_guest_base="yes"
585 ;;
586 arm*)
587 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000588 ;;
malcf6548c02009-07-18 10:08:40 +0400589 ppc*)
590 host_guest_base="yes"
591 ;;
blueswir131422552007-04-16 18:27:06 +0000592esac
593
Paul Brook379f6692009-07-17 12:48:08 +0100594[ -z "$guest_base" ] && guest_base="$host_guest_base"
595
pbrookaf5db582006-04-08 14:26:41 +0000596if test x"$show_help" = x"yes" ; then
597cat << EOF
598
599Usage: configure [options]
600Options: [defaults in brackets after descriptions]
601
602EOF
603echo "Standard options:"
604echo " --help print this message"
605echo " --prefix=PREFIX install in PREFIX [$prefix]"
606echo " --interp-prefix=PREFIX where to find shared libraries, etc."
607echo " use %M for cpu name [$interp_prefix]"
608echo " --target-list=LIST set target list [$target_list]"
609echo ""
610echo "kqemu kernel acceleration support:"
611echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000612echo ""
613echo "Advanced options (experts only):"
614echo " --source-path=PATH path of source code [$source_path]"
615echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
616echo " --cc=CC use C compiler CC [$cc]"
617echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
Jan Kiszkae3fc14c2009-06-30 21:29:03 +0200618echo " --extra-cflags=CFLAGS append extra C compiler flags CFLAGS"
619echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000620echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000621echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000622echo " --static enable static build [$static]"
aurel32f8393942009-04-13 18:45:38 +0000623echo " --enable-debug-tcg enable TCG debugging"
624echo " --disable-debug-tcg disable TCG debugging (default)"
Stefan Weil09695a42009-06-06 16:51:30 +0200625echo " --enable-debug enable common debug build options"
aliguori890b1652008-10-07 21:22:41 +0000626echo " --enable-sparse enable sparse checker"
627echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000628echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000629echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000630echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000631echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000632echo " --audio-drv-list=LIST set audio drivers list:"
633echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000634echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
635echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000636echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000637echo " --disable-xen disable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000638echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000639echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000640echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000641echo " --disable-curses disable curses output"
Alexander Graf769ce762009-05-11 17:41:42 +0200642echo " --disable-curl disable curl connectivity"
balrogfb599c92008-09-28 23:49:55 +0000643echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000644echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000645echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000646echo " --enable-system enable all system emulation targets"
647echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000648echo " --enable-linux-user enable all linux usermode emulation targets"
649echo " --disable-linux-user disable all linux usermode emulation targets"
650echo " --enable-darwin-user enable all darwin usermode emulation targets"
651echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000652echo " --enable-bsd-user enable all BSD usermode emulation targets"
653echo " --disable-bsd-user disable all BSD usermode emulation targets"
Paul Brook379f6692009-07-17 12:48:08 +0100654echo " --enable-guest-base enable GUEST_BASE support for usermode"
655echo " emulation targets"
656echo " --disable-guest-base disable GUEST_BASE support"
pbrookaf5db582006-04-08 14:26:41 +0000657echo " --fmod-lib path to FMOD library"
658echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000659echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000660echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000661echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000662echo " --disable-vde disable support for vde network"
aliguorie5d355d2009-04-24 18:03:15 +0000663echo " --disable-pthread disable pthread support"
blueswir1414f0da2008-08-15 18:20:52 +0000664echo " --disable-aio disable AIO support"
aliguorie5d355d2009-04-24 18:03:15 +0000665echo " --enable-io-thread enable IO thread"
ths77755342008-11-27 15:45:16 +0000666echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000667echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000668echo ""
ths5bf08932006-12-23 00:33:26 +0000669echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000670exit 1
671fi
672
aliguori03b4fe72008-10-07 19:16:17 +0000673if test ! -x "$(which cgcc 2>/dev/null)"; then
674 sparse="no"
675fi
676
bellardec530c82006-04-25 22:36:06 +0000677#
678# Solaris specific configure tool chain decisions
679#
680if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000681 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
682 if test -z "$solinst" ; then
683 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
684 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
685 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
686 exit 1
687 fi
688 if test "$solinst" = "/usr/sbin/install" ; then
689 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
690 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
691 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
692 exit 1
693 fi
bellardec530c82006-04-25 22:36:06 +0000694 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
695 if test -z "$sol_ar" ; then
696 echo "Error: No path includes ar"
697 if test -f /usr/ccs/bin/ar ; then
698 echo "Add /usr/ccs/bin to your path and rerun configure"
699 fi
700 exit 1
701 fi
ths5fafdf22007-09-16 21:08:06 +0000702fi
bellardec530c82006-04-25 22:36:06 +0000703
704
bellard5327cf42005-01-10 23:18:50 +0000705if test -z "$target_list" ; then
706# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000707 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000708 target_list="\
709i386-softmmu \
710x86_64-softmmu \
711arm-softmmu \
712cris-softmmu \
713m68k-softmmu \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200714microblaze-softmmu \
aurel322408a522008-04-20 20:19:44 +0000715mips-softmmu \
716mipsel-softmmu \
717mips64-softmmu \
718mips64el-softmmu \
719ppc-softmmu \
720ppcemb-softmmu \
721ppc64-softmmu \
722sh4-softmmu \
723sh4eb-softmmu \
724sparc-softmmu \
Igor V. Kovalenko1b64fca2009-06-23 18:04:16 +0000725sparc64-softmmu \
aurel322408a522008-04-20 20:19:44 +0000726"
pbrook0a8e90f2006-03-19 14:54:16 +0000727 fi
bellard5327cf42005-01-10 23:18:50 +0000728# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000729 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000730 target_list="${target_list}\
731i386-linux-user \
732x86_64-linux-user \
733alpha-linux-user \
734arm-linux-user \
735armeb-linux-user \
736cris-linux-user \
737m68k-linux-user \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200738microblaze-linux-user \
aurel322408a522008-04-20 20:19:44 +0000739mips-linux-user \
740mipsel-linux-user \
741ppc-linux-user \
742ppc64-linux-user \
743ppc64abi32-linux-user \
744sh4-linux-user \
745sh4eb-linux-user \
746sparc-linux-user \
747sparc64-linux-user \
748sparc32plus-linux-user \
749"
ths831b7822007-01-18 20:06:33 +0000750 fi
751# the following are Darwin specific
752 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000753 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000754 fi
blueswir184778502008-10-26 20:33:16 +0000755# the following are BSD specific
756 if [ "$bsd_user" = "yes" ] ; then
757 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000758i386-bsd-user \
759x86_64-bsd-user \
760sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000761sparc64-bsd-user \
762"
763 fi
bellard6e20a452005-06-05 15:56:02 +0000764else
pbrookb1a550a2006-04-16 13:28:56 +0000765 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000766fi
pbrook0a8e90f2006-03-19 14:54:16 +0000767if test -z "$target_list" ; then
768 echo "No targets enabled"
769 exit 1
770fi
bellard5327cf42005-01-10 23:18:50 +0000771
bellard7d132992003-03-06 23:23:54 +0000772if test -z "$cross_prefix" ; then
773
774# ---
775# big/little endian test
776cat > $TMPC << EOF
777#include <inttypes.h>
778int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000779 volatile uint32_t i=0x01234567;
780 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000781}
782EOF
783
Juan Quintela52166aa2009-08-03 14:46:03 +0200784if compile_prog "" "" ; then
bellard7d132992003-03-06 23:23:54 +0000785$TMPE && bigendian="yes"
786else
787echo big/little test failed
788fi
789
790else
791
792# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000793if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000794 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000795 -o "$cpu" = "m68k" \
796 -o "$cpu" = "mips" \
797 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000798 -o "$cpu" = "ppc" \
799 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000800 -o "$cpu" = "s390" \
801 -o "$cpu" = "sparc" \
802 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000803 bigendian="yes"
804fi
805
806fi
807
bellardb6853692005-06-05 17:10:39 +0000808# host long bits test
809hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000810if test "$cpu" = "x86_64" \
811 -o "$cpu" = "alpha" \
812 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000813 -o "$cpu" = "sparc64" \
814 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000815 hostlongbits="64"
816fi
817
pbrookbd0c5662008-05-29 14:34:11 +0000818# Check host NPTL support
819cat > $TMPC <<EOF
820#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000821#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000822void foo()
823{
824#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
825#error bork
826#endif
827}
828EOF
829
Juan Quintela52166aa2009-08-03 14:46:03 +0200830if compile_object ; then
pbrookbd0c5662008-05-29 14:34:11 +0000831 :
832else
833 nptl="no"
834fi
835
bellard11d9f692004-04-02 20:55:59 +0000836##########################################
balrogac629222008-10-11 09:56:04 +0000837# zlib check
838
839cat > $TMPC << EOF
840#include <zlib.h>
841int main(void) { zlibVersion(); return 0; }
842EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200843if compile_prog "" "-lz" ; then
balrogac629222008-10-11 09:56:04 +0000844 :
845else
846 echo
847 echo "Error: zlib check failed"
848 echo "Make sure to have the zlib libs and headers installed."
849 echo
850 exit 1
851fi
852
853##########################################
aliguorie37630c2009-04-22 15:19:10 +0000854# xen probe
855
856if test "$xen" = "yes" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +0200857 xen_libs="-lxenstore -lxenctrl -lxenguest"
858 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +0000859#include <xenctrl.h>
860#include <xs.h>
Christoph Eggerdf7a6072009-06-30 14:59:38 +0200861int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
aliguorie37630c2009-04-22 15:19:10 +0000862EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200863 if compile_prog "" "$xen_libs" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +0200864 :
865 else
866 xen="no"
867 fi
aliguorie37630c2009-04-22 15:19:10 +0000868fi
869
870##########################################
bellard11d9f692004-04-02 20:55:59 +0000871# SDL probe
872
873sdl_too_old=no
874
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500875if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +0200876 sdl=no
877 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +0000878#include <SDL.h>
879#undef main /* We don't want SDL to override our main() */
880int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
881EOF
Juan Quintelaac119f92009-07-27 16:13:15 +0200882 sdl_cflags=`sdl-config --cflags 2> /dev/null`
883 sdl_libs=`sdl-config --libs 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +0200884 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +0200885 _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
886 if test "$_sdlversion" -lt 121 ; then
887 sdl_too_old=yes
888 else
889 if test "$cocoa" = "no" ; then
890 sdl=yes
891 fi
892 fi
aliguoricd01b4a2008-08-21 19:25:45 +0000893
Juan Quintelaac119f92009-07-27 16:13:15 +0200894 # static link with sdl ?
895 if test "$sdl" = "yes" -a "$static" = "yes" ; then
896 sdl_libs=`sdl-config --static-libs 2>/dev/null`
897 if test `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` ; then
898 sdl_libs="$sdl_libs `aalib-config --static-libs >2 /dev/null`"
899 sdl_cflags="$sd_cflags `aalib-config --cflags >2 /dev/null`"
900 fi
Juan Quintela52166aa2009-08-03 14:46:03 +0200901 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +0200902 :
903 else
904 sdl=no
905 fi
906 fi # static link
907 fi # sdl compile test
Juan Quintelaa68551b2009-07-27 16:13:09 +0200908fi
bellard11d9f692004-04-02 20:55:59 +0000909
aliguori5368a422009-03-03 17:37:21 +0000910if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +0200911 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +0000912#include <SDL.h>
913#if defined(SDL_VIDEO_DRIVER_X11)
914#include <X11/XKBlib.h>
915#else
916#error No x11 support
917#endif
918int main(void) { return 0; }
919EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200920 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +0200921 sdl_libs="$sdl_libs -lX11"
922 fi
aliguori5368a422009-03-03 17:37:21 +0000923fi
924
ths8f28f3f2007-01-05 21:25:54 +0000925##########################################
ths8d5d2d42007-08-25 01:37:51 +0000926# VNC TLS detection
927if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000928cat > $TMPC <<EOF
929#include <gnutls/gnutls.h>
930int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
931EOF
932 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
933 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +0200934 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000935 :
936 else
937 vnc_tls="no"
938 fi
ths8d5d2d42007-08-25 01:37:51 +0000939fi
940
941##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000942# VNC SASL detection
943if test "$vnc_sasl" = "yes" ; then
944cat > $TMPC <<EOF
945#include <sasl/sasl.h>
946#include <stdio.h>
947int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
948EOF
949 # Assuming Cyrus-SASL installed in /usr prefix
950 vnc_sasl_cflags=""
951 vnc_sasl_libs="-lsasl2"
Juan Quintela52166aa2009-08-03 14:46:03 +0200952 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
aliguori2f9606b2009-03-06 20:27:28 +0000953 :
954 else
955 vnc_sasl="no"
956 fi
957fi
958
959##########################################
aliguori76655d62009-03-06 20:27:37 +0000960# fnmatch() probe, used for ACL routines
961fnmatch="no"
962cat > $TMPC << EOF
963#include <fnmatch.h>
964int main(void)
965{
966 fnmatch("foo", "foo", 0);
967 return 0;
968}
969EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200970if compile_prog "" "" ; then
aliguori76655d62009-03-06 20:27:37 +0000971 fnmatch="yes"
972fi
973
974##########################################
ths8a16d272008-07-19 09:56:24 +0000975# vde libraries probe
976if test "$vde" = "yes" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +0200977 vde=no
978 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +0000979 cat > $TMPC << EOF
980#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000981int main(void)
982{
983 struct vde_open_args a = {0, 0, 0};
984 vde_open("", "", &a);
985 return 0;
986}
ths8a16d272008-07-19 09:56:24 +0000987EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200988 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +0200989 vde=yes
990 fi
ths8a16d272008-07-19 09:56:24 +0000991fi
992
993##########################################
malcc2de5c92008-06-28 19:13:06 +0000994# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000995
malcc2de5c92008-06-28 19:13:06 +0000996audio_drv_probe()
997{
998 drv=$1
999 hdr=$2
1000 lib=$3
1001 exp=$4
1002 cfl=$5
1003 cat > $TMPC << EOF
1004#include <$hdr>
1005int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00001006EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001007 if compile_prog "$cfl" "$lib" ; then
malcc2de5c92008-06-28 19:13:06 +00001008 :
1009 else
1010 echo
1011 echo "Error: $drv check failed"
1012 echo "Make sure to have the $drv libs and headers installed."
1013 echo
1014 exit 1
1015 fi
1016}
1017
malc2fa7d3b2008-07-29 12:58:44 +00001018audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00001019for drv in $audio_drv_list; do
1020 case $drv in
1021 alsa)
1022 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1023 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1024 ;;
1025
1026 fmod)
1027 if test -z $fmod_lib || test -z $fmod_inc; then
1028 echo
1029 echo "Error: You must specify path to FMOD library and headers"
1030 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1031 echo
1032 exit 1
1033 fi
1034 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1035 ;;
1036
1037 esd)
1038 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1039 ;;
malcb8e59f12008-07-02 21:03:08 +00001040
1041 pa)
1042 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1043 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1044 ;;
1045
blueswir12f6a1ab2008-08-21 18:00:53 +00001046 oss|sdl|core|wav|dsound)
1047 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1048 ;;
1049
malce4c63a62008-07-19 16:15:16 +00001050 *)
malc1c9b2a52008-07-19 16:57:30 +00001051 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001052 echo
1053 echo "Error: Unknown driver '$drv' selected"
1054 echo "Possible drivers are: $audio_possible_drivers"
1055 echo
1056 exit 1
1057 }
1058 ;;
malcc2de5c92008-06-28 19:13:06 +00001059 esac
1060done
ths8f28f3f2007-01-05 21:25:54 +00001061
balrog4d3b6f62008-02-10 16:33:14 +00001062##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001063# BrlAPI probe
1064
Juan Quintelaeb822842009-07-27 16:13:18 +02001065if test "$brlapi" = "yes" ; then
1066 brlapi=no
1067 brlapi_libs="-lbrlapi"
1068 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00001069#include <brlapi.h>
1070int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1071EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001072 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001073 brlapi=yes
1074 fi
1075fi
aurel322e4d9fb2008-04-08 06:01:02 +00001076
1077##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001078# curses probe
1079
1080if test "$curses" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001081 cat > $TMPC << EOF
1082#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001083#ifdef __OpenBSD__
1084#define resize_term resizeterm
1085#endif
1086int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001087EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001088 if compile_prog "" "-lncurses" ; then
Juan Quintelae0b7a422009-07-27 16:13:17 +02001089 curses_libs="-lncurses"
Juan Quintela52166aa2009-08-03 14:46:03 +02001090 elif compile_prog "" "-lcurses" ; then
Juan Quintelae0b7a422009-07-27 16:13:17 +02001091 curses_libs="-lcurses"
1092 else
1093 curses=no
balrog4d3b6f62008-02-10 16:33:14 +00001094 fi
1095fi # test "$curses"
1096
blueswir1414f0da2008-08-15 18:20:52 +00001097##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001098# curl probe
1099
1100if test "$curl" = "yes" ; then
1101 curl=no
1102 cat > $TMPC << EOF
1103#include <curl/curl.h>
1104int main(void) { return curl_easy_init(); }
1105EOF
Juan Quintelab1d5a272009-08-03 14:46:05 +02001106 curl_cflags=`curl-config --cflags 2>/dev/null`
Paul Brook52368552009-05-22 17:22:38 +01001107 curl_libs=`curl-config --libs 2>/dev/null`
Juan Quintelab1d5a272009-08-03 14:46:05 +02001108 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001109 curl=yes
1110 fi
1111fi # test "$curl"
1112
1113##########################################
balrogfb599c92008-09-28 23:49:55 +00001114# bluez support probe
1115if test "$bluez" = "yes" ; then
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001116 `pkg-config bluez 2> /dev/null` || bluez="no"
balrogfb599c92008-09-28 23:49:55 +00001117fi
1118if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001119 cat > $TMPC << EOF
1120#include <bluetooth/bluetooth.h>
1121int main(void) { return bt_error(0); }
1122EOF
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001123 bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1124 bluez_libs=`pkg-config --libs bluez 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +02001125 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
balroge820e3f2008-09-30 02:27:44 +00001126 :
1127 else
1128 bluez="no"
1129 fi
balrogfb599c92008-09-28 23:49:55 +00001130fi
1131
1132##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001133# kvm probe
1134if test "$kvm" = "yes" ; then
1135 cat > $TMPC <<EOF
1136#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001137#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001138#error Invalid KVM version
1139#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001140#if !defined(KVM_CAP_USER_MEMORY)
1141#error Missing KVM capability KVM_CAP_USER_MEMORY
1142#endif
1143#if !defined(KVM_CAP_SET_TSS_ADDR)
1144#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1145#endif
1146#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1147#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1148#endif
aliguori7ba1e612008-11-05 16:04:33 +00001149int main(void) { return 0; }
1150EOF
aliguorieac30262008-11-05 16:28:56 +00001151 if test "$kerneldir" != "" ; then
1152 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001153 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1154 -a -d "$kerneldir/arch/x86/include" ; then
1155 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001156 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1157 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001158 elif test -d "$kerneldir/arch/$cpu/include" ; then
1159 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1160 fi
aliguorieac30262008-11-05 16:28:56 +00001161 else
1162 kvm_cflags=""
1163 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001164 if compile_prog "$kvm_cflags" "" ; then
aliguori7ba1e612008-11-05 16:04:33 +00001165 :
1166 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001167 kvm="no";
1168 if [ -x "`which awk 2>/dev/null`" ] && \
1169 [ -x "`which grep 2>/dev/null`" ]; then
Juan Quintela0c439cb2009-08-03 14:46:01 +02001170 kvmerr=`LANG=C $cc $CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001171 | grep "error: " \
1172 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1173 if test "$kvmerr" != "" ; then
Jan Kiszka168ccc12009-06-07 11:30:25 +02001174 kvm="no - (${kvmerr})\n\
1175 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1176recent kvm-kmod from http://sourceforge.net/projects/kvm."
aliguori9fd8d8d2009-01-15 21:57:30 +00001177 fi
1178 fi
aliguori7ba1e612008-11-05 16:04:33 +00001179 fi
1180fi
1181
1182##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001183# pthread probe
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001184PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
aliguorie5d355d2009-04-24 18:03:15 +00001185PTHREADLIBS=""
aliguori3c529d92008-12-12 16:41:40 +00001186
aliguorie5d355d2009-04-24 18:03:15 +00001187if test "$pthread" = yes; then
1188 pthread=no
1189cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001190#include <pthread.h>
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001191int main(void) { pthread_create(0,0,0,0); return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001192EOF
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001193 for pthread_lib in $PTHREADLIBS_LIST; do
Juan Quintela52166aa2009-08-03 14:46:03 +02001194 if compile_prog "" "$pthread_lib" ; then
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001195 pthread=yes
1196 PTHREADLIBS="$pthread_lib"
1197 break
1198 fi
1199 done
blueswir1414f0da2008-08-15 18:20:52 +00001200fi
1201
aliguorie5d355d2009-04-24 18:03:15 +00001202if test "$pthread" = no; then
1203 aio=no
1204 io_thread=no
1205fi
1206
aliguoribf9298b2008-12-05 20:05:26 +00001207##########################################
1208# iovec probe
1209cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001210#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001211#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001212#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001213int main(void) { struct iovec iov; return 0; }
1214EOF
1215iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02001216if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00001217 iovec=yes
1218fi
1219
aurel32f652e6a2008-12-16 10:43:48 +00001220##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001221# preadv probe
1222cat > $TMPC <<EOF
1223#include <sys/types.h>
1224#include <sys/uio.h>
1225#include <unistd.h>
1226int main(void) { preadv; }
1227EOF
1228preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02001229if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00001230 preadv=yes
1231fi
1232
1233##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001234# fdt probe
1235if test "$fdt" = "yes" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02001236 fdt=no
1237 fdt_libs="-lfdt"
1238 cat > $TMPC << EOF
aurel32f652e6a2008-12-16 10:43:48 +00001239int main(void) { return 0; }
1240EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001241 if compile_prog "" "$fdt_libs" ; then
aurel32f652e6a2008-12-16 10:43:48 +00001242 fdt=yes
1243 fi
1244fi
1245
aurel323b3f24a2009-04-15 16:12:13 +00001246#
1247# Check for xxxat() functions when we are building linux-user
1248# emulator. This is done because older glibc versions don't
1249# have syscall stubs for these implemented.
1250#
1251atfile=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03001252cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00001253#define _ATFILE_SOURCE
1254#include <sys/types.h>
1255#include <fcntl.h>
1256#include <unistd.h>
1257
1258int
1259main(void)
1260{
1261 /* try to unlink nonexisting file */
1262 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1263}
1264EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001265if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03001266 atfile=yes
aurel323b3f24a2009-04-15 16:12:13 +00001267fi
1268
aurel3239386ac2009-04-15 19:48:17 +00001269# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001270# emulator. This is done because older glibc versions don't
1271# have syscall stubs for these implemented. In that case we
1272# don't provide them even if kernel supports them.
1273#
1274inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03001275cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00001276#include <sys/inotify.h>
1277
1278int
1279main(void)
1280{
1281 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001282 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001283}
1284EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001285if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03001286 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00001287fi
1288
Riku Voipioebc996f2009-04-21 15:01:51 +03001289# check if utimensat and futimens are supported
1290utimens=no
1291cat > $TMPC << EOF
1292#define _ATFILE_SOURCE
1293#define _GNU_SOURCE
1294#include <stddef.h>
1295#include <fcntl.h>
1296
1297int main(void)
1298{
1299 utimensat(AT_FDCWD, "foo", NULL, 0);
1300 futimens(0, NULL);
1301 return 0;
1302}
1303EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001304if compile_prog "" "" ; then
Riku Voipioebc996f2009-04-21 15:01:51 +03001305 utimens=yes
1306fi
1307
Riku Voipio099d6b02009-05-05 12:10:04 +03001308# check if pipe2 is there
1309pipe2=no
1310cat > $TMPC << EOF
1311#define _GNU_SOURCE
1312#include <unistd.h>
1313#include <fcntl.h>
1314
1315int main(void)
1316{
1317 int pipefd[2];
1318 pipe2(pipefd, O_CLOEXEC);
1319 return 0;
1320}
1321EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001322if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03001323 pipe2=yes
1324fi
1325
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301326# check if tee/splice is there. vmsplice was added same time.
1327splice=no
1328cat > $TMPC << EOF
1329#define _GNU_SOURCE
1330#include <unistd.h>
1331#include <fcntl.h>
1332#include <limits.h>
1333
1334int main(void)
1335{
1336 int len, fd;
1337 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1338 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1339 return 0;
1340}
1341EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001342if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301343 splice=yes
1344fi
1345
pbrookcc8ae6d2006-04-23 17:57:59 +00001346# Check if tools are available to build documentation.
Anthony Liguori70ec5dc2009-05-14 08:25:04 -05001347if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
1348 build_docs="no"
pbrookcc8ae6d2006-04-23 17:57:59 +00001349fi
1350
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02001351# Search for bsawp_32 function
1352byteswap_h=no
1353cat > $TMPC << EOF
1354#include <byteswap.h>
1355int main(void) { return bswap_32(0); }
1356EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001357if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02001358 byteswap_h=yes
1359fi
1360
1361# Search for bsawp_32 function
1362bswap_h=no
1363cat > $TMPC << EOF
1364#include <sys/endian.h>
1365#include <sys/types.h>
1366#include <machine/bswap.h>
1367int main(void) { return bswap32(0); }
1368EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001369if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02001370 bswap_h=yes
1371fi
1372
aliguorida93a1f2008-12-12 20:02:52 +00001373##########################################
1374# Do we need librt
1375cat > $TMPC <<EOF
1376#include <signal.h>
1377#include <time.h>
1378int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1379EOF
1380
Juan Quintela52166aa2009-08-03 14:46:03 +02001381if compile_prog "" "" ; then
Juan Quintela51692022009-08-03 14:45:57 +02001382 CLOCKLIBS=""
Juan Quintela52166aa2009-08-03 14:46:03 +02001383elif compile_prog "" "-lrt" ; then
aliguorie5d355d2009-04-24 18:03:15 +00001384 CLOCKLIBS="-lrt"
aliguorida93a1f2008-12-12 20:02:52 +00001385fi
1386
Juan Quintelaa36abbb2009-08-03 14:45:56 +02001387# Determine what linker flags to use to force archive inclusion
1388check_linker_flags()
1389{
1390 w2=
1391 if test "$2" ; then
1392 w2=-Wl,$2
1393 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001394 compile_prog "" "-Wl,$1 ${w2}"
Juan Quintelaa36abbb2009-08-03 14:45:56 +02001395}
1396
1397cat > $TMPC << EOF
1398int main(void) { }
1399EOF
1400if check_linker_flags --whole-archive --no-whole-archive ; then
1401 # GNU ld
1402 arlibs_begin="-Wl,--whole-archive"
1403 arlibs_end="-Wl,--no-whole-archive"
1404elif check_linker_flags -z,allextract -z,defaultextract ; then
1405 # Solaris ld
1406 arlibs_begin"=-Wl,-z,allextract"
1407 arlibs_end="-Wl,-z,defaultextract"
1408elif check_linker_flags -all_load ; then
1409 # Mac OS X
1410 arlibs_begin="-all_load"
1411 arlibs_end=""
1412else
1413 echo "Error: your linker does not support --whole-archive or -z."
1414 echo "Please report to qemu-devel@nongnu.org"
1415 exit 1
1416fi
1417
Juan Quintelae86ecd42009-08-03 14:45:59 +02001418# End of CC checks
1419# After here, no more $cc or $ld runs
1420
1421# default flags for all hosts
Juan Quintela1156c662009-08-03 14:46:00 +02001422CFLAGS="-g -fno-strict-aliasing $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02001423if test "$debug" = "no" ; then
Juan Quintela1156c662009-08-03 14:46:00 +02001424 CFLAGS="-O2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02001425fi
Juan Quintela1156c662009-08-03 14:46:00 +02001426CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls $CFLAGS"
1427LDFLAGS="-g $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02001428
1429# Consult white-list to determine whether to enable werror
1430# by default. Only enable by default for git builds
1431if test -z "$werror" ; then
1432 z_version=`cut -f3 -d. $source_path/VERSION`
1433 if test "$z_version" = "50" -a \
1434 "$linux" = "yes" ; then
1435 werror="yes"
1436 else
1437 werror="no"
1438 fi
1439fi
1440
1441if test "$werror" = "yes" ; then
Juan Quintela1156c662009-08-03 14:46:00 +02001442 CFLAGS="-Werror $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02001443fi
1444
1445if test "$solaris" = "no" ; then
1446 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02001447 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02001448 fi
1449fi
1450
bellard11d9f692004-04-02 20:55:59 +00001451if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001452 if test -z "$prefix" ; then
Stefan Weil55418b92009-07-31 21:30:45 +02001453 prefix="c:/Program Files/Qemu"
pbrook308c3592007-02-27 00:52:01 +00001454 fi
1455 mansuffix=""
1456 datasuffix=""
1457 docsuffix=""
1458 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001459else
pbrook308c3592007-02-27 00:52:01 +00001460 if test -z "$prefix" ; then
1461 prefix="/usr/local"
1462 fi
1463 mansuffix="/share/man"
1464 datasuffix="/share/qemu"
1465 docsuffix="/share/doc/qemu"
1466 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001467fi
bellard5a671352003-10-01 00:13:48 +00001468
bellard43ce4df2003-06-09 19:53:12 +00001469echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001470echo "BIOS directory $prefix$datasuffix"
1471echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001472if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001473echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001474echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001475fi
bellard5a671352003-10-01 00:13:48 +00001476echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001477echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001478echo "Host C compiler $host_cc"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001479echo "CFLAGS $CFLAGS"
1480echo "LDFLAGS $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001481echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001482echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001483echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001484echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001485echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00001486echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00001487echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001488echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001489echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001490echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001491echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001492echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001493if test "$darwin" = "yes" ; then
1494 echo "Cocoa support $cocoa"
1495fi
bellard97a847b2003-08-10 21:36:04 +00001496echo "SDL support $sdl"
balrog4d3b6f62008-02-10 16:33:14 +00001497echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02001498echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00001499echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001500echo "Audio drivers $audio_drv_list"
1501echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001502echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001503echo "VNC TLS support $vnc_tls"
1504if test "$vnc_tls" = "yes" ; then
1505 echo " TLS CFLAGS $vnc_tls_cflags"
1506 echo " TLS LIBS $vnc_tls_libs"
1507fi
aliguori2f9606b2009-03-06 20:27:28 +00001508echo "VNC SASL support $vnc_sasl"
1509if test "$vnc_sasl" = "yes" ; then
1510 echo " SASL CFLAGS $vnc_sasl_cflags"
1511 echo " SASL LIBS $vnc_sasl_libs"
1512fi
blueswir131422552007-04-16 18:27:06 +00001513if test -n "$sparc_cpu"; then
1514 echo "Target Sparc Arch $sparc_cpu"
1515fi
bellard07f4ddb2005-04-23 17:44:28 +00001516echo "kqemu support $kqemu"
aliguorie37630c2009-04-22 15:19:10 +00001517echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00001518echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001519echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001520[ ! -z "$uname_release" ] && \
1521echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001522echo "NPTL support $nptl"
Paul Brook379f6692009-07-17 12:48:08 +01001523echo "GUEST_BASE $guest_base"
ths8a16d272008-07-19 09:56:24 +00001524echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001525echo "AIO support $aio"
aliguorie5d355d2009-04-24 18:03:15 +00001526echo "IO thread $io_thread"
ths77755342008-11-27 15:45:16 +00001527echo "Install blobs $blobs"
Jan Kiszka168ccc12009-06-07 11:30:25 +02001528echo -e "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001529echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001530echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001531
bellard97a847b2003-08-10 21:36:04 +00001532if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001533echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001534fi
bellard97a847b2003-08-10 21:36:04 +00001535
Juan Quintela98ec69a2009-07-16 18:34:18 +02001536config_host_mak="config-host.mak"
1537config_host_h="config-host.h"
Juan Quintela4bf6b552009-07-22 22:37:40 +02001538config_host_ld="config-host.ld"
bellard97a847b2003-08-10 21:36:04 +00001539
Juan Quintela98ec69a2009-07-16 18:34:18 +02001540#echo "Creating $config_host_mak and $config_host_h"
ths15d9ca02007-07-31 23:07:32 +00001541
Juan Quintela98ec69a2009-07-16 18:34:18 +02001542test -f $config_host_h && mv $config_host_h ${config_host_h}~
bellard97a847b2003-08-10 21:36:04 +00001543
Juan Quintela98ec69a2009-07-16 18:34:18 +02001544echo "# Automatically generated by configure - do not modify" > $config_host_mak
1545printf "# Configured with:" >> $config_host_mak
1546printf " '%s'" "$0" "$@" >> $config_host_mak
1547echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02001548
Juan Quintela2358a492009-07-27 16:13:25 +02001549echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02001550
aurel322408a522008-04-20 20:19:44 +00001551case "$cpu" in
Andrzej Zaborowskic62bbcd2009-07-18 14:32:00 +02001552 i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|sparc|sparc64)
Juan Quintelae0da9dd2009-07-16 18:34:09 +02001553 ARCH=$cpu
aurel322408a522008-04-20 20:19:44 +00001554 ;;
Laurent Desnoguesa302c322009-07-18 14:23:39 +02001555 armv4b|armv4l)
Juan Quintela16dbd142009-07-16 18:34:08 +02001556 ARCH=arm
aurel322408a522008-04-20 20:19:44 +00001557 ;;
aurel322408a522008-04-20 20:19:44 +00001558 *)
1559 echo "Unsupported CPU = $cpu"
1560 exit 1
1561 ;;
1562esac
Juan Quintela98ec69a2009-07-16 18:34:18 +02001563echo "ARCH=$ARCH" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00001564if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001565 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00001566fi
Paul Brookf3d08ee2009-06-04 11:39:04 +01001567if test "$debug" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001568 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
Paul Brookf3d08ee2009-06-04 11:39:04 +01001569fi
aliguori1625af82009-04-05 17:41:02 +00001570if test "$strip_opt" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001571 echo "STRIP_OPT=-s" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00001572fi
bellard7d132992003-03-06 23:23:54 +00001573if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02001574 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00001575fi
Juan Quintela2358a492009-07-27 16:13:25 +02001576echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00001577if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001578 echo "CONFIG_WIN32=y" >> $config_host_mak
pbrook210fa552007-02-27 21:04:49 +00001579else
Juan Quintela35f4df22009-07-27 16:13:07 +02001580 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00001581fi
blueswir1128ab2f2008-08-15 18:33:42 +00001582
bellard83fb7ad2004-07-05 21:25:26 +00001583if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001584 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00001585fi
malcb29fe3e2008-11-18 01:42:22 +00001586
1587if test "$aix" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001588 echo "CONFIG_AIX=y" >> $config_host_mak
malcb29fe3e2008-11-18 01:42:22 +00001589fi
1590
bellardec530c82006-04-25 22:36:06 +00001591if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001592 echo "CONFIG_SOLARIS=y" >> $config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02001593 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00001594 if test "$needs_libsunmath" = "yes" ; then
Juan Quintela75b5a692009-07-27 16:13:23 +02001595 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00001596 fi
bellardec530c82006-04-25 22:36:06 +00001597fi
bellard97a847b2003-08-10 21:36:04 +00001598if test "$gprof" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001599 echo "TARGET_GPROF=yes" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00001600fi
1601if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001602 echo "CONFIG_STATIC=y" >> $config_host_mak
Juan Quintela1156c662009-08-03 14:46:00 +02001603 LDFLAGS="-static $LDFLAGS"
bellard97a847b2003-08-10 21:36:04 +00001604fi
bellard05c2a3e2006-02-08 22:39:17 +00001605if test $profiler = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001606 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00001607fi
bellardc20709a2004-04-21 23:27:19 +00001608if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001609 echo "CONFIG_SLIRP=y" >> $config_host_mak
bellardc20709a2004-04-21 23:27:19 +00001610fi
ths8a16d272008-07-19 09:56:24 +00001611if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001612 echo "CONFIG_VDE=y" >> $config_host_mak
Juan Quintela4baae0a2009-07-27 16:13:19 +02001613 echo "VDE_LIBS=$vde_libs" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00001614fi
malc0c58ac12008-06-25 21:04:05 +00001615for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001616 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02001617 echo "$def=y" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00001618done
Juan Quintela2358a492009-07-27 16:13:25 +02001619echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00001620for drv in $audio_drv_list; do
pbrookf6e58892008-06-29 01:00:34 +00001621 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02001622 echo "$def=y" >> $config_host_mak
malc923e4522008-07-02 18:13:46 +00001623 if test "$drv" = "fmod"; then
Juan Quintela7aac6cb2009-07-27 16:12:47 +02001624 echo "FMOD_LIBS=$fmod_lib" >> $config_host_mak
1625 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001626 elif test "$drv" = "oss"; then
Juan Quintela68819642009-07-27 16:12:48 +02001627 echo "OSS_LIBS=$oss_lib" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00001628 fi
1629done
malc8ff9cbf2008-06-23 18:33:30 +00001630if test "$mixemu" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001631 echo "CONFIG_MIXEMU=y" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00001632fi
ths8d5d2d42007-08-25 01:37:51 +00001633if test "$vnc_tls" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001634 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
Juan Quintela525061b2009-07-27 16:12:43 +02001635 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
1636 echo "VNC_TLS_LIBS=$vnc_tls_libs" >> $config_host_mak
ths8d5d2d42007-08-25 01:37:51 +00001637fi
aliguori2f9606b2009-03-06 20:27:28 +00001638if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001639 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
Juan Quintela60ddf532009-07-27 16:12:45 +02001640 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
1641 echo "VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00001642fi
aliguori76655d62009-03-06 20:27:37 +00001643if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001644 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00001645fi
pbrookb1a550a2006-04-16 13:28:56 +00001646qemu_version=`head $source_path/VERSION`
Juan Quintela98ec69a2009-07-16 18:34:18 +02001647echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02001648echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02001649echo "SRC_PATH=$source_path" >> $config_host_mak
pbrookad064842006-04-16 12:41:07 +00001650if [ "$source_path_used" = "yes" ]; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001651 echo "VPATH=$source_path" >> $config_host_mak
pbrookad064842006-04-16 12:41:07 +00001652fi
Juan Quintela98ec69a2009-07-16 18:34:18 +02001653echo "TARGET_DIRS=$target_list" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001654if [ "$build_docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001655 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001656fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02001657if test "$sdl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001658 echo "CONFIG_SDL=y" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02001659 echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
1660 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00001661fi
1662if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001663 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00001664fi
1665if test "$curses" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001666 echo "CONFIG_CURSES=y" >> $config_host_mak
Juan Quintelae0b7a422009-07-27 16:13:17 +02001667 echo "CURSES_LIBS=$curses_libs" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00001668fi
aurel323b3f24a2009-04-15 16:12:13 +00001669if test "$atfile" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001670 echo "CONFIG_ATFILE=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00001671fi
Riku Voipioebc996f2009-04-21 15:01:51 +03001672if test "$utimens" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001673 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
Riku Voipioebc996f2009-04-21 15:01:51 +03001674fi
Riku Voipio099d6b02009-05-05 12:10:04 +03001675if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001676 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03001677fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301678if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001679 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301680fi
aurel323b3f24a2009-04-15 16:12:13 +00001681if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001682 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00001683fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02001684if test "$byteswap_h" = "yes" ; then
1685 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
1686fi
1687if test "$bswap_h" = "yes" ; then
1688 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
1689fi
Alexander Graf769ce762009-05-11 17:41:42 +02001690if test "$curl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001691 echo "CONFIG_CURL=y" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02001692 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02001693 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02001694fi
aurel322e4d9fb2008-04-08 06:01:02 +00001695if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001696 echo "CONFIG_BRLAPI=y" >> $config_host_mak
Juan Quintelaeb822842009-07-27 16:13:18 +02001697 echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00001698fi
balrogfb599c92008-09-28 23:49:55 +00001699if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001700 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02001701 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
1702 echo "BLUEZ_LIBS=$bluez_libs" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00001703fi
aliguorie37630c2009-04-22 15:19:10 +00001704if test "$xen" = "yes" ; then
Juan Quintela5647eb72009-07-27 16:13:21 +02001705 echo "CONFIG_XEN=y" >> $config_host_mak
Juan Quintelab2266be2009-07-27 16:13:16 +02001706 echo "XEN_LIBS=$xen_libs" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00001707fi
blueswir1414f0da2008-08-15 18:20:52 +00001708if test "$aio" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001709 echo "CONFIG_AIO=y" >> $config_host_mak
blueswir1414f0da2008-08-15 18:20:52 +00001710fi
aliguorie5d355d2009-04-24 18:03:15 +00001711if test "$io_thread" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001712 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
aliguorie5d355d2009-04-24 18:03:15 +00001713fi
ths77755342008-11-27 15:45:16 +00001714if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001715 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00001716fi
aliguoribf9298b2008-12-05 20:05:26 +00001717if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001718 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00001719fi
aliguoriceb42de2009-04-07 18:43:28 +00001720if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001721 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00001722fi
aurel32f652e6a2008-12-16 10:43:48 +00001723if test "$fdt" = "yes" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02001724 echo "CONFIG_FDT=y" >> $config_host_mak
Juan Quintelab41af4b2009-07-27 16:13:20 +02001725 echo "FDT_LIBS=$fdt_libs" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00001726fi
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
Juan Quintela2358a492009-07-27 16:13:25 +02001730 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00001731fi
1732
Juan Quintela2358a492009-07-27 16:13:25 +02001733echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
pbrookc5937222006-05-14 11:30:38 +00001734
blueswir168063642008-11-22 21:03:55 +00001735# USB host support
1736case "$usb" in
1737linux)
Juan Quintela98ec69a2009-07-16 18:34:18 +02001738 echo "HOST_USB=linux" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00001739;;
1740bsd)
Juan Quintela98ec69a2009-07-16 18:34:18 +02001741 echo "HOST_USB=bsd" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00001742;;
1743*)
Juan Quintela98ec69a2009-07-16 18:34:18 +02001744 echo "HOST_USB=stub" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00001745;;
1746esac
1747
pbrookc39e3332007-09-22 16:49:14 +00001748tools=
1749if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001750 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001751 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001752 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001753 fi
pbrookc39e3332007-09-22 16:49:14 +00001754fi
Juan Quintela98ec69a2009-07-16 18:34:18 +02001755echo "TOOLS=$tools" >> $config_host_mak
pbrookc39e3332007-09-22 16:49:14 +00001756
Juan Quintela161294d2009-07-21 14:11:22 +02001757# Mac OS X ships with a broken assembler
Alexander Graf253d0942009-06-29 15:37:40 +02001758roms=
Juan Quintela161294d2009-07-21 14:11:22 +02001759if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
1760 "$targetos" != "Darwin" ; then
Paul Brookc05ac892009-07-31 13:18:32 +01001761 roms="optionrom"
Alexander Graf253d0942009-06-29 15:37:40 +02001762fi
Juan Quintela98ec69a2009-07-16 18:34:18 +02001763echo "ROMS=$roms" >> $config_host_mak
Alexander Graf253d0942009-06-29 15:37:40 +02001764
Juan Quintela804edf22009-07-27 16:12:49 +02001765echo "prefix=$prefix" >> $config_host_mak
1766echo "bindir=\${prefix}$binsuffix" >> $config_host_mak
1767echo "mandir=\${prefix}$mansuffix" >> $config_host_mak
1768echo "datadir=\${prefix}$datasuffix" >> $config_host_mak
1769echo "docdir=\${prefix}$docsuffix" >> $config_host_mak
1770echo "MAKE=$make" >> $config_host_mak
1771echo "INSTALL=$install" >> $config_host_mak
1772echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
1773echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
1774echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
1775echo "CC=$cc" >> $config_host_mak
1776echo "HOST_CC=$host_cc" >> $config_host_mak
1777if test "$sparse" = "yes" ; then
1778 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
1779 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
1780 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
1781fi
1782echo "AR=$ar" >> $config_host_mak
1783echo "OBJCOPY=$objcopy" >> $config_host_mak
1784echo "LD=$ld" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02001785echo "CFLAGS=$CFLAGS" >> $config_host_mak
1786echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Juan Quintelaa36abbb2009-08-03 14:45:56 +02001787echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
1788echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02001789echo "EXESUF=$EXESUF" >> $config_host_mak
1790echo "PTHREADLIBS=$PTHREADLIBS" >> $config_host_mak
1791echo "CLOCKLIBS=$CLOCKLIBS" >> $config_host_mak
1792
Juan Quintela2358a492009-07-27 16:13:25 +02001793echo "/* Automatically generated by configure - do not modify */" > $config_host_h
1794
malc0ff66972009-08-10 03:40:16 +04001795$SHELL $source_path/create_config < $config_host_mak >> $config_host_h
Juan Quintela2358a492009-07-27 16:13:25 +02001796
Juan Quintela98ec69a2009-07-16 18:34:18 +02001797if test -f ${config_host_h}~ ; then
1798 if cmp -s $config_host_h ${config_host_h}~ ; then
1799 mv ${config_host_h}~ $config_host_h
Paul Brook370ab982009-05-26 15:07:56 +01001800 else
Juan Quintela98ec69a2009-07-16 18:34:18 +02001801 rm ${config_host_h}~
Paul Brook370ab982009-05-26 15:07:56 +01001802 fi
1803fi
1804
Juan Quintela4bf6b552009-07-22 22:37:40 +02001805# generate list of library paths for linker script
1806
1807$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
1808
1809if test -f ${config_host_ld}~ ; then
1810 if cmp -s $config_host_ld ${config_host_ld}~ ; then
1811 mv ${config_host_ld}~ $config_host_ld
1812 else
1813 rm ${config_host_ld}~
1814 fi
1815fi
1816
bellard1d14ffa2005-10-30 18:58:22 +00001817for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001818target_dir="$target"
1819config_mak=$target_dir/config.mak
1820config_h=$target_dir/config.h
Blue Swirl600309b2009-07-03 17:44:00 +00001821target_arch2=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00001822target_bigendian="no"
Juan Quintelaea2d6a32009-07-16 18:34:10 +02001823case "$target_arch2" in
1824 armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|sh4eb|sparc|sparc64|sparc32plus)
1825 target_bigendian=yes
1826 ;;
1827esac
bellard97a847b2003-08-10 21:36:04 +00001828target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001829target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001830target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001831target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001832target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001833case "$target" in
Blue Swirl600309b2009-07-03 17:44:00 +00001834 ${target_arch2}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00001835 target_softmmu="yes"
1836 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00001837 ${target_arch2}-linux-user)
pbrook9e407a82007-05-26 16:38:53 +00001838 target_user_only="yes"
1839 target_linux_user="yes"
1840 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00001841 ${target_arch2}-darwin-user)
pbrook9e407a82007-05-26 16:38:53 +00001842 target_user_only="yes"
1843 target_darwin_user="yes"
1844 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00001845 ${target_arch2}-bsd-user)
blueswir184778502008-10-26 20:33:16 +00001846 target_user_only="yes"
1847 target_bsd_user="yes"
1848 ;;
pbrook9e407a82007-05-26 16:38:53 +00001849 *)
1850 echo "ERROR: Target '$target' not recognised"
1851 exit 1
1852 ;;
1853esac
ths831b7822007-01-18 20:06:33 +00001854
bellard7c1f25b2004-04-22 00:02:08 +00001855#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001856
ths15d9ca02007-07-31 23:07:32 +00001857test -f $config_h && mv $config_h ${config_h}~
1858
bellard97a847b2003-08-10 21:36:04 +00001859mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001860mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001861mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001862if 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 +00001863 mkdir -p $target_dir/nwfpe
1864fi
1865
bellardec530c82006-04-25 22:36:06 +00001866#
1867# don't use ln -sf as not all "ln -sf" over write the file/link
1868#
1869rm -f $target_dir/Makefile
1870ln -s $source_path/Makefile.target $target_dir/Makefile
1871
bellard97a847b2003-08-10 21:36:04 +00001872
1873echo "# Automatically generated by configure - do not modify" > $config_mak
bellard97a847b2003-08-10 21:36:04 +00001874
1875echo "include ../config-host.mak" >> $config_mak
bellard1e43adf2003-09-30 20:54:24 +00001876
pbrooke5fe0c52006-06-11 13:32:59 +00001877bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001878elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001879target_nptl="no"
Blue Swirl600309b2009-07-03 17:44:00 +00001880interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
Juan Quintela42bc6082009-07-16 18:34:20 +02001881echo "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_mak
pbrook56aebc82008-10-11 17:55:29 +00001882gdb_xml_files=""
aliguori7ba1e612008-11-05 16:04:33 +00001883
Juan Quintela938b1ed2009-07-16 18:34:12 +02001884TARGET_ARCH="$target_arch2"
Juan Quintela6acff7d2009-07-16 18:34:15 +02001885TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02001886TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02001887
Blue Swirl600309b2009-07-03 17:44:00 +00001888case "$target_arch2" in
aurel322408a522008-04-20 20:19:44 +00001889 i386)
Paul Brook1ad21342009-05-19 16:17:58 +01001890 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001891 ;;
1892 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02001893 TARGET_BASE_ARCH=i386
Paul Brook1ad21342009-05-19 16:17:58 +01001894 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001895 ;;
1896 alpha)
Paul Brook1ad21342009-05-19 16:17:58 +01001897 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001898 ;;
1899 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001900 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00001901 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001902 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001903 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001904 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001905 ;;
1906 cris)
edgar_igl253bd7f2009-01-07 20:07:09 +00001907 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001908 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001909 ;;
1910 m68k)
aurel322408a522008-04-20 20:19:44 +00001911 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001912 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001913 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001914 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001915 microblaze)
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001916 bflt="yes"
1917 target_nptl="yes"
1918 target_phys_bits=32
1919 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02001920 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001921 TARGET_ARCH=mips
Juan Quintela42bc6082009-07-16 18:34:20 +02001922 echo "TARGET_ABI_MIPSO32=y" >> $config_mak
Paul Brookf04dc722009-07-09 17:56:24 +01001923 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001924 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001925 ;;
1926 mipsn32|mipsn32el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001927 TARGET_ARCH=mipsn32
Juan Quintela6acff7d2009-07-16 18:34:15 +02001928 TARGET_BASE_ARCH=mips
Juan Quintela42bc6082009-07-16 18:34:20 +02001929 echo "TARGET_ABI_MIPSN32=y" >> $config_mak
Paul Brook1ad21342009-05-19 16:17:58 +01001930 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001931 ;;
1932 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001933 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02001934 TARGET_BASE_ARCH=mips
Juan Quintela42bc6082009-07-16 18:34:20 +02001935 echo "TARGET_ABI_MIPSN64=y" >> $config_mak
Paul Brook1ad21342009-05-19 16:17:58 +01001936 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001937 ;;
1938 ppc)
aurel32c8b35322009-01-24 15:07:34 +00001939 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001940 target_phys_bits=32
Nathan Froydd6630702009-08-03 08:43:28 -07001941 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001942 ;;
1943 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02001944 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02001945 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00001946 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001947 target_phys_bits=64
Nathan Froydd6630702009-08-03 08:43:28 -07001948 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001949 ;;
1950 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02001951 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02001952 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00001953 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001954 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001955 ;;
1956 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001957 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02001958 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02001959 TARGET_ABI_DIR=ppc
Juan Quintela42bc6082009-07-16 18:34:20 +02001960 echo "TARGET_ABI32=y" >> $config_mak
aurel32c8b35322009-01-24 15:07:34 +00001961 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001962 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001963 ;;
1964 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001965 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00001966 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001967 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001968 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001969 ;;
1970 sparc)
Paul Brook1ad21342009-05-19 16:17:58 +01001971 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001972 ;;
1973 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02001974 TARGET_BASE_ARCH=sparc
aurel322408a522008-04-20 20:19:44 +00001975 elfload32="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001976 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001977 ;;
1978 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001979 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02001980 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02001981 TARGET_ABI_DIR=sparc
Juan Quintela42bc6082009-07-16 18:34:20 +02001982 echo "TARGET_ABI32=y" >> $config_mak
Paul Brook1ad21342009-05-19 16:17:58 +01001983 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001984 ;;
1985 *)
1986 echo "Unsupported target CPU"
1987 exit 1
1988 ;;
1989esac
Juan Quintelab498c8a2009-07-16 18:34:11 +02001990echo "TARGET_ARCH=$TARGET_ARCH" >> $config_mak
Juan Quintela0adcffb2009-07-16 18:34:16 +02001991echo "TARGET_ARCH2=$target_arch2" >> $config_mak
Juan Quintela42bc6082009-07-16 18:34:20 +02001992# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02001993if [ "$TARGET_BASE_ARCH" = "" ]; then
1994 TARGET_BASE_ARCH=$TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02001995fi
1996echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02001997if [ "$TARGET_ABI_DIR" = "" ]; then
1998 TARGET_ABI_DIR=$TARGET_ARCH
1999fi
2000echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_mak
Paul Brook1ad21342009-05-19 16:17:58 +01002001if [ $target_phys_bits -lt $hostlongbits ] ; then
2002 target_phys_bits=$hostlongbits
2003fi
Juan Quintela1b0c87f2009-07-16 18:33:59 +02002004case "$target_arch2" in
2005 i386|x86_64)
2006 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
2007 echo "CONFIG_XEN=y" >> $config_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02002008 fi
Juan Quintela0d46b7e2009-07-16 18:34:01 +02002009 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
2010 then
2011 echo "CONFIG_KQEMU=y" >> $config_mak
Juan Quintela0d46b7e2009-07-16 18:34:01 +02002012 fi
Juan Quintela1b0c87f2009-07-16 18:33:59 +02002013esac
Juan Quintelac59249f2009-07-16 18:34:00 +02002014case "$target_arch2" in
Alexander Graf5f114bc2009-07-17 13:51:42 +02002015 i386|x86_64|ppcemb|ppc|ppc64)
Juan Quintelac59249f2009-07-16 18:34:00 +02002016 # Make sure the target and host cpus are compatible
2017 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2018 \( "$target_arch2" = "$cpu" -o \
2019 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
Alexander Graf5f114bc2009-07-17 13:51:42 +02002020 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
Juan Quintelac59249f2009-07-16 18:34:00 +02002021 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
2022 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
2023 echo "CONFIG_KVM=y" >> $config_mak
2024 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
Juan Quintelac59249f2009-07-16 18:34:00 +02002025 fi
2026esac
Paul Brook1ad21342009-05-19 16:17:58 +01002027echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
Juan Quintela42bc6082009-07-16 18:34:20 +02002028echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_mak
Paul Brook1ad21342009-05-19 16:17:58 +01002029echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00002030if test "$target_bigendian" = "yes" ; then
Juan Quintela42bc6082009-07-16 18:34:20 +02002031 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00002032fi
2033if test "$target_softmmu" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002034 echo "CONFIG_SOFTMMU=y" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00002035fi
bellard997344f2003-10-27 21:10:39 +00002036if test "$target_user_only" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002037 echo "CONFIG_USER_ONLY=y" >> $config_mak
bellard997344f2003-10-27 21:10:39 +00002038fi
ths831b7822007-01-18 20:06:33 +00002039if test "$target_linux_user" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002040 echo "CONFIG_LINUX_USER=y" >> $config_mak
ths831b7822007-01-18 20:06:33 +00002041fi
2042if test "$target_darwin_user" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002043 echo "CONFIG_DARWIN_USER=y" >> $config_mak
ths831b7822007-01-18 20:06:33 +00002044fi
pbrook56aebc82008-10-11 17:55:29 +00002045list=""
2046if test ! -z "$gdb_xml_files" ; then
2047 for x in $gdb_xml_files; do
2048 list="$list $source_path/gdb-xml/$x"
2049 done
2050fi
2051echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00002052
Juan Quintelaf57975f2009-07-16 18:34:19 +02002053case "$target_arch2" in
2054 arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|sparc|sparc64|sparc32plus)
2055 echo "CONFIG_SOFTFLOAT=y" >> $config_mak
Juan Quintelaf57975f2009-07-16 18:34:19 +02002056 ;;
2057esac
2058
pbrooke5fe0c52006-06-11 13:32:59 +00002059if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002060 echo "TARGET_HAS_BFLT=y" >> $config_mak
pbrooke5fe0c52006-06-11 13:32:59 +00002061fi
pbrookbd0c5662008-05-29 14:34:11 +00002062if test "$target_user_only" = "yes" \
2063 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
Juan Quintela2f7bb872009-07-27 16:13:24 +02002064 echo "CONFIG_USE_NPTL=y" >> $config_mak
pbrookbd0c5662008-05-29 14:34:11 +00002065fi
blueswir1cb33da52007-10-09 16:34:29 +00002066# 32 bit ELF loader in addition to native 64 bit loader?
2067if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002068 echo "TARGET_HAS_ELFLOAD32=y" >> $config_mak
blueswir1cb33da52007-10-09 16:34:29 +00002069fi
Paul Brook379f6692009-07-17 12:48:08 +01002070if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
2071 echo "CONFIG_USE_GUEST_BASE=y" >> $config_mak
2072fi
blueswir184778502008-10-26 20:33:16 +00002073if test "$target_bsd_user" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002074 echo "CONFIG_BSD_USER=y" >> $config_mak
blueswir184778502008-10-26 20:33:16 +00002075fi
bellard5b0753e2005-03-01 21:37:28 +00002076
Juan Quintelafa282482009-07-22 22:37:39 +02002077# generate LDFLAGS for targets
2078
2079ldflags=""
2080if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then
2081 case "$ARCH" in
2082 i386)
2083 if test "$gprof" = "yes" -o "$static" = "yes" ; then
Juan Quintela4bf6b552009-07-22 22:37:40 +02002084 ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
Juan Quintelafa282482009-07-22 22:37:39 +02002085 else
2086 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
2087 # that the kernel ELF loader considers as an executable. I think this
2088 # is the simplest way to make it self virtualizable!
2089 ldflags='-Wl,-shared'
2090 fi
2091 ;;
2092 sparc)
2093 # -static is used to avoid g1/g3 usage by the dynamic linker
Juan Quintela4bf6b552009-07-22 22:37:40 +02002094 ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
Juan Quintelafa282482009-07-22 22:37:39 +02002095 ;;
2096 ia64)
Juan Quintela4bf6b552009-07-22 22:37:40 +02002097 ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
Juan Quintelafa282482009-07-22 22:37:39 +02002098 ;;
2099 x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
Juan Quintela4bf6b552009-07-22 22:37:40 +02002100 ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
Juan Quintelafa282482009-07-22 22:37:39 +02002101 ;;
2102 esac
2103fi
2104if test "$target_softmmu" = "yes" ; then
2105 case "$ARCH" in
2106 ia64)
Juan Quintela4bf6b552009-07-22 22:37:40 +02002107 ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
Juan Quintelafa282482009-07-22 22:37:39 +02002108 ;;
2109 esac
2110fi
2111
2112if test "$ldflags" != "" ; then
2113 echo "LDFLAGS+=$ldflags" >> $config_mak
2114fi
2115
Juan Quintela2358a492009-07-27 16:13:25 +02002116echo "/* Automatically generated by configure - do not modify */" > $config_h
2117echo "#include \"../config-host.h\"" >> $config_h
2118
malc0ff66972009-08-10 03:40:16 +04002119$SHELL $source_path/create_config < $config_mak >> $config_h
Juan Quintela42bc6082009-07-16 18:34:20 +02002120
Juan Quintelaa900c002009-07-27 16:12:44 +02002121if test -f ${config_h}~ ; then
2122 if cmp -s $config_h ${config_h}~ ; then
2123 mv ${config_h}~ $config_h
2124 else
2125 rm ${config_h}~
2126 fi
2127fi
ths15d9ca02007-07-31 23:07:32 +00002128
bellard97a847b2003-08-10 21:36:04 +00002129done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00002130
2131# build tree in object directory if source path is different from current one
2132if test "$source_path_used" = "yes" ; then
Alexander Graf253d0942009-06-29 15:37:40 +02002133 DIRS="tests tests/cris slirp audio block pc-bios/optionrom"
bellard7d132992003-03-06 23:23:54 +00002134 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00002135 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00002136 FILES="$FILES tests/test-mmap.c"
Jan Kiszka7ea78b72009-07-17 11:20:10 +02002137 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
2138 for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
2139 FILES="$FILES pc-bios/`basename $bios_file`"
2140 done
bellard7d132992003-03-06 23:23:54 +00002141 for dir in $DIRS ; do
2142 mkdir -p $dir
2143 done
bellardec530c82006-04-25 22:36:06 +00002144 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00002145 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00002146 rm -f $f
2147 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00002148 done
2149fi
Paul Brook1ad21342009-05-19 16:17:58 +01002150
2151for hwlib in 32 64; do
2152 d=libhw$hwlib
2153 mkdir -p $d
2154 rm -f $d/Makefile
2155 ln -s $source_path/Makefile.hw $d/Makefile
2156 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2157 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2158done