blob: 8fd54045ec4e656c82e16e9e60796b1484dc1f4f [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=""
aliguoriac0df512008-12-29 17:14:15 +0000101
Paolo Bonzini377529c2010-12-23 11:43:50 +0100102target_list=""
103
104# Default value for a variable defining feature "foo".
105# * foo="no" feature will only be used if --enable-foo arg is given
106# * foo="" feature will be searched for, and if found, will be used
107# unless --disable-foo is given
108# * foo="yes" this value will only be set by --enable-foo flag.
109# feature will searched for,
110# if not found, configure exits with error
111#
112# Always add --enable-foo and --disable-foo command line args.
113# Distributions want to ensure that several features are compiled in, and it
114# is impossible without a --enable-foo that exits if a feature is not found.
115
116bluez=""
117brlapi=""
118curl=""
119curses=""
120docs=""
121fdt=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100122nptl=""
123sdl=""
Jes Sorensen821601e2011-03-16 13:33:36 +0100124vnc="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100125sparse="no"
126uuid=""
127vde=""
128vnc_tls=""
129vnc_sasl=""
130vnc_jpeg=""
131vnc_png=""
132vnc_thread="no"
133xen=""
Anthony PERARDd5b93dd2011-02-25 16:20:34 +0000134xen_ctrl_version=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100135linux_aio=""
136attr=""
Avi Kivity4f26f2b2011-11-09 14:44:52 +0200137libattr=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100138xfs=""
139
Bradd41a75a2011-07-26 23:11:26 -0400140vhost_net="no"
141kvm="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100142gprof="no"
143debug_tcg="no"
144debug_mon="no"
145debug="no"
146strip_opt="yes"
Stefan Weil9195b2c2011-10-19 07:07:18 +0200147tcg_interpreter="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100148bigendian="no"
149mingw32="no"
150EXESUF=""
151prefix="/usr/local"
152mandir="\${prefix}/share/man"
153datadir="\${prefix}/share/qemu"
154docdir="\${prefix}/share/doc/qemu"
155bindir="\${prefix}/bin"
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300156libdir="\${prefix}/lib"
Alon Levy0f94d6d2011-06-27 11:58:20 +0200157includedir="\${prefix}/include"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100158sysconfdir="\${prefix}/etc"
159confsuffix="/qemu"
160slirp="yes"
161fmod_lib=""
162fmod_inc=""
163oss_lib=""
164bsd="no"
165linux="no"
166solaris="no"
167profiler="no"
168cocoa="no"
169softmmu="yes"
170linux_user="no"
171darwin_user="no"
172bsd_user="no"
173guest_base=""
174uname_release=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100175mixemu="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100176aix="no"
177blobs="yes"
178pkgversion=""
Avi Kivity40d64442011-11-15 20:12:17 +0200179pie=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100180zero_malloc=""
181trace_backend="nop"
182trace_file="trace"
183spice=""
184rbd=""
Alon Levy36707142010-10-17 11:40:07 +0200185smartcard=""
Robert Relyea111a38b2010-11-28 16:36:38 +0200186smartcard_nss=""
Hans de Goede69354a82011-07-19 11:04:10 +0200187usb_redir=""
Michael Walle430a3c12011-04-26 00:09:01 +0200188opengl=""
Alon Levy1ece9902011-07-26 12:30:40 +0300189zlib="yes"
Michael Rothd138cee2011-08-01 14:52:57 -0500190guest_agent="yes"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100191libiscsi=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100192
aliguoriac0df512008-12-29 17:14:15 +0000193# parse CC options first
194for opt do
195 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
196 case "$opt" in
197 --cross-prefix=*) cross_prefix="$optarg"
198 ;;
Paolo Bonzini3d8df642010-12-23 11:43:48 +0100199 --cc=*) CC="$optarg"
aliguoriac0df512008-12-29 17:14:15 +0000200 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100201 --source-path=*) source_path="$optarg"
202 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200203 --cpu=*) cpu="$optarg"
204 ;;
Juan Quintelaa558ee12009-08-03 14:46:21 +0200205 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200206 ;;
207 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
208 ;;
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200209 --sparc_cpu=*)
210 sparc_cpu="$optarg"
211 case $sparc_cpu in
Juan Quintelaed968ff2009-08-03 14:46:11 +0200212 v7|v8|v8plus|v8plusa)
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200213 cpu="sparc"
214 ;;
215 v9)
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200216 cpu="sparc64"
217 ;;
218 *)
219 echo "undefined SPARC architecture. Exiting";
220 exit 1
221 ;;
222 esac
223 ;;
aliguoriac0df512008-12-29 17:14:15 +0000224 esac
225done
aliguoriac0df512008-12-29 17:14:15 +0000226# OS specific
227# Using uname is really, really broken. Once we have the right set of checks
228# we can eliminate it's usage altogether
229
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500230cc="${CC-${cross_prefix}gcc}"
231ar="${AR-${cross_prefix}ar}"
232objcopy="${OBJCOPY-${cross_prefix}objcopy}"
233ld="${LD-${cross_prefix}ld}"
Brad3f534582011-08-13 20:30:14 -0400234libtool="${LIBTOOL-${cross_prefix}libtool}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500235strip="${STRIP-${cross_prefix}strip}"
236windres="${WINDRES-${cross_prefix}windres}"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300237pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
238query_pkg_config() {
239 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
240}
241pkg_config=query_pkg_config
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500242sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
aliguoriac0df512008-12-29 17:14:15 +0000243
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200244# default flags for all hosts
245QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
246CFLAGS="-g $CFLAGS"
Mike Frysingerf9188222011-05-17 17:08:43 -0400247QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200248QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
249QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Kirill A. Shutemov84958302010-01-20 00:56:22 +0100250QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
Paolo Bonzinicbbab922011-07-28 12:10:30 +0200251QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200252LDFLAGS="-g $LDFLAGS"
253
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100254# make source path absolute
255source_path=`cd "$source_path"; pwd`
256
aliguoriac0df512008-12-29 17:14:15 +0000257check_define() {
258cat > $TMPC <<EOF
259#if !defined($1)
Peter Maydellfd786e12011-11-23 17:26:43 +0000260#error $1 not defined
aliguoriac0df512008-12-29 17:14:15 +0000261#endif
262int main(void) { return 0; }
263EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200264 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000265}
266
Juan Quintela2ff6b912009-08-03 14:45:55 +0200267if test ! -z "$cpu" ; then
268 # command line argument
269 :
270elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000271 cpu="i386"
272elif check_define __x86_64__ ; then
273 cpu="x86_64"
blueswir13aa9bd62008-12-31 16:55:26 +0000274elif check_define __sparc__ ; then
275 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
276 # They must be specified using --sparc_cpu
277 if check_define __arch64__ ; then
278 cpu="sparc64"
279 else
280 cpu="sparc"
281 fi
malcfdf7ed92009-01-14 18:39:52 +0000282elif check_define _ARCH_PPC ; then
283 if check_define _ARCH_PPC64 ; then
284 cpu="ppc64"
285 else
286 cpu="ppc"
287 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200288elif check_define __mips__ ; then
289 cpu="mips"
Aurelien Jarno477ba622010-03-29 02:12:51 +0200290elif check_define __ia64__ ; then
291 cpu="ia64"
Aurelien Jarnod66ed0e2010-06-13 12:28:21 +0200292elif check_define __s390__ ; then
293 if check_define __s390x__ ; then
294 cpu="s390x"
295 else
296 cpu="s390"
297 fi
Peter Maydell21d89f82011-11-30 10:57:48 +0100298elif check_define __arm__ ; then
299 cpu="arm"
Bradf28ffed2011-09-07 21:24:56 -0400300elif check_define __hppa__ ; then
301 cpu="hppa"
aliguoriac0df512008-12-29 17:14:15 +0000302else
malcfdf7ed92009-01-14 18:39:52 +0000303 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +0000304fi
305
Peter Maydell359bc952011-12-24 13:07:25 +0000306ARCH=
307# Normalise host CPU name and set ARCH.
308# Note that this case should only have supported host CPUs, not guests.
bellard7d132992003-03-06 23:23:54 +0000309case "$cpu" in
Peter Maydell359bc952011-12-24 13:07:25 +0000310 ia64|ppc|ppc64|s390|s390x|sparc64)
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200311 cpu="$cpu"
312 ;;
bellard7d132992003-03-06 23:23:54 +0000313 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000314 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000315 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000316 x86_64|amd64)
317 cpu="x86_64"
318 ;;
Peter Maydell21d89f82011-11-30 10:57:48 +0100319 armv*b|armv*l|arm)
320 cpu="arm"
bellard7d132992003-03-06 23:23:54 +0000321 ;;
Bradf28ffed2011-09-07 21:24:56 -0400322 hppa|parisc|parisc64)
aurel32f54b3f92008-04-12 20:14:54 +0000323 cpu="hppa"
324 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200325 mips*)
326 cpu="mips"
327 ;;
blueswir131422552007-04-16 18:27:06 +0000328 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000329 cpu="sparc"
330 ;;
bellard7d132992003-03-06 23:23:54 +0000331 *)
Peter Maydell359bc952011-12-24 13:07:25 +0000332 # This will result in either an error or falling back to TCI later
333 ARCH=unknown
bellard7d132992003-03-06 23:23:54 +0000334 ;;
335esac
Peter Maydell359bc952011-12-24 13:07:25 +0000336if test -z "$ARCH"; then
337 ARCH="$cpu"
338fi
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200339
bellard7d132992003-03-06 23:23:54 +0000340# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000341if check_define __linux__ ; then
342 targetos="Linux"
343elif check_define _WIN32 ; then
344 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000345elif check_define __OpenBSD__ ; then
346 targetos='OpenBSD'
347elif check_define __sun__ ; then
348 targetos='SunOS'
Andreas Färber179cf402010-09-20 00:50:43 +0200349elif check_define __HAIKU__ ; then
350 targetos='Haiku'
aliguoriac0df512008-12-29 17:14:15 +0000351else
352 targetos=`uname -s`
353fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200354
bellard7d132992003-03-06 23:23:54 +0000355case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000356CYGWIN*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200357 mingw32="yes"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200358 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
malcd5631632009-10-10 01:13:41 +0400359 audio_possible_drivers="winwave sdl"
360 audio_drv_list="winwave"
bellardc326e0a2005-04-23 18:30:28 +0000361;;
bellard67b915a2004-03-31 23:37:16 +0000362MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200363 mingw32="yes"
malcd5631632009-10-10 01:13:41 +0400364 audio_possible_drivers="winwave dsound sdl fmod"
365 audio_drv_list="winwave"
bellard67b915a2004-03-31 23:37:16 +0000366;;
ths5c40d2b2007-06-23 16:03:36 +0000367GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100368 bsd="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200369 audio_drv_list="oss"
370 audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000371;;
bellard7d3505c2004-05-12 19:32:15 +0000372FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200373 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100374 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200375 audio_drv_list="oss"
376 audio_possible_drivers="oss sdl esd pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100377 # needed for kinfo_getvmmap(3) in libutil.h
378 LIBS="-lutil $LIBS"
bellard7d3505c2004-05-12 19:32:15 +0000379;;
blueswir1c5e97232009-03-07 20:06:23 +0000380DragonFly)
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"
blueswir1c5e97232009-03-07 20:06:23 +0000385;;
bellard7d3505c2004-05-12 19:32:15 +0000386NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200387 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100388 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200389 audio_drv_list="oss"
390 audio_possible_drivers="oss sdl esd"
391 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000392;;
393OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200394 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100395 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200396 audio_drv_list="oss"
397 audio_possible_drivers="oss sdl esd"
398 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000399;;
bellard83fb7ad2004-07-05 21:25:26 +0000400Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200401 bsd="yes"
402 darwin="yes"
403 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
404 # run 64-bit userspace code
405 if [ "$cpu" = "i386" ] ; then
malcaab85882009-02-23 14:11:10 +0000406 is_x86_64=`sysctl -n hw.optional.x86_64`
407 [ "$is_x86_64" = "1" ] && cpu=x86_64
Juan Quintela0dbfc672009-08-03 14:46:13 +0200408 fi
409 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200410 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200411 LDFLAGS="-arch x86_64 $LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200412 else
Juan Quintelaa558ee12009-08-03 14:46:21 +0200413 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200414 fi
415 darwin_user="yes"
416 cocoa="yes"
417 audio_drv_list="coreaudio"
418 audio_possible_drivers="coreaudio sdl fmod"
419 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200420 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
bellard83fb7ad2004-07-05 21:25:26 +0000421;;
bellardec530c82006-04-25 22:36:06 +0000422SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200423 solaris="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100424 make="${MAKE-gmake}"
425 install="${INSTALL-ginstall}"
Blue Swirlfa589482009-10-02 19:38:25 +0000426 ld="gld"
Brade2d88302011-09-02 16:53:28 -0400427 smbd="${SMBD-/usr/sfw/sbin/smbd}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200428 needs_libsunmath="no"
429 solarisrev=`uname -r | cut -f2 -d.`
430 # have to select again, because `uname -m` returns i86pc
431 # even on an x86_64 box.
432 solariscpu=`isainfo -k`
433 if test "${solariscpu}" = "amd64" ; then
434 cpu="x86_64"
435 fi
436 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
437 if test "$solarisrev" -le 9 ; then
438 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
439 needs_libsunmath="yes"
Juan Quintelaf14bfdf2009-08-03 14:47:11 +0200440 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
441 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
442 LIBS="-lsunmath $LIBS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200443 else
444 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
445 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
446 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
447 echo "Studio 11 can be downloaded from www.sun.com."
448 exit 1
449 fi
thsef18c882007-09-16 22:12:39 +0000450 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200451 fi
452 if test -f /usr/include/sys/soundcard.h ; then
453 audio_drv_list="oss"
454 fi
455 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000456# needed for CMSG_ macros in sys/socket.h
457 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
458# needed for TIOCWIN* defines in termios.h
459 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200460 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
Juan Quintelae174c0b2009-08-03 14:46:18 +0200461 LIBS="-lsocket -lnsl -lresolv $LIBS"
ths86b2bd92007-02-11 00:31:33 +0000462;;
malcb29fe3e2008-11-18 01:42:22 +0000463AIX)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200464 aix="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100465 make="${MAKE-gmake}"
malcb29fe3e2008-11-18 01:42:22 +0000466;;
Andreas Färber179cf402010-09-20 00:50:43 +0200467Haiku)
468 haiku="yes"
469 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
470 LIBS="-lposix_error_mapper -lnetwork $LIBS"
471;;
bellard1d14ffa2005-10-30 18:58:22 +0000472*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200473 audio_drv_list="oss"
474 audio_possible_drivers="oss alsa sdl esd pa"
475 linux="yes"
476 linux_user="yes"
477 usb="linux"
Jan Kiszkaaf2be202011-06-23 10:05:12 +0200478 kvm="yes"
479 vhost_net="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200480 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
malcc2de5c92008-06-28 19:13:06 +0000481 audio_possible_drivers="$audio_possible_drivers fmod"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200482 fi
bellardfb065182004-11-09 23:09:44 +0000483;;
bellard7d132992003-03-06 23:23:54 +0000484esac
485
bellard7d3505c2004-05-12 19:32:15 +0000486if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000487 if [ "$darwin" != "yes" ] ; then
blueswir168063642008-11-22 21:03:55 +0000488 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000489 fi
blueswir184778502008-10-26 20:33:16 +0000490 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000491fi
492
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100493: ${make=${MAKE-make}}
494: ${install=${INSTALL-install}}
Blue Swirlc886edf2011-07-22 21:08:09 +0000495: ${python=${PYTHON-python}}
Brade2d88302011-09-02 16:53:28 -0400496: ${smbd=${SMBD-/usr/sbin/smbd}}
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100497
Juan Quintela3457a3f2009-08-03 14:46:07 +0200498if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +0200499 EXESUF=".exe"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200500 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
Stefan Weile94a7932010-02-12 11:02:08 +0100501 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
502 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
Stefan Weil08f38962011-02-04 22:38:47 +0100503 LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200504 prefix="c:/Program Files/Qemu"
505 mandir="\${prefix}"
506 datadir="\${prefix}"
507 docdir="\${prefix}"
508 bindir="\${prefix}"
509 sysconfdir="\${prefix}"
510 confsuffix=""
Stefan Weil83b2f0a2011-08-06 22:47:22 +0200511 guest_agent="no"
Juan Quintela3457a3f2009-08-03 14:46:07 +0200512fi
513
Anthony Liguori487fefd2009-06-11 13:28:25 -0500514werror=""
bellard85aa5182007-11-11 20:17:03 +0000515
bellard7d132992003-03-06 23:23:54 +0000516for opt do
pbrooka46e4032006-04-29 23:05:22 +0000517 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000518 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000519 --help|-h) show_help=yes
520 ;;
Mike Frysinger99123e12011-04-07 01:12:28 -0400521 --version|-V) exec cat $source_path/VERSION
522 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000523 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000524 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000525 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000526 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100527 --source-path=*)
bellard7d132992003-03-06 23:23:54 +0000528 ;;
aliguoriac0df512008-12-29 17:14:15 +0000529 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000530 ;;
aliguoriac0df512008-12-29 17:14:15 +0000531 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000532 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000533 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000534 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000535 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000536 ;;
pbrook6a882642006-04-17 13:57:12 +0000537 --install=*) install="$optarg"
538 ;;
Blue Swirlc886edf2011-07-22 21:08:09 +0000539 --python=*) python="$optarg"
540 ;;
Brade2d88302011-09-02 16:53:28 -0400541 --smbd=*) smbd="$optarg"
542 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200543 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000544 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200545 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000546 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200547 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000548 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000549 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000550 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100551 --enable-trace-backend=*) trace_backend="$optarg"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +0100552 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100553 --with-trace-file=*) trace_file="$optarg"
Prerna Saxena9410b562010-07-13 09:26:32 +0100554 ;;
bellard7d132992003-03-06 23:23:54 +0000555 --enable-gprof) gprof="yes"
556 ;;
Loïc Minier79427692010-01-31 12:23:45 +0100557 --static)
558 static="yes"
559 LDFLAGS="-static $LDFLAGS"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300560 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
bellard43ce4df2003-06-09 19:53:12 +0000561 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200562 --mandir=*) mandir="$optarg"
563 ;;
564 --bindir=*) bindir="$optarg"
565 ;;
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300566 --libdir=*) libdir="$optarg"
567 ;;
Alon Levy0f94d6d2011-06-27 11:58:20 +0200568 --includedir=*) includedir="$optarg"
569 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200570 --datadir=*) datadir="$optarg"
571 ;;
572 --docdir=*) docdir="$optarg"
573 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +0100574 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -0600575 ;;
Max Filippov023ddd72011-11-24 16:11:31 +0400576 --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\
577 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
578 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
579 # These switches are silently ignored, for compatibility with
580 # autoconf-generated configure scripts. This allows QEMU's
581 # configure to be used by RPM and similar macros that set
582 # lots of directory switches by default.
583 ;;
bellard97a847b2003-08-10 21:36:04 +0000584 --disable-sdl) sdl="no"
585 ;;
Juan Quintelac4198152009-08-12 18:29:53 +0200586 --enable-sdl) sdl="yes"
587 ;;
Jes Sorensen821601e2011-03-16 13:33:36 +0100588 --disable-vnc) vnc="no"
589 ;;
590 --enable-vnc) vnc="yes"
591 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000592 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000593 ;;
malcc2de5c92008-06-28 19:13:06 +0000594 --fmod-inc=*) fmod_inc="$optarg"
595 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000596 --oss-lib=*) oss_lib="$optarg"
597 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000598 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000599 ;;
600 --audio-drv-list=*) audio_drv_list="$optarg"
601 ;;
Markus Armbrustereb852012009-10-27 18:41:44 +0100602 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
603 ;;
aurel32f8393942009-04-13 18:45:38 +0000604 --enable-debug-tcg) debug_tcg="yes"
605 ;;
606 --disable-debug-tcg) debug_tcg="no"
607 ;;
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200608 --enable-debug-mon) debug_mon="yes"
609 ;;
610 --disable-debug-mon) debug_mon="no"
611 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100612 --enable-debug)
613 # Enable debugging options that aren't excessively noisy
614 debug_tcg="yes"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200615 debug_mon="yes"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100616 debug="yes"
617 strip_opt="no"
618 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000619 --enable-sparse) sparse="yes"
620 ;;
621 --disable-sparse) sparse="no"
622 ;;
aliguori1625af82009-04-05 17:41:02 +0000623 --disable-strip) strip_opt="no"
624 ;;
ths8d5d2d42007-08-25 01:37:51 +0000625 --disable-vnc-tls) vnc_tls="no"
626 ;;
Juan Quintela1be10ad2009-08-12 18:20:28 +0200627 --enable-vnc-tls) vnc_tls="yes"
628 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000629 --disable-vnc-sasl) vnc_sasl="no"
630 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +0200631 --enable-vnc-sasl) vnc_sasl="yes"
632 ;;
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200633 --disable-vnc-jpeg) vnc_jpeg="no"
634 ;;
635 --enable-vnc-jpeg) vnc_jpeg="yes"
636 ;;
Corentin Charyefe556a2010-07-07 20:57:56 +0200637 --disable-vnc-png) vnc_png="no"
638 ;;
639 --enable-vnc-png) vnc_png="yes"
640 ;;
Corentin Charybd023f92010-07-07 20:58:02 +0200641 --disable-vnc-thread) vnc_thread="no"
642 ;;
643 --enable-vnc-thread) vnc_thread="yes"
644 ;;
bellard443f1372004-06-04 11:13:20 +0000645 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000646 ;;
Stefan Weilee682d22009-10-01 20:10:37 +0200647 --disable-uuid) uuid="no"
648 ;;
649 --enable-uuid) uuid="yes"
650 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000651 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000652 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +0200653 --enable-vde) vde="yes"
654 ;;
aliguorie37630c2009-04-22 15:19:10 +0000655 --disable-xen) xen="no"
656 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +0200657 --enable-xen) xen="yes"
658 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000659 --disable-brlapi) brlapi="no"
660 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200661 --enable-brlapi) brlapi="yes"
662 ;;
balrogfb599c92008-09-28 23:49:55 +0000663 --disable-bluez) bluez="no"
664 ;;
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200665 --enable-bluez) bluez="yes"
666 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000667 --disable-kvm) kvm="no"
668 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +0200669 --enable-kvm) kvm="yes"
670 ;;
Stefan Weil9195b2c2011-10-19 07:07:18 +0200671 --disable-tcg-interpreter) tcg_interpreter="no"
672 ;;
673 --enable-tcg-interpreter) tcg_interpreter="yes"
674 ;;
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +0100675 --disable-spice) spice="no"
676 ;;
677 --enable-spice) spice="yes"
678 ;;
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100679 --disable-libiscsi) libiscsi="no"
680 ;;
681 --enable-libiscsi) libiscsi="yes"
682 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000683 --enable-profiler) profiler="yes"
684 ;;
malcc2de5c92008-06-28 19:13:06 +0000685 --enable-cocoa)
686 cocoa="yes" ;
687 sdl="no" ;
688 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000689 ;;
pbrookcad25d62006-03-19 16:31:11 +0000690 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000691 ;;
pbrookcad25d62006-03-19 16:31:11 +0000692 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000693 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -1000694 --disable-user)
695 linux_user="no" ;
696 bsd_user="no" ;
697 darwin_user="no"
698 ;;
699 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +0000700 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000701 ;;
ths831b7822007-01-18 20:06:33 +0000702 --enable-linux-user) linux_user="yes"
703 ;;
704 --disable-darwin-user) darwin_user="no"
705 ;;
706 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000707 ;;
blueswir184778502008-10-26 20:33:16 +0000708 --disable-bsd-user) bsd_user="no"
709 ;;
710 --enable-bsd-user) bsd_user="yes"
711 ;;
Paul Brook379f6692009-07-17 12:48:08 +0100712 --enable-guest-base) guest_base="yes"
713 ;;
714 --disable-guest-base) guest_base="no"
715 ;;
Avi Kivity40d64442011-11-15 20:12:17 +0200716 --enable-pie) pie="yes"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300717 ;;
Avi Kivity40d64442011-11-15 20:12:17 +0200718 --disable-pie) pie="no"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300719 ;;
pbrookc5937222006-05-14 11:30:38 +0000720 --enable-uname-release=*) uname_release="$optarg"
721 ;;
blueswir131422552007-04-16 18:27:06 +0000722 --sparc_cpu=*)
blueswir131422552007-04-16 18:27:06 +0000723 ;;
bellard85aa5182007-11-11 20:17:03 +0000724 --enable-werror) werror="yes"
725 ;;
726 --disable-werror) werror="no"
727 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000728 --disable-curses) curses="no"
729 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +0200730 --enable-curses) curses="yes"
731 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200732 --disable-curl) curl="no"
733 ;;
Juan Quintela788c8192009-08-12 18:29:47 +0200734 --enable-curl) curl="yes"
735 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +0200736 --disable-fdt) fdt="no"
737 ;;
738 --enable-fdt) fdt="yes"
739 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000740 --disable-nptl) nptl="no"
741 ;;
Juan Quintelab0a47e72009-08-12 18:29:49 +0200742 --enable-nptl) nptl="yes"
743 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000744 --enable-mixemu) mixemu="yes"
745 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200746 --disable-linux-aio) linux_aio="no"
747 ;;
748 --enable-linux-aio) linux_aio="yes"
749 ;;
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700750 --disable-attr) attr="no"
751 ;;
752 --enable-attr) attr="yes"
753 ;;
ths77755342008-11-27 15:45:16 +0000754 --disable-blobs) blobs="no"
755 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000756 --with-pkgversion=*) pkgversion=" ($optarg)"
757 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200758 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500759 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200760 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +0200761 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200762 --disable-vhost-net) vhost_net="no"
763 ;;
764 --enable-vhost-net) vhost_net="yes"
765 ;;
Michael Walle20ff0752011-03-07 23:32:39 +0100766 --disable-opengl) opengl="no"
767 ;;
768 --enable-opengl) opengl="yes"
769 ;;
Christian Brunnerf27aaf42010-12-06 20:53:01 +0100770 --disable-rbd) rbd="no"
771 ;;
772 --enable-rbd) rbd="yes"
773 ;;
Sergei Trofimovich8c84cf12012-01-24 20:42:40 +0300774 --disable-xfsctl) xfs="no"
775 ;;
776 --enable-xfsctl) xfs="yes"
777 ;;
Alon Levy36707142010-10-17 11:40:07 +0200778 --disable-smartcard) smartcard="no"
779 ;;
780 --enable-smartcard) smartcard="yes"
781 ;;
Robert Relyea111a38b2010-11-28 16:36:38 +0200782 --disable-smartcard-nss) smartcard_nss="no"
783 ;;
784 --enable-smartcard-nss) smartcard_nss="yes"
785 ;;
Hans de Goede69354a82011-07-19 11:04:10 +0200786 --disable-usb-redir) usb_redir="no"
787 ;;
788 --enable-usb-redir) usb_redir="yes"
789 ;;
Alon Levy1ece9902011-07-26 12:30:40 +0300790 --disable-zlib-test) zlib="no"
791 ;;
Michael Rothd138cee2011-08-01 14:52:57 -0500792 --enable-guest-agent) guest_agent="yes"
793 ;;
794 --disable-guest-agent) guest_agent="no"
795 ;;
balrog7f1559c2007-11-17 10:24:32 +0000796 *) echo "ERROR: unknown option $opt"; show_help="yes"
797 ;;
bellard7d132992003-03-06 23:23:54 +0000798 esac
799done
800
blueswir131422552007-04-16 18:27:06 +0000801#
802# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
Juan Quintelaa558ee12009-08-03 14:46:21 +0200803# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
blueswir131422552007-04-16 18:27:06 +0000804#
Paul Brook379f6692009-07-17 12:48:08 +0100805host_guest_base="no"
bellard40293e52008-01-31 11:32:10 +0000806case "$cpu" in
Juan Quintelaed968ff2009-08-03 14:46:11 +0200807 sparc) case $sparc_cpu in
808 v7|v8)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200809 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200810 ;;
811 v8plus|v8plusa)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200812 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200813 ;;
814 *) # sparc_cpu not defined in the command line
Juan Quintelaa558ee12009-08-03 14:46:21 +0200815 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200816 esac
817 LDFLAGS="-m32 $LDFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200818 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000819 if test "$solaris" = "no" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200820 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
Juan Quintelac81da562009-08-03 14:46:24 +0200821 helper_cflags="-ffixed-i0"
blueswir1762e8232009-04-04 09:21:28 +0000822 fi
blueswir131422552007-04-16 18:27:06 +0000823 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +0200824 sparc64)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200825 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200826 LDFLAGS="-m64 $LDFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200827 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200828 if test "$solaris" != "no" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200829 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000830 fi
blueswir131422552007-04-16 18:27:06 +0000831 ;;
ths76d83bd2007-11-18 21:22:10 +0000832 s390)
Richard Henderson28d7cc42010-06-04 12:14:09 -0700833 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
834 LDFLAGS="-m31 $LDFLAGS"
Richard Henderson48bb3752010-06-28 19:15:37 -0700835 host_guest_base="yes"
Richard Henderson28d7cc42010-06-04 12:14:09 -0700836 ;;
837 s390x)
838 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
839 LDFLAGS="-m64 $LDFLAGS"
Richard Henderson48bb3752010-06-28 19:15:37 -0700840 host_guest_base="yes"
ths76d83bd2007-11-18 21:22:10 +0000841 ;;
bellard40293e52008-01-31 11:32:10 +0000842 i386)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200843 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200844 LDFLAGS="-m32 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200845 cc_i386='$(CC) -m32'
Juan Quintelac81da562009-08-03 14:46:24 +0200846 helper_cflags="-fomit-frame-pointer"
Paul Brook379f6692009-07-17 12:48:08 +0100847 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000848 ;;
849 x86_64)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200850 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200851 LDFLAGS="-m64 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200852 cc_i386='$(CC) -m32'
Paul Brook379f6692009-07-17 12:48:08 +0100853 host_guest_base="yes"
854 ;;
855 arm*)
856 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000857 ;;
malcf6548c02009-07-18 10:08:40 +0400858 ppc*)
859 host_guest_base="yes"
860 ;;
Aurelien Jarnocc01cc82010-03-27 17:31:04 +0100861 mips*)
862 host_guest_base="yes"
863 ;;
Aurelien Jarno477ba622010-03-29 02:12:51 +0200864 ia64*)
865 host_guest_base="yes"
866 ;;
Richard Hendersonfd76e732010-04-07 04:56:43 -0700867 hppa*)
868 host_guest_base="yes"
869 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +0800870 unicore32*)
871 host_guest_base="yes"
872 ;;
blueswir131422552007-04-16 18:27:06 +0000873esac
874
Paul Brook379f6692009-07-17 12:48:08 +0100875[ -z "$guest_base" ] && guest_base="$host_guest_base"
876
Peter Maydell60e0df22011-05-03 14:50:13 +0100877
878default_target_list=""
879
880# these targets are portable
881if [ "$softmmu" = "yes" ] ; then
882 default_target_list="\
883i386-softmmu \
884x86_64-softmmu \
Richard Henderson27cdad62011-09-20 15:36:24 -0700885alpha-softmmu \
Peter Maydell60e0df22011-05-03 14:50:13 +0100886arm-softmmu \
887cris-softmmu \
888lm32-softmmu \
889m68k-softmmu \
890microblaze-softmmu \
891microblazeel-softmmu \
892mips-softmmu \
893mipsel-softmmu \
894mips64-softmmu \
895mips64el-softmmu \
896ppc-softmmu \
897ppcemb-softmmu \
898ppc64-softmmu \
899sh4-softmmu \
900sh4eb-softmmu \
901sparc-softmmu \
902sparc64-softmmu \
Alexander Graf0f3301d2011-03-23 08:23:47 +0100903s390x-softmmu \
Max Filippovcfa550c2011-09-06 03:55:26 +0400904xtensa-softmmu \
905xtensaeb-softmmu \
Peter Maydell60e0df22011-05-03 14:50:13 +0100906"
907fi
908# the following are Linux specific
909if [ "$linux_user" = "yes" ] ; then
910 default_target_list="${default_target_list}\
911i386-linux-user \
912x86_64-linux-user \
913alpha-linux-user \
914arm-linux-user \
915armeb-linux-user \
916cris-linux-user \
917m68k-linux-user \
918microblaze-linux-user \
919microblazeel-linux-user \
920mips-linux-user \
921mipsel-linux-user \
922ppc-linux-user \
923ppc64-linux-user \
924ppc64abi32-linux-user \
925sh4-linux-user \
926sh4eb-linux-user \
927sparc-linux-user \
928sparc64-linux-user \
929sparc32plus-linux-user \
930unicore32-linux-user \
Alexander Graf0f3301d2011-03-23 08:23:47 +0100931s390x-linux-user \
Peter Maydell60e0df22011-05-03 14:50:13 +0100932"
933fi
934# the following are Darwin specific
935if [ "$darwin_user" = "yes" ] ; then
936 default_target_list="$default_target_list i386-darwin-user ppc-darwin-user "
937fi
938# the following are BSD specific
939if [ "$bsd_user" = "yes" ] ; then
940 default_target_list="${default_target_list}\
941i386-bsd-user \
942x86_64-bsd-user \
943sparc-bsd-user \
944sparc64-bsd-user \
945"
946fi
947
pbrookaf5db582006-04-08 14:26:41 +0000948if test x"$show_help" = x"yes" ; then
949cat << EOF
950
951Usage: configure [options]
952Options: [defaults in brackets after descriptions]
953
954EOF
955echo "Standard options:"
956echo " --help print this message"
957echo " --prefix=PREFIX install in PREFIX [$prefix]"
958echo " --interp-prefix=PREFIX where to find shared libraries, etc."
959echo " use %M for cpu name [$interp_prefix]"
Peter Maydell60e0df22011-05-03 14:50:13 +0100960echo " --target-list=LIST set target list (default: build everything)"
961echo "Available targets: $default_target_list" | \
962 fold -s -w 53 | sed -e 's/^/ /'
pbrookaf5db582006-04-08 14:26:41 +0000963echo ""
pbrookaf5db582006-04-08 14:26:41 +0000964echo "Advanced options (experts only):"
965echo " --source-path=PATH path of source code [$source_path]"
966echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
967echo " --cc=CC use C compiler CC [$cc]"
Paolo Bonzini0bfe8cc2010-05-26 16:08:18 +0200968echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
969echo " build time"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200970echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
Jan Kiszkae3fc14c2009-06-30 21:29:03 +0200971echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000972echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000973echo " --install=INSTALL use specified install [$install]"
Blue Swirlc886edf2011-07-22 21:08:09 +0000974echo " --python=PYTHON use specified python [$python]"
Brade2d88302011-09-02 16:53:28 -0400975echo " --smbd=SMBD use specified smbd [$smbd]"
pbrookaf5db582006-04-08 14:26:41 +0000976echo " --static enable static build [$static]"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200977echo " --mandir=PATH install man pages in PATH"
978echo " --datadir=PATH install firmware in PATH"
979echo " --docdir=PATH install documentation in PATH"
980echo " --bindir=PATH install binaries in PATH"
981echo " --sysconfdir=PATH install config in PATH/qemu"
aurel32f8393942009-04-13 18:45:38 +0000982echo " --enable-debug-tcg enable TCG debugging"
983echo " --disable-debug-tcg disable TCG debugging (default)"
Stefan Weil09695a42009-06-06 16:51:30 +0200984echo " --enable-debug enable common debug build options"
aliguori890b1652008-10-07 21:22:41 +0000985echo " --enable-sparse enable sparse checker"
986echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000987echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000988echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000989echo " --disable-sdl disable SDL"
Juan Quintelac4198152009-08-12 18:29:53 +0200990echo " --enable-sdl enable SDL"
Jes Sorensen821601e2011-03-16 13:33:36 +0100991echo " --disable-vnc disable VNC"
992echo " --enable-vnc enable VNC"
pbrookaf5db582006-04-08 14:26:41 +0000993echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000994echo " --audio-drv-list=LIST set audio drivers list:"
995echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000996echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
997echo " Available cards: $audio_possible_cards"
Markus Armbrustereb852012009-10-27 18:41:44 +0100998echo " --block-drv-whitelist=L set block driver whitelist"
999echo " (affects only QEMU, not qemu-img)"
malc8ff9cbf2008-06-23 18:33:30 +00001000echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +00001001echo " --disable-xen disable xen backend driver support"
Juan Quintelafc321b42009-08-12 18:29:55 +02001002echo " --enable-xen enable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +00001003echo " --disable-brlapi disable BrlAPI"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001004echo " --enable-brlapi enable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +00001005echo " --disable-vnc-tls disable TLS encryption for VNC server"
Juan Quintela1be10ad2009-08-12 18:20:28 +02001006echo " --enable-vnc-tls enable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +00001007echo " --disable-vnc-sasl disable SASL encryption for VNC server"
Juan Quintelaea784e32009-08-12 18:20:29 +02001008echo " --enable-vnc-sasl enable SASL encryption for VNC server"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001009echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
1010echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
Corentin Chary96763cf2010-07-07 20:58:06 +02001011echo " --disable-vnc-png disable PNG compression for VNC server (default)"
Corentin Charyefe556a2010-07-07 20:57:56 +02001012echo " --enable-vnc-png enable PNG compression for VNC server"
Corentin Charybd023f92010-07-07 20:58:02 +02001013echo " --disable-vnc-thread disable threaded VNC server"
1014echo " --enable-vnc-thread enable threaded VNC server"
pbrookaf896aa2008-03-23 00:47:42 +00001015echo " --disable-curses disable curses output"
Juan Quintelac584a6d2009-08-12 18:20:30 +02001016echo " --enable-curses enable curses output"
Alexander Graf769ce762009-05-11 17:41:42 +02001017echo " --disable-curl disable curl connectivity"
Juan Quintela788c8192009-08-12 18:29:47 +02001018echo " --enable-curl enable curl connectivity"
Juan Quintela2df87df2009-08-12 18:29:54 +02001019echo " --disable-fdt disable fdt device tree"
1020echo " --enable-fdt enable fdt device tree"
balrogfb599c92008-09-28 23:49:55 +00001021echo " --disable-bluez disable bluez stack connectivity"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001022echo " --enable-bluez enable bluez stack connectivity"
Peter Maydell6093d3d2011-05-23 10:13:47 +01001023echo " --disable-slirp disable SLIRP userspace network connectivity"
aliguori7ba1e612008-11-05 16:04:33 +00001024echo " --disable-kvm disable KVM acceleration support"
Juan Quintelab31a0272009-08-12 18:29:56 +02001025echo " --enable-kvm enable KVM acceleration support"
Stefan Weil9195b2c2011-10-19 07:07:18 +02001026echo " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
pbrookbd0c5662008-05-29 14:34:11 +00001027echo " --disable-nptl disable usermode NPTL support"
Andre Przywarae5934d32009-09-16 14:29:07 +02001028echo " --enable-nptl enable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +00001029echo " --enable-system enable all system emulation targets"
1030echo " --disable-system disable all system emulation targets"
Zachary Amsden0953a802009-07-30 00:14:59 -10001031echo " --enable-user enable supported user emulation targets"
1032echo " --disable-user disable all user emulation targets"
ths831b7822007-01-18 20:06:33 +00001033echo " --enable-linux-user enable all linux usermode emulation targets"
1034echo " --disable-linux-user disable all linux usermode emulation targets"
1035echo " --enable-darwin-user enable all darwin usermode emulation targets"
1036echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +00001037echo " --enable-bsd-user enable all BSD usermode emulation targets"
1038echo " --disable-bsd-user disable all BSD usermode emulation targets"
Paul Brook379f6692009-07-17 12:48:08 +01001039echo " --enable-guest-base enable GUEST_BASE support for usermode"
1040echo " emulation targets"
1041echo " --disable-guest-base disable GUEST_BASE support"
Avi Kivity40d64442011-11-15 20:12:17 +02001042echo " --enable-pie build Position Independent Executables"
1043echo " --disable-pie do not build Position Independent Executables"
pbrookaf5db582006-04-08 14:26:41 +00001044echo " --fmod-lib path to FMOD library"
1045echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +00001046echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +00001047echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
陳韋任235e5102011-11-07 17:42:05 +08001048echo " --cpu=CPU Build for host CPU [$cpu]"
blueswir131422552007-04-16 18:27:06 +00001049echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
Stefan Weilee682d22009-10-01 20:10:37 +02001050echo " --disable-uuid disable uuid support"
1051echo " --enable-uuid enable uuid support"
aliguorie0e6c8c02008-07-23 18:14:33 +00001052echo " --disable-vde disable support for vde network"
Juan Quinteladfb278b2009-08-12 18:20:27 +02001053echo " --enable-vde enable support for vde network"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001054echo " --disable-linux-aio disable Linux AIO support"
1055echo " --enable-linux-aio enable Linux AIO support"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07001056echo " --disable-attr disables attr and xattr support"
1057echo " --enable-attr enable attr and xattr support"
ths77755342008-11-27 15:45:16 +00001058echo " --disable-blobs disable installing provided firmware blobs"
Dirk Ullrichd2807bc2010-02-06 09:48:23 +01001059echo " --enable-docs enable documentation build"
1060echo " --disable-docs disable documentation build"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02001061echo " --disable-vhost-net disable vhost-net acceleration support"
1062echo " --enable-vhost-net enable vhost-net acceleration support"
Fabien Chouteau320fba22011-01-27 10:24:41 +01001063echo " --enable-trace-backend=B Set trace backend"
1064echo " Available backends:" $("$source_path"/scripts/tracetool --list-backends)
Paolo Bonzini74242e02010-12-23 11:44:02 +01001065echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
Prerna Saxena9410b562010-07-13 09:26:32 +01001066echo " Default:trace-<pid>"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01001067echo " --disable-spice disable spice"
1068echo " --enable-spice enable spice"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01001069echo " --enable-rbd enable building the rados block device (rbd)"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11001070echo " --disable-libiscsi disable iscsi support"
1071echo " --enable-libiscsi enable iscsi support"
Alon Levy36707142010-10-17 11:40:07 +02001072echo " --disable-smartcard disable smartcard support"
1073echo " --enable-smartcard enable smartcard support"
Robert Relyea111a38b2010-11-28 16:36:38 +02001074echo " --disable-smartcard-nss disable smartcard nss support"
1075echo " --enable-smartcard-nss enable smartcard nss support"
Hans de Goede69354a82011-07-19 11:04:10 +02001076echo " --disable-usb-redir disable usb network redirection support"
1077echo " --enable-usb-redir enable usb network redirection support"
Michael Rothd138cee2011-08-01 14:52:57 -05001078echo " --disable-guest-agent disable building of the QEMU Guest Agent"
1079echo " --enable-guest-agent enable building of the QEMU Guest Agent"
pbrookaf5db582006-04-08 14:26:41 +00001080echo ""
ths5bf08932006-12-23 00:33:26 +00001081echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +00001082exit 1
1083fi
1084
Peter Maydell359bc952011-12-24 13:07:25 +00001085# Now we have handled --enable-tcg-interpreter and know we're not just
1086# printing the help message, bail out if the host CPU isn't supported.
1087if test "$ARCH" = "unknown"; then
1088 if test "$tcg_interpreter" = "yes" ; then
1089 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1090 ARCH=tci
1091 else
1092 echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1093 exit 1
1094 fi
1095fi
1096
Paolo Bonzini8d050952010-12-23 11:43:52 +01001097# check that the C compiler works.
1098cat > $TMPC <<EOF
Stefan Weil75cafad2011-12-17 09:27:29 +01001099int main(void) { return 0; }
Paolo Bonzini8d050952010-12-23 11:43:52 +01001100EOF
1101
1102if compile_object ; then
1103 : C compiler works ok
1104else
1105 echo "ERROR: \"$cc\" either does not exist or does not work"
1106 exit 1
1107fi
1108
1109gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1110gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1111gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
Mike Frysingerf9188222011-05-17 17:08:43 -04001112gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
Paolo Bonzini8d050952010-12-23 11:43:52 +01001113cat > $TMPC << EOF
1114int main(void) { return 0; }
1115EOF
1116for flag in $gcc_flags; do
Stefan Weilbd947d32012-01-04 22:47:16 +01001117 if compile_prog "-Werror $flag" "" ; then
Paolo Bonzini8d050952010-12-23 11:43:52 +01001118 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1119 fi
1120done
1121
Avi Kivity40d64442011-11-15 20:12:17 +02001122if test "$static" = "yes" ; then
1123 if test "$pie" = "yes" ; then
1124 echo "static and pie are mutually incompatible"
1125 exit 1
1126 else
1127 pie="no"
1128 fi
1129fi
1130
1131if test "$pie" = ""; then
1132 case "$cpu-$targetos" in
Bradf9db31a2011-11-28 19:53:49 -05001133 i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD)
Avi Kivity40d64442011-11-15 20:12:17 +02001134 ;;
1135 *)
1136 pie="no"
1137 ;;
1138 esac
1139fi
1140
1141if test "$pie" != "no" ; then
1142 cat > $TMPC << EOF
Avi Kivity21d4a792011-11-23 11:24:25 +02001143
1144#ifdef __linux__
1145# define THREAD __thread
1146#else
1147# define THREAD
1148#endif
1149
1150static THREAD int tls_var;
1151
1152int main(void) { return tls_var; }
1153
Avi Kivity40d64442011-11-15 20:12:17 +02001154EOF
1155 if compile_prog "-fPIE -DPIE" "-pie"; then
1156 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1157 LDFLAGS="-pie $LDFLAGS"
1158 pie="yes"
1159 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1160 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1161 fi
1162 else
1163 if test "$pie" = "yes"; then
1164 echo "PIE not available due to missing toolchain support"
1165 exit 1
1166 else
1167 echo "Disabling PIE due to missing toolchain support"
1168 pie="no"
1169 fi
1170 fi
1171fi
1172
bellardec530c82006-04-25 22:36:06 +00001173#
1174# Solaris specific configure tool chain decisions
1175#
1176if test "$solaris" = "yes" ; then
Loïc Minier6792aa12010-01-20 11:35:54 +01001177 if has $install; then
1178 :
1179 else
bellardec530c82006-04-25 22:36:06 +00001180 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1181 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1182 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1183 exit 1
1184 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001185 if test "`path_of $install`" = "/usr/sbin/install" ; then
bellardec530c82006-04-25 22:36:06 +00001186 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1187 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1188 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1189 exit 1
1190 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001191 if has ar; then
1192 :
1193 else
bellardec530c82006-04-25 22:36:06 +00001194 echo "Error: No path includes ar"
1195 if test -f /usr/ccs/bin/ar ; then
1196 echo "Add /usr/ccs/bin to your path and rerun configure"
1197 fi
1198 exit 1
1199 fi
ths5fafdf22007-09-16 21:08:06 +00001200fi
bellardec530c82006-04-25 22:36:06 +00001201
Sebastian Herbszt7a3fc892011-12-31 12:14:47 +01001202if ! has $python; then
1203 echo "Python not found. Use --python=/path/to/python"
1204 exit 1
Blue Swirlc886edf2011-07-22 21:08:09 +00001205fi
1206
bellard5327cf42005-01-10 23:18:50 +00001207if test -z "$target_list" ; then
Peter Maydell60e0df22011-05-03 14:50:13 +01001208 target_list="$default_target_list"
bellard6e20a452005-06-05 15:56:02 +00001209else
pbrookb1a550a2006-04-16 13:28:56 +00001210 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +00001211fi
pbrook0a8e90f2006-03-19 14:54:16 +00001212if test -z "$target_list" ; then
1213 echo "No targets enabled"
1214 exit 1
1215fi
Paolo Bonzinif55fe272010-05-26 16:08:17 +02001216# see if system emulation was really requested
1217case " $target_list " in
1218 *"-softmmu "*) softmmu=yes
1219 ;;
1220 *) softmmu=no
1221 ;;
1222esac
bellard5327cf42005-01-10 23:18:50 +00001223
Juan Quintela249247c2009-08-12 18:20:25 +02001224feature_not_found() {
1225 feature=$1
1226
1227 echo "ERROR"
1228 echo "ERROR: User requested feature $feature"
Sebastian Herbszt9332f6a2009-09-13 21:32:54 +02001229 echo "ERROR: configure was not able to find it"
Juan Quintela249247c2009-08-12 18:20:25 +02001230 echo "ERROR"
1231 exit 1;
1232}
1233
bellard7d132992003-03-06 23:23:54 +00001234if test -z "$cross_prefix" ; then
1235
1236# ---
1237# big/little endian test
1238cat > $TMPC << EOF
1239#include <inttypes.h>
1240int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +00001241 volatile uint32_t i=0x01234567;
1242 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +00001243}
1244EOF
1245
Juan Quintela52166aa2009-08-03 14:46:03 +02001246if compile_prog "" "" ; then
bellard7d132992003-03-06 23:23:54 +00001247$TMPE && bigendian="yes"
1248else
1249echo big/little test failed
1250fi
1251
1252else
1253
1254# if cross compiling, cannot launch a program, so make a static guess
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001255case "$cpu" in
Peter Maydell21d89f82011-11-30 10:57:48 +01001256 arm)
1257 # ARM can be either way; ask the compiler which one we are
1258 if check_define __ARMEB__; then
1259 bigendian=yes
1260 fi
1261 ;;
1262 hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001263 bigendian=yes
1264 ;;
1265esac
bellard7d132992003-03-06 23:23:54 +00001266
1267fi
1268
Paolo Bonzini70be1a22010-12-23 11:43:54 +01001269# host long bits test, actually a pointer size test
1270cat > $TMPC << EOF
1271int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
1272EOF
1273if compile_object; then
1274hostlongbits=64
1275else
1276hostlongbits=32
1277fi
bellardb6853692005-06-05 17:10:39 +00001278
Juan Quintelab0a47e72009-08-12 18:29:49 +02001279
1280##########################################
1281# NPTL probe
1282
1283if test "$nptl" != "no" ; then
1284 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00001285#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00001286#include <linux/futex.h>
Stefan Weil182eacc2011-12-17 09:27:30 +01001287int main(void) {
pbrookbd0c5662008-05-29 14:34:11 +00001288#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1289#error bork
1290#endif
Stefan Weil182eacc2011-12-17 09:27:30 +01001291 return 0;
pbrookbd0c5662008-05-29 14:34:11 +00001292}
1293EOF
1294
Juan Quintelab0a47e72009-08-12 18:29:49 +02001295 if compile_object ; then
1296 nptl=yes
1297 else
1298 if test "$nptl" = "yes" ; then
1299 feature_not_found "nptl"
1300 fi
1301 nptl=no
1302 fi
pbrookbd0c5662008-05-29 14:34:11 +00001303fi
1304
bellard11d9f692004-04-02 20:55:59 +00001305##########################################
balrogac629222008-10-11 09:56:04 +00001306# zlib check
1307
Alon Levy1ece9902011-07-26 12:30:40 +03001308if test "$zlib" != "no" ; then
1309 cat > $TMPC << EOF
balrogac629222008-10-11 09:56:04 +00001310#include <zlib.h>
1311int main(void) { zlibVersion(); return 0; }
1312EOF
Alon Levy1ece9902011-07-26 12:30:40 +03001313 if compile_prog "" "-lz" ; then
1314 :
1315 else
1316 echo
1317 echo "Error: zlib check failed"
1318 echo "Make sure to have the zlib libs and headers installed."
1319 echo
1320 exit 1
1321 fi
balrogac629222008-10-11 09:56:04 +00001322fi
1323
1324##########################################
aliguorie37630c2009-04-22 15:19:10 +00001325# xen probe
1326
Juan Quintelafc321b42009-08-12 18:29:55 +02001327if test "$xen" != "no" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +02001328 xen_libs="-lxenstore -lxenctrl -lxenguest"
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001329
Stefan Weil50ced5b2011-12-17 09:27:39 +01001330 # First we test whether Xen headers and libraries are available.
1331 # If no, we are done and there is no Xen support.
1332 # If yes, more tests are run to detect the Xen version.
1333
1334 # Xen (any)
Juan Quintelab2266be2009-07-27 16:13:16 +02001335 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00001336#include <xenctrl.h>
1337#include <xs.h>
Stefan Weil50ced5b2011-12-17 09:27:39 +01001338int main(void) {
1339 return 0;
1340}
1341EOF
1342 if ! compile_prog "" "$xen_libs" ; then
1343 # Xen not found
1344 if test "$xen" = "yes" ; then
1345 feature_not_found "xen"
1346 fi
1347 xen=no
1348
1349 # Xen unstable
1350 elif (
1351 cat > $TMPC <<EOF
1352#include <xenctrl.h>
1353#include <xs.h>
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001354#include <stdint.h>
1355#include <xen/hvm/hvm_info_table.h>
1356#if !defined(HVM_MAX_VCPUS)
1357# error HVM_MAX_VCPUS not defined
1358#endif
1359int main(void) {
1360 xc_interface *xc;
1361 xs_daemon_open();
1362 xc = xc_interface_open(0, 0, 0);
1363 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1364 xc_gnttab_open(NULL, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001365 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001366 return 0;
1367}
aliguorie37630c2009-04-22 15:19:10 +00001368EOF
Stefan Weil50ced5b2011-12-17 09:27:39 +01001369 compile_prog "" "$xen_libs"
1370 ) ; then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001371 xen_ctrl_version=410
Juan Quintelafc321b42009-08-12 18:29:55 +02001372 xen=yes
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001373
1374 # Xen 4.0.0
1375 elif (
1376 cat > $TMPC <<EOF
1377#include <xenctrl.h>
1378#include <xs.h>
1379#include <stdint.h>
1380#include <xen/hvm/hvm_info_table.h>
1381#if !defined(HVM_MAX_VCPUS)
1382# error HVM_MAX_VCPUS not defined
1383#endif
1384int main(void) {
Anthony PERARDb87de242011-05-24 14:34:20 +01001385 struct xen_add_to_physmap xatp = {
1386 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1387 };
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001388 xs_daemon_open();
1389 xc_interface_open();
1390 xc_gnttab_open();
1391 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001392 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001393 return 0;
1394}
1395EOF
1396 compile_prog "" "$xen_libs"
1397 ) ; then
1398 xen_ctrl_version=400
1399 xen=yes
1400
Anthony PERARDb87de242011-05-24 14:34:20 +01001401 # Xen 3.4.0
1402 elif (
1403 cat > $TMPC <<EOF
1404#include <xenctrl.h>
1405#include <xs.h>
1406int main(void) {
1407 struct xen_add_to_physmap xatp = {
1408 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1409 };
1410 xs_daemon_open();
1411 xc_interface_open();
1412 xc_gnttab_open();
1413 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1414 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1415 return 0;
1416}
1417EOF
1418 compile_prog "" "$xen_libs"
1419 ) ; then
1420 xen_ctrl_version=340
1421 xen=yes
1422
1423 # Xen 3.3.0
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001424 elif (
1425 cat > $TMPC <<EOF
1426#include <xenctrl.h>
1427#include <xs.h>
1428int main(void) {
1429 xs_daemon_open();
1430 xc_interface_open();
1431 xc_gnttab_open();
1432 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1433 return 0;
1434}
1435EOF
1436 compile_prog "" "$xen_libs"
1437 ) ; then
1438 xen_ctrl_version=330
1439 xen=yes
1440
Stefan Weil50ced5b2011-12-17 09:27:39 +01001441 # Xen version unsupported
Juan Quintelab2266be2009-07-27 16:13:16 +02001442 else
Juan Quintelafc321b42009-08-12 18:29:55 +02001443 if test "$xen" = "yes" ; then
Stefan Weil50ced5b2011-12-17 09:27:39 +01001444 feature_not_found "xen (unsupported version)"
Juan Quintelafc321b42009-08-12 18:29:55 +02001445 fi
1446 xen=no
Juan Quintelab2266be2009-07-27 16:13:16 +02001447 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001448
1449 if test "$xen" = yes; then
1450 libs_softmmu="$xen_libs $libs_softmmu"
1451 fi
aliguorie37630c2009-04-22 15:19:10 +00001452fi
1453
1454##########################################
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001455# pkg-config probe
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001456
Sergei Trofimovich17884d72012-01-31 22:03:45 +03001457if ! has "$pkg_config_exe"; then
1458 echo "Error: pkg-config binary '$pkg_config_exe' not found"
Peter Maydella213fcb2011-09-15 12:15:56 +01001459 exit 1
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001460fi
1461
1462##########################################
Alon Levy44dc0ca2011-05-15 11:51:28 +03001463# libtool probe
1464
Brad3f534582011-08-13 20:30:14 -04001465if ! has $libtool; then
Alon Levy44dc0ca2011-05-15 11:51:28 +03001466 libtool=
Alon Levy44dc0ca2011-05-15 11:51:28 +03001467fi
1468
1469##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02001470# Sparse probe
1471if test "$sparse" != "no" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001472 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02001473 sparse=yes
1474 else
1475 if test "$sparse" = "yes" ; then
1476 feature_not_found "sparse"
1477 fi
1478 sparse=no
1479 fi
1480fi
1481
1482##########################################
bellard11d9f692004-04-02 20:55:59 +00001483# SDL probe
1484
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001485# Look for sdl configuration program (pkg-config or sdl-config). Try
1486# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1487if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1488 sdl_config=sdl-config
1489fi
1490
1491if $pkg_config sdl --modversion >/dev/null 2>&1; then
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001492 sdlconfig="$pkg_config sdl"
Stefan Weilfec0e3e2010-04-11 18:44:18 +02001493 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001494elif has ${sdl_config}; then
1495 sdlconfig="$sdl_config"
Paolo Bonzini9316f802010-01-13 09:52:55 +01001496 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00001497else
1498 if test "$sdl" = "yes" ; then
1499 feature_not_found "sdl"
1500 fi
1501 sdl=no
Paolo Bonzini9316f802010-01-13 09:52:55 +01001502fi
Scott Wood29e5bad2011-04-08 14:15:50 -05001503if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001504 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1505fi
bellard11d9f692004-04-02 20:55:59 +00001506
Paolo Bonzini9316f802010-01-13 09:52:55 +01001507sdl_too_old=no
Juan Quintelac4198152009-08-12 18:29:53 +02001508if test "$sdl" != "no" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001509 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00001510#include <SDL.h>
1511#undef main /* We don't want SDL to override our main() */
1512int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1513EOF
Paolo Bonzini9316f802010-01-13 09:52:55 +01001514 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
TeLeMan74f42e12010-02-08 13:56:44 +08001515 if test "$static" = "yes" ; then
1516 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1517 else
1518 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1519 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001520 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001521 if test "$_sdlversion" -lt 121 ; then
1522 sdl_too_old=yes
1523 else
1524 if test "$cocoa" = "no" ; then
1525 sdl=yes
1526 fi
1527 fi
aliguoricd01b4a2008-08-21 19:25:45 +00001528
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001529 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Juan Quintelaac119f92009-07-27 16:13:15 +02001530 if test "$sdl" = "yes" -a "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001531 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weilf8aa6c72010-03-01 22:10:46 +01001532 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1533 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
Juan Quintelaac119f92009-07-27 16:13:15 +02001534 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001535 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001536 :
1537 else
1538 sdl=no
1539 fi
1540 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02001541 else # sdl not found
1542 if test "$sdl" = "yes" ; then
1543 feature_not_found "sdl"
1544 fi
1545 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02001546 fi # sdl compile test
Juan Quintelaa68551b2009-07-27 16:13:09 +02001547fi
bellard11d9f692004-04-02 20:55:59 +00001548
aliguori5368a422009-03-03 17:37:21 +00001549if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001550 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00001551#include <SDL.h>
1552#if defined(SDL_VIDEO_DRIVER_X11)
1553#include <X11/XKBlib.h>
1554#else
1555#error No x11 support
1556#endif
1557int main(void) { return 0; }
1558EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001559 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001560 sdl_libs="$sdl_libs -lX11"
1561 fi
Juan Quintela07056672009-08-03 14:46:27 +02001562 libs_softmmu="$sdl_libs $libs_softmmu"
aliguori5368a422009-03-03 17:37:21 +00001563fi
1564
ths8f28f3f2007-01-05 21:25:54 +00001565##########################################
ths8d5d2d42007-08-25 01:37:51 +00001566# VNC TLS detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001567if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
Juan Quintela1be10ad2009-08-12 18:20:28 +02001568 cat > $TMPC <<EOF
aliguoriae6b5e52008-08-06 16:55:50 +00001569#include <gnutls/gnutls.h>
1570int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1571EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001572 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1573 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
Juan Quintela1be10ad2009-08-12 18:20:28 +02001574 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1575 vnc_tls=yes
1576 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1577 else
1578 if test "$vnc_tls" = "yes" ; then
1579 feature_not_found "vnc-tls"
aliguoriae6b5e52008-08-06 16:55:50 +00001580 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02001581 vnc_tls=no
1582 fi
ths8d5d2d42007-08-25 01:37:51 +00001583fi
1584
1585##########################################
aliguori2f9606b2009-03-06 20:27:28 +00001586# VNC SASL detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001587if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02001588 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00001589#include <sasl/sasl.h>
1590#include <stdio.h>
1591int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1592EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02001593 # Assuming Cyrus-SASL installed in /usr prefix
1594 vnc_sasl_cflags=""
1595 vnc_sasl_libs="-lsasl2"
1596 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1597 vnc_sasl=yes
1598 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1599 else
1600 if test "$vnc_sasl" = "yes" ; then
1601 feature_not_found "vnc-sasl"
aliguori2f9606b2009-03-06 20:27:28 +00001602 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02001603 vnc_sasl=no
1604 fi
aliguori2f9606b2009-03-06 20:27:28 +00001605fi
1606
1607##########################################
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001608# VNC JPEG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001609if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001610cat > $TMPC <<EOF
1611#include <stdio.h>
1612#include <jpeglib.h>
1613int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1614EOF
1615 vnc_jpeg_cflags=""
1616 vnc_jpeg_libs="-ljpeg"
1617 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1618 vnc_jpeg=yes
1619 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1620 else
1621 if test "$vnc_jpeg" = "yes" ; then
1622 feature_not_found "vnc-jpeg"
1623 fi
1624 vnc_jpeg=no
1625 fi
1626fi
1627
1628##########################################
Corentin Charyefe556a2010-07-07 20:57:56 +02001629# VNC PNG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001630if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02001631cat > $TMPC <<EOF
1632//#include <stdio.h>
1633#include <png.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05001634#include <stddef.h>
Corentin Charyefe556a2010-07-07 20:57:56 +02001635int main(void) {
1636 png_structp png_ptr;
1637 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1638 return 0;
1639}
1640EOF
Brad9af80252011-07-30 01:45:55 -04001641 if $pkg_config libpng --modversion >/dev/null 2>&1; then
1642 vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
1643 vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
1644 else
Corentin Charyefe556a2010-07-07 20:57:56 +02001645 vnc_png_cflags=""
1646 vnc_png_libs="-lpng"
Brad9af80252011-07-30 01:45:55 -04001647 fi
Corentin Charyefe556a2010-07-07 20:57:56 +02001648 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1649 vnc_png=yes
1650 libs_softmmu="$vnc_png_libs $libs_softmmu"
Brad9af80252011-07-30 01:45:55 -04001651 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
Corentin Charyefe556a2010-07-07 20:57:56 +02001652 else
1653 if test "$vnc_png" = "yes" ; then
1654 feature_not_found "vnc-png"
1655 fi
1656 vnc_png=no
1657 fi
1658fi
1659
1660##########################################
aliguori76655d62009-03-06 20:27:37 +00001661# fnmatch() probe, used for ACL routines
1662fnmatch="no"
1663cat > $TMPC << EOF
1664#include <fnmatch.h>
1665int main(void)
1666{
1667 fnmatch("foo", "foo", 0);
1668 return 0;
1669}
1670EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001671if compile_prog "" "" ; then
aliguori76655d62009-03-06 20:27:37 +00001672 fnmatch="yes"
1673fi
1674
1675##########################################
Stefan Weilee682d22009-10-01 20:10:37 +02001676# uuid_generate() probe, used for vdi block driver
1677if test "$uuid" != "no" ; then
1678 uuid_libs="-luuid"
1679 cat > $TMPC << EOF
1680#include <uuid/uuid.h>
1681int main(void)
1682{
1683 uuid_t my_uuid;
1684 uuid_generate(my_uuid);
1685 return 0;
1686}
1687EOF
1688 if compile_prog "" "$uuid_libs" ; then
1689 uuid="yes"
1690 libs_softmmu="$uuid_libs $libs_softmmu"
1691 libs_tools="$uuid_libs $libs_tools"
1692 else
1693 if test "$uuid" = "yes" ; then
1694 feature_not_found "uuid"
1695 fi
1696 uuid=no
1697 fi
1698fi
1699
1700##########################################
Christoph Hellwigdce512d2010-12-17 11:41:15 +01001701# xfsctl() probe, used for raw-posix
1702if test "$xfs" != "no" ; then
1703 cat > $TMPC << EOF
Stefan Weilffc41d12011-12-17 09:27:36 +01001704#include <stddef.h> /* NULL */
Christoph Hellwigdce512d2010-12-17 11:41:15 +01001705#include <xfs/xfs.h>
1706int main(void)
1707{
1708 xfsctl(NULL, 0, 0, NULL);
1709 return 0;
1710}
1711EOF
1712 if compile_prog "" "" ; then
1713 xfs="yes"
1714 else
1715 if test "$xfs" = "yes" ; then
1716 feature_not_found "xfs"
1717 fi
1718 xfs=no
1719 fi
1720fi
1721
1722##########################################
ths8a16d272008-07-19 09:56:24 +00001723# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02001724if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02001725 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00001726 cat > $TMPC << EOF
1727#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00001728int main(void)
1729{
1730 struct vde_open_args a = {0, 0, 0};
1731 vde_open("", "", &a);
1732 return 0;
1733}
ths8a16d272008-07-19 09:56:24 +00001734EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001735 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02001736 vde=yes
Juan Quintela8e02e542009-08-03 14:47:07 +02001737 libs_softmmu="$vde_libs $libs_softmmu"
1738 libs_tools="$vde_libs $libs_tools"
Juan Quinteladfb278b2009-08-12 18:20:27 +02001739 else
1740 if test "$vde" = "yes" ; then
1741 feature_not_found "vde"
1742 fi
1743 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02001744 fi
ths8a16d272008-07-19 09:56:24 +00001745fi
1746
1747##########################################
malcc2de5c92008-06-28 19:13:06 +00001748# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00001749
malcc2de5c92008-06-28 19:13:06 +00001750audio_drv_probe()
1751{
1752 drv=$1
1753 hdr=$2
1754 lib=$3
1755 exp=$4
1756 cfl=$5
1757 cat > $TMPC << EOF
1758#include <$hdr>
1759int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00001760EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001761 if compile_prog "$cfl" "$lib" ; then
malcc2de5c92008-06-28 19:13:06 +00001762 :
1763 else
1764 echo
1765 echo "Error: $drv check failed"
1766 echo "Make sure to have the $drv libs and headers installed."
1767 echo
1768 exit 1
1769 fi
1770}
1771
malc2fa7d3b2008-07-29 12:58:44 +00001772audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00001773for drv in $audio_drv_list; do
1774 case $drv in
1775 alsa)
1776 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1777 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001778 libs_softmmu="-lasound $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00001779 ;;
1780
1781 fmod)
1782 if test -z $fmod_lib || test -z $fmod_inc; then
1783 echo
1784 echo "Error: You must specify path to FMOD library and headers"
1785 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1786 echo
1787 exit 1
1788 fi
1789 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001790 libs_softmmu="$fmod_lib $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00001791 ;;
1792
1793 esd)
1794 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001795 libs_softmmu="-lesd $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02001796 audio_pt_int="yes"
malcc2de5c92008-06-28 19:13:06 +00001797 ;;
malcb8e59f12008-07-02 21:03:08 +00001798
1799 pa)
Aurelien Jarno493abda2009-11-16 17:52:03 +01001800 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
Marc-Antoine Perennou20fa53e2011-04-29 05:59:19 +00001801 "pa_simple *s = 0; pa_simple_free(s); return 0;"
Aurelien Jarno493abda2009-11-16 17:52:03 +01001802 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02001803 audio_pt_int="yes"
malcb8e59f12008-07-02 21:03:08 +00001804 ;;
1805
Juan Quintela997e6902009-08-03 14:46:29 +02001806 coreaudio)
1807 libs_softmmu="-framework CoreAudio $libs_softmmu"
1808 ;;
1809
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001810 dsound)
1811 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
malcd5631632009-10-10 01:13:41 +04001812 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001813 ;;
1814
1815 oss)
1816 libs_softmmu="$oss_lib $libs_softmmu"
1817 ;;
1818
1819 sdl|wav)
blueswir12f6a1ab2008-08-21 18:00:53 +00001820 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1821 ;;
1822
malcd5631632009-10-10 01:13:41 +04001823 winwave)
1824 libs_softmmu="-lwinmm $libs_softmmu"
1825 audio_win_int="yes"
1826 ;;
1827
malce4c63a62008-07-19 16:15:16 +00001828 *)
malc1c9b2a52008-07-19 16:57:30 +00001829 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001830 echo
1831 echo "Error: Unknown driver '$drv' selected"
1832 echo "Possible drivers are: $audio_possible_drivers"
1833 echo
1834 exit 1
1835 }
1836 ;;
malcc2de5c92008-06-28 19:13:06 +00001837 esac
1838done
ths8f28f3f2007-01-05 21:25:54 +00001839
balrog4d3b6f62008-02-10 16:33:14 +00001840##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001841# BrlAPI probe
1842
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001843if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001844 brlapi_libs="-lbrlapi"
1845 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00001846#include <brlapi.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05001847#include <stddef.h>
aurel322e4d9fb2008-04-08 06:01:02 +00001848int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1849EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001850 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001851 brlapi=yes
Juan Quintela264606b2009-08-03 14:46:39 +02001852 libs_softmmu="$brlapi_libs $libs_softmmu"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001853 else
1854 if test "$brlapi" = "yes" ; then
1855 feature_not_found "brlapi"
1856 fi
1857 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02001858 fi
1859fi
aurel322e4d9fb2008-04-08 06:01:02 +00001860
1861##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001862# curses probe
Stefan Weile095e2f2011-02-27 20:23:30 +01001863if test "$mingw32" = "yes" ; then
1864 curses_list="-lpdcurses"
1865else
1866 curses_list="-lncurses -lcurses"
1867fi
balrog4d3b6f62008-02-10 16:33:14 +00001868
Juan Quintelac584a6d2009-08-12 18:20:30 +02001869if test "$curses" != "no" ; then
1870 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00001871 cat > $TMPC << EOF
1872#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001873#ifdef __OpenBSD__
1874#define resize_term resizeterm
1875#endif
Stefan Weilef9a2522011-12-17 17:46:02 +01001876int main(void) {
1877 const char *s = curses_version();
1878 resize_term(0, 0);
1879 return s != 0;
1880}
balrog4d3b6f62008-02-10 16:33:14 +00001881EOF
Juan Quintela4f78ef92009-08-12 18:20:23 +02001882 for curses_lib in $curses_list; do
1883 if compile_prog "" "$curses_lib" ; then
Juan Quintelac584a6d2009-08-12 18:20:30 +02001884 curses_found=yes
Juan Quintela4f78ef92009-08-12 18:20:23 +02001885 libs_softmmu="$curses_lib $libs_softmmu"
1886 break
1887 fi
1888 done
Juan Quintelac584a6d2009-08-12 18:20:30 +02001889 if test "$curses_found" = "yes" ; then
1890 curses=yes
1891 else
1892 if test "$curses" = "yes" ; then
1893 feature_not_found "curses"
1894 fi
1895 curses=no
1896 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02001897fi
balrog4d3b6f62008-02-10 16:33:14 +00001898
blueswir1414f0da2008-08-15 18:20:52 +00001899##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001900# curl probe
1901
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001902if $pkg_config libcurl --modversion >/dev/null 2>&1; then
1903 curlconfig="$pkg_config libcurl"
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01001904else
1905 curlconfig=curl-config
1906fi
1907
Juan Quintela788c8192009-08-12 18:29:47 +02001908if test "$curl" != "no" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001909 cat > $TMPC << EOF
1910#include <curl/curl.h>
Peter Maydell0b862ce2011-06-09 22:54:29 +01001911int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
Alexander Graf769ce762009-05-11 17:41:42 +02001912EOF
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01001913 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1914 curl_libs=`$curlconfig --libs 2>/dev/null`
Juan Quintelab1d5a272009-08-03 14:46:05 +02001915 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001916 curl=yes
Juan Quintelaf0302932009-08-03 14:47:08 +02001917 libs_tools="$curl_libs $libs_tools"
1918 libs_softmmu="$curl_libs $libs_softmmu"
Juan Quintela788c8192009-08-12 18:29:47 +02001919 else
1920 if test "$curl" = "yes" ; then
1921 feature_not_found "curl"
1922 fi
1923 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02001924 fi
1925fi # test "$curl"
1926
1927##########################################
balrogfb599c92008-09-28 23:49:55 +00001928# bluez support probe
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001929if test "$bluez" != "no" ; then
balroge820e3f2008-09-30 02:27:44 +00001930 cat > $TMPC << EOF
1931#include <bluetooth/bluetooth.h>
1932int main(void) { return bt_error(0); }
1933EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001934 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1935 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +02001936 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001937 bluez=yes
Juan Quintelae482d562009-08-03 14:46:37 +02001938 libs_softmmu="$bluez_libs $libs_softmmu"
balroge820e3f2008-09-30 02:27:44 +00001939 else
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001940 if test "$bluez" = "yes" ; then
1941 feature_not_found "bluez"
1942 fi
balroge820e3f2008-09-30 02:27:44 +00001943 bluez="no"
1944 fi
balrogfb599c92008-09-28 23:49:55 +00001945fi
1946
1947##########################################
Anthony Liguorie18df142011-07-19 14:50:29 -05001948# glib support probe
Stefan Hajnoczi4b76a482011-08-08 13:04:05 +05301949if $pkg_config --modversion gthread-2.0 > /dev/null 2>&1 ; then
1950 glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
1951 glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
Anthony Liguori14015302011-08-20 22:18:37 -05001952 LIBS="$glib_libs $LIBS"
Michael Roth957f1f92011-08-11 15:38:12 -05001953 libs_qga="$glib_libs $libs_qga"
Stefan Hajnoczi4b76a482011-08-08 13:04:05 +05301954else
1955 echo "glib-2.0 required to compile QEMU"
1956 exit 1
Anthony Liguorie18df142011-07-19 14:50:29 -05001957fi
1958
1959##########################################
M. Mohan Kumar17bff522011-12-14 13:58:42 +05301960# libcap probe
1961
1962if test "$cap" != "no" ; then
1963 cat > $TMPC <<EOF
1964#include <stdio.h>
1965#include <sys/capability.h>
1966int main(void) { cap_t caps; caps = cap_init(); }
1967EOF
1968 if compile_prog "" "-lcap" ; then
1969 cap=yes
1970 else
1971 cap=no
1972 fi
1973fi
1974
1975##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001976# pthread probe
Brad4b29ec42011-08-07 20:02:11 -04001977PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00001978
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02001979pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00001980cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001981#include <pthread.h>
Stefan Weil7a42bbe2011-12-17 09:27:32 +01001982static void *f(void *p) { return NULL; }
1983int main(void) {
1984 pthread_t thread;
1985 pthread_create(&thread, 0, f, 0);
1986 return 0;
1987}
blueswir1414f0da2008-08-15 18:20:52 +00001988EOF
Andreas Färberbd00d532010-09-20 00:50:44 +02001989if compile_prog "" "" ; then
1990 pthread=yes
1991else
1992 for pthread_lib in $PTHREADLIBS_LIST; do
1993 if compile_prog "" "$pthread_lib" ; then
1994 pthread=yes
1995 LIBS="$pthread_lib $LIBS"
1996 break
1997 fi
1998 done
1999fi
blueswir1414f0da2008-08-15 18:20:52 +00002000
Anthony Liguori4617e592009-08-25 17:21:56 -05002001if test "$mingw32" != yes -a "$pthread" = no; then
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02002002 echo
2003 echo "Error: pthread check failed"
2004 echo "Make sure to have the pthread libs and headers installed."
2005 echo
2006 exit 1
aliguorie5d355d2009-04-24 18:03:15 +00002007fi
2008
aliguoribf9298b2008-12-05 20:05:26 +00002009##########################################
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002010# rbd probe
2011if test "$rbd" != "no" ; then
2012 cat > $TMPC <<EOF
2013#include <stdio.h>
Josh Durginad32e9c2011-05-26 16:07:31 -07002014#include <rbd/librbd.h>
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002015int main(void) {
Josh Durginad32e9c2011-05-26 16:07:31 -07002016 rados_t cluster;
2017 rados_create(&cluster, NULL);
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002018 return 0;
2019}
2020EOF
Josh Durginad32e9c2011-05-26 16:07:31 -07002021 rbd_libs="-lrbd -lrados"
2022 if compile_prog "" "$rbd_libs" ; then
2023 rbd=yes
2024 libs_tools="$rbd_libs $libs_tools"
2025 libs_softmmu="$rbd_libs $libs_softmmu"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002026 else
2027 if test "$rbd" = "yes" ; then
2028 feature_not_found "rados block device"
2029 fi
2030 rbd=no
2031 fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002032fi
2033
2034##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002035# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002036
2037if test "$linux_aio" != "no" ; then
2038 cat > $TMPC <<EOF
2039#include <libaio.h>
2040#include <sys/eventfd.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002041#include <stddef.h>
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002042int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2043EOF
2044 if compile_prog "" "-laio" ; then
2045 linux_aio=yes
Paul Brook048d1792010-05-05 16:32:59 +01002046 libs_softmmu="$libs_softmmu -laio"
2047 libs_tools="$libs_tools -laio"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002048 else
2049 if test "$linux_aio" = "yes" ; then
2050 feature_not_found "linux AIO"
2051 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03002052 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002053 fi
2054fi
2055
2056##########################################
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002057# attr probe
2058
2059if test "$attr" != "no" ; then
2060 cat > $TMPC <<EOF
2061#include <stdio.h>
2062#include <sys/types.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002063#ifdef CONFIG_LIBATTR
2064#include <attr/xattr.h>
2065#else
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002066#include <sys/xattr.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002067#endif
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002068int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2069EOF
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002070 if compile_prog "" "" ; then
2071 attr=yes
2072 # Older distros have <attr/xattr.h>, and need -lattr:
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002073 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002074 attr=yes
2075 LIBS="-lattr $LIBS"
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002076 libattr=yes
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002077 else
2078 if test "$attr" = "yes" ; then
2079 feature_not_found "ATTR"
2080 fi
2081 attr=no
2082 fi
2083fi
2084
2085##########################################
aliguoribf9298b2008-12-05 20:05:26 +00002086# iovec probe
2087cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00002088#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00002089#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00002090#include <unistd.h>
Stefan Weilf91f9be2011-12-17 09:27:33 +01002091int main(void) { return sizeof(struct iovec); }
aliguoribf9298b2008-12-05 20:05:26 +00002092EOF
2093iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002094if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00002095 iovec=yes
2096fi
2097
aurel32f652e6a2008-12-16 10:43:48 +00002098##########################################
aliguoriceb42de2009-04-07 18:43:28 +00002099# preadv probe
2100cat > $TMPC <<EOF
2101#include <sys/types.h>
2102#include <sys/uio.h>
2103#include <unistd.h>
Stefan Weil84972cb2011-12-17 09:27:38 +01002104int main(void) { return preadv == preadv; }
aliguoriceb42de2009-04-07 18:43:28 +00002105EOF
2106preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002107if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00002108 preadv=yes
2109fi
2110
2111##########################################
aurel32f652e6a2008-12-16 10:43:48 +00002112# fdt probe
Juan Quintela2df87df2009-08-12 18:29:54 +02002113if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02002114 fdt_libs="-lfdt"
2115 cat > $TMPC << EOF
aurel32f652e6a2008-12-16 10:43:48 +00002116int main(void) { return 0; }
2117EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002118 if compile_prog "" "$fdt_libs" ; then
aurel32f652e6a2008-12-16 10:43:48 +00002119 fdt=yes
Juan Quintela2df87df2009-08-12 18:29:54 +02002120 else
2121 if test "$fdt" = "yes" ; then
2122 feature_not_found "fdt"
2123 fi
Michael Wallede3a3542011-04-26 00:24:07 +02002124 fdt_libs=
Juan Quintela2df87df2009-08-12 18:29:54 +02002125 fdt=no
aurel32f652e6a2008-12-16 10:43:48 +00002126 fi
2127fi
2128
Michael Walle20ff0752011-03-07 23:32:39 +01002129##########################################
2130# opengl probe, used by milkymist-tmu2
2131if test "$opengl" != "no" ; then
2132 opengl_libs="-lGL"
2133 cat > $TMPC << EOF
2134#include <X11/Xlib.h>
2135#include <GL/gl.h>
2136#include <GL/glx.h>
Stefan Weil84972cb2011-12-17 09:27:38 +01002137int main(void) { return GL_VERSION != 0; }
Michael Walle20ff0752011-03-07 23:32:39 +01002138EOF
2139 if compile_prog "" "-lGL" ; then
2140 opengl=yes
Michael Walle20ff0752011-03-07 23:32:39 +01002141 else
2142 if test "$opengl" = "yes" ; then
2143 feature_not_found "opengl"
2144 fi
Michael Wallede3a3542011-04-26 00:24:07 +02002145 opengl_libs=
Michael Walle20ff0752011-03-07 23:32:39 +01002146 opengl=no
2147 fi
2148fi
2149
aurel323b3f24a2009-04-15 16:12:13 +00002150#
2151# Check for xxxat() functions when we are building linux-user
2152# emulator. This is done because older glibc versions don't
2153# have syscall stubs for these implemented.
2154#
2155atfile=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03002156cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00002157#define _ATFILE_SOURCE
2158#include <sys/types.h>
2159#include <fcntl.h>
2160#include <unistd.h>
2161
2162int
2163main(void)
2164{
2165 /* try to unlink nonexisting file */
2166 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
2167}
2168EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002169if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03002170 atfile=yes
aurel323b3f24a2009-04-15 16:12:13 +00002171fi
2172
aurel3239386ac2009-04-15 19:48:17 +00002173# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00002174# emulator. This is done because older glibc versions don't
2175# have syscall stubs for these implemented. In that case we
2176# don't provide them even if kernel supports them.
2177#
2178inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03002179cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00002180#include <sys/inotify.h>
2181
2182int
2183main(void)
2184{
2185 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00002186 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00002187}
2188EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002189if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03002190 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00002191fi
2192
Riku Voipioc05c7a72010-03-26 15:25:11 +00002193inotify1=no
2194cat > $TMPC << EOF
2195#include <sys/inotify.h>
2196
2197int
2198main(void)
2199{
2200 /* try to start inotify */
2201 return inotify_init1(0);
2202}
2203EOF
2204if compile_prog "" "" ; then
2205 inotify1=yes
2206fi
2207
Riku Voipioebc996f2009-04-21 15:01:51 +03002208# check if utimensat and futimens are supported
2209utimens=no
2210cat > $TMPC << EOF
2211#define _ATFILE_SOURCE
Riku Voipioebc996f2009-04-21 15:01:51 +03002212#include <stddef.h>
2213#include <fcntl.h>
2214
2215int main(void)
2216{
2217 utimensat(AT_FDCWD, "foo", NULL, 0);
2218 futimens(0, NULL);
2219 return 0;
2220}
2221EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002222if compile_prog "" "" ; then
Riku Voipioebc996f2009-04-21 15:01:51 +03002223 utimens=yes
2224fi
2225
Riku Voipio099d6b02009-05-05 12:10:04 +03002226# check if pipe2 is there
2227pipe2=no
2228cat > $TMPC << EOF
Riku Voipio099d6b02009-05-05 12:10:04 +03002229#include <unistd.h>
2230#include <fcntl.h>
2231
2232int main(void)
2233{
2234 int pipefd[2];
2235 pipe2(pipefd, O_CLOEXEC);
2236 return 0;
2237}
2238EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002239if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03002240 pipe2=yes
2241fi
2242
Kevin Wolf40ff6d72009-12-02 12:24:42 +01002243# check if accept4 is there
2244accept4=no
2245cat > $TMPC << EOF
Kevin Wolf40ff6d72009-12-02 12:24:42 +01002246#include <sys/socket.h>
2247#include <stddef.h>
2248
2249int main(void)
2250{
2251 accept4(0, NULL, NULL, SOCK_CLOEXEC);
2252 return 0;
2253}
2254EOF
2255if compile_prog "" "" ; then
2256 accept4=yes
2257fi
2258
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302259# check if tee/splice is there. vmsplice was added same time.
2260splice=no
2261cat > $TMPC << EOF
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302262#include <unistd.h>
2263#include <fcntl.h>
2264#include <limits.h>
2265
2266int main(void)
2267{
Stefan Weil66ea0f22011-12-17 09:27:35 +01002268 int len, fd = 0;
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302269 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
2270 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
2271 return 0;
2272}
2273EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002274if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302275 splice=yes
2276fi
2277
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03002278##########################################
2279# signalfd probe
2280signalfd="no"
2281cat > $TMPC << EOF
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03002282#include <unistd.h>
2283#include <sys/syscall.h>
2284#include <signal.h>
2285int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2286EOF
2287
2288if compile_prog "" "" ; then
2289 signalfd=yes
2290fi
2291
Riku Voipioc2882b92009-08-12 15:08:24 +03002292# check if eventfd is supported
2293eventfd=no
2294cat > $TMPC << EOF
2295#include <sys/eventfd.h>
2296
2297int main(void)
2298{
Stefan Weil55cc7f32011-12-17 09:27:37 +01002299 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
Riku Voipioc2882b92009-08-12 15:08:24 +03002300}
2301EOF
2302if compile_prog "" "" ; then
2303 eventfd=yes
2304fi
2305
Ulrich Hechtd0927932009-09-17 20:22:14 +03002306# check for fallocate
2307fallocate=no
2308cat > $TMPC << EOF
2309#include <fcntl.h>
2310
2311int main(void)
2312{
2313 fallocate(0, 0, 0, 0);
2314 return 0;
2315}
2316EOF
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +02002317if compile_prog "$ARCH_CFLAGS" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03002318 fallocate=yes
2319fi
2320
Peter Maydellc727f472011-01-06 11:05:10 +00002321# check for sync_file_range
2322sync_file_range=no
2323cat > $TMPC << EOF
2324#include <fcntl.h>
2325
2326int main(void)
2327{
2328 sync_file_range(0, 0, 0, 0);
2329 return 0;
2330}
2331EOF
2332if compile_prog "$ARCH_CFLAGS" "" ; then
2333 sync_file_range=yes
2334fi
2335
Peter Maydelldace20d2011-01-10 13:11:24 +00002336# check for linux/fiemap.h and FS_IOC_FIEMAP
2337fiemap=no
2338cat > $TMPC << EOF
2339#include <sys/ioctl.h>
2340#include <linux/fs.h>
2341#include <linux/fiemap.h>
2342
2343int main(void)
2344{
2345 ioctl(0, FS_IOC_FIEMAP, 0);
2346 return 0;
2347}
2348EOF
2349if compile_prog "$ARCH_CFLAGS" "" ; then
2350 fiemap=yes
2351fi
2352
Ulrich Hechtd0927932009-09-17 20:22:14 +03002353# check for dup3
2354dup3=no
2355cat > $TMPC << EOF
2356#include <unistd.h>
2357
2358int main(void)
2359{
2360 dup3(0, 0, 0);
2361 return 0;
2362}
2363EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01002364if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03002365 dup3=yes
2366fi
2367
Peter Maydell3b6edd12011-02-15 18:35:05 +00002368# check for epoll support
2369epoll=no
2370cat > $TMPC << EOF
2371#include <sys/epoll.h>
2372
2373int main(void)
2374{
2375 epoll_create(0);
2376 return 0;
2377}
2378EOF
2379if compile_prog "$ARCH_CFLAGS" "" ; then
2380 epoll=yes
2381fi
2382
2383# epoll_create1 and epoll_pwait are later additions
2384# so we must check separately for their presence
2385epoll_create1=no
2386cat > $TMPC << EOF
2387#include <sys/epoll.h>
2388
2389int main(void)
2390{
Peter Maydell19e83f62011-04-26 16:56:40 +01002391 /* Note that we use epoll_create1 as a value, not as
2392 * a function being called. This is necessary so that on
2393 * old SPARC glibc versions where the function was present in
2394 * the library but not declared in the header file we will
2395 * fail the configure check. (Otherwise we will get a compiler
2396 * warning but not an error, and will proceed to fail the
2397 * qemu compile where we compile with -Werror.)
2398 */
Stefan Weil84972cb2011-12-17 09:27:38 +01002399 return epoll_create1 == epoll_create1;
Peter Maydell3b6edd12011-02-15 18:35:05 +00002400}
2401EOF
2402if compile_prog "$ARCH_CFLAGS" "" ; then
2403 epoll_create1=yes
2404fi
2405
2406epoll_pwait=no
2407cat > $TMPC << EOF
2408#include <sys/epoll.h>
2409
2410int main(void)
2411{
2412 epoll_pwait(0, 0, 0, 0, 0);
2413 return 0;
2414}
2415EOF
2416if compile_prog "$ARCH_CFLAGS" "" ; then
2417 epoll_pwait=yes
2418fi
2419
pbrookcc8ae6d2006-04-23 17:57:59 +00002420# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02002421if test "$docs" != "no" ; then
Stefan Weil01668d92010-03-04 22:21:02 +01002422 if has makeinfo && has pod2man; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02002423 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02002424 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02002425 if test "$docs" = "yes" ; then
2426 feature_not_found "docs"
Juan Quintela83a3ab82009-08-12 18:29:51 +02002427 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02002428 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02002429 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00002430fi
2431
Stefan Weilf514f412009-10-11 12:44:07 +02002432# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002433byteswap_h=no
2434cat > $TMPC << EOF
2435#include <byteswap.h>
2436int main(void) { return bswap_32(0); }
2437EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002438if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002439 byteswap_h=yes
2440fi
2441
Stefan Weilf514f412009-10-11 12:44:07 +02002442# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002443bswap_h=no
2444cat > $TMPC << EOF
2445#include <sys/endian.h>
2446#include <sys/types.h>
2447#include <machine/bswap.h>
2448int main(void) { return bswap32(0); }
2449EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002450if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002451 bswap_h=yes
2452fi
2453
aliguorida93a1f2008-12-12 20:02:52 +00002454##########################################
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11002455# Do we have libiscsi
2456if test "$libiscsi" != "no" ; then
2457 cat > $TMPC << EOF
2458#include <iscsi/iscsi.h>
2459int main(void) { iscsi_create_context(""); return 0; }
2460EOF
2461 if compile_prog "-Werror" "-liscsi" ; then
2462 libiscsi="yes"
2463 LIBS="$LIBS -liscsi"
2464 else
2465 if test "$libiscsi" = "yes" ; then
2466 feature_not_found "libiscsi"
2467 fi
2468 libiscsi="no"
2469 fi
2470fi
2471
2472
2473##########################################
aliguorida93a1f2008-12-12 20:02:52 +00002474# Do we need librt
2475cat > $TMPC <<EOF
2476#include <signal.h>
2477#include <time.h>
Stefan Weil66ea0f22011-12-17 09:27:35 +01002478int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
aliguorida93a1f2008-12-12 20:02:52 +00002479EOF
2480
Juan Quintela52166aa2009-08-03 14:46:03 +02002481if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02002482 :
Juan Quintela52166aa2009-08-03 14:46:03 +02002483elif compile_prog "" "-lrt" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02002484 LIBS="-lrt $LIBS"
aliguorida93a1f2008-12-12 20:02:52 +00002485fi
2486
Blue Swirl31ff5042009-09-12 12:33:07 +00002487if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
Andreas Färber179cf402010-09-20 00:50:43 +02002488 "$aix" != "yes" -a "$haiku" != "yes" ; then
Juan Quintela6362a532009-08-03 14:46:32 +02002489 libs_softmmu="-lutil $libs_softmmu"
2490fi
2491
Blue Swirlde5071c2009-09-12 09:58:46 +00002492##########################################
2493# check if the compiler defines offsetof
2494
2495need_offsetof=yes
2496cat > $TMPC << EOF
2497#include <stddef.h>
2498int main(void) { struct s { int f; }; return offsetof(struct s, f); }
2499EOF
2500if compile_prog "" "" ; then
2501 need_offsetof=no
2502fi
2503
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002504# spice probe
2505if test "$spice" != "no" ; then
2506 cat > $TMPC << EOF
2507#include <spice.h>
2508int main(void) { spice_server_new(); return 0; }
2509EOF
Jiri Denemark710fc4f2011-01-24 13:20:29 +01002510 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2511 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
Gerd Hoffmann012b80d2011-05-17 10:48:14 +02002512 if $pkg_config --atleast-version=0.6.0 spice-server >/dev/null 2>&1 && \
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002513 compile_prog "$spice_cflags" "$spice_libs" ; then
2514 spice="yes"
2515 libs_softmmu="$libs_softmmu $spice_libs"
2516 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2517 else
2518 if test "$spice" = "yes" ; then
2519 feature_not_found "spice"
2520 fi
2521 spice="no"
2522 fi
2523fi
2524
Robert Relyea111a38b2010-11-28 16:36:38 +02002525# check for libcacard for smartcard support
2526if test "$smartcard" != "no" ; then
2527 smartcard="yes"
2528 smartcard_cflags=""
2529 # TODO - what's the minimal nss version we support?
2530 if test "$smartcard_nss" != "no"; then
2531 if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then
2532 smartcard_nss="yes"
2533 smartcard_cflags="-I\$(SRC_PATH)/libcacard"
2534 libcacard_libs=$($pkg_config --libs nss 2>/dev/null)
2535 libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null)
2536 QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
2537 LIBS="$libcacard_libs $LIBS"
2538 else
2539 if test "$smartcard_nss" = "yes"; then
2540 feature_not_found "nss"
2541 fi
2542 smartcard_nss="no"
2543 fi
2544 fi
2545fi
2546if test "$smartcard" = "no" ; then
2547 smartcard_nss="no"
2548fi
2549
Hans de Goede69354a82011-07-19 11:04:10 +02002550# check for usbredirparser for usb network redirection support
2551if test "$usb_redir" != "no" ; then
2552 if $pkg_config libusbredirparser >/dev/null 2>&1 ; then
2553 usb_redir="yes"
2554 usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
2555 usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
2556 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
2557 LIBS="$LIBS $usb_redir_libs"
2558 else
2559 if test "$usb_redir" = "yes"; then
2560 feature_not_found "usb-redir"
2561 fi
2562 usb_redir="no"
2563 fi
2564fi
2565
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002566##########################################
2567
Blue Swirl747bbdf2009-10-18 16:26:06 +00002568##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002569# check if we have fdatasync
2570
2571fdatasync=no
2572cat > $TMPC << EOF
2573#include <unistd.h>
Alexandre Raymondd1722a22011-05-29 18:22:48 -04002574int main(void) {
2575#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2576return fdatasync(0);
2577#else
2578#abort Not supported
2579#endif
2580}
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002581EOF
2582if compile_prog "" "" ; then
2583 fdatasync=yes
2584fi
2585
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002586##########################################
Andreas Färbere78815a2010-09-25 11:26:05 +00002587# check if we have madvise
2588
2589madvise=no
2590cat > $TMPC << EOF
2591#include <sys/types.h>
2592#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002593#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00002594int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2595EOF
2596if compile_prog "" "" ; then
2597 madvise=yes
2598fi
2599
2600##########################################
2601# check if we have posix_madvise
2602
2603posix_madvise=no
2604cat > $TMPC << EOF
2605#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002606#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00002607int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2608EOF
2609if compile_prog "" "" ; then
2610 posix_madvise=yes
2611fi
2612
2613##########################################
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002614# check if trace backend exists
2615
Blue Swirl4c3b5a42011-01-20 20:54:21 +00002616sh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002617if test "$?" -ne 0 ; then
2618 echo
2619 echo "Error: invalid trace backend"
2620 echo "Please choose a supported trace backend."
2621 echo
2622 exit 1
2623fi
2624
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01002625##########################################
2626# For 'ust' backend, test if ust headers are present
2627if test "$trace_backend" = "ust"; then
2628 cat > $TMPC << EOF
2629#include <ust/tracepoint.h>
2630#include <ust/marker.h>
2631int main(void) { return 0; }
2632EOF
2633 if compile_prog "" "" ; then
2634 LIBS="-lust $LIBS"
2635 else
2636 echo
2637 echo "Error: Trace backend 'ust' missing libust header files"
2638 echo
2639 exit 1
2640 fi
2641fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00002642
2643##########################################
2644# For 'dtrace' backend, test if 'dtrace' command is present
2645if test "$trace_backend" = "dtrace"; then
2646 if ! has 'dtrace' ; then
2647 echo
2648 echo "Error: dtrace command is not found in PATH $PATH"
2649 echo
2650 exit 1
2651 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00002652 trace_backend_stap="no"
2653 if has 'stap' ; then
2654 trace_backend_stap="yes"
2655 fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00002656fi
2657
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01002658##########################################
Wolfgang Mauerer023367e2011-07-11 14:57:43 +02002659# __sync_fetch_and_and requires at least -march=i486. Many toolchains
2660# use i686 as default anyway, but for those that don't, an explicit
2661# specification is necessary
Stefan Weil1ba16962011-07-29 22:40:45 +02002662if test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
Wolfgang Mauerer023367e2011-07-11 14:57:43 +02002663 cat > $TMPC << EOF
2664int sfaa(unsigned *ptr)
2665{
2666 return __sync_fetch_and_and(ptr, 0);
2667}
2668
2669int main(int argc, char **argv)
2670{
2671 int val = 42;
2672 sfaa(&val);
2673 return val;
2674}
2675EOF
2676 if ! compile_prog "" "" ; then
2677 CFLAGS+="-march=i486"
2678 fi
2679fi
2680
2681##########################################
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05302682# check if we have makecontext
2683
2684ucontext_coroutine=no
2685if test "$darwin" != "yes"; then
2686 cat > $TMPC << EOF
2687#include <ucontext.h>
Stefan Weil75cafad2011-12-17 09:27:29 +01002688int main(void) { makecontext(0, 0, 0); return 0; }
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05302689EOF
2690 if compile_prog "" "" ; then
2691 ucontext_coroutine=yes
2692 fi
2693fi
2694
2695##########################################
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05302696# check if we have open_by_handle_at
2697
2698open_by_hande_at=no
2699cat > $TMPC << EOF
2700#include <fcntl.h>
Stefan Weil75cafad2011-12-17 09:27:29 +01002701int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05302702EOF
2703if compile_prog "" "" ; then
2704 open_by_handle_at=yes
2705fi
2706
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05302707########################################
2708# check if we have linux/magic.h
2709
2710linux_magic_h=no
2711cat > $TMPC << EOF
2712#include <linux/magic.h>
2713int main(void) {
Stefan Weil75cafad2011-12-17 09:27:29 +01002714 return 0;
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05302715}
2716EOF
2717if compile_prog "" "" ; then
2718 linux_magic_h=yes
2719fi
2720
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05302721##########################################
Juan Quintelae86ecd42009-08-03 14:45:59 +02002722# End of CC checks
2723# After here, no more $cc or $ld runs
2724
Juan Quintelae86ecd42009-08-03 14:45:59 +02002725if test "$debug" = "no" ; then
Juan Quintela1156c662009-08-03 14:46:00 +02002726 CFLAGS="-O2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002727fi
Juan Quintelaa316e372009-09-30 01:10:55 +02002728
Juan Quintelae86ecd42009-08-03 14:45:59 +02002729# Consult white-list to determine whether to enable werror
2730# by default. Only enable by default for git builds
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002731z_version=`cut -f3 -d. $source_path/VERSION`
2732
Juan Quintelae86ecd42009-08-03 14:45:59 +02002733if test -z "$werror" ; then
Juan Quintelae86ecd42009-08-03 14:45:59 +02002734 if test "$z_version" = "50" -a \
2735 "$linux" = "yes" ; then
2736 werror="yes"
2737 else
2738 werror="no"
2739 fi
2740fi
2741
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002742# Disable zero malloc errors for official releases unless explicitly told to
2743# enable/disable
2744if test -z "$zero_malloc" ; then
2745 if test "$z_version" = "50" ; then
2746 zero_malloc="no"
2747 else
2748 zero_malloc="yes"
2749 fi
2750fi
2751
Juan Quintelae86ecd42009-08-03 14:45:59 +02002752if test "$werror" = "yes" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +02002753 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002754fi
2755
2756if test "$solaris" = "no" ; then
2757 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02002758 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002759 fi
2760fi
2761
Blue Swirl952afb72010-09-19 08:36:34 +00002762# Use ASLR, no-SEH and DEP if available
2763if test "$mingw32" = "yes" ; then
2764 for flag in --dynamicbase --no-seh --nxcompat; do
2765 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2766 LDFLAGS="-Wl,$flag $LDFLAGS"
2767 fi
2768 done
2769fi
2770
Paolo Bonzini190e9c52010-05-26 16:08:21 +02002771confdir=$sysconfdir$confsuffix
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02002772
Paolo Bonzinica35f782010-05-26 16:08:29 +02002773tools=
2774if test "$softmmu" = yes ; then
2775 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
M. Mohan Kumar17bff522011-12-14 13:58:42 +05302776 if [ "$cap" = "yes" -a "$linux" = "yes" ] ; then
2777 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
2778 fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02002779 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2780 tools="qemu-nbd\$(EXESUF) $tools"
Michael Rothd138cee2011-08-01 14:52:57 -05002781 if [ "$guest_agent" = "yes" ]; then
Michael Roth48ff7a62011-07-20 15:19:37 -05002782 tools="qemu-ga\$(EXESUF) $tools"
Michael Rothd138cee2011-08-01 14:52:57 -05002783 fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02002784 fi
2785fi
2786
2787# Mac OS X ships with a broken assembler
2788roms=
2789if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2790 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2791 "$softmmu" = yes ; then
2792 roms="optionrom"
2793fi
Andreas Färberd0384d12011-05-01 18:23:56 +02002794if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
David Gibson39ac8452011-04-01 15:15:23 +11002795 roms="$roms spapr-rtas"
2796fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02002797
bellard43ce4df2003-06-09 19:53:12 +00002798echo "Install prefix $prefix"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002799echo "BIOS directory `eval echo $datadir`"
2800echo "binary directory `eval echo $bindir`"
Alon Levy3aa5d2b2011-05-15 12:08:59 +03002801echo "library directory `eval echo $libdir`"
Alon Levy0f94d6d2011-06-27 11:58:20 +02002802echo "include directory `eval echo $includedir`"
Aurelien Jarno1c0fd162010-06-10 00:14:02 +02002803echo "config directory `eval echo $sysconfdir`"
bellard11d9f692004-04-02 20:55:59 +00002804if test "$mingw32" = "no" ; then
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002805echo "Manual directory `eval echo $mandir`"
bellard43ce4df2003-06-09 19:53:12 +00002806echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00002807fi
bellard5a671352003-10-01 00:13:48 +00002808echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00002809echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00002810echo "Host C compiler $host_cc"
Juan Quintela0c439cb2009-08-03 14:46:01 +02002811echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02002812echo "QEMU_CFLAGS $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02002813echo "LDFLAGS $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00002814echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00002815echo "install $install"
Blue Swirlc886edf2011-07-22 21:08:09 +00002816echo "python $python"
Brade2d88302011-09-02 16:53:28 -04002817if test "$slirp" = "yes" ; then
2818 echo "smbd $smbd"
2819fi
bellard43ce4df2003-06-09 19:53:12 +00002820echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00002821echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00002822echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00002823echo "tcg debug enabled $debug_tcg"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -02002824echo "Mon debug enabled $debug_mon"
bellard43ce4df2003-06-09 19:53:12 +00002825echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00002826echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00002827echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00002828echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00002829echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00002830echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00002831if test "$darwin" = "yes" ; then
2832 echo "Cocoa support $cocoa"
2833fi
bellard97a847b2003-08-10 21:36:04 +00002834echo "SDL support $sdl"
balrog4d3b6f62008-02-10 16:33:14 +00002835echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02002836echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00002837echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00002838echo "Audio drivers $audio_drv_list"
2839echo "Extra audio cards $audio_card_list"
Markus Armbrustereb852012009-10-27 18:41:44 +01002840echo "Block whitelist $block_drv_whitelist"
malc8ff9cbf2008-06-23 18:33:30 +00002841echo "Mixer emulation $mixemu"
Jes Sorensen821601e2011-03-16 13:33:36 +01002842echo "VNC support $vnc"
2843if test "$vnc" = "yes" ; then
2844 echo "VNC TLS support $vnc_tls"
2845 echo "VNC SASL support $vnc_sasl"
2846 echo "VNC JPEG support $vnc_jpeg"
2847 echo "VNC PNG support $vnc_png"
2848 echo "VNC thread $vnc_thread"
2849fi
blueswir131422552007-04-16 18:27:06 +00002850if test -n "$sparc_cpu"; then
2851 echo "Target Sparc Arch $sparc_cpu"
2852fi
aliguorie37630c2009-04-22 15:19:10 +00002853echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00002854echo "brlapi support $brlapi"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002855echo "bluez support $bluez"
Juan Quintelaa25dba12009-08-12 18:29:52 +02002856echo "Documentation $docs"
pbrookc5937222006-05-14 11:30:38 +00002857[ ! -z "$uname_release" ] && \
2858echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00002859echo "NPTL support $nptl"
Paul Brook379f6692009-07-17 12:48:08 +01002860echo "GUEST_BASE $guest_base"
Avi Kivity40d64442011-11-15 20:12:17 +02002861echo "PIE $pie"
ths8a16d272008-07-19 09:56:24 +00002862echo "vde support $vde"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002863echo "Linux AIO support $linux_aio"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002864echo "ATTR/XATTR support $attr"
ths77755342008-11-27 15:45:16 +00002865echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02002866echo "KVM support $kvm"
Stefan Weil9195b2c2011-10-19 07:07:18 +02002867echo "TCG interpreter $tcg_interpreter"
aurel32f652e6a2008-12-16 10:43:48 +00002868echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00002869echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002870echo "fdatasync $fdatasync"
Andreas Färbere78815a2010-09-25 11:26:05 +00002871echo "madvise $madvise"
2872echo "posix_madvise $posix_madvise"
Stefan Weilee682d22009-10-01 20:10:37 +02002873echo "uuid support $uuid"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02002874echo "vhost-net support $vhost_net"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002875echo "Trace backend $trace_backend"
Prerna Saxena9410b562010-07-13 09:26:32 +01002876echo "Trace output file $trace_file-<pid>"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002877echo "spice support $spice"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002878echo "rbd support $rbd"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002879echo "xfsctl support $xfs"
Robert Relyea111a38b2010-11-28 16:36:38 +02002880echo "nss used $smartcard_nss"
Hans de Goede69354a82011-07-19 11:04:10 +02002881echo "usb net redir $usb_redir"
Michael Walle20ff0752011-03-07 23:32:39 +01002882echo "OpenGL support $opengl"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11002883echo "libiscsi support $libiscsi"
Michael Rothd138cee2011-08-01 14:52:57 -05002884echo "build guest agent $guest_agent"
bellard67b915a2004-03-31 23:37:16 +00002885
Stefan Weil1ba16962011-07-29 22:40:45 +02002886if test "$sdl_too_old" = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00002887echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00002888fi
bellard97a847b2003-08-10 21:36:04 +00002889
Juan Quintela98ec69a2009-07-16 18:34:18 +02002890config_host_mak="config-host.mak"
Juan Quintela4bf6b552009-07-22 22:37:40 +02002891config_host_ld="config-host.ld"
bellard97a847b2003-08-10 21:36:04 +00002892
Juan Quintela98ec69a2009-07-16 18:34:18 +02002893echo "# Automatically generated by configure - do not modify" > $config_host_mak
2894printf "# Configured with:" >> $config_host_mak
2895printf " '%s'" "$0" "$@" >> $config_host_mak
2896echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002897
Paolo Bonzinie6c3b0f2010-10-21 10:18:35 +02002898echo all: >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02002899echo "prefix=$prefix" >> $config_host_mak
2900echo "bindir=$bindir" >> $config_host_mak
Alon Levy3aa5d2b2011-05-15 12:08:59 +03002901echo "libdir=$libdir" >> $config_host_mak
Alon Levy0f94d6d2011-06-27 11:58:20 +02002902echo "includedir=$includedir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02002903echo "mandir=$mandir" >> $config_host_mak
2904echo "datadir=$datadir" >> $config_host_mak
2905echo "sysconfdir=$sysconfdir" >> $config_host_mak
2906echo "docdir=$docdir" >> $config_host_mak
Paolo Bonzini1dabe052010-05-26 16:08:25 +02002907echo "confdir=$confdir" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002908
Juan Quintela98ec69a2009-07-16 18:34:18 +02002909echo "ARCH=$ARCH" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00002910if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002911 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00002912fi
Luiz Capitulinob4475aa2010-02-10 23:50:03 -02002913if test "$debug_mon" = "yes" ; then
2914 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2915fi
Paul Brookf3d08ee2009-06-04 11:39:04 +01002916if test "$debug" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002917 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
Paul Brookf3d08ee2009-06-04 11:39:04 +01002918fi
aliguori1625af82009-04-05 17:41:02 +00002919if test "$strip_opt" = "yes" ; then
Hollis Blanchard52ba7842010-08-04 17:21:34 -07002920 echo "STRIP=${strip}" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00002921fi
bellard7d132992003-03-06 23:23:54 +00002922if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02002923 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00002924fi
Juan Quintela2358a492009-07-27 16:13:25 +02002925echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00002926if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002927 echo "CONFIG_WIN32=y" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00002928 rc_version=`cat $source_path/VERSION`
2929 version_major=${rc_version%%.*}
2930 rc_version=${rc_version#*.}
2931 version_minor=${rc_version%%.*}
2932 rc_version=${rc_version#*.}
2933 version_subminor=${rc_version%%.*}
2934 version_micro=0
2935 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2936 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
pbrook210fa552007-02-27 21:04:49 +00002937else
Juan Quintela35f4df22009-07-27 16:13:07 +02002938 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00002939fi
blueswir1128ab2f2008-08-15 18:33:42 +00002940
Mark McLoughlindffcb712009-10-22 17:49:11 +01002941if test "$linux" = "yes" ; then
2942 echo "CONFIG_LINUX=y" >> $config_host_mak
2943fi
2944
bellard83fb7ad2004-07-05 21:25:26 +00002945if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002946 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00002947fi
malcb29fe3e2008-11-18 01:42:22 +00002948
2949if test "$aix" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002950 echo "CONFIG_AIX=y" >> $config_host_mak
malcb29fe3e2008-11-18 01:42:22 +00002951fi
2952
bellardec530c82006-04-25 22:36:06 +00002953if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002954 echo "CONFIG_SOLARIS=y" >> $config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02002955 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00002956 if test "$needs_libsunmath" = "yes" ; then
Juan Quintela75b5a692009-07-27 16:13:23 +02002957 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00002958 fi
bellardec530c82006-04-25 22:36:06 +00002959fi
Andreas Färber179cf402010-09-20 00:50:43 +02002960if test "$haiku" = "yes" ; then
2961 echo "CONFIG_HAIKU=y" >> $config_host_mak
2962fi
bellard97a847b2003-08-10 21:36:04 +00002963if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002964 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00002965fi
Stefan Weil1ba16962011-07-29 22:40:45 +02002966if test "$profiler" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002967 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00002968fi
bellardc20709a2004-04-21 23:27:19 +00002969if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002970 echo "CONFIG_SLIRP=y" >> $config_host_mak
Brade2d88302011-09-02 16:53:28 -04002971 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01002972 QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
bellardc20709a2004-04-21 23:27:19 +00002973fi
ths8a16d272008-07-19 09:56:24 +00002974if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002975 echo "CONFIG_VDE=y" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00002976fi
malc0c58ac12008-06-25 21:04:05 +00002977for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00002978 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002979 echo "$def=y" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002980done
Juan Quintela2358a492009-07-27 16:13:25 +02002981echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002982for drv in $audio_drv_list; do
pbrookf6e58892008-06-29 01:00:34 +00002983 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002984 echo "$def=y" >> $config_host_mak
malc923e4522008-07-02 18:13:46 +00002985 if test "$drv" = "fmod"; then
Juan Quintela7aac6cb2009-07-27 16:12:47 +02002986 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002987 fi
2988done
Juan Quintela67f86e82009-08-03 14:46:59 +02002989if test "$audio_pt_int" = "yes" ; then
2990 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2991fi
malcd5631632009-10-10 01:13:41 +04002992if test "$audio_win_int" = "yes" ; then
2993 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2994fi
Markus Armbrustereb852012009-10-27 18:41:44 +01002995echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00002996if test "$mixemu" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002997 echo "CONFIG_MIXEMU=y" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00002998fi
Jes Sorensen821601e2011-03-16 13:33:36 +01002999if test "$vnc" = "yes" ; then
3000 echo "CONFIG_VNC=y" >> $config_host_mak
3001fi
ths8d5d2d42007-08-25 01:37:51 +00003002if test "$vnc_tls" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003003 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
Juan Quintela525061b2009-07-27 16:12:43 +02003004 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
ths8d5d2d42007-08-25 01:37:51 +00003005fi
aliguori2f9606b2009-03-06 20:27:28 +00003006if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003007 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
Juan Quintela60ddf532009-07-27 16:12:45 +02003008 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00003009fi
Jes Sorensen821601e2011-03-16 13:33:36 +01003010if test "$vnc_jpeg" = "yes" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003011 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
3012 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
3013fi
Jes Sorensen821601e2011-03-16 13:33:36 +01003014if test "$vnc_png" = "yes" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02003015 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3016 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
3017fi
Jes Sorensen821601e2011-03-16 13:33:36 +01003018if test "$vnc_thread" = "yes" ; then
Corentin Charybd023f92010-07-07 20:58:02 +02003019 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
Corentin Charybd023f92010-07-07 20:58:02 +02003020fi
aliguori76655d62009-03-06 20:27:37 +00003021if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003022 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00003023fi
Stefan Weilee682d22009-10-01 20:10:37 +02003024if test "$uuid" = "yes" ; then
3025 echo "CONFIG_UUID=y" >> $config_host_mak
3026fi
Christoph Hellwigdce512d2010-12-17 11:41:15 +01003027if test "$xfs" = "yes" ; then
3028 echo "CONFIG_XFS=y" >> $config_host_mak
3029fi
pbrookb1a550a2006-04-16 13:28:56 +00003030qemu_version=`head $source_path/VERSION`
Juan Quintela98ec69a2009-07-16 18:34:18 +02003031echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02003032echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02003033echo "SRC_PATH=$source_path" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02003034echo "TARGET_DIRS=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02003035if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003036 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00003037fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02003038if test "$sdl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003039 echo "CONFIG_SDL=y" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02003040 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00003041fi
3042if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003043 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00003044fi
3045if test "$curses" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003046 echo "CONFIG_CURSES=y" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00003047fi
aurel323b3f24a2009-04-15 16:12:13 +00003048if test "$atfile" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003049 echo "CONFIG_ATFILE=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00003050fi
Riku Voipioebc996f2009-04-21 15:01:51 +03003051if test "$utimens" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003052 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
Riku Voipioebc996f2009-04-21 15:01:51 +03003053fi
Riku Voipio099d6b02009-05-05 12:10:04 +03003054if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003055 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03003056fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01003057if test "$accept4" = "yes" ; then
3058 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
3059fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303060if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003061 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303062fi
Riku Voipioc2882b92009-08-12 15:08:24 +03003063if test "$eventfd" = "yes" ; then
3064 echo "CONFIG_EVENTFD=y" >> $config_host_mak
3065fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03003066if test "$fallocate" = "yes" ; then
3067 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3068fi
Peter Maydellc727f472011-01-06 11:05:10 +00003069if test "$sync_file_range" = "yes" ; then
3070 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3071fi
Peter Maydelldace20d2011-01-10 13:11:24 +00003072if test "$fiemap" = "yes" ; then
3073 echo "CONFIG_FIEMAP=y" >> $config_host_mak
3074fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03003075if test "$dup3" = "yes" ; then
3076 echo "CONFIG_DUP3=y" >> $config_host_mak
3077fi
Peter Maydell3b6edd12011-02-15 18:35:05 +00003078if test "$epoll" = "yes" ; then
3079 echo "CONFIG_EPOLL=y" >> $config_host_mak
3080fi
3081if test "$epoll_create1" = "yes" ; then
3082 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
3083fi
3084if test "$epoll_pwait" = "yes" ; then
3085 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
3086fi
aurel323b3f24a2009-04-15 16:12:13 +00003087if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003088 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00003089fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00003090if test "$inotify1" = "yes" ; then
3091 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3092fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003093if test "$byteswap_h" = "yes" ; then
3094 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
3095fi
3096if test "$bswap_h" = "yes" ; then
3097 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
3098fi
Alexander Graf769ce762009-05-11 17:41:42 +02003099if test "$curl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003100 echo "CONFIG_CURL=y" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02003101 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02003102fi
aurel322e4d9fb2008-04-08 06:01:02 +00003103if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003104 echo "CONFIG_BRLAPI=y" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00003105fi
balrogfb599c92008-09-28 23:49:55 +00003106if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003107 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02003108 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00003109fi
Anthony Liguorie18df142011-07-19 14:50:29 -05003110echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00003111if test "$xen" = "yes" ; then
Jan Kiszka6dbd5882011-06-21 22:59:07 +02003112 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00003113 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00003114fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003115if test "$linux_aio" = "yes" ; then
3116 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
3117fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003118if test "$attr" = "yes" ; then
3119 echo "CONFIG_ATTR=y" >> $config_host_mak
3120fi
Avi Kivity4f26f2b2011-11-09 14:44:52 +02003121if test "$libattr" = "yes" ; then
3122 echo "CONFIG_LIBATTR=y" >> $config_host_mak
3123fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003124if test "$linux" = "yes" ; then
3125 if test "$attr" = "yes" ; then
3126 echo "CONFIG_VIRTFS=y" >> $config_host_mak
3127 fi
3128fi
ths77755342008-11-27 15:45:16 +00003129if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003130 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00003131fi
aliguoribf9298b2008-12-05 20:05:26 +00003132if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003133 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00003134fi
aliguoriceb42de2009-04-07 18:43:28 +00003135if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003136 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00003137fi
aurel32f652e6a2008-12-16 10:43:48 +00003138if test "$fdt" = "yes" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02003139 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00003140fi
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03003141if test "$signalfd" = "yes" ; then
3142 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3143fi
Stefan Weil9195b2c2011-10-19 07:07:18 +02003144if test "$tcg_interpreter" = "yes" ; then
3145 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
3146fi
Blue Swirlde5071c2009-09-12 09:58:46 +00003147if test "$need_offsetof" = "yes" ; then
3148 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
3149fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00003150if test "$fdatasync" = "yes" ; then
3151 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
3152fi
Andreas Färbere78815a2010-09-25 11:26:05 +00003153if test "$madvise" = "yes" ; then
3154 echo "CONFIG_MADVISE=y" >> $config_host_mak
3155fi
3156if test "$posix_madvise" = "yes" ; then
3157 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3158fi
bellard97a847b2003-08-10 21:36:04 +00003159
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003160if test "$spice" = "yes" ; then
3161 echo "CONFIG_SPICE=y" >> $config_host_mak
3162fi
3163
Alon Levy36707142010-10-17 11:40:07 +02003164if test "$smartcard" = "yes" ; then
3165 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
3166fi
3167
Robert Relyea111a38b2010-11-28 16:36:38 +02003168if test "$smartcard_nss" = "yes" ; then
3169 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3170fi
3171
Hans de Goede69354a82011-07-19 11:04:10 +02003172if test "$usb_redir" = "yes" ; then
3173 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
3174fi
3175
Michael Walle20ff0752011-03-07 23:32:39 +01003176if test "$opengl" = "yes" ; then
3177 echo "CONFIG_OPENGL=y" >> $config_host_mak
3178fi
3179
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003180if test "$libiscsi" = "yes" ; then
3181 echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3182fi
3183
bellard83fb7ad2004-07-05 21:25:26 +00003184# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00003185if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003186 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00003187fi
3188
Juan Quintela2358a492009-07-27 16:13:25 +02003189echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
pbrookc5937222006-05-14 11:30:38 +00003190
Anthony Liguori20ff6c82009-12-09 12:59:36 -06003191if test "$zero_malloc" = "yes" ; then
3192 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
3193fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003194if test "$rbd" = "yes" ; then
3195 echo "CONFIG_RBD=y" >> $config_host_mak
3196fi
Anthony Liguori20ff6c82009-12-09 12:59:36 -06003197
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303198if test "$ucontext_coroutine" = "yes" ; then
3199 echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3200fi
3201
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303202if test "$open_by_handle_at" = "yes" ; then
3203 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3204fi
3205
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05303206if test "$linux_magic_h" = "yes" ; then
3207 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3208fi
3209
blueswir168063642008-11-22 21:03:55 +00003210# USB host support
3211case "$usb" in
3212linux)
Juan Quintela98ec69a2009-07-16 18:34:18 +02003213 echo "HOST_USB=linux" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00003214;;
3215bsd)
Juan Quintela98ec69a2009-07-16 18:34:18 +02003216 echo "HOST_USB=bsd" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00003217;;
3218*)
Juan Quintela98ec69a2009-07-16 18:34:18 +02003219 echo "HOST_USB=stub" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00003220;;
3221esac
3222
Lluíse4858972011-08-31 20:31:03 +02003223# use default implementation for tracing backend-specific routines
3224trace_default=yes
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003225echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
Lluís6d8a7642011-08-31 20:30:43 +02003226if test "$trace_backend" = "nop"; then
3227 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
Prerna Saxena22890ab2010-06-24 17:04:53 +05303228fi
Prerna Saxena9410b562010-07-13 09:26:32 +01003229if test "$trace_backend" = "simple"; then
Lluís6d8a7642011-08-31 20:30:43 +02003230 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02003231 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02003232 # Set the appropriate trace file.
Andreas Färber953ffe02011-06-02 19:58:06 +02003233 trace_file="\"$trace_file-\" FMT_pid"
Prerna Saxena9410b562010-07-13 09:26:32 +01003234fi
Lluís6d8a7642011-08-31 20:30:43 +02003235if test "$trace_backend" = "stderr"; then
3236 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
Lluís9a82b6a2011-08-31 20:31:51 +02003237 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02003238fi
3239if test "$trace_backend" = "ust"; then
3240 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
3241fi
3242if test "$trace_backend" = "dtrace"; then
3243 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
3244 if test "$trace_backend_stap" = "yes" ; then
3245 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
3246 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00003247fi
Prerna Saxena9410b562010-07-13 09:26:32 +01003248echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02003249if test "$trace_default" = "yes"; then
3250 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3251fi
Prerna Saxena9410b562010-07-13 09:26:32 +01003252
Juan Quintela98ec69a2009-07-16 18:34:18 +02003253echo "TOOLS=$tools" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02003254echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003255echo "MAKE=$make" >> $config_host_mak
3256echo "INSTALL=$install" >> $config_host_mak
Brad1901cb12011-08-28 04:01:33 -04003257echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
3258echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
3259echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
Blue Swirlc886edf2011-07-22 21:08:09 +00003260echo "PYTHON=$python" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003261echo "CC=$cc" >> $config_host_mak
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02003262echo "CC_I386=$cc_i386" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003263echo "HOST_CC=$host_cc" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003264echo "AR=$ar" >> $config_host_mak
3265echo "OBJCOPY=$objcopy" >> $config_host_mak
3266echo "LD=$ld" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00003267echo "WINDRES=$windres" >> $config_host_mak
Alon Levy44dc0ca2011-05-15 11:51:28 +03003268echo "LIBTOOL=$libtool" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02003269echo "CFLAGS=$CFLAGS" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02003270echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01003271echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01003272if test "$sparse" = "yes" ; then
3273 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
3274 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
3275 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3276fi
Juan Quintelac81da562009-08-03 14:46:24 +02003277echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02003278echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Juan Quintelaa36abbb2009-08-03 14:45:56 +02003279echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3280echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02003281echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02003282echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003283echo "EXESUF=$EXESUF" >> $config_host_mak
Michael Roth957f1f92011-08-11 15:38:12 -05003284echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003285
Juan Quintela4bf6b552009-07-22 22:37:40 +02003286# generate list of library paths for linker script
3287
3288$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
3289
3290if test -f ${config_host_ld}~ ; then
3291 if cmp -s $config_host_ld ${config_host_ld}~ ; then
3292 mv ${config_host_ld}~ $config_host_ld
3293 else
3294 rm ${config_host_ld}~
3295 fi
3296fi
3297
Blue Swirl4d904532010-03-21 08:28:47 +00003298for d in libdis libdis-user; do
3299 mkdir -p $d
Paolo Bonzini11568d62010-12-23 11:43:58 +01003300 symlink $source_path/Makefile.dis $d/Makefile
Blue Swirl4d904532010-03-21 08:28:47 +00003301 echo > $d/config.mak
3302done
3303
Peter Maydell6efd7512011-11-30 11:59:04 +00003304# use included Linux headers
3305if test "$linux" = "yes" ; then
3306 mkdir -p linux-headers
3307 case "$cpu" in
3308 i386|x86_64)
3309 symlink $source_path/linux-headers/asm-x86 linux-headers/asm
3310 ;;
3311 ppcemb|ppc|ppc64)
3312 symlink $source_path/linux-headers/asm-powerpc linux-headers/asm
3313 ;;
3314 s390x)
3315 symlink $source_path/linux-headers/asm-s390 linux-headers/asm
3316 ;;
3317 esac
3318fi
3319
bellard1d14ffa2005-10-30 18:58:22 +00003320for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00003321target_dir="$target"
Juan Quintela25be2102009-10-07 02:41:00 +02003322config_target_mak=$target_dir/config-target.mak
Blue Swirl600309b2009-07-03 17:44:00 +00003323target_arch2=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00003324target_bigendian="no"
Juan Quintela1f3d3c82009-10-07 02:41:02 +02003325
Juan Quintelaea2d6a32009-07-16 18:34:10 +02003326case "$target_arch2" in
Max Filippovcfa550c2011-09-06 03:55:26 +04003327 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
Juan Quintelaea2d6a32009-07-16 18:34:10 +02003328 target_bigendian=yes
3329 ;;
3330esac
bellard97a847b2003-08-10 21:36:04 +00003331target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00003332target_user_only="no"
ths831b7822007-01-18 20:06:33 +00003333target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00003334target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00003335target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00003336case "$target" in
Blue Swirl600309b2009-07-03 17:44:00 +00003337 ${target_arch2}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00003338 target_softmmu="yes"
3339 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00003340 ${target_arch2}-linux-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00003341 if test "$linux" != "yes" ; then
3342 echo "ERROR: Target '$target' is only available on a Linux host"
3343 exit 1
3344 fi
pbrook9e407a82007-05-26 16:38:53 +00003345 target_user_only="yes"
3346 target_linux_user="yes"
3347 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00003348 ${target_arch2}-darwin-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00003349 if test "$darwin" != "yes" ; then
3350 echo "ERROR: Target '$target' is only available on a Darwin host"
3351 exit 1
3352 fi
pbrook9e407a82007-05-26 16:38:53 +00003353 target_user_only="yes"
3354 target_darwin_user="yes"
3355 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00003356 ${target_arch2}-bsd-user)
Blue Swirl9cf55762009-11-17 21:27:18 +00003357 if test "$bsd" != "yes" ; then
Blue Swirl9c7a4202009-11-17 20:52:56 +00003358 echo "ERROR: Target '$target' is only available on a BSD host"
3359 exit 1
3360 fi
blueswir184778502008-10-26 20:33:16 +00003361 target_user_only="yes"
3362 target_bsd_user="yes"
3363 ;;
pbrook9e407a82007-05-26 16:38:53 +00003364 *)
3365 echo "ERROR: Target '$target' not recognised"
3366 exit 1
3367 ;;
3368esac
ths831b7822007-01-18 20:06:33 +00003369
bellard97a847b2003-08-10 21:36:04 +00003370mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00003371mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00003372mkdir -p $target_dir/tcg
Gerd Hoffmann59f2a782009-08-20 15:22:26 +02003373mkdir -p $target_dir/ide
Aneesh Kumar K.V353ac782011-01-28 18:09:08 +05303374mkdir -p $target_dir/9pfs
Jan Kiszka3b9a6ee2011-10-15 10:01:27 +02003375mkdir -p $target_dir/kvm
blueswir184778502008-10-26 20:33:16 +00003376if 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 +00003377 mkdir -p $target_dir/nwfpe
3378fi
Paolo Bonzini11568d62010-12-23 11:43:58 +01003379symlink $source_path/Makefile.target $target_dir/Makefile
bellardec530c82006-04-25 22:36:06 +00003380
bellard97a847b2003-08-10 21:36:04 +00003381
Juan Quintela25be2102009-10-07 02:41:00 +02003382echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00003383
pbrooke5fe0c52006-06-11 13:32:59 +00003384bflt="no"
pbrookbd0c5662008-05-29 14:34:11 +00003385target_nptl="no"
Blue Swirl600309b2009-07-03 17:44:00 +00003386interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
pbrook56aebc82008-10-11 17:55:29 +00003387gdb_xml_files=""
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003388target_short_alignment=2
3389target_int_alignment=4
3390target_long_alignment=4
3391target_llong_alignment=8
Michael Wallede3a3542011-04-26 00:24:07 +02003392target_libs_softmmu=
aliguori7ba1e612008-11-05 16:04:33 +00003393
Juan Quintela938b1ed2009-07-16 18:34:12 +02003394TARGET_ARCH="$target_arch2"
Juan Quintela6acff7d2009-07-16 18:34:15 +02003395TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02003396TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02003397
Blue Swirl600309b2009-07-03 17:44:00 +00003398case "$target_arch2" in
aurel322408a522008-04-20 20:19:44 +00003399 i386)
Aurelien Jarno71deff22011-02-09 19:35:50 +01003400 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003401 ;;
3402 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02003403 TARGET_BASE_ARCH=i386
Paul Brook1ad21342009-05-19 16:17:58 +01003404 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003405 target_long_alignment=8
aurel322408a522008-04-20 20:19:44 +00003406 ;;
3407 alpha)
Paul Brook1ad21342009-05-19 16:17:58 +01003408 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003409 target_long_alignment=8
Richard Hendersona4b388f2010-04-12 16:17:22 -07003410 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00003411 ;;
3412 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003413 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00003414 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00003415 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00003416 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003417 target_phys_bits=32
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003418 target_llong_alignment=4
aurel322408a522008-04-20 20:19:44 +00003419 ;;
3420 cris)
edgar_igl253bd7f2009-01-07 20:07:09 +00003421 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01003422 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00003423 ;;
Michael Walle613a22c2011-02-17 23:45:17 +01003424 lm32)
3425 target_phys_bits=32
Michael Wallede3a3542011-04-26 00:24:07 +02003426 target_libs_softmmu="$opengl_libs"
Michael Walle613a22c2011-02-17 23:45:17 +01003427 ;;
aurel322408a522008-04-20 20:19:44 +00003428 m68k)
aurel322408a522008-04-20 20:19:44 +00003429 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00003430 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003431 target_phys_bits=32
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003432 target_int_alignment=2
3433 target_long_alignment=2
3434 target_llong_alignment=2
aurel322408a522008-04-20 20:19:44 +00003435 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01003436 microblaze|microblazeel)
3437 TARGET_ARCH=microblaze
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02003438 bflt="yes"
3439 target_nptl="yes"
3440 target_phys_bits=32
Michael Wallede3a3542011-04-26 00:24:07 +02003441 target_libs_softmmu="$fdt_libs"
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02003442 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02003443 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003444 TARGET_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02003445 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
Paul Brookf04dc722009-07-09 17:56:24 +01003446 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01003447 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003448 ;;
3449 mipsn32|mipsn32el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003450 TARGET_ARCH=mipsn32
Juan Quintela6acff7d2009-07-16 18:34:15 +02003451 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02003452 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01003453 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003454 ;;
3455 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003456 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02003457 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02003458 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01003459 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003460 target_long_alignment=8
aurel322408a522008-04-20 20:19:44 +00003461 ;;
3462 ppc)
aurel32c8b35322009-01-24 15:07:34 +00003463 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Alexander Graf8b242eb2011-10-18 01:46:08 +02003464 target_phys_bits=64
Nathan Froydd6630702009-08-03 08:43:28 -07003465 target_nptl="yes"
Michael Wallede3a3542011-04-26 00:24:07 +02003466 target_libs_softmmu="$fdt_libs"
aurel322408a522008-04-20 20:19:44 +00003467 ;;
3468 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02003469 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02003470 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00003471 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003472 target_phys_bits=64
Nathan Froydd6630702009-08-03 08:43:28 -07003473 target_nptl="yes"
Michael Wallede3a3542011-04-26 00:24:07 +02003474 target_libs_softmmu="$fdt_libs"
aurel322408a522008-04-20 20:19:44 +00003475 ;;
3476 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02003477 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02003478 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00003479 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003480 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003481 target_long_alignment=8
Michael Wallede3a3542011-04-26 00:24:07 +02003482 target_libs_softmmu="$fdt_libs"
aurel322408a522008-04-20 20:19:44 +00003483 ;;
3484 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003485 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02003486 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02003487 TARGET_ABI_DIR=ppc
Juan Quintela25be2102009-10-07 02:41:00 +02003488 echo "TARGET_ABI32=y" >> $config_target_mak
aurel32c8b35322009-01-24 15:07:34 +00003489 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003490 target_phys_bits=64
Michael Wallede3a3542011-04-26 00:24:07 +02003491 target_libs_softmmu="$fdt_libs"
aurel322408a522008-04-20 20:19:44 +00003492 ;;
3493 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003494 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00003495 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00003496 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01003497 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00003498 ;;
3499 sparc)
Paul Brook1ad21342009-05-19 16:17:58 +01003500 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003501 ;;
3502 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02003503 TARGET_BASE_ARCH=sparc
Paul Brook1ad21342009-05-19 16:17:58 +01003504 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003505 target_long_alignment=8
aurel322408a522008-04-20 20:19:44 +00003506 ;;
3507 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003508 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02003509 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02003510 TARGET_ABI_DIR=sparc
Juan Quintela25be2102009-10-07 02:41:00 +02003511 echo "TARGET_ABI32=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01003512 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003513 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01003514 s390x)
Ulrich Hechtbc434672011-03-29 15:29:33 +02003515 target_nptl="yes"
Alexander Graf24e804ec2009-12-05 12:44:22 +01003516 target_phys_bits=64
Alexander Graf7b3da902011-04-04 16:32:11 +02003517 target_long_alignment=8
Alexander Graf24e804ec2009-12-05 12:44:22 +01003518 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +08003519 unicore32)
3520 target_phys_bits=32
3521 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04003522 xtensa|xtensaeb)
3523 TARGET_ARCH=xtensa
3524 target_phys_bits=32
3525 ;;
aurel322408a522008-04-20 20:19:44 +00003526 *)
3527 echo "Unsupported target CPU"
3528 exit 1
3529 ;;
3530esac
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003531echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3532echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3533echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3534echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
Juan Quintela25be2102009-10-07 02:41:00 +02003535echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
Juan Quintela053dd922009-08-03 14:47:03 +02003536target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
Juan Quintela25be2102009-10-07 02:41:00 +02003537echo "TARGET_$target_arch_name=y" >> $config_target_mak
3538echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
Juan Quintela42bc6082009-07-16 18:34:20 +02003539# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02003540if [ "$TARGET_BASE_ARCH" = "" ]; then
3541 TARGET_BASE_ARCH=$TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02003542fi
Juan Quintela25be2102009-10-07 02:41:00 +02003543echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02003544if [ "$TARGET_ABI_DIR" = "" ]; then
3545 TARGET_ABI_DIR=$TARGET_ARCH
3546fi
Juan Quintela25be2102009-10-07 02:41:00 +02003547echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02003548case "$target_arch2" in
3549 i386|x86_64)
3550 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
Anthony PERARD64b3cfd2010-10-21 12:47:08 +01003551 target_phys_bits=64
Juan Quintela25be2102009-10-07 02:41:00 +02003552 echo "CONFIG_XEN=y" >> $config_target_mak
Alexander Graf59d21e52011-07-17 07:30:29 +02003553 else
3554 echo "CONFIG_NO_XEN=y" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02003555 fi
Alexander Graf59d21e52011-07-17 07:30:29 +02003556 ;;
3557 *)
3558 echo "CONFIG_NO_XEN=y" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02003559esac
Juan Quintelac59249f2009-07-16 18:34:00 +02003560case "$target_arch2" in
Alexander Graf0e60a692009-12-05 12:44:24 +01003561 i386|x86_64|ppcemb|ppc|ppc64|s390x)
Juan Quintelac59249f2009-07-16 18:34:00 +02003562 # Make sure the target and host cpus are compatible
3563 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3564 \( "$target_arch2" = "$cpu" -o \
3565 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
Alexander Graf5f114bc2009-07-17 13:51:42 +02003566 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
René Rebeadf82012011-03-21 11:18:50 +01003567 \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \
3568 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
Juan Quintelac59249f2009-07-16 18:34:00 +02003569 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
3570 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003571 echo "CONFIG_KVM=y" >> $config_target_mak
Stefan Weil1ba16962011-07-29 22:40:45 +02003572 if test "$vhost_net" = "yes" ; then
Michael S. Tsirkind5970052010-03-17 13:08:17 +02003573 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3574 fi
Juan Quintelac59249f2009-07-16 18:34:00 +02003575 fi
3576esac
Blue Swirl7f762362011-11-01 20:59:32 +00003577if test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
Alexander Graf0a6b8dd2011-08-10 14:21:41 +02003578 echo "CONFIG_PSERIES=y" >> $config_target_mak
3579fi
bellardde83cd02003-06-15 20:25:43 +00003580if test "$target_bigendian" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003581 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00003582fi
3583if test "$target_softmmu" = "yes" ; then
Paul Brookb1aa27c2010-03-01 02:27:26 +00003584 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
Juan Quintela25be2102009-10-07 02:41:00 +02003585 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
Michael Wallede3a3542011-04-26 00:24:07 +02003586 echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
Andreas Färber0e8c9212010-01-06 20:24:05 +01003587 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
Kirill A. Shutemov5791f452009-09-12 02:17:53 +03003588 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00003589fi
bellard997344f2003-10-27 21:10:39 +00003590if test "$target_user_only" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003591 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
Stefan Weila2c80be2011-12-22 11:26:10 +01003592 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00003593fi
ths831b7822007-01-18 20:06:33 +00003594if test "$target_linux_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003595 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00003596fi
3597if test "$target_darwin_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003598 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00003599fi
Robert Relyea111a38b2010-11-28 16:36:38 +02003600if test "$smartcard_nss" = "yes" ; then
3601 echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3602 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3603 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3604fi
pbrook56aebc82008-10-11 17:55:29 +00003605list=""
3606if test ! -z "$gdb_xml_files" ; then
3607 for x in $gdb_xml_files; do
3608 list="$list $source_path/gdb-xml/$x"
3609 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02003610 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00003611fi
bellardde83cd02003-06-15 20:25:43 +00003612
pbrooke5fe0c52006-06-11 13:32:59 +00003613if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02003614 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00003615fi
pbrookbd0c5662008-05-29 14:34:11 +00003616if test "$target_user_only" = "yes" \
3617 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02003618 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
pbrookbd0c5662008-05-29 14:34:11 +00003619fi
Paul Brook379f6692009-07-17 12:48:08 +01003620if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02003621 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
Paul Brook379f6692009-07-17 12:48:08 +01003622fi
blueswir184778502008-10-26 20:33:16 +00003623if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003624 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00003625fi
bellard5b0753e2005-03-01 21:37:28 +00003626
Juan Quintela4afddb52009-08-03 14:46:45 +02003627# generate QEMU_CFLAGS/LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02003628
Juan Quintela4afddb52009-08-03 14:46:45 +02003629cflags=""
Paolo Bonzinif9728942010-12-23 11:43:53 +01003630includes=""
Juan Quintelafa282482009-07-22 22:37:39 +02003631ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02003632
Stefan Weil9195b2c2011-10-19 07:07:18 +02003633if test "$tcg_interpreter" = "yes"; then
3634 includes="-I\$(SRC_PATH)/tcg/tci $includes"
3635elif test "$ARCH" = "sparc64" ; then
Paolo Bonzinif9728942010-12-23 11:43:53 +01003636 includes="-I\$(SRC_PATH)/tcg/sparc $includes"
Alexander Graf24e804ec2009-12-05 12:44:22 +01003637elif test "$ARCH" = "s390x" ; then
Paolo Bonzinif9728942010-12-23 11:43:53 +01003638 includes="-I\$(SRC_PATH)/tcg/s390 $includes"
Richard Henderson5d8a4f82010-06-03 17:35:17 -07003639elif test "$ARCH" = "x86_64" ; then
Paolo Bonzinif9728942010-12-23 11:43:53 +01003640 includes="-I\$(SRC_PATH)/tcg/i386 $includes"
Juan Quintela57ddfbf2009-08-03 14:46:51 +02003641else
Paolo Bonzinif9728942010-12-23 11:43:53 +01003642 includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
Juan Quintela57ddfbf2009-08-03 14:46:51 +02003643fi
Paolo Bonzinif9728942010-12-23 11:43:53 +01003644includes="-I\$(SRC_PATH)/tcg $includes"
Juan Quintela57ddfbf2009-08-03 14:46:51 +02003645
Peter Maydell6efd7512011-11-30 11:59:04 +00003646if test "$linux" = "yes" ; then
3647 includes="-I\$(SRC_PATH)/linux-headers $includes"
3648fi
3649
Blue Swirl4d904532010-03-21 08:28:47 +00003650if test "$target_user_only" = "yes" ; then
3651 libdis_config_mak=libdis-user/config.mak
3652else
3653 libdis_config_mak=libdis/config.mak
3654fi
3655
Juan Quintela64656022009-08-03 14:46:53 +02003656for i in $ARCH $TARGET_BASE_ARCH ; do
3657 case "$i" in
3658 alpha)
Juan Quintela25be2102009-10-07 02:41:00 +02003659 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003660 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003661 ;;
3662 arm)
Juan Quintela25be2102009-10-07 02:41:00 +02003663 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003664 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003665 ;;
3666 cris)
Juan Quintela25be2102009-10-07 02:41:00 +02003667 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003668 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003669 ;;
3670 hppa)
Juan Quintela25be2102009-10-07 02:41:00 +02003671 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003672 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003673 ;;
3674 i386|x86_64)
Juan Quintela25be2102009-10-07 02:41:00 +02003675 echo "CONFIG_I386_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003676 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003677 ;;
Aurelien Jarno903ec552010-03-29 02:12:51 +02003678 ia64*)
3679 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3680 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3681 ;;
Juan Quintela64656022009-08-03 14:46:53 +02003682 m68k)
Juan Quintela25be2102009-10-07 02:41:00 +02003683 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003684 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003685 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01003686 microblaze*)
Juan Quintela25be2102009-10-07 02:41:00 +02003687 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003688 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003689 ;;
3690 mips*)
Juan Quintela25be2102009-10-07 02:41:00 +02003691 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003692 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003693 ;;
3694 ppc*)
Juan Quintela25be2102009-10-07 02:41:00 +02003695 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003696 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003697 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01003698 s390*)
Juan Quintela25be2102009-10-07 02:41:00 +02003699 echo "CONFIG_S390_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003700 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003701 ;;
3702 sh4)
Juan Quintela25be2102009-10-07 02:41:00 +02003703 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003704 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003705 ;;
3706 sparc*)
Juan Quintela25be2102009-10-07 02:41:00 +02003707 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003708 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003709 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04003710 xtensa*)
3711 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
3712 echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak
3713 ;;
Juan Quintela64656022009-08-03 14:46:53 +02003714 esac
3715done
Stefan Weil9195b2c2011-10-19 07:07:18 +02003716if test "$tcg_interpreter" = "yes" ; then
3717 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
3718 echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak
3719fi
Juan Quintela64656022009-08-03 14:46:53 +02003720
Juan Quintela6ee71262009-08-03 14:46:47 +02003721case "$ARCH" in
3722alpha)
3723 # Ensure there's only a single GP
3724 cflags="-msmall-data $cflags"
3725;;
3726esac
3727
Juan Quintela55d9c042009-08-03 14:47:02 +02003728if test "$target_softmmu" = "yes" ; then
3729 case "$TARGET_BASE_ARCH" in
3730 arm)
3731 cflags="-DHAS_AUDIO $cflags"
3732 ;;
Michael Walle25a8bb92011-03-07 23:32:32 +01003733 lm32)
3734 cflags="-DHAS_AUDIO $cflags"
3735 ;;
Juan Quintela55d9c042009-08-03 14:47:02 +02003736 i386|mips|ppc)
3737 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3738 ;;
3739 esac
3740fi
3741
Juan Quintela471857d2009-08-03 14:46:52 +02003742if test "$target_softmmu" = "yes" -a \( \
3743 "$TARGET_ARCH" = "microblaze" -o \
3744 "$TARGET_ARCH" = "cris" \) ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003745 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
Juan Quintela471857d2009-08-03 14:46:52 +02003746fi
3747
Juan Quintelad02c1db2009-08-03 14:46:50 +02003748if test "$gprof" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003749 echo "TARGET_GPROF=yes" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02003750 if test "$target_linux_user" = "yes" ; then
3751 cflags="-p $cflags"
3752 ldflags="-p $ldflags"
3753 fi
3754 if test "$target_softmmu" = "yes" ; then
3755 ldflags="-p $ldflags"
Juan Quintela25be2102009-10-07 02:41:00 +02003756 echo "GPROF_CFLAGS=-p" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02003757 fi
3758fi
3759
Stefan Weil9195b2c2011-10-19 07:07:18 +02003760if test "$ARCH" = "tci"; then
3761 linker_script=""
3762else
3763 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
3764fi
3765
Juan Quintela9b8e1112009-08-03 14:46:46 +02003766if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
Juan Quintelafa282482009-07-22 22:37:39 +02003767 case "$ARCH" in
Juan Quintelafa282482009-07-22 22:37:39 +02003768 sparc)
3769 # -static is used to avoid g1/g3 usage by the dynamic linker
Juan Quintela322e5872009-08-03 14:46:44 +02003770 ldflags="$linker_script -static $ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02003771 ;;
Richard Henderson4d58be02010-06-04 12:14:11 -07003772 alpha | s390x)
3773 # The default placement of the application is fine.
3774 ;;
Richard Hendersonfd76e732010-04-07 04:56:43 -07003775 *)
Juan Quintela322e5872009-08-03 14:46:44 +02003776 ldflags="$linker_script $ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02003777 ;;
3778 esac
3779fi
Juan Quintelafa282482009-07-22 22:37:39 +02003780
Juan Quintela25be2102009-10-07 02:41:00 +02003781echo "LDFLAGS+=$ldflags" >> $config_target_mak
3782echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01003783echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02003784
bellard97a847b2003-08-10 21:36:04 +00003785done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00003786
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003787# build tree in object directory in case the source is not in the current directory
Anthony Liguoric09015d2012-01-10 13:10:42 -06003788DIRS="tests tests/tcg tests/tcg/cris slirp audio block net pc-bios/optionrom"
Andreas Färber446b9162011-05-08 13:25:56 +02003789DIRS="$DIRS pc-bios/spapr-rtas"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003790DIRS="$DIRS roms/seabios roms/vgabios"
3791DIRS="$DIRS fsdev ui"
Michael Rothe098fc32011-09-07 18:40:52 -05003792DIRS="$DIRS qapi qapi-generated"
Anthony Liguori2f28d2f2011-12-03 17:10:08 -06003793DIRS="$DIRS qga trace qom"
Anthony Liguoric09015d2012-01-10 13:10:42 -06003794FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
3795FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003796FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
Andreas Färber446b9162011-05-08 13:25:56 +02003797FILES="$FILES pc-bios/spapr-rtas/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003798FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
Richard Henderson753d11f2011-06-24 11:58:37 -07003799for bios_file in \
3800 $source_path/pc-bios/*.bin \
3801 $source_path/pc-bios/*.rom \
3802 $source_path/pc-bios/*.dtb \
3803 $source_path/pc-bios/openbios-* \
3804 $source_path/pc-bios/palcode-*
3805do
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003806 FILES="$FILES pc-bios/`basename $bios_file`"
3807done
3808mkdir -p $DIRS
3809for f in $FILES ; do
Peter Maydellf9245e12011-06-03 17:10:40 +01003810 if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then
3811 symlink "$source_path/$f" "$f"
3812 fi
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003813done
Paul Brook1ad21342009-05-19 16:17:58 +01003814
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003815# temporary config to build submodules
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06003816for rom in seabios vgabios ; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003817 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01003818 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003819 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3820 echo "CC=$cc" >> $config_mak
3821 echo "BCC=bcc" >> $config_mak
3822 echo "CPP=${cross_prefix}cpp" >> $config_mak
3823 echo "OBJCOPY=objcopy" >> $config_mak
3824 echo "IASL=iasl" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003825 echo "LD=$ld" >> $config_mak
3826done
3827
Paul Brook1ad21342009-05-19 16:17:58 +01003828for hwlib in 32 64; do
3829 d=libhw$hwlib
3830 mkdir -p $d
Blue Swirl9953b2f2010-03-21 19:47:05 +00003831 mkdir -p $d/ide
Paolo Bonzini11568d62010-12-23 11:43:58 +01003832 symlink $source_path/Makefile.hw $d/Makefile
Aneesh Kumar K.V353ac782011-01-28 18:09:08 +05303833 mkdir -p $d/9pfs
Stefan Weil37116c82010-03-01 22:20:29 +01003834 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
Paul Brook1ad21342009-05-19 16:17:58 +01003835done
Blue Swirladd16152009-09-27 16:26:02 +00003836
Robert Relyea111a38b2010-11-28 16:36:38 +02003837if [ "$source_path" != `pwd` ]; then
3838 # out of tree build
3839 mkdir -p libcacard
3840 rm -f libcacard/Makefile
Alon Levy44dc0ca2011-05-15 11:51:28 +03003841 symlink "$source_path/libcacard/Makefile" libcacard/Makefile
Robert Relyea111a38b2010-11-28 16:36:38 +02003842fi
3843
Blue Swirladd16152009-09-27 16:26:02 +00003844d=libuser
3845mkdir -p $d
Lluís Vilanova937b1252011-09-15 22:45:42 +02003846mkdir -p $d/trace
Paolo Bonzini11568d62010-12-23 11:43:58 +01003847symlink $source_path/Makefile.user $d/Makefile
Jan Kiszkab40292e2010-05-31 14:43:31 -03003848
3849if test "$docs" = "yes" ; then
3850 mkdir -p QMP
3851fi