blob: 5eb3ecd1929c610d86525eb33d51cabe3af5230d [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"
malca91b8572009-10-15 01:57:14 +040016TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
bellard7d132992003-03-06 23:23:54 +000017
Aurelien Jarno4021d242010-06-10 00:06:55 +020018trap "rm -f $TMPC $TMPO $TMPE ; exit" EXIT INT QUIT TERM
malc9ac81bb2008-11-29 20:09:56 +000019
Juan Quintela52166aa2009-08-03 14:46:03 +020020compile_object() {
Juan Quintelaa558ee12009-08-03 14:46:21 +020021 $cc $QEMU_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
Juan Quintela52166aa2009-08-03 14:46:03 +020022}
23
24compile_prog() {
25 local_cflags="$1"
26 local_ldflags="$2"
Juan Quintelaa558ee12009-08-03 14:46:21 +020027 $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null
Juan Quintela52166aa2009-08-03 14:46:03 +020028}
29
Loïc Minier0dba6192010-01-28 21:26:51 +000030# check whether a command is available to this shell (may be either an
31# executable or a builtin)
32has() {
33 type "$1" >/dev/null 2>&1
34}
35
36# search for an executable in PATH
37path_of() {
38 local_command="$1"
39 local_ifs="$IFS"
40 local_dir=""
41
42 # pathname has a dir component?
43 if [ "${local_command#*/}" != "$local_command" ]; then
44 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
45 echo "$local_command"
46 return 0
47 fi
48 fi
49 if [ -z "$local_command" ]; then
50 return 1
51 fi
52
53 IFS=:
54 for local_dir in $PATH; do
55 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
56 echo "$local_dir/$local_command"
57 IFS="${local_ifs:-$(printf ' \t\n')}"
58 return 0
59 fi
60 done
61 # not found
62 IFS="${local_ifs:-$(printf ' \t\n')}"
63 return 1
64}
65
bellard7d132992003-03-06 23:23:54 +000066# default parameters
Juan Quintela2ff6b912009-08-03 14:45:55 +020067cpu=""
bellard11d9f692004-04-02 20:55:59 +000068prefix=""
bellard1e43adf2003-09-30 20:54:24 +000069interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000070static="no"
Paolo Bonzini0b24e752010-05-26 16:08:26 +020071mandir=""
72datadir=""
73docdir=""
74bindir=""
Anthony Liguori07381cc2010-01-21 10:30:29 -060075sysconfdir=""
Juan Quintelaed968ff2009-08-03 14:46:11 +020076sparc_cpu=""
bellard7d132992003-03-06 23:23:54 +000077cross_prefix=""
78cc="gcc"
malc0c58ac12008-06-25 21:04:05 +000079audio_drv_list=""
malc4c9b53e2009-01-09 10:46:34 +000080audio_card_list="ac97 es1370 sb16"
81audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
Markus Armbrustereb852012009-10-27 18:41:44 +010082block_drv_whitelist=""
bellard7d132992003-03-06 23:23:54 +000083host_cc="gcc"
84ar="ar"
85make="make"
pbrook6a882642006-04-17 13:57:12 +000086install="install"
Anthony Liguori7aa486f2009-07-11 08:48:29 -050087objcopy="objcopy"
88ld="ld"
Juan Quintelac81da562009-08-03 14:46:24 +020089helper_cflags=""
Juan Quintela73da3752009-08-03 14:46:26 +020090libs_softmmu=""
Juan Quintela3e2e0e62009-08-03 14:47:06 +020091libs_tools=""
Juan Quintela67f86e82009-08-03 14:46:59 +020092audio_pt_int=""
malcd5631632009-10-10 01:13:41 +040093audio_win_int=""
aliguoriac0df512008-12-29 17:14:15 +000094
95# parse CC options first
96for opt do
97 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
98 case "$opt" in
99 --cross-prefix=*) cross_prefix="$optarg"
100 ;;
101 --cc=*) cc="$optarg"
102 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200103 --cpu=*) cpu="$optarg"
104 ;;
Juan Quintelaa558ee12009-08-03 14:46:21 +0200105 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200106 ;;
107 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
108 ;;
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200109 --sparc_cpu=*)
110 sparc_cpu="$optarg"
111 case $sparc_cpu in
Juan Quintelaed968ff2009-08-03 14:46:11 +0200112 v7|v8|v8plus|v8plusa)
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200113 cpu="sparc"
114 ;;
115 v9)
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200116 cpu="sparc64"
117 ;;
118 *)
119 echo "undefined SPARC architecture. Exiting";
120 exit 1
121 ;;
122 esac
123 ;;
aliguoriac0df512008-12-29 17:14:15 +0000124 esac
125done
aliguoriac0df512008-12-29 17:14:15 +0000126# OS specific
127# Using uname is really, really broken. Once we have the right set of checks
128# we can eliminate it's usage altogether
129
130cc="${cross_prefix}${cc}"
131ar="${cross_prefix}${ar}"
Anthony Liguori7aa486f2009-07-11 08:48:29 -0500132objcopy="${cross_prefix}${objcopy}"
133ld="${cross_prefix}${ld}"
aliguoriac0df512008-12-29 17:14:15 +0000134
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200135# default flags for all hosts
136QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
137CFLAGS="-g $CFLAGS"
138QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
139QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
140QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Kirill A. Shutemov84958302010-01-20 00:56:22 +0100141QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200142QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
143LDFLAGS="-g $LDFLAGS"
144
Juan Quintelaa0f291f2010-01-20 00:56:23 +0100145gcc_flags="-Wold-style-declaration -Wold-style-definition -fstack-protector-all"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200146cat > $TMPC << EOF
Aurelien Jarnoaa527b62010-02-06 21:22:19 +0100147int main(void) { return 0; }
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200148EOF
149for flag in $gcc_flags; do
Aurelien Jarnoaa527b62010-02-06 21:22:19 +0100150 if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200151 QEMU_CFLAGS="$flag $QEMU_CFLAGS"
152 fi
153done
154
aliguoriac0df512008-12-29 17:14:15 +0000155# check that the C compiler works.
156cat > $TMPC <<EOF
157int main(void) {}
158EOF
159
Juan Quintela52166aa2009-08-03 14:46:03 +0200160if compile_object ; then
aliguoriac0df512008-12-29 17:14:15 +0000161 : C compiler works ok
162else
163 echo "ERROR: \"$cc\" either does not exist or does not work"
164 exit 1
165fi
166
167check_define() {
168cat > $TMPC <<EOF
169#if !defined($1)
170#error Not defined
171#endif
172int main(void) { return 0; }
173EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200174 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000175}
176
Juan Quintela2ff6b912009-08-03 14:45:55 +0200177if test ! -z "$cpu" ; then
178 # command line argument
179 :
180elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000181 cpu="i386"
182elif check_define __x86_64__ ; then
183 cpu="x86_64"
blueswir13aa9bd62008-12-31 16:55:26 +0000184elif check_define __sparc__ ; then
185 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
186 # They must be specified using --sparc_cpu
187 if check_define __arch64__ ; then
188 cpu="sparc64"
189 else
190 cpu="sparc"
191 fi
malcfdf7ed92009-01-14 18:39:52 +0000192elif check_define _ARCH_PPC ; then
193 if check_define _ARCH_PPC64 ; then
194 cpu="ppc64"
195 else
196 cpu="ppc"
197 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200198elif check_define __mips__ ; then
199 cpu="mips"
Aurelien Jarno477ba622010-03-29 02:12:51 +0200200elif check_define __ia64__ ; then
201 cpu="ia64"
aliguoriac0df512008-12-29 17:14:15 +0000202else
malcfdf7ed92009-01-14 18:39:52 +0000203 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +0000204fi
205
bellard5327cf42005-01-10 23:18:50 +0000206target_list=""
bellard7d132992003-03-06 23:23:54 +0000207case "$cpu" in
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200208 alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64)
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200209 cpu="$cpu"
210 ;;
bellard7d132992003-03-06 23:23:54 +0000211 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000212 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000213 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000214 x86_64|amd64)
215 cpu="x86_64"
216 ;;
bellardba680552005-03-13 09:49:52 +0000217 armv*b)
bellard808c4952004-12-19 23:33:47 +0000218 cpu="armv4b"
219 ;;
bellardba680552005-03-13 09:49:52 +0000220 armv*l)
bellard7d132992003-03-06 23:23:54 +0000221 cpu="armv4l"
222 ;;
aurel32f54b3f92008-04-12 20:14:54 +0000223 parisc|parisc64)
224 cpu="hppa"
225 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200226 mips*)
227 cpu="mips"
228 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +0100229 s390)
bellardfb3e5842003-03-29 17:32:36 +0000230 cpu="s390"
231 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +0100232 s390x)
233 cpu="s390x"
234 ;;
blueswir131422552007-04-16 18:27:06 +0000235 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000236 cpu="sparc"
237 ;;
bellard7d132992003-03-06 23:23:54 +0000238 *)
Paolo Bonzinia447d4d2010-05-26 16:08:16 +0200239 echo "Unsupported CPU = $cpu"
240 exit 1
bellard7d132992003-03-06 23:23:54 +0000241 ;;
242esac
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200243
Stefan Weil3a3fb962009-11-16 19:59:18 +0100244# Default value for a variable defining feature "foo".
245# * foo="no" feature will only be used if --enable-foo arg is given
246# * foo="" feature will be searched for, and if found, will be used
247# unless --disable-foo is given
248# * foo="yes" this value will only be set by --enable-foo flag.
249# feature will searched for,
250# if not found, configure exits with error
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200251#
Stefan Weil3a3fb962009-11-16 19:59:18 +0100252# Always add --enable-foo and --disable-foo command line args.
253# Distributions want to ensure that several features are compiled in, and it
254# is impossible without a --enable-foo that exits if a feature is not found.
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200255
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200256bluez=""
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200257brlapi=""
Juan Quintela788c8192009-08-12 18:29:47 +0200258curl=""
Juan Quintelac584a6d2009-08-12 18:20:30 +0200259curses=""
Juan Quintelaa25dba12009-08-12 18:29:52 +0200260docs=""
Juan Quintela2df87df2009-08-12 18:29:54 +0200261fdt=""
Juan Quintelab31a0272009-08-12 18:29:56 +0200262kvm=""
Jan Kiszkadae50792010-01-12 19:53:48 +0100263kvm_para=""
Juan Quintelab0a47e72009-08-12 18:29:49 +0200264nptl=""
Juan Quintelac4198152009-08-12 18:29:53 +0200265sdl=""
Juan Quinteladfffc652009-08-12 18:29:57 +0200266sparse="no"
Stefan Weilee682d22009-10-01 20:10:37 +0200267uuid=""
Juan Quinteladfb278b2009-08-12 18:20:27 +0200268vde=""
Juan Quintela1be10ad2009-08-12 18:20:28 +0200269vnc_tls=""
Juan Quintelaea784e32009-08-12 18:20:29 +0200270vnc_sasl=""
Juan Quintelafc321b42009-08-12 18:29:55 +0200271xen=""
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200272linux_aio=""
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200273vhost_net=""
Juan Quinteladfb278b2009-08-12 18:20:27 +0200274
bellard7d132992003-03-06 23:23:54 +0000275gprof="no"
aurel32f8393942009-04-13 18:45:38 +0000276debug_tcg="no"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200277debug_mon="no"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100278debug="no"
aliguori1625af82009-04-05 17:41:02 +0000279strip_opt="yes"
bellard7d132992003-03-06 23:23:54 +0000280bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000281mingw32="no"
282EXESUF=""
bellard443f1372004-06-04 11:13:20 +0000283slirp="yes"
bellard102a52e2004-11-14 19:57:29 +0000284fmod_lib=""
285fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000286oss_lib=""
pbrookb1a550a2006-04-16 13:28:56 +0000287bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000288linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000289solaris="no"
bellard05c2a3e2006-02-08 22:39:17 +0000290profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000291cocoa="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000292softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000293linux_user="no"
294darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000295bsd_user="no"
Paul Brook379f6692009-07-17 12:48:08 +0100296guest_base=""
pbrookc5937222006-05-14 11:30:38 +0000297uname_release=""
aliguorie5d355d2009-04-24 18:03:15 +0000298io_thread="no"
malc8ff9cbf2008-06-23 18:33:30 +0000299mixemu="no"
aliguorieac30262008-11-05 16:28:56 +0000300kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000301aix="no"
ths77755342008-11-27 15:45:16 +0000302blobs="yes"
pbrook4a19f1e2009-04-07 23:17:49 +0000303pkgversion=""
Luiz Capitulino5495ed12009-08-28 15:27:28 -0300304check_utests="no"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300305user_pie="no"
Anthony Liguori20ff6c82009-12-09 12:59:36 -0600306zero_malloc=""
bellard7d132992003-03-06 23:23:54 +0000307
308# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000309if check_define __linux__ ; then
310 targetos="Linux"
311elif check_define _WIN32 ; then
312 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000313elif check_define __OpenBSD__ ; then
314 targetos='OpenBSD'
315elif check_define __sun__ ; then
316 targetos='SunOS'
aliguoriac0df512008-12-29 17:14:15 +0000317else
318 targetos=`uname -s`
319fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200320
bellard7d132992003-03-06 23:23:54 +0000321case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000322CYGWIN*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200323 mingw32="yes"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200324 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
malcd5631632009-10-10 01:13:41 +0400325 audio_possible_drivers="winwave sdl"
326 audio_drv_list="winwave"
bellardc326e0a2005-04-23 18:30:28 +0000327;;
bellard67b915a2004-03-31 23:37:16 +0000328MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200329 mingw32="yes"
malcd5631632009-10-10 01:13:41 +0400330 audio_possible_drivers="winwave dsound sdl fmod"
331 audio_drv_list="winwave"
bellard67b915a2004-03-31 23:37:16 +0000332;;
ths5c40d2b2007-06-23 16:03:36 +0000333GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100334 bsd="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200335 audio_drv_list="oss"
336 audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000337;;
bellard7d3505c2004-05-12 19:32:15 +0000338FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200339 bsd="yes"
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100340 make="gmake"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200341 audio_drv_list="oss"
342 audio_possible_drivers="oss sdl esd pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100343 # needed for kinfo_getvmmap(3) in libutil.h
344 LIBS="-lutil $LIBS"
bellard7d3505c2004-05-12 19:32:15 +0000345;;
blueswir1c5e97232009-03-07 20:06:23 +0000346DragonFly)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200347 bsd="yes"
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100348 make="gmake"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200349 audio_drv_list="oss"
350 audio_possible_drivers="oss sdl esd pa"
blueswir1c5e97232009-03-07 20:06:23 +0000351;;
bellard7d3505c2004-05-12 19:32:15 +0000352NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200353 bsd="yes"
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100354 make="gmake"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200355 audio_drv_list="oss"
356 audio_possible_drivers="oss sdl esd"
357 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000358;;
359OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200360 bsd="yes"
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100361 make="gmake"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200362 audio_drv_list="oss"
363 audio_possible_drivers="oss sdl esd"
364 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000365;;
bellard83fb7ad2004-07-05 21:25:26 +0000366Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200367 bsd="yes"
368 darwin="yes"
369 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
370 # run 64-bit userspace code
371 if [ "$cpu" = "i386" ] ; then
malcaab85882009-02-23 14:11:10 +0000372 is_x86_64=`sysctl -n hw.optional.x86_64`
373 [ "$is_x86_64" = "1" ] && cpu=x86_64
Juan Quintela0dbfc672009-08-03 14:46:13 +0200374 fi
375 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200376 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200377 LDFLAGS="-arch x86_64 $LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200378 else
Juan Quintelaa558ee12009-08-03 14:46:21 +0200379 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200380 fi
381 darwin_user="yes"
382 cocoa="yes"
383 audio_drv_list="coreaudio"
384 audio_possible_drivers="coreaudio sdl fmod"
385 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200386 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
bellard83fb7ad2004-07-05 21:25:26 +0000387;;
bellardec530c82006-04-25 22:36:06 +0000388SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200389 solaris="yes"
390 make="gmake"
391 install="ginstall"
Blue Swirlfa589482009-10-02 19:38:25 +0000392 ld="gld"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200393 needs_libsunmath="no"
394 solarisrev=`uname -r | cut -f2 -d.`
395 # have to select again, because `uname -m` returns i86pc
396 # even on an x86_64 box.
397 solariscpu=`isainfo -k`
398 if test "${solariscpu}" = "amd64" ; then
399 cpu="x86_64"
400 fi
401 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
402 if test "$solarisrev" -le 9 ; then
403 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
404 needs_libsunmath="yes"
Juan Quintelaf14bfdf2009-08-03 14:47:11 +0200405 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
406 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
407 LIBS="-lsunmath $LIBS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200408 else
409 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
410 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
411 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
412 echo "Studio 11 can be downloaded from www.sun.com."
413 exit 1
414 fi
thsef18c882007-09-16 22:12:39 +0000415 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200416 fi
417 if test -f /usr/include/sys/soundcard.h ; then
418 audio_drv_list="oss"
419 fi
420 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000421# needed for CMSG_ macros in sys/socket.h
422 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
423# needed for TIOCWIN* defines in termios.h
424 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200425 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
Juan Quintelae174c0b2009-08-03 14:46:18 +0200426 LIBS="-lsocket -lnsl -lresolv $LIBS"
ths86b2bd92007-02-11 00:31:33 +0000427;;
malcb29fe3e2008-11-18 01:42:22 +0000428AIX)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200429 aix="yes"
430 make="gmake"
malcb29fe3e2008-11-18 01:42:22 +0000431;;
bellard1d14ffa2005-10-30 18:58:22 +0000432*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200433 audio_drv_list="oss"
434 audio_possible_drivers="oss alsa sdl esd pa"
435 linux="yes"
436 linux_user="yes"
437 usb="linux"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200438 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
malcc2de5c92008-06-28 19:13:06 +0000439 audio_possible_drivers="$audio_possible_drivers fmod"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200440 fi
bellardfb065182004-11-09 23:09:44 +0000441;;
bellard7d132992003-03-06 23:23:54 +0000442esac
443
bellard7d3505c2004-05-12 19:32:15 +0000444if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000445 if [ "$darwin" != "yes" ] ; then
blueswir168063642008-11-22 21:03:55 +0000446 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000447 fi
blueswir184778502008-10-26 20:33:16 +0000448 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000449fi
450
Juan Quintela3457a3f2009-08-03 14:46:07 +0200451if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +0200452 EXESUF=".exe"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200453 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
Stefan Weile94a7932010-02-12 11:02:08 +0100454 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
455 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
Juan Quintela884044a2009-08-03 14:46:19 +0200456 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
Juan Quintela3457a3f2009-08-03 14:46:07 +0200457fi
458
bellard7d132992003-03-06 23:23:54 +0000459# find source path
pbrookad064842006-04-16 12:41:07 +0000460source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000461source_path_used="no"
462workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000463if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000464 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000465else
466 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000467fi
pbrook724db112008-02-03 19:20:13 +0000468[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000469
Anthony Liguori487fefd2009-06-11 13:28:25 -0500470werror=""
bellard85aa5182007-11-11 20:17:03 +0000471
bellard7d132992003-03-06 23:23:54 +0000472for opt do
pbrooka46e4032006-04-29 23:05:22 +0000473 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000474 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000475 --help|-h) show_help=yes
476 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000477 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000478 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000479 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000480 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000481 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000482 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000483 ;;
aliguoriac0df512008-12-29 17:14:15 +0000484 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000485 ;;
aliguoriac0df512008-12-29 17:14:15 +0000486 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000487 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000488 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000489 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000490 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000491 ;;
pbrook6a882642006-04-17 13:57:12 +0000492 --install=*) install="$optarg"
493 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200494 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000495 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200496 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000497 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200498 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000499 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000500 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000501 ;;
bellard7d132992003-03-06 23:23:54 +0000502 --enable-gprof) gprof="yes"
503 ;;
Loïc Minier79427692010-01-31 12:23:45 +0100504 --static)
505 static="yes"
506 LDFLAGS="-static $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +0000507 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200508 --mandir=*) mandir="$optarg"
509 ;;
510 --bindir=*) bindir="$optarg"
511 ;;
512 --datadir=*) datadir="$optarg"
513 ;;
514 --docdir=*) docdir="$optarg"
515 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +0100516 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -0600517 ;;
bellard97a847b2003-08-10 21:36:04 +0000518 --disable-sdl) sdl="no"
519 ;;
Juan Quintelac4198152009-08-12 18:29:53 +0200520 --enable-sdl) sdl="yes"
521 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000522 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000523 ;;
malcc2de5c92008-06-28 19:13:06 +0000524 --fmod-inc=*) fmod_inc="$optarg"
525 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000526 --oss-lib=*) oss_lib="$optarg"
527 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000528 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000529 ;;
530 --audio-drv-list=*) audio_drv_list="$optarg"
531 ;;
Markus Armbrustereb852012009-10-27 18:41:44 +0100532 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
533 ;;
aurel32f8393942009-04-13 18:45:38 +0000534 --enable-debug-tcg) debug_tcg="yes"
535 ;;
536 --disable-debug-tcg) debug_tcg="no"
537 ;;
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200538 --enable-debug-mon) debug_mon="yes"
539 ;;
540 --disable-debug-mon) debug_mon="no"
541 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100542 --enable-debug)
543 # Enable debugging options that aren't excessively noisy
544 debug_tcg="yes"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200545 debug_mon="yes"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100546 debug="yes"
547 strip_opt="no"
548 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000549 --enable-sparse) sparse="yes"
550 ;;
551 --disable-sparse) sparse="no"
552 ;;
aliguori1625af82009-04-05 17:41:02 +0000553 --disable-strip) strip_opt="no"
554 ;;
ths8d5d2d42007-08-25 01:37:51 +0000555 --disable-vnc-tls) vnc_tls="no"
556 ;;
Juan Quintela1be10ad2009-08-12 18:20:28 +0200557 --enable-vnc-tls) vnc_tls="yes"
558 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000559 --disable-vnc-sasl) vnc_sasl="no"
560 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +0200561 --enable-vnc-sasl) vnc_sasl="yes"
562 ;;
bellard443f1372004-06-04 11:13:20 +0000563 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000564 ;;
Stefan Weilee682d22009-10-01 20:10:37 +0200565 --disable-uuid) uuid="no"
566 ;;
567 --enable-uuid) uuid="yes"
568 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000569 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000570 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +0200571 --enable-vde) vde="yes"
572 ;;
aliguorie37630c2009-04-22 15:19:10 +0000573 --disable-xen) xen="no"
574 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +0200575 --enable-xen) xen="yes"
576 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000577 --disable-brlapi) brlapi="no"
578 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200579 --enable-brlapi) brlapi="yes"
580 ;;
balrogfb599c92008-09-28 23:49:55 +0000581 --disable-bluez) bluez="no"
582 ;;
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200583 --enable-bluez) bluez="yes"
584 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000585 --disable-kvm) kvm="no"
586 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +0200587 --enable-kvm) kvm="yes"
588 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000589 --enable-profiler) profiler="yes"
590 ;;
malcc2de5c92008-06-28 19:13:06 +0000591 --enable-cocoa)
592 cocoa="yes" ;
593 sdl="no" ;
594 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000595 ;;
pbrookcad25d62006-03-19 16:31:11 +0000596 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000597 ;;
pbrookcad25d62006-03-19 16:31:11 +0000598 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000599 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -1000600 --disable-user)
601 linux_user="no" ;
602 bsd_user="no" ;
603 darwin_user="no"
604 ;;
605 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +0000606 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000607 ;;
ths831b7822007-01-18 20:06:33 +0000608 --enable-linux-user) linux_user="yes"
609 ;;
610 --disable-darwin-user) darwin_user="no"
611 ;;
612 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000613 ;;
blueswir184778502008-10-26 20:33:16 +0000614 --disable-bsd-user) bsd_user="no"
615 ;;
616 --enable-bsd-user) bsd_user="yes"
617 ;;
Paul Brook379f6692009-07-17 12:48:08 +0100618 --enable-guest-base) guest_base="yes"
619 ;;
620 --disable-guest-base) guest_base="no"
621 ;;
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300622 --enable-user-pie) user_pie="yes"
623 ;;
624 --disable-user-pie) user_pie="no"
625 ;;
pbrookc5937222006-05-14 11:30:38 +0000626 --enable-uname-release=*) uname_release="$optarg"
627 ;;
blueswir131422552007-04-16 18:27:06 +0000628 --sparc_cpu=*)
blueswir131422552007-04-16 18:27:06 +0000629 ;;
bellard85aa5182007-11-11 20:17:03 +0000630 --enable-werror) werror="yes"
631 ;;
632 --disable-werror) werror="no"
633 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000634 --disable-curses) curses="no"
635 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +0200636 --enable-curses) curses="yes"
637 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200638 --disable-curl) curl="no"
639 ;;
Juan Quintela788c8192009-08-12 18:29:47 +0200640 --enable-curl) curl="yes"
641 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +0200642 --disable-fdt) fdt="no"
643 ;;
644 --enable-fdt) fdt="yes"
645 ;;
Luiz Capitulino5495ed12009-08-28 15:27:28 -0300646 --disable-check-utests) check_utests="no"
647 ;;
648 --enable-check-utests) check_utests="yes"
649 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000650 --disable-nptl) nptl="no"
651 ;;
Juan Quintelab0a47e72009-08-12 18:29:49 +0200652 --enable-nptl) nptl="yes"
653 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000654 --enable-mixemu) mixemu="yes"
655 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200656 --disable-linux-aio) linux_aio="no"
657 ;;
658 --enable-linux-aio) linux_aio="yes"
659 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000660 --enable-io-thread) io_thread="yes"
661 ;;
ths77755342008-11-27 15:45:16 +0000662 --disable-blobs) blobs="no"
663 ;;
aliguorieac30262008-11-05 16:28:56 +0000664 --kerneldir=*) kerneldir="$optarg"
665 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000666 --with-pkgversion=*) pkgversion=" ($optarg)"
667 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200668 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500669 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200670 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +0200671 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200672 --disable-vhost-net) vhost_net="no"
673 ;;
674 --enable-vhost-net) vhost_net="yes"
675 ;;
balrog7f1559c2007-11-17 10:24:32 +0000676 *) echo "ERROR: unknown option $opt"; show_help="yes"
677 ;;
bellard7d132992003-03-06 23:23:54 +0000678 esac
679done
680
blueswir131422552007-04-16 18:27:06 +0000681#
682# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
Juan Quintelaa558ee12009-08-03 14:46:21 +0200683# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
blueswir131422552007-04-16 18:27:06 +0000684#
Paul Brook379f6692009-07-17 12:48:08 +0100685host_guest_base="no"
bellard40293e52008-01-31 11:32:10 +0000686case "$cpu" in
Juan Quintelaed968ff2009-08-03 14:46:11 +0200687 sparc) case $sparc_cpu in
688 v7|v8)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200689 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200690 ;;
691 v8plus|v8plusa)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200692 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200693 ;;
694 *) # sparc_cpu not defined in the command line
Juan Quintelaa558ee12009-08-03 14:46:21 +0200695 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200696 esac
697 LDFLAGS="-m32 $LDFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200698 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000699 if test "$solaris" = "no" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200700 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
Juan Quintelac81da562009-08-03 14:46:24 +0200701 helper_cflags="-ffixed-i0"
blueswir1762e8232009-04-04 09:21:28 +0000702 fi
blueswir131422552007-04-16 18:27:06 +0000703 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +0200704 sparc64)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200705 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200706 LDFLAGS="-m64 $LDFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200707 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200708 if test "$solaris" != "no" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200709 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000710 fi
blueswir131422552007-04-16 18:27:06 +0000711 ;;
ths76d83bd2007-11-18 21:22:10 +0000712 s390)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200713 QEMU_CFLAGS="-march=z900 $QEMU_CFLAGS"
ths76d83bd2007-11-18 21:22:10 +0000714 ;;
bellard40293e52008-01-31 11:32:10 +0000715 i386)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200716 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200717 LDFLAGS="-m32 $LDFLAGS"
Juan Quintelac81da562009-08-03 14:46:24 +0200718 helper_cflags="-fomit-frame-pointer"
Paul Brook379f6692009-07-17 12:48:08 +0100719 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000720 ;;
721 x86_64)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200722 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200723 LDFLAGS="-m64 $LDFLAGS"
Paul Brook379f6692009-07-17 12:48:08 +0100724 host_guest_base="yes"
725 ;;
726 arm*)
727 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000728 ;;
malcf6548c02009-07-18 10:08:40 +0400729 ppc*)
730 host_guest_base="yes"
731 ;;
Aurelien Jarnocc01cc82010-03-27 17:31:04 +0100732 mips*)
733 host_guest_base="yes"
734 ;;
Aurelien Jarno477ba622010-03-29 02:12:51 +0200735 ia64*)
736 host_guest_base="yes"
737 ;;
Richard Hendersonfd76e732010-04-07 04:56:43 -0700738 hppa*)
739 host_guest_base="yes"
740 ;;
blueswir131422552007-04-16 18:27:06 +0000741esac
742
Paul Brook379f6692009-07-17 12:48:08 +0100743[ -z "$guest_base" ] && guest_base="$host_guest_base"
744
pbrookaf5db582006-04-08 14:26:41 +0000745if test x"$show_help" = x"yes" ; then
746cat << EOF
747
748Usage: configure [options]
749Options: [defaults in brackets after descriptions]
750
751EOF
752echo "Standard options:"
753echo " --help print this message"
754echo " --prefix=PREFIX install in PREFIX [$prefix]"
755echo " --interp-prefix=PREFIX where to find shared libraries, etc."
756echo " use %M for cpu name [$interp_prefix]"
757echo " --target-list=LIST set target list [$target_list]"
758echo ""
pbrookaf5db582006-04-08 14:26:41 +0000759echo "Advanced options (experts only):"
760echo " --source-path=PATH path of source code [$source_path]"
761echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
762echo " --cc=CC use C compiler CC [$cc]"
Paolo Bonzini0bfe8cc2010-05-26 16:08:18 +0200763echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
764echo " build time"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200765echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
Jan Kiszkae3fc14c2009-06-30 21:29:03 +0200766echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000767echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000768echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000769echo " --static enable static build [$static]"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200770echo " --mandir=PATH install man pages in PATH"
771echo " --datadir=PATH install firmware in PATH"
772echo " --docdir=PATH install documentation in PATH"
773echo " --bindir=PATH install binaries in PATH"
774echo " --sysconfdir=PATH install config in PATH/qemu"
aurel32f8393942009-04-13 18:45:38 +0000775echo " --enable-debug-tcg enable TCG debugging"
776echo " --disable-debug-tcg disable TCG debugging (default)"
Stefan Weil09695a42009-06-06 16:51:30 +0200777echo " --enable-debug enable common debug build options"
aliguori890b1652008-10-07 21:22:41 +0000778echo " --enable-sparse enable sparse checker"
779echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000780echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000781echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000782echo " --disable-sdl disable SDL"
Juan Quintelac4198152009-08-12 18:29:53 +0200783echo " --enable-sdl enable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000784echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000785echo " --audio-drv-list=LIST set audio drivers list:"
786echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000787echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
788echo " Available cards: $audio_possible_cards"
Markus Armbrustereb852012009-10-27 18:41:44 +0100789echo " --block-drv-whitelist=L set block driver whitelist"
790echo " (affects only QEMU, not qemu-img)"
malc8ff9cbf2008-06-23 18:33:30 +0000791echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000792echo " --disable-xen disable xen backend driver support"
Juan Quintelafc321b42009-08-12 18:29:55 +0200793echo " --enable-xen enable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000794echo " --disable-brlapi disable BrlAPI"
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200795echo " --enable-brlapi enable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000796echo " --disable-vnc-tls disable TLS encryption for VNC server"
Juan Quintela1be10ad2009-08-12 18:20:28 +0200797echo " --enable-vnc-tls enable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000798echo " --disable-vnc-sasl disable SASL encryption for VNC server"
Juan Quintelaea784e32009-08-12 18:20:29 +0200799echo " --enable-vnc-sasl enable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000800echo " --disable-curses disable curses output"
Juan Quintelac584a6d2009-08-12 18:20:30 +0200801echo " --enable-curses enable curses output"
Alexander Graf769ce762009-05-11 17:41:42 +0200802echo " --disable-curl disable curl connectivity"
Juan Quintela788c8192009-08-12 18:29:47 +0200803echo " --enable-curl enable curl connectivity"
Juan Quintela2df87df2009-08-12 18:29:54 +0200804echo " --disable-fdt disable fdt device tree"
805echo " --enable-fdt enable fdt device tree"
Luiz Capitulino5495ed12009-08-28 15:27:28 -0300806echo " --disable-check-utests disable check unit-tests"
807echo " --enable-check-utests enable check unit-tests"
balrogfb599c92008-09-28 23:49:55 +0000808echo " --disable-bluez disable bluez stack connectivity"
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200809echo " --enable-bluez enable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000810echo " --disable-kvm disable KVM acceleration support"
Juan Quintelab31a0272009-08-12 18:29:56 +0200811echo " --enable-kvm enable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000812echo " --disable-nptl disable usermode NPTL support"
Andre Przywarae5934d32009-09-16 14:29:07 +0200813echo " --enable-nptl enable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000814echo " --enable-system enable all system emulation targets"
815echo " --disable-system disable all system emulation targets"
Zachary Amsden0953a802009-07-30 00:14:59 -1000816echo " --enable-user enable supported user emulation targets"
817echo " --disable-user disable all user emulation targets"
ths831b7822007-01-18 20:06:33 +0000818echo " --enable-linux-user enable all linux usermode emulation targets"
819echo " --disable-linux-user disable all linux usermode emulation targets"
820echo " --enable-darwin-user enable all darwin usermode emulation targets"
821echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000822echo " --enable-bsd-user enable all BSD usermode emulation targets"
823echo " --disable-bsd-user disable all BSD usermode emulation targets"
Paul Brook379f6692009-07-17 12:48:08 +0100824echo " --enable-guest-base enable GUEST_BASE support for usermode"
825echo " emulation targets"
826echo " --disable-guest-base disable GUEST_BASE support"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300827echo " --enable-user-pie build usermode emulation targets as PIE"
828echo " --disable-user-pie do not build usermode emulation targets as PIE"
pbrookaf5db582006-04-08 14:26:41 +0000829echo " --fmod-lib path to FMOD library"
830echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000831echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000832echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000833echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
Stefan Weilee682d22009-10-01 20:10:37 +0200834echo " --disable-uuid disable uuid support"
835echo " --enable-uuid enable uuid support"
aliguorie0e6c8c02008-07-23 18:14:33 +0000836echo " --disable-vde disable support for vde network"
Juan Quinteladfb278b2009-08-12 18:20:27 +0200837echo " --enable-vde enable support for vde network"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200838echo " --disable-linux-aio disable Linux AIO support"
839echo " --enable-linux-aio enable Linux AIO support"
aliguorie5d355d2009-04-24 18:03:15 +0000840echo " --enable-io-thread enable IO thread"
ths77755342008-11-27 15:45:16 +0000841echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000842echo " --kerneldir=PATH look for kernel includes in PATH"
Dirk Ullrichd2807bc2010-02-06 09:48:23 +0100843echo " --enable-docs enable documentation build"
844echo " --disable-docs disable documentation build"
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200845echo " --disable-vhost-net disable vhost-net acceleration support"
846echo " --enable-vhost-net enable vhost-net acceleration support"
pbrookaf5db582006-04-08 14:26:41 +0000847echo ""
ths5bf08932006-12-23 00:33:26 +0000848echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000849exit 1
850fi
851
bellardec530c82006-04-25 22:36:06 +0000852#
853# Solaris specific configure tool chain decisions
854#
855if test "$solaris" = "yes" ; then
Loïc Minier6792aa12010-01-20 11:35:54 +0100856 if has $install; then
857 :
858 else
bellardec530c82006-04-25 22:36:06 +0000859 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
860 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
861 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
862 exit 1
863 fi
Loïc Minier6792aa12010-01-20 11:35:54 +0100864 if test "`path_of $install`" = "/usr/sbin/install" ; then
bellardec530c82006-04-25 22:36:06 +0000865 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
866 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
867 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
868 exit 1
869 fi
Loïc Minier6792aa12010-01-20 11:35:54 +0100870 if has ar; then
871 :
872 else
bellardec530c82006-04-25 22:36:06 +0000873 echo "Error: No path includes ar"
874 if test -f /usr/ccs/bin/ar ; then
875 echo "Add /usr/ccs/bin to your path and rerun configure"
876 fi
877 exit 1
878 fi
ths5fafdf22007-09-16 21:08:06 +0000879fi
bellardec530c82006-04-25 22:36:06 +0000880
881
bellard5327cf42005-01-10 23:18:50 +0000882if test -z "$target_list" ; then
883# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000884 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000885 target_list="\
886i386-softmmu \
887x86_64-softmmu \
888arm-softmmu \
889cris-softmmu \
890m68k-softmmu \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200891microblaze-softmmu \
aurel322408a522008-04-20 20:19:44 +0000892mips-softmmu \
893mipsel-softmmu \
894mips64-softmmu \
895mips64el-softmmu \
896ppc-softmmu \
897ppcemb-softmmu \
898ppc64-softmmu \
899sh4-softmmu \
900sh4eb-softmmu \
901sparc-softmmu \
Igor V. Kovalenko1b64fca2009-06-23 18:04:16 +0000902sparc64-softmmu \
aurel322408a522008-04-20 20:19:44 +0000903"
pbrook0a8e90f2006-03-19 14:54:16 +0000904 fi
bellard5327cf42005-01-10 23:18:50 +0000905# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000906 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000907 target_list="${target_list}\
908i386-linux-user \
909x86_64-linux-user \
910alpha-linux-user \
911arm-linux-user \
912armeb-linux-user \
913cris-linux-user \
914m68k-linux-user \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200915microblaze-linux-user \
aurel322408a522008-04-20 20:19:44 +0000916mips-linux-user \
917mipsel-linux-user \
918ppc-linux-user \
919ppc64-linux-user \
920ppc64abi32-linux-user \
921sh4-linux-user \
922sh4eb-linux-user \
923sparc-linux-user \
924sparc64-linux-user \
925sparc32plus-linux-user \
926"
ths831b7822007-01-18 20:06:33 +0000927 fi
928# the following are Darwin specific
929 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000930 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000931 fi
blueswir184778502008-10-26 20:33:16 +0000932# the following are BSD specific
933 if [ "$bsd_user" = "yes" ] ; then
934 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000935i386-bsd-user \
936x86_64-bsd-user \
937sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000938sparc64-bsd-user \
939"
940 fi
bellard6e20a452005-06-05 15:56:02 +0000941else
pbrookb1a550a2006-04-16 13:28:56 +0000942 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000943fi
pbrook0a8e90f2006-03-19 14:54:16 +0000944if test -z "$target_list" ; then
945 echo "No targets enabled"
946 exit 1
947fi
Paolo Bonzinif55fe272010-05-26 16:08:17 +0200948# see if system emulation was really requested
949case " $target_list " in
950 *"-softmmu "*) softmmu=yes
951 ;;
952 *) softmmu=no
953 ;;
954esac
bellard5327cf42005-01-10 23:18:50 +0000955
Juan Quintela249247c2009-08-12 18:20:25 +0200956feature_not_found() {
957 feature=$1
958
959 echo "ERROR"
960 echo "ERROR: User requested feature $feature"
Sebastian Herbszt9332f6a2009-09-13 21:32:54 +0200961 echo "ERROR: configure was not able to find it"
Juan Quintela249247c2009-08-12 18:20:25 +0200962 echo "ERROR"
963 exit 1;
964}
965
bellard7d132992003-03-06 23:23:54 +0000966if test -z "$cross_prefix" ; then
967
968# ---
969# big/little endian test
970cat > $TMPC << EOF
971#include <inttypes.h>
972int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000973 volatile uint32_t i=0x01234567;
974 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000975}
976EOF
977
Juan Quintela52166aa2009-08-03 14:46:03 +0200978if compile_prog "" "" ; then
bellard7d132992003-03-06 23:23:54 +0000979$TMPE && bigendian="yes"
980else
981echo big/little test failed
982fi
983
984else
985
986# if cross compiling, cannot launch a program, so make a static guess
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200987case "$cpu" in
Alexander Graf24e804ec2009-12-05 12:44:22 +0100988 armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200989 bigendian=yes
990 ;;
991esac
bellard7d132992003-03-06 23:23:54 +0000992
993fi
994
bellardb6853692005-06-05 17:10:39 +0000995# host long bits test
996hostlongbits="32"
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200997case "$cpu" in
Alexander Graf24e804ec2009-12-05 12:44:22 +0100998 x86_64|alpha|ia64|sparc64|ppc64|s390x)
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200999 hostlongbits=64
1000 ;;
1001esac
bellardb6853692005-06-05 17:10:39 +00001002
Juan Quintelab0a47e72009-08-12 18:29:49 +02001003
1004##########################################
1005# NPTL probe
1006
1007if test "$nptl" != "no" ; then
1008 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00001009#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00001010#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +00001011void foo()
1012{
1013#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1014#error bork
1015#endif
1016}
1017EOF
1018
Juan Quintelab0a47e72009-08-12 18:29:49 +02001019 if compile_object ; then
1020 nptl=yes
1021 else
1022 if test "$nptl" = "yes" ; then
1023 feature_not_found "nptl"
1024 fi
1025 nptl=no
1026 fi
pbrookbd0c5662008-05-29 14:34:11 +00001027fi
1028
bellard11d9f692004-04-02 20:55:59 +00001029##########################################
balrogac629222008-10-11 09:56:04 +00001030# zlib check
1031
1032cat > $TMPC << EOF
1033#include <zlib.h>
1034int main(void) { zlibVersion(); return 0; }
1035EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001036if compile_prog "" "-lz" ; then
balrogac629222008-10-11 09:56:04 +00001037 :
1038else
1039 echo
1040 echo "Error: zlib check failed"
1041 echo "Make sure to have the zlib libs and headers installed."
1042 echo
1043 exit 1
1044fi
1045
1046##########################################
aliguorie37630c2009-04-22 15:19:10 +00001047# xen probe
1048
Juan Quintelafc321b42009-08-12 18:29:55 +02001049if test "$xen" != "no" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +02001050 xen_libs="-lxenstore -lxenctrl -lxenguest"
1051 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00001052#include <xenctrl.h>
1053#include <xs.h>
Christoph Eggerdf7a6072009-06-30 14:59:38 +02001054int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
aliguorie37630c2009-04-22 15:19:10 +00001055EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001056 if compile_prog "" "$xen_libs" ; then
Juan Quintelafc321b42009-08-12 18:29:55 +02001057 xen=yes
Juan Quintela3efd6322009-08-03 14:46:36 +02001058 libs_softmmu="$xen_libs $libs_softmmu"
Juan Quintelab2266be2009-07-27 16:13:16 +02001059 else
Juan Quintelafc321b42009-08-12 18:29:55 +02001060 if test "$xen" = "yes" ; then
1061 feature_not_found "xen"
1062 fi
1063 xen=no
Juan Quintelab2266be2009-07-27 16:13:16 +02001064 fi
aliguorie37630c2009-04-22 15:19:10 +00001065fi
1066
1067##########################################
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001068# pkgconfig probe
1069
1070pkgconfig="${cross_prefix}pkg-config"
Loïc Minier0dba6192010-01-28 21:26:51 +00001071if ! has $pkgconfig; then
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001072 # likely not cross compiling, or hope for the best
1073 pkgconfig=pkg-config
1074fi
1075
1076##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02001077# Sparse probe
1078if test "$sparse" != "no" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001079 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02001080 sparse=yes
1081 else
1082 if test "$sparse" = "yes" ; then
1083 feature_not_found "sparse"
1084 fi
1085 sparse=no
1086 fi
1087fi
1088
1089##########################################
bellard11d9f692004-04-02 20:55:59 +00001090# SDL probe
1091
Stefan Weilfec0e3e2010-04-11 18:44:18 +02001092# Look for sdl configuration program (pkg-config or sdl-config).
1093# Prefer variant with cross prefix if cross compiling,
1094# and favour pkg-config with sdl over sdl-config.
1095if test -n "$cross_prefix" -a $pkgconfig != pkg-config && \
1096 $pkgconfig sdl --modversion >/dev/null 2>&1; then
1097 sdlconfig="$pkgconfig sdl"
1098 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1099elif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then
1100 sdlconfig="${cross_prefix}sdl-config"
1101 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1102elif $pkgconfig sdl --modversion >/dev/null 2>&1; then
Paolo Bonzini9316f802010-01-13 09:52:55 +01001103 sdlconfig="$pkgconfig sdl"
1104 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
Loïc Minier0dba6192010-01-28 21:26:51 +00001105elif has sdl-config; then
Paolo Bonzini9316f802010-01-13 09:52:55 +01001106 sdlconfig='sdl-config'
1107 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00001108else
1109 if test "$sdl" = "yes" ; then
1110 feature_not_found "sdl"
1111 fi
1112 sdl=no
Paolo Bonzini9316f802010-01-13 09:52:55 +01001113fi
bellard11d9f692004-04-02 20:55:59 +00001114
Paolo Bonzini9316f802010-01-13 09:52:55 +01001115sdl_too_old=no
Juan Quintelac4198152009-08-12 18:29:53 +02001116if test "$sdl" != "no" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001117 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00001118#include <SDL.h>
1119#undef main /* We don't want SDL to override our main() */
1120int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1121EOF
Paolo Bonzini9316f802010-01-13 09:52:55 +01001122 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
TeLeMan74f42e12010-02-08 13:56:44 +08001123 if test "$static" = "yes" ; then
1124 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1125 else
1126 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1127 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001128 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001129 if test "$_sdlversion" -lt 121 ; then
1130 sdl_too_old=yes
1131 else
1132 if test "$cocoa" = "no" ; then
1133 sdl=yes
1134 fi
1135 fi
aliguoricd01b4a2008-08-21 19:25:45 +00001136
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001137 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Juan Quintelaac119f92009-07-27 16:13:15 +02001138 if test "$sdl" = "yes" -a "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001139 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weilf8aa6c72010-03-01 22:10:46 +01001140 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1141 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
Juan Quintelaac119f92009-07-27 16:13:15 +02001142 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001143 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001144 :
1145 else
1146 sdl=no
1147 fi
1148 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02001149 else # sdl not found
1150 if test "$sdl" = "yes" ; then
1151 feature_not_found "sdl"
1152 fi
1153 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02001154 fi # sdl compile test
Juan Quintelaa68551b2009-07-27 16:13:09 +02001155fi
bellard11d9f692004-04-02 20:55:59 +00001156
aliguori5368a422009-03-03 17:37:21 +00001157if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001158 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00001159#include <SDL.h>
1160#if defined(SDL_VIDEO_DRIVER_X11)
1161#include <X11/XKBlib.h>
1162#else
1163#error No x11 support
1164#endif
1165int main(void) { return 0; }
1166EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001167 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001168 sdl_libs="$sdl_libs -lX11"
1169 fi
Juan Quintela07d9ac42009-08-03 14:46:25 +02001170 if test "$mingw32" = "yes" ; then
1171 sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1172 fi
Juan Quintela07056672009-08-03 14:46:27 +02001173 libs_softmmu="$sdl_libs $libs_softmmu"
aliguori5368a422009-03-03 17:37:21 +00001174fi
1175
ths8f28f3f2007-01-05 21:25:54 +00001176##########################################
ths8d5d2d42007-08-25 01:37:51 +00001177# VNC TLS detection
Juan Quintela1be10ad2009-08-12 18:20:28 +02001178if test "$vnc_tls" != "no" ; then
1179 cat > $TMPC <<EOF
aliguoriae6b5e52008-08-06 16:55:50 +00001180#include <gnutls/gnutls.h>
1181int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1182EOF
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001183 vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null`
1184 vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null`
Juan Quintela1be10ad2009-08-12 18:20:28 +02001185 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1186 vnc_tls=yes
1187 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1188 else
1189 if test "$vnc_tls" = "yes" ; then
1190 feature_not_found "vnc-tls"
aliguoriae6b5e52008-08-06 16:55:50 +00001191 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02001192 vnc_tls=no
1193 fi
ths8d5d2d42007-08-25 01:37:51 +00001194fi
1195
1196##########################################
aliguori2f9606b2009-03-06 20:27:28 +00001197# VNC SASL detection
Juan Quintela3aefa742009-08-31 17:16:43 +02001198if test "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02001199 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00001200#include <sasl/sasl.h>
1201#include <stdio.h>
1202int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1203EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02001204 # Assuming Cyrus-SASL installed in /usr prefix
1205 vnc_sasl_cflags=""
1206 vnc_sasl_libs="-lsasl2"
1207 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1208 vnc_sasl=yes
1209 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1210 else
1211 if test "$vnc_sasl" = "yes" ; then
1212 feature_not_found "vnc-sasl"
aliguori2f9606b2009-03-06 20:27:28 +00001213 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02001214 vnc_sasl=no
1215 fi
aliguori2f9606b2009-03-06 20:27:28 +00001216fi
1217
1218##########################################
aliguori76655d62009-03-06 20:27:37 +00001219# fnmatch() probe, used for ACL routines
1220fnmatch="no"
1221cat > $TMPC << EOF
1222#include <fnmatch.h>
1223int main(void)
1224{
1225 fnmatch("foo", "foo", 0);
1226 return 0;
1227}
1228EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001229if compile_prog "" "" ; then
aliguori76655d62009-03-06 20:27:37 +00001230 fnmatch="yes"
1231fi
1232
1233##########################################
Stefan Weilee682d22009-10-01 20:10:37 +02001234# uuid_generate() probe, used for vdi block driver
1235if test "$uuid" != "no" ; then
1236 uuid_libs="-luuid"
1237 cat > $TMPC << EOF
1238#include <uuid/uuid.h>
1239int main(void)
1240{
1241 uuid_t my_uuid;
1242 uuid_generate(my_uuid);
1243 return 0;
1244}
1245EOF
1246 if compile_prog "" "$uuid_libs" ; then
1247 uuid="yes"
1248 libs_softmmu="$uuid_libs $libs_softmmu"
1249 libs_tools="$uuid_libs $libs_tools"
1250 else
1251 if test "$uuid" = "yes" ; then
1252 feature_not_found "uuid"
1253 fi
1254 uuid=no
1255 fi
1256fi
1257
1258##########################################
ths8a16d272008-07-19 09:56:24 +00001259# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02001260if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02001261 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00001262 cat > $TMPC << EOF
1263#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00001264int main(void)
1265{
1266 struct vde_open_args a = {0, 0, 0};
1267 vde_open("", "", &a);
1268 return 0;
1269}
ths8a16d272008-07-19 09:56:24 +00001270EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001271 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02001272 vde=yes
Juan Quintela8e02e542009-08-03 14:47:07 +02001273 libs_softmmu="$vde_libs $libs_softmmu"
1274 libs_tools="$vde_libs $libs_tools"
Juan Quinteladfb278b2009-08-12 18:20:27 +02001275 else
1276 if test "$vde" = "yes" ; then
1277 feature_not_found "vde"
1278 fi
1279 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02001280 fi
ths8a16d272008-07-19 09:56:24 +00001281fi
1282
1283##########################################
malcc2de5c92008-06-28 19:13:06 +00001284# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00001285
malcc2de5c92008-06-28 19:13:06 +00001286audio_drv_probe()
1287{
1288 drv=$1
1289 hdr=$2
1290 lib=$3
1291 exp=$4
1292 cfl=$5
1293 cat > $TMPC << EOF
1294#include <$hdr>
1295int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00001296EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001297 if compile_prog "$cfl" "$lib" ; then
malcc2de5c92008-06-28 19:13:06 +00001298 :
1299 else
1300 echo
1301 echo "Error: $drv check failed"
1302 echo "Make sure to have the $drv libs and headers installed."
1303 echo
1304 exit 1
1305 fi
1306}
1307
malc2fa7d3b2008-07-29 12:58:44 +00001308audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00001309for drv in $audio_drv_list; do
1310 case $drv in
1311 alsa)
1312 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1313 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001314 libs_softmmu="-lasound $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00001315 ;;
1316
1317 fmod)
1318 if test -z $fmod_lib || test -z $fmod_inc; then
1319 echo
1320 echo "Error: You must specify path to FMOD library and headers"
1321 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1322 echo
1323 exit 1
1324 fi
1325 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001326 libs_softmmu="$fmod_lib $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00001327 ;;
1328
1329 esd)
1330 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001331 libs_softmmu="-lesd $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02001332 audio_pt_int="yes"
malcc2de5c92008-06-28 19:13:06 +00001333 ;;
malcb8e59f12008-07-02 21:03:08 +00001334
1335 pa)
Aurelien Jarno493abda2009-11-16 17:52:03 +01001336 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
malcb8e59f12008-07-02 21:03:08 +00001337 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
Aurelien Jarno493abda2009-11-16 17:52:03 +01001338 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02001339 audio_pt_int="yes"
malcb8e59f12008-07-02 21:03:08 +00001340 ;;
1341
Juan Quintela997e6902009-08-03 14:46:29 +02001342 coreaudio)
1343 libs_softmmu="-framework CoreAudio $libs_softmmu"
1344 ;;
1345
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001346 dsound)
1347 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
malcd5631632009-10-10 01:13:41 +04001348 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001349 ;;
1350
1351 oss)
1352 libs_softmmu="$oss_lib $libs_softmmu"
1353 ;;
1354
1355 sdl|wav)
blueswir12f6a1ab2008-08-21 18:00:53 +00001356 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1357 ;;
1358
malcd5631632009-10-10 01:13:41 +04001359 winwave)
1360 libs_softmmu="-lwinmm $libs_softmmu"
1361 audio_win_int="yes"
1362 ;;
1363
malce4c63a62008-07-19 16:15:16 +00001364 *)
malc1c9b2a52008-07-19 16:57:30 +00001365 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001366 echo
1367 echo "Error: Unknown driver '$drv' selected"
1368 echo "Possible drivers are: $audio_possible_drivers"
1369 echo
1370 exit 1
1371 }
1372 ;;
malcc2de5c92008-06-28 19:13:06 +00001373 esac
1374done
ths8f28f3f2007-01-05 21:25:54 +00001375
balrog4d3b6f62008-02-10 16:33:14 +00001376##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001377# BrlAPI probe
1378
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001379if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001380 brlapi_libs="-lbrlapi"
1381 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00001382#include <brlapi.h>
1383int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1384EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001385 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001386 brlapi=yes
Juan Quintela264606b2009-08-03 14:46:39 +02001387 libs_softmmu="$brlapi_libs $libs_softmmu"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001388 else
1389 if test "$brlapi" = "yes" ; then
1390 feature_not_found "brlapi"
1391 fi
1392 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02001393 fi
1394fi
aurel322e4d9fb2008-04-08 06:01:02 +00001395
1396##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001397# curses probe
Juan Quintela4f78ef92009-08-12 18:20:23 +02001398curses_list="-lncurses -lcurses"
balrog4d3b6f62008-02-10 16:33:14 +00001399
Juan Quintelac584a6d2009-08-12 18:20:30 +02001400if test "$curses" != "no" ; then
1401 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00001402 cat > $TMPC << EOF
1403#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001404#ifdef __OpenBSD__
1405#define resize_term resizeterm
1406#endif
1407int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001408EOF
Juan Quintela4f78ef92009-08-12 18:20:23 +02001409 for curses_lib in $curses_list; do
1410 if compile_prog "" "$curses_lib" ; then
Juan Quintelac584a6d2009-08-12 18:20:30 +02001411 curses_found=yes
Juan Quintela4f78ef92009-08-12 18:20:23 +02001412 libs_softmmu="$curses_lib $libs_softmmu"
1413 break
1414 fi
1415 done
Juan Quintelac584a6d2009-08-12 18:20:30 +02001416 if test "$curses_found" = "yes" ; then
1417 curses=yes
1418 else
1419 if test "$curses" = "yes" ; then
1420 feature_not_found "curses"
1421 fi
1422 curses=no
1423 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02001424fi
balrog4d3b6f62008-02-10 16:33:14 +00001425
blueswir1414f0da2008-08-15 18:20:52 +00001426##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001427# curl probe
1428
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01001429if $pkgconfig libcurl --modversion >/dev/null 2>&1; then
1430 curlconfig="$pkgconfig libcurl"
1431else
1432 curlconfig=curl-config
1433fi
1434
Juan Quintela788c8192009-08-12 18:29:47 +02001435if test "$curl" != "no" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001436 cat > $TMPC << EOF
1437#include <curl/curl.h>
1438int main(void) { return curl_easy_init(); }
1439EOF
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01001440 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1441 curl_libs=`$curlconfig --libs 2>/dev/null`
Juan Quintelab1d5a272009-08-03 14:46:05 +02001442 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001443 curl=yes
Juan Quintelaf0302932009-08-03 14:47:08 +02001444 libs_tools="$curl_libs $libs_tools"
1445 libs_softmmu="$curl_libs $libs_softmmu"
Juan Quintela788c8192009-08-12 18:29:47 +02001446 else
1447 if test "$curl" = "yes" ; then
1448 feature_not_found "curl"
1449 fi
1450 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02001451 fi
1452fi # test "$curl"
1453
1454##########################################
Luiz Capitulino5495ed12009-08-28 15:27:28 -03001455# check framework probe
1456
1457if test "$check_utests" != "no" ; then
1458 cat > $TMPC << EOF
1459#include <check.h>
1460int main(void) { suite_create("qemu test"); return 0; }
1461EOF
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001462 check_libs=`$pkgconfig --libs check`
Luiz Capitulino5495ed12009-08-28 15:27:28 -03001463 if compile_prog "" $check_libs ; then
1464 check_utests=yes
1465 libs_tools="$check_libs $libs_tools"
1466 else
1467 if test "$check_utests" = "yes" ; then
1468 feature_not_found "check"
1469 fi
1470 check_utests=no
1471 fi
1472fi # test "$check_utests"
1473
1474##########################################
balrogfb599c92008-09-28 23:49:55 +00001475# bluez support probe
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001476if test "$bluez" != "no" ; then
balroge820e3f2008-09-30 02:27:44 +00001477 cat > $TMPC << EOF
1478#include <bluetooth/bluetooth.h>
1479int main(void) { return bt_error(0); }
1480EOF
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001481 bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null`
1482 bluez_libs=`$pkgconfig --libs bluez 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +02001483 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001484 bluez=yes
Juan Quintelae482d562009-08-03 14:46:37 +02001485 libs_softmmu="$bluez_libs $libs_softmmu"
balroge820e3f2008-09-30 02:27:44 +00001486 else
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001487 if test "$bluez" = "yes" ; then
1488 feature_not_found "bluez"
1489 fi
balroge820e3f2008-09-30 02:27:44 +00001490 bluez="no"
1491 fi
balrogfb599c92008-09-28 23:49:55 +00001492fi
1493
1494##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001495# kvm probe
Juan Quintelab31a0272009-08-12 18:29:56 +02001496if test "$kvm" != "no" ; then
aliguori7ba1e612008-11-05 16:04:33 +00001497 cat > $TMPC <<EOF
1498#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001499#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001500#error Invalid KVM version
1501#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001502#if !defined(KVM_CAP_USER_MEMORY)
1503#error Missing KVM capability KVM_CAP_USER_MEMORY
1504#endif
1505#if !defined(KVM_CAP_SET_TSS_ADDR)
1506#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1507#endif
1508#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1509#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1510#endif
aliguori7ba1e612008-11-05 16:04:33 +00001511int main(void) { return 0; }
1512EOF
aliguorieac30262008-11-05 16:28:56 +00001513 if test "$kerneldir" != "" ; then
1514 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001515 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1516 -a -d "$kerneldir/arch/x86/include" ; then
1517 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001518 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1519 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
Alexander Graf0e60a692009-12-05 12:44:24 +01001520 elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
1521 kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
aliguori8444eb62009-01-09 20:05:10 +00001522 elif test -d "$kerneldir/arch/$cpu/include" ; then
1523 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1524 fi
aliguorieac30262008-11-05 16:28:56 +00001525 else
Stefan Weilf038e8f2010-04-11 19:01:01 +02001526 kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null`
aliguorieac30262008-11-05 16:28:56 +00001527 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001528 if compile_prog "$kvm_cflags" "" ; then
Juan Quintelab31a0272009-08-12 18:29:56 +02001529 kvm=yes
Jan Kiszkadae50792010-01-12 19:53:48 +01001530 cat > $TMPC <<EOF
1531#include <linux/kvm_para.h>
1532int main(void) { return 0; }
1533EOF
1534 if compile_prog "$kvm_cflags" "" ; then
1535 kvm_para=yes
1536 fi
aliguori7ba1e612008-11-05 16:04:33 +00001537 else
Juan Quintelab31a0272009-08-12 18:29:56 +02001538 if test "$kvm" = "yes" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001539 if has awk && has grep; then
Juan Quintelab31a0272009-08-12 18:29:56 +02001540 kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001541 | grep "error: " \
1542 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
Juan Quintelab31a0272009-08-12 18:29:56 +02001543 if test "$kvmerr" != "" ; then
1544 echo -e "${kvmerr}\n\
1545 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1546 recent kvm-kmod from http://sourceforge.net/projects/kvm."
1547 fi
aliguori9fd8d8d2009-01-15 21:57:30 +00001548 fi
Juan Quintelab31a0272009-08-12 18:29:56 +02001549 feature_not_found "kvm"
aliguori9fd8d8d2009-01-15 21:57:30 +00001550 fi
Juan Quintelab31a0272009-08-12 18:29:56 +02001551 kvm=no
aliguori7ba1e612008-11-05 16:04:33 +00001552 fi
1553fi
1554
1555##########################################
Michael S. Tsirkind5970052010-03-17 13:08:17 +02001556# test for vhost net
1557
1558if test "$vhost_net" != "no"; then
1559 if test "$kvm" != "no"; then
1560 cat > $TMPC <<EOF
1561 #include <linux/vhost.h>
1562 int main(void) { return 0; }
1563EOF
1564 if compile_prog "$kvm_cflags" "" ; then
1565 vhost_net=yes
1566 else
1567 if test "$vhost_net" = "yes" ; then
1568 feature_not_found "vhost-net"
1569 fi
1570 vhost_net=no
1571 fi
1572 else
1573 if test "$vhost_net" = "yes" ; then
Aurelien Jarno4021d242010-06-10 00:06:55 +02001574 echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
Michael S. Tsirkind5970052010-03-17 13:08:17 +02001575 feature_not_found "vhost-net"
1576 fi
1577 vhost_net=no
1578 fi
1579fi
1580
1581##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001582# pthread probe
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001583PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00001584
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02001585pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00001586cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001587#include <pthread.h>
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001588int main(void) { pthread_create(0,0,0,0); return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001589EOF
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02001590for pthread_lib in $PTHREADLIBS_LIST; do
1591 if compile_prog "" "$pthread_lib" ; then
1592 pthread=yes
1593 LIBS="$pthread_lib $LIBS"
1594 break
1595 fi
1596done
blueswir1414f0da2008-08-15 18:20:52 +00001597
Anthony Liguori4617e592009-08-25 17:21:56 -05001598if test "$mingw32" != yes -a "$pthread" = no; then
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02001599 echo
1600 echo "Error: pthread check failed"
1601 echo "Make sure to have the pthread libs and headers installed."
1602 echo
1603 exit 1
aliguorie5d355d2009-04-24 18:03:15 +00001604fi
1605
aliguoribf9298b2008-12-05 20:05:26 +00001606##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001607# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001608
1609if test "$linux_aio" != "no" ; then
1610 cat > $TMPC <<EOF
1611#include <libaio.h>
1612#include <sys/eventfd.h>
1613int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1614EOF
1615 if compile_prog "" "-laio" ; then
1616 linux_aio=yes
Paul Brook048d1792010-05-05 16:32:59 +01001617 libs_softmmu="$libs_softmmu -laio"
1618 libs_tools="$libs_tools -laio"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001619 else
1620 if test "$linux_aio" = "yes" ; then
1621 feature_not_found "linux AIO"
1622 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03001623 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001624 fi
1625fi
1626
1627##########################################
aliguoribf9298b2008-12-05 20:05:26 +00001628# iovec probe
1629cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001630#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001631#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001632#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001633int main(void) { struct iovec iov; return 0; }
1634EOF
1635iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02001636if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00001637 iovec=yes
1638fi
1639
aurel32f652e6a2008-12-16 10:43:48 +00001640##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001641# preadv probe
1642cat > $TMPC <<EOF
1643#include <sys/types.h>
1644#include <sys/uio.h>
1645#include <unistd.h>
1646int main(void) { preadv; }
1647EOF
1648preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02001649if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00001650 preadv=yes
1651fi
1652
1653##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001654# fdt probe
Juan Quintela2df87df2009-08-12 18:29:54 +02001655if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02001656 fdt_libs="-lfdt"
1657 cat > $TMPC << EOF
aurel32f652e6a2008-12-16 10:43:48 +00001658int main(void) { return 0; }
1659EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001660 if compile_prog "" "$fdt_libs" ; then
aurel32f652e6a2008-12-16 10:43:48 +00001661 fdt=yes
Juan Quintelae4782982009-08-03 14:46:38 +02001662 libs_softmmu="$fdt_libs $libs_softmmu"
Juan Quintela2df87df2009-08-12 18:29:54 +02001663 else
1664 if test "$fdt" = "yes" ; then
1665 feature_not_found "fdt"
1666 fi
1667 fdt=no
aurel32f652e6a2008-12-16 10:43:48 +00001668 fi
1669fi
1670
aurel323b3f24a2009-04-15 16:12:13 +00001671#
1672# Check for xxxat() functions when we are building linux-user
1673# emulator. This is done because older glibc versions don't
1674# have syscall stubs for these implemented.
1675#
1676atfile=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03001677cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00001678#define _ATFILE_SOURCE
1679#include <sys/types.h>
1680#include <fcntl.h>
1681#include <unistd.h>
1682
1683int
1684main(void)
1685{
1686 /* try to unlink nonexisting file */
1687 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1688}
1689EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001690if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03001691 atfile=yes
aurel323b3f24a2009-04-15 16:12:13 +00001692fi
1693
aurel3239386ac2009-04-15 19:48:17 +00001694# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001695# emulator. This is done because older glibc versions don't
1696# have syscall stubs for these implemented. In that case we
1697# don't provide them even if kernel supports them.
1698#
1699inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03001700cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00001701#include <sys/inotify.h>
1702
1703int
1704main(void)
1705{
1706 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001707 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001708}
1709EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001710if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03001711 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00001712fi
1713
Riku Voipioc05c7a72010-03-26 15:25:11 +00001714inotify1=no
1715cat > $TMPC << EOF
1716#include <sys/inotify.h>
1717
1718int
1719main(void)
1720{
1721 /* try to start inotify */
1722 return inotify_init1(0);
1723}
1724EOF
1725if compile_prog "" "" ; then
1726 inotify1=yes
1727fi
1728
Riku Voipioebc996f2009-04-21 15:01:51 +03001729# check if utimensat and futimens are supported
1730utimens=no
1731cat > $TMPC << EOF
1732#define _ATFILE_SOURCE
1733#define _GNU_SOURCE
1734#include <stddef.h>
1735#include <fcntl.h>
1736
1737int main(void)
1738{
1739 utimensat(AT_FDCWD, "foo", NULL, 0);
1740 futimens(0, NULL);
1741 return 0;
1742}
1743EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001744if compile_prog "" "" ; then
Riku Voipioebc996f2009-04-21 15:01:51 +03001745 utimens=yes
1746fi
1747
Riku Voipio099d6b02009-05-05 12:10:04 +03001748# check if pipe2 is there
1749pipe2=no
1750cat > $TMPC << EOF
1751#define _GNU_SOURCE
1752#include <unistd.h>
1753#include <fcntl.h>
1754
1755int main(void)
1756{
1757 int pipefd[2];
1758 pipe2(pipefd, O_CLOEXEC);
1759 return 0;
1760}
1761EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001762if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03001763 pipe2=yes
1764fi
1765
Kevin Wolf40ff6d72009-12-02 12:24:42 +01001766# check if accept4 is there
1767accept4=no
1768cat > $TMPC << EOF
1769#define _GNU_SOURCE
1770#include <sys/socket.h>
1771#include <stddef.h>
1772
1773int main(void)
1774{
1775 accept4(0, NULL, NULL, SOCK_CLOEXEC);
1776 return 0;
1777}
1778EOF
1779if compile_prog "" "" ; then
1780 accept4=yes
1781fi
1782
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301783# check if tee/splice is there. vmsplice was added same time.
1784splice=no
1785cat > $TMPC << EOF
1786#define _GNU_SOURCE
1787#include <unistd.h>
1788#include <fcntl.h>
1789#include <limits.h>
1790
1791int main(void)
1792{
1793 int len, fd;
1794 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1795 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1796 return 0;
1797}
1798EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001799if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301800 splice=yes
1801fi
1802
Riku Voipioc2882b92009-08-12 15:08:24 +03001803# check if eventfd is supported
1804eventfd=no
1805cat > $TMPC << EOF
1806#include <sys/eventfd.h>
1807
1808int main(void)
1809{
1810 int efd = eventfd(0, 0);
1811 return 0;
1812}
1813EOF
1814if compile_prog "" "" ; then
1815 eventfd=yes
1816fi
1817
Ulrich Hechtd0927932009-09-17 20:22:14 +03001818# check for fallocate
1819fallocate=no
1820cat > $TMPC << EOF
1821#include <fcntl.h>
1822
1823int main(void)
1824{
1825 fallocate(0, 0, 0, 0);
1826 return 0;
1827}
1828EOF
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +02001829if compile_prog "$ARCH_CFLAGS" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03001830 fallocate=yes
1831fi
1832
1833# check for dup3
1834dup3=no
1835cat > $TMPC << EOF
1836#include <unistd.h>
1837
1838int main(void)
1839{
1840 dup3(0, 0, 0);
1841 return 0;
1842}
1843EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01001844if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03001845 dup3=yes
1846fi
1847
pbrookcc8ae6d2006-04-23 17:57:59 +00001848# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02001849if test "$docs" != "no" ; then
Stefan Weil01668d92010-03-04 22:21:02 +01001850 if has makeinfo && has pod2man; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02001851 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02001852 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02001853 if test "$docs" = "yes" ; then
1854 feature_not_found "docs"
Juan Quintela83a3ab82009-08-12 18:29:51 +02001855 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02001856 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02001857 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00001858fi
1859
Stefan Weilf514f412009-10-11 12:44:07 +02001860# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02001861byteswap_h=no
1862cat > $TMPC << EOF
1863#include <byteswap.h>
1864int main(void) { return bswap_32(0); }
1865EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001866if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02001867 byteswap_h=yes
1868fi
1869
Stefan Weilf514f412009-10-11 12:44:07 +02001870# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02001871bswap_h=no
1872cat > $TMPC << EOF
1873#include <sys/endian.h>
1874#include <sys/types.h>
1875#include <machine/bswap.h>
1876int main(void) { return bswap32(0); }
1877EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001878if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02001879 bswap_h=yes
1880fi
1881
aliguorida93a1f2008-12-12 20:02:52 +00001882##########################################
1883# Do we need librt
1884cat > $TMPC <<EOF
1885#include <signal.h>
1886#include <time.h>
1887int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1888EOF
1889
Juan Quintela52166aa2009-08-03 14:46:03 +02001890if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02001891 :
Juan Quintela52166aa2009-08-03 14:46:03 +02001892elif compile_prog "" "-lrt" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02001893 LIBS="-lrt $LIBS"
aliguorida93a1f2008-12-12 20:02:52 +00001894fi
1895
Blue Swirl31ff5042009-09-12 12:33:07 +00001896if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
Juan Quintela6362a532009-08-03 14:46:32 +02001897 "$aix" != "yes" ; then
1898 libs_softmmu="-lutil $libs_softmmu"
1899fi
1900
Blue Swirlde5071c2009-09-12 09:58:46 +00001901##########################################
1902# check if the compiler defines offsetof
1903
1904need_offsetof=yes
1905cat > $TMPC << EOF
1906#include <stddef.h>
1907int main(void) { struct s { int f; }; return offsetof(struct s, f); }
1908EOF
1909if compile_prog "" "" ; then
1910 need_offsetof=no
1911fi
1912
Blue Swirl5f6b9e82009-09-20 06:56:26 +00001913##########################################
Blue Swirl747bbdf2009-10-18 16:26:06 +00001914# check if the compiler understands attribute warn_unused_result
1915#
1916# This could be smarter, but gcc -Werror does not error out even when warning
1917# about attribute warn_unused_result
1918
1919gcc_attribute_warn_unused_result=no
1920cat > $TMPC << EOF
1921#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
1922#error gcc 3.3 or older
1923#endif
1924int main(void) { return 0;}
1925EOF
1926if compile_prog "" ""; then
1927 gcc_attribute_warn_unused_result=yes
1928fi
1929
1930##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00001931# check if we have fdatasync
1932
1933fdatasync=no
1934cat > $TMPC << EOF
1935#include <unistd.h>
1936int main(void) { return fdatasync(0); }
1937EOF
1938if compile_prog "" "" ; then
1939 fdatasync=yes
1940fi
1941
Juan Quintelae86ecd42009-08-03 14:45:59 +02001942# End of CC checks
1943# After here, no more $cc or $ld runs
1944
Juan Quintelae86ecd42009-08-03 14:45:59 +02001945if test "$debug" = "no" ; then
Juan Quintela1156c662009-08-03 14:46:00 +02001946 CFLAGS="-O2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02001947fi
Juan Quintelaa316e372009-09-30 01:10:55 +02001948
Juan Quintelae86ecd42009-08-03 14:45:59 +02001949# Consult white-list to determine whether to enable werror
1950# by default. Only enable by default for git builds
Anthony Liguori20ff6c82009-12-09 12:59:36 -06001951z_version=`cut -f3 -d. $source_path/VERSION`
1952
Juan Quintelae86ecd42009-08-03 14:45:59 +02001953if test -z "$werror" ; then
Juan Quintelae86ecd42009-08-03 14:45:59 +02001954 if test "$z_version" = "50" -a \
1955 "$linux" = "yes" ; then
1956 werror="yes"
1957 else
1958 werror="no"
1959 fi
1960fi
1961
Anthony Liguori20ff6c82009-12-09 12:59:36 -06001962# Disable zero malloc errors for official releases unless explicitly told to
1963# enable/disable
1964if test -z "$zero_malloc" ; then
1965 if test "$z_version" = "50" ; then
1966 zero_malloc="no"
1967 else
1968 zero_malloc="yes"
1969 fi
1970fi
1971
Juan Quintelae86ecd42009-08-03 14:45:59 +02001972if test "$werror" = "yes" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +02001973 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02001974fi
1975
1976if test "$solaris" = "no" ; then
1977 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02001978 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02001979 fi
1980fi
1981
bellard11d9f692004-04-02 20:55:59 +00001982if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001983 if test -z "$prefix" ; then
Stefan Weil55418b92009-07-31 21:30:45 +02001984 prefix="c:/Program Files/Qemu"
pbrook308c3592007-02-27 00:52:01 +00001985 fi
1986 mansuffix=""
1987 datasuffix=""
1988 docsuffix=""
1989 binsuffix=""
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02001990 sysconfsuffix=""
Paolo Bonzini190e9c52010-05-26 16:08:21 +02001991 confsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001992else
pbrook308c3592007-02-27 00:52:01 +00001993 if test -z "$prefix" ; then
1994 prefix="/usr/local"
1995 fi
1996 mansuffix="/share/man"
1997 datasuffix="/share/qemu"
1998 docsuffix="/share/doc/qemu"
1999 binsuffix="/bin"
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02002000 sysconfsuffix="/etc"
Paolo Bonzini190e9c52010-05-26 16:08:21 +02002001 confsuffix="/qemu"
bellard11d9f692004-04-02 20:55:59 +00002002fi
bellard5a671352003-10-01 00:13:48 +00002003
Paolo Bonzini0b24e752010-05-26 16:08:26 +02002004: ${mandir:="\${prefix}$mansuffix"}
2005: ${datadir:="\${prefix}$datasuffix"}
2006: ${docdir:="\${prefix}$docsuffix"}
2007: ${bindir:="\${prefix}$binsuffix"}
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002008: ${sysconfdir:="\${prefix}$sysconfsuffix"}
Paolo Bonzini190e9c52010-05-26 16:08:21 +02002009confdir=$sysconfdir$confsuffix
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02002010
bellard43ce4df2003-06-09 19:53:12 +00002011echo "Install prefix $prefix"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002012echo "BIOS directory `eval echo $datadir`"
2013echo "binary directory `eval echo $bindir`"
bellard11d9f692004-04-02 20:55:59 +00002014if test "$mingw32" = "no" ; then
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002015echo "Manual directory `eval echo $mandir`"
bellard43ce4df2003-06-09 19:53:12 +00002016echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00002017fi
bellard5a671352003-10-01 00:13:48 +00002018echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00002019echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00002020echo "Host C compiler $host_cc"
Juan Quintela0c439cb2009-08-03 14:46:01 +02002021echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02002022echo "QEMU_CFLAGS $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02002023echo "LDFLAGS $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00002024echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00002025echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00002026echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00002027echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00002028echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00002029echo "tcg debug enabled $debug_tcg"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -02002030echo "Mon debug enabled $debug_mon"
bellard43ce4df2003-06-09 19:53:12 +00002031echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00002032echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00002033echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00002034echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00002035echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00002036echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00002037if test "$darwin" = "yes" ; then
2038 echo "Cocoa support $cocoa"
2039fi
bellard97a847b2003-08-10 21:36:04 +00002040echo "SDL support $sdl"
balrog4d3b6f62008-02-10 16:33:14 +00002041echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02002042echo "curl support $curl"
Luiz Capitulino5495ed12009-08-28 15:27:28 -03002043echo "check support $check_utests"
bellard67b915a2004-03-31 23:37:16 +00002044echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00002045echo "Audio drivers $audio_drv_list"
2046echo "Extra audio cards $audio_card_list"
Markus Armbrustereb852012009-10-27 18:41:44 +01002047echo "Block whitelist $block_drv_whitelist"
malc8ff9cbf2008-06-23 18:33:30 +00002048echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00002049echo "VNC TLS support $vnc_tls"
aliguori2f9606b2009-03-06 20:27:28 +00002050echo "VNC SASL support $vnc_sasl"
blueswir131422552007-04-16 18:27:06 +00002051if test -n "$sparc_cpu"; then
2052 echo "Target Sparc Arch $sparc_cpu"
2053fi
aliguorie37630c2009-04-22 15:19:10 +00002054echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00002055echo "brlapi support $brlapi"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002056echo "bluez support $bluez"
Juan Quintelaa25dba12009-08-12 18:29:52 +02002057echo "Documentation $docs"
pbrookc5937222006-05-14 11:30:38 +00002058[ ! -z "$uname_release" ] && \
2059echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00002060echo "NPTL support $nptl"
Paul Brook379f6692009-07-17 12:48:08 +01002061echo "GUEST_BASE $guest_base"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03002062echo "PIE user targets $user_pie"
ths8a16d272008-07-19 09:56:24 +00002063echo "vde support $vde"
aliguorie5d355d2009-04-24 18:03:15 +00002064echo "IO thread $io_thread"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002065echo "Linux AIO support $linux_aio"
ths77755342008-11-27 15:45:16 +00002066echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02002067echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00002068echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00002069echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002070echo "fdatasync $fdatasync"
Stefan Weilee682d22009-10-01 20:10:37 +02002071echo "uuid support $uuid"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02002072echo "vhost-net support $vhost_net"
bellard67b915a2004-03-31 23:37:16 +00002073
bellard97a847b2003-08-10 21:36:04 +00002074if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00002075echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00002076fi
bellard97a847b2003-08-10 21:36:04 +00002077
Juan Quintela98ec69a2009-07-16 18:34:18 +02002078config_host_mak="config-host.mak"
Juan Quintela4bf6b552009-07-22 22:37:40 +02002079config_host_ld="config-host.ld"
bellard97a847b2003-08-10 21:36:04 +00002080
Juan Quintela98ec69a2009-07-16 18:34:18 +02002081echo "# Automatically generated by configure - do not modify" > $config_host_mak
2082printf "# Configured with:" >> $config_host_mak
2083printf " '%s'" "$0" "$@" >> $config_host_mak
2084echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002085
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02002086echo "prefix=$prefix" >> $config_host_mak
2087echo "bindir=$bindir" >> $config_host_mak
2088echo "mandir=$mandir" >> $config_host_mak
2089echo "datadir=$datadir" >> $config_host_mak
2090echo "sysconfdir=$sysconfdir" >> $config_host_mak
2091echo "docdir=$docdir" >> $config_host_mak
Paolo Bonzini1dabe052010-05-26 16:08:25 +02002092echo "confdir=$confdir" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002093
aurel322408a522008-04-20 20:19:44 +00002094case "$cpu" in
Alexander Graf24e804ec2009-12-05 12:44:22 +01002095 i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
Juan Quintelae0da9dd2009-07-16 18:34:09 +02002096 ARCH=$cpu
aurel322408a522008-04-20 20:19:44 +00002097 ;;
Laurent Desnoguesa302c322009-07-18 14:23:39 +02002098 armv4b|armv4l)
Juan Quintela16dbd142009-07-16 18:34:08 +02002099 ARCH=arm
aurel322408a522008-04-20 20:19:44 +00002100 ;;
aurel322408a522008-04-20 20:19:44 +00002101esac
Juan Quintela98ec69a2009-07-16 18:34:18 +02002102echo "ARCH=$ARCH" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00002103if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002104 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00002105fi
Luiz Capitulinob4475aa2010-02-10 23:50:03 -02002106if test "$debug_mon" = "yes" ; then
2107 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2108fi
Paul Brookf3d08ee2009-06-04 11:39:04 +01002109if test "$debug" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002110 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
Paul Brookf3d08ee2009-06-04 11:39:04 +01002111fi
aliguori1625af82009-04-05 17:41:02 +00002112if test "$strip_opt" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002113 echo "STRIP_OPT=-s" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00002114fi
bellard7d132992003-03-06 23:23:54 +00002115if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02002116 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00002117fi
Juan Quintela2358a492009-07-27 16:13:25 +02002118echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00002119if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002120 echo "CONFIG_WIN32=y" >> $config_host_mak
pbrook210fa552007-02-27 21:04:49 +00002121else
Juan Quintela35f4df22009-07-27 16:13:07 +02002122 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00002123fi
blueswir1128ab2f2008-08-15 18:33:42 +00002124
Mark McLoughlindffcb712009-10-22 17:49:11 +01002125if test "$linux" = "yes" ; then
2126 echo "CONFIG_LINUX=y" >> $config_host_mak
2127fi
2128
bellard83fb7ad2004-07-05 21:25:26 +00002129if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002130 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00002131fi
malcb29fe3e2008-11-18 01:42:22 +00002132
2133if test "$aix" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002134 echo "CONFIG_AIX=y" >> $config_host_mak
malcb29fe3e2008-11-18 01:42:22 +00002135fi
2136
bellardec530c82006-04-25 22:36:06 +00002137if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002138 echo "CONFIG_SOLARIS=y" >> $config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02002139 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00002140 if test "$needs_libsunmath" = "yes" ; then
Juan Quintela75b5a692009-07-27 16:13:23 +02002141 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00002142 fi
bellardec530c82006-04-25 22:36:06 +00002143fi
bellard97a847b2003-08-10 21:36:04 +00002144if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002145 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00002146fi
bellard05c2a3e2006-02-08 22:39:17 +00002147if test $profiler = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002148 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00002149fi
bellardc20709a2004-04-21 23:27:19 +00002150if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002151 echo "CONFIG_SLIRP=y" >> $config_host_mak
Juan Quintelab6e31c12009-09-30 01:10:54 +02002152 QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
bellardc20709a2004-04-21 23:27:19 +00002153fi
ths8a16d272008-07-19 09:56:24 +00002154if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002155 echo "CONFIG_VDE=y" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00002156fi
malc0c58ac12008-06-25 21:04:05 +00002157for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00002158 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002159 echo "$def=y" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002160done
Juan Quintela2358a492009-07-27 16:13:25 +02002161echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002162for drv in $audio_drv_list; do
pbrookf6e58892008-06-29 01:00:34 +00002163 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002164 echo "$def=y" >> $config_host_mak
malc923e4522008-07-02 18:13:46 +00002165 if test "$drv" = "fmod"; then
Juan Quintela7aac6cb2009-07-27 16:12:47 +02002166 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002167 fi
2168done
Juan Quintela67f86e82009-08-03 14:46:59 +02002169if test "$audio_pt_int" = "yes" ; then
2170 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2171fi
malcd5631632009-10-10 01:13:41 +04002172if test "$audio_win_int" = "yes" ; then
2173 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2174fi
Markus Armbrustereb852012009-10-27 18:41:44 +01002175echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00002176if test "$mixemu" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002177 echo "CONFIG_MIXEMU=y" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00002178fi
ths8d5d2d42007-08-25 01:37:51 +00002179if test "$vnc_tls" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002180 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
Juan Quintela525061b2009-07-27 16:12:43 +02002181 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
ths8d5d2d42007-08-25 01:37:51 +00002182fi
aliguori2f9606b2009-03-06 20:27:28 +00002183if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002184 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
Juan Quintela60ddf532009-07-27 16:12:45 +02002185 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00002186fi
aliguori76655d62009-03-06 20:27:37 +00002187if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002188 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00002189fi
Stefan Weilee682d22009-10-01 20:10:37 +02002190if test "$uuid" = "yes" ; then
2191 echo "CONFIG_UUID=y" >> $config_host_mak
2192fi
pbrookb1a550a2006-04-16 13:28:56 +00002193qemu_version=`head $source_path/VERSION`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002194echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02002195echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002196echo "SRC_PATH=$source_path" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002197echo "TARGET_DIRS=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02002198if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002199 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00002200fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02002201if test "$sdl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002202 echo "CONFIG_SDL=y" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02002203 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00002204fi
2205if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002206 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00002207fi
2208if test "$curses" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002209 echo "CONFIG_CURSES=y" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00002210fi
aurel323b3f24a2009-04-15 16:12:13 +00002211if test "$atfile" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002212 echo "CONFIG_ATFILE=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00002213fi
Riku Voipioebc996f2009-04-21 15:01:51 +03002214if test "$utimens" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002215 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
Riku Voipioebc996f2009-04-21 15:01:51 +03002216fi
Riku Voipio099d6b02009-05-05 12:10:04 +03002217if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002218 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03002219fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01002220if test "$accept4" = "yes" ; then
2221 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2222fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302223if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002224 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302225fi
Riku Voipioc2882b92009-08-12 15:08:24 +03002226if test "$eventfd" = "yes" ; then
2227 echo "CONFIG_EVENTFD=y" >> $config_host_mak
2228fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03002229if test "$fallocate" = "yes" ; then
2230 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2231fi
2232if test "$dup3" = "yes" ; then
2233 echo "CONFIG_DUP3=y" >> $config_host_mak
2234fi
aurel323b3f24a2009-04-15 16:12:13 +00002235if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002236 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00002237fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00002238if test "$inotify1" = "yes" ; then
2239 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2240fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002241if test "$byteswap_h" = "yes" ; then
2242 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
2243fi
2244if test "$bswap_h" = "yes" ; then
2245 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
2246fi
Alexander Graf769ce762009-05-11 17:41:42 +02002247if test "$curl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002248 echo "CONFIG_CURL=y" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02002249 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02002250fi
aurel322e4d9fb2008-04-08 06:01:02 +00002251if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002252 echo "CONFIG_BRLAPI=y" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00002253fi
balrogfb599c92008-09-28 23:49:55 +00002254if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002255 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02002256 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00002257fi
aliguorie37630c2009-04-22 15:19:10 +00002258if test "$xen" = "yes" ; then
Juan Quintela5647eb72009-07-27 16:13:21 +02002259 echo "CONFIG_XEN=y" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00002260fi
aliguorie5d355d2009-04-24 18:03:15 +00002261if test "$io_thread" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002262 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
aliguorie5d355d2009-04-24 18:03:15 +00002263fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002264if test "$linux_aio" = "yes" ; then
2265 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
2266fi
ths77755342008-11-27 15:45:16 +00002267if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002268 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00002269fi
aliguoribf9298b2008-12-05 20:05:26 +00002270if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002271 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00002272fi
aliguoriceb42de2009-04-07 18:43:28 +00002273if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002274 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00002275fi
aurel32f652e6a2008-12-16 10:43:48 +00002276if test "$fdt" = "yes" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02002277 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00002278fi
Blue Swirlde5071c2009-09-12 09:58:46 +00002279if test "$need_offsetof" = "yes" ; then
2280 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2281fi
Blue Swirl747bbdf2009-10-18 16:26:06 +00002282if test "$gcc_attribute_warn_unused_result" = "yes" ; then
2283 echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2284fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002285if test "$fdatasync" = "yes" ; then
2286 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
2287fi
bellard97a847b2003-08-10 21:36:04 +00002288
bellard83fb7ad2004-07-05 21:25:26 +00002289# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00002290if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002291 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00002292fi
2293
Juan Quintela2358a492009-07-27 16:13:25 +02002294echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
pbrookc5937222006-05-14 11:30:38 +00002295
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002296if test "$zero_malloc" = "yes" ; then
2297 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
2298fi
2299
blueswir168063642008-11-22 21:03:55 +00002300# USB host support
2301case "$usb" in
2302linux)
Juan Quintela98ec69a2009-07-16 18:34:18 +02002303 echo "HOST_USB=linux" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00002304;;
2305bsd)
Juan Quintela98ec69a2009-07-16 18:34:18 +02002306 echo "HOST_USB=bsd" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00002307;;
2308*)
Juan Quintela98ec69a2009-07-16 18:34:18 +02002309 echo "HOST_USB=stub" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00002310;;
2311esac
2312
pbrookc39e3332007-09-22 16:49:14 +00002313tools=
Paolo Bonzinif55fe272010-05-26 16:08:17 +02002314if test "$softmmu" = yes ; then
Aurelien Jarno86355e02009-11-18 16:14:09 +01002315 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
Blue Swirl2bff4b62009-12-23 15:34:04 +00002316 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
Aurelien Jarno86355e02009-11-18 16:14:09 +01002317 tools="qemu-nbd\$(EXESUF) $tools"
Luiz Capitulino5495ed12009-08-28 15:27:28 -03002318 if [ "$check_utests" = "yes" ]; then
Luiz Capitulino3aa3dcf2009-10-07 13:41:49 -03002319 tools="check-qint check-qstring check-qdict check-qlist $tools"
Anthony Liguori422c46a2009-11-11 10:39:47 -06002320 tools="check-qfloat check-qjson $tools"
Luiz Capitulino5495ed12009-08-28 15:27:28 -03002321 fi
bellard7a5ca862008-05-27 21:13:40 +00002322 fi
pbrookc39e3332007-09-22 16:49:14 +00002323fi
Juan Quintela98ec69a2009-07-16 18:34:18 +02002324echo "TOOLS=$tools" >> $config_host_mak
pbrookc39e3332007-09-22 16:49:14 +00002325
Juan Quintela161294d2009-07-21 14:11:22 +02002326# Mac OS X ships with a broken assembler
Alexander Graf253d0942009-06-29 15:37:40 +02002327roms=
Juan Quintela161294d2009-07-21 14:11:22 +02002328if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
Andreas Faerberea5ad302009-11-27 22:18:52 +01002329 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
Paolo Bonzinif55fe272010-05-26 16:08:17 +02002330 "$softmmu" = yes ; then
Paul Brookc05ac892009-07-31 13:18:32 +01002331 roms="optionrom"
Alexander Graf253d0942009-06-29 15:37:40 +02002332fi
Juan Quintela98ec69a2009-07-16 18:34:18 +02002333echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002334echo "MAKE=$make" >> $config_host_mak
2335echo "INSTALL=$install" >> $config_host_mak
2336echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2337echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2338echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2339echo "CC=$cc" >> $config_host_mak
2340echo "HOST_CC=$host_cc" >> $config_host_mak
2341if test "$sparse" = "yes" ; then
2342 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
2343 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02002344 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002345fi
2346echo "AR=$ar" >> $config_host_mak
2347echo "OBJCOPY=$objcopy" >> $config_host_mak
2348echo "LD=$ld" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02002349echo "CFLAGS=$CFLAGS" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02002350echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Juan Quintelac81da562009-08-03 14:46:24 +02002351echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02002352echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Juan Quintelaa36abbb2009-08-03 14:45:56 +02002353echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2354echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02002355echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02002356echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002357echo "EXESUF=$EXESUF" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002358
Juan Quintela4bf6b552009-07-22 22:37:40 +02002359# generate list of library paths for linker script
2360
2361$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2362
2363if test -f ${config_host_ld}~ ; then
2364 if cmp -s $config_host_ld ${config_host_ld}~ ; then
2365 mv ${config_host_ld}~ $config_host_ld
2366 else
2367 rm ${config_host_ld}~
2368 fi
2369fi
2370
Blue Swirl4d904532010-03-21 08:28:47 +00002371for d in libdis libdis-user; do
2372 mkdir -p $d
2373 rm -f $d/Makefile
2374 ln -s $source_path/Makefile.dis $d/Makefile
2375 echo > $d/config.mak
2376done
Richard Hendersond44cff22010-05-21 10:04:46 -07002377if test "$static" = "no" -a "$user_pie" = "yes" ; then
2378 echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2379fi
Blue Swirl4d904532010-03-21 08:28:47 +00002380
bellard1d14ffa2005-10-30 18:58:22 +00002381for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00002382target_dir="$target"
Juan Quintela25be2102009-10-07 02:41:00 +02002383config_target_mak=$target_dir/config-target.mak
Blue Swirl600309b2009-07-03 17:44:00 +00002384target_arch2=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00002385target_bigendian="no"
Juan Quintela1f3d3c82009-10-07 02:41:02 +02002386
Juan Quintelaea2d6a32009-07-16 18:34:10 +02002387case "$target_arch2" in
Alexander Graf24e804ec2009-12-05 12:44:22 +01002388 armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
Juan Quintelaea2d6a32009-07-16 18:34:10 +02002389 target_bigendian=yes
2390 ;;
2391esac
bellard97a847b2003-08-10 21:36:04 +00002392target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00002393target_user_only="no"
ths831b7822007-01-18 20:06:33 +00002394target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00002395target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00002396target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00002397case "$target" in
Blue Swirl600309b2009-07-03 17:44:00 +00002398 ${target_arch2}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00002399 target_softmmu="yes"
2400 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00002401 ${target_arch2}-linux-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00002402 if test "$linux" != "yes" ; then
2403 echo "ERROR: Target '$target' is only available on a Linux host"
2404 exit 1
2405 fi
pbrook9e407a82007-05-26 16:38:53 +00002406 target_user_only="yes"
2407 target_linux_user="yes"
2408 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00002409 ${target_arch2}-darwin-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00002410 if test "$darwin" != "yes" ; then
2411 echo "ERROR: Target '$target' is only available on a Darwin host"
2412 exit 1
2413 fi
pbrook9e407a82007-05-26 16:38:53 +00002414 target_user_only="yes"
2415 target_darwin_user="yes"
2416 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00002417 ${target_arch2}-bsd-user)
Blue Swirl9cf55762009-11-17 21:27:18 +00002418 if test "$bsd" != "yes" ; then
Blue Swirl9c7a4202009-11-17 20:52:56 +00002419 echo "ERROR: Target '$target' is only available on a BSD host"
2420 exit 1
2421 fi
blueswir184778502008-10-26 20:33:16 +00002422 target_user_only="yes"
2423 target_bsd_user="yes"
2424 ;;
pbrook9e407a82007-05-26 16:38:53 +00002425 *)
2426 echo "ERROR: Target '$target' not recognised"
2427 exit 1
2428 ;;
2429esac
ths831b7822007-01-18 20:06:33 +00002430
bellard97a847b2003-08-10 21:36:04 +00002431mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00002432mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00002433mkdir -p $target_dir/tcg
Gerd Hoffmann59f2a782009-08-20 15:22:26 +02002434mkdir -p $target_dir/ide
blueswir184778502008-10-26 20:33:16 +00002435if 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 +00002436 mkdir -p $target_dir/nwfpe
2437fi
2438
bellardec530c82006-04-25 22:36:06 +00002439#
2440# don't use ln -sf as not all "ln -sf" over write the file/link
2441#
2442rm -f $target_dir/Makefile
2443ln -s $source_path/Makefile.target $target_dir/Makefile
2444
bellard97a847b2003-08-10 21:36:04 +00002445
Juan Quintela25be2102009-10-07 02:41:00 +02002446echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00002447
pbrooke5fe0c52006-06-11 13:32:59 +00002448bflt="no"
pbrookbd0c5662008-05-29 14:34:11 +00002449target_nptl="no"
Blue Swirl600309b2009-07-03 17:44:00 +00002450interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
Paolo Bonzini7ee28222010-05-26 16:08:22 +02002451echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00002452gdb_xml_files=""
aliguori7ba1e612008-11-05 16:04:33 +00002453
Juan Quintela938b1ed2009-07-16 18:34:12 +02002454TARGET_ARCH="$target_arch2"
Juan Quintela6acff7d2009-07-16 18:34:15 +02002455TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02002456TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02002457
Blue Swirl600309b2009-07-03 17:44:00 +00002458case "$target_arch2" in
aurel322408a522008-04-20 20:19:44 +00002459 i386)
Paul Brook1ad21342009-05-19 16:17:58 +01002460 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002461 ;;
2462 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02002463 TARGET_BASE_ARCH=i386
Paul Brook1ad21342009-05-19 16:17:58 +01002464 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002465 ;;
2466 alpha)
Paul Brook1ad21342009-05-19 16:17:58 +01002467 target_phys_bits=64
Richard Hendersona4b388f2010-04-12 16:17:22 -07002468 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00002469 ;;
2470 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002471 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00002472 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00002473 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00002474 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002475 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002476 ;;
2477 cris)
edgar_igl253bd7f2009-01-07 20:07:09 +00002478 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002479 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002480 ;;
2481 m68k)
aurel322408a522008-04-20 20:19:44 +00002482 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00002483 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002484 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002485 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02002486 microblaze)
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02002487 bflt="yes"
2488 target_nptl="yes"
2489 target_phys_bits=32
2490 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02002491 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002492 TARGET_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02002493 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
Paul Brookf04dc722009-07-09 17:56:24 +01002494 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002495 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002496 ;;
2497 mipsn32|mipsn32el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002498 TARGET_ARCH=mipsn32
Juan Quintela6acff7d2009-07-16 18:34:15 +02002499 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02002500 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01002501 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002502 ;;
2503 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002504 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02002505 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02002506 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01002507 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002508 ;;
2509 ppc)
aurel32c8b35322009-01-24 15:07:34 +00002510 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002511 target_phys_bits=32
Nathan Froydd6630702009-08-03 08:43:28 -07002512 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00002513 ;;
2514 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02002515 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02002516 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00002517 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002518 target_phys_bits=64
Nathan Froydd6630702009-08-03 08:43:28 -07002519 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00002520 ;;
2521 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02002522 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02002523 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00002524 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002525 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002526 ;;
2527 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002528 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02002529 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02002530 TARGET_ABI_DIR=ppc
Juan Quintela25be2102009-10-07 02:41:00 +02002531 echo "TARGET_ABI32=y" >> $config_target_mak
aurel32c8b35322009-01-24 15:07:34 +00002532 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002533 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002534 ;;
2535 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002536 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00002537 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00002538 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002539 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002540 ;;
2541 sparc)
Paul Brook1ad21342009-05-19 16:17:58 +01002542 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002543 ;;
2544 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02002545 TARGET_BASE_ARCH=sparc
Paul Brook1ad21342009-05-19 16:17:58 +01002546 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002547 ;;
2548 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002549 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02002550 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02002551 TARGET_ABI_DIR=sparc
Juan Quintela25be2102009-10-07 02:41:00 +02002552 echo "TARGET_ABI32=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01002553 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002554 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01002555 s390x)
2556 target_phys_bits=64
2557 ;;
aurel322408a522008-04-20 20:19:44 +00002558 *)
2559 echo "Unsupported target CPU"
2560 exit 1
2561 ;;
2562esac
Juan Quintela25be2102009-10-07 02:41:00 +02002563echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
Juan Quintela053dd922009-08-03 14:47:03 +02002564target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
Juan Quintela25be2102009-10-07 02:41:00 +02002565echo "TARGET_$target_arch_name=y" >> $config_target_mak
2566echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
Juan Quintela42bc6082009-07-16 18:34:20 +02002567# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02002568if [ "$TARGET_BASE_ARCH" = "" ]; then
2569 TARGET_BASE_ARCH=$TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02002570fi
Juan Quintela25be2102009-10-07 02:41:00 +02002571echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02002572if [ "$TARGET_ABI_DIR" = "" ]; then
2573 TARGET_ABI_DIR=$TARGET_ARCH
2574fi
Juan Quintela25be2102009-10-07 02:41:00 +02002575echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02002576case "$target_arch2" in
2577 i386|x86_64)
2578 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002579 echo "CONFIG_XEN=y" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02002580 fi
2581esac
Juan Quintelac59249f2009-07-16 18:34:00 +02002582case "$target_arch2" in
Alexander Graf0e60a692009-12-05 12:44:24 +01002583 i386|x86_64|ppcemb|ppc|ppc64|s390x)
Juan Quintelac59249f2009-07-16 18:34:00 +02002584 # Make sure the target and host cpus are compatible
2585 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2586 \( "$target_arch2" = "$cpu" -o \
2587 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
Alexander Graf5f114bc2009-07-17 13:51:42 +02002588 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
Juan Quintelac59249f2009-07-16 18:34:00 +02002589 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
2590 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002591 echo "CONFIG_KVM=y" >> $config_target_mak
2592 echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
Jan Kiszkadae50792010-01-12 19:53:48 +01002593 if test "$kvm_para" = "yes"; then
2594 echo "CONFIG_KVM_PARA=y" >> $config_target_mak
2595 fi
Michael S. Tsirkind5970052010-03-17 13:08:17 +02002596 if test $vhost_net = "yes" ; then
2597 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
2598 fi
Juan Quintelac59249f2009-07-16 18:34:00 +02002599 fi
2600esac
bellardde83cd02003-06-15 20:25:43 +00002601if test "$target_bigendian" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002602 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00002603fi
2604if test "$target_softmmu" = "yes" ; then
Paul Brookb1aa27c2010-03-01 02:27:26 +00002605 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
Juan Quintela25be2102009-10-07 02:41:00 +02002606 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
2607 echo "LIBS+=$libs_softmmu" >> $config_target_mak
Andreas Färber0e8c9212010-01-06 20:24:05 +01002608 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
Kirill A. Shutemov5791f452009-09-12 02:17:53 +03002609 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00002610fi
bellard997344f2003-10-27 21:10:39 +00002611if test "$target_user_only" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002612 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00002613fi
ths831b7822007-01-18 20:06:33 +00002614if test "$target_linux_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002615 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00002616fi
2617if test "$target_darwin_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002618 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00002619fi
pbrook56aebc82008-10-11 17:55:29 +00002620list=""
2621if test ! -z "$gdb_xml_files" ; then
2622 for x in $gdb_xml_files; do
2623 list="$list $source_path/gdb-xml/$x"
2624 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02002625 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00002626fi
bellardde83cd02003-06-15 20:25:43 +00002627
Juan Quintelaf57975f2009-07-16 18:34:19 +02002628case "$target_arch2" in
Richard Henderson990b3e12009-12-09 15:48:02 -08002629 alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
Juan Quintela25be2102009-10-07 02:41:00 +02002630 echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
Juan Quintelaf57975f2009-07-16 18:34:19 +02002631 ;;
Juan Quintelad6b38932009-08-03 14:46:42 +02002632 *)
Juan Quintela25be2102009-10-07 02:41:00 +02002633 echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
Juan Quintelad6b38932009-08-03 14:46:42 +02002634 ;;
Juan Quintelaf57975f2009-07-16 18:34:19 +02002635esac
2636
pbrooke5fe0c52006-06-11 13:32:59 +00002637if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02002638 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00002639fi
pbrookbd0c5662008-05-29 14:34:11 +00002640if test "$target_user_only" = "yes" \
2641 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02002642 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
pbrookbd0c5662008-05-29 14:34:11 +00002643fi
Paul Brook379f6692009-07-17 12:48:08 +01002644if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02002645 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
Paul Brook379f6692009-07-17 12:48:08 +01002646fi
blueswir184778502008-10-26 20:33:16 +00002647if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002648 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00002649fi
bellard5b0753e2005-03-01 21:37:28 +00002650
Juan Quintela4afddb52009-08-03 14:46:45 +02002651# generate QEMU_CFLAGS/LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02002652
Juan Quintela4afddb52009-08-03 14:46:45 +02002653cflags=""
Juan Quintelafa282482009-07-22 22:37:39 +02002654ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02002655
Juan Quintela57ddfbf2009-08-03 14:46:51 +02002656if test "$ARCH" = "sparc64" ; then
2657 cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
Alexander Graf24e804ec2009-12-05 12:44:22 +01002658elif test "$ARCH" = "s390x" ; then
2659 cflags="-I\$(SRC_PATH)/tcg/s390 $cflags"
Juan Quintela57ddfbf2009-08-03 14:46:51 +02002660else
2661 cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
2662fi
2663cflags="-I\$(SRC_PATH)/tcg $cflags"
2664cflags="-I\$(SRC_PATH)/fpu $cflags"
2665
Blue Swirl4d904532010-03-21 08:28:47 +00002666if test "$target_user_only" = "yes" ; then
2667 libdis_config_mak=libdis-user/config.mak
2668else
2669 libdis_config_mak=libdis/config.mak
2670fi
2671
Juan Quintela64656022009-08-03 14:46:53 +02002672for i in $ARCH $TARGET_BASE_ARCH ; do
2673 case "$i" in
2674 alpha)
Juan Quintela25be2102009-10-07 02:41:00 +02002675 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002676 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002677 ;;
2678 arm)
Juan Quintela25be2102009-10-07 02:41:00 +02002679 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002680 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002681 ;;
2682 cris)
Juan Quintela25be2102009-10-07 02:41:00 +02002683 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002684 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002685 ;;
2686 hppa)
Juan Quintela25be2102009-10-07 02:41:00 +02002687 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002688 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002689 ;;
2690 i386|x86_64)
Juan Quintela25be2102009-10-07 02:41:00 +02002691 echo "CONFIG_I386_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002692 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002693 ;;
Aurelien Jarno903ec552010-03-29 02:12:51 +02002694 ia64*)
2695 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
2696 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
2697 ;;
Juan Quintela64656022009-08-03 14:46:53 +02002698 m68k)
Juan Quintela25be2102009-10-07 02:41:00 +02002699 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002700 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002701 ;;
2702 microblaze)
Juan Quintela25be2102009-10-07 02:41:00 +02002703 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002704 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002705 ;;
2706 mips*)
Juan Quintela25be2102009-10-07 02:41:00 +02002707 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002708 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002709 ;;
2710 ppc*)
Juan Quintela25be2102009-10-07 02:41:00 +02002711 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002712 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002713 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01002714 s390*)
Juan Quintela25be2102009-10-07 02:41:00 +02002715 echo "CONFIG_S390_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002716 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002717 ;;
2718 sh4)
Juan Quintela25be2102009-10-07 02:41:00 +02002719 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002720 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002721 ;;
2722 sparc*)
Juan Quintela25be2102009-10-07 02:41:00 +02002723 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002724 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002725 ;;
2726 esac
2727done
2728
Juan Quintela6ee71262009-08-03 14:46:47 +02002729case "$ARCH" in
2730alpha)
2731 # Ensure there's only a single GP
2732 cflags="-msmall-data $cflags"
2733;;
2734esac
2735
Juan Quintela55d9c042009-08-03 14:47:02 +02002736if test "$target_softmmu" = "yes" ; then
2737 case "$TARGET_BASE_ARCH" in
2738 arm)
2739 cflags="-DHAS_AUDIO $cflags"
2740 ;;
2741 i386|mips|ppc)
2742 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
2743 ;;
2744 esac
2745fi
2746
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03002747if test "$target_user_only" = "yes" -a "$static" = "no" -a \
Blue Swirl50108932009-09-13 19:38:48 +00002748 "$user_pie" = "yes" ; then
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03002749 cflags="-fpie $cflags"
2750 ldflags="-pie $ldflags"
2751fi
2752
Juan Quintela471857d2009-08-03 14:46:52 +02002753if test "$target_softmmu" = "yes" -a \( \
2754 "$TARGET_ARCH" = "microblaze" -o \
2755 "$TARGET_ARCH" = "cris" \) ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002756 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
Juan Quintela471857d2009-08-03 14:46:52 +02002757fi
2758
Juan Quintelad02c1db2009-08-03 14:46:50 +02002759if test "$gprof" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002760 echo "TARGET_GPROF=yes" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02002761 if test "$target_linux_user" = "yes" ; then
2762 cflags="-p $cflags"
2763 ldflags="-p $ldflags"
2764 fi
2765 if test "$target_softmmu" = "yes" ; then
2766 ldflags="-p $ldflags"
Juan Quintela25be2102009-10-07 02:41:00 +02002767 echo "GPROF_CFLAGS=-p" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02002768 fi
2769fi
2770
Juan Quintela6ee71262009-08-03 14:46:47 +02002771linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
Juan Quintela9b8e1112009-08-03 14:46:46 +02002772if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
Juan Quintelafa282482009-07-22 22:37:39 +02002773 case "$ARCH" in
Juan Quintelafa282482009-07-22 22:37:39 +02002774 sparc)
2775 # -static is used to avoid g1/g3 usage by the dynamic linker
Juan Quintela322e5872009-08-03 14:46:44 +02002776 ldflags="$linker_script -static $ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02002777 ;;
Richard Hendersonfd76e732010-04-07 04:56:43 -07002778 *)
Juan Quintela322e5872009-08-03 14:46:44 +02002779 ldflags="$linker_script $ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02002780 ;;
2781 esac
2782fi
Juan Quintelafa282482009-07-22 22:37:39 +02002783
Juan Quintela25be2102009-10-07 02:41:00 +02002784echo "LDFLAGS+=$ldflags" >> $config_target_mak
2785echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02002786
bellard97a847b2003-08-10 21:36:04 +00002787done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00002788
2789# build tree in object directory if source path is different from current one
2790if test "$source_path_used" = "yes" ; then
Mark McLoughline1144d02009-10-23 17:52:16 +01002791 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06002792 DIRS="$DIRS roms/seabios roms/vgabios"
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302793 DIRS="$DIRS fsdev"
bellard7d132992003-03-06 23:23:54 +00002794 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00002795 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00002796 FILES="$FILES tests/test-mmap.c"
Jan Kiszka7ea78b72009-07-17 11:20:10 +02002797 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06002798 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
Jan Kiszka7ea78b72009-07-17 11:20:10 +02002799 for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
2800 FILES="$FILES pc-bios/`basename $bios_file`"
2801 done
bellard7d132992003-03-06 23:23:54 +00002802 for dir in $DIRS ; do
2803 mkdir -p $dir
2804 done
bellardec530c82006-04-25 22:36:06 +00002805 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00002806 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00002807 rm -f $f
2808 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00002809 done
2810fi
Paul Brook1ad21342009-05-19 16:17:58 +01002811
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05002812# temporary config to build submodules
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06002813for rom in seabios vgabios ; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05002814 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01002815 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05002816 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
2817 echo "CC=$cc" >> $config_mak
2818 echo "BCC=bcc" >> $config_mak
2819 echo "CPP=${cross_prefix}cpp" >> $config_mak
2820 echo "OBJCOPY=objcopy" >> $config_mak
2821 echo "IASL=iasl" >> $config_mak
2822 echo "HOST_CC=$host_cc" >> $config_mak
2823 echo "LD=$ld" >> $config_mak
2824done
2825
Paul Brook1ad21342009-05-19 16:17:58 +01002826for hwlib in 32 64; do
2827 d=libhw$hwlib
2828 mkdir -p $d
Blue Swirl9953b2f2010-03-21 19:47:05 +00002829 mkdir -p $d/ide
Paul Brook1ad21342009-05-19 16:17:58 +01002830 rm -f $d/Makefile
2831 ln -s $source_path/Makefile.hw $d/Makefile
Stefan Weil37116c82010-03-01 22:20:29 +01002832 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
Paul Brook1ad21342009-05-19 16:17:58 +01002833done
Blue Swirladd16152009-09-27 16:26:02 +00002834
2835d=libuser
2836mkdir -p $d
2837rm -f $d/Makefile
2838ln -s $source_path/Makefile.user $d/Makefile
Kirill A. Shutemov299060a2009-12-19 15:16:08 +00002839if test "$static" = "no" -a "$user_pie" = "yes" ; then
2840 echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
2841fi
Jan Kiszkab40292e2010-05-31 14:43:31 -03002842
2843if test "$docs" = "yes" ; then
2844 mkdir -p QMP
2845fi