blob: fa4fc77e0491ef588f05cea85bc54ecb7cecb5b6 [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001#!/bin/sh
2#
bellard3ef693a2003-03-23 20:17:16 +00003# qemu configure script (c) 2003 Fabrice Bellard
bellard7d132992003-03-06 23:23:54 +00004#
5# set temporary file name
6if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10else
11 TMPDIR1="/tmp"
12fi
13
bellard3ef693a2003-03-23 20:17:16 +000014TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
malc9d56d2d2008-09-30 19:44:32 +000018TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
malcd4742de2008-11-29 22:04:31 +000019TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
bellard7d132992003-03-06 23:23:54 +000020
malcd4742de2008-11-29 22:04:31 +000021trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
malc9ac81bb2008-11-29 20:09:56 +000022
bellard7d132992003-03-06 23:23:54 +000023# default parameters
bellard11d9f692004-04-02 20:55:59 +000024prefix=""
bellard1e43adf2003-09-30 20:54:24 +000025interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000026static="no"
bellard7d132992003-03-06 23:23:54 +000027cross_prefix=""
28cc="gcc"
malc0c58ac12008-06-25 21:04:05 +000029audio_drv_list=""
malc4c9b53e2009-01-09 10:46:34 +000030audio_card_list="ac97 es1370 sb16"
31audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
bellard7d132992003-03-06 23:23:54 +000032host_cc="gcc"
33ar="ar"
34make="make"
pbrook6a882642006-04-17 13:57:12 +000035install="install"
Anthony Liguori7aa486f2009-07-11 08:48:29 -050036objcopy="objcopy"
37ld="ld"
aliguoriac0df512008-12-29 17:14:15 +000038
39# parse CC options first
40for opt do
41 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
42 case "$opt" in
43 --cross-prefix=*) cross_prefix="$optarg"
44 ;;
45 --cc=*) cc="$optarg"
46 ;;
47 esac
48done
49
50# OS specific
51# Using uname is really, really broken. Once we have the right set of checks
52# we can eliminate it's usage altogether
53
54cc="${cross_prefix}${cc}"
55ar="${cross_prefix}${ar}"
Anthony Liguori7aa486f2009-07-11 08:48:29 -050056objcopy="${cross_prefix}${objcopy}"
57ld="${cross_prefix}${ld}"
aliguoriac0df512008-12-29 17:14:15 +000058
59# check that the C compiler works.
60cat > $TMPC <<EOF
61int main(void) {}
62EOF
63
Juan Quintelad2ac5822009-08-03 14:45:54 +020064if $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
aliguoriac0df512008-12-29 17:14:15 +000065 : C compiler works ok
66else
67 echo "ERROR: \"$cc\" either does not exist or does not work"
68 exit 1
69fi
70
71check_define() {
72cat > $TMPC <<EOF
73#if !defined($1)
74#error Not defined
75#endif
76int main(void) { return 0; }
77EOF
Juan Quintelad2ac5822009-08-03 14:45:54 +020078 $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
aliguoriac0df512008-12-29 17:14:15 +000079}
80
81if check_define __i386__ ; then
82 cpu="i386"
83elif check_define __x86_64__ ; then
84 cpu="x86_64"
blueswir13aa9bd62008-12-31 16:55:26 +000085elif check_define __sparc__ ; then
86 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
87 # They must be specified using --sparc_cpu
88 if check_define __arch64__ ; then
89 cpu="sparc64"
90 else
91 cpu="sparc"
92 fi
malcfdf7ed92009-01-14 18:39:52 +000093elif check_define _ARCH_PPC ; then
94 if check_define _ARCH_PPC64 ; then
95 cpu="ppc64"
96 else
97 cpu="ppc"
98 fi
aliguoriac0df512008-12-29 17:14:15 +000099else
malcfdf7ed92009-01-14 18:39:52 +0000100 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +0000101fi
102
bellard5327cf42005-01-10 23:18:50 +0000103target_list=""
bellard7d132992003-03-06 23:23:54 +0000104case "$cpu" in
105 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000106 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000107 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000108 x86_64|amd64)
109 cpu="x86_64"
110 ;;
111 alpha)
112 cpu="alpha"
113 ;;
bellardba680552005-03-13 09:49:52 +0000114 armv*b)
bellard808c4952004-12-19 23:33:47 +0000115 cpu="armv4b"
116 ;;
bellardba680552005-03-13 09:49:52 +0000117 armv*l)
bellard7d132992003-03-06 23:23:54 +0000118 cpu="armv4l"
119 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000120 cris)
121 cpu="cris"
bellard7d132992003-03-06 23:23:54 +0000122 ;;
aurel32f54b3f92008-04-12 20:14:54 +0000123 parisc|parisc64)
124 cpu="hppa"
125 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000126 ia64)
127 cpu="ia64"
128 ;;
129 m68k)
130 cpu="m68k"
bellard7d132992003-03-06 23:23:54 +0000131 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200132 microblaze)
133 cpu="microblaze"
134 ;;
bellard7d132992003-03-06 23:23:54 +0000135 mips)
136 cpu="mips"
137 ;;
thsfbe4f652007-04-01 11:16:48 +0000138 mips64)
139 cpu="mips64"
140 ;;
malcfdf7ed92009-01-14 18:39:52 +0000141 ppc)
142 cpu="ppc"
143 ;;
144 ppc64)
145 cpu="ppc64"
thse7daa602007-10-08 13:38:27 +0000146 ;;
ths0e7b8a92007-08-01 00:09:31 +0000147 s390*)
bellardfb3e5842003-03-29 17:32:36 +0000148 cpu="s390"
149 ;;
blueswir131422552007-04-16 18:27:06 +0000150 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000151 cpu="sparc"
152 ;;
153 sparc64)
154 cpu="sparc64"
155 ;;
bellard7d132992003-03-06 23:23:54 +0000156 *)
157 cpu="unknown"
158 ;;
159esac
Juan Quintelaeb822842009-07-27 16:13:18 +0200160brlapi="yes"
bellard7d132992003-03-06 23:23:54 +0000161gprof="no"
aurel32f8393942009-04-13 18:45:38 +0000162debug_tcg="no"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100163debug="no"
aliguori03b4fe72008-10-07 19:16:17 +0000164sparse="no"
aliguori1625af82009-04-05 17:41:02 +0000165strip_opt="yes"
bellard7d132992003-03-06 23:23:54 +0000166bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000167mingw32="no"
168EXESUF=""
bellard443f1372004-06-04 11:13:20 +0000169slirp="yes"
aliguorie0e6c8c02008-07-23 18:14:33 +0000170vde="yes"
bellard102a52e2004-11-14 19:57:29 +0000171fmod_lib=""
172fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000173oss_lib=""
ths8d5d2d42007-08-25 01:37:51 +0000174vnc_tls="yes"
aliguori2f9606b2009-03-06 20:27:28 +0000175vnc_sasl="yes"
pbrookb1a550a2006-04-16 13:28:56 +0000176bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000177linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000178solaris="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000179kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000180profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000181cocoa="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000182softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000183linux_user="no"
184darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000185bsd_user="no"
Paul Brook379f6692009-07-17 12:48:08 +0100186guest_base=""
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500187build_docs="yes"
pbrookc5937222006-05-14 11:30:38 +0000188uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000189curses="yes"
Alexander Graf769ce762009-05-11 17:41:42 +0200190curl="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000191pthread="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000192aio="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000193io_thread="no"
pbrookbd0c5662008-05-29 14:34:11 +0000194nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000195mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000196bluez="yes"
Jan Kiszkadff840342009-06-14 20:05:02 +0200197kvm="no"
aliguorieac30262008-11-05 16:28:56 +0000198kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000199aix="no"
ths77755342008-11-27 15:45:16 +0000200blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000201fdt="yes"
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500202sdl="yes"
aliguorie37630c2009-04-22 15:19:10 +0000203xen="yes"
pbrook4a19f1e2009-04-07 23:17:49 +0000204pkgversion=""
bellard7d132992003-03-06 23:23:54 +0000205
206# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000207if check_define __linux__ ; then
208 targetos="Linux"
209elif check_define _WIN32 ; then
210 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000211elif check_define __OpenBSD__ ; then
212 targetos='OpenBSD'
213elif check_define __sun__ ; then
214 targetos='SunOS'
aliguoriac0df512008-12-29 17:14:15 +0000215else
216 targetos=`uname -s`
217fi
bellard7d132992003-03-06 23:23:54 +0000218case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000219CYGWIN*)
220mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000221OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000222if [ "$cpu" = "i386" ] ; then
223 kqemu="yes"
224fi
malcc2de5c92008-06-28 19:13:06 +0000225audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000226;;
bellard67b915a2004-03-31 23:37:16 +0000227MINGW32*)
228mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000229if [ "$cpu" = "i386" ] ; then
230 kqemu="yes"
231fi
malcc2de5c92008-06-28 19:13:06 +0000232audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000233;;
ths5c40d2b2007-06-23 16:03:36 +0000234GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000235audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000236audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000237if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
238 kqemu="yes"
239fi
240;;
bellard7d3505c2004-05-12 19:32:15 +0000241FreeBSD)
242bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000243audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000244audio_possible_drivers="oss sdl esd pa"
bellarde99f9062005-07-28 21:45:38 +0000245if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000246 kqemu="yes"
247fi
bellard7d3505c2004-05-12 19:32:15 +0000248;;
blueswir1c5e97232009-03-07 20:06:23 +0000249DragonFly)
250bsd="yes"
251audio_drv_list="oss"
252audio_possible_drivers="oss sdl esd pa"
253if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
254 kqemu="yes"
255fi
256aio="no"
257;;
bellard7d3505c2004-05-12 19:32:15 +0000258NetBSD)
259bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000260audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000261audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000262oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000263;;
264OpenBSD)
265bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000266audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000267audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000268oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000269;;
bellard83fb7ad2004-07-05 21:25:26 +0000270Darwin)
271bsd="yes"
272darwin="yes"
aliguori1b0f9cc2009-01-26 15:37:40 +0000273# 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 +0000274if [ "$cpu" = "i386" ] ; then
275 is_x86_64=`sysctl -n hw.optional.x86_64`
276 [ "$is_x86_64" = "1" ] && cpu=x86_64
aliguori1b0f9cc2009-01-26 15:37:40 +0000277fi
278if [ "$cpu" = "x86_64" ] ; then
279 OS_CFLAGS="-arch x86_64"
280 LDFLAGS="-arch x86_64"
281else
282 OS_CFLAGS="-mdynamic-no-pic"
283fi
ths831b7822007-01-18 20:06:33 +0000284darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000285cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000286audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000287audio_possible_drivers="coreaudio sdl fmod"
thsc2c59c32008-01-08 00:00:20 +0000288OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
bellard83fb7ad2004-07-05 21:25:26 +0000289;;
bellardec530c82006-04-25 22:36:06 +0000290SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000291 solaris="yes"
292 make="gmake"
293 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000294 needs_libsunmath="no"
thsc2b84fa2007-02-10 23:21:21 +0000295 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000296 # have to select again, because `uname -m` returns i86pc
297 # even on an x86_64 box.
298 solariscpu=`isainfo -k`
299 if test "${solariscpu}" = "amd64" ; then
300 cpu="x86_64"
301 fi
thsc2b84fa2007-02-10 23:21:21 +0000302 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000303 if test "$solarisrev" -le 9 ; then
304 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
305 needs_libsunmath="yes"
306 else
307 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
308 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
309 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
310 echo "Studio 11 can be downloaded from www.sun.com."
311 exit 1
312 fi
313 fi
314 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000315 kqemu="yes"
316 fi
ths86b2bd92007-02-11 00:31:33 +0000317 fi
ths6b4d2ba2007-05-13 18:02:43 +0000318 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000319 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000320 fi
malcc2de5c92008-06-28 19:13:06 +0000321 audio_possible_drivers="oss sdl"
blueswir114d483e2009-04-13 16:27:08 +0000322 OS_CFLAGS=-std=gnu99
ths86b2bd92007-02-11 00:31:33 +0000323;;
malcb29fe3e2008-11-18 01:42:22 +0000324AIX)
325aix="yes"
326make="gmake"
327;;
bellard1d14ffa2005-10-30 18:58:22 +0000328*)
malc0c58ac12008-06-25 21:04:05 +0000329audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000330audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000331linux="yes"
ths831b7822007-01-18 20:06:33 +0000332linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000333usb="linux"
Jan Kiszkadff840342009-06-14 20:05:02 +0200334kvm="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000335if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000336 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000337 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000338fi
bellardfb065182004-11-09 23:09:44 +0000339;;
bellard7d132992003-03-06 23:23:54 +0000340esac
341
bellard7d3505c2004-05-12 19:32:15 +0000342if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000343 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000344 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000345 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000346 fi
blueswir184778502008-10-26 20:33:16 +0000347 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000348fi
349
bellard7d132992003-03-06 23:23:54 +0000350# find source path
pbrookad064842006-04-16 12:41:07 +0000351source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000352source_path_used="no"
353workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000354if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000355 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000356else
357 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000358fi
pbrook724db112008-02-03 19:20:13 +0000359[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000360
Anthony Liguori487fefd2009-06-11 13:28:25 -0500361werror=""
bellard85aa5182007-11-11 20:17:03 +0000362
bellard7d132992003-03-06 23:23:54 +0000363for opt do
pbrooka46e4032006-04-29 23:05:22 +0000364 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000365 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000366 --help|-h) show_help=yes
367 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000368 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000369 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000370 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000371 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000372 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000373 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000374 ;;
aliguoriac0df512008-12-29 17:14:15 +0000375 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000376 ;;
aliguoriac0df512008-12-29 17:14:15 +0000377 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000378 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000379 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000380 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000381 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000382 ;;
pbrook6a882642006-04-17 13:57:12 +0000383 --install=*) install="$optarg"
384 ;;
Jan Kiszkae3fc14c2009-06-30 21:29:03 +0200385 --extra-cflags=*) EXTRA_CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000386 ;;
Jan Kiszkae3fc14c2009-06-30 21:29:03 +0200387 --extra-ldflags=*) EXTRA_LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000388 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000389 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000390 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000391 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000392 ;;
bellard7d132992003-03-06 23:23:54 +0000393 --enable-gprof) gprof="yes"
394 ;;
bellard43ce4df2003-06-09 19:53:12 +0000395 --static) static="yes"
396 ;;
bellard97a847b2003-08-10 21:36:04 +0000397 --disable-sdl) sdl="no"
398 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000399 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000400 ;;
malcc2de5c92008-06-28 19:13:06 +0000401 --fmod-inc=*) fmod_inc="$optarg"
402 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000403 --oss-lib=*) oss_lib="$optarg"
404 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000405 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000406 ;;
407 --audio-drv-list=*) audio_drv_list="$optarg"
408 ;;
aurel32f8393942009-04-13 18:45:38 +0000409 --enable-debug-tcg) debug_tcg="yes"
410 ;;
411 --disable-debug-tcg) debug_tcg="no"
412 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100413 --enable-debug)
414 # Enable debugging options that aren't excessively noisy
415 debug_tcg="yes"
416 debug="yes"
417 strip_opt="no"
418 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000419 --enable-sparse) sparse="yes"
420 ;;
421 --disable-sparse) sparse="no"
422 ;;
aliguori1625af82009-04-05 17:41:02 +0000423 --disable-strip) strip_opt="no"
424 ;;
ths8d5d2d42007-08-25 01:37:51 +0000425 --disable-vnc-tls) vnc_tls="no"
426 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000427 --disable-vnc-sasl) vnc_sasl="no"
428 ;;
bellard443f1372004-06-04 11:13:20 +0000429 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000430 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000431 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000432 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000433 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000434 ;;
aliguorie37630c2009-04-22 15:19:10 +0000435 --disable-xen) xen="no"
436 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000437 --disable-brlapi) brlapi="no"
438 ;;
balrogfb599c92008-09-28 23:49:55 +0000439 --disable-bluez) bluez="no"
440 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000441 --disable-kvm) kvm="no"
442 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000443 --enable-profiler) profiler="yes"
444 ;;
malcc2de5c92008-06-28 19:13:06 +0000445 --enable-cocoa)
446 cocoa="yes" ;
447 sdl="no" ;
448 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000449 ;;
pbrookcad25d62006-03-19 16:31:11 +0000450 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000451 ;;
pbrookcad25d62006-03-19 16:31:11 +0000452 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000453 ;;
ths831b7822007-01-18 20:06:33 +0000454 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000455 ;;
ths831b7822007-01-18 20:06:33 +0000456 --enable-linux-user) linux_user="yes"
457 ;;
458 --disable-darwin-user) darwin_user="no"
459 ;;
460 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000461 ;;
blueswir184778502008-10-26 20:33:16 +0000462 --disable-bsd-user) bsd_user="no"
463 ;;
464 --enable-bsd-user) bsd_user="yes"
465 ;;
Paul Brook379f6692009-07-17 12:48:08 +0100466 --enable-guest-base) guest_base="yes"
467 ;;
468 --disable-guest-base) guest_base="no"
469 ;;
pbrookc5937222006-05-14 11:30:38 +0000470 --enable-uname-release=*) uname_release="$optarg"
471 ;;
blueswir131422552007-04-16 18:27:06 +0000472 --sparc_cpu=*)
473 sparc_cpu="$optarg"
474 case $sparc_cpu in
Juan Quintelab2740512009-07-27 16:12:41 +0200475 v7|v8)
476 ARCH_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"
477 ARCH_LDFLAGS="-m32"
Juan Quintelab2740512009-07-27 16:12:41 +0200478 cpu="sparc"
479 ;;
480 v8plus|v8plusa)
481 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"
482 ARCH_LDFLAGS="-m32"
Juan Quintelab2740512009-07-27 16:12:41 +0200483 cpu="sparc"
484 ;;
485 v9)
486 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"
487 ARCH_LDFLAGS="-m64"
Juan Quintelab2740512009-07-27 16:12:41 +0200488 cpu="sparc64"
489 ;;
490 *)
491 echo "undefined SPARC architecture. Exiting";
492 exit 1
493 ;;
blueswir131422552007-04-16 18:27:06 +0000494 esac
495 ;;
bellard85aa5182007-11-11 20:17:03 +0000496 --enable-werror) werror="yes"
497 ;;
498 --disable-werror) werror="no"
499 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000500 --disable-curses) curses="no"
501 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200502 --disable-curl) curl="no"
503 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000504 --disable-nptl) nptl="no"
505 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000506 --enable-mixemu) mixemu="yes"
507 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000508 --disable-pthread) pthread="no"
509 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000510 --disable-aio) aio="no"
511 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000512 --enable-io-thread) io_thread="yes"
513 ;;
ths77755342008-11-27 15:45:16 +0000514 --disable-blobs) blobs="no"
515 ;;
aliguorieac30262008-11-05 16:28:56 +0000516 --kerneldir=*) kerneldir="$optarg"
517 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000518 --with-pkgversion=*) pkgversion=" ($optarg)"
519 ;;
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500520 --disable-docs) build_docs="no"
521 ;;
balrog7f1559c2007-11-17 10:24:32 +0000522 *) echo "ERROR: unknown option $opt"; show_help="yes"
523 ;;
bellard7d132992003-03-06 23:23:54 +0000524 esac
525done
526
ths6f30fa82007-01-05 01:00:47 +0000527# default flags for all hosts
Paul Brookf3d08ee2009-06-04 11:39:04 +0100528CFLAGS="$CFLAGS -g -fno-strict-aliasing"
529if test "$debug" = "no" ; then
530 CFLAGS="$CFLAGS -O2"
531fi
blueswir1e0e36fe2008-12-07 19:16:27 +0000532CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000533LDFLAGS="$LDFLAGS -g"
Blue Swirl1172f652009-06-13 15:37:55 +0000534
535# Consult white-list to determine whether to enable werror
536# by default. Only enable by default for git builds
537if test -z "$werror" ; then
538 z_version=`cut -f3 -d. $source_path/VERSION`
539 if test "$z_version" = "50" -a \
540 "$linux" = "yes" ; then
541 werror="yes"
542 else
543 werror="no"
544 fi
545fi
546
bellard85aa5182007-11-11 20:17:03 +0000547if test "$werror" = "yes" ; then
Blue Swirl1172f652009-06-13 15:37:55 +0000548 CFLAGS="$CFLAGS -Werror"
bellard85aa5182007-11-11 20:17:03 +0000549fi
ths6f30fa82007-01-05 01:00:47 +0000550
blueswir1d2c7c9b2008-11-01 14:50:20 +0000551if test "$solaris" = "no" ; then
552 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
553 LDFLAGS="$LDFLAGS -Wl,--warn-common"
554 fi
blueswir149237ac2008-09-17 19:05:19 +0000555fi
556
blueswir131422552007-04-16 18:27:06 +0000557#
558# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
559# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
560#
Paul Brook379f6692009-07-17 12:48:08 +0100561host_guest_base="no"
bellard40293e52008-01-31 11:32:10 +0000562case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000563 sparc) if test -z "$sparc_cpu" ; then
564 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
565 ARCH_LDFLAGS="-m32"
blueswir131422552007-04-16 18:27:06 +0000566 fi
blueswir1762e8232009-04-04 09:21:28 +0000567 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
568 if test "$solaris" = "no" ; then
569 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
570 fi
blueswir131422552007-04-16 18:27:06 +0000571 ;;
572 sparc64) if test -z "$sparc_cpu" ; then
573 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
574 ARCH_LDFLAGS="-m64"
blueswir131422552007-04-16 18:27:06 +0000575 fi
blueswir1762e8232009-04-04 09:21:28 +0000576 if test "$solaris" = "no" ; then
577 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
578 else
579 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
580 fi
blueswir131422552007-04-16 18:27:06 +0000581 ;;
ths76d83bd2007-11-18 21:22:10 +0000582 s390)
583 ARCH_CFLAGS="-march=z900"
584 ;;
bellard40293e52008-01-31 11:32:10 +0000585 i386)
586 ARCH_CFLAGS="-m32"
587 ARCH_LDFLAGS="-m32"
Paul Brook379f6692009-07-17 12:48:08 +0100588 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000589 ;;
590 x86_64)
591 ARCH_CFLAGS="-m64"
592 ARCH_LDFLAGS="-m64"
Paul Brook379f6692009-07-17 12:48:08 +0100593 host_guest_base="yes"
594 ;;
595 arm*)
596 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000597 ;;
malcf6548c02009-07-18 10:08:40 +0400598 ppc*)
599 host_guest_base="yes"
600 ;;
blueswir131422552007-04-16 18:27:06 +0000601esac
602
Paul Brook379f6692009-07-17 12:48:08 +0100603[ -z "$guest_base" ] && guest_base="$host_guest_base"
604
pbrookaf5db582006-04-08 14:26:41 +0000605if test x"$show_help" = x"yes" ; then
606cat << EOF
607
608Usage: configure [options]
609Options: [defaults in brackets after descriptions]
610
611EOF
612echo "Standard options:"
613echo " --help print this message"
614echo " --prefix=PREFIX install in PREFIX [$prefix]"
615echo " --interp-prefix=PREFIX where to find shared libraries, etc."
616echo " use %M for cpu name [$interp_prefix]"
617echo " --target-list=LIST set target list [$target_list]"
618echo ""
619echo "kqemu kernel acceleration support:"
620echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000621echo ""
622echo "Advanced options (experts only):"
623echo " --source-path=PATH path of source code [$source_path]"
624echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
625echo " --cc=CC use C compiler CC [$cc]"
626echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
Jan Kiszkae3fc14c2009-06-30 21:29:03 +0200627echo " --extra-cflags=CFLAGS append extra C compiler flags CFLAGS"
628echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000629echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000630echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000631echo " --static enable static build [$static]"
aurel32f8393942009-04-13 18:45:38 +0000632echo " --enable-debug-tcg enable TCG debugging"
633echo " --disable-debug-tcg disable TCG debugging (default)"
Stefan Weil09695a42009-06-06 16:51:30 +0200634echo " --enable-debug enable common debug build options"
aliguori890b1652008-10-07 21:22:41 +0000635echo " --enable-sparse enable sparse checker"
636echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000637echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000638echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000639echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000640echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000641echo " --audio-drv-list=LIST set audio drivers list:"
642echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000643echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
644echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000645echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000646echo " --disable-xen disable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000647echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000648echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000649echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000650echo " --disable-curses disable curses output"
Alexander Graf769ce762009-05-11 17:41:42 +0200651echo " --disable-curl disable curl connectivity"
balrogfb599c92008-09-28 23:49:55 +0000652echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000653echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000654echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000655echo " --enable-system enable all system emulation targets"
656echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000657echo " --enable-linux-user enable all linux usermode emulation targets"
658echo " --disable-linux-user disable all linux usermode emulation targets"
659echo " --enable-darwin-user enable all darwin usermode emulation targets"
660echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000661echo " --enable-bsd-user enable all BSD usermode emulation targets"
662echo " --disable-bsd-user disable all BSD usermode emulation targets"
Paul Brook379f6692009-07-17 12:48:08 +0100663echo " --enable-guest-base enable GUEST_BASE support for usermode"
664echo " emulation targets"
665echo " --disable-guest-base disable GUEST_BASE support"
pbrookaf5db582006-04-08 14:26:41 +0000666echo " --fmod-lib path to FMOD library"
667echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000668echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000669echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000670echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000671echo " --disable-vde disable support for vde network"
aliguorie5d355d2009-04-24 18:03:15 +0000672echo " --disable-pthread disable pthread support"
blueswir1414f0da2008-08-15 18:20:52 +0000673echo " --disable-aio disable AIO support"
aliguorie5d355d2009-04-24 18:03:15 +0000674echo " --enable-io-thread enable IO thread"
ths77755342008-11-27 15:45:16 +0000675echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000676echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000677echo ""
ths5bf08932006-12-23 00:33:26 +0000678echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000679exit 1
680fi
681
bellard67b915a2004-03-31 23:37:16 +0000682if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000683 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000684 EXESUF=".exe"
aliguoricd01b4a2008-08-21 19:25:45 +0000685 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000686 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000687 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000688fi
689
aliguori03b4fe72008-10-07 19:16:17 +0000690if test ! -x "$(which cgcc 2>/dev/null)"; then
691 sparse="no"
692fi
693
bellardec530c82006-04-25 22:36:06 +0000694#
695# Solaris specific configure tool chain decisions
696#
697if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000698 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
699 if test -z "$solinst" ; then
700 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
701 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
702 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
703 exit 1
704 fi
705 if test "$solinst" = "/usr/sbin/install" ; then
706 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
707 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
708 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
709 exit 1
710 fi
bellardec530c82006-04-25 22:36:06 +0000711 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
712 if test -z "$sol_ar" ; then
713 echo "Error: No path includes ar"
714 if test -f /usr/ccs/bin/ar ; then
715 echo "Add /usr/ccs/bin to your path and rerun configure"
716 fi
717 exit 1
718 fi
ths5fafdf22007-09-16 21:08:06 +0000719fi
bellardec530c82006-04-25 22:36:06 +0000720
721
bellard5327cf42005-01-10 23:18:50 +0000722if test -z "$target_list" ; then
723# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000724 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000725 target_list="\
726i386-softmmu \
727x86_64-softmmu \
728arm-softmmu \
729cris-softmmu \
730m68k-softmmu \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200731microblaze-softmmu \
aurel322408a522008-04-20 20:19:44 +0000732mips-softmmu \
733mipsel-softmmu \
734mips64-softmmu \
735mips64el-softmmu \
736ppc-softmmu \
737ppcemb-softmmu \
738ppc64-softmmu \
739sh4-softmmu \
740sh4eb-softmmu \
741sparc-softmmu \
Igor V. Kovalenko1b64fca2009-06-23 18:04:16 +0000742sparc64-softmmu \
aurel322408a522008-04-20 20:19:44 +0000743"
pbrook0a8e90f2006-03-19 14:54:16 +0000744 fi
bellard5327cf42005-01-10 23:18:50 +0000745# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000746 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000747 target_list="${target_list}\
748i386-linux-user \
749x86_64-linux-user \
750alpha-linux-user \
751arm-linux-user \
752armeb-linux-user \
753cris-linux-user \
754m68k-linux-user \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200755microblaze-linux-user \
aurel322408a522008-04-20 20:19:44 +0000756mips-linux-user \
757mipsel-linux-user \
758ppc-linux-user \
759ppc64-linux-user \
760ppc64abi32-linux-user \
761sh4-linux-user \
762sh4eb-linux-user \
763sparc-linux-user \
764sparc64-linux-user \
765sparc32plus-linux-user \
766"
ths831b7822007-01-18 20:06:33 +0000767 fi
768# the following are Darwin specific
769 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000770 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000771 fi
blueswir184778502008-10-26 20:33:16 +0000772# the following are BSD specific
773 if [ "$bsd_user" = "yes" ] ; then
774 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000775i386-bsd-user \
776x86_64-bsd-user \
777sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000778sparc64-bsd-user \
779"
780 fi
bellard6e20a452005-06-05 15:56:02 +0000781else
pbrookb1a550a2006-04-16 13:28:56 +0000782 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000783fi
pbrook0a8e90f2006-03-19 14:54:16 +0000784if test -z "$target_list" ; then
785 echo "No targets enabled"
786 exit 1
787fi
bellard5327cf42005-01-10 23:18:50 +0000788
bellard7d132992003-03-06 23:23:54 +0000789if test -z "$cross_prefix" ; then
790
791# ---
792# big/little endian test
793cat > $TMPC << EOF
794#include <inttypes.h>
795int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000796 volatile uint32_t i=0x01234567;
797 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000798}
799EOF
800
aurel32178baee2008-12-08 18:11:57 +0000801if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000802$TMPE && bigendian="yes"
803else
804echo big/little test failed
805fi
806
807else
808
809# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000810if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000811 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000812 -o "$cpu" = "m68k" \
813 -o "$cpu" = "mips" \
814 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000815 -o "$cpu" = "ppc" \
816 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000817 -o "$cpu" = "s390" \
818 -o "$cpu" = "sparc" \
819 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000820 bigendian="yes"
821fi
822
823fi
824
bellardb6853692005-06-05 17:10:39 +0000825# host long bits test
826hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000827if test "$cpu" = "x86_64" \
828 -o "$cpu" = "alpha" \
829 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000830 -o "$cpu" = "sparc64" \
831 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000832 hostlongbits="64"
833fi
834
pbrookbd0c5662008-05-29 14:34:11 +0000835# Check host NPTL support
836cat > $TMPC <<EOF
837#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000838#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000839void foo()
840{
841#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
842#error bork
843#endif
844}
845EOF
846
balrog8c7f7572008-12-15 03:15:36 +0000847if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000848 :
849else
850 nptl="no"
851fi
852
bellard11d9f692004-04-02 20:55:59 +0000853##########################################
balrogac629222008-10-11 09:56:04 +0000854# zlib check
855
856cat > $TMPC << EOF
857#include <zlib.h>
858int main(void) { zlibVersion(); return 0; }
859EOF
balrog8c7f7572008-12-15 03:15:36 +0000860if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000861 :
862else
863 echo
864 echo "Error: zlib check failed"
865 echo "Make sure to have the zlib libs and headers installed."
866 echo
867 exit 1
868fi
869
870##########################################
aliguorie37630c2009-04-22 15:19:10 +0000871# xen probe
872
873if test "$xen" = "yes" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +0200874 xen_libs="-lxenstore -lxenctrl -lxenguest"
875 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +0000876#include <xenctrl.h>
877#include <xs.h>
Christoph Eggerdf7a6072009-06-30 14:59:38 +0200878int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
aliguorie37630c2009-04-22 15:19:10 +0000879EOF
Christoph Eggerac8ab732009-07-30 15:33:57 +0200880 if $cc $CFLAGS $ARCH_CFLAGS $EXTRA_CFLAGS -c -o $TMPO $TMPC $LDFLAGS $EXTRA_LDFLAGS $xen_libs 2> /dev/null > /dev/null ; then
Juan Quintelab2266be2009-07-27 16:13:16 +0200881 :
882 else
883 xen="no"
884 fi
aliguorie37630c2009-04-22 15:19:10 +0000885fi
886
887##########################################
bellard11d9f692004-04-02 20:55:59 +0000888# SDL probe
889
890sdl_too_old=no
891
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500892if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +0200893 sdl=no
894 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +0000895#include <SDL.h>
896#undef main /* We don't want SDL to override our main() */
897int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
898EOF
Juan Quintelaac119f92009-07-27 16:13:15 +0200899 sdl_cflags=`sdl-config --cflags 2> /dev/null`
900 sdl_libs=`sdl-config --libs 2> /dev/null`
901 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > $TMPSDLLOG 2>&1 ; then
902 _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
903 if test "$_sdlversion" -lt 121 ; then
904 sdl_too_old=yes
905 else
906 if test "$cocoa" = "no" ; then
907 sdl=yes
908 fi
909 fi
aliguoricd01b4a2008-08-21 19:25:45 +0000910
Juan Quintelaac119f92009-07-27 16:13:15 +0200911 # static link with sdl ?
912 if test "$sdl" = "yes" -a "$static" = "yes" ; then
913 sdl_libs=`sdl-config --static-libs 2>/dev/null`
914 if test `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` ; then
915 sdl_libs="$sdl_libs `aalib-config --static-libs >2 /dev/null`"
916 sdl_cflags="$sd_cflags `aalib-config --cflags >2 /dev/null`"
917 fi
918 if $cc -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > /dev/null 2> /dev/null; then
919 :
920 else
921 sdl=no
922 fi
923 fi # static link
924 fi # sdl compile test
Juan Quintelaa68551b2009-07-27 16:13:09 +0200925fi
bellard11d9f692004-04-02 20:55:59 +0000926
aliguori5368a422009-03-03 17:37:21 +0000927if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +0200928 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +0000929#include <SDL.h>
930#if defined(SDL_VIDEO_DRIVER_X11)
931#include <X11/XKBlib.h>
932#else
933#error No x11 support
934#endif
935int main(void) { return 0; }
936EOF
Juan Quintelaac119f92009-07-27 16:13:15 +0200937 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > /dev/null 2>&1 ; then
938 sdl_libs="$sdl_libs -lX11"
939 fi
aliguori5368a422009-03-03 17:37:21 +0000940fi
941
ths8f28f3f2007-01-05 21:25:54 +0000942##########################################
ths8d5d2d42007-08-25 01:37:51 +0000943# VNC TLS detection
944if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000945cat > $TMPC <<EOF
946#include <gnutls/gnutls.h>
947int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
948EOF
949 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
950 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
951 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000952 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000953 :
954 else
955 vnc_tls="no"
956 fi
ths8d5d2d42007-08-25 01:37:51 +0000957fi
958
959##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000960# VNC SASL detection
961if test "$vnc_sasl" = "yes" ; then
962cat > $TMPC <<EOF
963#include <sasl/sasl.h>
964#include <stdio.h>
965int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
966EOF
967 # Assuming Cyrus-SASL installed in /usr prefix
968 vnc_sasl_cflags=""
969 vnc_sasl_libs="-lsasl2"
970 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
Jan Kiszka918a6082009-04-27 17:16:55 +0000971 $vnc_sasl_libs 2> /dev/null > /dev/null ; then
aliguori2f9606b2009-03-06 20:27:28 +0000972 :
973 else
974 vnc_sasl="no"
975 fi
976fi
977
978##########################################
aliguori76655d62009-03-06 20:27:37 +0000979# fnmatch() probe, used for ACL routines
980fnmatch="no"
981cat > $TMPC << EOF
982#include <fnmatch.h>
983int main(void)
984{
985 fnmatch("foo", "foo", 0);
986 return 0;
987}
988EOF
989if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
990 fnmatch="yes"
991fi
992
993##########################################
ths8a16d272008-07-19 09:56:24 +0000994# vde libraries probe
995if test "$vde" = "yes" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +0200996 vde=no
997 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +0000998 cat > $TMPC << EOF
999#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00001000int main(void)
1001{
1002 struct vde_open_args a = {0, 0, 0};
1003 vde_open("", "", &a);
1004 return 0;
1005}
ths8a16d272008-07-19 09:56:24 +00001006EOF
Juan Quintela4baae0a2009-07-27 16:13:19 +02001007 if $cc $ARCH_CFLAGS -o $TMPE $TMPC $vde_libs > /dev/null 2> /dev/null ; then
1008 vde=yes
1009 fi
ths8a16d272008-07-19 09:56:24 +00001010fi
1011
1012##########################################
malcc2de5c92008-06-28 19:13:06 +00001013# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00001014
malcc2de5c92008-06-28 19:13:06 +00001015audio_drv_probe()
1016{
1017 drv=$1
1018 hdr=$2
1019 lib=$3
1020 exp=$4
1021 cfl=$5
1022 cat > $TMPC << EOF
1023#include <$hdr>
1024int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00001025EOF
balrog8c7f7572008-12-15 03:15:36 +00001026 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +00001027 :
1028 else
1029 echo
1030 echo "Error: $drv check failed"
1031 echo "Make sure to have the $drv libs and headers installed."
1032 echo
1033 exit 1
1034 fi
1035}
1036
malc2fa7d3b2008-07-29 12:58:44 +00001037audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00001038for drv in $audio_drv_list; do
1039 case $drv in
1040 alsa)
1041 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1042 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1043 ;;
1044
1045 fmod)
1046 if test -z $fmod_lib || test -z $fmod_inc; then
1047 echo
1048 echo "Error: You must specify path to FMOD library and headers"
1049 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1050 echo
1051 exit 1
1052 fi
1053 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1054 ;;
1055
1056 esd)
1057 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1058 ;;
malcb8e59f12008-07-02 21:03:08 +00001059
1060 pa)
1061 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1062 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1063 ;;
1064
blueswir12f6a1ab2008-08-21 18:00:53 +00001065 oss|sdl|core|wav|dsound)
1066 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1067 ;;
1068
malce4c63a62008-07-19 16:15:16 +00001069 *)
malc1c9b2a52008-07-19 16:57:30 +00001070 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001071 echo
1072 echo "Error: Unknown driver '$drv' selected"
1073 echo "Possible drivers are: $audio_possible_drivers"
1074 echo
1075 exit 1
1076 }
1077 ;;
malcc2de5c92008-06-28 19:13:06 +00001078 esac
1079done
ths8f28f3f2007-01-05 21:25:54 +00001080
balrog4d3b6f62008-02-10 16:33:14 +00001081##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001082# BrlAPI probe
1083
Juan Quintelaeb822842009-07-27 16:13:18 +02001084if test "$brlapi" = "yes" ; then
1085 brlapi=no
1086 brlapi_libs="-lbrlapi"
1087 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00001088#include <brlapi.h>
1089int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1090EOF
Juan Quintelaeb822842009-07-27 16:13:18 +02001091 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC $brlapi_libs > /dev/null 2> /dev/null ; then
1092 brlapi=yes
1093 fi
1094fi
aurel322e4d9fb2008-04-08 06:01:02 +00001095
1096##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001097# curses probe
1098
1099if test "$curses" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001100 cat > $TMPC << EOF
1101#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001102#ifdef __OpenBSD__
1103#define resize_term resizeterm
1104#endif
1105int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001106EOF
Jan Kiszkaab4e5602009-06-24 12:29:11 +02001107 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lncurses > /dev/null 2> /dev/null ; then
Juan Quintelae0b7a422009-07-27 16:13:17 +02001108 curses_libs="-lncurses"
Jan Kiszkaab4e5602009-06-24 12:29:11 +02001109 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
Juan Quintelae0b7a422009-07-27 16:13:17 +02001110 curses_libs="-lcurses"
1111 else
1112 curses=no
balrog4d3b6f62008-02-10 16:33:14 +00001113 fi
1114fi # test "$curses"
1115
blueswir1414f0da2008-08-15 18:20:52 +00001116##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001117# curl probe
1118
1119if test "$curl" = "yes" ; then
1120 curl=no
1121 cat > $TMPC << EOF
1122#include <curl/curl.h>
1123int main(void) { return curl_easy_init(); }
1124EOF
Paul Brook52368552009-05-22 17:22:38 +01001125 curl_libs=`curl-config --libs 2>/dev/null`
Alexander Graf769ce762009-05-11 17:41:42 +02001126 if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1127 curl=yes
1128 fi
1129fi # test "$curl"
1130
1131##########################################
balrogfb599c92008-09-28 23:49:55 +00001132# bluez support probe
1133if test "$bluez" = "yes" ; then
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001134 `pkg-config bluez 2> /dev/null` || bluez="no"
balrogfb599c92008-09-28 23:49:55 +00001135fi
1136if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001137 cat > $TMPC << EOF
1138#include <bluetooth/bluetooth.h>
1139int main(void) { return bt_error(0); }
1140EOF
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001141 bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1142 bluez_libs=`pkg-config --libs bluez 2> /dev/null`
balrog17e15922008-10-11 12:00:42 +00001143 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001144 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001145 :
1146 else
1147 bluez="no"
1148 fi
balrogfb599c92008-09-28 23:49:55 +00001149fi
1150
1151##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001152# kvm probe
1153if test "$kvm" = "yes" ; then
1154 cat > $TMPC <<EOF
1155#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001156#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001157#error Invalid KVM version
1158#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001159#if !defined(KVM_CAP_USER_MEMORY)
1160#error Missing KVM capability KVM_CAP_USER_MEMORY
1161#endif
1162#if !defined(KVM_CAP_SET_TSS_ADDR)
1163#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1164#endif
1165#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1166#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1167#endif
aliguori7ba1e612008-11-05 16:04:33 +00001168int main(void) { return 0; }
1169EOF
aliguorieac30262008-11-05 16:28:56 +00001170 if test "$kerneldir" != "" ; then
1171 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001172 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1173 -a -d "$kerneldir/arch/x86/include" ; then
1174 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001175 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1176 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001177 elif test -d "$kerneldir/arch/$cpu/include" ; then
1178 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1179 fi
aliguorieac30262008-11-05 16:28:56 +00001180 else
1181 kvm_cflags=""
1182 fi
aliguori7ba1e612008-11-05 16:04:33 +00001183 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001184 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001185 :
1186 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001187 kvm="no";
1188 if [ -x "`which awk 2>/dev/null`" ] && \
1189 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001190 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001191 | grep "error: " \
1192 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1193 if test "$kvmerr" != "" ; then
Jan Kiszka168ccc12009-06-07 11:30:25 +02001194 kvm="no - (${kvmerr})\n\
1195 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1196recent kvm-kmod from http://sourceforge.net/projects/kvm."
aliguori9fd8d8d2009-01-15 21:57:30 +00001197 fi
1198 fi
aliguori7ba1e612008-11-05 16:04:33 +00001199 fi
1200fi
1201
1202##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001203# pthread probe
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001204PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
aliguorie5d355d2009-04-24 18:03:15 +00001205PTHREADLIBS=""
aliguori3c529d92008-12-12 16:41:40 +00001206
aliguorie5d355d2009-04-24 18:03:15 +00001207if test "$pthread" = yes; then
1208 pthread=no
1209cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001210#include <pthread.h>
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001211int main(void) { pthread_create(0,0,0,0); return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001212EOF
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001213 for pthread_lib in $PTHREADLIBS_LIST; do
1214 if $cc $ARCH_CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null > /dev/null ; then
1215 pthread=yes
1216 PTHREADLIBS="$pthread_lib"
1217 break
1218 fi
1219 done
blueswir1414f0da2008-08-15 18:20:52 +00001220fi
1221
aliguorie5d355d2009-04-24 18:03:15 +00001222if test "$pthread" = no; then
1223 aio=no
1224 io_thread=no
1225fi
1226
aliguoribf9298b2008-12-05 20:05:26 +00001227##########################################
1228# iovec probe
1229cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001230#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001231#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001232#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001233int main(void) { struct iovec iov; return 0; }
1234EOF
1235iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001236if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001237 iovec=yes
1238fi
1239
aurel32f652e6a2008-12-16 10:43:48 +00001240##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001241# preadv probe
1242cat > $TMPC <<EOF
1243#include <sys/types.h>
1244#include <sys/uio.h>
1245#include <unistd.h>
1246int main(void) { preadv; }
1247EOF
1248preadv=no
1249if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1250 preadv=yes
1251fi
1252
1253##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001254# fdt probe
1255if test "$fdt" = "yes" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02001256 fdt=no
1257 fdt_libs="-lfdt"
1258 cat > $TMPC << EOF
aurel32f652e6a2008-12-16 10:43:48 +00001259int main(void) { return 0; }
1260EOF
Juan Quintelab41af4b2009-07-27 16:13:20 +02001261 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC $fdt_libs 2> /dev/null > /dev/null ; then
aurel32f652e6a2008-12-16 10:43:48 +00001262 fdt=yes
1263 fi
1264fi
1265
aurel323b3f24a2009-04-15 16:12:13 +00001266#
1267# Check for xxxat() functions when we are building linux-user
1268# emulator. This is done because older glibc versions don't
1269# have syscall stubs for these implemented.
1270#
1271atfile=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03001272cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00001273#define _ATFILE_SOURCE
1274#include <sys/types.h>
1275#include <fcntl.h>
1276#include <unistd.h>
1277
1278int
1279main(void)
1280{
1281 /* try to unlink nonexisting file */
1282 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1283}
1284EOF
Riku Voipio67ba57f2009-06-29 17:26:11 +03001285if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
1286 atfile=yes
aurel323b3f24a2009-04-15 16:12:13 +00001287fi
1288
aurel3239386ac2009-04-15 19:48:17 +00001289# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001290# emulator. This is done because older glibc versions don't
1291# have syscall stubs for these implemented. In that case we
1292# don't provide them even if kernel supports them.
1293#
1294inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03001295cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00001296#include <sys/inotify.h>
1297
1298int
1299main(void)
1300{
1301 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001302 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001303}
1304EOF
Riku Voipio67ba57f2009-06-29 17:26:11 +03001305if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
1306 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00001307fi
1308
Riku Voipioebc996f2009-04-21 15:01:51 +03001309# check if utimensat and futimens are supported
1310utimens=no
1311cat > $TMPC << EOF
1312#define _ATFILE_SOURCE
1313#define _GNU_SOURCE
1314#include <stddef.h>
1315#include <fcntl.h>
1316
1317int main(void)
1318{
1319 utimensat(AT_FDCWD, "foo", NULL, 0);
1320 futimens(0, NULL);
1321 return 0;
1322}
1323EOF
1324if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1325 utimens=yes
1326fi
1327
Riku Voipio099d6b02009-05-05 12:10:04 +03001328# check if pipe2 is there
1329pipe2=no
1330cat > $TMPC << EOF
1331#define _GNU_SOURCE
1332#include <unistd.h>
1333#include <fcntl.h>
1334
1335int main(void)
1336{
1337 int pipefd[2];
1338 pipe2(pipefd, O_CLOEXEC);
1339 return 0;
1340}
1341EOF
1342if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1343 pipe2=yes
1344fi
1345
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301346# check if tee/splice is there. vmsplice was added same time.
1347splice=no
1348cat > $TMPC << EOF
1349#define _GNU_SOURCE
1350#include <unistd.h>
1351#include <fcntl.h>
1352#include <limits.h>
1353
1354int main(void)
1355{
1356 int len, fd;
1357 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1358 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1359 return 0;
1360}
1361EOF
1362if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1363 splice=yes
1364fi
1365
pbrookcc8ae6d2006-04-23 17:57:59 +00001366# Check if tools are available to build documentation.
Anthony Liguori70ec5dc2009-05-14 08:25:04 -05001367if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
1368 build_docs="no"
pbrookcc8ae6d2006-04-23 17:57:59 +00001369fi
1370
aliguorida93a1f2008-12-12 20:02:52 +00001371##########################################
1372# Do we need librt
aliguorie5d355d2009-04-24 18:03:15 +00001373CLOCKLIBS=""
aliguorida93a1f2008-12-12 20:02:52 +00001374cat > $TMPC <<EOF
1375#include <signal.h>
1376#include <time.h>
1377int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1378EOF
1379
1380rt=no
balrog8c7f7572008-12-15 03:15:36 +00001381if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001382 :
balrog8c7f7572008-12-15 03:15:36 +00001383elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001384 rt=yes
1385fi
1386
1387if test "$rt" = "yes" ; then
aliguorie5d355d2009-04-24 18:03:15 +00001388 CLOCKLIBS="-lrt"
aliguorida93a1f2008-12-12 20:02:52 +00001389fi
1390
bellard11d9f692004-04-02 20:55:59 +00001391if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001392 if test -z "$prefix" ; then
Stefan Weil55418b92009-07-31 21:30:45 +02001393 prefix="c:/Program Files/Qemu"
pbrook308c3592007-02-27 00:52:01 +00001394 fi
1395 mansuffix=""
1396 datasuffix=""
1397 docsuffix=""
1398 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001399else
pbrook308c3592007-02-27 00:52:01 +00001400 if test -z "$prefix" ; then
1401 prefix="/usr/local"
1402 fi
1403 mansuffix="/share/man"
1404 datasuffix="/share/qemu"
1405 docsuffix="/share/doc/qemu"
1406 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001407fi
bellard5a671352003-10-01 00:13:48 +00001408
bellard43ce4df2003-06-09 19:53:12 +00001409echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001410echo "BIOS directory $prefix$datasuffix"
1411echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001412if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001413echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001414echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001415fi
bellard5a671352003-10-01 00:13:48 +00001416echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001417echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001418echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001419echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001420echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001421echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001422echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001423echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001424echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00001425echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00001426echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001427echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001428echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001429echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001430echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001431echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001432if test "$darwin" = "yes" ; then
1433 echo "Cocoa support $cocoa"
1434fi
bellard97a847b2003-08-10 21:36:04 +00001435echo "SDL support $sdl"
balrog4d3b6f62008-02-10 16:33:14 +00001436echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02001437echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00001438echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001439echo "Audio drivers $audio_drv_list"
1440echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001441echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001442echo "VNC TLS support $vnc_tls"
1443if test "$vnc_tls" = "yes" ; then
1444 echo " TLS CFLAGS $vnc_tls_cflags"
1445 echo " TLS LIBS $vnc_tls_libs"
1446fi
aliguori2f9606b2009-03-06 20:27:28 +00001447echo "VNC SASL support $vnc_sasl"
1448if test "$vnc_sasl" = "yes" ; then
1449 echo " SASL CFLAGS $vnc_sasl_cflags"
1450 echo " SASL LIBS $vnc_sasl_libs"
1451fi
blueswir131422552007-04-16 18:27:06 +00001452if test -n "$sparc_cpu"; then
1453 echo "Target Sparc Arch $sparc_cpu"
1454fi
bellard07f4ddb2005-04-23 17:44:28 +00001455echo "kqemu support $kqemu"
aliguorie37630c2009-04-22 15:19:10 +00001456echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00001457echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001458echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001459[ ! -z "$uname_release" ] && \
1460echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001461echo "NPTL support $nptl"
Paul Brook379f6692009-07-17 12:48:08 +01001462echo "GUEST_BASE $guest_base"
ths8a16d272008-07-19 09:56:24 +00001463echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001464echo "AIO support $aio"
aliguorie5d355d2009-04-24 18:03:15 +00001465echo "IO thread $io_thread"
ths77755342008-11-27 15:45:16 +00001466echo "Install blobs $blobs"
Jan Kiszka168ccc12009-06-07 11:30:25 +02001467echo -e "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001468echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001469echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001470
bellard97a847b2003-08-10 21:36:04 +00001471if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001472echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001473fi
bellard97a847b2003-08-10 21:36:04 +00001474
Juan Quintela98ec69a2009-07-16 18:34:18 +02001475config_host_mak="config-host.mak"
1476config_host_h="config-host.h"
Juan Quintela4bf6b552009-07-22 22:37:40 +02001477config_host_ld="config-host.ld"
bellard97a847b2003-08-10 21:36:04 +00001478
Juan Quintela98ec69a2009-07-16 18:34:18 +02001479#echo "Creating $config_host_mak and $config_host_h"
ths15d9ca02007-07-31 23:07:32 +00001480
Juan Quintela98ec69a2009-07-16 18:34:18 +02001481test -f $config_host_h && mv $config_host_h ${config_host_h}~
bellard97a847b2003-08-10 21:36:04 +00001482
Juan Quintela98ec69a2009-07-16 18:34:18 +02001483echo "# Automatically generated by configure - do not modify" > $config_host_mak
1484printf "# Configured with:" >> $config_host_mak
1485printf " '%s'" "$0" "$@" >> $config_host_mak
1486echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02001487
Juan Quintela2358a492009-07-27 16:13:25 +02001488echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02001489
aurel322408a522008-04-20 20:19:44 +00001490case "$cpu" in
Andrzej Zaborowskic62bbcd2009-07-18 14:32:00 +02001491 i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|sparc|sparc64)
Juan Quintelae0da9dd2009-07-16 18:34:09 +02001492 ARCH=$cpu
aurel322408a522008-04-20 20:19:44 +00001493 ;;
Laurent Desnoguesa302c322009-07-18 14:23:39 +02001494 armv4b|armv4l)
Juan Quintela16dbd142009-07-16 18:34:08 +02001495 ARCH=arm
aurel322408a522008-04-20 20:19:44 +00001496 ;;
aurel322408a522008-04-20 20:19:44 +00001497 *)
1498 echo "Unsupported CPU = $cpu"
1499 exit 1
1500 ;;
1501esac
Juan Quintela98ec69a2009-07-16 18:34:18 +02001502echo "ARCH=$ARCH" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00001503if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001504 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00001505fi
Paul Brookf3d08ee2009-06-04 11:39:04 +01001506if test "$debug" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001507 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
Paul Brookf3d08ee2009-06-04 11:39:04 +01001508fi
aliguori1625af82009-04-05 17:41:02 +00001509if test "$strip_opt" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001510 echo "STRIP_OPT=-s" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00001511fi
bellard7d132992003-03-06 23:23:54 +00001512if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02001513 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00001514fi
Juan Quintela2358a492009-07-27 16:13:25 +02001515echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00001516if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001517 echo "CONFIG_WIN32=y" >> $config_host_mak
pbrook210fa552007-02-27 21:04:49 +00001518else
Juan Quintela35f4df22009-07-27 16:13:07 +02001519 echo "CONFIG_POSIX=y" >> $config_host_mak
pbrook210fa552007-02-27 21:04:49 +00001520 cat > $TMPC << EOF
1521#include <byteswap.h>
1522int main(void) { return bswap_32(0); }
1523EOF
aurel32178baee2008-12-08 18:11:57 +00001524 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001525 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
pbrook210fa552007-02-27 21:04:49 +00001526 fi
blueswir113606772008-12-05 17:54:09 +00001527 cat > $TMPC << EOF
1528#include <sys/endian.h>
1529#include <sys/types.h>
1530#include <machine/bswap.h>
1531int main(void) { return bswap32(0); }
1532EOF
aurel32178baee2008-12-08 18:11:57 +00001533 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001534 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
blueswir113606772008-12-05 17:54:09 +00001535 fi
bellard67b915a2004-03-31 23:37:16 +00001536fi
blueswir1128ab2f2008-08-15 18:33:42 +00001537
bellard83fb7ad2004-07-05 21:25:26 +00001538if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001539 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00001540fi
malcb29fe3e2008-11-18 01:42:22 +00001541
1542if test "$aix" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001543 echo "CONFIG_AIX=y" >> $config_host_mak
malcb29fe3e2008-11-18 01:42:22 +00001544fi
1545
bellardec530c82006-04-25 22:36:06 +00001546if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001547 echo "CONFIG_SOLARIS=y" >> $config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02001548 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00001549 if test "$needs_libsunmath" = "yes" ; then
Juan Quintela75b5a692009-07-27 16:13:23 +02001550 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00001551 fi
bellardec530c82006-04-25 22:36:06 +00001552fi
blueswir131422552007-04-16 18:27:06 +00001553if test -n "$sparc_cpu"; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001554 echo "CONFIG__sparc_${sparc_cpu}__=y" >> $config_host_mak
blueswir131422552007-04-16 18:27:06 +00001555fi
bellard97a847b2003-08-10 21:36:04 +00001556if test "$gprof" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001557 echo "TARGET_GPROF=yes" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00001558fi
1559if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001560 echo "CONFIG_STATIC=y" >> $config_host_mak
Juan Quintela67c0f082009-07-27 16:12:51 +02001561 LDFLAGS="$LDFLAGS -static"
bellard97a847b2003-08-10 21:36:04 +00001562fi
bellard05c2a3e2006-02-08 22:39:17 +00001563if test $profiler = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001564 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00001565fi
bellardc20709a2004-04-21 23:27:19 +00001566if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001567 echo "CONFIG_SLIRP=y" >> $config_host_mak
bellardc20709a2004-04-21 23:27:19 +00001568fi
ths8a16d272008-07-19 09:56:24 +00001569if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001570 echo "CONFIG_VDE=y" >> $config_host_mak
Juan Quintela4baae0a2009-07-27 16:13:19 +02001571 echo "VDE_LIBS=$vde_libs" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00001572fi
malc0c58ac12008-06-25 21:04:05 +00001573for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001574 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02001575 echo "$def=y" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00001576done
Juan Quintela2358a492009-07-27 16:13:25 +02001577echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00001578for drv in $audio_drv_list; do
pbrookf6e58892008-06-29 01:00:34 +00001579 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02001580 echo "$def=y" >> $config_host_mak
malc923e4522008-07-02 18:13:46 +00001581 if test "$drv" = "fmod"; then
Juan Quintela7aac6cb2009-07-27 16:12:47 +02001582 echo "FMOD_LIBS=$fmod_lib" >> $config_host_mak
1583 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001584 elif test "$drv" = "oss"; then
Juan Quintela68819642009-07-27 16:12:48 +02001585 echo "OSS_LIBS=$oss_lib" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00001586 fi
1587done
malc8ff9cbf2008-06-23 18:33:30 +00001588if test "$mixemu" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001589 echo "CONFIG_MIXEMU=y" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00001590fi
ths8d5d2d42007-08-25 01:37:51 +00001591if test "$vnc_tls" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001592 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
Juan Quintela525061b2009-07-27 16:12:43 +02001593 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
1594 echo "VNC_TLS_LIBS=$vnc_tls_libs" >> $config_host_mak
ths8d5d2d42007-08-25 01:37:51 +00001595fi
aliguori2f9606b2009-03-06 20:27:28 +00001596if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001597 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
Juan Quintela60ddf532009-07-27 16:12:45 +02001598 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
1599 echo "VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00001600fi
aliguori76655d62009-03-06 20:27:37 +00001601if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001602 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00001603fi
pbrookb1a550a2006-04-16 13:28:56 +00001604qemu_version=`head $source_path/VERSION`
Juan Quintela98ec69a2009-07-16 18:34:18 +02001605echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02001606echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02001607echo "SRC_PATH=$source_path" >> $config_host_mak
pbrookad064842006-04-16 12:41:07 +00001608if [ "$source_path_used" = "yes" ]; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001609 echo "VPATH=$source_path" >> $config_host_mak
pbrookad064842006-04-16 12:41:07 +00001610fi
Juan Quintela98ec69a2009-07-16 18:34:18 +02001611echo "TARGET_DIRS=$target_list" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001612if [ "$build_docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001613 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001614fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02001615if test "$sdl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001616 echo "CONFIG_SDL=y" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02001617 echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
1618 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00001619fi
1620if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001621 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00001622fi
1623if test "$curses" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001624 echo "CONFIG_CURSES=y" >> $config_host_mak
Juan Quintelae0b7a422009-07-27 16:13:17 +02001625 echo "CURSES_LIBS=$curses_libs" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00001626fi
aurel323b3f24a2009-04-15 16:12:13 +00001627if test "$atfile" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001628 echo "CONFIG_ATFILE=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00001629fi
Riku Voipioebc996f2009-04-21 15:01:51 +03001630if test "$utimens" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001631 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
Riku Voipioebc996f2009-04-21 15:01:51 +03001632fi
Riku Voipio099d6b02009-05-05 12:10:04 +03001633if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001634 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03001635fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301636if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001637 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301638fi
aurel323b3f24a2009-04-15 16:12:13 +00001639if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001640 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00001641fi
Alexander Graf769ce762009-05-11 17:41:42 +02001642if test "$curl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001643 echo "CONFIG_CURL=y" >> $config_host_mak
1644 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02001645fi
aurel322e4d9fb2008-04-08 06:01:02 +00001646if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001647 echo "CONFIG_BRLAPI=y" >> $config_host_mak
Juan Quintelaeb822842009-07-27 16:13:18 +02001648 echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00001649fi
balrogfb599c92008-09-28 23:49:55 +00001650if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001651 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02001652 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
1653 echo "BLUEZ_LIBS=$bluez_libs" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00001654fi
aliguorie37630c2009-04-22 15:19:10 +00001655if test "$xen" = "yes" ; then
Juan Quintela5647eb72009-07-27 16:13:21 +02001656 echo "CONFIG_XEN=y" >> $config_host_mak
Juan Quintelab2266be2009-07-27 16:13:16 +02001657 echo "XEN_LIBS=$xen_libs" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00001658fi
blueswir1414f0da2008-08-15 18:20:52 +00001659if test "$aio" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001660 echo "CONFIG_AIO=y" >> $config_host_mak
blueswir1414f0da2008-08-15 18:20:52 +00001661fi
aliguorie5d355d2009-04-24 18:03:15 +00001662if test "$io_thread" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001663 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
aliguorie5d355d2009-04-24 18:03:15 +00001664fi
ths77755342008-11-27 15:45:16 +00001665if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02001666 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00001667fi
aliguoribf9298b2008-12-05 20:05:26 +00001668if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001669 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00001670fi
aliguoriceb42de2009-04-07 18:43:28 +00001671if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001672 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00001673fi
aurel32f652e6a2008-12-16 10:43:48 +00001674if test "$fdt" = "yes" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02001675 echo "CONFIG_FDT=y" >> $config_host_mak
Juan Quintelab41af4b2009-07-27 16:13:20 +02001676 echo "FDT_LIBS=$fdt_libs" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00001677fi
bellard97a847b2003-08-10 21:36:04 +00001678
bellard83fb7ad2004-07-05 21:25:26 +00001679# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001680if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02001681 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00001682fi
1683
Juan Quintela2358a492009-07-27 16:13:25 +02001684echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
pbrookc5937222006-05-14 11:30:38 +00001685
blueswir168063642008-11-22 21:03:55 +00001686# USB host support
1687case "$usb" in
1688linux)
Juan Quintela98ec69a2009-07-16 18:34:18 +02001689 echo "HOST_USB=linux" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00001690;;
1691bsd)
Juan Quintela98ec69a2009-07-16 18:34:18 +02001692 echo "HOST_USB=bsd" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00001693;;
1694*)
Juan Quintela98ec69a2009-07-16 18:34:18 +02001695 echo "HOST_USB=stub" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00001696;;
1697esac
1698
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001699# Determine what linker flags to use to force archive inclusion
1700check_linker_flags()
1701{
Anthony Liguori08b9d662009-06-18 13:31:51 -05001702 w2=
1703 if test "$2" ; then
1704 w2=-Wl,$2
1705 fi
1706 $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 ${w2} >/dev/null 2>/dev/null
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001707}
1708
1709cat > $TMPC << EOF
1710int main(void) { }
1711EOF
1712if check_linker_flags --whole-archive --no-whole-archive ; then
1713 # GNU ld
Juan Quintela98ec69a2009-07-16 18:34:18 +02001714 echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_host_mak
1715 echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_host_mak
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001716elif check_linker_flags -z,allextract -z,defaultextract ; then
1717 # Solaris ld
Juan Quintela98ec69a2009-07-16 18:34:18 +02001718 echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_host_mak
1719 echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_host_mak
Anthony Liguori08b9d662009-06-18 13:31:51 -05001720elif check_linker_flags -all_load ; then
1721 # Mac OS X
Juan Quintela98ec69a2009-07-16 18:34:18 +02001722 echo "ARLIBS_BEGIN=-all_load" >> $config_host_mak
1723 echo "ARLIBS_END=" >> $config_host_mak
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001724else
1725 echo "Error: your linker does not support --whole-archive or -z."
1726 echo "Please report to qemu-devel@nongnu.org"
1727 exit 1
1728fi
1729
pbrookc39e3332007-09-22 16:49:14 +00001730tools=
1731if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001732 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001733 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001734 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001735 fi
pbrookc39e3332007-09-22 16:49:14 +00001736fi
Juan Quintela98ec69a2009-07-16 18:34:18 +02001737echo "TOOLS=$tools" >> $config_host_mak
pbrookc39e3332007-09-22 16:49:14 +00001738
Juan Quintela161294d2009-07-21 14:11:22 +02001739# Mac OS X ships with a broken assembler
Alexander Graf253d0942009-06-29 15:37:40 +02001740roms=
Juan Quintela161294d2009-07-21 14:11:22 +02001741if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
1742 "$targetos" != "Darwin" ; then
Paul Brookc05ac892009-07-31 13:18:32 +01001743 roms="optionrom"
Alexander Graf253d0942009-06-29 15:37:40 +02001744fi
Juan Quintela98ec69a2009-07-16 18:34:18 +02001745echo "ROMS=$roms" >> $config_host_mak
Alexander Graf253d0942009-06-29 15:37:40 +02001746
Juan Quintela804edf22009-07-27 16:12:49 +02001747echo "prefix=$prefix" >> $config_host_mak
1748echo "bindir=\${prefix}$binsuffix" >> $config_host_mak
1749echo "mandir=\${prefix}$mansuffix" >> $config_host_mak
1750echo "datadir=\${prefix}$datasuffix" >> $config_host_mak
1751echo "docdir=\${prefix}$docsuffix" >> $config_host_mak
1752echo "MAKE=$make" >> $config_host_mak
1753echo "INSTALL=$install" >> $config_host_mak
1754echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
1755echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
1756echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
1757echo "CC=$cc" >> $config_host_mak
1758echo "HOST_CC=$host_cc" >> $config_host_mak
1759if test "$sparse" = "yes" ; then
1760 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
1761 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
1762 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
1763fi
1764echo "AR=$ar" >> $config_host_mak
1765echo "OBJCOPY=$objcopy" >> $config_host_mak
1766echo "LD=$ld" >> $config_host_mak
1767echo "CFLAGS=$CFLAGS $OS_CFLAGS $ARCH_CFLAGS $EXTRA_CFLAGS" >> $config_host_mak
1768echo "LDFLAGS=$LDFLAGS $OS_LDFLAGS $ARCH_LDFLAGS $EXTRA_LDFLAGS" >> $config_host_mak
1769echo "EXESUF=$EXESUF" >> $config_host_mak
1770echo "PTHREADLIBS=$PTHREADLIBS" >> $config_host_mak
1771echo "CLOCKLIBS=$CLOCKLIBS" >> $config_host_mak
1772
Juan Quintela2358a492009-07-27 16:13:25 +02001773echo "/* Automatically generated by configure - do not modify */" > $config_host_h
1774
malc0ff66972009-08-10 03:40:16 +04001775$SHELL $source_path/create_config < $config_host_mak >> $config_host_h
Juan Quintela2358a492009-07-27 16:13:25 +02001776
Juan Quintela98ec69a2009-07-16 18:34:18 +02001777if test -f ${config_host_h}~ ; then
1778 if cmp -s $config_host_h ${config_host_h}~ ; then
1779 mv ${config_host_h}~ $config_host_h
Paul Brook370ab982009-05-26 15:07:56 +01001780 else
Juan Quintela98ec69a2009-07-16 18:34:18 +02001781 rm ${config_host_h}~
Paul Brook370ab982009-05-26 15:07:56 +01001782 fi
1783fi
1784
Juan Quintela4bf6b552009-07-22 22:37:40 +02001785# generate list of library paths for linker script
1786
1787$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
1788
1789if test -f ${config_host_ld}~ ; then
1790 if cmp -s $config_host_ld ${config_host_ld}~ ; then
1791 mv ${config_host_ld}~ $config_host_ld
1792 else
1793 rm ${config_host_ld}~
1794 fi
1795fi
1796
bellard1d14ffa2005-10-30 18:58:22 +00001797for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001798target_dir="$target"
1799config_mak=$target_dir/config.mak
1800config_h=$target_dir/config.h
Blue Swirl600309b2009-07-03 17:44:00 +00001801target_arch2=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00001802target_bigendian="no"
Juan Quintelaea2d6a32009-07-16 18:34:10 +02001803case "$target_arch2" in
1804 armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|sh4eb|sparc|sparc64|sparc32plus)
1805 target_bigendian=yes
1806 ;;
1807esac
bellard97a847b2003-08-10 21:36:04 +00001808target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001809target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001810target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001811target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001812target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001813case "$target" in
Blue Swirl600309b2009-07-03 17:44:00 +00001814 ${target_arch2}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00001815 target_softmmu="yes"
1816 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00001817 ${target_arch2}-linux-user)
pbrook9e407a82007-05-26 16:38:53 +00001818 target_user_only="yes"
1819 target_linux_user="yes"
1820 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00001821 ${target_arch2}-darwin-user)
pbrook9e407a82007-05-26 16:38:53 +00001822 target_user_only="yes"
1823 target_darwin_user="yes"
1824 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00001825 ${target_arch2}-bsd-user)
blueswir184778502008-10-26 20:33:16 +00001826 target_user_only="yes"
1827 target_bsd_user="yes"
1828 ;;
pbrook9e407a82007-05-26 16:38:53 +00001829 *)
1830 echo "ERROR: Target '$target' not recognised"
1831 exit 1
1832 ;;
1833esac
ths831b7822007-01-18 20:06:33 +00001834
bellard7c1f25b2004-04-22 00:02:08 +00001835#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001836
ths15d9ca02007-07-31 23:07:32 +00001837test -f $config_h && mv $config_h ${config_h}~
1838
bellard97a847b2003-08-10 21:36:04 +00001839mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001840mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001841mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001842if 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 +00001843 mkdir -p $target_dir/nwfpe
1844fi
1845
bellardec530c82006-04-25 22:36:06 +00001846#
1847# don't use ln -sf as not all "ln -sf" over write the file/link
1848#
1849rm -f $target_dir/Makefile
1850ln -s $source_path/Makefile.target $target_dir/Makefile
1851
bellard97a847b2003-08-10 21:36:04 +00001852
1853echo "# Automatically generated by configure - do not modify" > $config_mak
bellard97a847b2003-08-10 21:36:04 +00001854
1855echo "include ../config-host.mak" >> $config_mak
bellard1e43adf2003-09-30 20:54:24 +00001856
pbrooke5fe0c52006-06-11 13:32:59 +00001857bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001858elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001859target_nptl="no"
Blue Swirl600309b2009-07-03 17:44:00 +00001860interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
Juan Quintela42bc6082009-07-16 18:34:20 +02001861echo "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_mak
pbrook56aebc82008-10-11 17:55:29 +00001862gdb_xml_files=""
aliguori7ba1e612008-11-05 16:04:33 +00001863
Juan Quintela938b1ed2009-07-16 18:34:12 +02001864TARGET_ARCH="$target_arch2"
Juan Quintela6acff7d2009-07-16 18:34:15 +02001865TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02001866TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02001867
Blue Swirl600309b2009-07-03 17:44:00 +00001868case "$target_arch2" in
aurel322408a522008-04-20 20:19:44 +00001869 i386)
Paul Brook1ad21342009-05-19 16:17:58 +01001870 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001871 ;;
1872 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02001873 TARGET_BASE_ARCH=i386
Paul Brook1ad21342009-05-19 16:17:58 +01001874 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001875 ;;
1876 alpha)
Paul Brook1ad21342009-05-19 16:17:58 +01001877 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001878 ;;
1879 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001880 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00001881 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001882 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001883 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001884 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001885 ;;
1886 cris)
edgar_igl253bd7f2009-01-07 20:07:09 +00001887 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001888 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001889 ;;
1890 m68k)
aurel322408a522008-04-20 20:19:44 +00001891 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001892 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001893 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001894 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001895 microblaze)
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001896 bflt="yes"
1897 target_nptl="yes"
1898 target_phys_bits=32
1899 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02001900 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001901 TARGET_ARCH=mips
Juan Quintela42bc6082009-07-16 18:34:20 +02001902 echo "TARGET_ABI_MIPSO32=y" >> $config_mak
Paul Brookf04dc722009-07-09 17:56:24 +01001903 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001904 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001905 ;;
1906 mipsn32|mipsn32el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001907 TARGET_ARCH=mipsn32
Juan Quintela6acff7d2009-07-16 18:34:15 +02001908 TARGET_BASE_ARCH=mips
Juan Quintela42bc6082009-07-16 18:34:20 +02001909 echo "TARGET_ABI_MIPSN32=y" >> $config_mak
Paul Brook1ad21342009-05-19 16:17:58 +01001910 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001911 ;;
1912 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001913 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02001914 TARGET_BASE_ARCH=mips
Juan Quintela42bc6082009-07-16 18:34:20 +02001915 echo "TARGET_ABI_MIPSN64=y" >> $config_mak
Paul Brook1ad21342009-05-19 16:17:58 +01001916 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001917 ;;
1918 ppc)
aurel32c8b35322009-01-24 15:07:34 +00001919 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001920 target_phys_bits=32
Nathan Froydd6630702009-08-03 08:43:28 -07001921 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001922 ;;
1923 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02001924 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02001925 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00001926 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001927 target_phys_bits=64
Nathan Froydd6630702009-08-03 08:43:28 -07001928 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001929 ;;
1930 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02001931 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02001932 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00001933 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001934 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001935 ;;
1936 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001937 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02001938 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02001939 TARGET_ABI_DIR=ppc
Juan Quintela42bc6082009-07-16 18:34:20 +02001940 echo "TARGET_ABI32=y" >> $config_mak
aurel32c8b35322009-01-24 15:07:34 +00001941 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001942 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001943 ;;
1944 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001945 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00001946 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001947 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001948 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001949 ;;
1950 sparc)
Paul Brook1ad21342009-05-19 16:17:58 +01001951 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001952 ;;
1953 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02001954 TARGET_BASE_ARCH=sparc
aurel322408a522008-04-20 20:19:44 +00001955 elfload32="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001956 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001957 ;;
1958 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02001959 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02001960 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02001961 TARGET_ABI_DIR=sparc
Juan Quintela42bc6082009-07-16 18:34:20 +02001962 echo "TARGET_ABI32=y" >> $config_mak
Paul Brook1ad21342009-05-19 16:17:58 +01001963 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001964 ;;
1965 *)
1966 echo "Unsupported target CPU"
1967 exit 1
1968 ;;
1969esac
Juan Quintelab498c8a2009-07-16 18:34:11 +02001970echo "TARGET_ARCH=$TARGET_ARCH" >> $config_mak
Juan Quintela0adcffb2009-07-16 18:34:16 +02001971echo "TARGET_ARCH2=$target_arch2" >> $config_mak
Juan Quintela42bc6082009-07-16 18:34:20 +02001972# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02001973if [ "$TARGET_BASE_ARCH" = "" ]; then
1974 TARGET_BASE_ARCH=$TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02001975fi
1976echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02001977if [ "$TARGET_ABI_DIR" = "" ]; then
1978 TARGET_ABI_DIR=$TARGET_ARCH
1979fi
1980echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_mak
Paul Brook1ad21342009-05-19 16:17:58 +01001981if [ $target_phys_bits -lt $hostlongbits ] ; then
1982 target_phys_bits=$hostlongbits
1983fi
Juan Quintela1b0c87f2009-07-16 18:33:59 +02001984case "$target_arch2" in
1985 i386|x86_64)
1986 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
1987 echo "CONFIG_XEN=y" >> $config_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02001988 fi
Juan Quintela0d46b7e2009-07-16 18:34:01 +02001989 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1990 then
1991 echo "CONFIG_KQEMU=y" >> $config_mak
Juan Quintela0d46b7e2009-07-16 18:34:01 +02001992 fi
Juan Quintela1b0c87f2009-07-16 18:33:59 +02001993esac
Juan Quintelac59249f2009-07-16 18:34:00 +02001994case "$target_arch2" in
Alexander Graf5f114bc2009-07-17 13:51:42 +02001995 i386|x86_64|ppcemb|ppc|ppc64)
Juan Quintelac59249f2009-07-16 18:34:00 +02001996 # Make sure the target and host cpus are compatible
1997 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1998 \( "$target_arch2" = "$cpu" -o \
1999 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
Alexander Graf5f114bc2009-07-17 13:51:42 +02002000 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
Juan Quintelac59249f2009-07-16 18:34:00 +02002001 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
2002 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
2003 echo "CONFIG_KVM=y" >> $config_mak
2004 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
Juan Quintelac59249f2009-07-16 18:34:00 +02002005 fi
2006esac
Paul Brook1ad21342009-05-19 16:17:58 +01002007echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
Juan Quintela42bc6082009-07-16 18:34:20 +02002008echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_mak
Paul Brook1ad21342009-05-19 16:17:58 +01002009echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00002010if test "$target_bigendian" = "yes" ; then
Juan Quintela42bc6082009-07-16 18:34:20 +02002011 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00002012fi
2013if test "$target_softmmu" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002014 echo "CONFIG_SOFTMMU=y" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00002015fi
bellard997344f2003-10-27 21:10:39 +00002016if test "$target_user_only" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002017 echo "CONFIG_USER_ONLY=y" >> $config_mak
bellard997344f2003-10-27 21:10:39 +00002018fi
ths831b7822007-01-18 20:06:33 +00002019if test "$target_linux_user" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002020 echo "CONFIG_LINUX_USER=y" >> $config_mak
ths831b7822007-01-18 20:06:33 +00002021fi
2022if test "$target_darwin_user" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002023 echo "CONFIG_DARWIN_USER=y" >> $config_mak
ths831b7822007-01-18 20:06:33 +00002024fi
pbrook56aebc82008-10-11 17:55:29 +00002025list=""
2026if test ! -z "$gdb_xml_files" ; then
2027 for x in $gdb_xml_files; do
2028 list="$list $source_path/gdb-xml/$x"
2029 done
2030fi
2031echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00002032
Juan Quintelaf57975f2009-07-16 18:34:19 +02002033case "$target_arch2" in
2034 arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|sparc|sparc64|sparc32plus)
2035 echo "CONFIG_SOFTFLOAT=y" >> $config_mak
Juan Quintelaf57975f2009-07-16 18:34:19 +02002036 ;;
2037esac
2038
pbrooke5fe0c52006-06-11 13:32:59 +00002039if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002040 echo "TARGET_HAS_BFLT=y" >> $config_mak
pbrooke5fe0c52006-06-11 13:32:59 +00002041fi
pbrookbd0c5662008-05-29 14:34:11 +00002042if test "$target_user_only" = "yes" \
2043 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
Juan Quintela2f7bb872009-07-27 16:13:24 +02002044 echo "CONFIG_USE_NPTL=y" >> $config_mak
pbrookbd0c5662008-05-29 14:34:11 +00002045fi
blueswir1cb33da52007-10-09 16:34:29 +00002046# 32 bit ELF loader in addition to native 64 bit loader?
2047if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002048 echo "TARGET_HAS_ELFLOAD32=y" >> $config_mak
blueswir1cb33da52007-10-09 16:34:29 +00002049fi
Paul Brook379f6692009-07-17 12:48:08 +01002050if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
2051 echo "CONFIG_USE_GUEST_BASE=y" >> $config_mak
2052fi
blueswir184778502008-10-26 20:33:16 +00002053if test "$target_bsd_user" = "yes" ; then
Juan Quintelae34af2c2009-06-25 00:08:08 +02002054 echo "CONFIG_BSD_USER=y" >> $config_mak
blueswir184778502008-10-26 20:33:16 +00002055fi
bellard5b0753e2005-03-01 21:37:28 +00002056
Juan Quintelafa282482009-07-22 22:37:39 +02002057# generate LDFLAGS for targets
2058
2059ldflags=""
2060if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then
2061 case "$ARCH" in
2062 i386)
2063 if test "$gprof" = "yes" -o "$static" = "yes" ; then
Juan Quintela4bf6b552009-07-22 22:37:40 +02002064 ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
Juan Quintelafa282482009-07-22 22:37:39 +02002065 else
2066 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
2067 # that the kernel ELF loader considers as an executable. I think this
2068 # is the simplest way to make it self virtualizable!
2069 ldflags='-Wl,-shared'
2070 fi
2071 ;;
2072 sparc)
2073 # -static is used to avoid g1/g3 usage by the dynamic linker
Juan Quintela4bf6b552009-07-22 22:37:40 +02002074 ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
Juan Quintelafa282482009-07-22 22:37:39 +02002075 ;;
2076 ia64)
Juan Quintela4bf6b552009-07-22 22:37:40 +02002077 ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
Juan Quintelafa282482009-07-22 22:37:39 +02002078 ;;
2079 x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
Juan Quintela4bf6b552009-07-22 22:37:40 +02002080 ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
Juan Quintelafa282482009-07-22 22:37:39 +02002081 ;;
2082 esac
2083fi
2084if test "$target_softmmu" = "yes" ; then
2085 case "$ARCH" in
2086 ia64)
Juan Quintela4bf6b552009-07-22 22:37:40 +02002087 ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
Juan Quintelafa282482009-07-22 22:37:39 +02002088 ;;
2089 esac
2090fi
2091
2092if test "$ldflags" != "" ; then
2093 echo "LDFLAGS+=$ldflags" >> $config_mak
2094fi
2095
Juan Quintela2358a492009-07-27 16:13:25 +02002096echo "/* Automatically generated by configure - do not modify */" > $config_h
2097echo "#include \"../config-host.h\"" >> $config_h
2098
malc0ff66972009-08-10 03:40:16 +04002099$SHELL $source_path/create_config < $config_mak >> $config_h
Juan Quintela42bc6082009-07-16 18:34:20 +02002100
Juan Quintelaa900c002009-07-27 16:12:44 +02002101if test -f ${config_h}~ ; then
2102 if cmp -s $config_h ${config_h}~ ; then
2103 mv ${config_h}~ $config_h
2104 else
2105 rm ${config_h}~
2106 fi
2107fi
ths15d9ca02007-07-31 23:07:32 +00002108
bellard97a847b2003-08-10 21:36:04 +00002109done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00002110
2111# build tree in object directory if source path is different from current one
2112if test "$source_path_used" = "yes" ; then
Alexander Graf253d0942009-06-29 15:37:40 +02002113 DIRS="tests tests/cris slirp audio block pc-bios/optionrom"
bellard7d132992003-03-06 23:23:54 +00002114 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00002115 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00002116 FILES="$FILES tests/test-mmap.c"
Jan Kiszka7ea78b72009-07-17 11:20:10 +02002117 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
2118 for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
2119 FILES="$FILES pc-bios/`basename $bios_file`"
2120 done
bellard7d132992003-03-06 23:23:54 +00002121 for dir in $DIRS ; do
2122 mkdir -p $dir
2123 done
bellardec530c82006-04-25 22:36:06 +00002124 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00002125 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00002126 rm -f $f
2127 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00002128 done
2129fi
Paul Brook1ad21342009-05-19 16:17:58 +01002130
2131for hwlib in 32 64; do
2132 d=libhw$hwlib
2133 mkdir -p $d
2134 rm -f $d/Makefile
2135 ln -s $source_path/Makefile.hw $d/Makefile
2136 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2137 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2138done