blob: 54674df5c71ea0e3f7bd4e4d873e6fd7fbe21778 [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001#!/bin/sh
2#
bellard3ef693a2003-03-23 20:17:16 +00003# qemu configure script (c) 2003 Fabrice Bellard
bellard7d132992003-03-06 23:23:54 +00004#
5# set temporary file name
6if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10else
11 TMPDIR1="/tmp"
12fi
13
bellard3ef693a2003-03-23 20:17:16 +000014TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
malca91b8572009-10-15 01:57:14 +040016TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
bellard7d132992003-03-06 23:23:54 +000017
Loïc Minier0ba86812010-09-25 21:52:30 +020018# NB: do not call "exit" in the trap handler; this is buggy with some shells;
19# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
20trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020021rm -f config.log
malc9ac81bb2008-11-29 20:09:56 +000022
Juan Quintela52166aa2009-08-03 14:46:03 +020023compile_object() {
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020024 echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
25 $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
Juan Quintela52166aa2009-08-03 14:46:03 +020026}
27
28compile_prog() {
29 local_cflags="$1"
30 local_ldflags="$2"
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020031 echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
32 $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
Juan Quintela52166aa2009-08-03 14:46:03 +020033}
34
Paolo Bonzini11568d62010-12-23 11:43:58 +010035# symbolically link $1 to $2. Portable version of "ln -sf".
36symlink() {
37 rm -f $2
38 ln -s $1 $2
39}
40
Loïc Minier0dba6192010-01-28 21:26:51 +000041# check whether a command is available to this shell (may be either an
42# executable or a builtin)
43has() {
44 type "$1" >/dev/null 2>&1
45}
46
47# search for an executable in PATH
48path_of() {
49 local_command="$1"
50 local_ifs="$IFS"
51 local_dir=""
52
53 # pathname has a dir component?
54 if [ "${local_command#*/}" != "$local_command" ]; then
55 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
56 echo "$local_command"
57 return 0
58 fi
59 fi
60 if [ -z "$local_command" ]; then
61 return 1
62 fi
63
64 IFS=:
65 for local_dir in $PATH; do
66 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
67 echo "$local_dir/$local_command"
68 IFS="${local_ifs:-$(printf ' \t\n')}"
69 return 0
70 fi
71 done
72 # not found
73 IFS="${local_ifs:-$(printf ' \t\n')}"
74 return 1
75}
76
bellard7d132992003-03-06 23:23:54 +000077# default parameters
Paolo Bonzinica4deeb2010-12-23 11:44:00 +010078source_path=`dirname "$0"`
Juan Quintela2ff6b912009-08-03 14:45:55 +020079cpu=""
bellard1e43adf2003-09-30 20:54:24 +000080interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000081static="no"
Juan Quintelaed968ff2009-08-03 14:46:11 +020082sparc_cpu=""
bellard7d132992003-03-06 23:23:54 +000083cross_prefix=""
malc0c58ac12008-06-25 21:04:05 +000084audio_drv_list=""
Gerd Hoffmannd61a4ce2010-11-01 13:05:32 +010085audio_card_list="ac97 es1370 sb16 hda"
86audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
Markus Armbrustereb852012009-10-27 18:41:44 +010087block_drv_whitelist=""
bellard7d132992003-03-06 23:23:54 +000088host_cc="gcc"
Juan Quintelac81da562009-08-03 14:46:24 +020089helper_cflags=""
Juan Quintela73da3752009-08-03 14:46:26 +020090libs_softmmu=""
Juan Quintela3e2e0e62009-08-03 14:47:06 +020091libs_tools=""
Juan Quintela67f86e82009-08-03 14:46:59 +020092audio_pt_int=""
malcd5631632009-10-10 01:13:41 +040093audio_win_int=""
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +020094cc_i386=i386-pc-linux-gnu-gcc
Michael Roth957f1f92011-08-11 15:38:12 -050095libs_qga=""
aliguoriac0df512008-12-29 17:14:15 +000096
Paolo Bonzini377529c2010-12-23 11:43:50 +010097target_list=""
98
99# Default value for a variable defining feature "foo".
100# * foo="no" feature will only be used if --enable-foo arg is given
101# * foo="" feature will be searched for, and if found, will be used
102# unless --disable-foo is given
103# * foo="yes" this value will only be set by --enable-foo flag.
104# feature will searched for,
105# if not found, configure exits with error
106#
107# Always add --enable-foo and --disable-foo command line args.
108# Distributions want to ensure that several features are compiled in, and it
109# is impossible without a --enable-foo that exits if a feature is not found.
110
111bluez=""
112brlapi=""
113curl=""
114curses=""
115docs=""
116fdt=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100117nptl=""
118sdl=""
Jes Sorensen821601e2011-03-16 13:33:36 +0100119vnc="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100120sparse="no"
121uuid=""
122vde=""
123vnc_tls=""
124vnc_sasl=""
125vnc_jpeg=""
126vnc_png=""
127vnc_thread="no"
128xen=""
Anthony PERARDd5b93dd2011-02-25 16:20:34 +0000129xen_ctrl_version=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100130linux_aio=""
131attr=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100132xfs=""
133
Bradd41a75a2011-07-26 23:11:26 -0400134vhost_net="no"
135kvm="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100136gprof="no"
137debug_tcg="no"
138debug_mon="no"
139debug="no"
140strip_opt="yes"
Stefan Weil9195b2c2011-10-19 07:07:18 +0200141tcg_interpreter="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100142bigendian="no"
143mingw32="no"
144EXESUF=""
145prefix="/usr/local"
146mandir="\${prefix}/share/man"
147datadir="\${prefix}/share/qemu"
148docdir="\${prefix}/share/doc/qemu"
149bindir="\${prefix}/bin"
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300150libdir="\${prefix}/lib"
Alon Levy0f94d6d2011-06-27 11:58:20 +0200151includedir="\${prefix}/include"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100152sysconfdir="\${prefix}/etc"
153confsuffix="/qemu"
154slirp="yes"
155fmod_lib=""
156fmod_inc=""
157oss_lib=""
158bsd="no"
159linux="no"
160solaris="no"
161profiler="no"
162cocoa="no"
163softmmu="yes"
164linux_user="no"
165darwin_user="no"
166bsd_user="no"
167guest_base=""
168uname_release=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100169mixemu="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100170aix="no"
171blobs="yes"
172pkgversion=""
173check_utests="no"
174user_pie="no"
175zero_malloc=""
176trace_backend="nop"
177trace_file="trace"
178spice=""
179rbd=""
Alon Levy36707142010-10-17 11:40:07 +0200180smartcard=""
Robert Relyea111a38b2010-11-28 16:36:38 +0200181smartcard_nss=""
Hans de Goede69354a82011-07-19 11:04:10 +0200182usb_redir=""
Michael Walle430a3c12011-04-26 00:09:01 +0200183opengl=""
Alon Levy1ece9902011-07-26 12:30:40 +0300184zlib="yes"
Michael Rothd138cee2011-08-01 14:52:57 -0500185guest_agent="yes"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100186libiscsi=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100187
aliguoriac0df512008-12-29 17:14:15 +0000188# parse CC options first
189for opt do
190 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
191 case "$opt" in
192 --cross-prefix=*) cross_prefix="$optarg"
193 ;;
Paolo Bonzini3d8df642010-12-23 11:43:48 +0100194 --cc=*) CC="$optarg"
aliguoriac0df512008-12-29 17:14:15 +0000195 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100196 --source-path=*) source_path="$optarg"
197 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200198 --cpu=*) cpu="$optarg"
199 ;;
Juan Quintelaa558ee12009-08-03 14:46:21 +0200200 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200201 ;;
202 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
203 ;;
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200204 --sparc_cpu=*)
205 sparc_cpu="$optarg"
206 case $sparc_cpu in
Juan Quintelaed968ff2009-08-03 14:46:11 +0200207 v7|v8|v8plus|v8plusa)
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200208 cpu="sparc"
209 ;;
210 v9)
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200211 cpu="sparc64"
212 ;;
213 *)
214 echo "undefined SPARC architecture. Exiting";
215 exit 1
216 ;;
217 esac
218 ;;
aliguoriac0df512008-12-29 17:14:15 +0000219 esac
220done
aliguoriac0df512008-12-29 17:14:15 +0000221# OS specific
222# Using uname is really, really broken. Once we have the right set of checks
223# we can eliminate it's usage altogether
224
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500225cc="${CC-${cross_prefix}gcc}"
226ar="${AR-${cross_prefix}ar}"
227objcopy="${OBJCOPY-${cross_prefix}objcopy}"
228ld="${LD-${cross_prefix}ld}"
Brad3f534582011-08-13 20:30:14 -0400229libtool="${LIBTOOL-${cross_prefix}libtool}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500230strip="${STRIP-${cross_prefix}strip}"
231windres="${WINDRES-${cross_prefix}windres}"
232pkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}"
233sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
aliguoriac0df512008-12-29 17:14:15 +0000234
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200235# default flags for all hosts
236QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
237CFLAGS="-g $CFLAGS"
Mike Frysingerf9188222011-05-17 17:08:43 -0400238QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200239QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
240QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Kirill A. Shutemov84958302010-01-20 00:56:22 +0100241QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
Paolo Bonzinicbbab922011-07-28 12:10:30 +0200242QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200243LDFLAGS="-g $LDFLAGS"
244
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100245# make source path absolute
246source_path=`cd "$source_path"; pwd`
247
aliguoriac0df512008-12-29 17:14:15 +0000248check_define() {
249cat > $TMPC <<EOF
250#if !defined($1)
251#error Not defined
252#endif
253int main(void) { return 0; }
254EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200255 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000256}
257
Juan Quintela2ff6b912009-08-03 14:45:55 +0200258if test ! -z "$cpu" ; then
259 # command line argument
260 :
261elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000262 cpu="i386"
263elif check_define __x86_64__ ; then
264 cpu="x86_64"
blueswir13aa9bd62008-12-31 16:55:26 +0000265elif check_define __sparc__ ; then
266 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
267 # They must be specified using --sparc_cpu
268 if check_define __arch64__ ; then
269 cpu="sparc64"
270 else
271 cpu="sparc"
272 fi
malcfdf7ed92009-01-14 18:39:52 +0000273elif check_define _ARCH_PPC ; then
274 if check_define _ARCH_PPC64 ; then
275 cpu="ppc64"
276 else
277 cpu="ppc"
278 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200279elif check_define __mips__ ; then
280 cpu="mips"
Aurelien Jarno477ba622010-03-29 02:12:51 +0200281elif check_define __ia64__ ; then
282 cpu="ia64"
Aurelien Jarnod66ed0e2010-06-13 12:28:21 +0200283elif check_define __s390__ ; then
284 if check_define __s390x__ ; then
285 cpu="s390x"
286 else
287 cpu="s390"
288 fi
Bradf28ffed2011-09-07 21:24:56 -0400289elif check_define __ARMEB__ ; then
290 cpu="armv4b"
291elif check_define __ARMEL__ ; then
292 cpu="armv4l"
293elif check_define __hppa__ ; then
294 cpu="hppa"
aliguoriac0df512008-12-29 17:14:15 +0000295else
malcfdf7ed92009-01-14 18:39:52 +0000296 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +0000297fi
298
bellard7d132992003-03-06 23:23:54 +0000299case "$cpu" in
Guan Xuetaod2fbca92011-04-12 16:27:03 +0800300 alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64|unicore32)
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200301 cpu="$cpu"
302 ;;
bellard7d132992003-03-06 23:23:54 +0000303 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000304 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000305 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000306 x86_64|amd64)
307 cpu="x86_64"
308 ;;
bellardba680552005-03-13 09:49:52 +0000309 armv*b)
bellard808c4952004-12-19 23:33:47 +0000310 cpu="armv4b"
311 ;;
bellardba680552005-03-13 09:49:52 +0000312 armv*l)
bellard7d132992003-03-06 23:23:54 +0000313 cpu="armv4l"
314 ;;
Bradf28ffed2011-09-07 21:24:56 -0400315 hppa|parisc|parisc64)
aurel32f54b3f92008-04-12 20:14:54 +0000316 cpu="hppa"
317 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200318 mips*)
319 cpu="mips"
320 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +0100321 s390)
bellardfb3e5842003-03-29 17:32:36 +0000322 cpu="s390"
323 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +0100324 s390x)
325 cpu="s390x"
326 ;;
blueswir131422552007-04-16 18:27:06 +0000327 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000328 cpu="sparc"
329 ;;
bellard7d132992003-03-06 23:23:54 +0000330 *)
Paolo Bonzinia447d4d2010-05-26 16:08:16 +0200331 echo "Unsupported CPU = $cpu"
332 exit 1
bellard7d132992003-03-06 23:23:54 +0000333 ;;
334esac
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200335
bellard7d132992003-03-06 23:23:54 +0000336# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000337if check_define __linux__ ; then
338 targetos="Linux"
339elif check_define _WIN32 ; then
340 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000341elif check_define __OpenBSD__ ; then
342 targetos='OpenBSD'
343elif check_define __sun__ ; then
344 targetos='SunOS'
Andreas Färber179cf402010-09-20 00:50:43 +0200345elif check_define __HAIKU__ ; then
346 targetos='Haiku'
aliguoriac0df512008-12-29 17:14:15 +0000347else
348 targetos=`uname -s`
349fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200350
bellard7d132992003-03-06 23:23:54 +0000351case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000352CYGWIN*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200353 mingw32="yes"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200354 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
malcd5631632009-10-10 01:13:41 +0400355 audio_possible_drivers="winwave sdl"
356 audio_drv_list="winwave"
bellardc326e0a2005-04-23 18:30:28 +0000357;;
bellard67b915a2004-03-31 23:37:16 +0000358MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200359 mingw32="yes"
malcd5631632009-10-10 01:13:41 +0400360 audio_possible_drivers="winwave dsound sdl fmod"
361 audio_drv_list="winwave"
bellard67b915a2004-03-31 23:37:16 +0000362;;
ths5c40d2b2007-06-23 16:03:36 +0000363GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100364 bsd="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200365 audio_drv_list="oss"
366 audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000367;;
bellard7d3505c2004-05-12 19:32:15 +0000368FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200369 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100370 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200371 audio_drv_list="oss"
372 audio_possible_drivers="oss sdl esd pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100373 # needed for kinfo_getvmmap(3) in libutil.h
374 LIBS="-lutil $LIBS"
bellard7d3505c2004-05-12 19:32:15 +0000375;;
blueswir1c5e97232009-03-07 20:06:23 +0000376DragonFly)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200377 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100378 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200379 audio_drv_list="oss"
380 audio_possible_drivers="oss sdl esd pa"
blueswir1c5e97232009-03-07 20:06:23 +0000381;;
bellard7d3505c2004-05-12 19:32:15 +0000382NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200383 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100384 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200385 audio_drv_list="oss"
386 audio_possible_drivers="oss sdl esd"
387 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000388;;
389OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200390 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100391 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200392 audio_drv_list="oss"
393 audio_possible_drivers="oss sdl esd"
394 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000395;;
bellard83fb7ad2004-07-05 21:25:26 +0000396Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200397 bsd="yes"
398 darwin="yes"
399 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
400 # run 64-bit userspace code
401 if [ "$cpu" = "i386" ] ; then
malcaab85882009-02-23 14:11:10 +0000402 is_x86_64=`sysctl -n hw.optional.x86_64`
403 [ "$is_x86_64" = "1" ] && cpu=x86_64
Juan Quintela0dbfc672009-08-03 14:46:13 +0200404 fi
405 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200406 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200407 LDFLAGS="-arch x86_64 $LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200408 else
Juan Quintelaa558ee12009-08-03 14:46:21 +0200409 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200410 fi
411 darwin_user="yes"
412 cocoa="yes"
413 audio_drv_list="coreaudio"
414 audio_possible_drivers="coreaudio sdl fmod"
415 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200416 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
bellard83fb7ad2004-07-05 21:25:26 +0000417;;
bellardec530c82006-04-25 22:36:06 +0000418SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200419 solaris="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100420 make="${MAKE-gmake}"
421 install="${INSTALL-ginstall}"
Blue Swirlfa589482009-10-02 19:38:25 +0000422 ld="gld"
Brade2d88302011-09-02 16:53:28 -0400423 smbd="${SMBD-/usr/sfw/sbin/smbd}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200424 needs_libsunmath="no"
425 solarisrev=`uname -r | cut -f2 -d.`
426 # have to select again, because `uname -m` returns i86pc
427 # even on an x86_64 box.
428 solariscpu=`isainfo -k`
429 if test "${solariscpu}" = "amd64" ; then
430 cpu="x86_64"
431 fi
432 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
433 if test "$solarisrev" -le 9 ; then
434 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
435 needs_libsunmath="yes"
Juan Quintelaf14bfdf2009-08-03 14:47:11 +0200436 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
437 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
438 LIBS="-lsunmath $LIBS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200439 else
440 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
441 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
442 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
443 echo "Studio 11 can be downloaded from www.sun.com."
444 exit 1
445 fi
thsef18c882007-09-16 22:12:39 +0000446 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200447 fi
448 if test -f /usr/include/sys/soundcard.h ; then
449 audio_drv_list="oss"
450 fi
451 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000452# needed for CMSG_ macros in sys/socket.h
453 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
454# needed for TIOCWIN* defines in termios.h
455 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200456 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
Juan Quintelae174c0b2009-08-03 14:46:18 +0200457 LIBS="-lsocket -lnsl -lresolv $LIBS"
ths86b2bd92007-02-11 00:31:33 +0000458;;
malcb29fe3e2008-11-18 01:42:22 +0000459AIX)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200460 aix="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100461 make="${MAKE-gmake}"
malcb29fe3e2008-11-18 01:42:22 +0000462;;
Andreas Färber179cf402010-09-20 00:50:43 +0200463Haiku)
464 haiku="yes"
465 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
466 LIBS="-lposix_error_mapper -lnetwork $LIBS"
467;;
bellard1d14ffa2005-10-30 18:58:22 +0000468*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200469 audio_drv_list="oss"
470 audio_possible_drivers="oss alsa sdl esd pa"
471 linux="yes"
472 linux_user="yes"
473 usb="linux"
Jan Kiszkaaf2be202011-06-23 10:05:12 +0200474 kvm="yes"
475 vhost_net="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200476 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
malcc2de5c92008-06-28 19:13:06 +0000477 audio_possible_drivers="$audio_possible_drivers fmod"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200478 fi
bellardfb065182004-11-09 23:09:44 +0000479;;
bellard7d132992003-03-06 23:23:54 +0000480esac
481
bellard7d3505c2004-05-12 19:32:15 +0000482if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000483 if [ "$darwin" != "yes" ] ; then
blueswir168063642008-11-22 21:03:55 +0000484 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000485 fi
blueswir184778502008-10-26 20:33:16 +0000486 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000487fi
488
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100489: ${make=${MAKE-make}}
490: ${install=${INSTALL-install}}
Blue Swirlc886edf2011-07-22 21:08:09 +0000491: ${python=${PYTHON-python}}
Brade2d88302011-09-02 16:53:28 -0400492: ${smbd=${SMBD-/usr/sbin/smbd}}
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100493
Juan Quintela3457a3f2009-08-03 14:46:07 +0200494if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +0200495 EXESUF=".exe"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200496 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
Stefan Weile94a7932010-02-12 11:02:08 +0100497 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
498 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
Stefan Weil08f38962011-02-04 22:38:47 +0100499 LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200500 prefix="c:/Program Files/Qemu"
501 mandir="\${prefix}"
502 datadir="\${prefix}"
503 docdir="\${prefix}"
504 bindir="\${prefix}"
505 sysconfdir="\${prefix}"
506 confsuffix=""
Stefan Weil83b2f0a2011-08-06 22:47:22 +0200507 guest_agent="no"
Juan Quintela3457a3f2009-08-03 14:46:07 +0200508fi
509
Anthony Liguori487fefd2009-06-11 13:28:25 -0500510werror=""
bellard85aa5182007-11-11 20:17:03 +0000511
bellard7d132992003-03-06 23:23:54 +0000512for opt do
pbrooka46e4032006-04-29 23:05:22 +0000513 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000514 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000515 --help|-h) show_help=yes
516 ;;
Mike Frysinger99123e12011-04-07 01:12:28 -0400517 --version|-V) exec cat $source_path/VERSION
518 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000519 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000520 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000521 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000522 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100523 --source-path=*)
bellard7d132992003-03-06 23:23:54 +0000524 ;;
aliguoriac0df512008-12-29 17:14:15 +0000525 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000526 ;;
aliguoriac0df512008-12-29 17:14:15 +0000527 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000528 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000529 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000530 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000531 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000532 ;;
pbrook6a882642006-04-17 13:57:12 +0000533 --install=*) install="$optarg"
534 ;;
Blue Swirlc886edf2011-07-22 21:08:09 +0000535 --python=*) python="$optarg"
536 ;;
Brade2d88302011-09-02 16:53:28 -0400537 --smbd=*) smbd="$optarg"
538 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200539 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000540 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200541 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000542 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200543 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000544 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000545 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000546 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100547 --enable-trace-backend=*) trace_backend="$optarg"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +0100548 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100549 --with-trace-file=*) trace_file="$optarg"
Prerna Saxena9410b562010-07-13 09:26:32 +0100550 ;;
bellard7d132992003-03-06 23:23:54 +0000551 --enable-gprof) gprof="yes"
552 ;;
Loïc Minier79427692010-01-31 12:23:45 +0100553 --static)
554 static="yes"
555 LDFLAGS="-static $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +0000556 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200557 --mandir=*) mandir="$optarg"
558 ;;
559 --bindir=*) bindir="$optarg"
560 ;;
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300561 --libdir=*) libdir="$optarg"
562 ;;
Alon Levy0f94d6d2011-06-27 11:58:20 +0200563 --includedir=*) includedir="$optarg"
564 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200565 --datadir=*) datadir="$optarg"
566 ;;
567 --docdir=*) docdir="$optarg"
568 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +0100569 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -0600570 ;;
bellard97a847b2003-08-10 21:36:04 +0000571 --disable-sdl) sdl="no"
572 ;;
Juan Quintelac4198152009-08-12 18:29:53 +0200573 --enable-sdl) sdl="yes"
574 ;;
Jes Sorensen821601e2011-03-16 13:33:36 +0100575 --disable-vnc) vnc="no"
576 ;;
577 --enable-vnc) vnc="yes"
578 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000579 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000580 ;;
malcc2de5c92008-06-28 19:13:06 +0000581 --fmod-inc=*) fmod_inc="$optarg"
582 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000583 --oss-lib=*) oss_lib="$optarg"
584 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000585 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000586 ;;
587 --audio-drv-list=*) audio_drv_list="$optarg"
588 ;;
Markus Armbrustereb852012009-10-27 18:41:44 +0100589 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
590 ;;
aurel32f8393942009-04-13 18:45:38 +0000591 --enable-debug-tcg) debug_tcg="yes"
592 ;;
593 --disable-debug-tcg) debug_tcg="no"
594 ;;
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200595 --enable-debug-mon) debug_mon="yes"
596 ;;
597 --disable-debug-mon) debug_mon="no"
598 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100599 --enable-debug)
600 # Enable debugging options that aren't excessively noisy
601 debug_tcg="yes"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200602 debug_mon="yes"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100603 debug="yes"
604 strip_opt="no"
605 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000606 --enable-sparse) sparse="yes"
607 ;;
608 --disable-sparse) sparse="no"
609 ;;
aliguori1625af82009-04-05 17:41:02 +0000610 --disable-strip) strip_opt="no"
611 ;;
ths8d5d2d42007-08-25 01:37:51 +0000612 --disable-vnc-tls) vnc_tls="no"
613 ;;
Juan Quintela1be10ad2009-08-12 18:20:28 +0200614 --enable-vnc-tls) vnc_tls="yes"
615 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000616 --disable-vnc-sasl) vnc_sasl="no"
617 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +0200618 --enable-vnc-sasl) vnc_sasl="yes"
619 ;;
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200620 --disable-vnc-jpeg) vnc_jpeg="no"
621 ;;
622 --enable-vnc-jpeg) vnc_jpeg="yes"
623 ;;
Corentin Charyefe556a2010-07-07 20:57:56 +0200624 --disable-vnc-png) vnc_png="no"
625 ;;
626 --enable-vnc-png) vnc_png="yes"
627 ;;
Corentin Charybd023f92010-07-07 20:58:02 +0200628 --disable-vnc-thread) vnc_thread="no"
629 ;;
630 --enable-vnc-thread) vnc_thread="yes"
631 ;;
bellard443f1372004-06-04 11:13:20 +0000632 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000633 ;;
Stefan Weilee682d22009-10-01 20:10:37 +0200634 --disable-uuid) uuid="no"
635 ;;
636 --enable-uuid) uuid="yes"
637 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000638 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000639 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +0200640 --enable-vde) vde="yes"
641 ;;
aliguorie37630c2009-04-22 15:19:10 +0000642 --disable-xen) xen="no"
643 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +0200644 --enable-xen) xen="yes"
645 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000646 --disable-brlapi) brlapi="no"
647 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200648 --enable-brlapi) brlapi="yes"
649 ;;
balrogfb599c92008-09-28 23:49:55 +0000650 --disable-bluez) bluez="no"
651 ;;
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200652 --enable-bluez) bluez="yes"
653 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000654 --disable-kvm) kvm="no"
655 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +0200656 --enable-kvm) kvm="yes"
657 ;;
Stefan Weil9195b2c2011-10-19 07:07:18 +0200658 --disable-tcg-interpreter) tcg_interpreter="no"
659 ;;
660 --enable-tcg-interpreter) tcg_interpreter="yes"
661 ;;
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +0100662 --disable-spice) spice="no"
663 ;;
664 --enable-spice) spice="yes"
665 ;;
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100666 --disable-libiscsi) libiscsi="no"
667 ;;
668 --enable-libiscsi) libiscsi="yes"
669 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000670 --enable-profiler) profiler="yes"
671 ;;
malcc2de5c92008-06-28 19:13:06 +0000672 --enable-cocoa)
673 cocoa="yes" ;
674 sdl="no" ;
675 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000676 ;;
pbrookcad25d62006-03-19 16:31:11 +0000677 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000678 ;;
pbrookcad25d62006-03-19 16:31:11 +0000679 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000680 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -1000681 --disable-user)
682 linux_user="no" ;
683 bsd_user="no" ;
684 darwin_user="no"
685 ;;
686 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +0000687 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000688 ;;
ths831b7822007-01-18 20:06:33 +0000689 --enable-linux-user) linux_user="yes"
690 ;;
691 --disable-darwin-user) darwin_user="no"
692 ;;
693 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000694 ;;
blueswir184778502008-10-26 20:33:16 +0000695 --disable-bsd-user) bsd_user="no"
696 ;;
697 --enable-bsd-user) bsd_user="yes"
698 ;;
Paul Brook379f6692009-07-17 12:48:08 +0100699 --enable-guest-base) guest_base="yes"
700 ;;
701 --disable-guest-base) guest_base="no"
702 ;;
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300703 --enable-user-pie) user_pie="yes"
704 ;;
705 --disable-user-pie) user_pie="no"
706 ;;
pbrookc5937222006-05-14 11:30:38 +0000707 --enable-uname-release=*) uname_release="$optarg"
708 ;;
blueswir131422552007-04-16 18:27:06 +0000709 --sparc_cpu=*)
blueswir131422552007-04-16 18:27:06 +0000710 ;;
bellard85aa5182007-11-11 20:17:03 +0000711 --enable-werror) werror="yes"
712 ;;
713 --disable-werror) werror="no"
714 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000715 --disable-curses) curses="no"
716 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +0200717 --enable-curses) curses="yes"
718 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200719 --disable-curl) curl="no"
720 ;;
Juan Quintela788c8192009-08-12 18:29:47 +0200721 --enable-curl) curl="yes"
722 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +0200723 --disable-fdt) fdt="no"
724 ;;
725 --enable-fdt) fdt="yes"
726 ;;
Luiz Capitulino5495ed12009-08-28 15:27:28 -0300727 --disable-check-utests) check_utests="no"
728 ;;
729 --enable-check-utests) check_utests="yes"
730 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000731 --disable-nptl) nptl="no"
732 ;;
Juan Quintelab0a47e72009-08-12 18:29:49 +0200733 --enable-nptl) nptl="yes"
734 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000735 --enable-mixemu) mixemu="yes"
736 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200737 --disable-linux-aio) linux_aio="no"
738 ;;
739 --enable-linux-aio) linux_aio="yes"
740 ;;
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700741 --disable-attr) attr="no"
742 ;;
743 --enable-attr) attr="yes"
744 ;;
ths77755342008-11-27 15:45:16 +0000745 --disable-blobs) blobs="no"
746 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000747 --with-pkgversion=*) pkgversion=" ($optarg)"
748 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200749 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500750 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200751 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +0200752 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200753 --disable-vhost-net) vhost_net="no"
754 ;;
755 --enable-vhost-net) vhost_net="yes"
756 ;;
Michael Walle20ff0752011-03-07 23:32:39 +0100757 --disable-opengl) opengl="no"
758 ;;
759 --enable-opengl) opengl="yes"
760 ;;
Paolo Bonzini6bde81c2010-05-26 16:08:27 +0200761 --*dir)
762 ;;
Christian Brunnerf27aaf42010-12-06 20:53:01 +0100763 --disable-rbd) rbd="no"
764 ;;
765 --enable-rbd) rbd="yes"
766 ;;
Alon Levy36707142010-10-17 11:40:07 +0200767 --disable-smartcard) smartcard="no"
768 ;;
769 --enable-smartcard) smartcard="yes"
770 ;;
Robert Relyea111a38b2010-11-28 16:36:38 +0200771 --disable-smartcard-nss) smartcard_nss="no"
772 ;;
773 --enable-smartcard-nss) smartcard_nss="yes"
774 ;;
Hans de Goede69354a82011-07-19 11:04:10 +0200775 --disable-usb-redir) usb_redir="no"
776 ;;
777 --enable-usb-redir) usb_redir="yes"
778 ;;
Alon Levy1ece9902011-07-26 12:30:40 +0300779 --disable-zlib-test) zlib="no"
780 ;;
Michael Rothd138cee2011-08-01 14:52:57 -0500781 --enable-guest-agent) guest_agent="yes"
782 ;;
783 --disable-guest-agent) guest_agent="no"
784 ;;
balrog7f1559c2007-11-17 10:24:32 +0000785 *) echo "ERROR: unknown option $opt"; show_help="yes"
786 ;;
bellard7d132992003-03-06 23:23:54 +0000787 esac
788done
789
blueswir131422552007-04-16 18:27:06 +0000790#
791# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
Juan Quintelaa558ee12009-08-03 14:46:21 +0200792# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
blueswir131422552007-04-16 18:27:06 +0000793#
Paul Brook379f6692009-07-17 12:48:08 +0100794host_guest_base="no"
bellard40293e52008-01-31 11:32:10 +0000795case "$cpu" in
Juan Quintelaed968ff2009-08-03 14:46:11 +0200796 sparc) case $sparc_cpu in
797 v7|v8)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200798 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200799 ;;
800 v8plus|v8plusa)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200801 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200802 ;;
803 *) # sparc_cpu not defined in the command line
Juan Quintelaa558ee12009-08-03 14:46:21 +0200804 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200805 esac
806 LDFLAGS="-m32 $LDFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200807 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000808 if test "$solaris" = "no" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200809 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
Juan Quintelac81da562009-08-03 14:46:24 +0200810 helper_cflags="-ffixed-i0"
blueswir1762e8232009-04-04 09:21:28 +0000811 fi
blueswir131422552007-04-16 18:27:06 +0000812 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +0200813 sparc64)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200814 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200815 LDFLAGS="-m64 $LDFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200816 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200817 if test "$solaris" != "no" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200818 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000819 fi
blueswir131422552007-04-16 18:27:06 +0000820 ;;
ths76d83bd2007-11-18 21:22:10 +0000821 s390)
Richard Henderson28d7cc42010-06-04 12:14:09 -0700822 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
823 LDFLAGS="-m31 $LDFLAGS"
Richard Henderson48bb3752010-06-28 19:15:37 -0700824 host_guest_base="yes"
Richard Henderson28d7cc42010-06-04 12:14:09 -0700825 ;;
826 s390x)
827 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
828 LDFLAGS="-m64 $LDFLAGS"
Richard Henderson48bb3752010-06-28 19:15:37 -0700829 host_guest_base="yes"
ths76d83bd2007-11-18 21:22:10 +0000830 ;;
bellard40293e52008-01-31 11:32:10 +0000831 i386)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200832 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200833 LDFLAGS="-m32 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200834 cc_i386='$(CC) -m32'
Juan Quintelac81da562009-08-03 14:46:24 +0200835 helper_cflags="-fomit-frame-pointer"
Paul Brook379f6692009-07-17 12:48:08 +0100836 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000837 ;;
838 x86_64)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200839 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200840 LDFLAGS="-m64 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200841 cc_i386='$(CC) -m32'
Paul Brook379f6692009-07-17 12:48:08 +0100842 host_guest_base="yes"
843 ;;
844 arm*)
845 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000846 ;;
malcf6548c02009-07-18 10:08:40 +0400847 ppc*)
848 host_guest_base="yes"
849 ;;
Aurelien Jarnocc01cc82010-03-27 17:31:04 +0100850 mips*)
851 host_guest_base="yes"
852 ;;
Aurelien Jarno477ba622010-03-29 02:12:51 +0200853 ia64*)
854 host_guest_base="yes"
855 ;;
Richard Hendersonfd76e732010-04-07 04:56:43 -0700856 hppa*)
857 host_guest_base="yes"
858 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +0800859 unicore32*)
860 host_guest_base="yes"
861 ;;
blueswir131422552007-04-16 18:27:06 +0000862esac
863
Paul Brook379f6692009-07-17 12:48:08 +0100864[ -z "$guest_base" ] && guest_base="$host_guest_base"
865
Peter Maydell60e0df22011-05-03 14:50:13 +0100866
867default_target_list=""
868
869# these targets are portable
870if [ "$softmmu" = "yes" ] ; then
871 default_target_list="\
872i386-softmmu \
873x86_64-softmmu \
Richard Henderson27cdad62011-09-20 15:36:24 -0700874alpha-softmmu \
Peter Maydell60e0df22011-05-03 14:50:13 +0100875arm-softmmu \
876cris-softmmu \
877lm32-softmmu \
878m68k-softmmu \
879microblaze-softmmu \
880microblazeel-softmmu \
881mips-softmmu \
882mipsel-softmmu \
883mips64-softmmu \
884mips64el-softmmu \
885ppc-softmmu \
886ppcemb-softmmu \
887ppc64-softmmu \
888sh4-softmmu \
889sh4eb-softmmu \
890sparc-softmmu \
891sparc64-softmmu \
Alexander Graf0f3301d2011-03-23 08:23:47 +0100892s390x-softmmu \
Max Filippovcfa550c2011-09-06 03:55:26 +0400893xtensa-softmmu \
894xtensaeb-softmmu \
Peter Maydell60e0df22011-05-03 14:50:13 +0100895"
896fi
897# the following are Linux specific
898if [ "$linux_user" = "yes" ] ; then
899 default_target_list="${default_target_list}\
900i386-linux-user \
901x86_64-linux-user \
902alpha-linux-user \
903arm-linux-user \
904armeb-linux-user \
905cris-linux-user \
906m68k-linux-user \
907microblaze-linux-user \
908microblazeel-linux-user \
909mips-linux-user \
910mipsel-linux-user \
911ppc-linux-user \
912ppc64-linux-user \
913ppc64abi32-linux-user \
914sh4-linux-user \
915sh4eb-linux-user \
916sparc-linux-user \
917sparc64-linux-user \
918sparc32plus-linux-user \
919unicore32-linux-user \
Alexander Graf0f3301d2011-03-23 08:23:47 +0100920s390x-linux-user \
Peter Maydell60e0df22011-05-03 14:50:13 +0100921"
922fi
923# the following are Darwin specific
924if [ "$darwin_user" = "yes" ] ; then
925 default_target_list="$default_target_list i386-darwin-user ppc-darwin-user "
926fi
927# the following are BSD specific
928if [ "$bsd_user" = "yes" ] ; then
929 default_target_list="${default_target_list}\
930i386-bsd-user \
931x86_64-bsd-user \
932sparc-bsd-user \
933sparc64-bsd-user \
934"
935fi
936
pbrookaf5db582006-04-08 14:26:41 +0000937if test x"$show_help" = x"yes" ; then
938cat << EOF
939
940Usage: configure [options]
941Options: [defaults in brackets after descriptions]
942
943EOF
944echo "Standard options:"
945echo " --help print this message"
946echo " --prefix=PREFIX install in PREFIX [$prefix]"
947echo " --interp-prefix=PREFIX where to find shared libraries, etc."
948echo " use %M for cpu name [$interp_prefix]"
Peter Maydell60e0df22011-05-03 14:50:13 +0100949echo " --target-list=LIST set target list (default: build everything)"
950echo "Available targets: $default_target_list" | \
951 fold -s -w 53 | sed -e 's/^/ /'
pbrookaf5db582006-04-08 14:26:41 +0000952echo ""
pbrookaf5db582006-04-08 14:26:41 +0000953echo "Advanced options (experts only):"
954echo " --source-path=PATH path of source code [$source_path]"
955echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
956echo " --cc=CC use C compiler CC [$cc]"
Paolo Bonzini0bfe8cc2010-05-26 16:08:18 +0200957echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
958echo " build time"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200959echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
Jan Kiszkae3fc14c2009-06-30 21:29:03 +0200960echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000961echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000962echo " --install=INSTALL use specified install [$install]"
Blue Swirlc886edf2011-07-22 21:08:09 +0000963echo " --python=PYTHON use specified python [$python]"
Brade2d88302011-09-02 16:53:28 -0400964echo " --smbd=SMBD use specified smbd [$smbd]"
pbrookaf5db582006-04-08 14:26:41 +0000965echo " --static enable static build [$static]"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200966echo " --mandir=PATH install man pages in PATH"
967echo " --datadir=PATH install firmware in PATH"
968echo " --docdir=PATH install documentation in PATH"
969echo " --bindir=PATH install binaries in PATH"
970echo " --sysconfdir=PATH install config in PATH/qemu"
aurel32f8393942009-04-13 18:45:38 +0000971echo " --enable-debug-tcg enable TCG debugging"
972echo " --disable-debug-tcg disable TCG debugging (default)"
Stefan Weil09695a42009-06-06 16:51:30 +0200973echo " --enable-debug enable common debug build options"
aliguori890b1652008-10-07 21:22:41 +0000974echo " --enable-sparse enable sparse checker"
975echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000976echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000977echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000978echo " --disable-sdl disable SDL"
Juan Quintelac4198152009-08-12 18:29:53 +0200979echo " --enable-sdl enable SDL"
Jes Sorensen821601e2011-03-16 13:33:36 +0100980echo " --disable-vnc disable VNC"
981echo " --enable-vnc enable VNC"
pbrookaf5db582006-04-08 14:26:41 +0000982echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000983echo " --audio-drv-list=LIST set audio drivers list:"
984echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000985echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
986echo " Available cards: $audio_possible_cards"
Markus Armbrustereb852012009-10-27 18:41:44 +0100987echo " --block-drv-whitelist=L set block driver whitelist"
988echo " (affects only QEMU, not qemu-img)"
malc8ff9cbf2008-06-23 18:33:30 +0000989echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000990echo " --disable-xen disable xen backend driver support"
Juan Quintelafc321b42009-08-12 18:29:55 +0200991echo " --enable-xen enable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000992echo " --disable-brlapi disable BrlAPI"
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200993echo " --enable-brlapi enable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000994echo " --disable-vnc-tls disable TLS encryption for VNC server"
Juan Quintela1be10ad2009-08-12 18:20:28 +0200995echo " --enable-vnc-tls enable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000996echo " --disable-vnc-sasl disable SASL encryption for VNC server"
Juan Quintelaea784e32009-08-12 18:20:29 +0200997echo " --enable-vnc-sasl enable SASL encryption for VNC server"
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200998echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
999echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
Corentin Chary96763cf2010-07-07 20:58:06 +02001000echo " --disable-vnc-png disable PNG compression for VNC server (default)"
Corentin Charyefe556a2010-07-07 20:57:56 +02001001echo " --enable-vnc-png enable PNG compression for VNC server"
Corentin Charybd023f92010-07-07 20:58:02 +02001002echo " --disable-vnc-thread disable threaded VNC server"
1003echo " --enable-vnc-thread enable threaded VNC server"
pbrookaf896aa2008-03-23 00:47:42 +00001004echo " --disable-curses disable curses output"
Juan Quintelac584a6d2009-08-12 18:20:30 +02001005echo " --enable-curses enable curses output"
Alexander Graf769ce762009-05-11 17:41:42 +02001006echo " --disable-curl disable curl connectivity"
Juan Quintela788c8192009-08-12 18:29:47 +02001007echo " --enable-curl enable curl connectivity"
Juan Quintela2df87df2009-08-12 18:29:54 +02001008echo " --disable-fdt disable fdt device tree"
1009echo " --enable-fdt enable fdt device tree"
Luiz Capitulino5495ed12009-08-28 15:27:28 -03001010echo " --disable-check-utests disable check unit-tests"
1011echo " --enable-check-utests enable check unit-tests"
balrogfb599c92008-09-28 23:49:55 +00001012echo " --disable-bluez disable bluez stack connectivity"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001013echo " --enable-bluez enable bluez stack connectivity"
Peter Maydell6093d3d2011-05-23 10:13:47 +01001014echo " --disable-slirp disable SLIRP userspace network connectivity"
aliguori7ba1e612008-11-05 16:04:33 +00001015echo " --disable-kvm disable KVM acceleration support"
Juan Quintelab31a0272009-08-12 18:29:56 +02001016echo " --enable-kvm enable KVM acceleration support"
Stefan Weil9195b2c2011-10-19 07:07:18 +02001017echo " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
pbrookbd0c5662008-05-29 14:34:11 +00001018echo " --disable-nptl disable usermode NPTL support"
Andre Przywarae5934d32009-09-16 14:29:07 +02001019echo " --enable-nptl enable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +00001020echo " --enable-system enable all system emulation targets"
1021echo " --disable-system disable all system emulation targets"
Zachary Amsden0953a802009-07-30 00:14:59 -10001022echo " --enable-user enable supported user emulation targets"
1023echo " --disable-user disable all user emulation targets"
ths831b7822007-01-18 20:06:33 +00001024echo " --enable-linux-user enable all linux usermode emulation targets"
1025echo " --disable-linux-user disable all linux usermode emulation targets"
1026echo " --enable-darwin-user enable all darwin usermode emulation targets"
1027echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +00001028echo " --enable-bsd-user enable all BSD usermode emulation targets"
1029echo " --disable-bsd-user disable all BSD usermode emulation targets"
Paul Brook379f6692009-07-17 12:48:08 +01001030echo " --enable-guest-base enable GUEST_BASE support for usermode"
1031echo " emulation targets"
1032echo " --disable-guest-base disable GUEST_BASE support"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03001033echo " --enable-user-pie build usermode emulation targets as PIE"
1034echo " --disable-user-pie do not build usermode emulation targets as PIE"
pbrookaf5db582006-04-08 14:26:41 +00001035echo " --fmod-lib path to FMOD library"
1036echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +00001037echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +00001038echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +00001039echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
Stefan Weilee682d22009-10-01 20:10:37 +02001040echo " --disable-uuid disable uuid support"
1041echo " --enable-uuid enable uuid support"
aliguorie0e6c8c02008-07-23 18:14:33 +00001042echo " --disable-vde disable support for vde network"
Juan Quinteladfb278b2009-08-12 18:20:27 +02001043echo " --enable-vde enable support for vde network"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001044echo " --disable-linux-aio disable Linux AIO support"
1045echo " --enable-linux-aio enable Linux AIO support"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07001046echo " --disable-attr disables attr and xattr support"
1047echo " --enable-attr enable attr and xattr support"
ths77755342008-11-27 15:45:16 +00001048echo " --disable-blobs disable installing provided firmware blobs"
Dirk Ullrichd2807bc2010-02-06 09:48:23 +01001049echo " --enable-docs enable documentation build"
1050echo " --disable-docs disable documentation build"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02001051echo " --disable-vhost-net disable vhost-net acceleration support"
1052echo " --enable-vhost-net enable vhost-net acceleration support"
Fabien Chouteau320fba22011-01-27 10:24:41 +01001053echo " --enable-trace-backend=B Set trace backend"
1054echo " Available backends:" $("$source_path"/scripts/tracetool --list-backends)
Paolo Bonzini74242e02010-12-23 11:44:02 +01001055echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
Prerna Saxena9410b562010-07-13 09:26:32 +01001056echo " Default:trace-<pid>"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01001057echo " --disable-spice disable spice"
1058echo " --enable-spice enable spice"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01001059echo " --enable-rbd enable building the rados block device (rbd)"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11001060echo " --disable-libiscsi disable iscsi support"
1061echo " --enable-libiscsi enable iscsi support"
Alon Levy36707142010-10-17 11:40:07 +02001062echo " --disable-smartcard disable smartcard support"
1063echo " --enable-smartcard enable smartcard support"
Robert Relyea111a38b2010-11-28 16:36:38 +02001064echo " --disable-smartcard-nss disable smartcard nss support"
1065echo " --enable-smartcard-nss enable smartcard nss support"
Hans de Goede69354a82011-07-19 11:04:10 +02001066echo " --disable-usb-redir disable usb network redirection support"
1067echo " --enable-usb-redir enable usb network redirection support"
Michael Rothd138cee2011-08-01 14:52:57 -05001068echo " --disable-guest-agent disable building of the QEMU Guest Agent"
1069echo " --enable-guest-agent enable building of the QEMU Guest Agent"
pbrookaf5db582006-04-08 14:26:41 +00001070echo ""
ths5bf08932006-12-23 00:33:26 +00001071echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +00001072exit 1
1073fi
1074
Paolo Bonzini8d050952010-12-23 11:43:52 +01001075# check that the C compiler works.
1076cat > $TMPC <<EOF
1077int main(void) {}
1078EOF
1079
1080if compile_object ; then
1081 : C compiler works ok
1082else
1083 echo "ERROR: \"$cc\" either does not exist or does not work"
1084 exit 1
1085fi
1086
1087gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1088gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1089gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
Mike Frysingerf9188222011-05-17 17:08:43 -04001090gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
Paolo Bonzini8d050952010-12-23 11:43:52 +01001091cat > $TMPC << EOF
1092int main(void) { return 0; }
1093EOF
1094for flag in $gcc_flags; do
Stefan Weilaf2d37d2011-09-04 18:30:02 +02001095 if compile_prog "$flag -Werror" "" ; then
Paolo Bonzini8d050952010-12-23 11:43:52 +01001096 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1097 fi
1098done
1099
bellardec530c82006-04-25 22:36:06 +00001100#
1101# Solaris specific configure tool chain decisions
1102#
1103if test "$solaris" = "yes" ; then
Loïc Minier6792aa12010-01-20 11:35:54 +01001104 if has $install; then
1105 :
1106 else
bellardec530c82006-04-25 22:36:06 +00001107 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1108 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1109 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1110 exit 1
1111 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001112 if test "`path_of $install`" = "/usr/sbin/install" ; then
bellardec530c82006-04-25 22:36:06 +00001113 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1114 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1115 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1116 exit 1
1117 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001118 if has ar; then
1119 :
1120 else
bellardec530c82006-04-25 22:36:06 +00001121 echo "Error: No path includes ar"
1122 if test -f /usr/ccs/bin/ar ; then
1123 echo "Add /usr/ccs/bin to your path and rerun configure"
1124 fi
1125 exit 1
1126 fi
ths5fafdf22007-09-16 21:08:06 +00001127fi
bellardec530c82006-04-25 22:36:06 +00001128
Michael Rothd138cee2011-08-01 14:52:57 -05001129if test "$guest_agent" != "no" ; then
1130 if has $python; then
1131 :
1132 else
1133 echo "Python not found. Use --python=/path/to/python"
1134 exit 1
1135 fi
Blue Swirlc886edf2011-07-22 21:08:09 +00001136fi
1137
bellard5327cf42005-01-10 23:18:50 +00001138if test -z "$target_list" ; then
Peter Maydell60e0df22011-05-03 14:50:13 +01001139 target_list="$default_target_list"
bellard6e20a452005-06-05 15:56:02 +00001140else
pbrookb1a550a2006-04-16 13:28:56 +00001141 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +00001142fi
pbrook0a8e90f2006-03-19 14:54:16 +00001143if test -z "$target_list" ; then
1144 echo "No targets enabled"
1145 exit 1
1146fi
Paolo Bonzinif55fe272010-05-26 16:08:17 +02001147# see if system emulation was really requested
1148case " $target_list " in
1149 *"-softmmu "*) softmmu=yes
1150 ;;
1151 *) softmmu=no
1152 ;;
1153esac
bellard5327cf42005-01-10 23:18:50 +00001154
Juan Quintela249247c2009-08-12 18:20:25 +02001155feature_not_found() {
1156 feature=$1
1157
1158 echo "ERROR"
1159 echo "ERROR: User requested feature $feature"
Sebastian Herbszt9332f6a2009-09-13 21:32:54 +02001160 echo "ERROR: configure was not able to find it"
Juan Quintela249247c2009-08-12 18:20:25 +02001161 echo "ERROR"
1162 exit 1;
1163}
1164
bellard7d132992003-03-06 23:23:54 +00001165if test -z "$cross_prefix" ; then
1166
1167# ---
1168# big/little endian test
1169cat > $TMPC << EOF
1170#include <inttypes.h>
1171int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +00001172 volatile uint32_t i=0x01234567;
1173 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +00001174}
1175EOF
1176
Juan Quintela52166aa2009-08-03 14:46:03 +02001177if compile_prog "" "" ; then
bellard7d132992003-03-06 23:23:54 +00001178$TMPE && bigendian="yes"
1179else
1180echo big/little test failed
1181fi
1182
1183else
1184
1185# if cross compiling, cannot launch a program, so make a static guess
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001186case "$cpu" in
Alexander Graf24e804ec2009-12-05 12:44:22 +01001187 armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001188 bigendian=yes
1189 ;;
1190esac
bellard7d132992003-03-06 23:23:54 +00001191
1192fi
1193
Paolo Bonzini70be1a22010-12-23 11:43:54 +01001194# host long bits test, actually a pointer size test
1195cat > $TMPC << EOF
1196int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
1197EOF
1198if compile_object; then
1199hostlongbits=64
1200else
1201hostlongbits=32
1202fi
bellardb6853692005-06-05 17:10:39 +00001203
Juan Quintelab0a47e72009-08-12 18:29:49 +02001204
1205##########################################
1206# NPTL probe
1207
1208if test "$nptl" != "no" ; then
1209 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00001210#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00001211#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +00001212void foo()
1213{
1214#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1215#error bork
1216#endif
1217}
1218EOF
1219
Juan Quintelab0a47e72009-08-12 18:29:49 +02001220 if compile_object ; then
1221 nptl=yes
1222 else
1223 if test "$nptl" = "yes" ; then
1224 feature_not_found "nptl"
1225 fi
1226 nptl=no
1227 fi
pbrookbd0c5662008-05-29 14:34:11 +00001228fi
1229
bellard11d9f692004-04-02 20:55:59 +00001230##########################################
balrogac629222008-10-11 09:56:04 +00001231# zlib check
1232
Alon Levy1ece9902011-07-26 12:30:40 +03001233if test "$zlib" != "no" ; then
1234 cat > $TMPC << EOF
balrogac629222008-10-11 09:56:04 +00001235#include <zlib.h>
1236int main(void) { zlibVersion(); return 0; }
1237EOF
Alon Levy1ece9902011-07-26 12:30:40 +03001238 if compile_prog "" "-lz" ; then
1239 :
1240 else
1241 echo
1242 echo "Error: zlib check failed"
1243 echo "Make sure to have the zlib libs and headers installed."
1244 echo
1245 exit 1
1246 fi
balrogac629222008-10-11 09:56:04 +00001247fi
1248
1249##########################################
aliguorie37630c2009-04-22 15:19:10 +00001250# xen probe
1251
Juan Quintelafc321b42009-08-12 18:29:55 +02001252if test "$xen" != "no" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +02001253 xen_libs="-lxenstore -lxenctrl -lxenguest"
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001254
1255 # Xen unstable
Juan Quintelab2266be2009-07-27 16:13:16 +02001256 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00001257#include <xenctrl.h>
1258#include <xs.h>
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001259#include <stdint.h>
1260#include <xen/hvm/hvm_info_table.h>
1261#if !defined(HVM_MAX_VCPUS)
1262# error HVM_MAX_VCPUS not defined
1263#endif
1264int main(void) {
1265 xc_interface *xc;
1266 xs_daemon_open();
1267 xc = xc_interface_open(0, 0, 0);
1268 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1269 xc_gnttab_open(NULL, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001270 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001271 return 0;
1272}
aliguorie37630c2009-04-22 15:19:10 +00001273EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001274 if compile_prog "" "$xen_libs" ; then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001275 xen_ctrl_version=410
Juan Quintelafc321b42009-08-12 18:29:55 +02001276 xen=yes
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001277
1278 # Xen 4.0.0
1279 elif (
1280 cat > $TMPC <<EOF
1281#include <xenctrl.h>
1282#include <xs.h>
1283#include <stdint.h>
1284#include <xen/hvm/hvm_info_table.h>
1285#if !defined(HVM_MAX_VCPUS)
1286# error HVM_MAX_VCPUS not defined
1287#endif
1288int main(void) {
Anthony PERARDb87de242011-05-24 14:34:20 +01001289 struct xen_add_to_physmap xatp = {
1290 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1291 };
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001292 xs_daemon_open();
1293 xc_interface_open();
1294 xc_gnttab_open();
1295 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001296 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001297 return 0;
1298}
1299EOF
1300 compile_prog "" "$xen_libs"
1301 ) ; then
1302 xen_ctrl_version=400
1303 xen=yes
1304
Anthony PERARDb87de242011-05-24 14:34:20 +01001305 # Xen 3.4.0
1306 elif (
1307 cat > $TMPC <<EOF
1308#include <xenctrl.h>
1309#include <xs.h>
1310int main(void) {
1311 struct xen_add_to_physmap xatp = {
1312 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1313 };
1314 xs_daemon_open();
1315 xc_interface_open();
1316 xc_gnttab_open();
1317 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1318 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1319 return 0;
1320}
1321EOF
1322 compile_prog "" "$xen_libs"
1323 ) ; then
1324 xen_ctrl_version=340
1325 xen=yes
1326
1327 # Xen 3.3.0
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001328 elif (
1329 cat > $TMPC <<EOF
1330#include <xenctrl.h>
1331#include <xs.h>
1332int main(void) {
1333 xs_daemon_open();
1334 xc_interface_open();
1335 xc_gnttab_open();
1336 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1337 return 0;
1338}
1339EOF
1340 compile_prog "" "$xen_libs"
1341 ) ; then
1342 xen_ctrl_version=330
1343 xen=yes
1344
1345 # Xen not found or unsupported
Juan Quintelab2266be2009-07-27 16:13:16 +02001346 else
Juan Quintelafc321b42009-08-12 18:29:55 +02001347 if test "$xen" = "yes" ; then
1348 feature_not_found "xen"
1349 fi
1350 xen=no
Juan Quintelab2266be2009-07-27 16:13:16 +02001351 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001352
1353 if test "$xen" = yes; then
1354 libs_softmmu="$xen_libs $libs_softmmu"
1355 fi
aliguorie37630c2009-04-22 15:19:10 +00001356fi
1357
1358##########################################
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001359# pkg-config probe
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001360
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001361if ! has $pkg_config; then
Peter Maydella213fcb2011-09-15 12:15:56 +01001362 echo "Error: pkg-config binary '$pkg_config' not found"
1363 exit 1
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001364fi
1365
1366##########################################
Alon Levy44dc0ca2011-05-15 11:51:28 +03001367# libtool probe
1368
Brad3f534582011-08-13 20:30:14 -04001369if ! has $libtool; then
Alon Levy44dc0ca2011-05-15 11:51:28 +03001370 libtool=
Alon Levy44dc0ca2011-05-15 11:51:28 +03001371fi
1372
1373##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02001374# Sparse probe
1375if test "$sparse" != "no" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001376 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02001377 sparse=yes
1378 else
1379 if test "$sparse" = "yes" ; then
1380 feature_not_found "sparse"
1381 fi
1382 sparse=no
1383 fi
1384fi
1385
1386##########################################
bellard11d9f692004-04-02 20:55:59 +00001387# SDL probe
1388
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001389# Look for sdl configuration program (pkg-config or sdl-config). Try
1390# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1391if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1392 sdl_config=sdl-config
1393fi
1394
1395if $pkg_config sdl --modversion >/dev/null 2>&1; then
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001396 sdlconfig="$pkg_config sdl"
Stefan Weilfec0e3e2010-04-11 18:44:18 +02001397 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001398elif has ${sdl_config}; then
1399 sdlconfig="$sdl_config"
Paolo Bonzini9316f802010-01-13 09:52:55 +01001400 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00001401else
1402 if test "$sdl" = "yes" ; then
1403 feature_not_found "sdl"
1404 fi
1405 sdl=no
Paolo Bonzini9316f802010-01-13 09:52:55 +01001406fi
Scott Wood29e5bad2011-04-08 14:15:50 -05001407if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001408 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1409fi
bellard11d9f692004-04-02 20:55:59 +00001410
Paolo Bonzini9316f802010-01-13 09:52:55 +01001411sdl_too_old=no
Juan Quintelac4198152009-08-12 18:29:53 +02001412if test "$sdl" != "no" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001413 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00001414#include <SDL.h>
1415#undef main /* We don't want SDL to override our main() */
1416int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1417EOF
Paolo Bonzini9316f802010-01-13 09:52:55 +01001418 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
TeLeMan74f42e12010-02-08 13:56:44 +08001419 if test "$static" = "yes" ; then
1420 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1421 else
1422 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1423 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001424 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001425 if test "$_sdlversion" -lt 121 ; then
1426 sdl_too_old=yes
1427 else
1428 if test "$cocoa" = "no" ; then
1429 sdl=yes
1430 fi
1431 fi
aliguoricd01b4a2008-08-21 19:25:45 +00001432
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001433 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Juan Quintelaac119f92009-07-27 16:13:15 +02001434 if test "$sdl" = "yes" -a "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001435 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weilf8aa6c72010-03-01 22:10:46 +01001436 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1437 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
Juan Quintelaac119f92009-07-27 16:13:15 +02001438 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001439 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001440 :
1441 else
1442 sdl=no
1443 fi
1444 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02001445 else # sdl not found
1446 if test "$sdl" = "yes" ; then
1447 feature_not_found "sdl"
1448 fi
1449 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02001450 fi # sdl compile test
Juan Quintelaa68551b2009-07-27 16:13:09 +02001451fi
bellard11d9f692004-04-02 20:55:59 +00001452
aliguori5368a422009-03-03 17:37:21 +00001453if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001454 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00001455#include <SDL.h>
1456#if defined(SDL_VIDEO_DRIVER_X11)
1457#include <X11/XKBlib.h>
1458#else
1459#error No x11 support
1460#endif
1461int main(void) { return 0; }
1462EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001463 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001464 sdl_libs="$sdl_libs -lX11"
1465 fi
Juan Quintela07d9ac42009-08-03 14:46:25 +02001466 if test "$mingw32" = "yes" ; then
1467 sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1468 fi
Juan Quintela07056672009-08-03 14:46:27 +02001469 libs_softmmu="$sdl_libs $libs_softmmu"
aliguori5368a422009-03-03 17:37:21 +00001470fi
1471
ths8f28f3f2007-01-05 21:25:54 +00001472##########################################
ths8d5d2d42007-08-25 01:37:51 +00001473# VNC TLS detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001474if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
Juan Quintela1be10ad2009-08-12 18:20:28 +02001475 cat > $TMPC <<EOF
aliguoriae6b5e52008-08-06 16:55:50 +00001476#include <gnutls/gnutls.h>
1477int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1478EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001479 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1480 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
Juan Quintela1be10ad2009-08-12 18:20:28 +02001481 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1482 vnc_tls=yes
1483 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1484 else
1485 if test "$vnc_tls" = "yes" ; then
1486 feature_not_found "vnc-tls"
aliguoriae6b5e52008-08-06 16:55:50 +00001487 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02001488 vnc_tls=no
1489 fi
ths8d5d2d42007-08-25 01:37:51 +00001490fi
1491
1492##########################################
aliguori2f9606b2009-03-06 20:27:28 +00001493# VNC SASL detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001494if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02001495 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00001496#include <sasl/sasl.h>
1497#include <stdio.h>
1498int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1499EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02001500 # Assuming Cyrus-SASL installed in /usr prefix
1501 vnc_sasl_cflags=""
1502 vnc_sasl_libs="-lsasl2"
1503 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1504 vnc_sasl=yes
1505 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1506 else
1507 if test "$vnc_sasl" = "yes" ; then
1508 feature_not_found "vnc-sasl"
aliguori2f9606b2009-03-06 20:27:28 +00001509 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02001510 vnc_sasl=no
1511 fi
aliguori2f9606b2009-03-06 20:27:28 +00001512fi
1513
1514##########################################
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001515# VNC JPEG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001516if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001517cat > $TMPC <<EOF
1518#include <stdio.h>
1519#include <jpeglib.h>
1520int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1521EOF
1522 vnc_jpeg_cflags=""
1523 vnc_jpeg_libs="-ljpeg"
1524 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1525 vnc_jpeg=yes
1526 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1527 else
1528 if test "$vnc_jpeg" = "yes" ; then
1529 feature_not_found "vnc-jpeg"
1530 fi
1531 vnc_jpeg=no
1532 fi
1533fi
1534
1535##########################################
Corentin Charyefe556a2010-07-07 20:57:56 +02001536# VNC PNG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001537if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02001538cat > $TMPC <<EOF
1539//#include <stdio.h>
1540#include <png.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05001541#include <stddef.h>
Corentin Charyefe556a2010-07-07 20:57:56 +02001542int main(void) {
1543 png_structp png_ptr;
1544 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1545 return 0;
1546}
1547EOF
Brad9af80252011-07-30 01:45:55 -04001548 if $pkg_config libpng --modversion >/dev/null 2>&1; then
1549 vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
1550 vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
1551 else
Corentin Charyefe556a2010-07-07 20:57:56 +02001552 vnc_png_cflags=""
1553 vnc_png_libs="-lpng"
Brad9af80252011-07-30 01:45:55 -04001554 fi
Corentin Charyefe556a2010-07-07 20:57:56 +02001555 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1556 vnc_png=yes
1557 libs_softmmu="$vnc_png_libs $libs_softmmu"
Brad9af80252011-07-30 01:45:55 -04001558 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
Corentin Charyefe556a2010-07-07 20:57:56 +02001559 else
1560 if test "$vnc_png" = "yes" ; then
1561 feature_not_found "vnc-png"
1562 fi
1563 vnc_png=no
1564 fi
1565fi
1566
1567##########################################
aliguori76655d62009-03-06 20:27:37 +00001568# fnmatch() probe, used for ACL routines
1569fnmatch="no"
1570cat > $TMPC << EOF
1571#include <fnmatch.h>
1572int main(void)
1573{
1574 fnmatch("foo", "foo", 0);
1575 return 0;
1576}
1577EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001578if compile_prog "" "" ; then
aliguori76655d62009-03-06 20:27:37 +00001579 fnmatch="yes"
1580fi
1581
1582##########################################
Stefan Weilee682d22009-10-01 20:10:37 +02001583# uuid_generate() probe, used for vdi block driver
1584if test "$uuid" != "no" ; then
1585 uuid_libs="-luuid"
1586 cat > $TMPC << EOF
1587#include <uuid/uuid.h>
1588int main(void)
1589{
1590 uuid_t my_uuid;
1591 uuid_generate(my_uuid);
1592 return 0;
1593}
1594EOF
1595 if compile_prog "" "$uuid_libs" ; then
1596 uuid="yes"
1597 libs_softmmu="$uuid_libs $libs_softmmu"
1598 libs_tools="$uuid_libs $libs_tools"
1599 else
1600 if test "$uuid" = "yes" ; then
1601 feature_not_found "uuid"
1602 fi
1603 uuid=no
1604 fi
1605fi
1606
1607##########################################
Christoph Hellwigdce512d2010-12-17 11:41:15 +01001608# xfsctl() probe, used for raw-posix
1609if test "$xfs" != "no" ; then
1610 cat > $TMPC << EOF
1611#include <xfs/xfs.h>
1612int main(void)
1613{
1614 xfsctl(NULL, 0, 0, NULL);
1615 return 0;
1616}
1617EOF
1618 if compile_prog "" "" ; then
1619 xfs="yes"
1620 else
1621 if test "$xfs" = "yes" ; then
1622 feature_not_found "xfs"
1623 fi
1624 xfs=no
1625 fi
1626fi
1627
1628##########################################
ths8a16d272008-07-19 09:56:24 +00001629# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02001630if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02001631 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00001632 cat > $TMPC << EOF
1633#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00001634int main(void)
1635{
1636 struct vde_open_args a = {0, 0, 0};
1637 vde_open("", "", &a);
1638 return 0;
1639}
ths8a16d272008-07-19 09:56:24 +00001640EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001641 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02001642 vde=yes
Juan Quintela8e02e542009-08-03 14:47:07 +02001643 libs_softmmu="$vde_libs $libs_softmmu"
1644 libs_tools="$vde_libs $libs_tools"
Juan Quinteladfb278b2009-08-12 18:20:27 +02001645 else
1646 if test "$vde" = "yes" ; then
1647 feature_not_found "vde"
1648 fi
1649 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02001650 fi
ths8a16d272008-07-19 09:56:24 +00001651fi
1652
1653##########################################
malcc2de5c92008-06-28 19:13:06 +00001654# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00001655
malcc2de5c92008-06-28 19:13:06 +00001656audio_drv_probe()
1657{
1658 drv=$1
1659 hdr=$2
1660 lib=$3
1661 exp=$4
1662 cfl=$5
1663 cat > $TMPC << EOF
1664#include <$hdr>
1665int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00001666EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001667 if compile_prog "$cfl" "$lib" ; then
malcc2de5c92008-06-28 19:13:06 +00001668 :
1669 else
1670 echo
1671 echo "Error: $drv check failed"
1672 echo "Make sure to have the $drv libs and headers installed."
1673 echo
1674 exit 1
1675 fi
1676}
1677
malc2fa7d3b2008-07-29 12:58:44 +00001678audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00001679for drv in $audio_drv_list; do
1680 case $drv in
1681 alsa)
1682 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1683 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001684 libs_softmmu="-lasound $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00001685 ;;
1686
1687 fmod)
1688 if test -z $fmod_lib || test -z $fmod_inc; then
1689 echo
1690 echo "Error: You must specify path to FMOD library and headers"
1691 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1692 echo
1693 exit 1
1694 fi
1695 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001696 libs_softmmu="$fmod_lib $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00001697 ;;
1698
1699 esd)
1700 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001701 libs_softmmu="-lesd $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02001702 audio_pt_int="yes"
malcc2de5c92008-06-28 19:13:06 +00001703 ;;
malcb8e59f12008-07-02 21:03:08 +00001704
1705 pa)
Aurelien Jarno493abda2009-11-16 17:52:03 +01001706 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
Marc-Antoine Perennou20fa53e2011-04-29 05:59:19 +00001707 "pa_simple *s = 0; pa_simple_free(s); return 0;"
Aurelien Jarno493abda2009-11-16 17:52:03 +01001708 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02001709 audio_pt_int="yes"
malcb8e59f12008-07-02 21:03:08 +00001710 ;;
1711
Juan Quintela997e6902009-08-03 14:46:29 +02001712 coreaudio)
1713 libs_softmmu="-framework CoreAudio $libs_softmmu"
1714 ;;
1715
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001716 dsound)
1717 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
malcd5631632009-10-10 01:13:41 +04001718 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001719 ;;
1720
1721 oss)
1722 libs_softmmu="$oss_lib $libs_softmmu"
1723 ;;
1724
1725 sdl|wav)
blueswir12f6a1ab2008-08-21 18:00:53 +00001726 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1727 ;;
1728
malcd5631632009-10-10 01:13:41 +04001729 winwave)
1730 libs_softmmu="-lwinmm $libs_softmmu"
1731 audio_win_int="yes"
1732 ;;
1733
malce4c63a62008-07-19 16:15:16 +00001734 *)
malc1c9b2a52008-07-19 16:57:30 +00001735 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001736 echo
1737 echo "Error: Unknown driver '$drv' selected"
1738 echo "Possible drivers are: $audio_possible_drivers"
1739 echo
1740 exit 1
1741 }
1742 ;;
malcc2de5c92008-06-28 19:13:06 +00001743 esac
1744done
ths8f28f3f2007-01-05 21:25:54 +00001745
balrog4d3b6f62008-02-10 16:33:14 +00001746##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001747# BrlAPI probe
1748
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001749if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001750 brlapi_libs="-lbrlapi"
1751 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00001752#include <brlapi.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05001753#include <stddef.h>
aurel322e4d9fb2008-04-08 06:01:02 +00001754int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1755EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001756 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001757 brlapi=yes
Juan Quintela264606b2009-08-03 14:46:39 +02001758 libs_softmmu="$brlapi_libs $libs_softmmu"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001759 else
1760 if test "$brlapi" = "yes" ; then
1761 feature_not_found "brlapi"
1762 fi
1763 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02001764 fi
1765fi
aurel322e4d9fb2008-04-08 06:01:02 +00001766
1767##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001768# curses probe
Stefan Weile095e2f2011-02-27 20:23:30 +01001769if test "$mingw32" = "yes" ; then
1770 curses_list="-lpdcurses"
1771else
1772 curses_list="-lncurses -lcurses"
1773fi
balrog4d3b6f62008-02-10 16:33:14 +00001774
Juan Quintelac584a6d2009-08-12 18:20:30 +02001775if test "$curses" != "no" ; then
1776 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00001777 cat > $TMPC << EOF
1778#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001779#ifdef __OpenBSD__
1780#define resize_term resizeterm
1781#endif
1782int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001783EOF
Juan Quintela4f78ef92009-08-12 18:20:23 +02001784 for curses_lib in $curses_list; do
1785 if compile_prog "" "$curses_lib" ; then
Juan Quintelac584a6d2009-08-12 18:20:30 +02001786 curses_found=yes
Juan Quintela4f78ef92009-08-12 18:20:23 +02001787 libs_softmmu="$curses_lib $libs_softmmu"
1788 break
1789 fi
1790 done
Juan Quintelac584a6d2009-08-12 18:20:30 +02001791 if test "$curses_found" = "yes" ; then
1792 curses=yes
1793 else
1794 if test "$curses" = "yes" ; then
1795 feature_not_found "curses"
1796 fi
1797 curses=no
1798 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02001799fi
balrog4d3b6f62008-02-10 16:33:14 +00001800
blueswir1414f0da2008-08-15 18:20:52 +00001801##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001802# curl probe
1803
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001804if $pkg_config libcurl --modversion >/dev/null 2>&1; then
1805 curlconfig="$pkg_config libcurl"
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01001806else
1807 curlconfig=curl-config
1808fi
1809
Juan Quintela788c8192009-08-12 18:29:47 +02001810if test "$curl" != "no" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001811 cat > $TMPC << EOF
1812#include <curl/curl.h>
Peter Maydell0b862ce2011-06-09 22:54:29 +01001813int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
Alexander Graf769ce762009-05-11 17:41:42 +02001814EOF
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01001815 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1816 curl_libs=`$curlconfig --libs 2>/dev/null`
Juan Quintelab1d5a272009-08-03 14:46:05 +02001817 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001818 curl=yes
Juan Quintelaf0302932009-08-03 14:47:08 +02001819 libs_tools="$curl_libs $libs_tools"
1820 libs_softmmu="$curl_libs $libs_softmmu"
Juan Quintela788c8192009-08-12 18:29:47 +02001821 else
1822 if test "$curl" = "yes" ; then
1823 feature_not_found "curl"
1824 fi
1825 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02001826 fi
1827fi # test "$curl"
1828
1829##########################################
Luiz Capitulino5495ed12009-08-28 15:27:28 -03001830# check framework probe
1831
1832if test "$check_utests" != "no" ; then
1833 cat > $TMPC << EOF
1834#include <check.h>
1835int main(void) { suite_create("qemu test"); return 0; }
1836EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001837 check_libs=`$pkg_config --libs check`
Luiz Capitulino5495ed12009-08-28 15:27:28 -03001838 if compile_prog "" $check_libs ; then
1839 check_utests=yes
1840 libs_tools="$check_libs $libs_tools"
1841 else
1842 if test "$check_utests" = "yes" ; then
1843 feature_not_found "check"
1844 fi
1845 check_utests=no
1846 fi
1847fi # test "$check_utests"
1848
1849##########################################
balrogfb599c92008-09-28 23:49:55 +00001850# bluez support probe
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001851if test "$bluez" != "no" ; then
balroge820e3f2008-09-30 02:27:44 +00001852 cat > $TMPC << EOF
1853#include <bluetooth/bluetooth.h>
1854int main(void) { return bt_error(0); }
1855EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001856 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1857 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +02001858 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001859 bluez=yes
Juan Quintelae482d562009-08-03 14:46:37 +02001860 libs_softmmu="$bluez_libs $libs_softmmu"
balroge820e3f2008-09-30 02:27:44 +00001861 else
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001862 if test "$bluez" = "yes" ; then
1863 feature_not_found "bluez"
1864 fi
balroge820e3f2008-09-30 02:27:44 +00001865 bluez="no"
1866 fi
balrogfb599c92008-09-28 23:49:55 +00001867fi
1868
1869##########################################
Anthony Liguorie18df142011-07-19 14:50:29 -05001870# glib support probe
Stefan Hajnoczi4b76a482011-08-08 13:04:05 +05301871if $pkg_config --modversion gthread-2.0 > /dev/null 2>&1 ; then
1872 glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
1873 glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
Anthony Liguori14015302011-08-20 22:18:37 -05001874 LIBS="$glib_libs $LIBS"
Michael Roth957f1f92011-08-11 15:38:12 -05001875 libs_qga="$glib_libs $libs_qga"
Stefan Hajnoczi4b76a482011-08-08 13:04:05 +05301876else
1877 echo "glib-2.0 required to compile QEMU"
1878 exit 1
Anthony Liguorie18df142011-07-19 14:50:29 -05001879fi
1880
1881##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001882# pthread probe
Brad4b29ec42011-08-07 20:02:11 -04001883PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00001884
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02001885pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00001886cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001887#include <pthread.h>
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001888int main(void) { pthread_create(0,0,0,0); return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001889EOF
Andreas Färberbd00d532010-09-20 00:50:44 +02001890if compile_prog "" "" ; then
1891 pthread=yes
1892else
1893 for pthread_lib in $PTHREADLIBS_LIST; do
1894 if compile_prog "" "$pthread_lib" ; then
1895 pthread=yes
1896 LIBS="$pthread_lib $LIBS"
1897 break
1898 fi
1899 done
1900fi
blueswir1414f0da2008-08-15 18:20:52 +00001901
Anthony Liguori4617e592009-08-25 17:21:56 -05001902if test "$mingw32" != yes -a "$pthread" = no; then
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02001903 echo
1904 echo "Error: pthread check failed"
1905 echo "Make sure to have the pthread libs and headers installed."
1906 echo
1907 exit 1
aliguorie5d355d2009-04-24 18:03:15 +00001908fi
1909
aliguoribf9298b2008-12-05 20:05:26 +00001910##########################################
Christian Brunnerf27aaf42010-12-06 20:53:01 +01001911# rbd probe
1912if test "$rbd" != "no" ; then
1913 cat > $TMPC <<EOF
1914#include <stdio.h>
Josh Durginad32e9c2011-05-26 16:07:31 -07001915#include <rbd/librbd.h>
Christian Brunnerf27aaf42010-12-06 20:53:01 +01001916int main(void) {
Josh Durginad32e9c2011-05-26 16:07:31 -07001917 rados_t cluster;
1918 rados_create(&cluster, NULL);
Christian Brunnerf27aaf42010-12-06 20:53:01 +01001919 return 0;
1920}
1921EOF
Josh Durginad32e9c2011-05-26 16:07:31 -07001922 rbd_libs="-lrbd -lrados"
1923 if compile_prog "" "$rbd_libs" ; then
1924 rbd=yes
1925 libs_tools="$rbd_libs $libs_tools"
1926 libs_softmmu="$rbd_libs $libs_softmmu"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01001927 else
1928 if test "$rbd" = "yes" ; then
1929 feature_not_found "rados block device"
1930 fi
1931 rbd=no
1932 fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01001933fi
1934
1935##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001936# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001937
1938if test "$linux_aio" != "no" ; then
1939 cat > $TMPC <<EOF
1940#include <libaio.h>
1941#include <sys/eventfd.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05001942#include <stddef.h>
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001943int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1944EOF
1945 if compile_prog "" "-laio" ; then
1946 linux_aio=yes
Paul Brook048d1792010-05-05 16:32:59 +01001947 libs_softmmu="$libs_softmmu -laio"
1948 libs_tools="$libs_tools -laio"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001949 else
1950 if test "$linux_aio" = "yes" ; then
1951 feature_not_found "linux AIO"
1952 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03001953 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001954 fi
1955fi
1956
1957##########################################
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07001958# attr probe
1959
1960if test "$attr" != "no" ; then
1961 cat > $TMPC <<EOF
1962#include <stdio.h>
1963#include <sys/types.h>
1964#include <attr/xattr.h>
1965int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1966EOF
1967 if compile_prog "" "-lattr" ; then
1968 attr=yes
1969 LIBS="-lattr $LIBS"
1970 else
1971 if test "$attr" = "yes" ; then
1972 feature_not_found "ATTR"
1973 fi
1974 attr=no
1975 fi
1976fi
1977
1978##########################################
aliguoribf9298b2008-12-05 20:05:26 +00001979# iovec probe
1980cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001981#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001982#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001983#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001984int main(void) { struct iovec iov; return 0; }
1985EOF
1986iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02001987if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00001988 iovec=yes
1989fi
1990
aurel32f652e6a2008-12-16 10:43:48 +00001991##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001992# preadv probe
1993cat > $TMPC <<EOF
1994#include <sys/types.h>
1995#include <sys/uio.h>
1996#include <unistd.h>
1997int main(void) { preadv; }
1998EOF
1999preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002000if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00002001 preadv=yes
2002fi
2003
2004##########################################
aurel32f652e6a2008-12-16 10:43:48 +00002005# fdt probe
Juan Quintela2df87df2009-08-12 18:29:54 +02002006if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02002007 fdt_libs="-lfdt"
2008 cat > $TMPC << EOF
aurel32f652e6a2008-12-16 10:43:48 +00002009int main(void) { return 0; }
2010EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002011 if compile_prog "" "$fdt_libs" ; then
aurel32f652e6a2008-12-16 10:43:48 +00002012 fdt=yes
Juan Quintela2df87df2009-08-12 18:29:54 +02002013 else
2014 if test "$fdt" = "yes" ; then
2015 feature_not_found "fdt"
2016 fi
Michael Wallede3a3542011-04-26 00:24:07 +02002017 fdt_libs=
Juan Quintela2df87df2009-08-12 18:29:54 +02002018 fdt=no
aurel32f652e6a2008-12-16 10:43:48 +00002019 fi
2020fi
2021
Michael Walle20ff0752011-03-07 23:32:39 +01002022##########################################
2023# opengl probe, used by milkymist-tmu2
2024if test "$opengl" != "no" ; then
2025 opengl_libs="-lGL"
2026 cat > $TMPC << EOF
2027#include <X11/Xlib.h>
2028#include <GL/gl.h>
2029#include <GL/glx.h>
2030int main(void) { GL_VERSION; return 0; }
2031EOF
2032 if compile_prog "" "-lGL" ; then
2033 opengl=yes
Michael Walle20ff0752011-03-07 23:32:39 +01002034 else
2035 if test "$opengl" = "yes" ; then
2036 feature_not_found "opengl"
2037 fi
Michael Wallede3a3542011-04-26 00:24:07 +02002038 opengl_libs=
Michael Walle20ff0752011-03-07 23:32:39 +01002039 opengl=no
2040 fi
2041fi
2042
aurel323b3f24a2009-04-15 16:12:13 +00002043#
2044# Check for xxxat() functions when we are building linux-user
2045# emulator. This is done because older glibc versions don't
2046# have syscall stubs for these implemented.
2047#
2048atfile=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03002049cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00002050#define _ATFILE_SOURCE
2051#include <sys/types.h>
2052#include <fcntl.h>
2053#include <unistd.h>
2054
2055int
2056main(void)
2057{
2058 /* try to unlink nonexisting file */
2059 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
2060}
2061EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002062if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03002063 atfile=yes
aurel323b3f24a2009-04-15 16:12:13 +00002064fi
2065
aurel3239386ac2009-04-15 19:48:17 +00002066# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00002067# emulator. This is done because older glibc versions don't
2068# have syscall stubs for these implemented. In that case we
2069# don't provide them even if kernel supports them.
2070#
2071inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03002072cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00002073#include <sys/inotify.h>
2074
2075int
2076main(void)
2077{
2078 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00002079 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00002080}
2081EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002082if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03002083 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00002084fi
2085
Riku Voipioc05c7a72010-03-26 15:25:11 +00002086inotify1=no
2087cat > $TMPC << EOF
2088#include <sys/inotify.h>
2089
2090int
2091main(void)
2092{
2093 /* try to start inotify */
2094 return inotify_init1(0);
2095}
2096EOF
2097if compile_prog "" "" ; then
2098 inotify1=yes
2099fi
2100
Riku Voipioebc996f2009-04-21 15:01:51 +03002101# check if utimensat and futimens are supported
2102utimens=no
2103cat > $TMPC << EOF
2104#define _ATFILE_SOURCE
Riku Voipioebc996f2009-04-21 15:01:51 +03002105#include <stddef.h>
2106#include <fcntl.h>
2107
2108int main(void)
2109{
2110 utimensat(AT_FDCWD, "foo", NULL, 0);
2111 futimens(0, NULL);
2112 return 0;
2113}
2114EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002115if compile_prog "" "" ; then
Riku Voipioebc996f2009-04-21 15:01:51 +03002116 utimens=yes
2117fi
2118
Riku Voipio099d6b02009-05-05 12:10:04 +03002119# check if pipe2 is there
2120pipe2=no
2121cat > $TMPC << EOF
Riku Voipio099d6b02009-05-05 12:10:04 +03002122#include <unistd.h>
2123#include <fcntl.h>
2124
2125int main(void)
2126{
2127 int pipefd[2];
2128 pipe2(pipefd, O_CLOEXEC);
2129 return 0;
2130}
2131EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002132if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03002133 pipe2=yes
2134fi
2135
Kevin Wolf40ff6d72009-12-02 12:24:42 +01002136# check if accept4 is there
2137accept4=no
2138cat > $TMPC << EOF
Kevin Wolf40ff6d72009-12-02 12:24:42 +01002139#include <sys/socket.h>
2140#include <stddef.h>
2141
2142int main(void)
2143{
2144 accept4(0, NULL, NULL, SOCK_CLOEXEC);
2145 return 0;
2146}
2147EOF
2148if compile_prog "" "" ; then
2149 accept4=yes
2150fi
2151
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302152# check if tee/splice is there. vmsplice was added same time.
2153splice=no
2154cat > $TMPC << EOF
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302155#include <unistd.h>
2156#include <fcntl.h>
2157#include <limits.h>
2158
2159int main(void)
2160{
2161 int len, fd;
2162 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
2163 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
2164 return 0;
2165}
2166EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002167if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302168 splice=yes
2169fi
2170
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03002171##########################################
2172# signalfd probe
2173signalfd="no"
2174cat > $TMPC << EOF
2175#define _GNU_SOURCE
2176#include <unistd.h>
2177#include <sys/syscall.h>
2178#include <signal.h>
2179int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2180EOF
2181
2182if compile_prog "" "" ; then
2183 signalfd=yes
2184fi
2185
Riku Voipioc2882b92009-08-12 15:08:24 +03002186# check if eventfd is supported
2187eventfd=no
2188cat > $TMPC << EOF
2189#include <sys/eventfd.h>
2190
2191int main(void)
2192{
2193 int efd = eventfd(0, 0);
2194 return 0;
2195}
2196EOF
2197if compile_prog "" "" ; then
2198 eventfd=yes
2199fi
2200
Ulrich Hechtd0927932009-09-17 20:22:14 +03002201# check for fallocate
2202fallocate=no
2203cat > $TMPC << EOF
2204#include <fcntl.h>
2205
2206int main(void)
2207{
2208 fallocate(0, 0, 0, 0);
2209 return 0;
2210}
2211EOF
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +02002212if compile_prog "$ARCH_CFLAGS" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03002213 fallocate=yes
2214fi
2215
Peter Maydellc727f472011-01-06 11:05:10 +00002216# check for sync_file_range
2217sync_file_range=no
2218cat > $TMPC << EOF
2219#include <fcntl.h>
2220
2221int main(void)
2222{
2223 sync_file_range(0, 0, 0, 0);
2224 return 0;
2225}
2226EOF
2227if compile_prog "$ARCH_CFLAGS" "" ; then
2228 sync_file_range=yes
2229fi
2230
Peter Maydelldace20d2011-01-10 13:11:24 +00002231# check for linux/fiemap.h and FS_IOC_FIEMAP
2232fiemap=no
2233cat > $TMPC << EOF
2234#include <sys/ioctl.h>
2235#include <linux/fs.h>
2236#include <linux/fiemap.h>
2237
2238int main(void)
2239{
2240 ioctl(0, FS_IOC_FIEMAP, 0);
2241 return 0;
2242}
2243EOF
2244if compile_prog "$ARCH_CFLAGS" "" ; then
2245 fiemap=yes
2246fi
2247
Ulrich Hechtd0927932009-09-17 20:22:14 +03002248# check for dup3
2249dup3=no
2250cat > $TMPC << EOF
2251#include <unistd.h>
2252
2253int main(void)
2254{
2255 dup3(0, 0, 0);
2256 return 0;
2257}
2258EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01002259if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03002260 dup3=yes
2261fi
2262
Peter Maydell3b6edd12011-02-15 18:35:05 +00002263# check for epoll support
2264epoll=no
2265cat > $TMPC << EOF
2266#include <sys/epoll.h>
2267
2268int main(void)
2269{
2270 epoll_create(0);
2271 return 0;
2272}
2273EOF
2274if compile_prog "$ARCH_CFLAGS" "" ; then
2275 epoll=yes
2276fi
2277
2278# epoll_create1 and epoll_pwait are later additions
2279# so we must check separately for their presence
2280epoll_create1=no
2281cat > $TMPC << EOF
2282#include <sys/epoll.h>
2283
2284int main(void)
2285{
Peter Maydell19e83f62011-04-26 16:56:40 +01002286 /* Note that we use epoll_create1 as a value, not as
2287 * a function being called. This is necessary so that on
2288 * old SPARC glibc versions where the function was present in
2289 * the library but not declared in the header file we will
2290 * fail the configure check. (Otherwise we will get a compiler
2291 * warning but not an error, and will proceed to fail the
2292 * qemu compile where we compile with -Werror.)
2293 */
2294 epoll_create1;
Peter Maydell3b6edd12011-02-15 18:35:05 +00002295 return 0;
2296}
2297EOF
2298if compile_prog "$ARCH_CFLAGS" "" ; then
2299 epoll_create1=yes
2300fi
2301
2302epoll_pwait=no
2303cat > $TMPC << EOF
2304#include <sys/epoll.h>
2305
2306int main(void)
2307{
2308 epoll_pwait(0, 0, 0, 0, 0);
2309 return 0;
2310}
2311EOF
2312if compile_prog "$ARCH_CFLAGS" "" ; then
2313 epoll_pwait=yes
2314fi
2315
pbrookcc8ae6d2006-04-23 17:57:59 +00002316# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02002317if test "$docs" != "no" ; then
Stefan Weil01668d92010-03-04 22:21:02 +01002318 if has makeinfo && has pod2man; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02002319 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02002320 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02002321 if test "$docs" = "yes" ; then
2322 feature_not_found "docs"
Juan Quintela83a3ab82009-08-12 18:29:51 +02002323 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02002324 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02002325 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00002326fi
2327
Stefan Weilf514f412009-10-11 12:44:07 +02002328# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002329byteswap_h=no
2330cat > $TMPC << EOF
2331#include <byteswap.h>
2332int main(void) { return bswap_32(0); }
2333EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002334if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002335 byteswap_h=yes
2336fi
2337
Stefan Weilf514f412009-10-11 12:44:07 +02002338# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002339bswap_h=no
2340cat > $TMPC << EOF
2341#include <sys/endian.h>
2342#include <sys/types.h>
2343#include <machine/bswap.h>
2344int main(void) { return bswap32(0); }
2345EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002346if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002347 bswap_h=yes
2348fi
2349
aliguorida93a1f2008-12-12 20:02:52 +00002350##########################################
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11002351# Do we have libiscsi
2352if test "$libiscsi" != "no" ; then
2353 cat > $TMPC << EOF
2354#include <iscsi/iscsi.h>
2355int main(void) { iscsi_create_context(""); return 0; }
2356EOF
2357 if compile_prog "-Werror" "-liscsi" ; then
2358 libiscsi="yes"
2359 LIBS="$LIBS -liscsi"
2360 else
2361 if test "$libiscsi" = "yes" ; then
2362 feature_not_found "libiscsi"
2363 fi
2364 libiscsi="no"
2365 fi
2366fi
2367
2368
2369##########################################
aliguorida93a1f2008-12-12 20:02:52 +00002370# Do we need librt
2371cat > $TMPC <<EOF
2372#include <signal.h>
2373#include <time.h>
2374int main(void) { clockid_t id; return clock_gettime(id, NULL); }
2375EOF
2376
Juan Quintela52166aa2009-08-03 14:46:03 +02002377if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02002378 :
Juan Quintela52166aa2009-08-03 14:46:03 +02002379elif compile_prog "" "-lrt" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02002380 LIBS="-lrt $LIBS"
aliguorida93a1f2008-12-12 20:02:52 +00002381fi
2382
Blue Swirl31ff5042009-09-12 12:33:07 +00002383if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
Andreas Färber179cf402010-09-20 00:50:43 +02002384 "$aix" != "yes" -a "$haiku" != "yes" ; then
Juan Quintela6362a532009-08-03 14:46:32 +02002385 libs_softmmu="-lutil $libs_softmmu"
2386fi
2387
Blue Swirlde5071c2009-09-12 09:58:46 +00002388##########################################
2389# check if the compiler defines offsetof
2390
2391need_offsetof=yes
2392cat > $TMPC << EOF
2393#include <stddef.h>
2394int main(void) { struct s { int f; }; return offsetof(struct s, f); }
2395EOF
2396if compile_prog "" "" ; then
2397 need_offsetof=no
2398fi
2399
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002400# spice probe
2401if test "$spice" != "no" ; then
2402 cat > $TMPC << EOF
2403#include <spice.h>
2404int main(void) { spice_server_new(); return 0; }
2405EOF
Jiri Denemark710fc4f2011-01-24 13:20:29 +01002406 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2407 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
Gerd Hoffmann012b80d2011-05-17 10:48:14 +02002408 if $pkg_config --atleast-version=0.6.0 spice-server >/dev/null 2>&1 && \
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002409 compile_prog "$spice_cflags" "$spice_libs" ; then
2410 spice="yes"
2411 libs_softmmu="$libs_softmmu $spice_libs"
2412 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2413 else
2414 if test "$spice" = "yes" ; then
2415 feature_not_found "spice"
2416 fi
2417 spice="no"
2418 fi
2419fi
2420
Robert Relyea111a38b2010-11-28 16:36:38 +02002421# check for libcacard for smartcard support
2422if test "$smartcard" != "no" ; then
2423 smartcard="yes"
2424 smartcard_cflags=""
2425 # TODO - what's the minimal nss version we support?
2426 if test "$smartcard_nss" != "no"; then
2427 if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then
2428 smartcard_nss="yes"
2429 smartcard_cflags="-I\$(SRC_PATH)/libcacard"
2430 libcacard_libs=$($pkg_config --libs nss 2>/dev/null)
2431 libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null)
2432 QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
2433 LIBS="$libcacard_libs $LIBS"
2434 else
2435 if test "$smartcard_nss" = "yes"; then
2436 feature_not_found "nss"
2437 fi
2438 smartcard_nss="no"
2439 fi
2440 fi
2441fi
2442if test "$smartcard" = "no" ; then
2443 smartcard_nss="no"
2444fi
2445
Hans de Goede69354a82011-07-19 11:04:10 +02002446# check for usbredirparser for usb network redirection support
2447if test "$usb_redir" != "no" ; then
2448 if $pkg_config libusbredirparser >/dev/null 2>&1 ; then
2449 usb_redir="yes"
2450 usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
2451 usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
2452 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
2453 LIBS="$LIBS $usb_redir_libs"
2454 else
2455 if test "$usb_redir" = "yes"; then
2456 feature_not_found "usb-redir"
2457 fi
2458 usb_redir="no"
2459 fi
2460fi
2461
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002462##########################################
2463
Blue Swirl747bbdf2009-10-18 16:26:06 +00002464##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002465# check if we have fdatasync
2466
2467fdatasync=no
2468cat > $TMPC << EOF
2469#include <unistd.h>
Alexandre Raymondd1722a22011-05-29 18:22:48 -04002470int main(void) {
2471#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2472return fdatasync(0);
2473#else
2474#abort Not supported
2475#endif
2476}
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002477EOF
2478if compile_prog "" "" ; then
2479 fdatasync=yes
2480fi
2481
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002482##########################################
Andreas Färbere78815a2010-09-25 11:26:05 +00002483# check if we have madvise
2484
2485madvise=no
2486cat > $TMPC << EOF
2487#include <sys/types.h>
2488#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002489#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00002490int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2491EOF
2492if compile_prog "" "" ; then
2493 madvise=yes
2494fi
2495
2496##########################################
2497# check if we have posix_madvise
2498
2499posix_madvise=no
2500cat > $TMPC << EOF
2501#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002502#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00002503int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2504EOF
2505if compile_prog "" "" ; then
2506 posix_madvise=yes
2507fi
2508
2509##########################################
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002510# check if trace backend exists
2511
Blue Swirl4c3b5a42011-01-20 20:54:21 +00002512sh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002513if test "$?" -ne 0 ; then
2514 echo
2515 echo "Error: invalid trace backend"
2516 echo "Please choose a supported trace backend."
2517 echo
2518 exit 1
2519fi
2520
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01002521##########################################
2522# For 'ust' backend, test if ust headers are present
2523if test "$trace_backend" = "ust"; then
2524 cat > $TMPC << EOF
2525#include <ust/tracepoint.h>
2526#include <ust/marker.h>
2527int main(void) { return 0; }
2528EOF
2529 if compile_prog "" "" ; then
2530 LIBS="-lust $LIBS"
2531 else
2532 echo
2533 echo "Error: Trace backend 'ust' missing libust header files"
2534 echo
2535 exit 1
2536 fi
2537fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00002538
2539##########################################
2540# For 'dtrace' backend, test if 'dtrace' command is present
2541if test "$trace_backend" = "dtrace"; then
2542 if ! has 'dtrace' ; then
2543 echo
2544 echo "Error: dtrace command is not found in PATH $PATH"
2545 echo
2546 exit 1
2547 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00002548 trace_backend_stap="no"
2549 if has 'stap' ; then
2550 trace_backend_stap="yes"
2551 fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00002552fi
2553
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01002554##########################################
Wolfgang Mauerer023367e2011-07-11 14:57:43 +02002555# __sync_fetch_and_and requires at least -march=i486. Many toolchains
2556# use i686 as default anyway, but for those that don't, an explicit
2557# specification is necessary
Stefan Weil1ba16962011-07-29 22:40:45 +02002558if test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
Wolfgang Mauerer023367e2011-07-11 14:57:43 +02002559 cat > $TMPC << EOF
2560int sfaa(unsigned *ptr)
2561{
2562 return __sync_fetch_and_and(ptr, 0);
2563}
2564
2565int main(int argc, char **argv)
2566{
2567 int val = 42;
2568 sfaa(&val);
2569 return val;
2570}
2571EOF
2572 if ! compile_prog "" "" ; then
2573 CFLAGS+="-march=i486"
2574 fi
2575fi
2576
2577##########################################
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05302578# check if we have makecontext
2579
2580ucontext_coroutine=no
2581if test "$darwin" != "yes"; then
2582 cat > $TMPC << EOF
2583#include <ucontext.h>
2584int main(void) { makecontext(0, 0, 0); }
2585EOF
2586 if compile_prog "" "" ; then
2587 ucontext_coroutine=yes
2588 fi
2589fi
2590
2591##########################################
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05302592# check if we have open_by_handle_at
2593
2594open_by_hande_at=no
2595cat > $TMPC << EOF
2596#include <fcntl.h>
Aneesh Kumar K.V15329e82011-10-25 12:10:39 +05302597int main(void) { struct file_handle fh; open_by_handle_at(0, &fh, 0); }
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05302598EOF
2599if compile_prog "" "" ; then
2600 open_by_handle_at=yes
2601fi
2602
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05302603########################################
2604# check if we have linux/magic.h
2605
2606linux_magic_h=no
2607cat > $TMPC << EOF
2608#include <linux/magic.h>
2609int main(void) {
2610}
2611EOF
2612if compile_prog "" "" ; then
2613 linux_magic_h=yes
2614fi
2615
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05302616##########################################
Juan Quintelae86ecd42009-08-03 14:45:59 +02002617# End of CC checks
2618# After here, no more $cc or $ld runs
2619
Juan Quintelae86ecd42009-08-03 14:45:59 +02002620if test "$debug" = "no" ; then
Juan Quintela1156c662009-08-03 14:46:00 +02002621 CFLAGS="-O2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002622fi
Juan Quintelaa316e372009-09-30 01:10:55 +02002623
Juan Quintelae86ecd42009-08-03 14:45:59 +02002624# Consult white-list to determine whether to enable werror
2625# by default. Only enable by default for git builds
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002626z_version=`cut -f3 -d. $source_path/VERSION`
2627
Juan Quintelae86ecd42009-08-03 14:45:59 +02002628if test -z "$werror" ; then
Juan Quintelae86ecd42009-08-03 14:45:59 +02002629 if test "$z_version" = "50" -a \
2630 "$linux" = "yes" ; then
2631 werror="yes"
2632 else
2633 werror="no"
2634 fi
2635fi
2636
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002637# Disable zero malloc errors for official releases unless explicitly told to
2638# enable/disable
2639if test -z "$zero_malloc" ; then
2640 if test "$z_version" = "50" ; then
2641 zero_malloc="no"
2642 else
2643 zero_malloc="yes"
2644 fi
2645fi
2646
Juan Quintelae86ecd42009-08-03 14:45:59 +02002647if test "$werror" = "yes" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +02002648 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002649fi
2650
2651if test "$solaris" = "no" ; then
2652 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02002653 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002654 fi
2655fi
2656
Blue Swirl952afb72010-09-19 08:36:34 +00002657# Use ASLR, no-SEH and DEP if available
2658if test "$mingw32" = "yes" ; then
2659 for flag in --dynamicbase --no-seh --nxcompat; do
2660 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2661 LDFLAGS="-Wl,$flag $LDFLAGS"
2662 fi
2663 done
2664fi
2665
Paolo Bonzini190e9c52010-05-26 16:08:21 +02002666confdir=$sysconfdir$confsuffix
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02002667
Paolo Bonzinica35f782010-05-26 16:08:29 +02002668tools=
2669if test "$softmmu" = yes ; then
2670 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2671 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2672 tools="qemu-nbd\$(EXESUF) $tools"
Michael Rothd138cee2011-08-01 14:52:57 -05002673 if [ "$guest_agent" = "yes" ]; then
Michael Roth48ff7a62011-07-20 15:19:37 -05002674 tools="qemu-ga\$(EXESUF) $tools"
Michael Rothd138cee2011-08-01 14:52:57 -05002675 fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02002676 if [ "$check_utests" = "yes" ]; then
2677 tools="check-qint check-qstring check-qdict check-qlist $tools"
2678 tools="check-qfloat check-qjson $tools"
2679 fi
2680 fi
2681fi
2682
2683# Mac OS X ships with a broken assembler
2684roms=
2685if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2686 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2687 "$softmmu" = yes ; then
2688 roms="optionrom"
2689fi
Andreas Färberd0384d12011-05-01 18:23:56 +02002690if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
David Gibson39ac8452011-04-01 15:15:23 +11002691 roms="$roms spapr-rtas"
2692fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02002693
bellard43ce4df2003-06-09 19:53:12 +00002694echo "Install prefix $prefix"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002695echo "BIOS directory `eval echo $datadir`"
2696echo "binary directory `eval echo $bindir`"
Alon Levy3aa5d2b2011-05-15 12:08:59 +03002697echo "library directory `eval echo $libdir`"
Alon Levy0f94d6d2011-06-27 11:58:20 +02002698echo "include directory `eval echo $includedir`"
Aurelien Jarno1c0fd162010-06-10 00:14:02 +02002699echo "config directory `eval echo $sysconfdir`"
bellard11d9f692004-04-02 20:55:59 +00002700if test "$mingw32" = "no" ; then
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002701echo "Manual directory `eval echo $mandir`"
bellard43ce4df2003-06-09 19:53:12 +00002702echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00002703fi
bellard5a671352003-10-01 00:13:48 +00002704echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00002705echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00002706echo "Host C compiler $host_cc"
Juan Quintela0c439cb2009-08-03 14:46:01 +02002707echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02002708echo "QEMU_CFLAGS $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02002709echo "LDFLAGS $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00002710echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00002711echo "install $install"
Blue Swirlc886edf2011-07-22 21:08:09 +00002712echo "python $python"
Brade2d88302011-09-02 16:53:28 -04002713if test "$slirp" = "yes" ; then
2714 echo "smbd $smbd"
2715fi
bellard43ce4df2003-06-09 19:53:12 +00002716echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00002717echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00002718echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00002719echo "tcg debug enabled $debug_tcg"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -02002720echo "Mon debug enabled $debug_mon"
bellard43ce4df2003-06-09 19:53:12 +00002721echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00002722echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00002723echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00002724echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00002725echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00002726echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00002727if test "$darwin" = "yes" ; then
2728 echo "Cocoa support $cocoa"
2729fi
bellard97a847b2003-08-10 21:36:04 +00002730echo "SDL support $sdl"
balrog4d3b6f62008-02-10 16:33:14 +00002731echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02002732echo "curl support $curl"
Luiz Capitulino5495ed12009-08-28 15:27:28 -03002733echo "check support $check_utests"
bellard67b915a2004-03-31 23:37:16 +00002734echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00002735echo "Audio drivers $audio_drv_list"
2736echo "Extra audio cards $audio_card_list"
Markus Armbrustereb852012009-10-27 18:41:44 +01002737echo "Block whitelist $block_drv_whitelist"
malc8ff9cbf2008-06-23 18:33:30 +00002738echo "Mixer emulation $mixemu"
Jes Sorensen821601e2011-03-16 13:33:36 +01002739echo "VNC support $vnc"
2740if test "$vnc" = "yes" ; then
2741 echo "VNC TLS support $vnc_tls"
2742 echo "VNC SASL support $vnc_sasl"
2743 echo "VNC JPEG support $vnc_jpeg"
2744 echo "VNC PNG support $vnc_png"
2745 echo "VNC thread $vnc_thread"
2746fi
blueswir131422552007-04-16 18:27:06 +00002747if test -n "$sparc_cpu"; then
2748 echo "Target Sparc Arch $sparc_cpu"
2749fi
aliguorie37630c2009-04-22 15:19:10 +00002750echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00002751echo "brlapi support $brlapi"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002752echo "bluez support $bluez"
Juan Quintelaa25dba12009-08-12 18:29:52 +02002753echo "Documentation $docs"
pbrookc5937222006-05-14 11:30:38 +00002754[ ! -z "$uname_release" ] && \
2755echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00002756echo "NPTL support $nptl"
Paul Brook379f6692009-07-17 12:48:08 +01002757echo "GUEST_BASE $guest_base"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03002758echo "PIE user targets $user_pie"
ths8a16d272008-07-19 09:56:24 +00002759echo "vde support $vde"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002760echo "Linux AIO support $linux_aio"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002761echo "ATTR/XATTR support $attr"
ths77755342008-11-27 15:45:16 +00002762echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02002763echo "KVM support $kvm"
Stefan Weil9195b2c2011-10-19 07:07:18 +02002764echo "TCG interpreter $tcg_interpreter"
aurel32f652e6a2008-12-16 10:43:48 +00002765echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00002766echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002767echo "fdatasync $fdatasync"
Andreas Färbere78815a2010-09-25 11:26:05 +00002768echo "madvise $madvise"
2769echo "posix_madvise $posix_madvise"
Stefan Weilee682d22009-10-01 20:10:37 +02002770echo "uuid support $uuid"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02002771echo "vhost-net support $vhost_net"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002772echo "Trace backend $trace_backend"
Prerna Saxena9410b562010-07-13 09:26:32 +01002773echo "Trace output file $trace_file-<pid>"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01002774echo "spice support $spice"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002775echo "rbd support $rbd"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002776echo "xfsctl support $xfs"
Robert Relyea111a38b2010-11-28 16:36:38 +02002777echo "nss used $smartcard_nss"
Hans de Goede69354a82011-07-19 11:04:10 +02002778echo "usb net redir $usb_redir"
Michael Walle20ff0752011-03-07 23:32:39 +01002779echo "OpenGL support $opengl"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11002780echo "libiscsi support $libiscsi"
Michael Rothd138cee2011-08-01 14:52:57 -05002781echo "build guest agent $guest_agent"
bellard67b915a2004-03-31 23:37:16 +00002782
Stefan Weil1ba16962011-07-29 22:40:45 +02002783if test "$sdl_too_old" = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00002784echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00002785fi
bellard97a847b2003-08-10 21:36:04 +00002786
Juan Quintela98ec69a2009-07-16 18:34:18 +02002787config_host_mak="config-host.mak"
Juan Quintela4bf6b552009-07-22 22:37:40 +02002788config_host_ld="config-host.ld"
bellard97a847b2003-08-10 21:36:04 +00002789
Juan Quintela98ec69a2009-07-16 18:34:18 +02002790echo "# Automatically generated by configure - do not modify" > $config_host_mak
2791printf "# Configured with:" >> $config_host_mak
2792printf " '%s'" "$0" "$@" >> $config_host_mak
2793echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002794
Paolo Bonzinie6c3b0f2010-10-21 10:18:35 +02002795echo all: >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02002796echo "prefix=$prefix" >> $config_host_mak
2797echo "bindir=$bindir" >> $config_host_mak
Alon Levy3aa5d2b2011-05-15 12:08:59 +03002798echo "libdir=$libdir" >> $config_host_mak
Alon Levy0f94d6d2011-06-27 11:58:20 +02002799echo "includedir=$includedir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02002800echo "mandir=$mandir" >> $config_host_mak
2801echo "datadir=$datadir" >> $config_host_mak
2802echo "sysconfdir=$sysconfdir" >> $config_host_mak
2803echo "docdir=$docdir" >> $config_host_mak
Paolo Bonzini1dabe052010-05-26 16:08:25 +02002804echo "confdir=$confdir" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002805
aurel322408a522008-04-20 20:19:44 +00002806case "$cpu" in
Guan Xuetaod2fbca92011-04-12 16:27:03 +08002807 i386|x86_64|alpha|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32)
Juan Quintelae0da9dd2009-07-16 18:34:09 +02002808 ARCH=$cpu
aurel322408a522008-04-20 20:19:44 +00002809 ;;
Laurent Desnoguesa302c322009-07-18 14:23:39 +02002810 armv4b|armv4l)
Juan Quintela16dbd142009-07-16 18:34:08 +02002811 ARCH=arm
aurel322408a522008-04-20 20:19:44 +00002812 ;;
Stefan Weil9195b2c2011-10-19 07:07:18 +02002813 *)
2814 if test "$tcg_interpreter" = "yes" ; then
2815 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
2816 ARCH=tci
2817 else
2818 echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
2819 exit 1
2820 fi
2821 ;;
aurel322408a522008-04-20 20:19:44 +00002822esac
Juan Quintela98ec69a2009-07-16 18:34:18 +02002823echo "ARCH=$ARCH" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00002824if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002825 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00002826fi
Luiz Capitulinob4475aa2010-02-10 23:50:03 -02002827if test "$debug_mon" = "yes" ; then
2828 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2829fi
Paul Brookf3d08ee2009-06-04 11:39:04 +01002830if test "$debug" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002831 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
Paul Brookf3d08ee2009-06-04 11:39:04 +01002832fi
aliguori1625af82009-04-05 17:41:02 +00002833if test "$strip_opt" = "yes" ; then
Hollis Blanchard52ba7842010-08-04 17:21:34 -07002834 echo "STRIP=${strip}" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00002835fi
bellard7d132992003-03-06 23:23:54 +00002836if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02002837 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00002838fi
Juan Quintela2358a492009-07-27 16:13:25 +02002839echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00002840if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002841 echo "CONFIG_WIN32=y" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00002842 rc_version=`cat $source_path/VERSION`
2843 version_major=${rc_version%%.*}
2844 rc_version=${rc_version#*.}
2845 version_minor=${rc_version%%.*}
2846 rc_version=${rc_version#*.}
2847 version_subminor=${rc_version%%.*}
2848 version_micro=0
2849 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2850 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
pbrook210fa552007-02-27 21:04:49 +00002851else
Juan Quintela35f4df22009-07-27 16:13:07 +02002852 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00002853fi
blueswir1128ab2f2008-08-15 18:33:42 +00002854
Mark McLoughlindffcb712009-10-22 17:49:11 +01002855if test "$linux" = "yes" ; then
2856 echo "CONFIG_LINUX=y" >> $config_host_mak
2857fi
2858
bellard83fb7ad2004-07-05 21:25:26 +00002859if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002860 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00002861fi
malcb29fe3e2008-11-18 01:42:22 +00002862
2863if test "$aix" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002864 echo "CONFIG_AIX=y" >> $config_host_mak
malcb29fe3e2008-11-18 01:42:22 +00002865fi
2866
bellardec530c82006-04-25 22:36:06 +00002867if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002868 echo "CONFIG_SOLARIS=y" >> $config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02002869 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00002870 if test "$needs_libsunmath" = "yes" ; then
Juan Quintela75b5a692009-07-27 16:13:23 +02002871 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00002872 fi
bellardec530c82006-04-25 22:36:06 +00002873fi
Andreas Färber179cf402010-09-20 00:50:43 +02002874if test "$haiku" = "yes" ; then
2875 echo "CONFIG_HAIKU=y" >> $config_host_mak
2876fi
bellard97a847b2003-08-10 21:36:04 +00002877if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002878 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00002879fi
Stefan Weil1ba16962011-07-29 22:40:45 +02002880if test "$profiler" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002881 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00002882fi
bellardc20709a2004-04-21 23:27:19 +00002883if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002884 echo "CONFIG_SLIRP=y" >> $config_host_mak
Brade2d88302011-09-02 16:53:28 -04002885 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01002886 QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
bellardc20709a2004-04-21 23:27:19 +00002887fi
ths8a16d272008-07-19 09:56:24 +00002888if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002889 echo "CONFIG_VDE=y" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00002890fi
malc0c58ac12008-06-25 21:04:05 +00002891for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00002892 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002893 echo "$def=y" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002894done
Juan Quintela2358a492009-07-27 16:13:25 +02002895echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002896for drv in $audio_drv_list; do
pbrookf6e58892008-06-29 01:00:34 +00002897 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002898 echo "$def=y" >> $config_host_mak
malc923e4522008-07-02 18:13:46 +00002899 if test "$drv" = "fmod"; then
Juan Quintela7aac6cb2009-07-27 16:12:47 +02002900 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002901 fi
2902done
Juan Quintela67f86e82009-08-03 14:46:59 +02002903if test "$audio_pt_int" = "yes" ; then
2904 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2905fi
malcd5631632009-10-10 01:13:41 +04002906if test "$audio_win_int" = "yes" ; then
2907 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2908fi
Markus Armbrustereb852012009-10-27 18:41:44 +01002909echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00002910if test "$mixemu" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002911 echo "CONFIG_MIXEMU=y" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00002912fi
Jes Sorensen821601e2011-03-16 13:33:36 +01002913if test "$vnc" = "yes" ; then
2914 echo "CONFIG_VNC=y" >> $config_host_mak
2915fi
ths8d5d2d42007-08-25 01:37:51 +00002916if test "$vnc_tls" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002917 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
Juan Quintela525061b2009-07-27 16:12:43 +02002918 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
ths8d5d2d42007-08-25 01:37:51 +00002919fi
aliguori2f9606b2009-03-06 20:27:28 +00002920if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002921 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
Juan Quintela60ddf532009-07-27 16:12:45 +02002922 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00002923fi
Jes Sorensen821601e2011-03-16 13:33:36 +01002924if test "$vnc_jpeg" = "yes" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002925 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
2926 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
2927fi
Jes Sorensen821601e2011-03-16 13:33:36 +01002928if test "$vnc_png" = "yes" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02002929 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2930 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2931fi
Jes Sorensen821601e2011-03-16 13:33:36 +01002932if test "$vnc_thread" = "yes" ; then
Corentin Charybd023f92010-07-07 20:58:02 +02002933 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
Corentin Charybd023f92010-07-07 20:58:02 +02002934fi
aliguori76655d62009-03-06 20:27:37 +00002935if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002936 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00002937fi
Stefan Weilee682d22009-10-01 20:10:37 +02002938if test "$uuid" = "yes" ; then
2939 echo "CONFIG_UUID=y" >> $config_host_mak
2940fi
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002941if test "$xfs" = "yes" ; then
2942 echo "CONFIG_XFS=y" >> $config_host_mak
2943fi
pbrookb1a550a2006-04-16 13:28:56 +00002944qemu_version=`head $source_path/VERSION`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002945echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02002946echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002947echo "SRC_PATH=$source_path" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002948echo "TARGET_DIRS=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02002949if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002950 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00002951fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02002952if test "$sdl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002953 echo "CONFIG_SDL=y" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02002954 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00002955fi
2956if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002957 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00002958fi
2959if test "$curses" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002960 echo "CONFIG_CURSES=y" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00002961fi
aurel323b3f24a2009-04-15 16:12:13 +00002962if test "$atfile" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002963 echo "CONFIG_ATFILE=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00002964fi
Riku Voipioebc996f2009-04-21 15:01:51 +03002965if test "$utimens" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002966 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
Riku Voipioebc996f2009-04-21 15:01:51 +03002967fi
Riku Voipio099d6b02009-05-05 12:10:04 +03002968if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002969 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03002970fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01002971if test "$accept4" = "yes" ; then
2972 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2973fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302974if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002975 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302976fi
Riku Voipioc2882b92009-08-12 15:08:24 +03002977if test "$eventfd" = "yes" ; then
2978 echo "CONFIG_EVENTFD=y" >> $config_host_mak
2979fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03002980if test "$fallocate" = "yes" ; then
2981 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2982fi
Peter Maydellc727f472011-01-06 11:05:10 +00002983if test "$sync_file_range" = "yes" ; then
2984 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
2985fi
Peter Maydelldace20d2011-01-10 13:11:24 +00002986if test "$fiemap" = "yes" ; then
2987 echo "CONFIG_FIEMAP=y" >> $config_host_mak
2988fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03002989if test "$dup3" = "yes" ; then
2990 echo "CONFIG_DUP3=y" >> $config_host_mak
2991fi
Peter Maydell3b6edd12011-02-15 18:35:05 +00002992if test "$epoll" = "yes" ; then
2993 echo "CONFIG_EPOLL=y" >> $config_host_mak
2994fi
2995if test "$epoll_create1" = "yes" ; then
2996 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
2997fi
2998if test "$epoll_pwait" = "yes" ; then
2999 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
3000fi
aurel323b3f24a2009-04-15 16:12:13 +00003001if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003002 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00003003fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00003004if test "$inotify1" = "yes" ; then
3005 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3006fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003007if test "$byteswap_h" = "yes" ; then
3008 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
3009fi
3010if test "$bswap_h" = "yes" ; then
3011 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
3012fi
Alexander Graf769ce762009-05-11 17:41:42 +02003013if test "$curl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003014 echo "CONFIG_CURL=y" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02003015 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02003016fi
aurel322e4d9fb2008-04-08 06:01:02 +00003017if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003018 echo "CONFIG_BRLAPI=y" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00003019fi
balrogfb599c92008-09-28 23:49:55 +00003020if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003021 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02003022 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00003023fi
Anthony Liguorie18df142011-07-19 14:50:29 -05003024echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00003025if test "$xen" = "yes" ; then
Jan Kiszka6dbd5882011-06-21 22:59:07 +02003026 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00003027 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00003028fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003029if test "$linux_aio" = "yes" ; then
3030 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
3031fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003032if test "$attr" = "yes" ; then
3033 echo "CONFIG_ATTR=y" >> $config_host_mak
3034fi
3035if test "$linux" = "yes" ; then
3036 if test "$attr" = "yes" ; then
3037 echo "CONFIG_VIRTFS=y" >> $config_host_mak
3038 fi
3039fi
ths77755342008-11-27 15:45:16 +00003040if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003041 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00003042fi
aliguoribf9298b2008-12-05 20:05:26 +00003043if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003044 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00003045fi
aliguoriceb42de2009-04-07 18:43:28 +00003046if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003047 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00003048fi
aurel32f652e6a2008-12-16 10:43:48 +00003049if test "$fdt" = "yes" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02003050 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00003051fi
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03003052if test "$signalfd" = "yes" ; then
3053 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3054fi
Stefan Weil9195b2c2011-10-19 07:07:18 +02003055if test "$tcg_interpreter" = "yes" ; then
3056 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
3057fi
Blue Swirlde5071c2009-09-12 09:58:46 +00003058if test "$need_offsetof" = "yes" ; then
3059 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
3060fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00003061if test "$fdatasync" = "yes" ; then
3062 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
3063fi
Andreas Färbere78815a2010-09-25 11:26:05 +00003064if test "$madvise" = "yes" ; then
3065 echo "CONFIG_MADVISE=y" >> $config_host_mak
3066fi
3067if test "$posix_madvise" = "yes" ; then
3068 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3069fi
bellard97a847b2003-08-10 21:36:04 +00003070
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003071if test "$spice" = "yes" ; then
3072 echo "CONFIG_SPICE=y" >> $config_host_mak
3073fi
3074
Alon Levy36707142010-10-17 11:40:07 +02003075if test "$smartcard" = "yes" ; then
3076 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
3077fi
3078
Robert Relyea111a38b2010-11-28 16:36:38 +02003079if test "$smartcard_nss" = "yes" ; then
3080 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3081fi
3082
Hans de Goede69354a82011-07-19 11:04:10 +02003083if test "$usb_redir" = "yes" ; then
3084 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
3085fi
3086
Michael Walle20ff0752011-03-07 23:32:39 +01003087if test "$opengl" = "yes" ; then
3088 echo "CONFIG_OPENGL=y" >> $config_host_mak
3089fi
3090
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003091if test "$libiscsi" = "yes" ; then
3092 echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3093fi
3094
bellard83fb7ad2004-07-05 21:25:26 +00003095# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00003096if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003097 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00003098fi
3099
Juan Quintela2358a492009-07-27 16:13:25 +02003100echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
pbrookc5937222006-05-14 11:30:38 +00003101
Anthony Liguori20ff6c82009-12-09 12:59:36 -06003102if test "$zero_malloc" = "yes" ; then
3103 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
3104fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003105if test "$rbd" = "yes" ; then
3106 echo "CONFIG_RBD=y" >> $config_host_mak
3107fi
Anthony Liguori20ff6c82009-12-09 12:59:36 -06003108
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303109if test "$ucontext_coroutine" = "yes" ; then
3110 echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3111fi
3112
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303113if test "$open_by_handle_at" = "yes" ; then
3114 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3115fi
3116
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05303117if test "$linux_magic_h" = "yes" ; then
3118 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3119fi
3120
blueswir168063642008-11-22 21:03:55 +00003121# USB host support
3122case "$usb" in
3123linux)
Juan Quintela98ec69a2009-07-16 18:34:18 +02003124 echo "HOST_USB=linux" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00003125;;
3126bsd)
Juan Quintela98ec69a2009-07-16 18:34:18 +02003127 echo "HOST_USB=bsd" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00003128;;
3129*)
Juan Quintela98ec69a2009-07-16 18:34:18 +02003130 echo "HOST_USB=stub" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00003131;;
3132esac
3133
Lluíse4858972011-08-31 20:31:03 +02003134# use default implementation for tracing backend-specific routines
3135trace_default=yes
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003136echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
Lluís6d8a7642011-08-31 20:30:43 +02003137if test "$trace_backend" = "nop"; then
3138 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
Prerna Saxena22890ab2010-06-24 17:04:53 +05303139fi
Prerna Saxena9410b562010-07-13 09:26:32 +01003140if test "$trace_backend" = "simple"; then
Lluís6d8a7642011-08-31 20:30:43 +02003141 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02003142 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02003143 # Set the appropriate trace file.
Andreas Färber953ffe02011-06-02 19:58:06 +02003144 trace_file="\"$trace_file-\" FMT_pid"
Prerna Saxena9410b562010-07-13 09:26:32 +01003145fi
Lluís6d8a7642011-08-31 20:30:43 +02003146if test "$trace_backend" = "stderr"; then
3147 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
Lluís9a82b6a2011-08-31 20:31:51 +02003148 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02003149fi
3150if test "$trace_backend" = "ust"; then
3151 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
3152fi
3153if test "$trace_backend" = "dtrace"; then
3154 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
3155 if test "$trace_backend_stap" = "yes" ; then
3156 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
3157 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00003158fi
Prerna Saxena9410b562010-07-13 09:26:32 +01003159echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02003160if test "$trace_default" = "yes"; then
3161 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3162fi
Prerna Saxena9410b562010-07-13 09:26:32 +01003163
Juan Quintela98ec69a2009-07-16 18:34:18 +02003164echo "TOOLS=$tools" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02003165echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003166echo "MAKE=$make" >> $config_host_mak
3167echo "INSTALL=$install" >> $config_host_mak
Brad1901cb12011-08-28 04:01:33 -04003168echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
3169echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
3170echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
Blue Swirlc886edf2011-07-22 21:08:09 +00003171echo "PYTHON=$python" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003172echo "CC=$cc" >> $config_host_mak
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02003173echo "CC_I386=$cc_i386" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003174echo "HOST_CC=$host_cc" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003175echo "AR=$ar" >> $config_host_mak
3176echo "OBJCOPY=$objcopy" >> $config_host_mak
3177echo "LD=$ld" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00003178echo "WINDRES=$windres" >> $config_host_mak
Alon Levy44dc0ca2011-05-15 11:51:28 +03003179echo "LIBTOOL=$libtool" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02003180echo "CFLAGS=$CFLAGS" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02003181echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01003182echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01003183if test "$sparse" = "yes" ; then
3184 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
3185 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
3186 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3187fi
Juan Quintelac81da562009-08-03 14:46:24 +02003188echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02003189echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Juan Quintelaa36abbb2009-08-03 14:45:56 +02003190echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3191echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02003192echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02003193echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003194echo "EXESUF=$EXESUF" >> $config_host_mak
Michael Roth957f1f92011-08-11 15:38:12 -05003195echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003196
Juan Quintela4bf6b552009-07-22 22:37:40 +02003197# generate list of library paths for linker script
3198
3199$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
3200
3201if test -f ${config_host_ld}~ ; then
3202 if cmp -s $config_host_ld ${config_host_ld}~ ; then
3203 mv ${config_host_ld}~ $config_host_ld
3204 else
3205 rm ${config_host_ld}~
3206 fi
3207fi
3208
Blue Swirl4d904532010-03-21 08:28:47 +00003209for d in libdis libdis-user; do
3210 mkdir -p $d
Paolo Bonzini11568d62010-12-23 11:43:58 +01003211 symlink $source_path/Makefile.dis $d/Makefile
Blue Swirl4d904532010-03-21 08:28:47 +00003212 echo > $d/config.mak
3213done
Richard Hendersond44cff22010-05-21 10:04:46 -07003214if test "$static" = "no" -a "$user_pie" = "yes" ; then
3215 echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
3216fi
Blue Swirl4d904532010-03-21 08:28:47 +00003217
bellard1d14ffa2005-10-30 18:58:22 +00003218for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00003219target_dir="$target"
Juan Quintela25be2102009-10-07 02:41:00 +02003220config_target_mak=$target_dir/config-target.mak
Blue Swirl600309b2009-07-03 17:44:00 +00003221target_arch2=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00003222target_bigendian="no"
Juan Quintela1f3d3c82009-10-07 02:41:02 +02003223
Juan Quintelaea2d6a32009-07-16 18:34:10 +02003224case "$target_arch2" in
Max Filippovcfa550c2011-09-06 03:55:26 +04003225 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
Juan Quintelaea2d6a32009-07-16 18:34:10 +02003226 target_bigendian=yes
3227 ;;
3228esac
bellard97a847b2003-08-10 21:36:04 +00003229target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00003230target_user_only="no"
ths831b7822007-01-18 20:06:33 +00003231target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00003232target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00003233target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00003234case "$target" in
Blue Swirl600309b2009-07-03 17:44:00 +00003235 ${target_arch2}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00003236 target_softmmu="yes"
3237 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00003238 ${target_arch2}-linux-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00003239 if test "$linux" != "yes" ; then
3240 echo "ERROR: Target '$target' is only available on a Linux host"
3241 exit 1
3242 fi
pbrook9e407a82007-05-26 16:38:53 +00003243 target_user_only="yes"
3244 target_linux_user="yes"
3245 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00003246 ${target_arch2}-darwin-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00003247 if test "$darwin" != "yes" ; then
3248 echo "ERROR: Target '$target' is only available on a Darwin host"
3249 exit 1
3250 fi
pbrook9e407a82007-05-26 16:38:53 +00003251 target_user_only="yes"
3252 target_darwin_user="yes"
3253 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00003254 ${target_arch2}-bsd-user)
Blue Swirl9cf55762009-11-17 21:27:18 +00003255 if test "$bsd" != "yes" ; then
Blue Swirl9c7a4202009-11-17 20:52:56 +00003256 echo "ERROR: Target '$target' is only available on a BSD host"
3257 exit 1
3258 fi
blueswir184778502008-10-26 20:33:16 +00003259 target_user_only="yes"
3260 target_bsd_user="yes"
3261 ;;
pbrook9e407a82007-05-26 16:38:53 +00003262 *)
3263 echo "ERROR: Target '$target' not recognised"
3264 exit 1
3265 ;;
3266esac
ths831b7822007-01-18 20:06:33 +00003267
bellard97a847b2003-08-10 21:36:04 +00003268mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00003269mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00003270mkdir -p $target_dir/tcg
Gerd Hoffmann59f2a782009-08-20 15:22:26 +02003271mkdir -p $target_dir/ide
Aneesh Kumar K.V353ac782011-01-28 18:09:08 +05303272mkdir -p $target_dir/9pfs
blueswir184778502008-10-26 20:33:16 +00003273if 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 +00003274 mkdir -p $target_dir/nwfpe
3275fi
Paolo Bonzini11568d62010-12-23 11:43:58 +01003276symlink $source_path/Makefile.target $target_dir/Makefile
bellardec530c82006-04-25 22:36:06 +00003277
bellard97a847b2003-08-10 21:36:04 +00003278
Juan Quintela25be2102009-10-07 02:41:00 +02003279echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00003280
pbrooke5fe0c52006-06-11 13:32:59 +00003281bflt="no"
pbrookbd0c5662008-05-29 14:34:11 +00003282target_nptl="no"
Blue Swirl600309b2009-07-03 17:44:00 +00003283interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
Paolo Bonzini7ee28222010-05-26 16:08:22 +02003284echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00003285gdb_xml_files=""
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003286target_short_alignment=2
3287target_int_alignment=4
3288target_long_alignment=4
3289target_llong_alignment=8
Michael Wallede3a3542011-04-26 00:24:07 +02003290target_libs_softmmu=
aliguori7ba1e612008-11-05 16:04:33 +00003291
Juan Quintela938b1ed2009-07-16 18:34:12 +02003292TARGET_ARCH="$target_arch2"
Juan Quintela6acff7d2009-07-16 18:34:15 +02003293TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02003294TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02003295
Blue Swirl600309b2009-07-03 17:44:00 +00003296case "$target_arch2" in
aurel322408a522008-04-20 20:19:44 +00003297 i386)
Aurelien Jarno71deff22011-02-09 19:35:50 +01003298 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003299 ;;
3300 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02003301 TARGET_BASE_ARCH=i386
Paul Brook1ad21342009-05-19 16:17:58 +01003302 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003303 target_long_alignment=8
aurel322408a522008-04-20 20:19:44 +00003304 ;;
3305 alpha)
Paul Brook1ad21342009-05-19 16:17:58 +01003306 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003307 target_long_alignment=8
Richard Hendersona4b388f2010-04-12 16:17:22 -07003308 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00003309 ;;
3310 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003311 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00003312 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00003313 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00003314 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003315 target_phys_bits=32
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003316 target_llong_alignment=4
aurel322408a522008-04-20 20:19:44 +00003317 ;;
3318 cris)
edgar_igl253bd7f2009-01-07 20:07:09 +00003319 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01003320 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00003321 ;;
Michael Walle613a22c2011-02-17 23:45:17 +01003322 lm32)
3323 target_phys_bits=32
Michael Wallede3a3542011-04-26 00:24:07 +02003324 target_libs_softmmu="$opengl_libs"
Michael Walle613a22c2011-02-17 23:45:17 +01003325 ;;
aurel322408a522008-04-20 20:19:44 +00003326 m68k)
aurel322408a522008-04-20 20:19:44 +00003327 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00003328 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003329 target_phys_bits=32
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003330 target_int_alignment=2
3331 target_long_alignment=2
3332 target_llong_alignment=2
aurel322408a522008-04-20 20:19:44 +00003333 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01003334 microblaze|microblazeel)
3335 TARGET_ARCH=microblaze
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02003336 bflt="yes"
3337 target_nptl="yes"
3338 target_phys_bits=32
Michael Wallede3a3542011-04-26 00:24:07 +02003339 target_libs_softmmu="$fdt_libs"
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02003340 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02003341 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003342 TARGET_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02003343 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
Paul Brookf04dc722009-07-09 17:56:24 +01003344 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01003345 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003346 ;;
3347 mipsn32|mipsn32el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003348 TARGET_ARCH=mipsn32
Juan Quintela6acff7d2009-07-16 18:34:15 +02003349 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02003350 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01003351 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003352 ;;
3353 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003354 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02003355 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02003356 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01003357 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003358 target_long_alignment=8
aurel322408a522008-04-20 20:19:44 +00003359 ;;
3360 ppc)
aurel32c8b35322009-01-24 15:07:34 +00003361 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003362 target_phys_bits=32
Nathan Froydd6630702009-08-03 08:43:28 -07003363 target_nptl="yes"
Michael Wallede3a3542011-04-26 00:24:07 +02003364 target_libs_softmmu="$fdt_libs"
aurel322408a522008-04-20 20:19:44 +00003365 ;;
3366 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02003367 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02003368 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00003369 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003370 target_phys_bits=64
Nathan Froydd6630702009-08-03 08:43:28 -07003371 target_nptl="yes"
Michael Wallede3a3542011-04-26 00:24:07 +02003372 target_libs_softmmu="$fdt_libs"
aurel322408a522008-04-20 20:19:44 +00003373 ;;
3374 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02003375 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02003376 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00003377 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003378 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003379 target_long_alignment=8
Michael Wallede3a3542011-04-26 00:24:07 +02003380 target_libs_softmmu="$fdt_libs"
aurel322408a522008-04-20 20:19:44 +00003381 ;;
3382 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003383 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02003384 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02003385 TARGET_ABI_DIR=ppc
Juan Quintela25be2102009-10-07 02:41:00 +02003386 echo "TARGET_ABI32=y" >> $config_target_mak
aurel32c8b35322009-01-24 15:07:34 +00003387 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01003388 target_phys_bits=64
Michael Wallede3a3542011-04-26 00:24:07 +02003389 target_libs_softmmu="$fdt_libs"
aurel322408a522008-04-20 20:19:44 +00003390 ;;
3391 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003392 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00003393 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00003394 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01003395 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00003396 ;;
3397 sparc)
Paul Brook1ad21342009-05-19 16:17:58 +01003398 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003399 ;;
3400 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02003401 TARGET_BASE_ARCH=sparc
Paul Brook1ad21342009-05-19 16:17:58 +01003402 target_phys_bits=64
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003403 target_long_alignment=8
aurel322408a522008-04-20 20:19:44 +00003404 ;;
3405 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02003406 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02003407 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02003408 TARGET_ABI_DIR=sparc
Juan Quintela25be2102009-10-07 02:41:00 +02003409 echo "TARGET_ABI32=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01003410 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00003411 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01003412 s390x)
Ulrich Hechtbc434672011-03-29 15:29:33 +02003413 target_nptl="yes"
Alexander Graf24e804ec2009-12-05 12:44:22 +01003414 target_phys_bits=64
Alexander Graf7b3da902011-04-04 16:32:11 +02003415 target_long_alignment=8
Alexander Graf24e804ec2009-12-05 12:44:22 +01003416 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +08003417 unicore32)
3418 target_phys_bits=32
3419 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04003420 xtensa|xtensaeb)
3421 TARGET_ARCH=xtensa
3422 target_phys_bits=32
3423 ;;
aurel322408a522008-04-20 20:19:44 +00003424 *)
3425 echo "Unsupported target CPU"
3426 exit 1
3427 ;;
3428esac
Laurent Vivierc2e3dee2011-02-13 23:37:34 +01003429echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3430echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3431echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3432echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
Juan Quintela25be2102009-10-07 02:41:00 +02003433echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
Juan Quintela053dd922009-08-03 14:47:03 +02003434target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
Juan Quintela25be2102009-10-07 02:41:00 +02003435echo "TARGET_$target_arch_name=y" >> $config_target_mak
3436echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
Juan Quintela42bc6082009-07-16 18:34:20 +02003437# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02003438if [ "$TARGET_BASE_ARCH" = "" ]; then
3439 TARGET_BASE_ARCH=$TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02003440fi
Juan Quintela25be2102009-10-07 02:41:00 +02003441echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02003442if [ "$TARGET_ABI_DIR" = "" ]; then
3443 TARGET_ABI_DIR=$TARGET_ARCH
3444fi
Juan Quintela25be2102009-10-07 02:41:00 +02003445echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02003446case "$target_arch2" in
3447 i386|x86_64)
3448 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
Anthony PERARD64b3cfd2010-10-21 12:47:08 +01003449 target_phys_bits=64
Juan Quintela25be2102009-10-07 02:41:00 +02003450 echo "CONFIG_XEN=y" >> $config_target_mak
Alexander Graf59d21e52011-07-17 07:30:29 +02003451 else
3452 echo "CONFIG_NO_XEN=y" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02003453 fi
Alexander Graf59d21e52011-07-17 07:30:29 +02003454 ;;
3455 *)
3456 echo "CONFIG_NO_XEN=y" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02003457esac
Juan Quintelac59249f2009-07-16 18:34:00 +02003458case "$target_arch2" in
Alexander Graf0e60a692009-12-05 12:44:24 +01003459 i386|x86_64|ppcemb|ppc|ppc64|s390x)
Juan Quintelac59249f2009-07-16 18:34:00 +02003460 # Make sure the target and host cpus are compatible
3461 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3462 \( "$target_arch2" = "$cpu" -o \
3463 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
Alexander Graf5f114bc2009-07-17 13:51:42 +02003464 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
René Rebeadf82012011-03-21 11:18:50 +01003465 \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \
3466 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
Juan Quintelac59249f2009-07-16 18:34:00 +02003467 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
3468 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003469 echo "CONFIG_KVM=y" >> $config_target_mak
Stefan Weil1ba16962011-07-29 22:40:45 +02003470 if test "$vhost_net" = "yes" ; then
Michael S. Tsirkind5970052010-03-17 13:08:17 +02003471 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3472 fi
Juan Quintelac59249f2009-07-16 18:34:00 +02003473 fi
3474esac
Alexander Graf0a6b8dd2011-08-10 14:21:41 +02003475if test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
3476 echo "CONFIG_PSERIES=y" >> $config_target_mak
3477fi
bellardde83cd02003-06-15 20:25:43 +00003478if test "$target_bigendian" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003479 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00003480fi
3481if test "$target_softmmu" = "yes" ; then
Paul Brookb1aa27c2010-03-01 02:27:26 +00003482 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
Juan Quintela25be2102009-10-07 02:41:00 +02003483 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
Michael Wallede3a3542011-04-26 00:24:07 +02003484 echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
Andreas Färber0e8c9212010-01-06 20:24:05 +01003485 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
Kirill A. Shutemov5791f452009-09-12 02:17:53 +03003486 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00003487fi
bellard997344f2003-10-27 21:10:39 +00003488if test "$target_user_only" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003489 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00003490fi
ths831b7822007-01-18 20:06:33 +00003491if test "$target_linux_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003492 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00003493fi
3494if test "$target_darwin_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003495 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00003496fi
Robert Relyea111a38b2010-11-28 16:36:38 +02003497if test "$smartcard_nss" = "yes" ; then
3498 echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3499 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3500 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3501fi
pbrook56aebc82008-10-11 17:55:29 +00003502list=""
3503if test ! -z "$gdb_xml_files" ; then
3504 for x in $gdb_xml_files; do
3505 list="$list $source_path/gdb-xml/$x"
3506 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02003507 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00003508fi
bellardde83cd02003-06-15 20:25:43 +00003509
pbrooke5fe0c52006-06-11 13:32:59 +00003510if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02003511 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00003512fi
pbrookbd0c5662008-05-29 14:34:11 +00003513if test "$target_user_only" = "yes" \
3514 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02003515 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
pbrookbd0c5662008-05-29 14:34:11 +00003516fi
Paul Brook379f6692009-07-17 12:48:08 +01003517if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02003518 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
Paul Brook379f6692009-07-17 12:48:08 +01003519fi
blueswir184778502008-10-26 20:33:16 +00003520if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003521 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00003522fi
bellard5b0753e2005-03-01 21:37:28 +00003523
Juan Quintela4afddb52009-08-03 14:46:45 +02003524# generate QEMU_CFLAGS/LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02003525
Juan Quintela4afddb52009-08-03 14:46:45 +02003526cflags=""
Paolo Bonzinif9728942010-12-23 11:43:53 +01003527includes=""
Juan Quintelafa282482009-07-22 22:37:39 +02003528ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02003529
Stefan Weil9195b2c2011-10-19 07:07:18 +02003530if test "$tcg_interpreter" = "yes"; then
3531 includes="-I\$(SRC_PATH)/tcg/tci $includes"
3532elif test "$ARCH" = "sparc64" ; then
Paolo Bonzinif9728942010-12-23 11:43:53 +01003533 includes="-I\$(SRC_PATH)/tcg/sparc $includes"
Alexander Graf24e804ec2009-12-05 12:44:22 +01003534elif test "$ARCH" = "s390x" ; then
Paolo Bonzinif9728942010-12-23 11:43:53 +01003535 includes="-I\$(SRC_PATH)/tcg/s390 $includes"
Richard Henderson5d8a4f82010-06-03 17:35:17 -07003536elif test "$ARCH" = "x86_64" ; then
Paolo Bonzinif9728942010-12-23 11:43:53 +01003537 includes="-I\$(SRC_PATH)/tcg/i386 $includes"
Juan Quintela57ddfbf2009-08-03 14:46:51 +02003538else
Paolo Bonzinif9728942010-12-23 11:43:53 +01003539 includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
Juan Quintela57ddfbf2009-08-03 14:46:51 +02003540fi
Paolo Bonzinif9728942010-12-23 11:43:53 +01003541includes="-I\$(SRC_PATH)/tcg $includes"
Juan Quintela57ddfbf2009-08-03 14:46:51 +02003542
Blue Swirl4d904532010-03-21 08:28:47 +00003543if test "$target_user_only" = "yes" ; then
3544 libdis_config_mak=libdis-user/config.mak
3545else
3546 libdis_config_mak=libdis/config.mak
3547fi
3548
Juan Quintela64656022009-08-03 14:46:53 +02003549for i in $ARCH $TARGET_BASE_ARCH ; do
3550 case "$i" in
3551 alpha)
Juan Quintela25be2102009-10-07 02:41:00 +02003552 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003553 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003554 ;;
3555 arm)
Juan Quintela25be2102009-10-07 02:41:00 +02003556 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003557 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003558 ;;
3559 cris)
Juan Quintela25be2102009-10-07 02:41:00 +02003560 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003561 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003562 ;;
3563 hppa)
Juan Quintela25be2102009-10-07 02:41:00 +02003564 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003565 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003566 ;;
3567 i386|x86_64)
Juan Quintela25be2102009-10-07 02:41:00 +02003568 echo "CONFIG_I386_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003569 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003570 ;;
Aurelien Jarno903ec552010-03-29 02:12:51 +02003571 ia64*)
3572 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3573 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3574 ;;
Juan Quintela64656022009-08-03 14:46:53 +02003575 m68k)
Juan Quintela25be2102009-10-07 02:41:00 +02003576 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003577 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003578 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01003579 microblaze*)
Juan Quintela25be2102009-10-07 02:41:00 +02003580 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003581 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003582 ;;
3583 mips*)
Juan Quintela25be2102009-10-07 02:41:00 +02003584 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003585 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003586 ;;
3587 ppc*)
Juan Quintela25be2102009-10-07 02:41:00 +02003588 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003589 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003590 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01003591 s390*)
Juan Quintela25be2102009-10-07 02:41:00 +02003592 echo "CONFIG_S390_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003593 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003594 ;;
3595 sh4)
Juan Quintela25be2102009-10-07 02:41:00 +02003596 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003597 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003598 ;;
3599 sparc*)
Juan Quintela25be2102009-10-07 02:41:00 +02003600 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00003601 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02003602 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04003603 xtensa*)
3604 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
3605 echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak
3606 ;;
Juan Quintela64656022009-08-03 14:46:53 +02003607 esac
3608done
Stefan Weil9195b2c2011-10-19 07:07:18 +02003609if test "$tcg_interpreter" = "yes" ; then
3610 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
3611 echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak
3612fi
Juan Quintela64656022009-08-03 14:46:53 +02003613
Juan Quintela6ee71262009-08-03 14:46:47 +02003614case "$ARCH" in
3615alpha)
3616 # Ensure there's only a single GP
3617 cflags="-msmall-data $cflags"
3618;;
3619esac
3620
Juan Quintela55d9c042009-08-03 14:47:02 +02003621if test "$target_softmmu" = "yes" ; then
3622 case "$TARGET_BASE_ARCH" in
3623 arm)
3624 cflags="-DHAS_AUDIO $cflags"
3625 ;;
Michael Walle25a8bb92011-03-07 23:32:32 +01003626 lm32)
3627 cflags="-DHAS_AUDIO $cflags"
3628 ;;
Juan Quintela55d9c042009-08-03 14:47:02 +02003629 i386|mips|ppc)
3630 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3631 ;;
3632 esac
3633fi
3634
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03003635if test "$target_user_only" = "yes" -a "$static" = "no" -a \
Blue Swirl50108932009-09-13 19:38:48 +00003636 "$user_pie" = "yes" ; then
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03003637 cflags="-fpie $cflags"
3638 ldflags="-pie $ldflags"
3639fi
3640
Juan Quintela471857d2009-08-03 14:46:52 +02003641if test "$target_softmmu" = "yes" -a \( \
3642 "$TARGET_ARCH" = "microblaze" -o \
3643 "$TARGET_ARCH" = "cris" \) ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003644 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
Juan Quintela471857d2009-08-03 14:46:52 +02003645fi
3646
Juan Quintelad02c1db2009-08-03 14:46:50 +02003647if test "$gprof" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02003648 echo "TARGET_GPROF=yes" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02003649 if test "$target_linux_user" = "yes" ; then
3650 cflags="-p $cflags"
3651 ldflags="-p $ldflags"
3652 fi
3653 if test "$target_softmmu" = "yes" ; then
3654 ldflags="-p $ldflags"
Juan Quintela25be2102009-10-07 02:41:00 +02003655 echo "GPROF_CFLAGS=-p" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02003656 fi
3657fi
3658
Stefan Weil9195b2c2011-10-19 07:07:18 +02003659if test "$ARCH" = "tci"; then
3660 linker_script=""
3661else
3662 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
3663fi
3664
Juan Quintela9b8e1112009-08-03 14:46:46 +02003665if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
Juan Quintelafa282482009-07-22 22:37:39 +02003666 case "$ARCH" in
Juan Quintelafa282482009-07-22 22:37:39 +02003667 sparc)
3668 # -static is used to avoid g1/g3 usage by the dynamic linker
Juan Quintela322e5872009-08-03 14:46:44 +02003669 ldflags="$linker_script -static $ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02003670 ;;
Richard Henderson4d58be02010-06-04 12:14:11 -07003671 alpha | s390x)
3672 # The default placement of the application is fine.
3673 ;;
Richard Hendersonfd76e732010-04-07 04:56:43 -07003674 *)
Juan Quintela322e5872009-08-03 14:46:44 +02003675 ldflags="$linker_script $ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02003676 ;;
3677 esac
3678fi
Juan Quintelafa282482009-07-22 22:37:39 +02003679
Jan Kiszkae205c792011-06-08 16:10:57 +02003680# use included Linux headers
Jan Kiszkaaf2be202011-06-23 10:05:12 +02003681if test "$linux" = "yes" ; then
3682 includes="-I\$(SRC_PATH)/linux-headers $includes"
3683 mkdir -p linux-headers
3684 case "$cpu" in
3685 i386|x86_64)
3686 symlink $source_path/linux-headers/asm-x86 linux-headers/asm
3687 ;;
3688 ppcemb|ppc|ppc64)
3689 symlink $source_path/linux-headers/asm-powerpc linux-headers/asm
3690 ;;
3691 s390x)
3692 symlink $source_path/linux-headers/asm-s390 linux-headers/asm
3693 ;;
3694 esac
3695fi
Jan Kiszkae205c792011-06-08 16:10:57 +02003696
Juan Quintela25be2102009-10-07 02:41:00 +02003697echo "LDFLAGS+=$ldflags" >> $config_target_mak
3698echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01003699echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02003700
bellard97a847b2003-08-10 21:36:04 +00003701done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00003702
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003703# build tree in object directory in case the source is not in the current directory
3704DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
Andreas Färber446b9162011-05-08 13:25:56 +02003705DIRS="$DIRS pc-bios/spapr-rtas"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003706DIRS="$DIRS roms/seabios roms/vgabios"
3707DIRS="$DIRS fsdev ui"
Michael Rothe098fc32011-09-07 18:40:52 -05003708DIRS="$DIRS qapi qapi-generated"
Anthony Liguorid9cd4462011-09-02 10:28:35 -05003709DIRS="$DIRS qga trace"
Luiz Capitulino70371cf2011-08-26 15:00:13 -03003710FILES="Makefile tests/Makefile qdict-test-data.txt"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003711FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
3712FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
Andreas Färber446b9162011-05-08 13:25:56 +02003713FILES="$FILES pc-bios/spapr-rtas/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003714FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
Richard Henderson753d11f2011-06-24 11:58:37 -07003715for bios_file in \
3716 $source_path/pc-bios/*.bin \
3717 $source_path/pc-bios/*.rom \
3718 $source_path/pc-bios/*.dtb \
3719 $source_path/pc-bios/openbios-* \
3720 $source_path/pc-bios/palcode-*
3721do
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003722 FILES="$FILES pc-bios/`basename $bios_file`"
3723done
3724mkdir -p $DIRS
3725for f in $FILES ; do
Peter Maydellf9245e12011-06-03 17:10:40 +01003726 if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then
3727 symlink "$source_path/$f" "$f"
3728 fi
Paolo Bonzinid1807a42010-12-23 11:43:59 +01003729done
Paul Brook1ad21342009-05-19 16:17:58 +01003730
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003731# temporary config to build submodules
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06003732for rom in seabios vgabios ; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003733 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01003734 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003735 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3736 echo "CC=$cc" >> $config_mak
3737 echo "BCC=bcc" >> $config_mak
3738 echo "CPP=${cross_prefix}cpp" >> $config_mak
3739 echo "OBJCOPY=objcopy" >> $config_mak
3740 echo "IASL=iasl" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003741 echo "LD=$ld" >> $config_mak
3742done
3743
Paul Brook1ad21342009-05-19 16:17:58 +01003744for hwlib in 32 64; do
3745 d=libhw$hwlib
3746 mkdir -p $d
Blue Swirl9953b2f2010-03-21 19:47:05 +00003747 mkdir -p $d/ide
Paolo Bonzini11568d62010-12-23 11:43:58 +01003748 symlink $source_path/Makefile.hw $d/Makefile
Aneesh Kumar K.V353ac782011-01-28 18:09:08 +05303749 mkdir -p $d/9pfs
Stefan Weil37116c82010-03-01 22:20:29 +01003750 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
Paul Brook1ad21342009-05-19 16:17:58 +01003751done
Blue Swirladd16152009-09-27 16:26:02 +00003752
Robert Relyea111a38b2010-11-28 16:36:38 +02003753if [ "$source_path" != `pwd` ]; then
3754 # out of tree build
3755 mkdir -p libcacard
3756 rm -f libcacard/Makefile
Alon Levy44dc0ca2011-05-15 11:51:28 +03003757 symlink "$source_path/libcacard/Makefile" libcacard/Makefile
Robert Relyea111a38b2010-11-28 16:36:38 +02003758fi
3759
Blue Swirladd16152009-09-27 16:26:02 +00003760d=libuser
3761mkdir -p $d
Lluís Vilanova937b1252011-09-15 22:45:42 +02003762mkdir -p $d/trace
Paolo Bonzini11568d62010-12-23 11:43:58 +01003763symlink $source_path/Makefile.user $d/Makefile
Kirill A. Shutemov299060a2009-12-19 15:16:08 +00003764if test "$static" = "no" -a "$user_pie" = "yes" ; then
3765 echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3766fi
Jan Kiszkab40292e2010-05-31 14:43:31 -03003767
3768if test "$docs" = "yes" ; then
3769 mkdir -p QMP
3770fi