blob: 2917874f96f55671db5889a9c3278846d35b59b3 [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
Loïc Minier0ba86812010-09-25 21:52:30 +020018# NB: do not call "exit" in the trap handler; this is buggy with some shells;
19# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
20trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020021rm -f config.log
malc9ac81bb2008-11-29 20:09:56 +000022
Juan Quintela52166aa2009-08-03 14:46:03 +020023compile_object() {
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020024 echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
25 $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
Juan Quintela52166aa2009-08-03 14:46:03 +020026}
27
28compile_prog() {
29 local_cflags="$1"
30 local_ldflags="$2"
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020031 echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
32 $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
Juan Quintela52166aa2009-08-03 14:46:03 +020033}
34
Loïc Minier0dba6192010-01-28 21:26:51 +000035# check whether a command is available to this shell (may be either an
36# executable or a builtin)
37has() {
38 type "$1" >/dev/null 2>&1
39}
40
41# search for an executable in PATH
42path_of() {
43 local_command="$1"
44 local_ifs="$IFS"
45 local_dir=""
46
47 # pathname has a dir component?
48 if [ "${local_command#*/}" != "$local_command" ]; then
49 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
50 echo "$local_command"
51 return 0
52 fi
53 fi
54 if [ -z "$local_command" ]; then
55 return 1
56 fi
57
58 IFS=:
59 for local_dir in $PATH; do
60 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
61 echo "$local_dir/$local_command"
62 IFS="${local_ifs:-$(printf ' \t\n')}"
63 return 0
64 fi
65 done
66 # not found
67 IFS="${local_ifs:-$(printf ' \t\n')}"
68 return 1
69}
70
bellard7d132992003-03-06 23:23:54 +000071# default parameters
Juan Quintela2ff6b912009-08-03 14:45:55 +020072cpu=""
bellard1e43adf2003-09-30 20:54:24 +000073interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000074static="no"
Juan Quintelaed968ff2009-08-03 14:46:11 +020075sparc_cpu=""
bellard7d132992003-03-06 23:23:54 +000076cross_prefix=""
77cc="gcc"
malc0c58ac12008-06-25 21:04:05 +000078audio_drv_list=""
Gerd Hoffmannd61a4ce2010-11-01 13:05:32 +010079audio_card_list="ac97 es1370 sb16 hda"
80audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
Markus Armbrustereb852012009-10-27 18:41:44 +010081block_drv_whitelist=""
bellard7d132992003-03-06 23:23:54 +000082host_cc="gcc"
83ar="ar"
84make="make"
pbrook6a882642006-04-17 13:57:12 +000085install="install"
Anthony Liguori7aa486f2009-07-11 08:48:29 -050086objcopy="objcopy"
87ld="ld"
Hollis Blanchard52ba7842010-08-04 17:21:34 -070088strip="strip"
Blue Swirl9fe6de92010-09-26 16:07:57 +000089windres="windres"
Juan Quintelac81da562009-08-03 14:46:24 +020090helper_cflags=""
Juan Quintela73da3752009-08-03 14:46:26 +020091libs_softmmu=""
Juan Quintela3e2e0e62009-08-03 14:47:06 +020092libs_tools=""
Juan Quintela67f86e82009-08-03 14:46:59 +020093audio_pt_int=""
malcd5631632009-10-10 01:13:41 +040094audio_win_int=""
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +020095cc_i386=i386-pc-linux-gnu-gcc
aliguoriac0df512008-12-29 17:14:15 +000096
97# parse CC options first
98for opt do
99 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
100 case "$opt" in
101 --cross-prefix=*) cross_prefix="$optarg"
102 ;;
103 --cc=*) cc="$optarg"
104 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200105 --cpu=*) cpu="$optarg"
106 ;;
Juan Quintelaa558ee12009-08-03 14:46:21 +0200107 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200108 ;;
109 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
110 ;;
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200111 --sparc_cpu=*)
112 sparc_cpu="$optarg"
113 case $sparc_cpu in
Juan Quintelaed968ff2009-08-03 14:46:11 +0200114 v7|v8|v8plus|v8plusa)
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200115 cpu="sparc"
116 ;;
117 v9)
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200118 cpu="sparc64"
119 ;;
120 *)
121 echo "undefined SPARC architecture. Exiting";
122 exit 1
123 ;;
124 esac
125 ;;
aliguoriac0df512008-12-29 17:14:15 +0000126 esac
127done
aliguoriac0df512008-12-29 17:14:15 +0000128# OS specific
129# Using uname is really, really broken. Once we have the right set of checks
130# we can eliminate it's usage altogether
131
132cc="${cross_prefix}${cc}"
133ar="${cross_prefix}${ar}"
Anthony Liguori7aa486f2009-07-11 08:48:29 -0500134objcopy="${cross_prefix}${objcopy}"
135ld="${cross_prefix}${ld}"
Hollis Blanchard52ba7842010-08-04 17:21:34 -0700136strip="${cross_prefix}${strip}"
Blue Swirl9fe6de92010-09-26 16:07:57 +0000137windres="${cross_prefix}${windres}"
aliguoriac0df512008-12-29 17:14:15 +0000138
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200139# default flags for all hosts
140QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
141CFLAGS="-g $CFLAGS"
142QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
143QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
144QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Kirill A. Shutemov84958302010-01-20 00:56:22 +0100145QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200146QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
147LDFLAGS="-g $LDFLAGS"
148
Blue Swirla21493e2010-09-18 07:01:05 +0000149gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
150gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
Blue Swirl0b65b9e2010-09-18 07:02:16 +0000151gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
Blue Swirla21493e2010-09-18 07:01:05 +0000152gcc_flags="-fstack-protector-all $gcc_flags"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200153cat > $TMPC << EOF
Aurelien Jarnoaa527b62010-02-06 21:22:19 +0100154int main(void) { return 0; }
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200155EOF
156for flag in $gcc_flags; do
Aurelien Jarnoaa527b62010-02-06 21:22:19 +0100157 if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
Markus Armbruster1e027be2010-10-14 11:19:04 +0200158 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200159 fi
160done
161
aliguoriac0df512008-12-29 17:14:15 +0000162# check that the C compiler works.
163cat > $TMPC <<EOF
164int main(void) {}
165EOF
166
Juan Quintela52166aa2009-08-03 14:46:03 +0200167if compile_object ; then
aliguoriac0df512008-12-29 17:14:15 +0000168 : C compiler works ok
169else
170 echo "ERROR: \"$cc\" either does not exist or does not work"
171 exit 1
172fi
173
174check_define() {
175cat > $TMPC <<EOF
176#if !defined($1)
177#error Not defined
178#endif
179int main(void) { return 0; }
180EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200181 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000182}
183
Juan Quintela2ff6b912009-08-03 14:45:55 +0200184if test ! -z "$cpu" ; then
185 # command line argument
186 :
187elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000188 cpu="i386"
189elif check_define __x86_64__ ; then
190 cpu="x86_64"
blueswir13aa9bd62008-12-31 16:55:26 +0000191elif check_define __sparc__ ; then
192 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
193 # They must be specified using --sparc_cpu
194 if check_define __arch64__ ; then
195 cpu="sparc64"
196 else
197 cpu="sparc"
198 fi
malcfdf7ed92009-01-14 18:39:52 +0000199elif check_define _ARCH_PPC ; then
200 if check_define _ARCH_PPC64 ; then
201 cpu="ppc64"
202 else
203 cpu="ppc"
204 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200205elif check_define __mips__ ; then
206 cpu="mips"
Aurelien Jarno477ba622010-03-29 02:12:51 +0200207elif check_define __ia64__ ; then
208 cpu="ia64"
Aurelien Jarnod66ed0e2010-06-13 12:28:21 +0200209elif check_define __s390__ ; then
210 if check_define __s390x__ ; then
211 cpu="s390x"
212 else
213 cpu="s390"
214 fi
aliguoriac0df512008-12-29 17:14:15 +0000215else
malcfdf7ed92009-01-14 18:39:52 +0000216 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +0000217fi
218
bellard5327cf42005-01-10 23:18:50 +0000219target_list=""
bellard7d132992003-03-06 23:23:54 +0000220case "$cpu" in
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200221 alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64)
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200222 cpu="$cpu"
223 ;;
bellard7d132992003-03-06 23:23:54 +0000224 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000225 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000226 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000227 x86_64|amd64)
228 cpu="x86_64"
229 ;;
bellardba680552005-03-13 09:49:52 +0000230 armv*b)
bellard808c4952004-12-19 23:33:47 +0000231 cpu="armv4b"
232 ;;
bellardba680552005-03-13 09:49:52 +0000233 armv*l)
bellard7d132992003-03-06 23:23:54 +0000234 cpu="armv4l"
235 ;;
aurel32f54b3f92008-04-12 20:14:54 +0000236 parisc|parisc64)
237 cpu="hppa"
238 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200239 mips*)
240 cpu="mips"
241 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +0100242 s390)
bellardfb3e5842003-03-29 17:32:36 +0000243 cpu="s390"
244 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +0100245 s390x)
246 cpu="s390x"
247 ;;
blueswir131422552007-04-16 18:27:06 +0000248 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000249 cpu="sparc"
250 ;;
bellard7d132992003-03-06 23:23:54 +0000251 *)
Paolo Bonzinia447d4d2010-05-26 16:08:16 +0200252 echo "Unsupported CPU = $cpu"
253 exit 1
bellard7d132992003-03-06 23:23:54 +0000254 ;;
255esac
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200256
Stefan Weil3a3fb962009-11-16 19:59:18 +0100257# Default value for a variable defining feature "foo".
258# * foo="no" feature will only be used if --enable-foo arg is given
259# * foo="" feature will be searched for, and if found, will be used
260# unless --disable-foo is given
261# * foo="yes" this value will only be set by --enable-foo flag.
262# feature will searched for,
263# if not found, configure exits with error
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200264#
Stefan Weil3a3fb962009-11-16 19:59:18 +0100265# Always add --enable-foo and --disable-foo command line args.
266# Distributions want to ensure that several features are compiled in, and it
267# is impossible without a --enable-foo that exits if a feature is not found.
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200268
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200269bluez=""
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200270brlapi=""
Juan Quintela788c8192009-08-12 18:29:47 +0200271curl=""
Juan Quintelac584a6d2009-08-12 18:20:30 +0200272curses=""
Juan Quintelaa25dba12009-08-12 18:29:52 +0200273docs=""
Juan Quintela2df87df2009-08-12 18:29:54 +0200274fdt=""
Juan Quintelab31a0272009-08-12 18:29:56 +0200275kvm=""
Jan Kiszkadae50792010-01-12 19:53:48 +0100276kvm_para=""
Juan Quintelab0a47e72009-08-12 18:29:49 +0200277nptl=""
Juan Quintelac4198152009-08-12 18:29:53 +0200278sdl=""
Juan Quinteladfffc652009-08-12 18:29:57 +0200279sparse="no"
Stefan Weilee682d22009-10-01 20:10:37 +0200280uuid=""
Juan Quinteladfb278b2009-08-12 18:20:27 +0200281vde=""
Juan Quintela1be10ad2009-08-12 18:20:28 +0200282vnc_tls=""
Juan Quintelaea784e32009-08-12 18:20:29 +0200283vnc_sasl=""
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200284vnc_jpeg=""
Corentin Charyefe556a2010-07-07 20:57:56 +0200285vnc_png=""
Corentin Chary96763cf2010-07-07 20:58:06 +0200286vnc_thread="no"
Juan Quintelafc321b42009-08-12 18:29:55 +0200287xen=""
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200288linux_aio=""
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700289attr=""
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200290vhost_net=""
Juan Quinteladfb278b2009-08-12 18:20:27 +0200291
bellard7d132992003-03-06 23:23:54 +0000292gprof="no"
aurel32f8393942009-04-13 18:45:38 +0000293debug_tcg="no"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200294debug_mon="no"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100295debug="no"
aliguori1625af82009-04-05 17:41:02 +0000296strip_opt="yes"
bellard7d132992003-03-06 23:23:54 +0000297bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000298mingw32="no"
299EXESUF=""
Paolo Bonzini683035d2010-05-26 16:08:28 +0200300prefix="/usr/local"
301mandir="\${prefix}/share/man"
302datadir="\${prefix}/share/qemu"
303docdir="\${prefix}/share/doc/qemu"
304bindir="\${prefix}/bin"
305sysconfdir="\${prefix}/etc"
306confsuffix="/qemu"
bellard443f1372004-06-04 11:13:20 +0000307slirp="yes"
bellard102a52e2004-11-14 19:57:29 +0000308fmod_lib=""
309fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000310oss_lib=""
pbrookb1a550a2006-04-16 13:28:56 +0000311bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000312linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000313solaris="no"
bellard05c2a3e2006-02-08 22:39:17 +0000314profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000315cocoa="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000316softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000317linux_user="no"
318darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000319bsd_user="no"
Paul Brook379f6692009-07-17 12:48:08 +0100320guest_base=""
pbrookc5937222006-05-14 11:30:38 +0000321uname_release=""
aliguorie5d355d2009-04-24 18:03:15 +0000322io_thread="no"
malc8ff9cbf2008-06-23 18:33:30 +0000323mixemu="no"
aliguorieac30262008-11-05 16:28:56 +0000324kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000325aix="no"
Andreas Färber179cf402010-09-20 00:50:43 +0200326haiku="no"
ths77755342008-11-27 15:45:16 +0000327blobs="yes"
pbrook4a19f1e2009-04-07 23:17:49 +0000328pkgversion=""
Luiz Capitulino5495ed12009-08-28 15:27:28 -0300329check_utests="no"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300330user_pie="no"
Anthony Liguori20ff6c82009-12-09 12:59:36 -0600331zero_malloc=""
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +0100332trace_backend="nop"
Prerna Saxena9410b562010-07-13 09:26:32 +0100333trace_file="trace"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +0100334spice=""
bellard7d132992003-03-06 23:23:54 +0000335
336# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000337if check_define __linux__ ; then
338 targetos="Linux"
339elif check_define _WIN32 ; then
340 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000341elif check_define __OpenBSD__ ; then
342 targetos='OpenBSD'
343elif check_define __sun__ ; then
344 targetos='SunOS'
Andreas Färber179cf402010-09-20 00:50:43 +0200345elif check_define __HAIKU__ ; then
346 targetos='Haiku'
aliguoriac0df512008-12-29 17:14:15 +0000347else
348 targetos=`uname -s`
349fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200350
bellard7d132992003-03-06 23:23:54 +0000351case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000352CYGWIN*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200353 mingw32="yes"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200354 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
malcd5631632009-10-10 01:13:41 +0400355 audio_possible_drivers="winwave sdl"
356 audio_drv_list="winwave"
bellardc326e0a2005-04-23 18:30:28 +0000357;;
bellard67b915a2004-03-31 23:37:16 +0000358MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200359 mingw32="yes"
malcd5631632009-10-10 01:13:41 +0400360 audio_possible_drivers="winwave dsound sdl fmod"
361 audio_drv_list="winwave"
bellard67b915a2004-03-31 23:37:16 +0000362;;
ths5c40d2b2007-06-23 16:03:36 +0000363GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100364 bsd="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200365 audio_drv_list="oss"
366 audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000367;;
bellard7d3505c2004-05-12 19:32:15 +0000368FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200369 bsd="yes"
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100370 make="gmake"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200371 audio_drv_list="oss"
372 audio_possible_drivers="oss sdl esd pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100373 # needed for kinfo_getvmmap(3) in libutil.h
374 LIBS="-lutil $LIBS"
bellard7d3505c2004-05-12 19:32:15 +0000375;;
blueswir1c5e97232009-03-07 20:06:23 +0000376DragonFly)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200377 bsd="yes"
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100378 make="gmake"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200379 audio_drv_list="oss"
380 audio_possible_drivers="oss sdl esd pa"
blueswir1c5e97232009-03-07 20:06:23 +0000381;;
bellard7d3505c2004-05-12 19:32:15 +0000382NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200383 bsd="yes"
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100384 make="gmake"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200385 audio_drv_list="oss"
386 audio_possible_drivers="oss sdl esd"
387 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000388;;
389OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200390 bsd="yes"
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100391 make="gmake"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200392 audio_drv_list="oss"
393 audio_possible_drivers="oss sdl esd"
394 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000395;;
bellard83fb7ad2004-07-05 21:25:26 +0000396Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200397 bsd="yes"
398 darwin="yes"
399 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
400 # run 64-bit userspace code
401 if [ "$cpu" = "i386" ] ; then
malcaab85882009-02-23 14:11:10 +0000402 is_x86_64=`sysctl -n hw.optional.x86_64`
403 [ "$is_x86_64" = "1" ] && cpu=x86_64
Juan Quintela0dbfc672009-08-03 14:46:13 +0200404 fi
405 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200406 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200407 LDFLAGS="-arch x86_64 $LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200408 else
Juan Quintelaa558ee12009-08-03 14:46:21 +0200409 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200410 fi
411 darwin_user="yes"
412 cocoa="yes"
413 audio_drv_list="coreaudio"
414 audio_possible_drivers="coreaudio sdl fmod"
415 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200416 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
bellard83fb7ad2004-07-05 21:25:26 +0000417;;
bellardec530c82006-04-25 22:36:06 +0000418SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200419 solaris="yes"
420 make="gmake"
421 install="ginstall"
Blue Swirlfa589482009-10-02 19:38:25 +0000422 ld="gld"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200423 needs_libsunmath="no"
424 solarisrev=`uname -r | cut -f2 -d.`
425 # have to select again, because `uname -m` returns i86pc
426 # even on an x86_64 box.
427 solariscpu=`isainfo -k`
428 if test "${solariscpu}" = "amd64" ; then
429 cpu="x86_64"
430 fi
431 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
432 if test "$solarisrev" -le 9 ; then
433 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
434 needs_libsunmath="yes"
Juan Quintelaf14bfdf2009-08-03 14:47:11 +0200435 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
436 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
437 LIBS="-lsunmath $LIBS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200438 else
439 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
440 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
441 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
442 echo "Studio 11 can be downloaded from www.sun.com."
443 exit 1
444 fi
thsef18c882007-09-16 22:12:39 +0000445 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200446 fi
447 if test -f /usr/include/sys/soundcard.h ; then
448 audio_drv_list="oss"
449 fi
450 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000451# needed for CMSG_ macros in sys/socket.h
452 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
453# needed for TIOCWIN* defines in termios.h
454 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200455 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
Juan Quintelae174c0b2009-08-03 14:46:18 +0200456 LIBS="-lsocket -lnsl -lresolv $LIBS"
ths86b2bd92007-02-11 00:31:33 +0000457;;
malcb29fe3e2008-11-18 01:42:22 +0000458AIX)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200459 aix="yes"
460 make="gmake"
malcb29fe3e2008-11-18 01:42:22 +0000461;;
Andreas Färber179cf402010-09-20 00:50:43 +0200462Haiku)
463 haiku="yes"
464 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
465 LIBS="-lposix_error_mapper -lnetwork $LIBS"
466;;
bellard1d14ffa2005-10-30 18:58:22 +0000467*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200468 audio_drv_list="oss"
469 audio_possible_drivers="oss alsa sdl esd pa"
470 linux="yes"
471 linux_user="yes"
472 usb="linux"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200473 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
malcc2de5c92008-06-28 19:13:06 +0000474 audio_possible_drivers="$audio_possible_drivers fmod"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200475 fi
bellardfb065182004-11-09 23:09:44 +0000476;;
bellard7d132992003-03-06 23:23:54 +0000477esac
478
bellard7d3505c2004-05-12 19:32:15 +0000479if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000480 if [ "$darwin" != "yes" ] ; then
blueswir168063642008-11-22 21:03:55 +0000481 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000482 fi
blueswir184778502008-10-26 20:33:16 +0000483 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000484fi
485
Juan Quintela3457a3f2009-08-03 14:46:07 +0200486if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +0200487 EXESUF=".exe"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200488 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
Stefan Weile94a7932010-02-12 11:02:08 +0100489 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
490 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
Juan Quintela884044a2009-08-03 14:46:19 +0200491 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200492 prefix="c:/Program Files/Qemu"
493 mandir="\${prefix}"
494 datadir="\${prefix}"
495 docdir="\${prefix}"
496 bindir="\${prefix}"
497 sysconfdir="\${prefix}"
498 confsuffix=""
Juan Quintela3457a3f2009-08-03 14:46:07 +0200499fi
500
bellard7d132992003-03-06 23:23:54 +0000501# find source path
pbrookad064842006-04-16 12:41:07 +0000502source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000503source_path_used="no"
504workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000505if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000506 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000507else
508 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000509fi
pbrook724db112008-02-03 19:20:13 +0000510[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000511
Anthony Liguori487fefd2009-06-11 13:28:25 -0500512werror=""
bellard85aa5182007-11-11 20:17:03 +0000513
bellard7d132992003-03-06 23:23:54 +0000514for opt do
pbrooka46e4032006-04-29 23:05:22 +0000515 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000516 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000517 --help|-h) show_help=yes
518 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000519 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000520 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000521 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000522 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000523 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000524 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000525 ;;
aliguoriac0df512008-12-29 17:14:15 +0000526 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000527 ;;
aliguoriac0df512008-12-29 17:14:15 +0000528 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000529 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000530 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000531 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000532 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000533 ;;
pbrook6a882642006-04-17 13:57:12 +0000534 --install=*) install="$optarg"
535 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200536 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000537 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200538 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000539 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200540 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000541 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000542 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000543 ;;
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +0100544 --trace-backend=*) trace_backend="$optarg"
545 ;;
Prerna Saxena9410b562010-07-13 09:26:32 +0100546 --trace-file=*) trace_file="$optarg"
547 ;;
bellard7d132992003-03-06 23:23:54 +0000548 --enable-gprof) gprof="yes"
549 ;;
Loïc Minier79427692010-01-31 12:23:45 +0100550 --static)
551 static="yes"
552 LDFLAGS="-static $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +0000553 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200554 --mandir=*) mandir="$optarg"
555 ;;
556 --bindir=*) bindir="$optarg"
557 ;;
558 --datadir=*) datadir="$optarg"
559 ;;
560 --docdir=*) docdir="$optarg"
561 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +0100562 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -0600563 ;;
bellard97a847b2003-08-10 21:36:04 +0000564 --disable-sdl) sdl="no"
565 ;;
Juan Quintelac4198152009-08-12 18:29:53 +0200566 --enable-sdl) sdl="yes"
567 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000568 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000569 ;;
malcc2de5c92008-06-28 19:13:06 +0000570 --fmod-inc=*) fmod_inc="$optarg"
571 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000572 --oss-lib=*) oss_lib="$optarg"
573 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000574 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000575 ;;
576 --audio-drv-list=*) audio_drv_list="$optarg"
577 ;;
Markus Armbrustereb852012009-10-27 18:41:44 +0100578 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
579 ;;
aurel32f8393942009-04-13 18:45:38 +0000580 --enable-debug-tcg) debug_tcg="yes"
581 ;;
582 --disable-debug-tcg) debug_tcg="no"
583 ;;
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200584 --enable-debug-mon) debug_mon="yes"
585 ;;
586 --disable-debug-mon) debug_mon="no"
587 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100588 --enable-debug)
589 # Enable debugging options that aren't excessively noisy
590 debug_tcg="yes"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200591 debug_mon="yes"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100592 debug="yes"
593 strip_opt="no"
594 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000595 --enable-sparse) sparse="yes"
596 ;;
597 --disable-sparse) sparse="no"
598 ;;
aliguori1625af82009-04-05 17:41:02 +0000599 --disable-strip) strip_opt="no"
600 ;;
ths8d5d2d42007-08-25 01:37:51 +0000601 --disable-vnc-tls) vnc_tls="no"
602 ;;
Juan Quintela1be10ad2009-08-12 18:20:28 +0200603 --enable-vnc-tls) vnc_tls="yes"
604 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000605 --disable-vnc-sasl) vnc_sasl="no"
606 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +0200607 --enable-vnc-sasl) vnc_sasl="yes"
608 ;;
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200609 --disable-vnc-jpeg) vnc_jpeg="no"
610 ;;
611 --enable-vnc-jpeg) vnc_jpeg="yes"
612 ;;
Corentin Charyefe556a2010-07-07 20:57:56 +0200613 --disable-vnc-png) vnc_png="no"
614 ;;
615 --enable-vnc-png) vnc_png="yes"
616 ;;
Corentin Charybd023f92010-07-07 20:58:02 +0200617 --disable-vnc-thread) vnc_thread="no"
618 ;;
619 --enable-vnc-thread) vnc_thread="yes"
620 ;;
bellard443f1372004-06-04 11:13:20 +0000621 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000622 ;;
Stefan Weilee682d22009-10-01 20:10:37 +0200623 --disable-uuid) uuid="no"
624 ;;
625 --enable-uuid) uuid="yes"
626 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000627 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000628 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +0200629 --enable-vde) vde="yes"
630 ;;
aliguorie37630c2009-04-22 15:19:10 +0000631 --disable-xen) xen="no"
632 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +0200633 --enable-xen) xen="yes"
634 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000635 --disable-brlapi) brlapi="no"
636 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200637 --enable-brlapi) brlapi="yes"
638 ;;
balrogfb599c92008-09-28 23:49:55 +0000639 --disable-bluez) bluez="no"
640 ;;
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200641 --enable-bluez) bluez="yes"
642 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000643 --disable-kvm) kvm="no"
644 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +0200645 --enable-kvm) kvm="yes"
646 ;;
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +0100647 --disable-spice) spice="no"
648 ;;
649 --enable-spice) spice="yes"
650 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000651 --enable-profiler) profiler="yes"
652 ;;
malcc2de5c92008-06-28 19:13:06 +0000653 --enable-cocoa)
654 cocoa="yes" ;
655 sdl="no" ;
656 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000657 ;;
pbrookcad25d62006-03-19 16:31:11 +0000658 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000659 ;;
pbrookcad25d62006-03-19 16:31:11 +0000660 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000661 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -1000662 --disable-user)
663 linux_user="no" ;
664 bsd_user="no" ;
665 darwin_user="no"
666 ;;
667 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +0000668 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000669 ;;
ths831b7822007-01-18 20:06:33 +0000670 --enable-linux-user) linux_user="yes"
671 ;;
672 --disable-darwin-user) darwin_user="no"
673 ;;
674 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000675 ;;
blueswir184778502008-10-26 20:33:16 +0000676 --disable-bsd-user) bsd_user="no"
677 ;;
678 --enable-bsd-user) bsd_user="yes"
679 ;;
Paul Brook379f6692009-07-17 12:48:08 +0100680 --enable-guest-base) guest_base="yes"
681 ;;
682 --disable-guest-base) guest_base="no"
683 ;;
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300684 --enable-user-pie) user_pie="yes"
685 ;;
686 --disable-user-pie) user_pie="no"
687 ;;
pbrookc5937222006-05-14 11:30:38 +0000688 --enable-uname-release=*) uname_release="$optarg"
689 ;;
blueswir131422552007-04-16 18:27:06 +0000690 --sparc_cpu=*)
blueswir131422552007-04-16 18:27:06 +0000691 ;;
bellard85aa5182007-11-11 20:17:03 +0000692 --enable-werror) werror="yes"
693 ;;
694 --disable-werror) werror="no"
695 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000696 --disable-curses) curses="no"
697 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +0200698 --enable-curses) curses="yes"
699 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200700 --disable-curl) curl="no"
701 ;;
Juan Quintela788c8192009-08-12 18:29:47 +0200702 --enable-curl) curl="yes"
703 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +0200704 --disable-fdt) fdt="no"
705 ;;
706 --enable-fdt) fdt="yes"
707 ;;
Luiz Capitulino5495ed12009-08-28 15:27:28 -0300708 --disable-check-utests) check_utests="no"
709 ;;
710 --enable-check-utests) check_utests="yes"
711 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000712 --disable-nptl) nptl="no"
713 ;;
Juan Quintelab0a47e72009-08-12 18:29:49 +0200714 --enable-nptl) nptl="yes"
715 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000716 --enable-mixemu) mixemu="yes"
717 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200718 --disable-linux-aio) linux_aio="no"
719 ;;
720 --enable-linux-aio) linux_aio="yes"
721 ;;
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700722 --disable-attr) attr="no"
723 ;;
724 --enable-attr) attr="yes"
725 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000726 --enable-io-thread) io_thread="yes"
727 ;;
ths77755342008-11-27 15:45:16 +0000728 --disable-blobs) blobs="no"
729 ;;
aliguorieac30262008-11-05 16:28:56 +0000730 --kerneldir=*) kerneldir="$optarg"
731 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000732 --with-pkgversion=*) pkgversion=" ($optarg)"
733 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200734 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500735 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200736 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +0200737 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200738 --disable-vhost-net) vhost_net="no"
739 ;;
740 --enable-vhost-net) vhost_net="yes"
741 ;;
Paolo Bonzini6bde81c2010-05-26 16:08:27 +0200742 --*dir)
743 ;;
balrog7f1559c2007-11-17 10:24:32 +0000744 *) echo "ERROR: unknown option $opt"; show_help="yes"
745 ;;
bellard7d132992003-03-06 23:23:54 +0000746 esac
747done
748
blueswir131422552007-04-16 18:27:06 +0000749#
750# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
Juan Quintelaa558ee12009-08-03 14:46:21 +0200751# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
blueswir131422552007-04-16 18:27:06 +0000752#
Paul Brook379f6692009-07-17 12:48:08 +0100753host_guest_base="no"
bellard40293e52008-01-31 11:32:10 +0000754case "$cpu" in
Juan Quintelaed968ff2009-08-03 14:46:11 +0200755 sparc) case $sparc_cpu in
756 v7|v8)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200757 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200758 ;;
759 v8plus|v8plusa)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200760 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200761 ;;
762 *) # sparc_cpu not defined in the command line
Juan Quintelaa558ee12009-08-03 14:46:21 +0200763 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200764 esac
765 LDFLAGS="-m32 $LDFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200766 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000767 if test "$solaris" = "no" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200768 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
Juan Quintelac81da562009-08-03 14:46:24 +0200769 helper_cflags="-ffixed-i0"
blueswir1762e8232009-04-04 09:21:28 +0000770 fi
blueswir131422552007-04-16 18:27:06 +0000771 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +0200772 sparc64)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200773 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200774 LDFLAGS="-m64 $LDFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200775 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200776 if test "$solaris" != "no" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200777 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000778 fi
blueswir131422552007-04-16 18:27:06 +0000779 ;;
ths76d83bd2007-11-18 21:22:10 +0000780 s390)
Richard Henderson28d7cc42010-06-04 12:14:09 -0700781 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
782 LDFLAGS="-m31 $LDFLAGS"
Richard Henderson48bb3752010-06-28 19:15:37 -0700783 host_guest_base="yes"
Richard Henderson28d7cc42010-06-04 12:14:09 -0700784 ;;
785 s390x)
786 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
787 LDFLAGS="-m64 $LDFLAGS"
Richard Henderson48bb3752010-06-28 19:15:37 -0700788 host_guest_base="yes"
ths76d83bd2007-11-18 21:22:10 +0000789 ;;
bellard40293e52008-01-31 11:32:10 +0000790 i386)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200791 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200792 LDFLAGS="-m32 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200793 cc_i386='$(CC) -m32'
Juan Quintelac81da562009-08-03 14:46:24 +0200794 helper_cflags="-fomit-frame-pointer"
Paul Brook379f6692009-07-17 12:48:08 +0100795 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000796 ;;
797 x86_64)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200798 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200799 LDFLAGS="-m64 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200800 cc_i386='$(CC) -m32'
Paul Brook379f6692009-07-17 12:48:08 +0100801 host_guest_base="yes"
802 ;;
803 arm*)
804 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000805 ;;
malcf6548c02009-07-18 10:08:40 +0400806 ppc*)
807 host_guest_base="yes"
808 ;;
Aurelien Jarnocc01cc82010-03-27 17:31:04 +0100809 mips*)
810 host_guest_base="yes"
811 ;;
Aurelien Jarno477ba622010-03-29 02:12:51 +0200812 ia64*)
813 host_guest_base="yes"
814 ;;
Richard Hendersonfd76e732010-04-07 04:56:43 -0700815 hppa*)
816 host_guest_base="yes"
817 ;;
blueswir131422552007-04-16 18:27:06 +0000818esac
819
Paul Brook379f6692009-07-17 12:48:08 +0100820[ -z "$guest_base" ] && guest_base="$host_guest_base"
821
pbrookaf5db582006-04-08 14:26:41 +0000822if test x"$show_help" = x"yes" ; then
823cat << EOF
824
825Usage: configure [options]
826Options: [defaults in brackets after descriptions]
827
828EOF
829echo "Standard options:"
830echo " --help print this message"
831echo " --prefix=PREFIX install in PREFIX [$prefix]"
832echo " --interp-prefix=PREFIX where to find shared libraries, etc."
833echo " use %M for cpu name [$interp_prefix]"
834echo " --target-list=LIST set target list [$target_list]"
835echo ""
pbrookaf5db582006-04-08 14:26:41 +0000836echo "Advanced options (experts only):"
837echo " --source-path=PATH path of source code [$source_path]"
838echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
839echo " --cc=CC use C compiler CC [$cc]"
Paolo Bonzini0bfe8cc2010-05-26 16:08:18 +0200840echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
841echo " build time"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200842echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
Jan Kiszkae3fc14c2009-06-30 21:29:03 +0200843echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000844echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000845echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000846echo " --static enable static build [$static]"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200847echo " --mandir=PATH install man pages in PATH"
848echo " --datadir=PATH install firmware in PATH"
849echo " --docdir=PATH install documentation in PATH"
850echo " --bindir=PATH install binaries in PATH"
851echo " --sysconfdir=PATH install config in PATH/qemu"
aurel32f8393942009-04-13 18:45:38 +0000852echo " --enable-debug-tcg enable TCG debugging"
853echo " --disable-debug-tcg disable TCG debugging (default)"
Stefan Weil09695a42009-06-06 16:51:30 +0200854echo " --enable-debug enable common debug build options"
aliguori890b1652008-10-07 21:22:41 +0000855echo " --enable-sparse enable sparse checker"
856echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000857echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000858echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000859echo " --disable-sdl disable SDL"
Juan Quintelac4198152009-08-12 18:29:53 +0200860echo " --enable-sdl enable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000861echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000862echo " --audio-drv-list=LIST set audio drivers list:"
863echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000864echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
865echo " Available cards: $audio_possible_cards"
Markus Armbrustereb852012009-10-27 18:41:44 +0100866echo " --block-drv-whitelist=L set block driver whitelist"
867echo " (affects only QEMU, not qemu-img)"
malc8ff9cbf2008-06-23 18:33:30 +0000868echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000869echo " --disable-xen disable xen backend driver support"
Juan Quintelafc321b42009-08-12 18:29:55 +0200870echo " --enable-xen enable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000871echo " --disable-brlapi disable BrlAPI"
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200872echo " --enable-brlapi enable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000873echo " --disable-vnc-tls disable TLS encryption for VNC server"
Juan Quintela1be10ad2009-08-12 18:20:28 +0200874echo " --enable-vnc-tls enable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000875echo " --disable-vnc-sasl disable SASL encryption for VNC server"
Juan Quintelaea784e32009-08-12 18:20:29 +0200876echo " --enable-vnc-sasl enable SASL encryption for VNC server"
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200877echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
878echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
Corentin Chary96763cf2010-07-07 20:58:06 +0200879echo " --disable-vnc-png disable PNG compression for VNC server (default)"
Corentin Charyefe556a2010-07-07 20:57:56 +0200880echo " --enable-vnc-png enable PNG compression for VNC server"
Corentin Charybd023f92010-07-07 20:58:02 +0200881echo " --disable-vnc-thread disable threaded VNC server"
882echo " --enable-vnc-thread enable threaded VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000883echo " --disable-curses disable curses output"
Juan Quintelac584a6d2009-08-12 18:20:30 +0200884echo " --enable-curses enable curses output"
Alexander Graf769ce762009-05-11 17:41:42 +0200885echo " --disable-curl disable curl connectivity"
Juan Quintela788c8192009-08-12 18:29:47 +0200886echo " --enable-curl enable curl connectivity"
Juan Quintela2df87df2009-08-12 18:29:54 +0200887echo " --disable-fdt disable fdt device tree"
888echo " --enable-fdt enable fdt device tree"
Luiz Capitulino5495ed12009-08-28 15:27:28 -0300889echo " --disable-check-utests disable check unit-tests"
890echo " --enable-check-utests enable check unit-tests"
balrogfb599c92008-09-28 23:49:55 +0000891echo " --disable-bluez disable bluez stack connectivity"
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200892echo " --enable-bluez enable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000893echo " --disable-kvm disable KVM acceleration support"
Juan Quintelab31a0272009-08-12 18:29:56 +0200894echo " --enable-kvm enable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000895echo " --disable-nptl disable usermode NPTL support"
Andre Przywarae5934d32009-09-16 14:29:07 +0200896echo " --enable-nptl enable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000897echo " --enable-system enable all system emulation targets"
898echo " --disable-system disable all system emulation targets"
Zachary Amsden0953a802009-07-30 00:14:59 -1000899echo " --enable-user enable supported user emulation targets"
900echo " --disable-user disable all user emulation targets"
ths831b7822007-01-18 20:06:33 +0000901echo " --enable-linux-user enable all linux usermode emulation targets"
902echo " --disable-linux-user disable all linux usermode emulation targets"
903echo " --enable-darwin-user enable all darwin usermode emulation targets"
904echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000905echo " --enable-bsd-user enable all BSD usermode emulation targets"
906echo " --disable-bsd-user disable all BSD usermode emulation targets"
Paul Brook379f6692009-07-17 12:48:08 +0100907echo " --enable-guest-base enable GUEST_BASE support for usermode"
908echo " emulation targets"
909echo " --disable-guest-base disable GUEST_BASE support"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300910echo " --enable-user-pie build usermode emulation targets as PIE"
911echo " --disable-user-pie do not build usermode emulation targets as PIE"
pbrookaf5db582006-04-08 14:26:41 +0000912echo " --fmod-lib path to FMOD library"
913echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000914echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000915echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000916echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
Stefan Weilee682d22009-10-01 20:10:37 +0200917echo " --disable-uuid disable uuid support"
918echo " --enable-uuid enable uuid support"
aliguorie0e6c8c02008-07-23 18:14:33 +0000919echo " --disable-vde disable support for vde network"
Juan Quinteladfb278b2009-08-12 18:20:27 +0200920echo " --enable-vde enable support for vde network"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200921echo " --disable-linux-aio disable Linux AIO support"
922echo " --enable-linux-aio enable Linux AIO support"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700923echo " --disable-attr disables attr and xattr support"
924echo " --enable-attr enable attr and xattr support"
aliguorie5d355d2009-04-24 18:03:15 +0000925echo " --enable-io-thread enable IO thread"
ths77755342008-11-27 15:45:16 +0000926echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000927echo " --kerneldir=PATH look for kernel includes in PATH"
Dirk Ullrichd2807bc2010-02-06 09:48:23 +0100928echo " --enable-docs enable documentation build"
929echo " --disable-docs disable documentation build"
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200930echo " --disable-vhost-net disable vhost-net acceleration support"
931echo " --enable-vhost-net enable vhost-net acceleration support"
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +0000932echo " --trace-backend=B Trace backend nop simple ust dtrace"
Prerna Saxena9410b562010-07-13 09:26:32 +0100933echo " --trace-file=NAME Full PATH,NAME of file to store traces"
934echo " Default:trace-<pid>"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +0100935echo " --disable-spice disable spice"
936echo " --enable-spice enable spice"
pbrookaf5db582006-04-08 14:26:41 +0000937echo ""
ths5bf08932006-12-23 00:33:26 +0000938echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000939exit 1
940fi
941
bellardec530c82006-04-25 22:36:06 +0000942#
943# Solaris specific configure tool chain decisions
944#
945if test "$solaris" = "yes" ; then
Loïc Minier6792aa12010-01-20 11:35:54 +0100946 if has $install; then
947 :
948 else
bellardec530c82006-04-25 22:36:06 +0000949 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
950 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
951 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
952 exit 1
953 fi
Loïc Minier6792aa12010-01-20 11:35:54 +0100954 if test "`path_of $install`" = "/usr/sbin/install" ; then
bellardec530c82006-04-25 22:36:06 +0000955 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
956 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
957 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
958 exit 1
959 fi
Loïc Minier6792aa12010-01-20 11:35:54 +0100960 if has ar; then
961 :
962 else
bellardec530c82006-04-25 22:36:06 +0000963 echo "Error: No path includes ar"
964 if test -f /usr/ccs/bin/ar ; then
965 echo "Add /usr/ccs/bin to your path and rerun configure"
966 fi
967 exit 1
968 fi
ths5fafdf22007-09-16 21:08:06 +0000969fi
bellardec530c82006-04-25 22:36:06 +0000970
971
bellard5327cf42005-01-10 23:18:50 +0000972if test -z "$target_list" ; then
973# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000974 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000975 target_list="\
976i386-softmmu \
977x86_64-softmmu \
978arm-softmmu \
979cris-softmmu \
980m68k-softmmu \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200981microblaze-softmmu \
aurel322408a522008-04-20 20:19:44 +0000982mips-softmmu \
983mipsel-softmmu \
984mips64-softmmu \
985mips64el-softmmu \
986ppc-softmmu \
987ppcemb-softmmu \
988ppc64-softmmu \
989sh4-softmmu \
990sh4eb-softmmu \
991sparc-softmmu \
Igor V. Kovalenko1b64fca2009-06-23 18:04:16 +0000992sparc64-softmmu \
aurel322408a522008-04-20 20:19:44 +0000993"
pbrook0a8e90f2006-03-19 14:54:16 +0000994 fi
bellard5327cf42005-01-10 23:18:50 +0000995# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000996 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000997 target_list="${target_list}\
998i386-linux-user \
999x86_64-linux-user \
1000alpha-linux-user \
1001arm-linux-user \
1002armeb-linux-user \
1003cris-linux-user \
1004m68k-linux-user \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02001005microblaze-linux-user \
aurel322408a522008-04-20 20:19:44 +00001006mips-linux-user \
1007mipsel-linux-user \
1008ppc-linux-user \
1009ppc64-linux-user \
1010ppc64abi32-linux-user \
1011sh4-linux-user \
1012sh4eb-linux-user \
1013sparc-linux-user \
1014sparc64-linux-user \
1015sparc32plus-linux-user \
1016"
ths831b7822007-01-18 20:06:33 +00001017 fi
1018# the following are Darwin specific
1019 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +00001020 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +00001021 fi
blueswir184778502008-10-26 20:33:16 +00001022# the following are BSD specific
1023 if [ "$bsd_user" = "yes" ] ; then
1024 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +00001025i386-bsd-user \
1026x86_64-bsd-user \
1027sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +00001028sparc64-bsd-user \
1029"
1030 fi
bellard6e20a452005-06-05 15:56:02 +00001031else
pbrookb1a550a2006-04-16 13:28:56 +00001032 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +00001033fi
pbrook0a8e90f2006-03-19 14:54:16 +00001034if test -z "$target_list" ; then
1035 echo "No targets enabled"
1036 exit 1
1037fi
Paolo Bonzinif55fe272010-05-26 16:08:17 +02001038# see if system emulation was really requested
1039case " $target_list " in
1040 *"-softmmu "*) softmmu=yes
1041 ;;
1042 *) softmmu=no
1043 ;;
1044esac
bellard5327cf42005-01-10 23:18:50 +00001045
Juan Quintela249247c2009-08-12 18:20:25 +02001046feature_not_found() {
1047 feature=$1
1048
1049 echo "ERROR"
1050 echo "ERROR: User requested feature $feature"
Sebastian Herbszt9332f6a2009-09-13 21:32:54 +02001051 echo "ERROR: configure was not able to find it"
Juan Quintela249247c2009-08-12 18:20:25 +02001052 echo "ERROR"
1053 exit 1;
1054}
1055
bellard7d132992003-03-06 23:23:54 +00001056if test -z "$cross_prefix" ; then
1057
1058# ---
1059# big/little endian test
1060cat > $TMPC << EOF
1061#include <inttypes.h>
1062int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +00001063 volatile uint32_t i=0x01234567;
1064 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +00001065}
1066EOF
1067
Juan Quintela52166aa2009-08-03 14:46:03 +02001068if compile_prog "" "" ; then
bellard7d132992003-03-06 23:23:54 +00001069$TMPE && bigendian="yes"
1070else
1071echo big/little test failed
1072fi
1073
1074else
1075
1076# if cross compiling, cannot launch a program, so make a static guess
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001077case "$cpu" in
Alexander Graf24e804ec2009-12-05 12:44:22 +01001078 armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001079 bigendian=yes
1080 ;;
1081esac
bellard7d132992003-03-06 23:23:54 +00001082
1083fi
1084
bellardb6853692005-06-05 17:10:39 +00001085# host long bits test
1086hostlongbits="32"
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001087case "$cpu" in
Alexander Graf24e804ec2009-12-05 12:44:22 +01001088 x86_64|alpha|ia64|sparc64|ppc64|s390x)
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001089 hostlongbits=64
1090 ;;
1091esac
bellardb6853692005-06-05 17:10:39 +00001092
Juan Quintelab0a47e72009-08-12 18:29:49 +02001093
1094##########################################
1095# NPTL probe
1096
1097if test "$nptl" != "no" ; then
1098 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00001099#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00001100#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +00001101void foo()
1102{
1103#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1104#error bork
1105#endif
1106}
1107EOF
1108
Juan Quintelab0a47e72009-08-12 18:29:49 +02001109 if compile_object ; then
1110 nptl=yes
1111 else
1112 if test "$nptl" = "yes" ; then
1113 feature_not_found "nptl"
1114 fi
1115 nptl=no
1116 fi
pbrookbd0c5662008-05-29 14:34:11 +00001117fi
1118
bellard11d9f692004-04-02 20:55:59 +00001119##########################################
balrogac629222008-10-11 09:56:04 +00001120# zlib check
1121
1122cat > $TMPC << EOF
1123#include <zlib.h>
1124int main(void) { zlibVersion(); return 0; }
1125EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001126if compile_prog "" "-lz" ; then
balrogac629222008-10-11 09:56:04 +00001127 :
1128else
1129 echo
1130 echo "Error: zlib check failed"
1131 echo "Make sure to have the zlib libs and headers installed."
1132 echo
1133 exit 1
1134fi
1135
1136##########################################
aliguorie37630c2009-04-22 15:19:10 +00001137# xen probe
1138
Juan Quintelafc321b42009-08-12 18:29:55 +02001139if test "$xen" != "no" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +02001140 xen_libs="-lxenstore -lxenctrl -lxenguest"
1141 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00001142#include <xenctrl.h>
1143#include <xs.h>
Christoph Eggerdf7a6072009-06-30 14:59:38 +02001144int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
aliguorie37630c2009-04-22 15:19:10 +00001145EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001146 if compile_prog "" "$xen_libs" ; then
Juan Quintelafc321b42009-08-12 18:29:55 +02001147 xen=yes
Juan Quintela3efd6322009-08-03 14:46:36 +02001148 libs_softmmu="$xen_libs $libs_softmmu"
Juan Quintelab2266be2009-07-27 16:13:16 +02001149 else
Juan Quintelafc321b42009-08-12 18:29:55 +02001150 if test "$xen" = "yes" ; then
1151 feature_not_found "xen"
1152 fi
1153 xen=no
Juan Quintelab2266be2009-07-27 16:13:16 +02001154 fi
aliguorie37630c2009-04-22 15:19:10 +00001155fi
1156
1157##########################################
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001158# pkgconfig probe
1159
1160pkgconfig="${cross_prefix}pkg-config"
Loïc Minier0dba6192010-01-28 21:26:51 +00001161if ! has $pkgconfig; then
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001162 # likely not cross compiling, or hope for the best
1163 pkgconfig=pkg-config
1164fi
1165
1166##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02001167# Sparse probe
1168if test "$sparse" != "no" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001169 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02001170 sparse=yes
1171 else
1172 if test "$sparse" = "yes" ; then
1173 feature_not_found "sparse"
1174 fi
1175 sparse=no
1176 fi
1177fi
1178
1179##########################################
bellard11d9f692004-04-02 20:55:59 +00001180# SDL probe
1181
Stefan Weilfec0e3e2010-04-11 18:44:18 +02001182# Look for sdl configuration program (pkg-config or sdl-config).
1183# Prefer variant with cross prefix if cross compiling,
1184# and favour pkg-config with sdl over sdl-config.
1185if test -n "$cross_prefix" -a $pkgconfig != pkg-config && \
1186 $pkgconfig sdl --modversion >/dev/null 2>&1; then
1187 sdlconfig="$pkgconfig sdl"
1188 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1189elif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then
1190 sdlconfig="${cross_prefix}sdl-config"
1191 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1192elif $pkgconfig sdl --modversion >/dev/null 2>&1; then
Paolo Bonzini9316f802010-01-13 09:52:55 +01001193 sdlconfig="$pkgconfig sdl"
1194 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
Loïc Minier0dba6192010-01-28 21:26:51 +00001195elif has sdl-config; then
Paolo Bonzini9316f802010-01-13 09:52:55 +01001196 sdlconfig='sdl-config'
1197 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00001198else
1199 if test "$sdl" = "yes" ; then
1200 feature_not_found "sdl"
1201 fi
1202 sdl=no
Paolo Bonzini9316f802010-01-13 09:52:55 +01001203fi
bellard11d9f692004-04-02 20:55:59 +00001204
Paolo Bonzini9316f802010-01-13 09:52:55 +01001205sdl_too_old=no
Juan Quintelac4198152009-08-12 18:29:53 +02001206if test "$sdl" != "no" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001207 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00001208#include <SDL.h>
1209#undef main /* We don't want SDL to override our main() */
1210int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1211EOF
Paolo Bonzini9316f802010-01-13 09:52:55 +01001212 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
TeLeMan74f42e12010-02-08 13:56:44 +08001213 if test "$static" = "yes" ; then
1214 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1215 else
1216 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1217 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001218 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001219 if test "$_sdlversion" -lt 121 ; then
1220 sdl_too_old=yes
1221 else
1222 if test "$cocoa" = "no" ; then
1223 sdl=yes
1224 fi
1225 fi
aliguoricd01b4a2008-08-21 19:25:45 +00001226
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001227 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Juan Quintelaac119f92009-07-27 16:13:15 +02001228 if test "$sdl" = "yes" -a "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001229 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weilf8aa6c72010-03-01 22:10:46 +01001230 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1231 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
Juan Quintelaac119f92009-07-27 16:13:15 +02001232 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001233 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001234 :
1235 else
1236 sdl=no
1237 fi
1238 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02001239 else # sdl not found
1240 if test "$sdl" = "yes" ; then
1241 feature_not_found "sdl"
1242 fi
1243 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02001244 fi # sdl compile test
Juan Quintelaa68551b2009-07-27 16:13:09 +02001245fi
bellard11d9f692004-04-02 20:55:59 +00001246
aliguori5368a422009-03-03 17:37:21 +00001247if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001248 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00001249#include <SDL.h>
1250#if defined(SDL_VIDEO_DRIVER_X11)
1251#include <X11/XKBlib.h>
1252#else
1253#error No x11 support
1254#endif
1255int main(void) { return 0; }
1256EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001257 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001258 sdl_libs="$sdl_libs -lX11"
1259 fi
Juan Quintela07d9ac42009-08-03 14:46:25 +02001260 if test "$mingw32" = "yes" ; then
1261 sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1262 fi
Juan Quintela07056672009-08-03 14:46:27 +02001263 libs_softmmu="$sdl_libs $libs_softmmu"
aliguori5368a422009-03-03 17:37:21 +00001264fi
1265
ths8f28f3f2007-01-05 21:25:54 +00001266##########################################
ths8d5d2d42007-08-25 01:37:51 +00001267# VNC TLS detection
Juan Quintela1be10ad2009-08-12 18:20:28 +02001268if test "$vnc_tls" != "no" ; then
1269 cat > $TMPC <<EOF
aliguoriae6b5e52008-08-06 16:55:50 +00001270#include <gnutls/gnutls.h>
1271int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1272EOF
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001273 vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null`
1274 vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null`
Juan Quintela1be10ad2009-08-12 18:20:28 +02001275 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1276 vnc_tls=yes
1277 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1278 else
1279 if test "$vnc_tls" = "yes" ; then
1280 feature_not_found "vnc-tls"
aliguoriae6b5e52008-08-06 16:55:50 +00001281 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02001282 vnc_tls=no
1283 fi
ths8d5d2d42007-08-25 01:37:51 +00001284fi
1285
1286##########################################
aliguori2f9606b2009-03-06 20:27:28 +00001287# VNC SASL detection
Juan Quintela3aefa742009-08-31 17:16:43 +02001288if test "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02001289 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00001290#include <sasl/sasl.h>
1291#include <stdio.h>
1292int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1293EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02001294 # Assuming Cyrus-SASL installed in /usr prefix
1295 vnc_sasl_cflags=""
1296 vnc_sasl_libs="-lsasl2"
1297 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1298 vnc_sasl=yes
1299 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1300 else
1301 if test "$vnc_sasl" = "yes" ; then
1302 feature_not_found "vnc-sasl"
aliguori2f9606b2009-03-06 20:27:28 +00001303 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02001304 vnc_sasl=no
1305 fi
aliguori2f9606b2009-03-06 20:27:28 +00001306fi
1307
1308##########################################
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001309# VNC JPEG detection
Corentin Chary96763cf2010-07-07 20:58:06 +02001310if test "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001311cat > $TMPC <<EOF
1312#include <stdio.h>
1313#include <jpeglib.h>
1314int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1315EOF
1316 vnc_jpeg_cflags=""
1317 vnc_jpeg_libs="-ljpeg"
1318 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1319 vnc_jpeg=yes
1320 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1321 else
1322 if test "$vnc_jpeg" = "yes" ; then
1323 feature_not_found "vnc-jpeg"
1324 fi
1325 vnc_jpeg=no
1326 fi
1327fi
1328
1329##########################################
Corentin Charyefe556a2010-07-07 20:57:56 +02001330# VNC PNG detection
Corentin Chary96763cf2010-07-07 20:58:06 +02001331if test "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02001332cat > $TMPC <<EOF
1333//#include <stdio.h>
1334#include <png.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05001335#include <stddef.h>
Corentin Charyefe556a2010-07-07 20:57:56 +02001336int main(void) {
1337 png_structp png_ptr;
1338 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1339 return 0;
1340}
1341EOF
1342 vnc_png_cflags=""
1343 vnc_png_libs="-lpng"
1344 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1345 vnc_png=yes
1346 libs_softmmu="$vnc_png_libs $libs_softmmu"
1347 else
1348 if test "$vnc_png" = "yes" ; then
1349 feature_not_found "vnc-png"
1350 fi
1351 vnc_png=no
1352 fi
1353fi
1354
1355##########################################
aliguori76655d62009-03-06 20:27:37 +00001356# fnmatch() probe, used for ACL routines
1357fnmatch="no"
1358cat > $TMPC << EOF
1359#include <fnmatch.h>
1360int main(void)
1361{
1362 fnmatch("foo", "foo", 0);
1363 return 0;
1364}
1365EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001366if compile_prog "" "" ; then
aliguori76655d62009-03-06 20:27:37 +00001367 fnmatch="yes"
1368fi
1369
1370##########################################
Stefan Weilee682d22009-10-01 20:10:37 +02001371# uuid_generate() probe, used for vdi block driver
1372if test "$uuid" != "no" ; then
1373 uuid_libs="-luuid"
1374 cat > $TMPC << EOF
1375#include <uuid/uuid.h>
1376int main(void)
1377{
1378 uuid_t my_uuid;
1379 uuid_generate(my_uuid);
1380 return 0;
1381}
1382EOF
1383 if compile_prog "" "$uuid_libs" ; then
1384 uuid="yes"
1385 libs_softmmu="$uuid_libs $libs_softmmu"
1386 libs_tools="$uuid_libs $libs_tools"
1387 else
1388 if test "$uuid" = "yes" ; then
1389 feature_not_found "uuid"
1390 fi
1391 uuid=no
1392 fi
1393fi
1394
1395##########################################
ths8a16d272008-07-19 09:56:24 +00001396# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02001397if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02001398 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00001399 cat > $TMPC << EOF
1400#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00001401int main(void)
1402{
1403 struct vde_open_args a = {0, 0, 0};
1404 vde_open("", "", &a);
1405 return 0;
1406}
ths8a16d272008-07-19 09:56:24 +00001407EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001408 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02001409 vde=yes
Juan Quintela8e02e542009-08-03 14:47:07 +02001410 libs_softmmu="$vde_libs $libs_softmmu"
1411 libs_tools="$vde_libs $libs_tools"
Juan Quinteladfb278b2009-08-12 18:20:27 +02001412 else
1413 if test "$vde" = "yes" ; then
1414 feature_not_found "vde"
1415 fi
1416 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02001417 fi
ths8a16d272008-07-19 09:56:24 +00001418fi
1419
1420##########################################
malcc2de5c92008-06-28 19:13:06 +00001421# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00001422
malcc2de5c92008-06-28 19:13:06 +00001423audio_drv_probe()
1424{
1425 drv=$1
1426 hdr=$2
1427 lib=$3
1428 exp=$4
1429 cfl=$5
1430 cat > $TMPC << EOF
1431#include <$hdr>
1432int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00001433EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001434 if compile_prog "$cfl" "$lib" ; then
malcc2de5c92008-06-28 19:13:06 +00001435 :
1436 else
1437 echo
1438 echo "Error: $drv check failed"
1439 echo "Make sure to have the $drv libs and headers installed."
1440 echo
1441 exit 1
1442 fi
1443}
1444
malc2fa7d3b2008-07-29 12:58:44 +00001445audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00001446for drv in $audio_drv_list; do
1447 case $drv in
1448 alsa)
1449 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1450 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001451 libs_softmmu="-lasound $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00001452 ;;
1453
1454 fmod)
1455 if test -z $fmod_lib || test -z $fmod_inc; then
1456 echo
1457 echo "Error: You must specify path to FMOD library and headers"
1458 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1459 echo
1460 exit 1
1461 fi
1462 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001463 libs_softmmu="$fmod_lib $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00001464 ;;
1465
1466 esd)
1467 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001468 libs_softmmu="-lesd $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02001469 audio_pt_int="yes"
malcc2de5c92008-06-28 19:13:06 +00001470 ;;
malcb8e59f12008-07-02 21:03:08 +00001471
1472 pa)
Aurelien Jarno493abda2009-11-16 17:52:03 +01001473 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
malcb8e59f12008-07-02 21:03:08 +00001474 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
Aurelien Jarno493abda2009-11-16 17:52:03 +01001475 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02001476 audio_pt_int="yes"
malcb8e59f12008-07-02 21:03:08 +00001477 ;;
1478
Juan Quintela997e6902009-08-03 14:46:29 +02001479 coreaudio)
1480 libs_softmmu="-framework CoreAudio $libs_softmmu"
1481 ;;
1482
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001483 dsound)
1484 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
malcd5631632009-10-10 01:13:41 +04001485 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001486 ;;
1487
1488 oss)
1489 libs_softmmu="$oss_lib $libs_softmmu"
1490 ;;
1491
1492 sdl|wav)
blueswir12f6a1ab2008-08-21 18:00:53 +00001493 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1494 ;;
1495
malcd5631632009-10-10 01:13:41 +04001496 winwave)
1497 libs_softmmu="-lwinmm $libs_softmmu"
1498 audio_win_int="yes"
1499 ;;
1500
malce4c63a62008-07-19 16:15:16 +00001501 *)
malc1c9b2a52008-07-19 16:57:30 +00001502 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001503 echo
1504 echo "Error: Unknown driver '$drv' selected"
1505 echo "Possible drivers are: $audio_possible_drivers"
1506 echo
1507 exit 1
1508 }
1509 ;;
malcc2de5c92008-06-28 19:13:06 +00001510 esac
1511done
ths8f28f3f2007-01-05 21:25:54 +00001512
balrog4d3b6f62008-02-10 16:33:14 +00001513##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001514# BrlAPI probe
1515
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001516if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001517 brlapi_libs="-lbrlapi"
1518 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00001519#include <brlapi.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05001520#include <stddef.h>
aurel322e4d9fb2008-04-08 06:01:02 +00001521int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1522EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001523 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001524 brlapi=yes
Juan Quintela264606b2009-08-03 14:46:39 +02001525 libs_softmmu="$brlapi_libs $libs_softmmu"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001526 else
1527 if test "$brlapi" = "yes" ; then
1528 feature_not_found "brlapi"
1529 fi
1530 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02001531 fi
1532fi
aurel322e4d9fb2008-04-08 06:01:02 +00001533
1534##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001535# curses probe
Juan Quintela4f78ef92009-08-12 18:20:23 +02001536curses_list="-lncurses -lcurses"
balrog4d3b6f62008-02-10 16:33:14 +00001537
Juan Quintelac584a6d2009-08-12 18:20:30 +02001538if test "$curses" != "no" ; then
1539 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00001540 cat > $TMPC << EOF
1541#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001542#ifdef __OpenBSD__
1543#define resize_term resizeterm
1544#endif
1545int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001546EOF
Juan Quintela4f78ef92009-08-12 18:20:23 +02001547 for curses_lib in $curses_list; do
1548 if compile_prog "" "$curses_lib" ; then
Juan Quintelac584a6d2009-08-12 18:20:30 +02001549 curses_found=yes
Juan Quintela4f78ef92009-08-12 18:20:23 +02001550 libs_softmmu="$curses_lib $libs_softmmu"
1551 break
1552 fi
1553 done
Juan Quintelac584a6d2009-08-12 18:20:30 +02001554 if test "$curses_found" = "yes" ; then
1555 curses=yes
1556 else
1557 if test "$curses" = "yes" ; then
1558 feature_not_found "curses"
1559 fi
1560 curses=no
1561 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02001562fi
balrog4d3b6f62008-02-10 16:33:14 +00001563
blueswir1414f0da2008-08-15 18:20:52 +00001564##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001565# curl probe
1566
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01001567if $pkgconfig libcurl --modversion >/dev/null 2>&1; then
1568 curlconfig="$pkgconfig libcurl"
1569else
1570 curlconfig=curl-config
1571fi
1572
Juan Quintela788c8192009-08-12 18:29:47 +02001573if test "$curl" != "no" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001574 cat > $TMPC << EOF
1575#include <curl/curl.h>
1576int main(void) { return curl_easy_init(); }
1577EOF
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01001578 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1579 curl_libs=`$curlconfig --libs 2>/dev/null`
Juan Quintelab1d5a272009-08-03 14:46:05 +02001580 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001581 curl=yes
Juan Quintelaf0302932009-08-03 14:47:08 +02001582 libs_tools="$curl_libs $libs_tools"
1583 libs_softmmu="$curl_libs $libs_softmmu"
Juan Quintela788c8192009-08-12 18:29:47 +02001584 else
1585 if test "$curl" = "yes" ; then
1586 feature_not_found "curl"
1587 fi
1588 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02001589 fi
1590fi # test "$curl"
1591
1592##########################################
Luiz Capitulino5495ed12009-08-28 15:27:28 -03001593# check framework probe
1594
1595if test "$check_utests" != "no" ; then
1596 cat > $TMPC << EOF
1597#include <check.h>
1598int main(void) { suite_create("qemu test"); return 0; }
1599EOF
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001600 check_libs=`$pkgconfig --libs check`
Luiz Capitulino5495ed12009-08-28 15:27:28 -03001601 if compile_prog "" $check_libs ; then
1602 check_utests=yes
1603 libs_tools="$check_libs $libs_tools"
1604 else
1605 if test "$check_utests" = "yes" ; then
1606 feature_not_found "check"
1607 fi
1608 check_utests=no
1609 fi
1610fi # test "$check_utests"
1611
1612##########################################
balrogfb599c92008-09-28 23:49:55 +00001613# bluez support probe
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001614if test "$bluez" != "no" ; then
balroge820e3f2008-09-30 02:27:44 +00001615 cat > $TMPC << EOF
1616#include <bluetooth/bluetooth.h>
1617int main(void) { return bt_error(0); }
1618EOF
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001619 bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null`
1620 bluez_libs=`$pkgconfig --libs bluez 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +02001621 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001622 bluez=yes
Juan Quintelae482d562009-08-03 14:46:37 +02001623 libs_softmmu="$bluez_libs $libs_softmmu"
balroge820e3f2008-09-30 02:27:44 +00001624 else
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001625 if test "$bluez" = "yes" ; then
1626 feature_not_found "bluez"
1627 fi
balroge820e3f2008-09-30 02:27:44 +00001628 bluez="no"
1629 fi
balrogfb599c92008-09-28 23:49:55 +00001630fi
1631
1632##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001633# kvm probe
Juan Quintelab31a0272009-08-12 18:29:56 +02001634if test "$kvm" != "no" ; then
aliguori7ba1e612008-11-05 16:04:33 +00001635 cat > $TMPC <<EOF
1636#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001637#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001638#error Invalid KVM version
1639#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001640#if !defined(KVM_CAP_USER_MEMORY)
1641#error Missing KVM capability KVM_CAP_USER_MEMORY
1642#endif
1643#if !defined(KVM_CAP_SET_TSS_ADDR)
1644#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1645#endif
1646#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1647#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1648#endif
aliguori7ba1e612008-11-05 16:04:33 +00001649int main(void) { return 0; }
1650EOF
aliguorieac30262008-11-05 16:28:56 +00001651 if test "$kerneldir" != "" ; then
1652 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001653 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1654 -a -d "$kerneldir/arch/x86/include" ; then
1655 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001656 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1657 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
Alexander Graf0e60a692009-12-05 12:44:24 +01001658 elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
1659 kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
aliguori8444eb62009-01-09 20:05:10 +00001660 elif test -d "$kerneldir/arch/$cpu/include" ; then
1661 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1662 fi
aliguorieac30262008-11-05 16:28:56 +00001663 else
Stefan Weilf038e8f2010-04-11 19:01:01 +02001664 kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null`
aliguorieac30262008-11-05 16:28:56 +00001665 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001666 if compile_prog "$kvm_cflags" "" ; then
Juan Quintelab31a0272009-08-12 18:29:56 +02001667 kvm=yes
Jan Kiszkadae50792010-01-12 19:53:48 +01001668 cat > $TMPC <<EOF
1669#include <linux/kvm_para.h>
1670int main(void) { return 0; }
1671EOF
1672 if compile_prog "$kvm_cflags" "" ; then
1673 kvm_para=yes
1674 fi
aliguori7ba1e612008-11-05 16:04:33 +00001675 else
Juan Quintelab31a0272009-08-12 18:29:56 +02001676 if test "$kvm" = "yes" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001677 if has awk && has grep; then
Juan Quintelab31a0272009-08-12 18:29:56 +02001678 kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001679 | grep "error: " \
1680 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
Juan Quintelab31a0272009-08-12 18:29:56 +02001681 if test "$kvmerr" != "" ; then
1682 echo -e "${kvmerr}\n\
1683 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1684 recent kvm-kmod from http://sourceforge.net/projects/kvm."
1685 fi
aliguori9fd8d8d2009-01-15 21:57:30 +00001686 fi
Juan Quintelab31a0272009-08-12 18:29:56 +02001687 feature_not_found "kvm"
aliguori9fd8d8d2009-01-15 21:57:30 +00001688 fi
Juan Quintelab31a0272009-08-12 18:29:56 +02001689 kvm=no
aliguori7ba1e612008-11-05 16:04:33 +00001690 fi
1691fi
1692
1693##########################################
Michael S. Tsirkind5970052010-03-17 13:08:17 +02001694# test for vhost net
1695
1696if test "$vhost_net" != "no"; then
1697 if test "$kvm" != "no"; then
1698 cat > $TMPC <<EOF
1699 #include <linux/vhost.h>
1700 int main(void) { return 0; }
1701EOF
1702 if compile_prog "$kvm_cflags" "" ; then
1703 vhost_net=yes
1704 else
1705 if test "$vhost_net" = "yes" ; then
1706 feature_not_found "vhost-net"
1707 fi
1708 vhost_net=no
1709 fi
1710 else
1711 if test "$vhost_net" = "yes" ; then
Aurelien Jarno4021d242010-06-10 00:06:55 +02001712 echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
Michael S. Tsirkind5970052010-03-17 13:08:17 +02001713 feature_not_found "vhost-net"
1714 fi
1715 vhost_net=no
1716 fi
1717fi
1718
1719##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001720# pthread probe
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001721PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00001722
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02001723pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00001724cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001725#include <pthread.h>
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001726int main(void) { pthread_create(0,0,0,0); return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001727EOF
Andreas Färberbd00d532010-09-20 00:50:44 +02001728if compile_prog "" "" ; then
1729 pthread=yes
1730else
1731 for pthread_lib in $PTHREADLIBS_LIST; do
1732 if compile_prog "" "$pthread_lib" ; then
1733 pthread=yes
1734 LIBS="$pthread_lib $LIBS"
1735 break
1736 fi
1737 done
1738fi
blueswir1414f0da2008-08-15 18:20:52 +00001739
Anthony Liguori4617e592009-08-25 17:21:56 -05001740if test "$mingw32" != yes -a "$pthread" = no; then
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02001741 echo
1742 echo "Error: pthread check failed"
1743 echo "Make sure to have the pthread libs and headers installed."
1744 echo
1745 exit 1
aliguorie5d355d2009-04-24 18:03:15 +00001746fi
1747
aliguoribf9298b2008-12-05 20:05:26 +00001748##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001749# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001750
1751if test "$linux_aio" != "no" ; then
1752 cat > $TMPC <<EOF
1753#include <libaio.h>
1754#include <sys/eventfd.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05001755#include <stddef.h>
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001756int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1757EOF
1758 if compile_prog "" "-laio" ; then
1759 linux_aio=yes
Paul Brook048d1792010-05-05 16:32:59 +01001760 libs_softmmu="$libs_softmmu -laio"
1761 libs_tools="$libs_tools -laio"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001762 else
1763 if test "$linux_aio" = "yes" ; then
1764 feature_not_found "linux AIO"
1765 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03001766 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001767 fi
1768fi
1769
1770##########################################
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07001771# attr probe
1772
1773if test "$attr" != "no" ; then
1774 cat > $TMPC <<EOF
1775#include <stdio.h>
1776#include <sys/types.h>
1777#include <attr/xattr.h>
1778int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1779EOF
1780 if compile_prog "" "-lattr" ; then
1781 attr=yes
1782 LIBS="-lattr $LIBS"
1783 else
1784 if test "$attr" = "yes" ; then
1785 feature_not_found "ATTR"
1786 fi
1787 attr=no
1788 fi
1789fi
1790
1791##########################################
aliguoribf9298b2008-12-05 20:05:26 +00001792# iovec probe
1793cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001794#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001795#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001796#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001797int main(void) { struct iovec iov; return 0; }
1798EOF
1799iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02001800if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00001801 iovec=yes
1802fi
1803
aurel32f652e6a2008-12-16 10:43:48 +00001804##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001805# preadv probe
1806cat > $TMPC <<EOF
1807#include <sys/types.h>
1808#include <sys/uio.h>
1809#include <unistd.h>
1810int main(void) { preadv; }
1811EOF
1812preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02001813if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00001814 preadv=yes
1815fi
1816
1817##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001818# fdt probe
Juan Quintela2df87df2009-08-12 18:29:54 +02001819if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02001820 fdt_libs="-lfdt"
1821 cat > $TMPC << EOF
aurel32f652e6a2008-12-16 10:43:48 +00001822int main(void) { return 0; }
1823EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001824 if compile_prog "" "$fdt_libs" ; then
aurel32f652e6a2008-12-16 10:43:48 +00001825 fdt=yes
Juan Quintelae4782982009-08-03 14:46:38 +02001826 libs_softmmu="$fdt_libs $libs_softmmu"
Juan Quintela2df87df2009-08-12 18:29:54 +02001827 else
1828 if test "$fdt" = "yes" ; then
1829 feature_not_found "fdt"
1830 fi
1831 fdt=no
aurel32f652e6a2008-12-16 10:43:48 +00001832 fi
1833fi
1834
aurel323b3f24a2009-04-15 16:12:13 +00001835#
1836# Check for xxxat() functions when we are building linux-user
1837# emulator. This is done because older glibc versions don't
1838# have syscall stubs for these implemented.
1839#
1840atfile=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03001841cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00001842#define _ATFILE_SOURCE
1843#include <sys/types.h>
1844#include <fcntl.h>
1845#include <unistd.h>
1846
1847int
1848main(void)
1849{
1850 /* try to unlink nonexisting file */
1851 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1852}
1853EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001854if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03001855 atfile=yes
aurel323b3f24a2009-04-15 16:12:13 +00001856fi
1857
aurel3239386ac2009-04-15 19:48:17 +00001858# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001859# emulator. This is done because older glibc versions don't
1860# have syscall stubs for these implemented. In that case we
1861# don't provide them even if kernel supports them.
1862#
1863inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03001864cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00001865#include <sys/inotify.h>
1866
1867int
1868main(void)
1869{
1870 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001871 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001872}
1873EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001874if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03001875 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00001876fi
1877
Riku Voipioc05c7a72010-03-26 15:25:11 +00001878inotify1=no
1879cat > $TMPC << EOF
1880#include <sys/inotify.h>
1881
1882int
1883main(void)
1884{
1885 /* try to start inotify */
1886 return inotify_init1(0);
1887}
1888EOF
1889if compile_prog "" "" ; then
1890 inotify1=yes
1891fi
1892
Riku Voipioebc996f2009-04-21 15:01:51 +03001893# check if utimensat and futimens are supported
1894utimens=no
1895cat > $TMPC << EOF
1896#define _ATFILE_SOURCE
Riku Voipioebc996f2009-04-21 15:01:51 +03001897#include <stddef.h>
1898#include <fcntl.h>
1899
1900int main(void)
1901{
1902 utimensat(AT_FDCWD, "foo", NULL, 0);
1903 futimens(0, NULL);
1904 return 0;
1905}
1906EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001907if compile_prog "" "" ; then
Riku Voipioebc996f2009-04-21 15:01:51 +03001908 utimens=yes
1909fi
1910
Riku Voipio099d6b02009-05-05 12:10:04 +03001911# check if pipe2 is there
1912pipe2=no
1913cat > $TMPC << EOF
Riku Voipio099d6b02009-05-05 12:10:04 +03001914#include <unistd.h>
1915#include <fcntl.h>
1916
1917int main(void)
1918{
1919 int pipefd[2];
1920 pipe2(pipefd, O_CLOEXEC);
1921 return 0;
1922}
1923EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001924if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03001925 pipe2=yes
1926fi
1927
Kevin Wolf40ff6d72009-12-02 12:24:42 +01001928# check if accept4 is there
1929accept4=no
1930cat > $TMPC << EOF
Kevin Wolf40ff6d72009-12-02 12:24:42 +01001931#include <sys/socket.h>
1932#include <stddef.h>
1933
1934int main(void)
1935{
1936 accept4(0, NULL, NULL, SOCK_CLOEXEC);
1937 return 0;
1938}
1939EOF
1940if compile_prog "" "" ; then
1941 accept4=yes
1942fi
1943
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301944# check if tee/splice is there. vmsplice was added same time.
1945splice=no
1946cat > $TMPC << EOF
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301947#include <unistd.h>
1948#include <fcntl.h>
1949#include <limits.h>
1950
1951int main(void)
1952{
1953 int len, fd;
1954 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1955 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1956 return 0;
1957}
1958EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001959if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301960 splice=yes
1961fi
1962
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03001963##########################################
1964# signalfd probe
1965signalfd="no"
1966cat > $TMPC << EOF
1967#define _GNU_SOURCE
1968#include <unistd.h>
1969#include <sys/syscall.h>
1970#include <signal.h>
1971int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1972EOF
1973
1974if compile_prog "" "" ; then
1975 signalfd=yes
1976fi
1977
Riku Voipioc2882b92009-08-12 15:08:24 +03001978# check if eventfd is supported
1979eventfd=no
1980cat > $TMPC << EOF
1981#include <sys/eventfd.h>
1982
1983int main(void)
1984{
1985 int efd = eventfd(0, 0);
1986 return 0;
1987}
1988EOF
1989if compile_prog "" "" ; then
1990 eventfd=yes
1991fi
1992
Ulrich Hechtd0927932009-09-17 20:22:14 +03001993# check for fallocate
1994fallocate=no
1995cat > $TMPC << EOF
1996#include <fcntl.h>
1997
1998int main(void)
1999{
2000 fallocate(0, 0, 0, 0);
2001 return 0;
2002}
2003EOF
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +02002004if compile_prog "$ARCH_CFLAGS" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03002005 fallocate=yes
2006fi
2007
2008# check for dup3
2009dup3=no
2010cat > $TMPC << EOF
2011#include <unistd.h>
2012
2013int main(void)
2014{
2015 dup3(0, 0, 0);
2016 return 0;
2017}
2018EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01002019if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03002020 dup3=yes
2021fi
2022
pbrookcc8ae6d2006-04-23 17:57:59 +00002023# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02002024if test "$docs" != "no" ; then
Stefan Weil01668d92010-03-04 22:21:02 +01002025 if has makeinfo && has pod2man; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02002026 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02002027 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02002028 if test "$docs" = "yes" ; then
2029 feature_not_found "docs"
Juan Quintela83a3ab82009-08-12 18:29:51 +02002030 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02002031 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02002032 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00002033fi
2034
Stefan Weilf514f412009-10-11 12:44:07 +02002035# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002036byteswap_h=no
2037cat > $TMPC << EOF
2038#include <byteswap.h>
2039int main(void) { return bswap_32(0); }
2040EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002041if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002042 byteswap_h=yes
2043fi
2044
Stefan Weilf514f412009-10-11 12:44:07 +02002045# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002046bswap_h=no
2047cat > $TMPC << EOF
2048#include <sys/endian.h>
2049#include <sys/types.h>
2050#include <machine/bswap.h>
2051int main(void) { return bswap32(0); }
2052EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002053if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002054 bswap_h=yes
2055fi
2056
aliguorida93a1f2008-12-12 20:02:52 +00002057##########################################
2058# Do we need librt
2059cat > $TMPC <<EOF
2060#include <signal.h>
2061#include <time.h>
2062int main(void) { clockid_t id; return clock_gettime(id, NULL); }
2063EOF
2064
Juan Quintela52166aa2009-08-03 14:46:03 +02002065if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02002066 :
Juan Quintela52166aa2009-08-03 14:46:03 +02002067elif compile_prog "" "-lrt" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02002068 LIBS="-lrt $LIBS"
aliguorida93a1f2008-12-12 20:02:52 +00002069fi
2070
Blue Swirl31ff5042009-09-12 12:33:07 +00002071if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
Andreas Färber179cf402010-09-20 00:50:43 +02002072 "$aix" != "yes" -a "$haiku" != "yes" ; then
Juan Quintela6362a532009-08-03 14:46:32 +02002073 libs_softmmu="-lutil $libs_softmmu"
2074fi
2075
Blue Swirlde5071c2009-09-12 09:58:46 +00002076##########################################
2077# check if the compiler defines offsetof
2078
2079need_offsetof=yes
2080cat > $TMPC << EOF
2081#include <stddef.h>
2082int main(void) { struct s { int f; }; return offsetof(struct s, f); }
2083EOF
2084if compile_prog "" "" ; then
2085 need_offsetof=no
2086fi
2087
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002088##########################################
Blue Swirl747bbdf2009-10-18 16:26:06 +00002089# check if the compiler understands attribute warn_unused_result
2090#
2091# This could be smarter, but gcc -Werror does not error out even when warning
2092# about attribute warn_unused_result
2093
2094gcc_attribute_warn_unused_result=no
2095cat > $TMPC << EOF
2096#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
2097#error gcc 3.3 or older
2098#endif
2099int main(void) { return 0;}
2100EOF
2101if compile_prog "" ""; then
2102 gcc_attribute_warn_unused_result=yes
2103fi
2104
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002105# spice probe
2106if test "$spice" != "no" ; then
2107 cat > $TMPC << EOF
2108#include <spice.h>
2109int main(void) { spice_server_new(); return 0; }
2110EOF
2111 spice_cflags=$($pkgconfig --cflags spice-protocol spice-server 2>/dev/null)
2112 spice_libs=$($pkgconfig --libs spice-protocol spice-server 2>/dev/null)
Stefan Weilba807822010-10-07 21:15:58 +02002113 if $pkgconfig --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002114 compile_prog "$spice_cflags" "$spice_libs" ; then
2115 spice="yes"
2116 libs_softmmu="$libs_softmmu $spice_libs"
2117 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2118 else
2119 if test "$spice" = "yes" ; then
2120 feature_not_found "spice"
2121 fi
2122 spice="no"
2123 fi
2124fi
2125
2126##########################################
2127
Blue Swirl747bbdf2009-10-18 16:26:06 +00002128##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002129# check if we have fdatasync
2130
2131fdatasync=no
2132cat > $TMPC << EOF
2133#include <unistd.h>
2134int main(void) { return fdatasync(0); }
2135EOF
2136if compile_prog "" "" ; then
2137 fdatasync=yes
2138fi
2139
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002140##########################################
Andreas Färbere78815a2010-09-25 11:26:05 +00002141# check if we have madvise
2142
2143madvise=no
2144cat > $TMPC << EOF
2145#include <sys/types.h>
2146#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002147#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00002148int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2149EOF
2150if compile_prog "" "" ; then
2151 madvise=yes
2152fi
2153
2154##########################################
2155# check if we have posix_madvise
2156
2157posix_madvise=no
2158cat > $TMPC << EOF
2159#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002160#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00002161int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2162EOF
2163if compile_prog "" "" ; then
2164 posix_madvise=yes
2165fi
2166
2167##########################################
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002168# check if trace backend exists
2169
2170sh "$source_path/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
2171if test "$?" -ne 0 ; then
2172 echo
2173 echo "Error: invalid trace backend"
2174 echo "Please choose a supported trace backend."
2175 echo
2176 exit 1
2177fi
2178
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01002179##########################################
2180# For 'ust' backend, test if ust headers are present
2181if test "$trace_backend" = "ust"; then
2182 cat > $TMPC << EOF
2183#include <ust/tracepoint.h>
2184#include <ust/marker.h>
2185int main(void) { return 0; }
2186EOF
2187 if compile_prog "" "" ; then
2188 LIBS="-lust $LIBS"
2189 else
2190 echo
2191 echo "Error: Trace backend 'ust' missing libust header files"
2192 echo
2193 exit 1
2194 fi
2195fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00002196
2197##########################################
2198# For 'dtrace' backend, test if 'dtrace' command is present
2199if test "$trace_backend" = "dtrace"; then
2200 if ! has 'dtrace' ; then
2201 echo
2202 echo "Error: dtrace command is not found in PATH $PATH"
2203 echo
2204 exit 1
2205 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00002206 trace_backend_stap="no"
2207 if has 'stap' ; then
2208 trace_backend_stap="yes"
2209 fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00002210fi
2211
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01002212##########################################
Juan Quintelae86ecd42009-08-03 14:45:59 +02002213# End of CC checks
2214# After here, no more $cc or $ld runs
2215
Juan Quintelae86ecd42009-08-03 14:45:59 +02002216if test "$debug" = "no" ; then
Juan Quintela1156c662009-08-03 14:46:00 +02002217 CFLAGS="-O2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002218fi
Juan Quintelaa316e372009-09-30 01:10:55 +02002219
Juan Quintelae86ecd42009-08-03 14:45:59 +02002220# Consult white-list to determine whether to enable werror
2221# by default. Only enable by default for git builds
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002222z_version=`cut -f3 -d. $source_path/VERSION`
2223
Juan Quintelae86ecd42009-08-03 14:45:59 +02002224if test -z "$werror" ; then
Juan Quintelae86ecd42009-08-03 14:45:59 +02002225 if test "$z_version" = "50" -a \
2226 "$linux" = "yes" ; then
2227 werror="yes"
2228 else
2229 werror="no"
2230 fi
2231fi
2232
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002233# Disable zero malloc errors for official releases unless explicitly told to
2234# enable/disable
2235if test -z "$zero_malloc" ; then
2236 if test "$z_version" = "50" ; then
2237 zero_malloc="no"
2238 else
2239 zero_malloc="yes"
2240 fi
2241fi
2242
Juan Quintelae86ecd42009-08-03 14:45:59 +02002243if test "$werror" = "yes" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +02002244 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002245fi
2246
2247if test "$solaris" = "no" ; then
2248 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02002249 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002250 fi
2251fi
2252
Blue Swirl952afb72010-09-19 08:36:34 +00002253# Use ASLR, no-SEH and DEP if available
2254if test "$mingw32" = "yes" ; then
2255 for flag in --dynamicbase --no-seh --nxcompat; do
2256 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2257 LDFLAGS="-Wl,$flag $LDFLAGS"
2258 fi
2259 done
2260fi
2261
Paolo Bonzini190e9c52010-05-26 16:08:21 +02002262confdir=$sysconfdir$confsuffix
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02002263
Paolo Bonzinica35f782010-05-26 16:08:29 +02002264tools=
2265if test "$softmmu" = yes ; then
2266 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2267 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2268 tools="qemu-nbd\$(EXESUF) $tools"
2269 if [ "$check_utests" = "yes" ]; then
2270 tools="check-qint check-qstring check-qdict check-qlist $tools"
2271 tools="check-qfloat check-qjson $tools"
2272 fi
2273 fi
2274fi
2275
2276# Mac OS X ships with a broken assembler
2277roms=
2278if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2279 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2280 "$softmmu" = yes ; then
2281 roms="optionrom"
2282fi
2283
2284
bellard43ce4df2003-06-09 19:53:12 +00002285echo "Install prefix $prefix"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002286echo "BIOS directory `eval echo $datadir`"
2287echo "binary directory `eval echo $bindir`"
Aurelien Jarno1c0fd162010-06-10 00:14:02 +02002288echo "config directory `eval echo $sysconfdir`"
bellard11d9f692004-04-02 20:55:59 +00002289if test "$mingw32" = "no" ; then
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002290echo "Manual directory `eval echo $mandir`"
bellard43ce4df2003-06-09 19:53:12 +00002291echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00002292fi
bellard5a671352003-10-01 00:13:48 +00002293echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00002294echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00002295echo "Host C compiler $host_cc"
Juan Quintela0c439cb2009-08-03 14:46:01 +02002296echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02002297echo "QEMU_CFLAGS $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02002298echo "LDFLAGS $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00002299echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00002300echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00002301echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00002302echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00002303echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00002304echo "tcg debug enabled $debug_tcg"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -02002305echo "Mon debug enabled $debug_mon"
bellard43ce4df2003-06-09 19:53:12 +00002306echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00002307echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00002308echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00002309echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00002310echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00002311echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00002312if test "$darwin" = "yes" ; then
2313 echo "Cocoa support $cocoa"
2314fi
bellard97a847b2003-08-10 21:36:04 +00002315echo "SDL support $sdl"
balrog4d3b6f62008-02-10 16:33:14 +00002316echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02002317echo "curl support $curl"
Luiz Capitulino5495ed12009-08-28 15:27:28 -03002318echo "check support $check_utests"
bellard67b915a2004-03-31 23:37:16 +00002319echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00002320echo "Audio drivers $audio_drv_list"
2321echo "Extra audio cards $audio_card_list"
Markus Armbrustereb852012009-10-27 18:41:44 +01002322echo "Block whitelist $block_drv_whitelist"
malc8ff9cbf2008-06-23 18:33:30 +00002323echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00002324echo "VNC TLS support $vnc_tls"
aliguori2f9606b2009-03-06 20:27:28 +00002325echo "VNC SASL support $vnc_sasl"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002326echo "VNC JPEG support $vnc_jpeg"
Corentin Charyefe556a2010-07-07 20:57:56 +02002327echo "VNC PNG support $vnc_png"
Corentin Charybd023f92010-07-07 20:58:02 +02002328echo "VNC thread $vnc_thread"
blueswir131422552007-04-16 18:27:06 +00002329if test -n "$sparc_cpu"; then
2330 echo "Target Sparc Arch $sparc_cpu"
2331fi
aliguorie37630c2009-04-22 15:19:10 +00002332echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00002333echo "brlapi support $brlapi"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002334echo "bluez support $bluez"
Juan Quintelaa25dba12009-08-12 18:29:52 +02002335echo "Documentation $docs"
pbrookc5937222006-05-14 11:30:38 +00002336[ ! -z "$uname_release" ] && \
2337echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00002338echo "NPTL support $nptl"
Paul Brook379f6692009-07-17 12:48:08 +01002339echo "GUEST_BASE $guest_base"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03002340echo "PIE user targets $user_pie"
ths8a16d272008-07-19 09:56:24 +00002341echo "vde support $vde"
aliguorie5d355d2009-04-24 18:03:15 +00002342echo "IO thread $io_thread"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002343echo "Linux AIO support $linux_aio"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002344echo "ATTR/XATTR support $attr"
ths77755342008-11-27 15:45:16 +00002345echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02002346echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00002347echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00002348echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002349echo "fdatasync $fdatasync"
Andreas Färbere78815a2010-09-25 11:26:05 +00002350echo "madvise $madvise"
2351echo "posix_madvise $posix_madvise"
Stefan Weilee682d22009-10-01 20:10:37 +02002352echo "uuid support $uuid"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02002353echo "vhost-net support $vhost_net"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002354echo "Trace backend $trace_backend"
Prerna Saxena9410b562010-07-13 09:26:32 +01002355echo "Trace output file $trace_file-<pid>"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002356echo "spice support $spice"
bellard67b915a2004-03-31 23:37:16 +00002357
bellard97a847b2003-08-10 21:36:04 +00002358if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00002359echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00002360fi
bellard97a847b2003-08-10 21:36:04 +00002361
Juan Quintela98ec69a2009-07-16 18:34:18 +02002362config_host_mak="config-host.mak"
Juan Quintela4bf6b552009-07-22 22:37:40 +02002363config_host_ld="config-host.ld"
bellard97a847b2003-08-10 21:36:04 +00002364
Juan Quintela98ec69a2009-07-16 18:34:18 +02002365echo "# Automatically generated by configure - do not modify" > $config_host_mak
2366printf "# Configured with:" >> $config_host_mak
2367printf " '%s'" "$0" "$@" >> $config_host_mak
2368echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002369
Paolo Bonzinie6c3b0f2010-10-21 10:18:35 +02002370echo all: >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02002371echo "prefix=$prefix" >> $config_host_mak
2372echo "bindir=$bindir" >> $config_host_mak
2373echo "mandir=$mandir" >> $config_host_mak
2374echo "datadir=$datadir" >> $config_host_mak
2375echo "sysconfdir=$sysconfdir" >> $config_host_mak
2376echo "docdir=$docdir" >> $config_host_mak
Paolo Bonzini1dabe052010-05-26 16:08:25 +02002377echo "confdir=$confdir" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002378
aurel322408a522008-04-20 20:19:44 +00002379case "$cpu" in
Alexander Graf24e804ec2009-12-05 12:44:22 +01002380 i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
Juan Quintelae0da9dd2009-07-16 18:34:09 +02002381 ARCH=$cpu
aurel322408a522008-04-20 20:19:44 +00002382 ;;
Laurent Desnoguesa302c322009-07-18 14:23:39 +02002383 armv4b|armv4l)
Juan Quintela16dbd142009-07-16 18:34:08 +02002384 ARCH=arm
aurel322408a522008-04-20 20:19:44 +00002385 ;;
aurel322408a522008-04-20 20:19:44 +00002386esac
Juan Quintela98ec69a2009-07-16 18:34:18 +02002387echo "ARCH=$ARCH" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00002388if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002389 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00002390fi
Luiz Capitulinob4475aa2010-02-10 23:50:03 -02002391if test "$debug_mon" = "yes" ; then
2392 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2393fi
Paul Brookf3d08ee2009-06-04 11:39:04 +01002394if test "$debug" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002395 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
Paul Brookf3d08ee2009-06-04 11:39:04 +01002396fi
aliguori1625af82009-04-05 17:41:02 +00002397if test "$strip_opt" = "yes" ; then
Hollis Blanchard52ba7842010-08-04 17:21:34 -07002398 echo "STRIP=${strip}" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00002399fi
bellard7d132992003-03-06 23:23:54 +00002400if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02002401 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00002402fi
Juan Quintela2358a492009-07-27 16:13:25 +02002403echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00002404if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002405 echo "CONFIG_WIN32=y" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00002406 rc_version=`cat $source_path/VERSION`
2407 version_major=${rc_version%%.*}
2408 rc_version=${rc_version#*.}
2409 version_minor=${rc_version%%.*}
2410 rc_version=${rc_version#*.}
2411 version_subminor=${rc_version%%.*}
2412 version_micro=0
2413 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2414 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
pbrook210fa552007-02-27 21:04:49 +00002415else
Juan Quintela35f4df22009-07-27 16:13:07 +02002416 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00002417fi
blueswir1128ab2f2008-08-15 18:33:42 +00002418
Mark McLoughlindffcb712009-10-22 17:49:11 +01002419if test "$linux" = "yes" ; then
2420 echo "CONFIG_LINUX=y" >> $config_host_mak
2421fi
2422
bellard83fb7ad2004-07-05 21:25:26 +00002423if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002424 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00002425fi
malcb29fe3e2008-11-18 01:42:22 +00002426
2427if test "$aix" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002428 echo "CONFIG_AIX=y" >> $config_host_mak
malcb29fe3e2008-11-18 01:42:22 +00002429fi
2430
bellardec530c82006-04-25 22:36:06 +00002431if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002432 echo "CONFIG_SOLARIS=y" >> $config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02002433 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00002434 if test "$needs_libsunmath" = "yes" ; then
Juan Quintela75b5a692009-07-27 16:13:23 +02002435 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00002436 fi
bellardec530c82006-04-25 22:36:06 +00002437fi
Andreas Färber179cf402010-09-20 00:50:43 +02002438if test "$haiku" = "yes" ; then
2439 echo "CONFIG_HAIKU=y" >> $config_host_mak
2440fi
bellard97a847b2003-08-10 21:36:04 +00002441if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002442 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00002443fi
bellard05c2a3e2006-02-08 22:39:17 +00002444if test $profiler = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002445 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00002446fi
bellardc20709a2004-04-21 23:27:19 +00002447if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002448 echo "CONFIG_SLIRP=y" >> $config_host_mak
Juan Quintelab6e31c12009-09-30 01:10:54 +02002449 QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
bellardc20709a2004-04-21 23:27:19 +00002450fi
ths8a16d272008-07-19 09:56:24 +00002451if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002452 echo "CONFIG_VDE=y" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00002453fi
malc0c58ac12008-06-25 21:04:05 +00002454for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00002455 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002456 echo "$def=y" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002457done
Juan Quintela2358a492009-07-27 16:13:25 +02002458echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002459for drv in $audio_drv_list; do
pbrookf6e58892008-06-29 01:00:34 +00002460 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002461 echo "$def=y" >> $config_host_mak
malc923e4522008-07-02 18:13:46 +00002462 if test "$drv" = "fmod"; then
Juan Quintela7aac6cb2009-07-27 16:12:47 +02002463 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002464 fi
2465done
Juan Quintela67f86e82009-08-03 14:46:59 +02002466if test "$audio_pt_int" = "yes" ; then
2467 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2468fi
malcd5631632009-10-10 01:13:41 +04002469if test "$audio_win_int" = "yes" ; then
2470 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2471fi
Markus Armbrustereb852012009-10-27 18:41:44 +01002472echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00002473if test "$mixemu" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002474 echo "CONFIG_MIXEMU=y" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00002475fi
ths8d5d2d42007-08-25 01:37:51 +00002476if test "$vnc_tls" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002477 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
Juan Quintela525061b2009-07-27 16:12:43 +02002478 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
ths8d5d2d42007-08-25 01:37:51 +00002479fi
aliguori2f9606b2009-03-06 20:27:28 +00002480if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002481 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
Juan Quintela60ddf532009-07-27 16:12:45 +02002482 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00002483fi
Corentin Chary96763cf2010-07-07 20:58:06 +02002484if test "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002485 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
2486 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
2487fi
Corentin Chary96763cf2010-07-07 20:58:06 +02002488if test "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02002489 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2490 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2491fi
Corentin Chary96763cf2010-07-07 20:58:06 +02002492if test "$vnc_thread" != "no" ; then
Corentin Charybd023f92010-07-07 20:58:02 +02002493 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2494 echo "CONFIG_THREAD=y" >> $config_host_mak
2495fi
aliguori76655d62009-03-06 20:27:37 +00002496if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002497 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00002498fi
Stefan Weilee682d22009-10-01 20:10:37 +02002499if test "$uuid" = "yes" ; then
2500 echo "CONFIG_UUID=y" >> $config_host_mak
2501fi
pbrookb1a550a2006-04-16 13:28:56 +00002502qemu_version=`head $source_path/VERSION`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002503echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02002504echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002505echo "SRC_PATH=$source_path" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002506echo "TARGET_DIRS=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02002507if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002508 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00002509fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02002510if test "$sdl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002511 echo "CONFIG_SDL=y" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02002512 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00002513fi
2514if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002515 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00002516fi
2517if test "$curses" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002518 echo "CONFIG_CURSES=y" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00002519fi
aurel323b3f24a2009-04-15 16:12:13 +00002520if test "$atfile" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002521 echo "CONFIG_ATFILE=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00002522fi
Riku Voipioebc996f2009-04-21 15:01:51 +03002523if test "$utimens" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002524 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
Riku Voipioebc996f2009-04-21 15:01:51 +03002525fi
Riku Voipio099d6b02009-05-05 12:10:04 +03002526if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002527 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03002528fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01002529if test "$accept4" = "yes" ; then
2530 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2531fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302532if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002533 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302534fi
Riku Voipioc2882b92009-08-12 15:08:24 +03002535if test "$eventfd" = "yes" ; then
2536 echo "CONFIG_EVENTFD=y" >> $config_host_mak
2537fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03002538if test "$fallocate" = "yes" ; then
2539 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2540fi
2541if test "$dup3" = "yes" ; then
2542 echo "CONFIG_DUP3=y" >> $config_host_mak
2543fi
aurel323b3f24a2009-04-15 16:12:13 +00002544if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002545 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00002546fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00002547if test "$inotify1" = "yes" ; then
2548 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2549fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002550if test "$byteswap_h" = "yes" ; then
2551 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
2552fi
2553if test "$bswap_h" = "yes" ; then
2554 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
2555fi
Alexander Graf769ce762009-05-11 17:41:42 +02002556if test "$curl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002557 echo "CONFIG_CURL=y" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02002558 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02002559fi
aurel322e4d9fb2008-04-08 06:01:02 +00002560if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002561 echo "CONFIG_BRLAPI=y" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00002562fi
balrogfb599c92008-09-28 23:49:55 +00002563if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002564 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02002565 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00002566fi
aliguorie37630c2009-04-22 15:19:10 +00002567if test "$xen" = "yes" ; then
Juan Quintela5647eb72009-07-27 16:13:21 +02002568 echo "CONFIG_XEN=y" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00002569fi
aliguorie5d355d2009-04-24 18:03:15 +00002570if test "$io_thread" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002571 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
Corentin Charybd023f92010-07-07 20:58:02 +02002572 echo "CONFIG_THREAD=y" >> $config_host_mak
aliguorie5d355d2009-04-24 18:03:15 +00002573fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002574if test "$linux_aio" = "yes" ; then
2575 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
2576fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002577if test "$attr" = "yes" ; then
2578 echo "CONFIG_ATTR=y" >> $config_host_mak
2579fi
2580if test "$linux" = "yes" ; then
2581 if test "$attr" = "yes" ; then
2582 echo "CONFIG_VIRTFS=y" >> $config_host_mak
2583 fi
2584fi
ths77755342008-11-27 15:45:16 +00002585if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002586 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00002587fi
aliguoribf9298b2008-12-05 20:05:26 +00002588if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002589 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00002590fi
aliguoriceb42de2009-04-07 18:43:28 +00002591if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002592 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00002593fi
aurel32f652e6a2008-12-16 10:43:48 +00002594if test "$fdt" = "yes" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02002595 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00002596fi
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03002597if test "$signalfd" = "yes" ; then
2598 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
2599fi
Blue Swirlde5071c2009-09-12 09:58:46 +00002600if test "$need_offsetof" = "yes" ; then
2601 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2602fi
Blue Swirl747bbdf2009-10-18 16:26:06 +00002603if test "$gcc_attribute_warn_unused_result" = "yes" ; then
2604 echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2605fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002606if test "$fdatasync" = "yes" ; then
2607 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
2608fi
Andreas Färbere78815a2010-09-25 11:26:05 +00002609if test "$madvise" = "yes" ; then
2610 echo "CONFIG_MADVISE=y" >> $config_host_mak
2611fi
2612if test "$posix_madvise" = "yes" ; then
2613 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
2614fi
bellard97a847b2003-08-10 21:36:04 +00002615
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002616if test "$spice" = "yes" ; then
2617 echo "CONFIG_SPICE=y" >> $config_host_mak
2618fi
2619
bellard83fb7ad2004-07-05 21:25:26 +00002620# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00002621if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002622 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00002623fi
2624
Juan Quintela2358a492009-07-27 16:13:25 +02002625echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
pbrookc5937222006-05-14 11:30:38 +00002626
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002627if test "$zero_malloc" = "yes" ; then
2628 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
2629fi
2630
blueswir168063642008-11-22 21:03:55 +00002631# USB host support
2632case "$usb" in
2633linux)
Juan Quintela98ec69a2009-07-16 18:34:18 +02002634 echo "HOST_USB=linux" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00002635;;
2636bsd)
Juan Quintela98ec69a2009-07-16 18:34:18 +02002637 echo "HOST_USB=bsd" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00002638;;
2639*)
Juan Quintela98ec69a2009-07-16 18:34:18 +02002640 echo "HOST_USB=stub" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00002641;;
2642esac
2643
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002644echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
Prerna Saxena22890ab2010-06-24 17:04:53 +05302645if test "$trace_backend" = "simple"; then
2646 echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
2647fi
Prerna Saxena9410b562010-07-13 09:26:32 +01002648# Set the appropriate trace file.
2649if test "$trace_backend" = "simple"; then
2650 trace_file="\"$trace_file-%u\""
2651fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00002652if test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then
2653 echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak
2654fi
Prerna Saxena9410b562010-07-13 09:26:32 +01002655echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
2656
Juan Quintela98ec69a2009-07-16 18:34:18 +02002657echo "TOOLS=$tools" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002658echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002659echo "MAKE=$make" >> $config_host_mak
2660echo "INSTALL=$install" >> $config_host_mak
2661echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2662echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2663echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2664echo "CC=$cc" >> $config_host_mak
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02002665echo "CC_I386=$cc_i386" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002666echo "HOST_CC=$host_cc" >> $config_host_mak
2667if test "$sparse" = "yes" ; then
2668 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
2669 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02002670 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002671fi
2672echo "AR=$ar" >> $config_host_mak
2673echo "OBJCOPY=$objcopy" >> $config_host_mak
2674echo "LD=$ld" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00002675echo "WINDRES=$windres" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02002676echo "CFLAGS=$CFLAGS" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02002677echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Juan Quintelac81da562009-08-03 14:46:24 +02002678echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02002679echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Juan Quintelaa36abbb2009-08-03 14:45:56 +02002680echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2681echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02002682echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02002683echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002684echo "EXESUF=$EXESUF" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002685
Juan Quintela4bf6b552009-07-22 22:37:40 +02002686# generate list of library paths for linker script
2687
2688$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2689
2690if test -f ${config_host_ld}~ ; then
2691 if cmp -s $config_host_ld ${config_host_ld}~ ; then
2692 mv ${config_host_ld}~ $config_host_ld
2693 else
2694 rm ${config_host_ld}~
2695 fi
2696fi
2697
Blue Swirl4d904532010-03-21 08:28:47 +00002698for d in libdis libdis-user; do
2699 mkdir -p $d
2700 rm -f $d/Makefile
2701 ln -s $source_path/Makefile.dis $d/Makefile
2702 echo > $d/config.mak
2703done
Richard Hendersond44cff22010-05-21 10:04:46 -07002704if test "$static" = "no" -a "$user_pie" = "yes" ; then
2705 echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2706fi
Blue Swirl4d904532010-03-21 08:28:47 +00002707
bellard1d14ffa2005-10-30 18:58:22 +00002708for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00002709target_dir="$target"
Juan Quintela25be2102009-10-07 02:41:00 +02002710config_target_mak=$target_dir/config-target.mak
Blue Swirl600309b2009-07-03 17:44:00 +00002711target_arch2=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00002712target_bigendian="no"
Juan Quintela1f3d3c82009-10-07 02:41:02 +02002713
Juan Quintelaea2d6a32009-07-16 18:34:10 +02002714case "$target_arch2" in
Alexander Graf24e804ec2009-12-05 12:44:22 +01002715 armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
Juan Quintelaea2d6a32009-07-16 18:34:10 +02002716 target_bigendian=yes
2717 ;;
2718esac
bellard97a847b2003-08-10 21:36:04 +00002719target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00002720target_user_only="no"
ths831b7822007-01-18 20:06:33 +00002721target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00002722target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00002723target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00002724case "$target" in
Blue Swirl600309b2009-07-03 17:44:00 +00002725 ${target_arch2}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00002726 target_softmmu="yes"
2727 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00002728 ${target_arch2}-linux-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00002729 if test "$linux" != "yes" ; then
2730 echo "ERROR: Target '$target' is only available on a Linux host"
2731 exit 1
2732 fi
pbrook9e407a82007-05-26 16:38:53 +00002733 target_user_only="yes"
2734 target_linux_user="yes"
2735 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00002736 ${target_arch2}-darwin-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00002737 if test "$darwin" != "yes" ; then
2738 echo "ERROR: Target '$target' is only available on a Darwin host"
2739 exit 1
2740 fi
pbrook9e407a82007-05-26 16:38:53 +00002741 target_user_only="yes"
2742 target_darwin_user="yes"
2743 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00002744 ${target_arch2}-bsd-user)
Blue Swirl9cf55762009-11-17 21:27:18 +00002745 if test "$bsd" != "yes" ; then
Blue Swirl9c7a4202009-11-17 20:52:56 +00002746 echo "ERROR: Target '$target' is only available on a BSD host"
2747 exit 1
2748 fi
blueswir184778502008-10-26 20:33:16 +00002749 target_user_only="yes"
2750 target_bsd_user="yes"
2751 ;;
pbrook9e407a82007-05-26 16:38:53 +00002752 *)
2753 echo "ERROR: Target '$target' not recognised"
2754 exit 1
2755 ;;
2756esac
ths831b7822007-01-18 20:06:33 +00002757
bellard97a847b2003-08-10 21:36:04 +00002758mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00002759mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00002760mkdir -p $target_dir/tcg
Gerd Hoffmann59f2a782009-08-20 15:22:26 +02002761mkdir -p $target_dir/ide
blueswir184778502008-10-26 20:33:16 +00002762if 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 +00002763 mkdir -p $target_dir/nwfpe
2764fi
2765
bellardec530c82006-04-25 22:36:06 +00002766#
2767# don't use ln -sf as not all "ln -sf" over write the file/link
2768#
2769rm -f $target_dir/Makefile
2770ln -s $source_path/Makefile.target $target_dir/Makefile
2771
bellard97a847b2003-08-10 21:36:04 +00002772
Juan Quintela25be2102009-10-07 02:41:00 +02002773echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00002774
pbrooke5fe0c52006-06-11 13:32:59 +00002775bflt="no"
pbrookbd0c5662008-05-29 14:34:11 +00002776target_nptl="no"
Blue Swirl600309b2009-07-03 17:44:00 +00002777interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
Paolo Bonzini7ee28222010-05-26 16:08:22 +02002778echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00002779gdb_xml_files=""
aliguori7ba1e612008-11-05 16:04:33 +00002780
Juan Quintela938b1ed2009-07-16 18:34:12 +02002781TARGET_ARCH="$target_arch2"
Juan Quintela6acff7d2009-07-16 18:34:15 +02002782TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02002783TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02002784
Blue Swirl600309b2009-07-03 17:44:00 +00002785case "$target_arch2" in
aurel322408a522008-04-20 20:19:44 +00002786 i386)
Paul Brook1ad21342009-05-19 16:17:58 +01002787 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002788 ;;
2789 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02002790 TARGET_BASE_ARCH=i386
Paul Brook1ad21342009-05-19 16:17:58 +01002791 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002792 ;;
2793 alpha)
Paul Brook1ad21342009-05-19 16:17:58 +01002794 target_phys_bits=64
Richard Hendersona4b388f2010-04-12 16:17:22 -07002795 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00002796 ;;
2797 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002798 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00002799 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00002800 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00002801 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002802 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002803 ;;
2804 cris)
edgar_igl253bd7f2009-01-07 20:07:09 +00002805 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002806 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002807 ;;
2808 m68k)
aurel322408a522008-04-20 20:19:44 +00002809 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00002810 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002811 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002812 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02002813 microblaze)
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02002814 bflt="yes"
2815 target_nptl="yes"
2816 target_phys_bits=32
2817 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02002818 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002819 TARGET_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02002820 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
Paul Brookf04dc722009-07-09 17:56:24 +01002821 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002822 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002823 ;;
2824 mipsn32|mipsn32el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002825 TARGET_ARCH=mipsn32
Juan Quintela6acff7d2009-07-16 18:34:15 +02002826 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02002827 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01002828 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002829 ;;
2830 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002831 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02002832 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02002833 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01002834 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002835 ;;
2836 ppc)
aurel32c8b35322009-01-24 15:07:34 +00002837 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002838 target_phys_bits=32
Nathan Froydd6630702009-08-03 08:43:28 -07002839 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00002840 ;;
2841 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02002842 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02002843 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00002844 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002845 target_phys_bits=64
Nathan Froydd6630702009-08-03 08:43:28 -07002846 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00002847 ;;
2848 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02002849 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02002850 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00002851 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002852 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002853 ;;
2854 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002855 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02002856 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02002857 TARGET_ABI_DIR=ppc
Juan Quintela25be2102009-10-07 02:41:00 +02002858 echo "TARGET_ABI32=y" >> $config_target_mak
aurel32c8b35322009-01-24 15:07:34 +00002859 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002860 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002861 ;;
2862 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002863 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00002864 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00002865 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002866 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002867 ;;
2868 sparc)
Paul Brook1ad21342009-05-19 16:17:58 +01002869 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002870 ;;
2871 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02002872 TARGET_BASE_ARCH=sparc
Paul Brook1ad21342009-05-19 16:17:58 +01002873 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002874 ;;
2875 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002876 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02002877 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02002878 TARGET_ABI_DIR=sparc
Juan Quintela25be2102009-10-07 02:41:00 +02002879 echo "TARGET_ABI32=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01002880 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002881 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01002882 s390x)
2883 target_phys_bits=64
2884 ;;
aurel322408a522008-04-20 20:19:44 +00002885 *)
2886 echo "Unsupported target CPU"
2887 exit 1
2888 ;;
2889esac
Juan Quintela25be2102009-10-07 02:41:00 +02002890echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
Juan Quintela053dd922009-08-03 14:47:03 +02002891target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
Juan Quintela25be2102009-10-07 02:41:00 +02002892echo "TARGET_$target_arch_name=y" >> $config_target_mak
2893echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
Juan Quintela42bc6082009-07-16 18:34:20 +02002894# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02002895if [ "$TARGET_BASE_ARCH" = "" ]; then
2896 TARGET_BASE_ARCH=$TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02002897fi
Juan Quintela25be2102009-10-07 02:41:00 +02002898echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02002899if [ "$TARGET_ABI_DIR" = "" ]; then
2900 TARGET_ABI_DIR=$TARGET_ARCH
2901fi
Juan Quintela25be2102009-10-07 02:41:00 +02002902echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02002903case "$target_arch2" in
2904 i386|x86_64)
2905 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002906 echo "CONFIG_XEN=y" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02002907 fi
2908esac
Juan Quintelac59249f2009-07-16 18:34:00 +02002909case "$target_arch2" in
Alexander Graf0e60a692009-12-05 12:44:24 +01002910 i386|x86_64|ppcemb|ppc|ppc64|s390x)
Juan Quintelac59249f2009-07-16 18:34:00 +02002911 # Make sure the target and host cpus are compatible
2912 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2913 \( "$target_arch2" = "$cpu" -o \
2914 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
Alexander Graf5f114bc2009-07-17 13:51:42 +02002915 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
Juan Quintelac59249f2009-07-16 18:34:00 +02002916 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
2917 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002918 echo "CONFIG_KVM=y" >> $config_target_mak
2919 echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
Jan Kiszkadae50792010-01-12 19:53:48 +01002920 if test "$kvm_para" = "yes"; then
2921 echo "CONFIG_KVM_PARA=y" >> $config_target_mak
2922 fi
Michael S. Tsirkind5970052010-03-17 13:08:17 +02002923 if test $vhost_net = "yes" ; then
2924 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
2925 fi
Juan Quintelac59249f2009-07-16 18:34:00 +02002926 fi
2927esac
bellardde83cd02003-06-15 20:25:43 +00002928if test "$target_bigendian" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002929 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00002930fi
2931if test "$target_softmmu" = "yes" ; then
Paul Brookb1aa27c2010-03-01 02:27:26 +00002932 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
Juan Quintela25be2102009-10-07 02:41:00 +02002933 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
2934 echo "LIBS+=$libs_softmmu" >> $config_target_mak
Andreas Färber0e8c9212010-01-06 20:24:05 +01002935 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
Kirill A. Shutemov5791f452009-09-12 02:17:53 +03002936 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00002937fi
bellard997344f2003-10-27 21:10:39 +00002938if test "$target_user_only" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002939 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00002940fi
ths831b7822007-01-18 20:06:33 +00002941if test "$target_linux_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002942 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00002943fi
2944if test "$target_darwin_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002945 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00002946fi
pbrook56aebc82008-10-11 17:55:29 +00002947list=""
2948if test ! -z "$gdb_xml_files" ; then
2949 for x in $gdb_xml_files; do
2950 list="$list $source_path/gdb-xml/$x"
2951 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02002952 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00002953fi
bellardde83cd02003-06-15 20:25:43 +00002954
Juan Quintelaf57975f2009-07-16 18:34:19 +02002955case "$target_arch2" in
Richard Henderson990b3e12009-12-09 15:48:02 -08002956 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 +02002957 echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
Juan Quintelaf57975f2009-07-16 18:34:19 +02002958 ;;
Juan Quintelad6b38932009-08-03 14:46:42 +02002959 *)
Juan Quintela25be2102009-10-07 02:41:00 +02002960 echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
Juan Quintelad6b38932009-08-03 14:46:42 +02002961 ;;
Juan Quintelaf57975f2009-07-16 18:34:19 +02002962esac
2963
pbrooke5fe0c52006-06-11 13:32:59 +00002964if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02002965 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00002966fi
pbrookbd0c5662008-05-29 14:34:11 +00002967if test "$target_user_only" = "yes" \
2968 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02002969 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
pbrookbd0c5662008-05-29 14:34:11 +00002970fi
Paul Brook379f6692009-07-17 12:48:08 +01002971if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02002972 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
Paul Brook379f6692009-07-17 12:48:08 +01002973fi
blueswir184778502008-10-26 20:33:16 +00002974if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02002975 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00002976fi
bellard5b0753e2005-03-01 21:37:28 +00002977
Juan Quintela4afddb52009-08-03 14:46:45 +02002978# generate QEMU_CFLAGS/LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02002979
Juan Quintela4afddb52009-08-03 14:46:45 +02002980cflags=""
Juan Quintelafa282482009-07-22 22:37:39 +02002981ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02002982
Juan Quintela57ddfbf2009-08-03 14:46:51 +02002983if test "$ARCH" = "sparc64" ; then
2984 cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
Alexander Graf24e804ec2009-12-05 12:44:22 +01002985elif test "$ARCH" = "s390x" ; then
2986 cflags="-I\$(SRC_PATH)/tcg/s390 $cflags"
Richard Henderson5d8a4f82010-06-03 17:35:17 -07002987elif test "$ARCH" = "x86_64" ; then
2988 cflags="-I\$(SRC_PATH)/tcg/i386 $cflags"
Juan Quintela57ddfbf2009-08-03 14:46:51 +02002989else
2990 cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
2991fi
2992cflags="-I\$(SRC_PATH)/tcg $cflags"
2993cflags="-I\$(SRC_PATH)/fpu $cflags"
2994
Blue Swirl4d904532010-03-21 08:28:47 +00002995if test "$target_user_only" = "yes" ; then
2996 libdis_config_mak=libdis-user/config.mak
2997else
2998 libdis_config_mak=libdis/config.mak
2999fi
3000
Juan Quintela64656022009-08-03 14:46:53 +02003001for i in $ARCH $TARGET_BASE_ARCH ; do
3002 case "$i" in
3003 alpha)
Juan Quintela25be2102009-10-07 02:41:00 +02003004 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003005 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003006 ;;
3007 arm)
Juan Quintela25be2102009-10-07 02:41:00 +02003008 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003009 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003010 ;;
3011 cris)
Juan Quintela25be2102009-10-07 02:41:00 +02003012 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003013 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003014 ;;
3015 hppa)
Juan Quintela25be2102009-10-07 02:41:00 +02003016 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003017 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003018 ;;
3019 i386|x86_64)
Juan Quintela25be2102009-10-07 02:41:00 +02003020 echo "CONFIG_I386_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003021 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003022 ;;
Aurelien Jarno903ec552010-03-29 02:12:51 +02003023 ia64*)
3024 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3025 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3026 ;;
Juan Quintela64656022009-08-03 14:46:53 +02003027 m68k)
Juan Quintela25be2102009-10-07 02:41:00 +02003028 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003029 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003030 ;;
3031 microblaze)
Juan Quintela25be2102009-10-07 02:41:00 +02003032 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003033 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003034 ;;
3035 mips*)
Juan Quintela25be2102009-10-07 02:41:00 +02003036 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003037 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003038 ;;
3039 ppc*)
Juan Quintela25be2102009-10-07 02:41:00 +02003040 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003041 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003042 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01003043 s390*)
Juan Quintela25be2102009-10-07 02:41:00 +02003044 echo "CONFIG_S390_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003045 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003046 ;;
3047 sh4)
Juan Quintela25be2102009-10-07 02:41:00 +02003048 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003049 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003050 ;;
3051 sparc*)
Juan Quintela25be2102009-10-07 02:41:00 +02003052 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003053 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003054 ;;
3055 esac
3056done
3057
Juan Quintela6ee71262009-08-03 14:46:47 +02003058case "$ARCH" in
3059alpha)
3060 # Ensure there's only a single GP
3061 cflags="-msmall-data $cflags"
3062;;
3063esac
3064
Juan Quintela55d9c042009-08-03 14:47:02 +02003065if test "$target_softmmu" = "yes" ; then
3066 case "$TARGET_BASE_ARCH" in
3067 arm)
3068 cflags="-DHAS_AUDIO $cflags"
3069 ;;
3070 i386|mips|ppc)
3071 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3072 ;;
3073 esac
3074fi
3075
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03003076if test "$target_user_only" = "yes" -a "$static" = "no" -a \
Blue Swirl50108932009-09-13 19:38:48 +00003077 "$user_pie" = "yes" ; then
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03003078 cflags="-fpie $cflags"
3079 ldflags="-pie $ldflags"
3080fi
3081
Juan Quintela471857d2009-08-03 14:46:52 +02003082if test "$target_softmmu" = "yes" -a \( \
3083 "$TARGET_ARCH" = "microblaze" -o \
3084 "$TARGET_ARCH" = "cris" \) ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003085 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
Juan Quintela471857d2009-08-03 14:46:52 +02003086fi
3087
Juan Quintelad02c1db2009-08-03 14:46:50 +02003088if test "$gprof" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003089 echo "TARGET_GPROF=yes" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02003090 if test "$target_linux_user" = "yes" ; then
3091 cflags="-p $cflags"
3092 ldflags="-p $ldflags"
3093 fi
3094 if test "$target_softmmu" = "yes" ; then
3095 ldflags="-p $ldflags"
Juan Quintela25be2102009-10-07 02:41:00 +02003096 echo "GPROF_CFLAGS=-p" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02003097 fi
3098fi
3099
Juan Quintela6ee71262009-08-03 14:46:47 +02003100linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
Juan Quintela9b8e1112009-08-03 14:46:46 +02003101if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
Juan Quintelafa282482009-07-22 22:37:39 +02003102 case "$ARCH" in
Juan Quintelafa282482009-07-22 22:37:39 +02003103 sparc)
3104 # -static is used to avoid g1/g3 usage by the dynamic linker
Juan Quintela322e5872009-08-03 14:46:44 +02003105 ldflags="$linker_script -static $ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02003106 ;;
Richard Henderson4d58be02010-06-04 12:14:11 -07003107 alpha | s390x)
3108 # The default placement of the application is fine.
3109 ;;
Richard Hendersonfd76e732010-04-07 04:56:43 -07003110 *)
Juan Quintela322e5872009-08-03 14:46:44 +02003111 ldflags="$linker_script $ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02003112 ;;
3113 esac
3114fi
Juan Quintelafa282482009-07-22 22:37:39 +02003115
Juan Quintela25be2102009-10-07 02:41:00 +02003116echo "LDFLAGS+=$ldflags" >> $config_target_mak
3117echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02003118
bellard97a847b2003-08-10 21:36:04 +00003119done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00003120
3121# build tree in object directory if source path is different from current one
3122if test "$source_path_used" = "yes" ; then
Mark McLoughline1144d02009-10-23 17:52:16 +01003123 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06003124 DIRS="$DIRS roms/seabios roms/vgabios"
Corentin Chary3e230dd2010-07-07 20:57:52 +02003125 DIRS="$DIRS fsdev ui"
bellard7d132992003-03-06 23:23:54 +00003126 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00003127 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00003128 FILES="$FILES tests/test-mmap.c"
Blue Swirlae0bfb72010-10-13 18:38:07 +00003129 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06003130 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
Jan Kiszka7ea78b72009-07-17 11:20:10 +02003131 for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
3132 FILES="$FILES pc-bios/`basename $bios_file`"
3133 done
bellard7d132992003-03-06 23:23:54 +00003134 for dir in $DIRS ; do
3135 mkdir -p $dir
3136 done
bellardec530c82006-04-25 22:36:06 +00003137 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00003138 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00003139 rm -f $f
3140 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00003141 done
3142fi
Paul Brook1ad21342009-05-19 16:17:58 +01003143
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003144# temporary config to build submodules
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06003145for rom in seabios vgabios ; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003146 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01003147 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003148 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3149 echo "CC=$cc" >> $config_mak
3150 echo "BCC=bcc" >> $config_mak
3151 echo "CPP=${cross_prefix}cpp" >> $config_mak
3152 echo "OBJCOPY=objcopy" >> $config_mak
3153 echo "IASL=iasl" >> $config_mak
3154 echo "HOST_CC=$host_cc" >> $config_mak
3155 echo "LD=$ld" >> $config_mak
3156done
3157
Paul Brook1ad21342009-05-19 16:17:58 +01003158for hwlib in 32 64; do
3159 d=libhw$hwlib
3160 mkdir -p $d
Blue Swirl9953b2f2010-03-21 19:47:05 +00003161 mkdir -p $d/ide
Paul Brook1ad21342009-05-19 16:17:58 +01003162 rm -f $d/Makefile
3163 ln -s $source_path/Makefile.hw $d/Makefile
Stefan Weil37116c82010-03-01 22:20:29 +01003164 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
Paul Brook1ad21342009-05-19 16:17:58 +01003165done
Blue Swirladd16152009-09-27 16:26:02 +00003166
3167d=libuser
3168mkdir -p $d
3169rm -f $d/Makefile
3170ln -s $source_path/Makefile.user $d/Makefile
Kirill A. Shutemov299060a2009-12-19 15:16:08 +00003171if test "$static" = "no" -a "$user_pie" = "yes" ; then
3172 echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3173fi
Jan Kiszkab40292e2010-05-31 14:43:31 -03003174
3175if test "$docs" = "yes" ; then
3176 mkdir -p QMP
3177fi