blob: 87474e9afcf5a05e7d1dcb4754b27892bc522636 [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
Peter Maydellb48e3612011-11-23 17:26:44 +000023# Print a helpful header at the top of config.log
24echo "# QEMU configure log $(date)" >> config.log
25echo "# produced by $0 $*" >> config.log
26echo "#" >> config.log
27
Juan Quintela52166aa2009-08-03 14:46:03 +020028compile_object() {
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020029 echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
30 $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
Juan Quintela52166aa2009-08-03 14:46:03 +020031}
32
33compile_prog() {
34 local_cflags="$1"
35 local_ldflags="$2"
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020036 echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
37 $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
Juan Quintela52166aa2009-08-03 14:46:03 +020038}
39
Paolo Bonzini11568d62010-12-23 11:43:58 +010040# symbolically link $1 to $2. Portable version of "ln -sf".
41symlink() {
42 rm -f $2
43 ln -s $1 $2
44}
45
Loïc Minier0dba6192010-01-28 21:26:51 +000046# check whether a command is available to this shell (may be either an
47# executable or a builtin)
48has() {
49 type "$1" >/dev/null 2>&1
50}
51
52# search for an executable in PATH
53path_of() {
54 local_command="$1"
55 local_ifs="$IFS"
56 local_dir=""
57
58 # pathname has a dir component?
59 if [ "${local_command#*/}" != "$local_command" ]; then
60 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
61 echo "$local_command"
62 return 0
63 fi
64 fi
65 if [ -z "$local_command" ]; then
66 return 1
67 fi
68
69 IFS=:
70 for local_dir in $PATH; do
71 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
72 echo "$local_dir/$local_command"
73 IFS="${local_ifs:-$(printf ' \t\n')}"
74 return 0
75 fi
76 done
77 # not found
78 IFS="${local_ifs:-$(printf ' \t\n')}"
79 return 1
80}
81
bellard7d132992003-03-06 23:23:54 +000082# default parameters
Paolo Bonzinica4deeb2010-12-23 11:44:00 +010083source_path=`dirname "$0"`
Juan Quintela2ff6b912009-08-03 14:45:55 +020084cpu=""
bellard1e43adf2003-09-30 20:54:24 +000085interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000086static="no"
Juan Quintelaed968ff2009-08-03 14:46:11 +020087sparc_cpu=""
bellard7d132992003-03-06 23:23:54 +000088cross_prefix=""
malc0c58ac12008-06-25 21:04:05 +000089audio_drv_list=""
Gerd Hoffmannd61a4ce2010-11-01 13:05:32 +010090audio_card_list="ac97 es1370 sb16 hda"
91audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
Markus Armbrustereb852012009-10-27 18:41:44 +010092block_drv_whitelist=""
bellard7d132992003-03-06 23:23:54 +000093host_cc="gcc"
Juan Quintelac81da562009-08-03 14:46:24 +020094helper_cflags=""
Juan Quintela73da3752009-08-03 14:46:26 +020095libs_softmmu=""
Juan Quintela3e2e0e62009-08-03 14:47:06 +020096libs_tools=""
Juan Quintela67f86e82009-08-03 14:46:59 +020097audio_pt_int=""
malcd5631632009-10-10 01:13:41 +040098audio_win_int=""
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +020099cc_i386=i386-pc-linux-gnu-gcc
Michael Roth957f1f92011-08-11 15:38:12 -0500100libs_qga=""
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100101debug_info="yes"
aliguoriac0df512008-12-29 17:14:15 +0000102
Paolo Bonzini377529c2010-12-23 11:43:50 +0100103target_list=""
104
105# Default value for a variable defining feature "foo".
106# * foo="no" feature will only be used if --enable-foo arg is given
107# * foo="" feature will be searched for, and if found, will be used
108# unless --disable-foo is given
109# * foo="yes" this value will only be set by --enable-foo flag.
110# feature will searched for,
111# if not found, configure exits with error
112#
113# Always add --enable-foo and --disable-foo command line args.
114# Distributions want to ensure that several features are compiled in, and it
115# is impossible without a --enable-foo that exits if a feature is not found.
116
117bluez=""
118brlapi=""
119curl=""
120curses=""
121docs=""
122fdt=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100123nptl=""
124sdl=""
Jes Sorensen821601e2011-03-16 13:33:36 +0100125vnc="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100126sparse="no"
127uuid=""
128vde=""
129vnc_tls=""
130vnc_sasl=""
131vnc_jpeg=""
132vnc_png=""
133vnc_thread="no"
134xen=""
Anthony PERARDd5b93dd2011-02-25 16:20:34 +0000135xen_ctrl_version=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100136linux_aio=""
Corey Bryant47e98652012-01-26 09:42:26 -0500137cap_ng=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100138attr=""
Avi Kivity4f26f2b2011-11-09 14:44:52 +0200139libattr=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100140xfs=""
141
Bradd41a75a2011-07-26 23:11:26 -0400142vhost_net="no"
143kvm="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100144gprof="no"
145debug_tcg="no"
146debug_mon="no"
147debug="no"
148strip_opt="yes"
Stefan Weil9195b2c2011-10-19 07:07:18 +0200149tcg_interpreter="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100150bigendian="no"
151mingw32="no"
152EXESUF=""
153prefix="/usr/local"
154mandir="\${prefix}/share/man"
155datadir="\${prefix}/share/qemu"
156docdir="\${prefix}/share/doc/qemu"
157bindir="\${prefix}/bin"
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300158libdir="\${prefix}/lib"
Alon Levy0f94d6d2011-06-27 11:58:20 +0200159includedir="\${prefix}/include"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100160sysconfdir="\${prefix}/etc"
161confsuffix="/qemu"
162slirp="yes"
163fmod_lib=""
164fmod_inc=""
165oss_lib=""
166bsd="no"
167linux="no"
168solaris="no"
169profiler="no"
170cocoa="no"
171softmmu="yes"
172linux_user="no"
173darwin_user="no"
174bsd_user="no"
175guest_base=""
176uname_release=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100177mixemu="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100178aix="no"
179blobs="yes"
180pkgversion=""
Avi Kivity40d64442011-11-15 20:12:17 +0200181pie=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100182zero_malloc=""
183trace_backend="nop"
184trace_file="trace"
185spice=""
186rbd=""
Alon Levy36707142010-10-17 11:40:07 +0200187smartcard=""
Robert Relyea111a38b2010-11-28 16:36:38 +0200188smartcard_nss=""
Hans de Goede69354a82011-07-19 11:04:10 +0200189usb_redir=""
Michael Walle430a3c12011-04-26 00:09:01 +0200190opengl=""
Alon Levy1ece9902011-07-26 12:30:40 +0300191zlib="yes"
Michael Rothd138cee2011-08-01 14:52:57 -0500192guest_agent="yes"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100193libiscsi=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100194
aliguoriac0df512008-12-29 17:14:15 +0000195# parse CC options first
196for opt do
197 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
198 case "$opt" in
199 --cross-prefix=*) cross_prefix="$optarg"
200 ;;
Paolo Bonzini3d8df642010-12-23 11:43:48 +0100201 --cc=*) CC="$optarg"
aliguoriac0df512008-12-29 17:14:15 +0000202 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100203 --source-path=*) source_path="$optarg"
204 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200205 --cpu=*) cpu="$optarg"
206 ;;
Juan Quintelaa558ee12009-08-03 14:46:21 +0200207 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200208 ;;
209 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
210 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100211 --enable-debug-info) debug_info="yes"
212 ;;
213 --disable-debug-info) debug_info="no"
214 ;;
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200215 --sparc_cpu=*)
216 sparc_cpu="$optarg"
217 case $sparc_cpu in
Juan Quintelaed968ff2009-08-03 14:46:11 +0200218 v7|v8|v8plus|v8plusa)
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200219 cpu="sparc"
220 ;;
221 v9)
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200222 cpu="sparc64"
223 ;;
224 *)
225 echo "undefined SPARC architecture. Exiting";
226 exit 1
227 ;;
228 esac
229 ;;
aliguoriac0df512008-12-29 17:14:15 +0000230 esac
231done
aliguoriac0df512008-12-29 17:14:15 +0000232# OS specific
233# Using uname is really, really broken. Once we have the right set of checks
234# we can eliminate it's usage altogether
235
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500236cc="${CC-${cross_prefix}gcc}"
237ar="${AR-${cross_prefix}ar}"
238objcopy="${OBJCOPY-${cross_prefix}objcopy}"
239ld="${LD-${cross_prefix}ld}"
Brad3f534582011-08-13 20:30:14 -0400240libtool="${LIBTOOL-${cross_prefix}libtool}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500241strip="${STRIP-${cross_prefix}strip}"
242windres="${WINDRES-${cross_prefix}windres}"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300243pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
244query_pkg_config() {
245 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
246}
247pkg_config=query_pkg_config
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500248sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
aliguoriac0df512008-12-29 17:14:15 +0000249
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200250# default flags for all hosts
251QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
Mike Frysingerf9188222011-05-17 17:08:43 -0400252QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200253QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
254QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Kirill A. Shutemov84958302010-01-20 00:56:22 +0100255QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
Paolo Bonzinicbbab922011-07-28 12:10:30 +0200256QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100257if test "$debug_info" = "yes"; then
258 CFLAGS="-g $CFLAGS"
259 LDFLAGS="-g $LDFLAGS"
260fi
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200261
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100262# make source path absolute
263source_path=`cd "$source_path"; pwd`
264
aliguoriac0df512008-12-29 17:14:15 +0000265check_define() {
266cat > $TMPC <<EOF
267#if !defined($1)
Peter Maydellfd786e12011-11-23 17:26:43 +0000268#error $1 not defined
aliguoriac0df512008-12-29 17:14:15 +0000269#endif
270int main(void) { return 0; }
271EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200272 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000273}
274
Juan Quintela2ff6b912009-08-03 14:45:55 +0200275if test ! -z "$cpu" ; then
276 # command line argument
277 :
278elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000279 cpu="i386"
280elif check_define __x86_64__ ; then
281 cpu="x86_64"
blueswir13aa9bd62008-12-31 16:55:26 +0000282elif check_define __sparc__ ; then
283 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
284 # They must be specified using --sparc_cpu
285 if check_define __arch64__ ; then
286 cpu="sparc64"
287 else
288 cpu="sparc"
289 fi
malcfdf7ed92009-01-14 18:39:52 +0000290elif check_define _ARCH_PPC ; then
291 if check_define _ARCH_PPC64 ; then
292 cpu="ppc64"
293 else
294 cpu="ppc"
295 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200296elif check_define __mips__ ; then
297 cpu="mips"
Aurelien Jarno477ba622010-03-29 02:12:51 +0200298elif check_define __ia64__ ; then
299 cpu="ia64"
Aurelien Jarnod66ed0e2010-06-13 12:28:21 +0200300elif check_define __s390__ ; then
301 if check_define __s390x__ ; then
302 cpu="s390x"
303 else
304 cpu="s390"
305 fi
Peter Maydell21d89f82011-11-30 10:57:48 +0100306elif check_define __arm__ ; then
307 cpu="arm"
Bradf28ffed2011-09-07 21:24:56 -0400308elif check_define __hppa__ ; then
309 cpu="hppa"
aliguoriac0df512008-12-29 17:14:15 +0000310else
malcfdf7ed92009-01-14 18:39:52 +0000311 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +0000312fi
313
Peter Maydell359bc952011-12-24 13:07:25 +0000314ARCH=
315# Normalise host CPU name and set ARCH.
316# Note that this case should only have supported host CPUs, not guests.
bellard7d132992003-03-06 23:23:54 +0000317case "$cpu" in
Peter Maydell359bc952011-12-24 13:07:25 +0000318 ia64|ppc|ppc64|s390|s390x|sparc64)
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200319 cpu="$cpu"
320 ;;
bellard7d132992003-03-06 23:23:54 +0000321 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000322 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000323 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000324 x86_64|amd64)
325 cpu="x86_64"
326 ;;
Peter Maydell21d89f82011-11-30 10:57:48 +0100327 armv*b|armv*l|arm)
328 cpu="arm"
bellard7d132992003-03-06 23:23:54 +0000329 ;;
Bradf28ffed2011-09-07 21:24:56 -0400330 hppa|parisc|parisc64)
aurel32f54b3f92008-04-12 20:14:54 +0000331 cpu="hppa"
332 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200333 mips*)
334 cpu="mips"
335 ;;
blueswir131422552007-04-16 18:27:06 +0000336 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000337 cpu="sparc"
338 ;;
bellard7d132992003-03-06 23:23:54 +0000339 *)
Peter Maydell359bc952011-12-24 13:07:25 +0000340 # This will result in either an error or falling back to TCI later
341 ARCH=unknown
bellard7d132992003-03-06 23:23:54 +0000342 ;;
343esac
Peter Maydell359bc952011-12-24 13:07:25 +0000344if test -z "$ARCH"; then
345 ARCH="$cpu"
346fi
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200347
bellard7d132992003-03-06 23:23:54 +0000348# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000349if check_define __linux__ ; then
350 targetos="Linux"
351elif check_define _WIN32 ; then
352 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000353elif check_define __OpenBSD__ ; then
354 targetos='OpenBSD'
355elif check_define __sun__ ; then
356 targetos='SunOS'
Andreas Färber179cf402010-09-20 00:50:43 +0200357elif check_define __HAIKU__ ; then
358 targetos='Haiku'
aliguoriac0df512008-12-29 17:14:15 +0000359else
360 targetos=`uname -s`
361fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200362
bellard7d132992003-03-06 23:23:54 +0000363case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000364CYGWIN*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200365 mingw32="yes"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200366 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
malcd5631632009-10-10 01:13:41 +0400367 audio_possible_drivers="winwave sdl"
368 audio_drv_list="winwave"
bellardc326e0a2005-04-23 18:30:28 +0000369;;
bellard67b915a2004-03-31 23:37:16 +0000370MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200371 mingw32="yes"
malcd5631632009-10-10 01:13:41 +0400372 audio_possible_drivers="winwave dsound sdl fmod"
373 audio_drv_list="winwave"
bellard67b915a2004-03-31 23:37:16 +0000374;;
ths5c40d2b2007-06-23 16:03:36 +0000375GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100376 bsd="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200377 audio_drv_list="oss"
378 audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000379;;
bellard7d3505c2004-05-12 19:32:15 +0000380FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200381 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100382 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200383 audio_drv_list="oss"
384 audio_possible_drivers="oss sdl esd pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100385 # needed for kinfo_getvmmap(3) in libutil.h
386 LIBS="-lutil $LIBS"
bellard7d3505c2004-05-12 19:32:15 +0000387;;
blueswir1c5e97232009-03-07 20:06:23 +0000388DragonFly)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200389 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100390 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200391 audio_drv_list="oss"
392 audio_possible_drivers="oss sdl esd pa"
blueswir1c5e97232009-03-07 20:06:23 +0000393;;
bellard7d3505c2004-05-12 19:32:15 +0000394NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200395 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100396 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200397 audio_drv_list="oss"
398 audio_possible_drivers="oss sdl esd"
399 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000400;;
401OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200402 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100403 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200404 audio_drv_list="oss"
405 audio_possible_drivers="oss sdl esd"
406 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000407;;
bellard83fb7ad2004-07-05 21:25:26 +0000408Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200409 bsd="yes"
410 darwin="yes"
411 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
412 # run 64-bit userspace code
413 if [ "$cpu" = "i386" ] ; then
malcaab85882009-02-23 14:11:10 +0000414 is_x86_64=`sysctl -n hw.optional.x86_64`
415 [ "$is_x86_64" = "1" ] && cpu=x86_64
Juan Quintela0dbfc672009-08-03 14:46:13 +0200416 fi
417 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200418 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200419 LDFLAGS="-arch x86_64 $LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200420 else
Juan Quintelaa558ee12009-08-03 14:46:21 +0200421 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200422 fi
423 darwin_user="yes"
424 cocoa="yes"
425 audio_drv_list="coreaudio"
426 audio_possible_drivers="coreaudio sdl fmod"
427 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200428 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
bellard83fb7ad2004-07-05 21:25:26 +0000429;;
bellardec530c82006-04-25 22:36:06 +0000430SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200431 solaris="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100432 make="${MAKE-gmake}"
433 install="${INSTALL-ginstall}"
Blue Swirlfa589482009-10-02 19:38:25 +0000434 ld="gld"
Brade2d88302011-09-02 16:53:28 -0400435 smbd="${SMBD-/usr/sfw/sbin/smbd}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200436 needs_libsunmath="no"
437 solarisrev=`uname -r | cut -f2 -d.`
438 # have to select again, because `uname -m` returns i86pc
439 # even on an x86_64 box.
440 solariscpu=`isainfo -k`
441 if test "${solariscpu}" = "amd64" ; then
442 cpu="x86_64"
443 fi
444 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
445 if test "$solarisrev" -le 9 ; then
446 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
447 needs_libsunmath="yes"
Juan Quintelaf14bfdf2009-08-03 14:47:11 +0200448 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
449 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
450 LIBS="-lsunmath $LIBS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200451 else
452 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
453 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
454 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
455 echo "Studio 11 can be downloaded from www.sun.com."
456 exit 1
457 fi
thsef18c882007-09-16 22:12:39 +0000458 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200459 fi
460 if test -f /usr/include/sys/soundcard.h ; then
461 audio_drv_list="oss"
462 fi
463 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000464# needed for CMSG_ macros in sys/socket.h
465 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
466# needed for TIOCWIN* defines in termios.h
467 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200468 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
Juan Quintelae174c0b2009-08-03 14:46:18 +0200469 LIBS="-lsocket -lnsl -lresolv $LIBS"
ths86b2bd92007-02-11 00:31:33 +0000470;;
malcb29fe3e2008-11-18 01:42:22 +0000471AIX)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200472 aix="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100473 make="${MAKE-gmake}"
malcb29fe3e2008-11-18 01:42:22 +0000474;;
Andreas Färber179cf402010-09-20 00:50:43 +0200475Haiku)
476 haiku="yes"
477 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
478 LIBS="-lposix_error_mapper -lnetwork $LIBS"
479;;
bellard1d14ffa2005-10-30 18:58:22 +0000480*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200481 audio_drv_list="oss"
482 audio_possible_drivers="oss alsa sdl esd pa"
483 linux="yes"
484 linux_user="yes"
485 usb="linux"
Jan Kiszkaaf2be202011-06-23 10:05:12 +0200486 kvm="yes"
487 vhost_net="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200488 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
malcc2de5c92008-06-28 19:13:06 +0000489 audio_possible_drivers="$audio_possible_drivers fmod"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200490 fi
bellardfb065182004-11-09 23:09:44 +0000491;;
bellard7d132992003-03-06 23:23:54 +0000492esac
493
bellard7d3505c2004-05-12 19:32:15 +0000494if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000495 if [ "$darwin" != "yes" ] ; then
blueswir168063642008-11-22 21:03:55 +0000496 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000497 fi
blueswir184778502008-10-26 20:33:16 +0000498 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000499fi
500
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100501: ${make=${MAKE-make}}
502: ${install=${INSTALL-install}}
Blue Swirlc886edf2011-07-22 21:08:09 +0000503: ${python=${PYTHON-python}}
Brade2d88302011-09-02 16:53:28 -0400504: ${smbd=${SMBD-/usr/sbin/smbd}}
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100505
Juan Quintela3457a3f2009-08-03 14:46:07 +0200506if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +0200507 EXESUF=".exe"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200508 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
Stefan Weile94a7932010-02-12 11:02:08 +0100509 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
510 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
Stefan Weil08f38962011-02-04 22:38:47 +0100511 LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200512 prefix="c:/Program Files/Qemu"
513 mandir="\${prefix}"
514 datadir="\${prefix}"
515 docdir="\${prefix}"
516 bindir="\${prefix}"
517 sysconfdir="\${prefix}"
518 confsuffix=""
Michael Rothd8ca6852012-01-19 22:04:34 -0600519 libs_qga="-lws2_32 -lwinmm $lib_qga"
Juan Quintela3457a3f2009-08-03 14:46:07 +0200520fi
521
Anthony Liguori487fefd2009-06-11 13:28:25 -0500522werror=""
bellard85aa5182007-11-11 20:17:03 +0000523
bellard7d132992003-03-06 23:23:54 +0000524for opt do
pbrooka46e4032006-04-29 23:05:22 +0000525 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000526 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000527 --help|-h) show_help=yes
528 ;;
Mike Frysinger99123e12011-04-07 01:12:28 -0400529 --version|-V) exec cat $source_path/VERSION
530 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000531 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000532 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000533 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000534 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100535 --source-path=*)
bellard7d132992003-03-06 23:23:54 +0000536 ;;
aliguoriac0df512008-12-29 17:14:15 +0000537 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000538 ;;
aliguoriac0df512008-12-29 17:14:15 +0000539 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000540 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000541 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000542 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000543 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000544 ;;
pbrook6a882642006-04-17 13:57:12 +0000545 --install=*) install="$optarg"
546 ;;
Blue Swirlc886edf2011-07-22 21:08:09 +0000547 --python=*) python="$optarg"
548 ;;
Brade2d88302011-09-02 16:53:28 -0400549 --smbd=*) smbd="$optarg"
550 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200551 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000552 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200553 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000554 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100555 --enable-debug-info)
556 ;;
557 --disable-debug-info)
558 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200559 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000560 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000561 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000562 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100563 --enable-trace-backend=*) trace_backend="$optarg"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +0100564 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100565 --with-trace-file=*) trace_file="$optarg"
Prerna Saxena9410b562010-07-13 09:26:32 +0100566 ;;
bellard7d132992003-03-06 23:23:54 +0000567 --enable-gprof) gprof="yes"
568 ;;
Loïc Minier79427692010-01-31 12:23:45 +0100569 --static)
570 static="yes"
571 LDFLAGS="-static $LDFLAGS"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300572 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
bellard43ce4df2003-06-09 19:53:12 +0000573 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200574 --mandir=*) mandir="$optarg"
575 ;;
576 --bindir=*) bindir="$optarg"
577 ;;
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300578 --libdir=*) libdir="$optarg"
579 ;;
Alon Levy0f94d6d2011-06-27 11:58:20 +0200580 --includedir=*) includedir="$optarg"
581 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200582 --datadir=*) datadir="$optarg"
583 ;;
584 --docdir=*) docdir="$optarg"
585 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +0100586 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -0600587 ;;
Max Filippov023ddd72011-11-24 16:11:31 +0400588 --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\
589 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
590 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
591 # These switches are silently ignored, for compatibility with
592 # autoconf-generated configure scripts. This allows QEMU's
593 # configure to be used by RPM and similar macros that set
594 # lots of directory switches by default.
595 ;;
bellard97a847b2003-08-10 21:36:04 +0000596 --disable-sdl) sdl="no"
597 ;;
Juan Quintelac4198152009-08-12 18:29:53 +0200598 --enable-sdl) sdl="yes"
599 ;;
Jes Sorensen821601e2011-03-16 13:33:36 +0100600 --disable-vnc) vnc="no"
601 ;;
602 --enable-vnc) vnc="yes"
603 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000604 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000605 ;;
malcc2de5c92008-06-28 19:13:06 +0000606 --fmod-inc=*) fmod_inc="$optarg"
607 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000608 --oss-lib=*) oss_lib="$optarg"
609 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000610 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000611 ;;
612 --audio-drv-list=*) audio_drv_list="$optarg"
613 ;;
Markus Armbrustereb852012009-10-27 18:41:44 +0100614 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
615 ;;
aurel32f8393942009-04-13 18:45:38 +0000616 --enable-debug-tcg) debug_tcg="yes"
617 ;;
618 --disable-debug-tcg) debug_tcg="no"
619 ;;
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200620 --enable-debug-mon) debug_mon="yes"
621 ;;
622 --disable-debug-mon) debug_mon="no"
623 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100624 --enable-debug)
625 # Enable debugging options that aren't excessively noisy
626 debug_tcg="yes"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200627 debug_mon="yes"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100628 debug="yes"
629 strip_opt="no"
630 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000631 --enable-sparse) sparse="yes"
632 ;;
633 --disable-sparse) sparse="no"
634 ;;
aliguori1625af82009-04-05 17:41:02 +0000635 --disable-strip) strip_opt="no"
636 ;;
ths8d5d2d42007-08-25 01:37:51 +0000637 --disable-vnc-tls) vnc_tls="no"
638 ;;
Juan Quintela1be10ad2009-08-12 18:20:28 +0200639 --enable-vnc-tls) vnc_tls="yes"
640 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000641 --disable-vnc-sasl) vnc_sasl="no"
642 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +0200643 --enable-vnc-sasl) vnc_sasl="yes"
644 ;;
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200645 --disable-vnc-jpeg) vnc_jpeg="no"
646 ;;
647 --enable-vnc-jpeg) vnc_jpeg="yes"
648 ;;
Corentin Charyefe556a2010-07-07 20:57:56 +0200649 --disable-vnc-png) vnc_png="no"
650 ;;
651 --enable-vnc-png) vnc_png="yes"
652 ;;
Corentin Charybd023f92010-07-07 20:58:02 +0200653 --disable-vnc-thread) vnc_thread="no"
654 ;;
655 --enable-vnc-thread) vnc_thread="yes"
656 ;;
bellard443f1372004-06-04 11:13:20 +0000657 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000658 ;;
Stefan Weilee682d22009-10-01 20:10:37 +0200659 --disable-uuid) uuid="no"
660 ;;
661 --enable-uuid) uuid="yes"
662 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000663 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000664 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +0200665 --enable-vde) vde="yes"
666 ;;
aliguorie37630c2009-04-22 15:19:10 +0000667 --disable-xen) xen="no"
668 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +0200669 --enable-xen) xen="yes"
670 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000671 --disable-brlapi) brlapi="no"
672 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200673 --enable-brlapi) brlapi="yes"
674 ;;
balrogfb599c92008-09-28 23:49:55 +0000675 --disable-bluez) bluez="no"
676 ;;
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200677 --enable-bluez) bluez="yes"
678 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000679 --disable-kvm) kvm="no"
680 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +0200681 --enable-kvm) kvm="yes"
682 ;;
Stefan Weil9195b2c2011-10-19 07:07:18 +0200683 --disable-tcg-interpreter) tcg_interpreter="no"
684 ;;
685 --enable-tcg-interpreter) tcg_interpreter="yes"
686 ;;
Corey Bryant47e98652012-01-26 09:42:26 -0500687 --disable-cap-ng) cap_ng="no"
688 ;;
689 --enable-cap-ng) cap_ng="yes"
690 ;;
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +0100691 --disable-spice) spice="no"
692 ;;
693 --enable-spice) spice="yes"
694 ;;
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100695 --disable-libiscsi) libiscsi="no"
696 ;;
697 --enable-libiscsi) libiscsi="yes"
698 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000699 --enable-profiler) profiler="yes"
700 ;;
malcc2de5c92008-06-28 19:13:06 +0000701 --enable-cocoa)
702 cocoa="yes" ;
703 sdl="no" ;
704 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000705 ;;
pbrookcad25d62006-03-19 16:31:11 +0000706 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000707 ;;
pbrookcad25d62006-03-19 16:31:11 +0000708 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000709 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -1000710 --disable-user)
711 linux_user="no" ;
712 bsd_user="no" ;
713 darwin_user="no"
714 ;;
715 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +0000716 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000717 ;;
ths831b7822007-01-18 20:06:33 +0000718 --enable-linux-user) linux_user="yes"
719 ;;
720 --disable-darwin-user) darwin_user="no"
721 ;;
722 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000723 ;;
blueswir184778502008-10-26 20:33:16 +0000724 --disable-bsd-user) bsd_user="no"
725 ;;
726 --enable-bsd-user) bsd_user="yes"
727 ;;
Paul Brook379f6692009-07-17 12:48:08 +0100728 --enable-guest-base) guest_base="yes"
729 ;;
730 --disable-guest-base) guest_base="no"
731 ;;
Avi Kivity40d64442011-11-15 20:12:17 +0200732 --enable-pie) pie="yes"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300733 ;;
Avi Kivity40d64442011-11-15 20:12:17 +0200734 --disable-pie) pie="no"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300735 ;;
pbrookc5937222006-05-14 11:30:38 +0000736 --enable-uname-release=*) uname_release="$optarg"
737 ;;
blueswir131422552007-04-16 18:27:06 +0000738 --sparc_cpu=*)
blueswir131422552007-04-16 18:27:06 +0000739 ;;
bellard85aa5182007-11-11 20:17:03 +0000740 --enable-werror) werror="yes"
741 ;;
742 --disable-werror) werror="no"
743 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000744 --disable-curses) curses="no"
745 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +0200746 --enable-curses) curses="yes"
747 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200748 --disable-curl) curl="no"
749 ;;
Juan Quintela788c8192009-08-12 18:29:47 +0200750 --enable-curl) curl="yes"
751 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +0200752 --disable-fdt) fdt="no"
753 ;;
754 --enable-fdt) fdt="yes"
755 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000756 --disable-nptl) nptl="no"
757 ;;
Juan Quintelab0a47e72009-08-12 18:29:49 +0200758 --enable-nptl) nptl="yes"
759 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000760 --enable-mixemu) mixemu="yes"
761 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200762 --disable-linux-aio) linux_aio="no"
763 ;;
764 --enable-linux-aio) linux_aio="yes"
765 ;;
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700766 --disable-attr) attr="no"
767 ;;
768 --enable-attr) attr="yes"
769 ;;
ths77755342008-11-27 15:45:16 +0000770 --disable-blobs) blobs="no"
771 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000772 --with-pkgversion=*) pkgversion=" ($optarg)"
773 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200774 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500775 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200776 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +0200777 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200778 --disable-vhost-net) vhost_net="no"
779 ;;
780 --enable-vhost-net) vhost_net="yes"
781 ;;
Michael Walle20ff0752011-03-07 23:32:39 +0100782 --disable-opengl) opengl="no"
783 ;;
784 --enable-opengl) opengl="yes"
785 ;;
Christian Brunnerf27aaf42010-12-06 20:53:01 +0100786 --disable-rbd) rbd="no"
787 ;;
788 --enable-rbd) rbd="yes"
789 ;;
Sergei Trofimovich8c84cf12012-01-24 20:42:40 +0300790 --disable-xfsctl) xfs="no"
791 ;;
792 --enable-xfsctl) xfs="yes"
793 ;;
Alon Levy36707142010-10-17 11:40:07 +0200794 --disable-smartcard) smartcard="no"
795 ;;
796 --enable-smartcard) smartcard="yes"
797 ;;
Robert Relyea111a38b2010-11-28 16:36:38 +0200798 --disable-smartcard-nss) smartcard_nss="no"
799 ;;
800 --enable-smartcard-nss) smartcard_nss="yes"
801 ;;
Hans de Goede69354a82011-07-19 11:04:10 +0200802 --disable-usb-redir) usb_redir="no"
803 ;;
804 --enable-usb-redir) usb_redir="yes"
805 ;;
Alon Levy1ece9902011-07-26 12:30:40 +0300806 --disable-zlib-test) zlib="no"
807 ;;
Michael Rothd138cee2011-08-01 14:52:57 -0500808 --enable-guest-agent) guest_agent="yes"
809 ;;
810 --disable-guest-agent) guest_agent="no"
811 ;;
balrog7f1559c2007-11-17 10:24:32 +0000812 *) echo "ERROR: unknown option $opt"; show_help="yes"
813 ;;
bellard7d132992003-03-06 23:23:54 +0000814 esac
815done
816
blueswir131422552007-04-16 18:27:06 +0000817#
818# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
Juan Quintelaa558ee12009-08-03 14:46:21 +0200819# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
blueswir131422552007-04-16 18:27:06 +0000820#
Paul Brook379f6692009-07-17 12:48:08 +0100821host_guest_base="no"
bellard40293e52008-01-31 11:32:10 +0000822case "$cpu" in
Juan Quintelaed968ff2009-08-03 14:46:11 +0200823 sparc) case $sparc_cpu in
824 v7|v8)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200825 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200826 ;;
827 v8plus|v8plusa)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200828 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200829 ;;
830 *) # sparc_cpu not defined in the command line
Juan Quintelaa558ee12009-08-03 14:46:21 +0200831 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200832 esac
833 LDFLAGS="-m32 $LDFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200834 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000835 if test "$solaris" = "no" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200836 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
Juan Quintelac81da562009-08-03 14:46:24 +0200837 helper_cflags="-ffixed-i0"
blueswir1762e8232009-04-04 09:21:28 +0000838 fi
blueswir131422552007-04-16 18:27:06 +0000839 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +0200840 sparc64)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200841 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200842 LDFLAGS="-m64 $LDFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200843 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200844 if test "$solaris" != "no" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200845 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000846 fi
blueswir131422552007-04-16 18:27:06 +0000847 ;;
ths76d83bd2007-11-18 21:22:10 +0000848 s390)
Richard Henderson28d7cc42010-06-04 12:14:09 -0700849 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
850 LDFLAGS="-m31 $LDFLAGS"
Richard Henderson48bb3752010-06-28 19:15:37 -0700851 host_guest_base="yes"
Richard Henderson28d7cc42010-06-04 12:14:09 -0700852 ;;
853 s390x)
854 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
855 LDFLAGS="-m64 $LDFLAGS"
Richard Henderson48bb3752010-06-28 19:15:37 -0700856 host_guest_base="yes"
ths76d83bd2007-11-18 21:22:10 +0000857 ;;
bellard40293e52008-01-31 11:32:10 +0000858 i386)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200859 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200860 LDFLAGS="-m32 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200861 cc_i386='$(CC) -m32'
Juan Quintelac81da562009-08-03 14:46:24 +0200862 helper_cflags="-fomit-frame-pointer"
Paul Brook379f6692009-07-17 12:48:08 +0100863 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000864 ;;
865 x86_64)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200866 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200867 LDFLAGS="-m64 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200868 cc_i386='$(CC) -m32'
Paul Brook379f6692009-07-17 12:48:08 +0100869 host_guest_base="yes"
870 ;;
871 arm*)
872 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000873 ;;
malcf6548c02009-07-18 10:08:40 +0400874 ppc*)
875 host_guest_base="yes"
876 ;;
Aurelien Jarnocc01cc82010-03-27 17:31:04 +0100877 mips*)
878 host_guest_base="yes"
879 ;;
Aurelien Jarno477ba622010-03-29 02:12:51 +0200880 ia64*)
881 host_guest_base="yes"
882 ;;
Richard Hendersonfd76e732010-04-07 04:56:43 -0700883 hppa*)
884 host_guest_base="yes"
885 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +0800886 unicore32*)
887 host_guest_base="yes"
888 ;;
blueswir131422552007-04-16 18:27:06 +0000889esac
890
Paul Brook379f6692009-07-17 12:48:08 +0100891[ -z "$guest_base" ] && guest_base="$host_guest_base"
892
Peter Maydell60e0df22011-05-03 14:50:13 +0100893
894default_target_list=""
895
896# these targets are portable
897if [ "$softmmu" = "yes" ] ; then
898 default_target_list="\
899i386-softmmu \
900x86_64-softmmu \
Richard Henderson27cdad62011-09-20 15:36:24 -0700901alpha-softmmu \
Peter Maydell60e0df22011-05-03 14:50:13 +0100902arm-softmmu \
903cris-softmmu \
904lm32-softmmu \
905m68k-softmmu \
906microblaze-softmmu \
907microblazeel-softmmu \
908mips-softmmu \
909mipsel-softmmu \
910mips64-softmmu \
911mips64el-softmmu \
912ppc-softmmu \
913ppcemb-softmmu \
914ppc64-softmmu \
915sh4-softmmu \
916sh4eb-softmmu \
917sparc-softmmu \
918sparc64-softmmu \
Alexander Graf0f3301d2011-03-23 08:23:47 +0100919s390x-softmmu \
Max Filippovcfa550c2011-09-06 03:55:26 +0400920xtensa-softmmu \
921xtensaeb-softmmu \
Peter Maydell60e0df22011-05-03 14:50:13 +0100922"
923fi
924# the following are Linux specific
925if [ "$linux_user" = "yes" ] ; then
926 default_target_list="${default_target_list}\
927i386-linux-user \
928x86_64-linux-user \
929alpha-linux-user \
930arm-linux-user \
931armeb-linux-user \
932cris-linux-user \
933m68k-linux-user \
934microblaze-linux-user \
935microblazeel-linux-user \
936mips-linux-user \
937mipsel-linux-user \
938ppc-linux-user \
939ppc64-linux-user \
940ppc64abi32-linux-user \
941sh4-linux-user \
942sh4eb-linux-user \
943sparc-linux-user \
944sparc64-linux-user \
945sparc32plus-linux-user \
946unicore32-linux-user \
Alexander Graf0f3301d2011-03-23 08:23:47 +0100947s390x-linux-user \
Peter Maydell60e0df22011-05-03 14:50:13 +0100948"
949fi
950# the following are Darwin specific
951if [ "$darwin_user" = "yes" ] ; then
952 default_target_list="$default_target_list i386-darwin-user ppc-darwin-user "
953fi
954# the following are BSD specific
955if [ "$bsd_user" = "yes" ] ; then
956 default_target_list="${default_target_list}\
957i386-bsd-user \
958x86_64-bsd-user \
959sparc-bsd-user \
960sparc64-bsd-user \
961"
962fi
963
pbrookaf5db582006-04-08 14:26:41 +0000964if test x"$show_help" = x"yes" ; then
965cat << EOF
966
967Usage: configure [options]
968Options: [defaults in brackets after descriptions]
969
970EOF
971echo "Standard options:"
972echo " --help print this message"
973echo " --prefix=PREFIX install in PREFIX [$prefix]"
974echo " --interp-prefix=PREFIX where to find shared libraries, etc."
975echo " use %M for cpu name [$interp_prefix]"
Peter Maydell60e0df22011-05-03 14:50:13 +0100976echo " --target-list=LIST set target list (default: build everything)"
977echo "Available targets: $default_target_list" | \
978 fold -s -w 53 | sed -e 's/^/ /'
pbrookaf5db582006-04-08 14:26:41 +0000979echo ""
pbrookaf5db582006-04-08 14:26:41 +0000980echo "Advanced options (experts only):"
981echo " --source-path=PATH path of source code [$source_path]"
982echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
983echo " --cc=CC use C compiler CC [$cc]"
Paolo Bonzini0bfe8cc2010-05-26 16:08:18 +0200984echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
985echo " build time"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200986echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
Jan Kiszkae3fc14c2009-06-30 21:29:03 +0200987echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000988echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000989echo " --install=INSTALL use specified install [$install]"
Blue Swirlc886edf2011-07-22 21:08:09 +0000990echo " --python=PYTHON use specified python [$python]"
Brade2d88302011-09-02 16:53:28 -0400991echo " --smbd=SMBD use specified smbd [$smbd]"
pbrookaf5db582006-04-08 14:26:41 +0000992echo " --static enable static build [$static]"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200993echo " --mandir=PATH install man pages in PATH"
994echo " --datadir=PATH install firmware in PATH"
995echo " --docdir=PATH install documentation in PATH"
996echo " --bindir=PATH install binaries in PATH"
997echo " --sysconfdir=PATH install config in PATH/qemu"
aurel32f8393942009-04-13 18:45:38 +0000998echo " --enable-debug-tcg enable TCG debugging"
999echo " --disable-debug-tcg disable TCG debugging (default)"
Stefan Weil09695a42009-06-06 16:51:30 +02001000echo " --enable-debug enable common debug build options"
aliguori890b1652008-10-07 21:22:41 +00001001echo " --enable-sparse enable sparse checker"
1002echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +00001003echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +00001004echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +00001005echo " --disable-sdl disable SDL"
Juan Quintelac4198152009-08-12 18:29:53 +02001006echo " --enable-sdl enable SDL"
Jes Sorensen821601e2011-03-16 13:33:36 +01001007echo " --disable-vnc disable VNC"
1008echo " --enable-vnc enable VNC"
pbrookaf5db582006-04-08 14:26:41 +00001009echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +00001010echo " --audio-drv-list=LIST set audio drivers list:"
1011echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +00001012echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
1013echo " Available cards: $audio_possible_cards"
Markus Armbrustereb852012009-10-27 18:41:44 +01001014echo " --block-drv-whitelist=L set block driver whitelist"
1015echo " (affects only QEMU, not qemu-img)"
malc8ff9cbf2008-06-23 18:33:30 +00001016echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +00001017echo " --disable-xen disable xen backend driver support"
Juan Quintelafc321b42009-08-12 18:29:55 +02001018echo " --enable-xen enable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +00001019echo " --disable-brlapi disable BrlAPI"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001020echo " --enable-brlapi enable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +00001021echo " --disable-vnc-tls disable TLS encryption for VNC server"
Juan Quintela1be10ad2009-08-12 18:20:28 +02001022echo " --enable-vnc-tls enable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +00001023echo " --disable-vnc-sasl disable SASL encryption for VNC server"
Juan Quintelaea784e32009-08-12 18:20:29 +02001024echo " --enable-vnc-sasl enable SASL encryption for VNC server"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001025echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
1026echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
Corentin Chary96763cf2010-07-07 20:58:06 +02001027echo " --disable-vnc-png disable PNG compression for VNC server (default)"
Corentin Charyefe556a2010-07-07 20:57:56 +02001028echo " --enable-vnc-png enable PNG compression for VNC server"
Corentin Charybd023f92010-07-07 20:58:02 +02001029echo " --disable-vnc-thread disable threaded VNC server"
1030echo " --enable-vnc-thread enable threaded VNC server"
pbrookaf896aa2008-03-23 00:47:42 +00001031echo " --disable-curses disable curses output"
Juan Quintelac584a6d2009-08-12 18:20:30 +02001032echo " --enable-curses enable curses output"
Alexander Graf769ce762009-05-11 17:41:42 +02001033echo " --disable-curl disable curl connectivity"
Juan Quintela788c8192009-08-12 18:29:47 +02001034echo " --enable-curl enable curl connectivity"
Juan Quintela2df87df2009-08-12 18:29:54 +02001035echo " --disable-fdt disable fdt device tree"
1036echo " --enable-fdt enable fdt device tree"
balrogfb599c92008-09-28 23:49:55 +00001037echo " --disable-bluez disable bluez stack connectivity"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001038echo " --enable-bluez enable bluez stack connectivity"
Peter Maydell6093d3d2011-05-23 10:13:47 +01001039echo " --disable-slirp disable SLIRP userspace network connectivity"
aliguori7ba1e612008-11-05 16:04:33 +00001040echo " --disable-kvm disable KVM acceleration support"
Juan Quintelab31a0272009-08-12 18:29:56 +02001041echo " --enable-kvm enable KVM acceleration support"
Stefan Weil9195b2c2011-10-19 07:07:18 +02001042echo " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
pbrookbd0c5662008-05-29 14:34:11 +00001043echo " --disable-nptl disable usermode NPTL support"
Andre Przywarae5934d32009-09-16 14:29:07 +02001044echo " --enable-nptl enable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +00001045echo " --enable-system enable all system emulation targets"
1046echo " --disable-system disable all system emulation targets"
Zachary Amsden0953a802009-07-30 00:14:59 -10001047echo " --enable-user enable supported user emulation targets"
1048echo " --disable-user disable all user emulation targets"
ths831b7822007-01-18 20:06:33 +00001049echo " --enable-linux-user enable all linux usermode emulation targets"
1050echo " --disable-linux-user disable all linux usermode emulation targets"
1051echo " --enable-darwin-user enable all darwin usermode emulation targets"
1052echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +00001053echo " --enable-bsd-user enable all BSD usermode emulation targets"
1054echo " --disable-bsd-user disable all BSD usermode emulation targets"
Paul Brook379f6692009-07-17 12:48:08 +01001055echo " --enable-guest-base enable GUEST_BASE support for usermode"
1056echo " emulation targets"
1057echo " --disable-guest-base disable GUEST_BASE support"
Avi Kivity40d64442011-11-15 20:12:17 +02001058echo " --enable-pie build Position Independent Executables"
1059echo " --disable-pie do not build Position Independent Executables"
pbrookaf5db582006-04-08 14:26:41 +00001060echo " --fmod-lib path to FMOD library"
1061echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +00001062echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +00001063echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
陳韋任235e5102011-11-07 17:42:05 +08001064echo " --cpu=CPU Build for host CPU [$cpu]"
blueswir131422552007-04-16 18:27:06 +00001065echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
Stefan Weilee682d22009-10-01 20:10:37 +02001066echo " --disable-uuid disable uuid support"
1067echo " --enable-uuid enable uuid support"
aliguorie0e6c8c02008-07-23 18:14:33 +00001068echo " --disable-vde disable support for vde network"
Juan Quinteladfb278b2009-08-12 18:20:27 +02001069echo " --enable-vde enable support for vde network"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001070echo " --disable-linux-aio disable Linux AIO support"
1071echo " --enable-linux-aio enable Linux AIO support"
Corey Bryant47e98652012-01-26 09:42:26 -05001072echo " --disable-cap-ng disable libcap-ng support"
1073echo " --enable-cap-ng enable libcap-ng support"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07001074echo " --disable-attr disables attr and xattr support"
1075echo " --enable-attr enable attr and xattr support"
ths77755342008-11-27 15:45:16 +00001076echo " --disable-blobs disable installing provided firmware blobs"
Dirk Ullrichd2807bc2010-02-06 09:48:23 +01001077echo " --enable-docs enable documentation build"
1078echo " --disable-docs disable documentation build"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02001079echo " --disable-vhost-net disable vhost-net acceleration support"
1080echo " --enable-vhost-net enable vhost-net acceleration support"
Fabien Chouteau320fba22011-01-27 10:24:41 +01001081echo " --enable-trace-backend=B Set trace backend"
1082echo " Available backends:" $("$source_path"/scripts/tracetool --list-backends)
Paolo Bonzini74242e02010-12-23 11:44:02 +01001083echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
Prerna Saxena9410b562010-07-13 09:26:32 +01001084echo " Default:trace-<pid>"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01001085echo " --disable-spice disable spice"
1086echo " --enable-spice enable spice"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01001087echo " --enable-rbd enable building the rados block device (rbd)"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11001088echo " --disable-libiscsi disable iscsi support"
1089echo " --enable-libiscsi enable iscsi support"
Alon Levy36707142010-10-17 11:40:07 +02001090echo " --disable-smartcard disable smartcard support"
1091echo " --enable-smartcard enable smartcard support"
Robert Relyea111a38b2010-11-28 16:36:38 +02001092echo " --disable-smartcard-nss disable smartcard nss support"
1093echo " --enable-smartcard-nss enable smartcard nss support"
Hans de Goede69354a82011-07-19 11:04:10 +02001094echo " --disable-usb-redir disable usb network redirection support"
1095echo " --enable-usb-redir enable usb network redirection support"
Michael Rothd138cee2011-08-01 14:52:57 -05001096echo " --disable-guest-agent disable building of the QEMU Guest Agent"
1097echo " --enable-guest-agent enable building of the QEMU Guest Agent"
pbrookaf5db582006-04-08 14:26:41 +00001098echo ""
ths5bf08932006-12-23 00:33:26 +00001099echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +00001100exit 1
1101fi
1102
Peter Maydell359bc952011-12-24 13:07:25 +00001103# Now we have handled --enable-tcg-interpreter and know we're not just
1104# printing the help message, bail out if the host CPU isn't supported.
1105if test "$ARCH" = "unknown"; then
1106 if test "$tcg_interpreter" = "yes" ; then
1107 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1108 ARCH=tci
1109 else
1110 echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1111 exit 1
1112 fi
1113fi
1114
Paolo Bonzini8d050952010-12-23 11:43:52 +01001115# check that the C compiler works.
1116cat > $TMPC <<EOF
Stefan Weil75cafad2011-12-17 09:27:29 +01001117int main(void) { return 0; }
Paolo Bonzini8d050952010-12-23 11:43:52 +01001118EOF
1119
1120if compile_object ; then
1121 : C compiler works ok
1122else
1123 echo "ERROR: \"$cc\" either does not exist or does not work"
1124 exit 1
1125fi
1126
1127gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1128gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1129gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
Mike Frysingerf9188222011-05-17 17:08:43 -04001130gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
Paolo Bonzini8d050952010-12-23 11:43:52 +01001131cat > $TMPC << EOF
1132int main(void) { return 0; }
1133EOF
1134for flag in $gcc_flags; do
Stefan Weilbd947d32012-01-04 22:47:16 +01001135 if compile_prog "-Werror $flag" "" ; then
Paolo Bonzini8d050952010-12-23 11:43:52 +01001136 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1137 fi
1138done
1139
Avi Kivity40d64442011-11-15 20:12:17 +02001140if test "$static" = "yes" ; then
1141 if test "$pie" = "yes" ; then
1142 echo "static and pie are mutually incompatible"
1143 exit 1
1144 else
1145 pie="no"
1146 fi
1147fi
1148
1149if test "$pie" = ""; then
1150 case "$cpu-$targetos" in
Bradf9db31a2011-11-28 19:53:49 -05001151 i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD)
Avi Kivity40d64442011-11-15 20:12:17 +02001152 ;;
1153 *)
1154 pie="no"
1155 ;;
1156 esac
1157fi
1158
1159if test "$pie" != "no" ; then
1160 cat > $TMPC << EOF
Avi Kivity21d4a792011-11-23 11:24:25 +02001161
1162#ifdef __linux__
1163# define THREAD __thread
1164#else
1165# define THREAD
1166#endif
1167
1168static THREAD int tls_var;
1169
1170int main(void) { return tls_var; }
1171
Avi Kivity40d64442011-11-15 20:12:17 +02001172EOF
1173 if compile_prog "-fPIE -DPIE" "-pie"; then
1174 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1175 LDFLAGS="-pie $LDFLAGS"
1176 pie="yes"
1177 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1178 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1179 fi
1180 else
1181 if test "$pie" = "yes"; then
1182 echo "PIE not available due to missing toolchain support"
1183 exit 1
1184 else
1185 echo "Disabling PIE due to missing toolchain support"
1186 pie="no"
1187 fi
1188 fi
1189fi
1190
bellardec530c82006-04-25 22:36:06 +00001191#
1192# Solaris specific configure tool chain decisions
1193#
1194if test "$solaris" = "yes" ; then
Loïc Minier6792aa12010-01-20 11:35:54 +01001195 if has $install; then
1196 :
1197 else
bellardec530c82006-04-25 22:36:06 +00001198 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1199 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1200 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1201 exit 1
1202 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001203 if test "`path_of $install`" = "/usr/sbin/install" ; then
bellardec530c82006-04-25 22:36:06 +00001204 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1205 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1206 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1207 exit 1
1208 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001209 if has ar; then
1210 :
1211 else
bellardec530c82006-04-25 22:36:06 +00001212 echo "Error: No path includes ar"
1213 if test -f /usr/ccs/bin/ar ; then
1214 echo "Add /usr/ccs/bin to your path and rerun configure"
1215 fi
1216 exit 1
1217 fi
ths5fafdf22007-09-16 21:08:06 +00001218fi
bellardec530c82006-04-25 22:36:06 +00001219
Sebastian Herbszt7a3fc892011-12-31 12:14:47 +01001220if ! has $python; then
1221 echo "Python not found. Use --python=/path/to/python"
1222 exit 1
Blue Swirlc886edf2011-07-22 21:08:09 +00001223fi
1224
bellard5327cf42005-01-10 23:18:50 +00001225if test -z "$target_list" ; then
Peter Maydell60e0df22011-05-03 14:50:13 +01001226 target_list="$default_target_list"
bellard6e20a452005-06-05 15:56:02 +00001227else
pbrookb1a550a2006-04-16 13:28:56 +00001228 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +00001229fi
pbrook0a8e90f2006-03-19 14:54:16 +00001230if test -z "$target_list" ; then
1231 echo "No targets enabled"
1232 exit 1
1233fi
Paolo Bonzinif55fe272010-05-26 16:08:17 +02001234# see if system emulation was really requested
1235case " $target_list " in
1236 *"-softmmu "*) softmmu=yes
1237 ;;
1238 *) softmmu=no
1239 ;;
1240esac
bellard5327cf42005-01-10 23:18:50 +00001241
Juan Quintela249247c2009-08-12 18:20:25 +02001242feature_not_found() {
1243 feature=$1
1244
1245 echo "ERROR"
1246 echo "ERROR: User requested feature $feature"
Sebastian Herbszt9332f6a2009-09-13 21:32:54 +02001247 echo "ERROR: configure was not able to find it"
Juan Quintela249247c2009-08-12 18:20:25 +02001248 echo "ERROR"
1249 exit 1;
1250}
1251
bellard7d132992003-03-06 23:23:54 +00001252if test -z "$cross_prefix" ; then
1253
1254# ---
1255# big/little endian test
1256cat > $TMPC << EOF
1257#include <inttypes.h>
1258int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +00001259 volatile uint32_t i=0x01234567;
1260 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +00001261}
1262EOF
1263
Juan Quintela52166aa2009-08-03 14:46:03 +02001264if compile_prog "" "" ; then
bellard7d132992003-03-06 23:23:54 +00001265$TMPE && bigendian="yes"
1266else
1267echo big/little test failed
1268fi
1269
1270else
1271
1272# if cross compiling, cannot launch a program, so make a static guess
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001273case "$cpu" in
Peter Maydell21d89f82011-11-30 10:57:48 +01001274 arm)
1275 # ARM can be either way; ask the compiler which one we are
1276 if check_define __ARMEB__; then
1277 bigendian=yes
1278 fi
1279 ;;
1280 hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001281 bigendian=yes
1282 ;;
1283esac
bellard7d132992003-03-06 23:23:54 +00001284
1285fi
1286
Paolo Bonzini70be1a22010-12-23 11:43:54 +01001287# host long bits test, actually a pointer size test
1288cat > $TMPC << EOF
1289int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
1290EOF
1291if compile_object; then
1292hostlongbits=64
1293else
1294hostlongbits=32
1295fi
bellardb6853692005-06-05 17:10:39 +00001296
Juan Quintelab0a47e72009-08-12 18:29:49 +02001297
1298##########################################
1299# NPTL probe
1300
1301if test "$nptl" != "no" ; then
1302 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00001303#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00001304#include <linux/futex.h>
Stefan Weil182eacc2011-12-17 09:27:30 +01001305int main(void) {
pbrookbd0c5662008-05-29 14:34:11 +00001306#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1307#error bork
1308#endif
Stefan Weil182eacc2011-12-17 09:27:30 +01001309 return 0;
pbrookbd0c5662008-05-29 14:34:11 +00001310}
1311EOF
1312
Juan Quintelab0a47e72009-08-12 18:29:49 +02001313 if compile_object ; then
1314 nptl=yes
1315 else
1316 if test "$nptl" = "yes" ; then
1317 feature_not_found "nptl"
1318 fi
1319 nptl=no
1320 fi
pbrookbd0c5662008-05-29 14:34:11 +00001321fi
1322
bellard11d9f692004-04-02 20:55:59 +00001323##########################################
balrogac629222008-10-11 09:56:04 +00001324# zlib check
1325
Alon Levy1ece9902011-07-26 12:30:40 +03001326if test "$zlib" != "no" ; then
1327 cat > $TMPC << EOF
balrogac629222008-10-11 09:56:04 +00001328#include <zlib.h>
1329int main(void) { zlibVersion(); return 0; }
1330EOF
Alon Levy1ece9902011-07-26 12:30:40 +03001331 if compile_prog "" "-lz" ; then
1332 :
1333 else
1334 echo
1335 echo "Error: zlib check failed"
1336 echo "Make sure to have the zlib libs and headers installed."
1337 echo
1338 exit 1
1339 fi
balrogac629222008-10-11 09:56:04 +00001340fi
1341
1342##########################################
aliguorie37630c2009-04-22 15:19:10 +00001343# xen probe
1344
Juan Quintelafc321b42009-08-12 18:29:55 +02001345if test "$xen" != "no" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +02001346 xen_libs="-lxenstore -lxenctrl -lxenguest"
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001347
Stefan Weil50ced5b2011-12-17 09:27:39 +01001348 # First we test whether Xen headers and libraries are available.
1349 # If no, we are done and there is no Xen support.
1350 # If yes, more tests are run to detect the Xen version.
1351
1352 # Xen (any)
Juan Quintelab2266be2009-07-27 16:13:16 +02001353 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00001354#include <xenctrl.h>
1355#include <xs.h>
Stefan Weil50ced5b2011-12-17 09:27:39 +01001356int main(void) {
1357 return 0;
1358}
1359EOF
1360 if ! compile_prog "" "$xen_libs" ; then
1361 # Xen not found
1362 if test "$xen" = "yes" ; then
1363 feature_not_found "xen"
1364 fi
1365 xen=no
1366
1367 # Xen unstable
1368 elif (
1369 cat > $TMPC <<EOF
1370#include <xenctrl.h>
1371#include <xs.h>
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001372#include <stdint.h>
1373#include <xen/hvm/hvm_info_table.h>
1374#if !defined(HVM_MAX_VCPUS)
1375# error HVM_MAX_VCPUS not defined
1376#endif
1377int main(void) {
1378 xc_interface *xc;
1379 xs_daemon_open();
1380 xc = xc_interface_open(0, 0, 0);
1381 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1382 xc_gnttab_open(NULL, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001383 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001384 return 0;
1385}
aliguorie37630c2009-04-22 15:19:10 +00001386EOF
Stefan Weil50ced5b2011-12-17 09:27:39 +01001387 compile_prog "" "$xen_libs"
1388 ) ; then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001389 xen_ctrl_version=410
Juan Quintelafc321b42009-08-12 18:29:55 +02001390 xen=yes
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001391
1392 # Xen 4.0.0
1393 elif (
1394 cat > $TMPC <<EOF
1395#include <xenctrl.h>
1396#include <xs.h>
1397#include <stdint.h>
1398#include <xen/hvm/hvm_info_table.h>
1399#if !defined(HVM_MAX_VCPUS)
1400# error HVM_MAX_VCPUS not defined
1401#endif
1402int main(void) {
Anthony PERARDb87de242011-05-24 14:34:20 +01001403 struct xen_add_to_physmap xatp = {
1404 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1405 };
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001406 xs_daemon_open();
1407 xc_interface_open();
1408 xc_gnttab_open();
1409 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001410 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001411 return 0;
1412}
1413EOF
1414 compile_prog "" "$xen_libs"
1415 ) ; then
1416 xen_ctrl_version=400
1417 xen=yes
1418
Anthony PERARDb87de242011-05-24 14:34:20 +01001419 # Xen 3.4.0
1420 elif (
1421 cat > $TMPC <<EOF
1422#include <xenctrl.h>
1423#include <xs.h>
1424int main(void) {
1425 struct xen_add_to_physmap xatp = {
1426 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1427 };
1428 xs_daemon_open();
1429 xc_interface_open();
1430 xc_gnttab_open();
1431 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1432 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1433 return 0;
1434}
1435EOF
1436 compile_prog "" "$xen_libs"
1437 ) ; then
1438 xen_ctrl_version=340
1439 xen=yes
1440
1441 # Xen 3.3.0
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001442 elif (
1443 cat > $TMPC <<EOF
1444#include <xenctrl.h>
1445#include <xs.h>
1446int main(void) {
1447 xs_daemon_open();
1448 xc_interface_open();
1449 xc_gnttab_open();
1450 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1451 return 0;
1452}
1453EOF
1454 compile_prog "" "$xen_libs"
1455 ) ; then
1456 xen_ctrl_version=330
1457 xen=yes
1458
Stefan Weil50ced5b2011-12-17 09:27:39 +01001459 # Xen version unsupported
Juan Quintelab2266be2009-07-27 16:13:16 +02001460 else
Juan Quintelafc321b42009-08-12 18:29:55 +02001461 if test "$xen" = "yes" ; then
Stefan Weil50ced5b2011-12-17 09:27:39 +01001462 feature_not_found "xen (unsupported version)"
Juan Quintelafc321b42009-08-12 18:29:55 +02001463 fi
1464 xen=no
Juan Quintelab2266be2009-07-27 16:13:16 +02001465 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001466
1467 if test "$xen" = yes; then
1468 libs_softmmu="$xen_libs $libs_softmmu"
1469 fi
aliguorie37630c2009-04-22 15:19:10 +00001470fi
1471
1472##########################################
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001473# pkg-config probe
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001474
Sergei Trofimovich17884d72012-01-31 22:03:45 +03001475if ! has "$pkg_config_exe"; then
1476 echo "Error: pkg-config binary '$pkg_config_exe' not found"
Peter Maydella213fcb2011-09-15 12:15:56 +01001477 exit 1
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001478fi
1479
1480##########################################
Alon Levy44dc0ca2011-05-15 11:51:28 +03001481# libtool probe
1482
Brad3f534582011-08-13 20:30:14 -04001483if ! has $libtool; then
Alon Levy44dc0ca2011-05-15 11:51:28 +03001484 libtool=
Alon Levy44dc0ca2011-05-15 11:51:28 +03001485fi
1486
1487##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02001488# Sparse probe
1489if test "$sparse" != "no" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001490 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02001491 sparse=yes
1492 else
1493 if test "$sparse" = "yes" ; then
1494 feature_not_found "sparse"
1495 fi
1496 sparse=no
1497 fi
1498fi
1499
1500##########################################
bellard11d9f692004-04-02 20:55:59 +00001501# SDL probe
1502
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001503# Look for sdl configuration program (pkg-config or sdl-config). Try
1504# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1505if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1506 sdl_config=sdl-config
1507fi
1508
1509if $pkg_config sdl --modversion >/dev/null 2>&1; then
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001510 sdlconfig="$pkg_config sdl"
Stefan Weilfec0e3e2010-04-11 18:44:18 +02001511 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001512elif has ${sdl_config}; then
1513 sdlconfig="$sdl_config"
Paolo Bonzini9316f802010-01-13 09:52:55 +01001514 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00001515else
1516 if test "$sdl" = "yes" ; then
1517 feature_not_found "sdl"
1518 fi
1519 sdl=no
Paolo Bonzini9316f802010-01-13 09:52:55 +01001520fi
Scott Wood29e5bad2011-04-08 14:15:50 -05001521if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001522 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1523fi
bellard11d9f692004-04-02 20:55:59 +00001524
Paolo Bonzini9316f802010-01-13 09:52:55 +01001525sdl_too_old=no
Juan Quintelac4198152009-08-12 18:29:53 +02001526if test "$sdl" != "no" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001527 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00001528#include <SDL.h>
1529#undef main /* We don't want SDL to override our main() */
1530int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1531EOF
Paolo Bonzini9316f802010-01-13 09:52:55 +01001532 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
TeLeMan74f42e12010-02-08 13:56:44 +08001533 if test "$static" = "yes" ; then
1534 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1535 else
1536 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1537 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001538 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001539 if test "$_sdlversion" -lt 121 ; then
1540 sdl_too_old=yes
1541 else
1542 if test "$cocoa" = "no" ; then
1543 sdl=yes
1544 fi
1545 fi
aliguoricd01b4a2008-08-21 19:25:45 +00001546
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001547 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Juan Quintelaac119f92009-07-27 16:13:15 +02001548 if test "$sdl" = "yes" -a "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001549 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weilf8aa6c72010-03-01 22:10:46 +01001550 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1551 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
Juan Quintelaac119f92009-07-27 16:13:15 +02001552 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001553 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001554 :
1555 else
1556 sdl=no
1557 fi
1558 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02001559 else # sdl not found
1560 if test "$sdl" = "yes" ; then
1561 feature_not_found "sdl"
1562 fi
1563 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02001564 fi # sdl compile test
Juan Quintelaa68551b2009-07-27 16:13:09 +02001565fi
bellard11d9f692004-04-02 20:55:59 +00001566
aliguori5368a422009-03-03 17:37:21 +00001567if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001568 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00001569#include <SDL.h>
1570#if defined(SDL_VIDEO_DRIVER_X11)
1571#include <X11/XKBlib.h>
1572#else
1573#error No x11 support
1574#endif
1575int main(void) { return 0; }
1576EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001577 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001578 sdl_libs="$sdl_libs -lX11"
1579 fi
Juan Quintela07056672009-08-03 14:46:27 +02001580 libs_softmmu="$sdl_libs $libs_softmmu"
aliguori5368a422009-03-03 17:37:21 +00001581fi
1582
ths8f28f3f2007-01-05 21:25:54 +00001583##########################################
ths8d5d2d42007-08-25 01:37:51 +00001584# VNC TLS detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001585if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
Juan Quintela1be10ad2009-08-12 18:20:28 +02001586 cat > $TMPC <<EOF
aliguoriae6b5e52008-08-06 16:55:50 +00001587#include <gnutls/gnutls.h>
1588int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1589EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001590 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1591 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
Juan Quintela1be10ad2009-08-12 18:20:28 +02001592 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1593 vnc_tls=yes
1594 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1595 else
1596 if test "$vnc_tls" = "yes" ; then
1597 feature_not_found "vnc-tls"
aliguoriae6b5e52008-08-06 16:55:50 +00001598 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02001599 vnc_tls=no
1600 fi
ths8d5d2d42007-08-25 01:37:51 +00001601fi
1602
1603##########################################
aliguori2f9606b2009-03-06 20:27:28 +00001604# VNC SASL detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001605if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02001606 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00001607#include <sasl/sasl.h>
1608#include <stdio.h>
1609int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1610EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02001611 # Assuming Cyrus-SASL installed in /usr prefix
1612 vnc_sasl_cflags=""
1613 vnc_sasl_libs="-lsasl2"
1614 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1615 vnc_sasl=yes
1616 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1617 else
1618 if test "$vnc_sasl" = "yes" ; then
1619 feature_not_found "vnc-sasl"
aliguori2f9606b2009-03-06 20:27:28 +00001620 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02001621 vnc_sasl=no
1622 fi
aliguori2f9606b2009-03-06 20:27:28 +00001623fi
1624
1625##########################################
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001626# VNC JPEG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001627if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001628cat > $TMPC <<EOF
1629#include <stdio.h>
1630#include <jpeglib.h>
1631int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1632EOF
1633 vnc_jpeg_cflags=""
1634 vnc_jpeg_libs="-ljpeg"
1635 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1636 vnc_jpeg=yes
1637 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1638 else
1639 if test "$vnc_jpeg" = "yes" ; then
1640 feature_not_found "vnc-jpeg"
1641 fi
1642 vnc_jpeg=no
1643 fi
1644fi
1645
1646##########################################
Corentin Charyefe556a2010-07-07 20:57:56 +02001647# VNC PNG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001648if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02001649cat > $TMPC <<EOF
1650//#include <stdio.h>
1651#include <png.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05001652#include <stddef.h>
Corentin Charyefe556a2010-07-07 20:57:56 +02001653int main(void) {
1654 png_structp png_ptr;
1655 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1656 return 0;
1657}
1658EOF
Brad9af80252011-07-30 01:45:55 -04001659 if $pkg_config libpng --modversion >/dev/null 2>&1; then
1660 vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
1661 vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
1662 else
Corentin Charyefe556a2010-07-07 20:57:56 +02001663 vnc_png_cflags=""
1664 vnc_png_libs="-lpng"
Brad9af80252011-07-30 01:45:55 -04001665 fi
Corentin Charyefe556a2010-07-07 20:57:56 +02001666 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1667 vnc_png=yes
1668 libs_softmmu="$vnc_png_libs $libs_softmmu"
Brad9af80252011-07-30 01:45:55 -04001669 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
Corentin Charyefe556a2010-07-07 20:57:56 +02001670 else
1671 if test "$vnc_png" = "yes" ; then
1672 feature_not_found "vnc-png"
1673 fi
1674 vnc_png=no
1675 fi
1676fi
1677
1678##########################################
aliguori76655d62009-03-06 20:27:37 +00001679# fnmatch() probe, used for ACL routines
1680fnmatch="no"
1681cat > $TMPC << EOF
1682#include <fnmatch.h>
1683int main(void)
1684{
1685 fnmatch("foo", "foo", 0);
1686 return 0;
1687}
1688EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001689if compile_prog "" "" ; then
aliguori76655d62009-03-06 20:27:37 +00001690 fnmatch="yes"
1691fi
1692
1693##########################################
Stefan Weilee682d22009-10-01 20:10:37 +02001694# uuid_generate() probe, used for vdi block driver
1695if test "$uuid" != "no" ; then
1696 uuid_libs="-luuid"
1697 cat > $TMPC << EOF
1698#include <uuid/uuid.h>
1699int main(void)
1700{
1701 uuid_t my_uuid;
1702 uuid_generate(my_uuid);
1703 return 0;
1704}
1705EOF
1706 if compile_prog "" "$uuid_libs" ; then
1707 uuid="yes"
1708 libs_softmmu="$uuid_libs $libs_softmmu"
1709 libs_tools="$uuid_libs $libs_tools"
1710 else
1711 if test "$uuid" = "yes" ; then
1712 feature_not_found "uuid"
1713 fi
1714 uuid=no
1715 fi
1716fi
1717
1718##########################################
Christoph Hellwigdce512d2010-12-17 11:41:15 +01001719# xfsctl() probe, used for raw-posix
1720if test "$xfs" != "no" ; then
1721 cat > $TMPC << EOF
Stefan Weilffc41d12011-12-17 09:27:36 +01001722#include <stddef.h> /* NULL */
Christoph Hellwigdce512d2010-12-17 11:41:15 +01001723#include <xfs/xfs.h>
1724int main(void)
1725{
1726 xfsctl(NULL, 0, 0, NULL);
1727 return 0;
1728}
1729EOF
1730 if compile_prog "" "" ; then
1731 xfs="yes"
1732 else
1733 if test "$xfs" = "yes" ; then
1734 feature_not_found "xfs"
1735 fi
1736 xfs=no
1737 fi
1738fi
1739
1740##########################################
ths8a16d272008-07-19 09:56:24 +00001741# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02001742if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02001743 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00001744 cat > $TMPC << EOF
1745#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00001746int main(void)
1747{
1748 struct vde_open_args a = {0, 0, 0};
1749 vde_open("", "", &a);
1750 return 0;
1751}
ths8a16d272008-07-19 09:56:24 +00001752EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001753 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02001754 vde=yes
Juan Quintela8e02e542009-08-03 14:47:07 +02001755 libs_softmmu="$vde_libs $libs_softmmu"
1756 libs_tools="$vde_libs $libs_tools"
Juan Quinteladfb278b2009-08-12 18:20:27 +02001757 else
1758 if test "$vde" = "yes" ; then
1759 feature_not_found "vde"
1760 fi
1761 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02001762 fi
ths8a16d272008-07-19 09:56:24 +00001763fi
1764
1765##########################################
Corey Bryant47e98652012-01-26 09:42:26 -05001766# libcap-ng library probe
1767if test "$cap_ng" != "no" ; then
1768 cap_libs="-lcap-ng"
1769 cat > $TMPC << EOF
1770#include <cap-ng.h>
1771int main(void)
1772{
1773 capng_capability_to_name(CAPNG_EFFECTIVE);
1774 return 0;
1775}
1776EOF
1777 if compile_prog "" "$cap_libs" ; then
1778 cap_ng=yes
1779 libs_tools="$cap_libs $libs_tools"
1780 else
1781 if test "$cap_ng" = "yes" ; then
1782 feature_not_found "cap_ng"
1783 fi
1784 cap_ng=no
1785 fi
1786fi
1787
1788##########################################
malcc2de5c92008-06-28 19:13:06 +00001789# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00001790
malcc2de5c92008-06-28 19:13:06 +00001791audio_drv_probe()
1792{
1793 drv=$1
1794 hdr=$2
1795 lib=$3
1796 exp=$4
1797 cfl=$5
1798 cat > $TMPC << EOF
1799#include <$hdr>
1800int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00001801EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001802 if compile_prog "$cfl" "$lib" ; then
malcc2de5c92008-06-28 19:13:06 +00001803 :
1804 else
1805 echo
1806 echo "Error: $drv check failed"
1807 echo "Make sure to have the $drv libs and headers installed."
1808 echo
1809 exit 1
1810 fi
1811}
1812
malc2fa7d3b2008-07-29 12:58:44 +00001813audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00001814for drv in $audio_drv_list; do
1815 case $drv in
1816 alsa)
1817 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1818 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001819 libs_softmmu="-lasound $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00001820 ;;
1821
1822 fmod)
1823 if test -z $fmod_lib || test -z $fmod_inc; then
1824 echo
1825 echo "Error: You must specify path to FMOD library and headers"
1826 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1827 echo
1828 exit 1
1829 fi
1830 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001831 libs_softmmu="$fmod_lib $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00001832 ;;
1833
1834 esd)
1835 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001836 libs_softmmu="-lesd $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02001837 audio_pt_int="yes"
malcc2de5c92008-06-28 19:13:06 +00001838 ;;
malcb8e59f12008-07-02 21:03:08 +00001839
1840 pa)
Aurelien Jarno493abda2009-11-16 17:52:03 +01001841 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
Marc-Antoine Perennou20fa53e2011-04-29 05:59:19 +00001842 "pa_simple *s = 0; pa_simple_free(s); return 0;"
Aurelien Jarno493abda2009-11-16 17:52:03 +01001843 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02001844 audio_pt_int="yes"
malcb8e59f12008-07-02 21:03:08 +00001845 ;;
1846
Juan Quintela997e6902009-08-03 14:46:29 +02001847 coreaudio)
1848 libs_softmmu="-framework CoreAudio $libs_softmmu"
1849 ;;
1850
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001851 dsound)
1852 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
malcd5631632009-10-10 01:13:41 +04001853 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001854 ;;
1855
1856 oss)
1857 libs_softmmu="$oss_lib $libs_softmmu"
1858 ;;
1859
1860 sdl|wav)
blueswir12f6a1ab2008-08-21 18:00:53 +00001861 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1862 ;;
1863
malcd5631632009-10-10 01:13:41 +04001864 winwave)
1865 libs_softmmu="-lwinmm $libs_softmmu"
1866 audio_win_int="yes"
1867 ;;
1868
malce4c63a62008-07-19 16:15:16 +00001869 *)
malc1c9b2a52008-07-19 16:57:30 +00001870 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001871 echo
1872 echo "Error: Unknown driver '$drv' selected"
1873 echo "Possible drivers are: $audio_possible_drivers"
1874 echo
1875 exit 1
1876 }
1877 ;;
malcc2de5c92008-06-28 19:13:06 +00001878 esac
1879done
ths8f28f3f2007-01-05 21:25:54 +00001880
balrog4d3b6f62008-02-10 16:33:14 +00001881##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001882# BrlAPI probe
1883
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001884if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001885 brlapi_libs="-lbrlapi"
1886 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00001887#include <brlapi.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05001888#include <stddef.h>
aurel322e4d9fb2008-04-08 06:01:02 +00001889int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1890EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001891 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001892 brlapi=yes
Juan Quintela264606b2009-08-03 14:46:39 +02001893 libs_softmmu="$brlapi_libs $libs_softmmu"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001894 else
1895 if test "$brlapi" = "yes" ; then
1896 feature_not_found "brlapi"
1897 fi
1898 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02001899 fi
1900fi
aurel322e4d9fb2008-04-08 06:01:02 +00001901
1902##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001903# curses probe
Stefan Weile095e2f2011-02-27 20:23:30 +01001904if test "$mingw32" = "yes" ; then
1905 curses_list="-lpdcurses"
1906else
1907 curses_list="-lncurses -lcurses"
1908fi
balrog4d3b6f62008-02-10 16:33:14 +00001909
Juan Quintelac584a6d2009-08-12 18:20:30 +02001910if test "$curses" != "no" ; then
1911 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00001912 cat > $TMPC << EOF
1913#include <curses.h>
Stefan Weilef9a2522011-12-17 17:46:02 +01001914int main(void) {
1915 const char *s = curses_version();
1916 resize_term(0, 0);
1917 return s != 0;
1918}
balrog4d3b6f62008-02-10 16:33:14 +00001919EOF
Juan Quintela4f78ef92009-08-12 18:20:23 +02001920 for curses_lib in $curses_list; do
1921 if compile_prog "" "$curses_lib" ; then
Juan Quintelac584a6d2009-08-12 18:20:30 +02001922 curses_found=yes
Juan Quintela4f78ef92009-08-12 18:20:23 +02001923 libs_softmmu="$curses_lib $libs_softmmu"
1924 break
1925 fi
1926 done
Juan Quintelac584a6d2009-08-12 18:20:30 +02001927 if test "$curses_found" = "yes" ; then
1928 curses=yes
1929 else
1930 if test "$curses" = "yes" ; then
1931 feature_not_found "curses"
1932 fi
1933 curses=no
1934 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02001935fi
balrog4d3b6f62008-02-10 16:33:14 +00001936
blueswir1414f0da2008-08-15 18:20:52 +00001937##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001938# curl probe
1939
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001940if $pkg_config libcurl --modversion >/dev/null 2>&1; then
1941 curlconfig="$pkg_config libcurl"
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01001942else
1943 curlconfig=curl-config
1944fi
1945
Juan Quintela788c8192009-08-12 18:29:47 +02001946if test "$curl" != "no" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001947 cat > $TMPC << EOF
1948#include <curl/curl.h>
Peter Maydell0b862ce2011-06-09 22:54:29 +01001949int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
Alexander Graf769ce762009-05-11 17:41:42 +02001950EOF
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01001951 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1952 curl_libs=`$curlconfig --libs 2>/dev/null`
Juan Quintelab1d5a272009-08-03 14:46:05 +02001953 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001954 curl=yes
Juan Quintelaf0302932009-08-03 14:47:08 +02001955 libs_tools="$curl_libs $libs_tools"
1956 libs_softmmu="$curl_libs $libs_softmmu"
Juan Quintela788c8192009-08-12 18:29:47 +02001957 else
1958 if test "$curl" = "yes" ; then
1959 feature_not_found "curl"
1960 fi
1961 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02001962 fi
1963fi # test "$curl"
1964
1965##########################################
balrogfb599c92008-09-28 23:49:55 +00001966# bluez support probe
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001967if test "$bluez" != "no" ; then
balroge820e3f2008-09-30 02:27:44 +00001968 cat > $TMPC << EOF
1969#include <bluetooth/bluetooth.h>
1970int main(void) { return bt_error(0); }
1971EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001972 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1973 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +02001974 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001975 bluez=yes
Juan Quintelae482d562009-08-03 14:46:37 +02001976 libs_softmmu="$bluez_libs $libs_softmmu"
balroge820e3f2008-09-30 02:27:44 +00001977 else
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001978 if test "$bluez" = "yes" ; then
1979 feature_not_found "bluez"
1980 fi
balroge820e3f2008-09-30 02:27:44 +00001981 bluez="no"
1982 fi
balrogfb599c92008-09-28 23:49:55 +00001983fi
1984
1985##########################################
Anthony Liguorie18df142011-07-19 14:50:29 -05001986# glib support probe
Stefan Hajnoczi4b76a482011-08-08 13:04:05 +05301987if $pkg_config --modversion gthread-2.0 > /dev/null 2>&1 ; then
1988 glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
1989 glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
Anthony Liguori14015302011-08-20 22:18:37 -05001990 LIBS="$glib_libs $LIBS"
Michael Roth957f1f92011-08-11 15:38:12 -05001991 libs_qga="$glib_libs $libs_qga"
Stefan Hajnoczi4b76a482011-08-08 13:04:05 +05301992else
1993 echo "glib-2.0 required to compile QEMU"
1994 exit 1
Anthony Liguorie18df142011-07-19 14:50:29 -05001995fi
1996
1997##########################################
M. Mohan Kumar17bff522011-12-14 13:58:42 +05301998# libcap probe
1999
2000if test "$cap" != "no" ; then
2001 cat > $TMPC <<EOF
2002#include <stdio.h>
2003#include <sys/capability.h>
2004int main(void) { cap_t caps; caps = cap_init(); }
2005EOF
2006 if compile_prog "" "-lcap" ; then
2007 cap=yes
2008 else
2009 cap=no
2010 fi
2011fi
2012
2013##########################################
aliguorie5d355d2009-04-24 18:03:15 +00002014# pthread probe
Brad4b29ec42011-08-07 20:02:11 -04002015PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00002016
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02002017pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00002018cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00002019#include <pthread.h>
Stefan Weil7a42bbe2011-12-17 09:27:32 +01002020static void *f(void *p) { return NULL; }
2021int main(void) {
2022 pthread_t thread;
2023 pthread_create(&thread, 0, f, 0);
2024 return 0;
2025}
blueswir1414f0da2008-08-15 18:20:52 +00002026EOF
Andreas Färberbd00d532010-09-20 00:50:44 +02002027if compile_prog "" "" ; then
2028 pthread=yes
2029else
2030 for pthread_lib in $PTHREADLIBS_LIST; do
2031 if compile_prog "" "$pthread_lib" ; then
2032 pthread=yes
2033 LIBS="$pthread_lib $LIBS"
2034 break
2035 fi
2036 done
2037fi
blueswir1414f0da2008-08-15 18:20:52 +00002038
Anthony Liguori4617e592009-08-25 17:21:56 -05002039if test "$mingw32" != yes -a "$pthread" = no; then
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02002040 echo
2041 echo "Error: pthread check failed"
2042 echo "Make sure to have the pthread libs and headers installed."
2043 echo
2044 exit 1
aliguorie5d355d2009-04-24 18:03:15 +00002045fi
2046
aliguoribf9298b2008-12-05 20:05:26 +00002047##########################################
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002048# rbd probe
2049if test "$rbd" != "no" ; then
2050 cat > $TMPC <<EOF
2051#include <stdio.h>
Josh Durginad32e9c2011-05-26 16:07:31 -07002052#include <rbd/librbd.h>
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002053int main(void) {
Josh Durginad32e9c2011-05-26 16:07:31 -07002054 rados_t cluster;
2055 rados_create(&cluster, NULL);
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002056 return 0;
2057}
2058EOF
Josh Durginad32e9c2011-05-26 16:07:31 -07002059 rbd_libs="-lrbd -lrados"
2060 if compile_prog "" "$rbd_libs" ; then
2061 rbd=yes
2062 libs_tools="$rbd_libs $libs_tools"
2063 libs_softmmu="$rbd_libs $libs_softmmu"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002064 else
2065 if test "$rbd" = "yes" ; then
2066 feature_not_found "rados block device"
2067 fi
2068 rbd=no
2069 fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002070fi
2071
2072##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002073# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002074
2075if test "$linux_aio" != "no" ; then
2076 cat > $TMPC <<EOF
2077#include <libaio.h>
2078#include <sys/eventfd.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002079#include <stddef.h>
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002080int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2081EOF
2082 if compile_prog "" "-laio" ; then
2083 linux_aio=yes
Paul Brook048d1792010-05-05 16:32:59 +01002084 libs_softmmu="$libs_softmmu -laio"
2085 libs_tools="$libs_tools -laio"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002086 else
2087 if test "$linux_aio" = "yes" ; then
2088 feature_not_found "linux AIO"
2089 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03002090 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002091 fi
2092fi
2093
2094##########################################
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002095# attr probe
2096
2097if test "$attr" != "no" ; then
2098 cat > $TMPC <<EOF
2099#include <stdio.h>
2100#include <sys/types.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002101#ifdef CONFIG_LIBATTR
2102#include <attr/xattr.h>
2103#else
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002104#include <sys/xattr.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002105#endif
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002106int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2107EOF
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002108 if compile_prog "" "" ; then
2109 attr=yes
2110 # Older distros have <attr/xattr.h>, and need -lattr:
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002111 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002112 attr=yes
2113 LIBS="-lattr $LIBS"
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002114 libattr=yes
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002115 else
2116 if test "$attr" = "yes" ; then
2117 feature_not_found "ATTR"
2118 fi
2119 attr=no
2120 fi
2121fi
2122
2123##########################################
aliguoribf9298b2008-12-05 20:05:26 +00002124# iovec probe
2125cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00002126#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00002127#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00002128#include <unistd.h>
Stefan Weilf91f9be2011-12-17 09:27:33 +01002129int main(void) { return sizeof(struct iovec); }
aliguoribf9298b2008-12-05 20:05:26 +00002130EOF
2131iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002132if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00002133 iovec=yes
2134fi
2135
aurel32f652e6a2008-12-16 10:43:48 +00002136##########################################
aliguoriceb42de2009-04-07 18:43:28 +00002137# preadv probe
2138cat > $TMPC <<EOF
2139#include <sys/types.h>
2140#include <sys/uio.h>
2141#include <unistd.h>
Stefan Weil84972cb2011-12-17 09:27:38 +01002142int main(void) { return preadv == preadv; }
aliguoriceb42de2009-04-07 18:43:28 +00002143EOF
2144preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002145if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00002146 preadv=yes
2147fi
2148
2149##########################################
aurel32f652e6a2008-12-16 10:43:48 +00002150# fdt probe
Juan Quintela2df87df2009-08-12 18:29:54 +02002151if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02002152 fdt_libs="-lfdt"
2153 cat > $TMPC << EOF
aurel32f652e6a2008-12-16 10:43:48 +00002154int main(void) { return 0; }
2155EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002156 if compile_prog "" "$fdt_libs" ; then
aurel32f652e6a2008-12-16 10:43:48 +00002157 fdt=yes
Juan Quintela2df87df2009-08-12 18:29:54 +02002158 else
2159 if test "$fdt" = "yes" ; then
2160 feature_not_found "fdt"
2161 fi
Michael Wallede3a3542011-04-26 00:24:07 +02002162 fdt_libs=
Juan Quintela2df87df2009-08-12 18:29:54 +02002163 fdt=no
aurel32f652e6a2008-12-16 10:43:48 +00002164 fi
2165fi
2166
Michael Walle20ff0752011-03-07 23:32:39 +01002167##########################################
2168# opengl probe, used by milkymist-tmu2
2169if test "$opengl" != "no" ; then
2170 opengl_libs="-lGL"
2171 cat > $TMPC << EOF
2172#include <X11/Xlib.h>
2173#include <GL/gl.h>
2174#include <GL/glx.h>
Stefan Weil84972cb2011-12-17 09:27:38 +01002175int main(void) { return GL_VERSION != 0; }
Michael Walle20ff0752011-03-07 23:32:39 +01002176EOF
2177 if compile_prog "" "-lGL" ; then
2178 opengl=yes
Michael Walle20ff0752011-03-07 23:32:39 +01002179 else
2180 if test "$opengl" = "yes" ; then
2181 feature_not_found "opengl"
2182 fi
Michael Wallede3a3542011-04-26 00:24:07 +02002183 opengl_libs=
Michael Walle20ff0752011-03-07 23:32:39 +01002184 opengl=no
2185 fi
2186fi
2187
aurel323b3f24a2009-04-15 16:12:13 +00002188#
2189# Check for xxxat() functions when we are building linux-user
2190# emulator. This is done because older glibc versions don't
2191# have syscall stubs for these implemented.
2192#
2193atfile=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03002194cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00002195#define _ATFILE_SOURCE
2196#include <sys/types.h>
2197#include <fcntl.h>
2198#include <unistd.h>
2199
2200int
2201main(void)
2202{
2203 /* try to unlink nonexisting file */
2204 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
2205}
2206EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002207if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03002208 atfile=yes
aurel323b3f24a2009-04-15 16:12:13 +00002209fi
2210
aurel3239386ac2009-04-15 19:48:17 +00002211# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00002212# emulator. This is done because older glibc versions don't
2213# have syscall stubs for these implemented. In that case we
2214# don't provide them even if kernel supports them.
2215#
2216inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03002217cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00002218#include <sys/inotify.h>
2219
2220int
2221main(void)
2222{
2223 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00002224 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00002225}
2226EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002227if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03002228 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00002229fi
2230
Riku Voipioc05c7a72010-03-26 15:25:11 +00002231inotify1=no
2232cat > $TMPC << EOF
2233#include <sys/inotify.h>
2234
2235int
2236main(void)
2237{
2238 /* try to start inotify */
2239 return inotify_init1(0);
2240}
2241EOF
2242if compile_prog "" "" ; then
2243 inotify1=yes
2244fi
2245
Riku Voipioebc996f2009-04-21 15:01:51 +03002246# check if utimensat and futimens are supported
2247utimens=no
2248cat > $TMPC << EOF
2249#define _ATFILE_SOURCE
Riku Voipioebc996f2009-04-21 15:01:51 +03002250#include <stddef.h>
2251#include <fcntl.h>
2252
2253int main(void)
2254{
2255 utimensat(AT_FDCWD, "foo", NULL, 0);
2256 futimens(0, NULL);
2257 return 0;
2258}
2259EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002260if compile_prog "" "" ; then
Riku Voipioebc996f2009-04-21 15:01:51 +03002261 utimens=yes
2262fi
2263
Riku Voipio099d6b02009-05-05 12:10:04 +03002264# check if pipe2 is there
2265pipe2=no
2266cat > $TMPC << EOF
Riku Voipio099d6b02009-05-05 12:10:04 +03002267#include <unistd.h>
2268#include <fcntl.h>
2269
2270int main(void)
2271{
2272 int pipefd[2];
2273 pipe2(pipefd, O_CLOEXEC);
2274 return 0;
2275}
2276EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002277if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03002278 pipe2=yes
2279fi
2280
Kevin Wolf40ff6d72009-12-02 12:24:42 +01002281# check if accept4 is there
2282accept4=no
2283cat > $TMPC << EOF
Kevin Wolf40ff6d72009-12-02 12:24:42 +01002284#include <sys/socket.h>
2285#include <stddef.h>
2286
2287int main(void)
2288{
2289 accept4(0, NULL, NULL, SOCK_CLOEXEC);
2290 return 0;
2291}
2292EOF
2293if compile_prog "" "" ; then
2294 accept4=yes
2295fi
2296
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302297# check if tee/splice is there. vmsplice was added same time.
2298splice=no
2299cat > $TMPC << EOF
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302300#include <unistd.h>
2301#include <fcntl.h>
2302#include <limits.h>
2303
2304int main(void)
2305{
Stefan Weil66ea0f22011-12-17 09:27:35 +01002306 int len, fd = 0;
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302307 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
2308 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
2309 return 0;
2310}
2311EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002312if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302313 splice=yes
2314fi
2315
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03002316##########################################
2317# signalfd probe
2318signalfd="no"
2319cat > $TMPC << EOF
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03002320#include <unistd.h>
2321#include <sys/syscall.h>
2322#include <signal.h>
2323int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2324EOF
2325
2326if compile_prog "" "" ; then
2327 signalfd=yes
2328fi
2329
Riku Voipioc2882b92009-08-12 15:08:24 +03002330# check if eventfd is supported
2331eventfd=no
2332cat > $TMPC << EOF
2333#include <sys/eventfd.h>
2334
2335int main(void)
2336{
Stefan Weil55cc7f32011-12-17 09:27:37 +01002337 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
Riku Voipioc2882b92009-08-12 15:08:24 +03002338}
2339EOF
2340if compile_prog "" "" ; then
2341 eventfd=yes
2342fi
2343
Ulrich Hechtd0927932009-09-17 20:22:14 +03002344# check for fallocate
2345fallocate=no
2346cat > $TMPC << EOF
2347#include <fcntl.h>
2348
2349int main(void)
2350{
2351 fallocate(0, 0, 0, 0);
2352 return 0;
2353}
2354EOF
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +02002355if compile_prog "$ARCH_CFLAGS" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03002356 fallocate=yes
2357fi
2358
Peter Maydellc727f472011-01-06 11:05:10 +00002359# check for sync_file_range
2360sync_file_range=no
2361cat > $TMPC << EOF
2362#include <fcntl.h>
2363
2364int main(void)
2365{
2366 sync_file_range(0, 0, 0, 0);
2367 return 0;
2368}
2369EOF
2370if compile_prog "$ARCH_CFLAGS" "" ; then
2371 sync_file_range=yes
2372fi
2373
Peter Maydelldace20d2011-01-10 13:11:24 +00002374# check for linux/fiemap.h and FS_IOC_FIEMAP
2375fiemap=no
2376cat > $TMPC << EOF
2377#include <sys/ioctl.h>
2378#include <linux/fs.h>
2379#include <linux/fiemap.h>
2380
2381int main(void)
2382{
2383 ioctl(0, FS_IOC_FIEMAP, 0);
2384 return 0;
2385}
2386EOF
2387if compile_prog "$ARCH_CFLAGS" "" ; then
2388 fiemap=yes
2389fi
2390
Ulrich Hechtd0927932009-09-17 20:22:14 +03002391# check for dup3
2392dup3=no
2393cat > $TMPC << EOF
2394#include <unistd.h>
2395
2396int main(void)
2397{
2398 dup3(0, 0, 0);
2399 return 0;
2400}
2401EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01002402if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03002403 dup3=yes
2404fi
2405
Peter Maydell3b6edd12011-02-15 18:35:05 +00002406# check for epoll support
2407epoll=no
2408cat > $TMPC << EOF
2409#include <sys/epoll.h>
2410
2411int main(void)
2412{
2413 epoll_create(0);
2414 return 0;
2415}
2416EOF
2417if compile_prog "$ARCH_CFLAGS" "" ; then
2418 epoll=yes
2419fi
2420
2421# epoll_create1 and epoll_pwait are later additions
2422# so we must check separately for their presence
2423epoll_create1=no
2424cat > $TMPC << EOF
2425#include <sys/epoll.h>
2426
2427int main(void)
2428{
Peter Maydell19e83f62011-04-26 16:56:40 +01002429 /* Note that we use epoll_create1 as a value, not as
2430 * a function being called. This is necessary so that on
2431 * old SPARC glibc versions where the function was present in
2432 * the library but not declared in the header file we will
2433 * fail the configure check. (Otherwise we will get a compiler
2434 * warning but not an error, and will proceed to fail the
2435 * qemu compile where we compile with -Werror.)
2436 */
Stefan Weil84972cb2011-12-17 09:27:38 +01002437 return epoll_create1 == epoll_create1;
Peter Maydell3b6edd12011-02-15 18:35:05 +00002438}
2439EOF
2440if compile_prog "$ARCH_CFLAGS" "" ; then
2441 epoll_create1=yes
2442fi
2443
2444epoll_pwait=no
2445cat > $TMPC << EOF
2446#include <sys/epoll.h>
2447
2448int main(void)
2449{
2450 epoll_pwait(0, 0, 0, 0, 0);
2451 return 0;
2452}
2453EOF
2454if compile_prog "$ARCH_CFLAGS" "" ; then
2455 epoll_pwait=yes
2456fi
2457
pbrookcc8ae6d2006-04-23 17:57:59 +00002458# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02002459if test "$docs" != "no" ; then
Stefan Weil01668d92010-03-04 22:21:02 +01002460 if has makeinfo && has pod2man; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02002461 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02002462 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02002463 if test "$docs" = "yes" ; then
2464 feature_not_found "docs"
Juan Quintela83a3ab82009-08-12 18:29:51 +02002465 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02002466 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02002467 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00002468fi
2469
Stefan Weilf514f412009-10-11 12:44:07 +02002470# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002471byteswap_h=no
2472cat > $TMPC << EOF
2473#include <byteswap.h>
2474int main(void) { return bswap_32(0); }
2475EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002476if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002477 byteswap_h=yes
2478fi
2479
Stefan Weilf514f412009-10-11 12:44:07 +02002480# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002481bswap_h=no
2482cat > $TMPC << EOF
2483#include <sys/endian.h>
2484#include <sys/types.h>
2485#include <machine/bswap.h>
2486int main(void) { return bswap32(0); }
2487EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002488if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002489 bswap_h=yes
2490fi
2491
aliguorida93a1f2008-12-12 20:02:52 +00002492##########################################
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11002493# Do we have libiscsi
2494if test "$libiscsi" != "no" ; then
2495 cat > $TMPC << EOF
2496#include <iscsi/iscsi.h>
2497int main(void) { iscsi_create_context(""); return 0; }
2498EOF
2499 if compile_prog "-Werror" "-liscsi" ; then
2500 libiscsi="yes"
2501 LIBS="$LIBS -liscsi"
2502 else
2503 if test "$libiscsi" = "yes" ; then
2504 feature_not_found "libiscsi"
2505 fi
2506 libiscsi="no"
2507 fi
2508fi
2509
2510
2511##########################################
aliguorida93a1f2008-12-12 20:02:52 +00002512# Do we need librt
2513cat > $TMPC <<EOF
2514#include <signal.h>
2515#include <time.h>
Stefan Weil66ea0f22011-12-17 09:27:35 +01002516int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
aliguorida93a1f2008-12-12 20:02:52 +00002517EOF
2518
Juan Quintela52166aa2009-08-03 14:46:03 +02002519if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02002520 :
Juan Quintela52166aa2009-08-03 14:46:03 +02002521elif compile_prog "" "-lrt" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02002522 LIBS="-lrt $LIBS"
aliguorida93a1f2008-12-12 20:02:52 +00002523fi
2524
Blue Swirl31ff5042009-09-12 12:33:07 +00002525if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
Andreas Färber179cf402010-09-20 00:50:43 +02002526 "$aix" != "yes" -a "$haiku" != "yes" ; then
Juan Quintela6362a532009-08-03 14:46:32 +02002527 libs_softmmu="-lutil $libs_softmmu"
2528fi
2529
Blue Swirlde5071c2009-09-12 09:58:46 +00002530##########################################
2531# check if the compiler defines offsetof
2532
2533need_offsetof=yes
2534cat > $TMPC << EOF
2535#include <stddef.h>
2536int main(void) { struct s { int f; }; return offsetof(struct s, f); }
2537EOF
2538if compile_prog "" "" ; then
2539 need_offsetof=no
2540fi
2541
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002542# spice probe
2543if test "$spice" != "no" ; then
2544 cat > $TMPC << EOF
2545#include <spice.h>
2546int main(void) { spice_server_new(); return 0; }
2547EOF
Jiri Denemark710fc4f2011-01-24 13:20:29 +01002548 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2549 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
Gerd Hoffmann012b80d2011-05-17 10:48:14 +02002550 if $pkg_config --atleast-version=0.6.0 spice-server >/dev/null 2>&1 && \
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002551 compile_prog "$spice_cflags" "$spice_libs" ; then
2552 spice="yes"
2553 libs_softmmu="$libs_softmmu $spice_libs"
2554 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2555 else
2556 if test "$spice" = "yes" ; then
2557 feature_not_found "spice"
2558 fi
2559 spice="no"
2560 fi
2561fi
2562
Robert Relyea111a38b2010-11-28 16:36:38 +02002563# check for libcacard for smartcard support
2564if test "$smartcard" != "no" ; then
2565 smartcard="yes"
2566 smartcard_cflags=""
2567 # TODO - what's the minimal nss version we support?
2568 if test "$smartcard_nss" != "no"; then
Sergei Trofimovich5f01e062012-01-31 22:03:58 +03002569 cat > $TMPC << EOF
2570#include <pk11pub.h>
2571int main(void) { PK11_FreeSlot(0); return 0; }
2572EOF
2573 smartcard_cflags="-I\$(SRC_PATH)/libcacard"
Alon Levy8c741c22012-02-26 17:09:22 +01002574 libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
2575 libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
Sergei Trofimovich5f01e062012-01-31 22:03:58 +03002576 if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \
2577 compile_prog "$smartcard_cflags $libcacard_cflags" "$libcacard_libs"; then
Robert Relyea111a38b2010-11-28 16:36:38 +02002578 smartcard_nss="yes"
Robert Relyea111a38b2010-11-28 16:36:38 +02002579 QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
Paul Brookad4cf3f2012-02-09 19:05:29 +00002580 libs_softmmu="$libcacard_libs $libs_softmmu"
Robert Relyea111a38b2010-11-28 16:36:38 +02002581 else
2582 if test "$smartcard_nss" = "yes"; then
2583 feature_not_found "nss"
2584 fi
2585 smartcard_nss="no"
2586 fi
2587 fi
2588fi
2589if test "$smartcard" = "no" ; then
2590 smartcard_nss="no"
2591fi
2592
Hans de Goede69354a82011-07-19 11:04:10 +02002593# check for usbredirparser for usb network redirection support
2594if test "$usb_redir" != "no" ; then
Hans de Goede6af16582012-01-25 09:50:39 +01002595 if $pkg_config --atleast-version=0.3.3 libusbredirparser >/dev/null 2>&1 ; then
Hans de Goede69354a82011-07-19 11:04:10 +02002596 usb_redir="yes"
2597 usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
2598 usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
2599 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
2600 LIBS="$LIBS $usb_redir_libs"
2601 else
2602 if test "$usb_redir" = "yes"; then
2603 feature_not_found "usb-redir"
2604 fi
2605 usb_redir="no"
2606 fi
2607fi
2608
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002609##########################################
2610
Blue Swirl747bbdf2009-10-18 16:26:06 +00002611##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002612# check if we have fdatasync
2613
2614fdatasync=no
2615cat > $TMPC << EOF
2616#include <unistd.h>
Alexandre Raymondd1722a22011-05-29 18:22:48 -04002617int main(void) {
2618#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2619return fdatasync(0);
2620#else
2621#abort Not supported
2622#endif
2623}
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002624EOF
2625if compile_prog "" "" ; then
2626 fdatasync=yes
2627fi
2628
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002629##########################################
Andreas Färbere78815a2010-09-25 11:26:05 +00002630# check if we have madvise
2631
2632madvise=no
2633cat > $TMPC << EOF
2634#include <sys/types.h>
2635#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002636#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00002637int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2638EOF
2639if compile_prog "" "" ; then
2640 madvise=yes
2641fi
2642
2643##########################################
2644# check if we have posix_madvise
2645
2646posix_madvise=no
2647cat > $TMPC << EOF
2648#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002649#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00002650int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2651EOF
2652if compile_prog "" "" ; then
2653 posix_madvise=yes
2654fi
2655
2656##########################################
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002657# check if trace backend exists
2658
Blue Swirl4c3b5a42011-01-20 20:54:21 +00002659sh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002660if test "$?" -ne 0 ; then
2661 echo
2662 echo "Error: invalid trace backend"
2663 echo "Please choose a supported trace backend."
2664 echo
2665 exit 1
2666fi
2667
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01002668##########################################
2669# For 'ust' backend, test if ust headers are present
2670if test "$trace_backend" = "ust"; then
2671 cat > $TMPC << EOF
2672#include <ust/tracepoint.h>
2673#include <ust/marker.h>
2674int main(void) { return 0; }
2675EOF
2676 if compile_prog "" "" ; then
2677 LIBS="-lust $LIBS"
2678 else
2679 echo
2680 echo "Error: Trace backend 'ust' missing libust header files"
2681 echo
2682 exit 1
2683 fi
2684fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00002685
2686##########################################
2687# For 'dtrace' backend, test if 'dtrace' command is present
2688if test "$trace_backend" = "dtrace"; then
2689 if ! has 'dtrace' ; then
2690 echo
2691 echo "Error: dtrace command is not found in PATH $PATH"
2692 echo
2693 exit 1
2694 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00002695 trace_backend_stap="no"
2696 if has 'stap' ; then
2697 trace_backend_stap="yes"
2698 fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00002699fi
2700
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01002701##########################################
Wolfgang Mauerer023367e2011-07-11 14:57:43 +02002702# __sync_fetch_and_and requires at least -march=i486. Many toolchains
2703# use i686 as default anyway, but for those that don't, an explicit
2704# specification is necessary
Stefan Weil1ba16962011-07-29 22:40:45 +02002705if test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
Wolfgang Mauerer023367e2011-07-11 14:57:43 +02002706 cat > $TMPC << EOF
2707int sfaa(unsigned *ptr)
2708{
2709 return __sync_fetch_and_and(ptr, 0);
2710}
2711
2712int main(int argc, char **argv)
2713{
2714 int val = 42;
2715 sfaa(&val);
2716 return val;
2717}
2718EOF
2719 if ! compile_prog "" "" ; then
2720 CFLAGS+="-march=i486"
2721 fi
2722fi
2723
2724##########################################
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05302725# check if we have makecontext
Peter Maydellcdf84802012-02-23 16:20:05 +00002726# (and that it's not a glibc stub which always returns -1)
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05302727
2728ucontext_coroutine=no
2729if test "$darwin" != "yes"; then
2730 cat > $TMPC << EOF
2731#include <ucontext.h>
Peter Maydellcdf84802012-02-23 16:20:05 +00002732#ifdef __stub_makecontext
2733#error Ignoring glibc stub makecontext which will always fail
2734#endif
Stefan Weil75cafad2011-12-17 09:27:29 +01002735int main(void) { makecontext(0, 0, 0); return 0; }
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05302736EOF
2737 if compile_prog "" "" ; then
2738 ucontext_coroutine=yes
2739 fi
2740fi
2741
2742##########################################
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05302743# check if we have open_by_handle_at
2744
2745open_by_hande_at=no
2746cat > $TMPC << EOF
2747#include <fcntl.h>
Stefan Weil75cafad2011-12-17 09:27:29 +01002748int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05302749EOF
2750if compile_prog "" "" ; then
2751 open_by_handle_at=yes
2752fi
2753
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05302754########################################
2755# check if we have linux/magic.h
2756
2757linux_magic_h=no
2758cat > $TMPC << EOF
2759#include <linux/magic.h>
2760int main(void) {
Stefan Weil75cafad2011-12-17 09:27:29 +01002761 return 0;
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05302762}
2763EOF
2764if compile_prog "" "" ; then
2765 linux_magic_h=yes
2766fi
2767
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05302768##########################################
Juan Quintelae86ecd42009-08-03 14:45:59 +02002769# End of CC checks
2770# After here, no more $cc or $ld runs
2771
Juan Quintelae86ecd42009-08-03 14:45:59 +02002772if test "$debug" = "no" ; then
Juan Quintela1156c662009-08-03 14:46:00 +02002773 CFLAGS="-O2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002774fi
Juan Quintelaa316e372009-09-30 01:10:55 +02002775
Juan Quintelae86ecd42009-08-03 14:45:59 +02002776# Consult white-list to determine whether to enable werror
2777# by default. Only enable by default for git builds
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002778z_version=`cut -f3 -d. $source_path/VERSION`
2779
Juan Quintelae86ecd42009-08-03 14:45:59 +02002780if test -z "$werror" ; then
Juan Quintelae86ecd42009-08-03 14:45:59 +02002781 if test "$z_version" = "50" -a \
2782 "$linux" = "yes" ; then
2783 werror="yes"
2784 else
2785 werror="no"
2786 fi
2787fi
2788
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002789# Disable zero malloc errors for official releases unless explicitly told to
2790# enable/disable
2791if test -z "$zero_malloc" ; then
2792 if test "$z_version" = "50" ; then
2793 zero_malloc="no"
2794 else
2795 zero_malloc="yes"
2796 fi
2797fi
2798
Juan Quintelae86ecd42009-08-03 14:45:59 +02002799if test "$werror" = "yes" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +02002800 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002801fi
2802
2803if test "$solaris" = "no" ; then
2804 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02002805 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002806 fi
2807fi
2808
Blue Swirl952afb72010-09-19 08:36:34 +00002809# Use ASLR, no-SEH and DEP if available
2810if test "$mingw32" = "yes" ; then
2811 for flag in --dynamicbase --no-seh --nxcompat; do
2812 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2813 LDFLAGS="-Wl,$flag $LDFLAGS"
2814 fi
2815 done
2816fi
2817
Paolo Bonzini190e9c52010-05-26 16:08:21 +02002818confdir=$sysconfdir$confsuffix
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02002819
Paolo Bonzinica35f782010-05-26 16:08:29 +02002820tools=
2821if test "$softmmu" = yes ; then
2822 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
M. Mohan Kumar17bff522011-12-14 13:58:42 +05302823 if [ "$cap" = "yes" -a "$linux" = "yes" ] ; then
2824 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
2825 fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02002826 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2827 tools="qemu-nbd\$(EXESUF) $tools"
Michael Rothd138cee2011-08-01 14:52:57 -05002828 if [ "$guest_agent" = "yes" ]; then
Michael Roth48ff7a62011-07-20 15:19:37 -05002829 tools="qemu-ga\$(EXESUF) $tools"
Michael Rothd138cee2011-08-01 14:52:57 -05002830 fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02002831 fi
2832fi
2833
2834# Mac OS X ships with a broken assembler
2835roms=
2836if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2837 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2838 "$softmmu" = yes ; then
2839 roms="optionrom"
2840fi
Andreas Färberd0384d12011-05-01 18:23:56 +02002841if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
David Gibson39ac8452011-04-01 15:15:23 +11002842 roms="$roms spapr-rtas"
2843fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02002844
bellard43ce4df2003-06-09 19:53:12 +00002845echo "Install prefix $prefix"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002846echo "BIOS directory `eval echo $datadir`"
2847echo "binary directory `eval echo $bindir`"
Alon Levy3aa5d2b2011-05-15 12:08:59 +03002848echo "library directory `eval echo $libdir`"
Alon Levy0f94d6d2011-06-27 11:58:20 +02002849echo "include directory `eval echo $includedir`"
Aurelien Jarno1c0fd162010-06-10 00:14:02 +02002850echo "config directory `eval echo $sysconfdir`"
bellard11d9f692004-04-02 20:55:59 +00002851if test "$mingw32" = "no" ; then
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002852echo "Manual directory `eval echo $mandir`"
bellard43ce4df2003-06-09 19:53:12 +00002853echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00002854fi
bellard5a671352003-10-01 00:13:48 +00002855echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00002856echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00002857echo "Host C compiler $host_cc"
Juan Quintela0c439cb2009-08-03 14:46:01 +02002858echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02002859echo "QEMU_CFLAGS $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02002860echo "LDFLAGS $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00002861echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00002862echo "install $install"
Blue Swirlc886edf2011-07-22 21:08:09 +00002863echo "python $python"
Brade2d88302011-09-02 16:53:28 -04002864if test "$slirp" = "yes" ; then
2865 echo "smbd $smbd"
2866fi
bellard43ce4df2003-06-09 19:53:12 +00002867echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00002868echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00002869echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00002870echo "tcg debug enabled $debug_tcg"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -02002871echo "Mon debug enabled $debug_mon"
bellard43ce4df2003-06-09 19:53:12 +00002872echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00002873echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00002874echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00002875echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00002876echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00002877echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00002878if test "$darwin" = "yes" ; then
2879 echo "Cocoa support $cocoa"
2880fi
bellard97a847b2003-08-10 21:36:04 +00002881echo "SDL support $sdl"
balrog4d3b6f62008-02-10 16:33:14 +00002882echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02002883echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00002884echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00002885echo "Audio drivers $audio_drv_list"
2886echo "Extra audio cards $audio_card_list"
Markus Armbrustereb852012009-10-27 18:41:44 +01002887echo "Block whitelist $block_drv_whitelist"
malc8ff9cbf2008-06-23 18:33:30 +00002888echo "Mixer emulation $mixemu"
Jes Sorensen821601e2011-03-16 13:33:36 +01002889echo "VNC support $vnc"
2890if test "$vnc" = "yes" ; then
2891 echo "VNC TLS support $vnc_tls"
2892 echo "VNC SASL support $vnc_sasl"
2893 echo "VNC JPEG support $vnc_jpeg"
2894 echo "VNC PNG support $vnc_png"
2895 echo "VNC thread $vnc_thread"
2896fi
blueswir131422552007-04-16 18:27:06 +00002897if test -n "$sparc_cpu"; then
2898 echo "Target Sparc Arch $sparc_cpu"
2899fi
aliguorie37630c2009-04-22 15:19:10 +00002900echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00002901echo "brlapi support $brlapi"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002902echo "bluez support $bluez"
Juan Quintelaa25dba12009-08-12 18:29:52 +02002903echo "Documentation $docs"
pbrookc5937222006-05-14 11:30:38 +00002904[ ! -z "$uname_release" ] && \
2905echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00002906echo "NPTL support $nptl"
Paul Brook379f6692009-07-17 12:48:08 +01002907echo "GUEST_BASE $guest_base"
Avi Kivity40d64442011-11-15 20:12:17 +02002908echo "PIE $pie"
ths8a16d272008-07-19 09:56:24 +00002909echo "vde support $vde"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002910echo "Linux AIO support $linux_aio"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002911echo "ATTR/XATTR support $attr"
ths77755342008-11-27 15:45:16 +00002912echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02002913echo "KVM support $kvm"
Stefan Weil9195b2c2011-10-19 07:07:18 +02002914echo "TCG interpreter $tcg_interpreter"
aurel32f652e6a2008-12-16 10:43:48 +00002915echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00002916echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002917echo "fdatasync $fdatasync"
Andreas Färbere78815a2010-09-25 11:26:05 +00002918echo "madvise $madvise"
2919echo "posix_madvise $posix_madvise"
Stefan Weilee682d22009-10-01 20:10:37 +02002920echo "uuid support $uuid"
Corey Bryant47e98652012-01-26 09:42:26 -05002921echo "libcap-ng support $cap_ng"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02002922echo "vhost-net support $vhost_net"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002923echo "Trace backend $trace_backend"
Prerna Saxena9410b562010-07-13 09:26:32 +01002924echo "Trace output file $trace_file-<pid>"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002925echo "spice support $spice"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002926echo "rbd support $rbd"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002927echo "xfsctl support $xfs"
Robert Relyea111a38b2010-11-28 16:36:38 +02002928echo "nss used $smartcard_nss"
Hans de Goede69354a82011-07-19 11:04:10 +02002929echo "usb net redir $usb_redir"
Michael Walle20ff0752011-03-07 23:32:39 +01002930echo "OpenGL support $opengl"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11002931echo "libiscsi support $libiscsi"
Michael Rothd138cee2011-08-01 14:52:57 -05002932echo "build guest agent $guest_agent"
bellard67b915a2004-03-31 23:37:16 +00002933
Stefan Weil1ba16962011-07-29 22:40:45 +02002934if test "$sdl_too_old" = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00002935echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00002936fi
bellard97a847b2003-08-10 21:36:04 +00002937
Juan Quintela98ec69a2009-07-16 18:34:18 +02002938config_host_mak="config-host.mak"
Juan Quintela4bf6b552009-07-22 22:37:40 +02002939config_host_ld="config-host.ld"
bellard97a847b2003-08-10 21:36:04 +00002940
Juan Quintela98ec69a2009-07-16 18:34:18 +02002941echo "# Automatically generated by configure - do not modify" > $config_host_mak
2942printf "# Configured with:" >> $config_host_mak
2943printf " '%s'" "$0" "$@" >> $config_host_mak
2944echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002945
Paolo Bonzinie6c3b0f2010-10-21 10:18:35 +02002946echo all: >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02002947echo "prefix=$prefix" >> $config_host_mak
2948echo "bindir=$bindir" >> $config_host_mak
Alon Levy3aa5d2b2011-05-15 12:08:59 +03002949echo "libdir=$libdir" >> $config_host_mak
Alon Levy0f94d6d2011-06-27 11:58:20 +02002950echo "includedir=$includedir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02002951echo "mandir=$mandir" >> $config_host_mak
2952echo "datadir=$datadir" >> $config_host_mak
2953echo "sysconfdir=$sysconfdir" >> $config_host_mak
2954echo "docdir=$docdir" >> $config_host_mak
Paolo Bonzini1dabe052010-05-26 16:08:25 +02002955echo "confdir=$confdir" >> $config_host_mak
Corey Bryant7b93fad2012-01-26 09:42:24 -05002956echo "libexecdir=\${prefix}/libexec" >> $config_host_mak
Corey Bryanta7c36ee2012-01-26 09:42:27 -05002957echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
2958echo "CONFIG_QEMU_HELPERDIR=\"$prefix/libexec\"" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002959
Juan Quintela98ec69a2009-07-16 18:34:18 +02002960echo "ARCH=$ARCH" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00002961if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002962 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00002963fi
Luiz Capitulinob4475aa2010-02-10 23:50:03 -02002964if test "$debug_mon" = "yes" ; then
2965 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2966fi
Paul Brookf3d08ee2009-06-04 11:39:04 +01002967if test "$debug" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002968 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
Paul Brookf3d08ee2009-06-04 11:39:04 +01002969fi
aliguori1625af82009-04-05 17:41:02 +00002970if test "$strip_opt" = "yes" ; then
Hollis Blanchard52ba7842010-08-04 17:21:34 -07002971 echo "STRIP=${strip}" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00002972fi
bellard7d132992003-03-06 23:23:54 +00002973if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02002974 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00002975fi
Juan Quintela2358a492009-07-27 16:13:25 +02002976echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00002977if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002978 echo "CONFIG_WIN32=y" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00002979 rc_version=`cat $source_path/VERSION`
2980 version_major=${rc_version%%.*}
2981 rc_version=${rc_version#*.}
2982 version_minor=${rc_version%%.*}
2983 rc_version=${rc_version#*.}
2984 version_subminor=${rc_version%%.*}
2985 version_micro=0
2986 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2987 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
pbrook210fa552007-02-27 21:04:49 +00002988else
Juan Quintela35f4df22009-07-27 16:13:07 +02002989 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00002990fi
blueswir1128ab2f2008-08-15 18:33:42 +00002991
Mark McLoughlindffcb712009-10-22 17:49:11 +01002992if test "$linux" = "yes" ; then
2993 echo "CONFIG_LINUX=y" >> $config_host_mak
2994fi
2995
bellard83fb7ad2004-07-05 21:25:26 +00002996if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002997 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00002998fi
malcb29fe3e2008-11-18 01:42:22 +00002999
3000if test "$aix" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003001 echo "CONFIG_AIX=y" >> $config_host_mak
malcb29fe3e2008-11-18 01:42:22 +00003002fi
3003
bellardec530c82006-04-25 22:36:06 +00003004if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003005 echo "CONFIG_SOLARIS=y" >> $config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02003006 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00003007 if test "$needs_libsunmath" = "yes" ; then
Juan Quintela75b5a692009-07-27 16:13:23 +02003008 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00003009 fi
bellardec530c82006-04-25 22:36:06 +00003010fi
Andreas Färber179cf402010-09-20 00:50:43 +02003011if test "$haiku" = "yes" ; then
3012 echo "CONFIG_HAIKU=y" >> $config_host_mak
3013fi
bellard97a847b2003-08-10 21:36:04 +00003014if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003015 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00003016fi
Stefan Weil1ba16962011-07-29 22:40:45 +02003017if test "$profiler" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003018 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00003019fi
bellardc20709a2004-04-21 23:27:19 +00003020if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003021 echo "CONFIG_SLIRP=y" >> $config_host_mak
Brade2d88302011-09-02 16:53:28 -04003022 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01003023 QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
bellardc20709a2004-04-21 23:27:19 +00003024fi
ths8a16d272008-07-19 09:56:24 +00003025if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003026 echo "CONFIG_VDE=y" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00003027fi
Corey Bryant47e98652012-01-26 09:42:26 -05003028if test "$cap_ng" = "yes" ; then
3029 echo "CONFIG_LIBCAP=y" >> $config_host_mak
3030fi
malc0c58ac12008-06-25 21:04:05 +00003031for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00003032 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02003033 echo "$def=y" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00003034done
Juan Quintela2358a492009-07-27 16:13:25 +02003035echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00003036for drv in $audio_drv_list; do
pbrookf6e58892008-06-29 01:00:34 +00003037 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02003038 echo "$def=y" >> $config_host_mak
malc923e4522008-07-02 18:13:46 +00003039 if test "$drv" = "fmod"; then
Juan Quintela7aac6cb2009-07-27 16:12:47 +02003040 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00003041 fi
3042done
Juan Quintela67f86e82009-08-03 14:46:59 +02003043if test "$audio_pt_int" = "yes" ; then
3044 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
3045fi
malcd5631632009-10-10 01:13:41 +04003046if test "$audio_win_int" = "yes" ; then
3047 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3048fi
Markus Armbrustereb852012009-10-27 18:41:44 +01003049echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00003050if test "$mixemu" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003051 echo "CONFIG_MIXEMU=y" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00003052fi
Jes Sorensen821601e2011-03-16 13:33:36 +01003053if test "$vnc" = "yes" ; then
3054 echo "CONFIG_VNC=y" >> $config_host_mak
3055fi
ths8d5d2d42007-08-25 01:37:51 +00003056if test "$vnc_tls" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003057 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
Juan Quintela525061b2009-07-27 16:12:43 +02003058 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
ths8d5d2d42007-08-25 01:37:51 +00003059fi
aliguori2f9606b2009-03-06 20:27:28 +00003060if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003061 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
Juan Quintela60ddf532009-07-27 16:12:45 +02003062 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00003063fi
Jes Sorensen821601e2011-03-16 13:33:36 +01003064if test "$vnc_jpeg" = "yes" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003065 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
3066 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
3067fi
Jes Sorensen821601e2011-03-16 13:33:36 +01003068if test "$vnc_png" = "yes" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02003069 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3070 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
3071fi
Jes Sorensen821601e2011-03-16 13:33:36 +01003072if test "$vnc_thread" = "yes" ; then
Corentin Charybd023f92010-07-07 20:58:02 +02003073 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
Corentin Charybd023f92010-07-07 20:58:02 +02003074fi
aliguori76655d62009-03-06 20:27:37 +00003075if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003076 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00003077fi
Stefan Weilee682d22009-10-01 20:10:37 +02003078if test "$uuid" = "yes" ; then
3079 echo "CONFIG_UUID=y" >> $config_host_mak
3080fi
Christoph Hellwigdce512d2010-12-17 11:41:15 +01003081if test "$xfs" = "yes" ; then
3082 echo "CONFIG_XFS=y" >> $config_host_mak
3083fi
pbrookb1a550a2006-04-16 13:28:56 +00003084qemu_version=`head $source_path/VERSION`
Juan Quintela98ec69a2009-07-16 18:34:18 +02003085echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02003086echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02003087echo "SRC_PATH=$source_path" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02003088echo "TARGET_DIRS=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02003089if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003090 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00003091fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02003092if test "$sdl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003093 echo "CONFIG_SDL=y" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02003094 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00003095fi
3096if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003097 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00003098fi
3099if test "$curses" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003100 echo "CONFIG_CURSES=y" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00003101fi
aurel323b3f24a2009-04-15 16:12:13 +00003102if test "$atfile" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003103 echo "CONFIG_ATFILE=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00003104fi
Riku Voipioebc996f2009-04-21 15:01:51 +03003105if test "$utimens" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003106 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
Riku Voipioebc996f2009-04-21 15:01:51 +03003107fi
Riku Voipio099d6b02009-05-05 12:10:04 +03003108if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003109 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03003110fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01003111if test "$accept4" = "yes" ; then
3112 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
3113fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303114if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003115 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303116fi
Riku Voipioc2882b92009-08-12 15:08:24 +03003117if test "$eventfd" = "yes" ; then
3118 echo "CONFIG_EVENTFD=y" >> $config_host_mak
3119fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03003120if test "$fallocate" = "yes" ; then
3121 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3122fi
Peter Maydellc727f472011-01-06 11:05:10 +00003123if test "$sync_file_range" = "yes" ; then
3124 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3125fi
Peter Maydelldace20d2011-01-10 13:11:24 +00003126if test "$fiemap" = "yes" ; then
3127 echo "CONFIG_FIEMAP=y" >> $config_host_mak
3128fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03003129if test "$dup3" = "yes" ; then
3130 echo "CONFIG_DUP3=y" >> $config_host_mak
3131fi
Peter Maydell3b6edd12011-02-15 18:35:05 +00003132if test "$epoll" = "yes" ; then
3133 echo "CONFIG_EPOLL=y" >> $config_host_mak
3134fi
3135if test "$epoll_create1" = "yes" ; then
3136 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
3137fi
3138if test "$epoll_pwait" = "yes" ; then
3139 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
3140fi
aurel323b3f24a2009-04-15 16:12:13 +00003141if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003142 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00003143fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00003144if test "$inotify1" = "yes" ; then
3145 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3146fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003147if test "$byteswap_h" = "yes" ; then
3148 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
3149fi
3150if test "$bswap_h" = "yes" ; then
3151 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
3152fi
Alexander Graf769ce762009-05-11 17:41:42 +02003153if test "$curl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003154 echo "CONFIG_CURL=y" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02003155 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02003156fi
aurel322e4d9fb2008-04-08 06:01:02 +00003157if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003158 echo "CONFIG_BRLAPI=y" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00003159fi
balrogfb599c92008-09-28 23:49:55 +00003160if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003161 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02003162 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00003163fi
Anthony Liguorie18df142011-07-19 14:50:29 -05003164echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00003165if test "$xen" = "yes" ; then
Jan Kiszka6dbd5882011-06-21 22:59:07 +02003166 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00003167 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00003168fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003169if test "$linux_aio" = "yes" ; then
3170 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
3171fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003172if test "$attr" = "yes" ; then
3173 echo "CONFIG_ATTR=y" >> $config_host_mak
3174fi
Avi Kivity4f26f2b2011-11-09 14:44:52 +02003175if test "$libattr" = "yes" ; then
3176 echo "CONFIG_LIBATTR=y" >> $config_host_mak
3177fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003178if test "$linux" = "yes" ; then
3179 if test "$attr" = "yes" ; then
3180 echo "CONFIG_VIRTFS=y" >> $config_host_mak
3181 fi
3182fi
ths77755342008-11-27 15:45:16 +00003183if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003184 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00003185fi
aliguoribf9298b2008-12-05 20:05:26 +00003186if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003187 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00003188fi
aliguoriceb42de2009-04-07 18:43:28 +00003189if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003190 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00003191fi
aurel32f652e6a2008-12-16 10:43:48 +00003192if test "$fdt" = "yes" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02003193 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00003194fi
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03003195if test "$signalfd" = "yes" ; then
3196 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3197fi
Stefan Weil9195b2c2011-10-19 07:07:18 +02003198if test "$tcg_interpreter" = "yes" ; then
3199 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
3200fi
Blue Swirlde5071c2009-09-12 09:58:46 +00003201if test "$need_offsetof" = "yes" ; then
3202 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
3203fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00003204if test "$fdatasync" = "yes" ; then
3205 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
3206fi
Andreas Färbere78815a2010-09-25 11:26:05 +00003207if test "$madvise" = "yes" ; then
3208 echo "CONFIG_MADVISE=y" >> $config_host_mak
3209fi
3210if test "$posix_madvise" = "yes" ; then
3211 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3212fi
bellard97a847b2003-08-10 21:36:04 +00003213
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003214if test "$spice" = "yes" ; then
3215 echo "CONFIG_SPICE=y" >> $config_host_mak
3216fi
3217
Alon Levy36707142010-10-17 11:40:07 +02003218if test "$smartcard" = "yes" ; then
3219 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
3220fi
3221
Robert Relyea111a38b2010-11-28 16:36:38 +02003222if test "$smartcard_nss" = "yes" ; then
3223 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
Paul Brookad4cf3f2012-02-09 19:05:29 +00003224 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3225 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
Robert Relyea111a38b2010-11-28 16:36:38 +02003226fi
3227
Hans de Goede69354a82011-07-19 11:04:10 +02003228if test "$usb_redir" = "yes" ; then
3229 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
3230fi
3231
Michael Walle20ff0752011-03-07 23:32:39 +01003232if test "$opengl" = "yes" ; then
3233 echo "CONFIG_OPENGL=y" >> $config_host_mak
3234fi
3235
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003236if test "$libiscsi" = "yes" ; then
3237 echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3238fi
3239
bellard83fb7ad2004-07-05 21:25:26 +00003240# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00003241if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003242 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00003243fi
3244
Juan Quintela2358a492009-07-27 16:13:25 +02003245echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
pbrookc5937222006-05-14 11:30:38 +00003246
Anthony Liguori20ff6c82009-12-09 12:59:36 -06003247if test "$zero_malloc" = "yes" ; then
3248 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
3249fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003250if test "$rbd" = "yes" ; then
3251 echo "CONFIG_RBD=y" >> $config_host_mak
3252fi
Anthony Liguori20ff6c82009-12-09 12:59:36 -06003253
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303254if test "$ucontext_coroutine" = "yes" ; then
3255 echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3256fi
3257
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303258if test "$open_by_handle_at" = "yes" ; then
3259 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3260fi
3261
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05303262if test "$linux_magic_h" = "yes" ; then
3263 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3264fi
3265
blueswir168063642008-11-22 21:03:55 +00003266# USB host support
3267case "$usb" in
3268linux)
Juan Quintela98ec69a2009-07-16 18:34:18 +02003269 echo "HOST_USB=linux" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00003270;;
3271bsd)
Juan Quintela98ec69a2009-07-16 18:34:18 +02003272 echo "HOST_USB=bsd" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00003273;;
3274*)
Juan Quintela98ec69a2009-07-16 18:34:18 +02003275 echo "HOST_USB=stub" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00003276;;
3277esac
3278
Lluíse4858972011-08-31 20:31:03 +02003279# use default implementation for tracing backend-specific routines
3280trace_default=yes
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003281echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
Lluís6d8a7642011-08-31 20:30:43 +02003282if test "$trace_backend" = "nop"; then
3283 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
Prerna Saxena22890ab2010-06-24 17:04:53 +05303284fi
Prerna Saxena9410b562010-07-13 09:26:32 +01003285if test "$trace_backend" = "simple"; then
Lluís6d8a7642011-08-31 20:30:43 +02003286 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02003287 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02003288 # Set the appropriate trace file.
Andreas Färber953ffe02011-06-02 19:58:06 +02003289 trace_file="\"$trace_file-\" FMT_pid"
Prerna Saxena9410b562010-07-13 09:26:32 +01003290fi
Lluís6d8a7642011-08-31 20:30:43 +02003291if test "$trace_backend" = "stderr"; then
3292 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
Lluís9a82b6a2011-08-31 20:31:51 +02003293 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02003294fi
3295if test "$trace_backend" = "ust"; then
3296 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
3297fi
3298if test "$trace_backend" = "dtrace"; then
3299 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
3300 if test "$trace_backend_stap" = "yes" ; then
3301 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
3302 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00003303fi
Prerna Saxena9410b562010-07-13 09:26:32 +01003304echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02003305if test "$trace_default" = "yes"; then
3306 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3307fi
Prerna Saxena9410b562010-07-13 09:26:32 +01003308
Juan Quintela98ec69a2009-07-16 18:34:18 +02003309echo "TOOLS=$tools" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02003310echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003311echo "MAKE=$make" >> $config_host_mak
3312echo "INSTALL=$install" >> $config_host_mak
Brad1901cb12011-08-28 04:01:33 -04003313echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
3314echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
3315echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
Blue Swirlc886edf2011-07-22 21:08:09 +00003316echo "PYTHON=$python" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003317echo "CC=$cc" >> $config_host_mak
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02003318echo "CC_I386=$cc_i386" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003319echo "HOST_CC=$host_cc" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003320echo "AR=$ar" >> $config_host_mak
3321echo "OBJCOPY=$objcopy" >> $config_host_mak
3322echo "LD=$ld" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00003323echo "WINDRES=$windres" >> $config_host_mak
Alon Levy44dc0ca2011-05-15 11:51:28 +03003324echo "LIBTOOL=$libtool" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02003325echo "CFLAGS=$CFLAGS" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02003326echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01003327echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01003328if test "$sparse" = "yes" ; then
3329 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
3330 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
3331 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3332fi
Juan Quintelac81da562009-08-03 14:46:24 +02003333echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02003334echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Juan Quintelaa36abbb2009-08-03 14:45:56 +02003335echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3336echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02003337echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02003338echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003339echo "EXESUF=$EXESUF" >> $config_host_mak
Michael Roth957f1f92011-08-11 15:38:12 -05003340echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003341
Juan Quintela4bf6b552009-07-22 22:37:40 +02003342# generate list of library paths for linker script
3343
3344$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
3345
3346if test -f ${config_host_ld}~ ; then
3347 if cmp -s $config_host_ld ${config_host_ld}~ ; then
3348 mv ${config_host_ld}~ $config_host_ld
3349 else
3350 rm ${config_host_ld}~
3351 fi
3352fi
3353
Blue Swirl4d904532010-03-21 08:28:47 +00003354for d in libdis libdis-user; do
3355 mkdir -p $d
Paolo Bonzini11568d62010-12-23 11:43:58 +01003356 symlink $source_path/Makefile.dis $d/Makefile
Blue Swirl4d904532010-03-21 08:28:47 +00003357 echo > $d/config.mak
3358done
3359
Peter Maydell6efd7512011-11-30 11:59:04 +00003360# use included Linux headers
3361if test "$linux" = "yes" ; then
3362 mkdir -p linux-headers
3363 case "$cpu" in
3364 i386|x86_64)
3365 symlink $source_path/linux-headers/asm-x86 linux-headers/asm
3366 ;;
3367 ppcemb|ppc|ppc64)
3368 symlink $source_path/linux-headers/asm-powerpc linux-headers/asm
3369 ;;
3370 s390x)
3371 symlink $source_path/linux-headers/asm-s390 linux-headers/asm
3372 ;;
3373 esac
3374fi
3375
bellard1d14ffa2005-10-30 18:58:22 +00003376for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00003377target_dir="$target"
Juan Quintela25be210f2009-10-07 02:41:00 +02003378config_target_mak=$target_dir/config-target.mak
Blue Swirl600309b2009-07-03 17:44:00 +00003379target_arch2=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00003380target_bigendian="no"
Juan Quintela1f3d3c82009-10-07 02:41:02 +02003381
Juan Quintelaea2d6a32009-07-16 18:34:10 +02003382case "$target_arch2" in
Max Filippovcfa550c2011-09-06 03:55:26 +04003383 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
Juan Quintelaea2d6a32009-07-16 18:34:10 +02003384 target_bigendian=yes
3385 ;;
3386esac
bellard97a847b2003-08-10 21:36:04 +00003387target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00003388target_user_only="no"
ths831b7822007-01-18 20:06:33 +00003389target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00003390target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00003391target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00003392case "$target" in
Blue Swirl600309b2009-07-03 17:44:00 +00003393 ${target_arch2}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00003394 target_softmmu="yes"
3395 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00003396 ${target_arch2}-linux-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00003397 if test "$linux" != "yes" ; then
3398 echo "ERROR: Target '$target' is only available on a Linux host"
3399 exit 1
3400 fi
pbrook9e407a82007-05-26 16:38:53 +00003401 target_user_only="yes"
3402 target_linux_user="yes"
3403 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00003404 ${target_arch2}-darwin-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00003405 if test "$darwin" != "yes" ; then
3406 echo "ERROR: Target '$target' is only available on a Darwin host"
3407 exit 1
3408 fi
pbrook9e407a82007-05-26 16:38:53 +00003409 target_user_only="yes"
3410 target_darwin_user="yes"
3411 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00003412 ${target_arch2}-bsd-user)
Blue Swirl9cf55762009-11-17 21:27:18 +00003413 if test "$bsd" != "yes" ; then
Blue Swirl9c7a4202009-11-17 20:52:56 +00003414 echo "ERROR: Target '$target' is only available on a BSD host"
3415 exit 1
3416 fi
blueswir184778502008-10-26 20:33:16 +00003417 target_user_only="yes"
3418 target_bsd_user="yes"
3419 ;;
pbrook9e407a82007-05-26 16:38:53 +00003420 *)
3421 echo "ERROR: Target '$target' not recognised"
3422 exit 1
3423 ;;
3424esac
ths831b7822007-01-18 20:06:33 +00003425
bellard97a847b2003-08-10 21:36:04 +00003426mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00003427mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00003428mkdir -p $target_dir/tcg
Gerd Hoffmann59f2a782009-08-20 15:22:26 +02003429mkdir -p $target_dir/ide
Aneesh Kumar K.V353ac782011-01-28 18:09:08 +05303430mkdir -p $target_dir/9pfs
Jan Kiszka3b9a6ee2011-10-15 10:01:27 +02003431mkdir -p $target_dir/kvm
blueswir184778502008-10-26 20:33:16 +00003432if 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 +00003433 mkdir -p $target_dir/nwfpe
3434fi
Paolo Bonzini11568d62010-12-23 11:43:58 +01003435symlink $source_path/Makefile.target $target_dir/Makefile
bellardec530c82006-04-25 22:36:06 +00003436
bellard97a847b2003-08-10 21:36:04 +00003437
Juan Quintela25be210f2009-10-07 02:41:00 +02003438echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00003439
pbrooke5fe0c52006-06-11 13:32:59 +00003440bflt="no"
pbrookbd0c5662008-05-29 14:34:11 +00003441target_nptl="no"
Blue Swirl600309b2009-07-03 17:44:00 +00003442interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
pbrook56aebc82008-10-11 17:55:29 +00003443gdb_xml_files=""
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003444target_short_alignment=2
3445target_int_alignment=4
3446target_long_alignment=4
3447target_llong_alignment=8
Michael Wallede3a3542011-04-26 00:24:07 +02003448target_libs_softmmu=
aliguori7ba1e612008-11-05 16:04:33 +00003449
Juan Quintela938b1ed2009-07-16 18:34:12 +02003450TARGET_ARCH="$target_arch2"
Juan Quintela6acff7d2009-07-16 18:34:15 +02003451TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02003452TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02003453
Blue Swirl600309b2009-07-03 17:44:00 +00003454case "$target_arch2" in
aurel322408a522008-04-20 20:19:44 +00003455 i386)
Aurelien Jarno71deff22011-02-09 19:35:50 +01003456 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003457 ;;
3458 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02003459 TARGET_BASE_ARCH=i386
Paul Brook1ad21342009-05-19 16:17:58 +01003460 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003461 target_long_alignment=8
aurel322408a522008-04-20 20:19:44 +00003462 ;;
3463 alpha)
Paul Brook1ad21342009-05-19 16:17:58 +01003464 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003465 target_long_alignment=8
Richard Hendersona4b388f2010-04-12 16:17:22 -07003466 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00003467 ;;
3468 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003469 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00003470 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00003471 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00003472 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003473 target_phys_bits=32
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003474 target_llong_alignment=4
aurel322408a522008-04-20 20:19:44 +00003475 ;;
3476 cris)
edgar_igl253bd7f2009-01-07 20:07:09 +00003477 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01003478 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00003479 ;;
Michael Walle613a22c2011-02-17 23:45:17 +01003480 lm32)
3481 target_phys_bits=32
Michael Wallede3a3542011-04-26 00:24:07 +02003482 target_libs_softmmu="$opengl_libs"
Michael Walle613a22c2011-02-17 23:45:17 +01003483 ;;
aurel322408a522008-04-20 20:19:44 +00003484 m68k)
aurel322408a522008-04-20 20:19:44 +00003485 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00003486 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003487 target_phys_bits=32
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003488 target_int_alignment=2
3489 target_long_alignment=2
3490 target_llong_alignment=2
aurel322408a522008-04-20 20:19:44 +00003491 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01003492 microblaze|microblazeel)
3493 TARGET_ARCH=microblaze
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02003494 bflt="yes"
3495 target_nptl="yes"
3496 target_phys_bits=32
Michael Wallede3a3542011-04-26 00:24:07 +02003497 target_libs_softmmu="$fdt_libs"
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02003498 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02003499 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003500 TARGET_ARCH=mips
Juan Quintela25be210f2009-10-07 02:41:00 +02003501 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
Paul Brookf04dc722009-07-09 17:56:24 +01003502 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01003503 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003504 ;;
3505 mipsn32|mipsn32el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003506 TARGET_ARCH=mipsn32
Juan Quintela6acff7d2009-07-16 18:34:15 +02003507 TARGET_BASE_ARCH=mips
Juan Quintela25be210f2009-10-07 02:41:00 +02003508 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01003509 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003510 ;;
3511 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003512 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02003513 TARGET_BASE_ARCH=mips
Juan Quintela25be210f2009-10-07 02:41:00 +02003514 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01003515 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003516 target_long_alignment=8
aurel322408a522008-04-20 20:19:44 +00003517 ;;
3518 ppc)
aurel32c8b35322009-01-24 15:07:34 +00003519 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Alexander Graf8b242eb2011-10-18 01:46:08 +02003520 target_phys_bits=64
Nathan Froydd6630702009-08-03 08:43:28 -07003521 target_nptl="yes"
Michael Wallede3a3542011-04-26 00:24:07 +02003522 target_libs_softmmu="$fdt_libs"
aurel322408a522008-04-20 20:19:44 +00003523 ;;
3524 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02003525 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02003526 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00003527 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003528 target_phys_bits=64
Nathan Froydd6630702009-08-03 08:43:28 -07003529 target_nptl="yes"
Michael Wallede3a3542011-04-26 00:24:07 +02003530 target_libs_softmmu="$fdt_libs"
aurel322408a522008-04-20 20:19:44 +00003531 ;;
3532 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02003533 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02003534 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00003535 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003536 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003537 target_long_alignment=8
Michael Wallede3a3542011-04-26 00:24:07 +02003538 target_libs_softmmu="$fdt_libs"
aurel322408a522008-04-20 20:19:44 +00003539 ;;
3540 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003541 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02003542 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02003543 TARGET_ABI_DIR=ppc
Juan Quintela25be210f2009-10-07 02:41:00 +02003544 echo "TARGET_ABI32=y" >> $config_target_mak
aurel32c8b35322009-01-24 15:07:34 +00003545 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003546 target_phys_bits=64
Michael Wallede3a3542011-04-26 00:24:07 +02003547 target_libs_softmmu="$fdt_libs"
aurel322408a522008-04-20 20:19:44 +00003548 ;;
3549 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003550 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00003551 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00003552 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01003553 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00003554 ;;
3555 sparc)
Paul Brook1ad21342009-05-19 16:17:58 +01003556 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003557 ;;
3558 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02003559 TARGET_BASE_ARCH=sparc
Paul Brook1ad21342009-05-19 16:17:58 +01003560 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003561 target_long_alignment=8
aurel322408a522008-04-20 20:19:44 +00003562 ;;
3563 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003564 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02003565 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02003566 TARGET_ABI_DIR=sparc
Juan Quintela25be210f2009-10-07 02:41:00 +02003567 echo "TARGET_ABI32=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01003568 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003569 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01003570 s390x)
Ulrich Hechtbc434672011-03-29 15:29:33 +02003571 target_nptl="yes"
Alexander Graf24e804ec2009-12-05 12:44:22 +01003572 target_phys_bits=64
Alexander Graf7b3da902011-04-04 16:32:11 +02003573 target_long_alignment=8
Alexander Graf24e804ec2009-12-05 12:44:22 +01003574 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +08003575 unicore32)
3576 target_phys_bits=32
3577 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04003578 xtensa|xtensaeb)
3579 TARGET_ARCH=xtensa
3580 target_phys_bits=32
3581 ;;
aurel322408a522008-04-20 20:19:44 +00003582 *)
3583 echo "Unsupported target CPU"
3584 exit 1
3585 ;;
3586esac
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003587echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3588echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3589echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3590echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
Juan Quintela25be210f2009-10-07 02:41:00 +02003591echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
Juan Quintela053dd922009-08-03 14:47:03 +02003592target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
Juan Quintela25be210f2009-10-07 02:41:00 +02003593echo "TARGET_$target_arch_name=y" >> $config_target_mak
3594echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
Juan Quintela42bc6082009-07-16 18:34:20 +02003595# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02003596if [ "$TARGET_BASE_ARCH" = "" ]; then
3597 TARGET_BASE_ARCH=$TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02003598fi
Juan Quintela25be210f2009-10-07 02:41:00 +02003599echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02003600if [ "$TARGET_ABI_DIR" = "" ]; then
3601 TARGET_ABI_DIR=$TARGET_ARCH
3602fi
Juan Quintela25be210f2009-10-07 02:41:00 +02003603echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02003604case "$target_arch2" in
3605 i386|x86_64)
3606 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
Anthony PERARD64b3cfd2010-10-21 12:47:08 +01003607 target_phys_bits=64
Juan Quintela25be210f2009-10-07 02:41:00 +02003608 echo "CONFIG_XEN=y" >> $config_target_mak
Alexander Graf59d21e52011-07-17 07:30:29 +02003609 else
3610 echo "CONFIG_NO_XEN=y" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02003611 fi
Alexander Graf59d21e52011-07-17 07:30:29 +02003612 ;;
3613 *)
3614 echo "CONFIG_NO_XEN=y" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02003615esac
Juan Quintelac59249f2009-07-16 18:34:00 +02003616case "$target_arch2" in
Alexander Graf0e60a692009-12-05 12:44:24 +01003617 i386|x86_64|ppcemb|ppc|ppc64|s390x)
Juan Quintelac59249f2009-07-16 18:34:00 +02003618 # Make sure the target and host cpus are compatible
3619 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3620 \( "$target_arch2" = "$cpu" -o \
3621 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
Alexander Graf5f114bc2009-07-17 13:51:42 +02003622 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
René Rebeadf82012011-03-21 11:18:50 +01003623 \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \
3624 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
Juan Quintelac59249f2009-07-16 18:34:00 +02003625 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
3626 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02003627 echo "CONFIG_KVM=y" >> $config_target_mak
Stefan Weil1ba16962011-07-29 22:40:45 +02003628 if test "$vhost_net" = "yes" ; then
Michael S. Tsirkind5970052010-03-17 13:08:17 +02003629 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3630 fi
Juan Quintelac59249f2009-07-16 18:34:00 +02003631 fi
3632esac
Blue Swirl7f762362011-11-01 20:59:32 +00003633if test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
Alexander Graf0a6b8dd2011-08-10 14:21:41 +02003634 echo "CONFIG_PSERIES=y" >> $config_target_mak
3635fi
bellardde83cd02003-06-15 20:25:43 +00003636if test "$target_bigendian" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02003637 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00003638fi
3639if test "$target_softmmu" = "yes" ; then
Paul Brookb1aa27c2010-03-01 02:27:26 +00003640 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
Juan Quintela25be210f2009-10-07 02:41:00 +02003641 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
Michael Wallede3a3542011-04-26 00:24:07 +02003642 echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
Andreas Färber0e8c9212010-01-06 20:24:05 +01003643 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
Kirill A. Shutemov5791f452009-09-12 02:17:53 +03003644 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
Paul Brookad4cf3f2012-02-09 19:05:29 +00003645 if test "$smartcard_nss" = "yes" ; then
3646 echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3647 fi
bellardde83cd02003-06-15 20:25:43 +00003648fi
bellard997344f2003-10-27 21:10:39 +00003649if test "$target_user_only" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02003650 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
Stefan Weila2c80be2011-12-22 11:26:10 +01003651 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00003652fi
ths831b7822007-01-18 20:06:33 +00003653if test "$target_linux_user" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02003654 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00003655fi
3656if test "$target_darwin_user" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02003657 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00003658fi
pbrook56aebc82008-10-11 17:55:29 +00003659list=""
3660if test ! -z "$gdb_xml_files" ; then
3661 for x in $gdb_xml_files; do
3662 list="$list $source_path/gdb-xml/$x"
3663 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02003664 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00003665fi
bellardde83cd02003-06-15 20:25:43 +00003666
pbrooke5fe0c52006-06-11 13:32:59 +00003667if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintela25be210f2009-10-07 02:41:00 +02003668 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00003669fi
pbrookbd0c5662008-05-29 14:34:11 +00003670if test "$target_user_only" = "yes" \
3671 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
Juan Quintela25be210f2009-10-07 02:41:00 +02003672 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
pbrookbd0c5662008-05-29 14:34:11 +00003673fi
Paul Brook379f6692009-07-17 12:48:08 +01003674if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
Juan Quintela25be210f2009-10-07 02:41:00 +02003675 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
Paul Brook379f6692009-07-17 12:48:08 +01003676fi
blueswir184778502008-10-26 20:33:16 +00003677if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02003678 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00003679fi
bellard5b0753e2005-03-01 21:37:28 +00003680
Juan Quintela4afddb52009-08-03 14:46:45 +02003681# generate QEMU_CFLAGS/LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02003682
Juan Quintela4afddb52009-08-03 14:46:45 +02003683cflags=""
Paolo Bonzinif9728942010-12-23 11:43:53 +01003684includes=""
Juan Quintelafa282482009-07-22 22:37:39 +02003685ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02003686
Stefan Weil9195b2c2011-10-19 07:07:18 +02003687if test "$tcg_interpreter" = "yes"; then
3688 includes="-I\$(SRC_PATH)/tcg/tci $includes"
3689elif test "$ARCH" = "sparc64" ; then
Paolo Bonzinif9728942010-12-23 11:43:53 +01003690 includes="-I\$(SRC_PATH)/tcg/sparc $includes"
Alexander Graf24e804ec2009-12-05 12:44:22 +01003691elif test "$ARCH" = "s390x" ; then
Paolo Bonzinif9728942010-12-23 11:43:53 +01003692 includes="-I\$(SRC_PATH)/tcg/s390 $includes"
Richard Henderson5d8a4f82010-06-03 17:35:17 -07003693elif test "$ARCH" = "x86_64" ; then
Paolo Bonzinif9728942010-12-23 11:43:53 +01003694 includes="-I\$(SRC_PATH)/tcg/i386 $includes"
Juan Quintela57ddfbf2009-08-03 14:46:51 +02003695else
Paolo Bonzinif9728942010-12-23 11:43:53 +01003696 includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
Juan Quintela57ddfbf2009-08-03 14:46:51 +02003697fi
Paolo Bonzinif9728942010-12-23 11:43:53 +01003698includes="-I\$(SRC_PATH)/tcg $includes"
Juan Quintela57ddfbf2009-08-03 14:46:51 +02003699
Peter Maydell6efd7512011-11-30 11:59:04 +00003700if test "$linux" = "yes" ; then
3701 includes="-I\$(SRC_PATH)/linux-headers $includes"
3702fi
3703
Blue Swirl4d904532010-03-21 08:28:47 +00003704if test "$target_user_only" = "yes" ; then
3705 libdis_config_mak=libdis-user/config.mak
3706else
3707 libdis_config_mak=libdis/config.mak
3708fi
3709
Juan Quintela64656022009-08-03 14:46:53 +02003710for i in $ARCH $TARGET_BASE_ARCH ; do
3711 case "$i" in
3712 alpha)
Juan Quintela25be210f2009-10-07 02:41:00 +02003713 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003714 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003715 ;;
3716 arm)
Juan Quintela25be210f2009-10-07 02:41:00 +02003717 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003718 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003719 ;;
3720 cris)
Juan Quintela25be210f2009-10-07 02:41:00 +02003721 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003722 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003723 ;;
3724 hppa)
Juan Quintela25be210f2009-10-07 02:41:00 +02003725 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003726 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003727 ;;
3728 i386|x86_64)
Juan Quintela25be210f2009-10-07 02:41:00 +02003729 echo "CONFIG_I386_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003730 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003731 ;;
Aurelien Jarno903ec552010-03-29 02:12:51 +02003732 ia64*)
3733 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3734 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3735 ;;
Juan Quintela64656022009-08-03 14:46:53 +02003736 m68k)
Juan Quintela25be210f2009-10-07 02:41:00 +02003737 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003738 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003739 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01003740 microblaze*)
Juan Quintela25be210f2009-10-07 02:41:00 +02003741 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003742 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003743 ;;
3744 mips*)
Juan Quintela25be210f2009-10-07 02:41:00 +02003745 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003746 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003747 ;;
3748 ppc*)
Juan Quintela25be210f2009-10-07 02:41:00 +02003749 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003750 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003751 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01003752 s390*)
Juan Quintela25be210f2009-10-07 02:41:00 +02003753 echo "CONFIG_S390_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003754 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003755 ;;
3756 sh4)
Juan Quintela25be210f2009-10-07 02:41:00 +02003757 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003758 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003759 ;;
3760 sparc*)
Juan Quintela25be210f2009-10-07 02:41:00 +02003761 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003762 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003763 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04003764 xtensa*)
3765 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
3766 echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak
3767 ;;
Juan Quintela64656022009-08-03 14:46:53 +02003768 esac
3769done
Stefan Weil9195b2c2011-10-19 07:07:18 +02003770if test "$tcg_interpreter" = "yes" ; then
3771 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
3772 echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak
3773fi
Juan Quintela64656022009-08-03 14:46:53 +02003774
Juan Quintela6ee71262009-08-03 14:46:47 +02003775case "$ARCH" in
3776alpha)
3777 # Ensure there's only a single GP
3778 cflags="-msmall-data $cflags"
3779;;
3780esac
3781
Juan Quintela55d9c042009-08-03 14:47:02 +02003782if test "$target_softmmu" = "yes" ; then
3783 case "$TARGET_BASE_ARCH" in
3784 arm)
3785 cflags="-DHAS_AUDIO $cflags"
3786 ;;
Michael Walle25a8bb92011-03-07 23:32:32 +01003787 lm32)
3788 cflags="-DHAS_AUDIO $cflags"
3789 ;;
Juan Quintela55d9c042009-08-03 14:47:02 +02003790 i386|mips|ppc)
3791 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3792 ;;
3793 esac
3794fi
3795
Juan Quintela471857d2009-08-03 14:46:52 +02003796if test "$target_softmmu" = "yes" -a \( \
3797 "$TARGET_ARCH" = "microblaze" -o \
3798 "$TARGET_ARCH" = "cris" \) ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02003799 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
Juan Quintela471857d2009-08-03 14:46:52 +02003800fi
3801
Juan Quintelad02c1db2009-08-03 14:46:50 +02003802if test "$gprof" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02003803 echo "TARGET_GPROF=yes" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02003804 if test "$target_linux_user" = "yes" ; then
3805 cflags="-p $cflags"
3806 ldflags="-p $ldflags"
3807 fi
3808 if test "$target_softmmu" = "yes" ; then
3809 ldflags="-p $ldflags"
Juan Quintela25be210f2009-10-07 02:41:00 +02003810 echo "GPROF_CFLAGS=-p" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02003811 fi
3812fi
3813
Stefan Weil9195b2c2011-10-19 07:07:18 +02003814if test "$ARCH" = "tci"; then
3815 linker_script=""
3816else
3817 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
3818fi
3819
Juan Quintela9b8e1112009-08-03 14:46:46 +02003820if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
Juan Quintelafa282482009-07-22 22:37:39 +02003821 case "$ARCH" in
Juan Quintelafa282482009-07-22 22:37:39 +02003822 sparc)
3823 # -static is used to avoid g1/g3 usage by the dynamic linker
Juan Quintela322e5872009-08-03 14:46:44 +02003824 ldflags="$linker_script -static $ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02003825 ;;
Richard Henderson4d58be02010-06-04 12:14:11 -07003826 alpha | s390x)
3827 # The default placement of the application is fine.
3828 ;;
Richard Hendersonfd76e732010-04-07 04:56:43 -07003829 *)
Juan Quintela322e5872009-08-03 14:46:44 +02003830 ldflags="$linker_script $ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02003831 ;;
3832 esac
3833fi
Juan Quintelafa282482009-07-22 22:37:39 +02003834
Juan Quintela25be210f2009-10-07 02:41:00 +02003835echo "LDFLAGS+=$ldflags" >> $config_target_mak
3836echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01003837echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02003838
bellard97a847b2003-08-10 21:36:04 +00003839done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00003840
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003841# build tree in object directory in case the source is not in the current directory
Anthony Liguoric09015d2012-01-10 13:10:42 -06003842DIRS="tests tests/tcg tests/tcg/cris slirp audio block net pc-bios/optionrom"
Andreas Färber446b9162011-05-08 13:25:56 +02003843DIRS="$DIRS pc-bios/spapr-rtas"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003844DIRS="$DIRS roms/seabios roms/vgabios"
3845DIRS="$DIRS fsdev ui"
Michael Rothe098fc32011-09-07 18:40:52 -05003846DIRS="$DIRS qapi qapi-generated"
Anthony Liguori2f28d2f2011-12-03 17:10:08 -06003847DIRS="$DIRS qga trace qom"
Anthony Liguoric09015d2012-01-10 13:10:42 -06003848FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
3849FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003850FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
Andreas Färber446b9162011-05-08 13:25:56 +02003851FILES="$FILES pc-bios/spapr-rtas/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003852FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
Richard Henderson753d11f2011-06-24 11:58:37 -07003853for bios_file in \
3854 $source_path/pc-bios/*.bin \
3855 $source_path/pc-bios/*.rom \
3856 $source_path/pc-bios/*.dtb \
3857 $source_path/pc-bios/openbios-* \
3858 $source_path/pc-bios/palcode-*
3859do
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003860 FILES="$FILES pc-bios/`basename $bios_file`"
3861done
3862mkdir -p $DIRS
3863for f in $FILES ; do
Peter Maydellf9245e12011-06-03 17:10:40 +01003864 if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then
3865 symlink "$source_path/$f" "$f"
3866 fi
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003867done
Paul Brook1ad21342009-05-19 16:17:58 +01003868
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003869# temporary config to build submodules
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06003870for rom in seabios vgabios ; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003871 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01003872 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003873 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3874 echo "CC=$cc" >> $config_mak
3875 echo "BCC=bcc" >> $config_mak
3876 echo "CPP=${cross_prefix}cpp" >> $config_mak
3877 echo "OBJCOPY=objcopy" >> $config_mak
3878 echo "IASL=iasl" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003879 echo "LD=$ld" >> $config_mak
3880done
3881
Paul Brook1ad21342009-05-19 16:17:58 +01003882for hwlib in 32 64; do
3883 d=libhw$hwlib
3884 mkdir -p $d
Blue Swirl9953b2f2010-03-21 19:47:05 +00003885 mkdir -p $d/ide
Paolo Bonzini11568d62010-12-23 11:43:58 +01003886 symlink $source_path/Makefile.hw $d/Makefile
Aneesh Kumar K.V353ac782011-01-28 18:09:08 +05303887 mkdir -p $d/9pfs
Stefan Weil37116c82010-03-01 22:20:29 +01003888 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
Paul Brook1ad21342009-05-19 16:17:58 +01003889done
Blue Swirladd16152009-09-27 16:26:02 +00003890
Robert Relyea111a38b2010-11-28 16:36:38 +02003891if [ "$source_path" != `pwd` ]; then
3892 # out of tree build
3893 mkdir -p libcacard
3894 rm -f libcacard/Makefile
Alon Levy44dc0ca2011-05-15 11:51:28 +03003895 symlink "$source_path/libcacard/Makefile" libcacard/Makefile
Robert Relyea111a38b2010-11-28 16:36:38 +02003896fi
3897
Blue Swirladd16152009-09-27 16:26:02 +00003898d=libuser
3899mkdir -p $d
Lluís Vilanova937b1252011-09-15 22:45:42 +02003900mkdir -p $d/trace
Paolo Bonzini11568d62010-12-23 11:43:58 +01003901symlink $source_path/Makefile.user $d/Makefile
Jan Kiszkab40292e2010-05-31 14:43:31 -03003902
3903if test "$docs" = "yes" ; then
3904 mkdir -p QMP
3905fi