blob: 6143acbcbf0dc77aaf3dc219e620dd9d409f08e5 [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001#!/bin/sh
2#
bellard3ef693a2003-03-23 20:17:16 +00003# qemu configure script (c) 2003 Fabrice Bellard
bellard7d132992003-03-06 23:23:54 +00004#
5# set temporary file name
6if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10else
11 TMPDIR1="/tmp"
12fi
13
bellard3ef693a2003-03-23 20:17:16 +000014TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
malca91b8572009-10-15 01:57:14 +040016TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
bellard7d132992003-03-06 23:23:54 +000017
Loïc Minier0ba86812010-09-25 21:52:30 +020018# NB: do not call "exit" in the trap handler; this is buggy with some shells;
19# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
20trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020021rm -f config.log
malc9ac81bb2008-11-29 20:09:56 +000022
Peter Maydellb48e3612011-11-23 17:26:44 +000023# Print a helpful header at the top of config.log
24echo "# QEMU configure log $(date)" >> config.log
Peter Maydell979ae162012-03-07 12:16:29 +000025printf "# Configured with:" >> config.log
26printf " '%s'" "$0" "$@" >> config.log
27echo >> config.log
Peter Maydellb48e3612011-11-23 17:26:44 +000028echo "#" >> config.log
29
Stefan Weilbdf523e2013-10-20 18:39:21 +020030# Save the configure command line for later reuse.
31cat <<EOD >config.status
32#!/bin/sh
33# Generated by configure.
34# Run this file to recreate the current configuration.
35# Compiler output produced by configure, useful for debugging
36# configure, is in config.log if it exists.
37EOD
38printf "exec" >>config.status
39printf " '%s'" "$0" "$@" >>config.status
40echo >>config.status
41chmod +x config.status
42
Peter Maydell76ad07a2013-04-08 12:11:26 +010043error_exit() {
44 echo
45 echo "ERROR: $1"
46 while test -n "$2"; do
47 echo " $2"
48 shift
49 done
50 echo
51 exit 1
52}
53
Peter Maydell8dc38a72012-07-18 15:10:28 +010054do_cc() {
55 # Run the compiler, capturing its output to the log.
56 echo $cc "$@" >> config.log
57 $cc "$@" >> config.log 2>&1 || return $?
58 # Test passed. If this is an --enable-werror build, rerun
59 # the test with -Werror and bail out if it fails. This
60 # makes warning-generating-errors in configure test code
61 # obvious to developers.
62 if test "$werror" != "yes"; then
63 return 0
64 fi
65 # Don't bother rerunning the compile if we were already using -Werror
66 case "$*" in
67 *-Werror*)
68 return 0
69 ;;
70 esac
71 echo $cc -Werror "$@" >> config.log
72 $cc -Werror "$@" >> config.log 2>&1 && return $?
Peter Maydell76ad07a2013-04-08 12:11:26 +010073 error_exit "configure test passed without -Werror but failed with -Werror." \
74 "This is probably a bug in the configure script. The failing command" \
75 "will be at the bottom of config.log." \
76 "You can run configure with --disable-werror to bypass this check."
Peter Maydell8dc38a72012-07-18 15:10:28 +010077}
78
Juan Quintela52166aa2009-08-03 14:46:03 +020079compile_object() {
Peter Maydell8dc38a72012-07-18 15:10:28 +010080 do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
Juan Quintela52166aa2009-08-03 14:46:03 +020081}
82
83compile_prog() {
84 local_cflags="$1"
85 local_ldflags="$2"
Peter Maydell8dc38a72012-07-18 15:10:28 +010086 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
Juan Quintela52166aa2009-08-03 14:46:03 +020087}
88
Paolo Bonzini11568d62010-12-23 11:43:58 +010089# symbolically link $1 to $2. Portable version of "ln -sf".
90symlink() {
Stefan Weil72b8b5a2012-03-19 13:20:47 +010091 rm -rf "$2"
Anthony Liguoriec5b06d2012-06-06 16:57:00 +080092 mkdir -p "$(dirname "$2")"
Stefan Weil72b8b5a2012-03-19 13:20:47 +010093 ln -s "$1" "$2"
Paolo Bonzini11568d62010-12-23 11:43:58 +010094}
95
Loïc Minier0dba6192010-01-28 21:26:51 +000096# check whether a command is available to this shell (may be either an
97# executable or a builtin)
98has() {
99 type "$1" >/dev/null 2>&1
100}
101
102# search for an executable in PATH
103path_of() {
104 local_command="$1"
105 local_ifs="$IFS"
106 local_dir=""
107
108 # pathname has a dir component?
109 if [ "${local_command#*/}" != "$local_command" ]; then
110 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
111 echo "$local_command"
112 return 0
113 fi
114 fi
115 if [ -z "$local_command" ]; then
116 return 1
117 fi
118
119 IFS=:
120 for local_dir in $PATH; do
121 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
122 echo "$local_dir/$local_command"
123 IFS="${local_ifs:-$(printf ' \t\n')}"
124 return 0
125 fi
126 done
127 # not found
128 IFS="${local_ifs:-$(printf ' \t\n')}"
129 return 1
130}
131
bellard7d132992003-03-06 23:23:54 +0000132# default parameters
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100133source_path=`dirname "$0"`
Juan Quintela2ff6b912009-08-03 14:45:55 +0200134cpu=""
Michael S. Tsirkina31a8642013-07-24 18:56:03 +0300135iasl="iasl"
bellard1e43adf2003-09-30 20:54:24 +0000136interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +0000137static="no"
bellard7d132992003-03-06 23:23:54 +0000138cross_prefix=""
malc0c58ac12008-06-25 21:04:05 +0000139audio_drv_list=""
Fam Zhengb64ec4e2013-05-29 19:35:40 +0800140block_drv_rw_whitelist=""
141block_drv_ro_whitelist=""
Peter Maydelle49d0212012-12-07 15:39:13 +0000142host_cc="cc"
Juan Quintela73da3752009-08-03 14:46:26 +0200143libs_softmmu=""
Juan Quintela3e2e0e62009-08-03 14:47:06 +0200144libs_tools=""
Juan Quintela67f86e82009-08-03 14:46:59 +0200145audio_pt_int=""
malcd5631632009-10-10 01:13:41 +0400146audio_win_int=""
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200147cc_i386=i386-pc-linux-gnu-gcc
Michael Roth957f1f92011-08-11 15:38:12 -0500148libs_qga=""
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100149debug_info="yes"
aliguoriac0df512008-12-29 17:14:15 +0000150
Stefan Weilafb63eb2012-09-26 22:04:38 +0200151# Don't accept a target_list environment variable.
152unset target_list
Paolo Bonzini377529c2010-12-23 11:43:50 +0100153
154# Default value for a variable defining feature "foo".
155# * foo="no" feature will only be used if --enable-foo arg is given
156# * foo="" feature will be searched for, and if found, will be used
157# unless --disable-foo is given
158# * foo="yes" this value will only be set by --enable-foo flag.
159# feature will searched for,
160# if not found, configure exits with error
161#
162# Always add --enable-foo and --disable-foo command line args.
163# Distributions want to ensure that several features are compiled in, and it
164# is impossible without a --enable-foo that exits if a feature is not found.
165
166bluez=""
167brlapi=""
168curl=""
169curses=""
170docs=""
171fdt=""
Vincenzo Maffione58952132013-11-06 11:44:06 +0100172netmap="no"
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +0200173pixman=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100174sdl=""
Meador Inge983eef52012-02-24 14:00:42 +0530175virtfs=""
Jes Sorensen821601e2011-03-16 13:33:36 +0100176vnc="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100177sparse="no"
178uuid=""
179vde=""
180vnc_tls=""
181vnc_sasl=""
182vnc_jpeg=""
183vnc_png=""
Tim Hardeck7536ee42013-01-21 11:04:44 +0100184vnc_ws=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100185xen=""
Anthony PERARDd5b93dd2011-02-25 16:20:34 +0000186xen_ctrl_version=""
Anthony PERARDeb6fda02012-06-21 15:32:59 +0000187xen_pci_passthrough=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100188linux_aio=""
Corey Bryant47e98652012-01-26 09:42:26 -0500189cap_ng=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100190attr=""
Avi Kivity4f26f2b2011-11-09 14:44:52 +0200191libattr=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100192xfs=""
193
Bradd41a75a2011-07-26 23:11:26 -0400194vhost_net="no"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000195vhost_scsi="no"
Bradd41a75a2011-07-26 23:11:26 -0400196kvm="no"
Michael R. Hines2da776d2013-07-22 10:01:54 -0400197rdma=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100198gprof="no"
199debug_tcg="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100200debug="no"
201strip_opt="yes"
Stefan Weil9195b2c2011-10-19 07:07:18 +0200202tcg_interpreter="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100203bigendian="no"
204mingw32="no"
Blue Swirl1d728c32012-05-01 18:45:39 +0000205gcov="no"
206gcov_tool="gcov"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100207EXESUF=""
208prefix="/usr/local"
209mandir="\${prefix}/share/man"
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300210datadir="\${prefix}/share"
Eduardo Habkost850da182012-04-18 16:55:38 -0300211qemu_docdir="\${prefix}/share/doc/qemu"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100212bindir="\${prefix}/bin"
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300213libdir="\${prefix}/lib"
Michael Tokarev8bf188a2012-06-07 01:11:00 +0400214libexecdir="\${prefix}/libexec"
Alon Levy0f94d6d2011-06-27 11:58:20 +0200215includedir="\${prefix}/include"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100216sysconfdir="\${prefix}/etc"
Luiz Capitulino785c23a2012-10-03 18:35:57 -0300217local_statedir="\${prefix}/var"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100218confsuffix="/qemu"
219slirp="yes"
220fmod_lib=""
221fmod_inc=""
222oss_lib=""
223bsd="no"
224linux="no"
225solaris="no"
226profiler="no"
227cocoa="no"
228softmmu="yes"
229linux_user="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100230bsd_user="no"
Peter Maydell30163d82012-10-09 03:16:49 +0000231guest_base="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100232uname_release=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100233aix="no"
234blobs="yes"
235pkgversion=""
Avi Kivity40d64442011-11-15 20:12:17 +0200236pie=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100237zero_malloc=""
Paolo Bonzini3556c232013-05-10 14:16:40 +0200238qom_cast_debug="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100239trace_backend="nop"
240trace_file="trace"
241spice=""
242rbd=""
Robert Relyea111a38b2010-11-28 16:36:38 +0200243smartcard_nss=""
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +0100244libusb=""
Hans de Goede69354a82011-07-19 11:04:10 +0200245usb_redir=""
Michael Walleb1e5fff2013-03-06 20:23:32 +0100246glx=""
Alon Levy1ece9902011-07-26 12:30:40 +0300247zlib="yes"
Michael Tokareve8ef31a2013-07-31 14:22:07 +0400248guest_agent=""
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -0400249guest_agent_with_vss="no"
250vss_win32_sdk=""
251win_sdk="no"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +0100252want_tools="yes"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100253libiscsi=""
Peter Lieven6542aa92014-02-03 10:26:13 +0100254libnfs=""
Alex Barcelo519175a2012-02-28 12:25:50 +0100255coroutine=""
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +0200256coroutine_pool=""
Eduardo Otubof7945732012-08-14 18:44:05 -0300257seccomp=""
Bharata B Raoeb100392012-09-24 14:42:45 +0530258glusterfs=""
Bharata B Rao0c14fb42013-07-16 21:47:42 +0530259glusterfs_discard="no"
Bharata B Rao7c815372013-12-21 14:51:25 +0530260glusterfs_zerofill="no"
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +0100261virtio_blk_data_plane=""
Anthony Liguoria4ccabc2013-02-20 07:43:20 -0600262gtk=""
Daniel P. Berrange528de902013-02-25 15:20:44 +0000263gtkabi="2.0"
Stefan Bergerab214c22013-02-27 12:47:52 -0500264tpm="no"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +0100265libssh2=""
Jeff Cody4f18b782013-10-30 10:44:39 -0400266vhdx=""
Benoît Canet95c6bff2014-02-21 22:21:15 +0100267quorum="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100268
aliguoriac0df512008-12-29 17:14:15 +0000269# parse CC options first
270for opt do
271 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
272 case "$opt" in
273 --cross-prefix=*) cross_prefix="$optarg"
274 ;;
Paolo Bonzini3d8df642010-12-23 11:43:48 +0100275 --cc=*) CC="$optarg"
aliguoriac0df512008-12-29 17:14:15 +0000276 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400277 --cxx=*) CXX="$optarg"
278 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100279 --source-path=*) source_path="$optarg"
280 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200281 --cpu=*) cpu="$optarg"
282 ;;
Juan Quintelaa558ee12009-08-03 14:46:21 +0200283 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +0100284 EXTRA_CFLAGS="$optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200285 ;;
286 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +0100287 EXTRA_LDFLAGS="$optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200288 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100289 --enable-debug-info) debug_info="yes"
290 ;;
291 --disable-debug-info) debug_info="no"
292 ;;
aliguoriac0df512008-12-29 17:14:15 +0000293 esac
294done
aliguoriac0df512008-12-29 17:14:15 +0000295# OS specific
296# Using uname is really, really broken. Once we have the right set of checks
Stefan Weil93148aa2012-02-26 18:46:12 +0100297# we can eliminate its usage altogether.
aliguoriac0df512008-12-29 17:14:15 +0000298
Peter Maydelle49d0212012-12-07 15:39:13 +0000299# Preferred compiler:
300# ${CC} (if set)
301# ${cross_prefix}gcc (if cross-prefix specified)
302# system compiler
303if test -z "${CC}${cross_prefix}"; then
304 cc="$host_cc"
305else
306 cc="${CC-${cross_prefix}gcc}"
307fi
308
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400309if test -z "${CXX}${cross_prefix}"; then
310 cxx="c++"
311else
312 cxx="${CXX-${cross_prefix}g++}"
313fi
314
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500315ar="${AR-${cross_prefix}ar}"
Blue Swirl3dd46c72013-01-05 10:10:27 +0000316as="${AS-${cross_prefix}as}"
317cpp="${CPP-$cc -E}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500318objcopy="${OBJCOPY-${cross_prefix}objcopy}"
319ld="${LD-${cross_prefix}ld}"
Brad3f534582011-08-13 20:30:14 -0400320libtool="${LIBTOOL-${cross_prefix}libtool}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500321strip="${STRIP-${cross_prefix}strip}"
322windres="${WINDRES-${cross_prefix}windres}"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300323pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
324query_pkg_config() {
325 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
326}
327pkg_config=query_pkg_config
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500328sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
aliguoriac0df512008-12-29 17:14:15 +0000329
Peter Maydell45d285a2013-10-21 21:03:06 +0100330# If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
331ARFLAGS="${ARFLAGS-rv}"
332
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200333# default flags for all hosts
334QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
Mike Frysingerf9188222011-05-17 17:08:43 -0400335QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
Kevin Wolfc95e3082013-02-22 21:08:51 +0100336QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200337QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Paolo Bonzini6b4c3052012-10-24 13:12:00 +0200338QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100339if test "$debug_info" = "yes"; then
340 CFLAGS="-g $CFLAGS"
341 LDFLAGS="-g $LDFLAGS"
342fi
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200343
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100344# make source path absolute
345source_path=`cd "$source_path"; pwd`
346
aliguoriac0df512008-12-29 17:14:15 +0000347check_define() {
348cat > $TMPC <<EOF
349#if !defined($1)
Peter Maydellfd786e12011-11-23 17:26:43 +0000350#error $1 not defined
aliguoriac0df512008-12-29 17:14:15 +0000351#endif
352int main(void) { return 0; }
353EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200354 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000355}
356
Peter Maydellbbea4052012-08-14 15:35:34 +0100357if check_define __linux__ ; then
358 targetos="Linux"
359elif check_define _WIN32 ; then
360 targetos='MINGW32'
361elif check_define __OpenBSD__ ; then
362 targetos='OpenBSD'
363elif check_define __sun__ ; then
364 targetos='SunOS'
365elif check_define __HAIKU__ ; then
366 targetos='Haiku'
367else
368 targetos=`uname -s`
369fi
370
371# Some host OSes need non-standard checks for which CPU to use.
372# Note that these checks are broken for cross-compilation: if you're
373# cross-compiling to one of these OSes then you'll need to specify
374# the correct CPU with the --cpu option.
375case $targetos in
376Darwin)
377 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
378 # run 64-bit userspace code.
379 # If the user didn't specify a CPU explicitly and the kernel says this is
380 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
381 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
382 cpu="x86_64"
383 fi
384 ;;
385SunOS)
386 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
387 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
388 cpu="x86_64"
389 fi
390esac
391
Juan Quintela2ff6b912009-08-03 14:45:55 +0200392if test ! -z "$cpu" ; then
393 # command line argument
394 :
395elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000396 cpu="i386"
397elif check_define __x86_64__ ; then
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700398 if check_define __ILP32__ ; then
399 cpu="x32"
400 else
401 cpu="x86_64"
402 fi
blueswir13aa9bd62008-12-31 16:55:26 +0000403elif check_define __sparc__ ; then
blueswir13aa9bd62008-12-31 16:55:26 +0000404 if check_define __arch64__ ; then
405 cpu="sparc64"
406 else
407 cpu="sparc"
408 fi
malcfdf7ed92009-01-14 18:39:52 +0000409elif check_define _ARCH_PPC ; then
410 if check_define _ARCH_PPC64 ; then
411 cpu="ppc64"
412 else
413 cpu="ppc"
414 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200415elif check_define __mips__ ; then
416 cpu="mips"
Aurelien Jarno477ba622010-03-29 02:12:51 +0200417elif check_define __ia64__ ; then
418 cpu="ia64"
Aurelien Jarnod66ed0e2010-06-13 12:28:21 +0200419elif check_define __s390__ ; then
420 if check_define __s390x__ ; then
421 cpu="s390x"
422 else
423 cpu="s390"
424 fi
Peter Maydell21d89f82011-11-30 10:57:48 +0100425elif check_define __arm__ ; then
426 cpu="arm"
Claudio Fontana1f080312013-06-12 16:20:23 +0100427elif check_define __aarch64__ ; then
428 cpu="aarch64"
Bradf28ffed2011-09-07 21:24:56 -0400429elif check_define __hppa__ ; then
430 cpu="hppa"
aliguoriac0df512008-12-29 17:14:15 +0000431else
malcfdf7ed92009-01-14 18:39:52 +0000432 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +0000433fi
434
Peter Maydell359bc952011-12-24 13:07:25 +0000435ARCH=
436# Normalise host CPU name and set ARCH.
437# Note that this case should only have supported host CPUs, not guests.
bellard7d132992003-03-06 23:23:54 +0000438case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700439 ia64|ppc|ppc64|s390|s390x|sparc64|x32)
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200440 cpu="$cpu"
441 ;;
bellard7d132992003-03-06 23:23:54 +0000442 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000443 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000444 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000445 x86_64|amd64)
446 cpu="x86_64"
447 ;;
Peter Maydell21d89f82011-11-30 10:57:48 +0100448 armv*b|armv*l|arm)
449 cpu="arm"
bellard7d132992003-03-06 23:23:54 +0000450 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +0100451 aarch64)
452 cpu="aarch64"
453 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200454 mips*)
455 cpu="mips"
456 ;;
blueswir131422552007-04-16 18:27:06 +0000457 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000458 cpu="sparc"
459 ;;
bellard7d132992003-03-06 23:23:54 +0000460 *)
Peter Maydell359bc952011-12-24 13:07:25 +0000461 # This will result in either an error or falling back to TCI later
462 ARCH=unknown
bellard7d132992003-03-06 23:23:54 +0000463 ;;
464esac
Peter Maydell359bc952011-12-24 13:07:25 +0000465if test -z "$ARCH"; then
466 ARCH="$cpu"
467fi
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200468
bellard7d132992003-03-06 23:23:54 +0000469# OS specific
Juan Quintela0dbfc672009-08-03 14:46:13 +0200470
bellard7d132992003-03-06 23:23:54 +0000471case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000472CYGWIN*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200473 mingw32="yes"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200474 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
malcd5631632009-10-10 01:13:41 +0400475 audio_possible_drivers="winwave sdl"
476 audio_drv_list="winwave"
bellardc326e0a2005-04-23 18:30:28 +0000477;;
bellard67b915a2004-03-31 23:37:16 +0000478MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200479 mingw32="yes"
malcd5631632009-10-10 01:13:41 +0400480 audio_possible_drivers="winwave dsound sdl fmod"
481 audio_drv_list="winwave"
bellard67b915a2004-03-31 23:37:16 +0000482;;
ths5c40d2b2007-06-23 16:03:36 +0000483GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100484 bsd="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200485 audio_drv_list="oss"
486 audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000487;;
bellard7d3505c2004-05-12 19:32:15 +0000488FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200489 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100490 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200491 audio_drv_list="oss"
492 audio_possible_drivers="oss sdl esd pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100493 # needed for kinfo_getvmmap(3) in libutil.h
494 LIBS="-lutil $LIBS"
Vincenzo Maffione58952132013-11-06 11:44:06 +0100495 netmap="" # enable netmap autodetect
bellard7d3505c2004-05-12 19:32:15 +0000496;;
blueswir1c5e97232009-03-07 20:06:23 +0000497DragonFly)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200498 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100499 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200500 audio_drv_list="oss"
501 audio_possible_drivers="oss sdl esd pa"
blueswir1c5e97232009-03-07 20:06:23 +0000502;;
bellard7d3505c2004-05-12 19:32:15 +0000503NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200504 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100505 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200506 audio_drv_list="oss"
507 audio_possible_drivers="oss sdl esd"
508 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000509;;
510OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200511 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100512 make="${MAKE-gmake}"
Brad Smith4f6ab392013-05-24 19:01:07 -0400513 audio_drv_list="sdl"
514 audio_possible_drivers="sdl esd"
bellard7d3505c2004-05-12 19:32:15 +0000515;;
bellard83fb7ad2004-07-05 21:25:26 +0000516Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200517 bsd="yes"
518 darwin="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200519 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200520 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200521 LDFLAGS="-arch x86_64 $LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200522 else
Juan Quintelaa558ee12009-08-03 14:46:21 +0200523 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200524 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200525 cocoa="yes"
526 audio_drv_list="coreaudio"
527 audio_possible_drivers="coreaudio sdl fmod"
528 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200529 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
Peter Maydella0b7cf62012-08-11 22:34:39 +0100530 # Disable attempts to use ObjectiveC features in os/object.h since they
531 # won't work when we're compiling with gcc as a C compiler.
532 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
bellard83fb7ad2004-07-05 21:25:26 +0000533;;
bellardec530c82006-04-25 22:36:06 +0000534SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200535 solaris="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100536 make="${MAKE-gmake}"
537 install="${INSTALL-ginstall}"
Blue Swirlfa589482009-10-02 19:38:25 +0000538 ld="gld"
Brade2d88302011-09-02 16:53:28 -0400539 smbd="${SMBD-/usr/sfw/sbin/smbd}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200540 needs_libsunmath="no"
541 solarisrev=`uname -r | cut -f2 -d.`
Juan Quintela0dbfc672009-08-03 14:46:13 +0200542 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
543 if test "$solarisrev" -le 9 ; then
544 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
545 needs_libsunmath="yes"
Juan Quintelaf14bfdf2009-08-03 14:47:11 +0200546 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
547 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
548 LIBS="-lsunmath $LIBS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200549 else
Peter Maydell76ad07a2013-04-08 12:11:26 +0100550 error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
551 "libsunmath from the Sun Studio compilers tools, due to a lack of" \
552 "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
553 "Studio 11 can be downloaded from www.sun.com."
Juan Quintela0dbfc672009-08-03 14:46:13 +0200554 fi
thsef18c882007-09-16 22:12:39 +0000555 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200556 fi
557 if test -f /usr/include/sys/soundcard.h ; then
558 audio_drv_list="oss"
559 fi
560 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000561# needed for CMSG_ macros in sys/socket.h
562 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
563# needed for TIOCWIN* defines in termios.h
564 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200565 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
Andreas Färber560d3752012-04-30 18:00:55 +0200566 solarisnetlibs="-lsocket -lnsl -lresolv"
567 LIBS="$solarisnetlibs $LIBS"
568 libs_qga="$solarisnetlibs $libs_qga"
ths86b2bd92007-02-11 00:31:33 +0000569;;
malcb29fe3e2008-11-18 01:42:22 +0000570AIX)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200571 aix="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100572 make="${MAKE-gmake}"
malcb29fe3e2008-11-18 01:42:22 +0000573;;
Andreas Färber179cf402010-09-20 00:50:43 +0200574Haiku)
575 haiku="yes"
576 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
577 LIBS="-lposix_error_mapper -lnetwork $LIBS"
578;;
bellard1d14ffa2005-10-30 18:58:22 +0000579*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200580 audio_drv_list="oss"
581 audio_possible_drivers="oss alsa sdl esd pa"
582 linux="yes"
583 linux_user="yes"
Jan Kiszkaaf2be202011-06-23 10:05:12 +0200584 kvm="yes"
585 vhost_net="yes"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000586 vhost_scsi="yes"
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700587 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
malcc2de5c92008-06-28 19:13:06 +0000588 audio_possible_drivers="$audio_possible_drivers fmod"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200589 fi
Alexey Kardashevskiya5851402013-05-29 23:30:43 +1000590 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
bellardfb065182004-11-09 23:09:44 +0000591;;
bellard7d132992003-03-06 23:23:54 +0000592esac
593
bellard7d3505c2004-05-12 19:32:15 +0000594if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000595 if [ "$darwin" != "yes" ] ; then
Andreas Färber08de3942012-04-26 11:57:39 +0200596 bsd_user="yes"
bellard83fb7ad2004-07-05 21:25:26 +0000597 fi
bellard7d3505c2004-05-12 19:32:15 +0000598fi
599
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100600: ${make=${MAKE-make}}
601: ${install=${INSTALL-install}}
Stefan Weil52510f82013-11-14 19:07:03 +0100602: ${python=${PYTHON-python}}
Brade2d88302011-09-02 16:53:28 -0400603: ${smbd=${SMBD-/usr/sbin/smbd}}
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100604
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100605# Default objcc to clang if available, otherwise use CC
606if has clang; then
607 objcc=clang
608else
609 objcc="$cc"
610fi
611
Juan Quintela3457a3f2009-08-03 14:46:07 +0200612if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +0200613 EXESUF=".exe"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200614 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
Stefan Weile94a7932010-02-12 11:02:08 +0100615 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
616 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
Stefan Weilf7cf5d52012-03-10 11:14:32 +0100617 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
618cat > $TMPC << EOF
619int main(void) { return 0; }
620EOF
621 if compile_prog "" "-liberty" ; then
622 LIBS="-liberty $LIBS"
623 fi
Stefan Weilc5ec15e2012-04-07 09:23:38 +0200624 prefix="c:/Program Files/QEMU"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200625 mandir="\${prefix}"
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300626 datadir="\${prefix}"
Eduardo Habkost850da182012-04-18 16:55:38 -0300627 qemu_docdir="\${prefix}"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200628 bindir="\${prefix}"
629 sysconfdir="\${prefix}"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +0200630 local_statedir=
Paolo Bonzini683035d2010-05-26 16:08:28 +0200631 confsuffix=""
Stefan Hajnoczi368542b2012-03-27 08:26:18 +0100632 libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
Juan Quintela3457a3f2009-08-03 14:46:07 +0200633fi
634
Anthony Liguori487fefd2009-06-11 13:28:25 -0500635werror=""
bellard85aa5182007-11-11 20:17:03 +0000636
bellard7d132992003-03-06 23:23:54 +0000637for opt do
pbrooka46e4032006-04-29 23:05:22 +0000638 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000639 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000640 --help|-h) show_help=yes
641 ;;
Mike Frysinger99123e12011-04-07 01:12:28 -0400642 --version|-V) exec cat $source_path/VERSION
643 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000644 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000645 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000646 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000647 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100648 --source-path=*)
bellard7d132992003-03-06 23:23:54 +0000649 ;;
aliguoriac0df512008-12-29 17:14:15 +0000650 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000651 ;;
aliguoriac0df512008-12-29 17:14:15 +0000652 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000653 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000654 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000655 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400656 --cxx=*)
657 ;;
Michael S. Tsirkine007dbe2013-11-24 11:38:05 +0200658 --iasl=*) iasl="$optarg"
659 ;;
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100660 --objcc=*) objcc="$optarg"
661 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000662 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000663 ;;
pbrook6a882642006-04-17 13:57:12 +0000664 --install=*) install="$optarg"
665 ;;
Blue Swirlc886edf2011-07-22 21:08:09 +0000666 --python=*) python="$optarg"
667 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +0000668 --gcov=*) gcov_tool="$optarg"
669 ;;
Brade2d88302011-09-02 16:53:28 -0400670 --smbd=*) smbd="$optarg"
671 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200672 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000673 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200674 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000675 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100676 --enable-debug-info)
677 ;;
678 --disable-debug-info)
679 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200680 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000681 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000682 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000683 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100684 --enable-trace-backend=*) trace_backend="$optarg"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +0100685 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100686 --with-trace-file=*) trace_file="$optarg"
Prerna Saxena9410b562010-07-13 09:26:32 +0100687 ;;
bellard7d132992003-03-06 23:23:54 +0000688 --enable-gprof) gprof="yes"
689 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +0000690 --enable-gcov) gcov="yes"
691 ;;
Loïc Minier79427692010-01-31 12:23:45 +0100692 --static)
693 static="yes"
694 LDFLAGS="-static $LDFLAGS"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300695 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
bellard43ce4df2003-06-09 19:53:12 +0000696 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200697 --mandir=*) mandir="$optarg"
698 ;;
699 --bindir=*) bindir="$optarg"
700 ;;
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300701 --libdir=*) libdir="$optarg"
702 ;;
Michael Tokarev8bf188a2012-06-07 01:11:00 +0400703 --libexecdir=*) libexecdir="$optarg"
704 ;;
Alon Levy0f94d6d2011-06-27 11:58:20 +0200705 --includedir=*) includedir="$optarg"
706 ;;
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300707 --datadir=*) datadir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200708 ;;
Eduardo Habkost023d3d62012-04-18 16:55:50 -0300709 --with-confsuffix=*) confsuffix="$optarg"
710 ;;
Eduardo Habkost850da182012-04-18 16:55:38 -0300711 --docdir=*) qemu_docdir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200712 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +0100713 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -0600714 ;;
Luiz Capitulino785c23a2012-10-03 18:35:57 -0300715 --localstatedir=*) local_statedir="$optarg"
716 ;;
717 --sbindir=*|--sharedstatedir=*|\
Max Filippov023ddd72011-11-24 16:11:31 +0400718 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
719 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
720 # These switches are silently ignored, for compatibility with
721 # autoconf-generated configure scripts. This allows QEMU's
722 # configure to be used by RPM and similar macros that set
723 # lots of directory switches by default.
724 ;;
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +0200725 --with-system-pixman) pixman="system"
726 ;;
727 --without-system-pixman) pixman="internal"
728 ;;
Robert Schiele74880fe2012-12-04 16:58:08 +0100729 --without-pixman) pixman="none"
730 ;;
bellard97a847b2003-08-10 21:36:04 +0000731 --disable-sdl) sdl="no"
732 ;;
Juan Quintelac4198152009-08-12 18:29:53 +0200733 --enable-sdl) sdl="yes"
734 ;;
Paolo Bonzini3556c232013-05-10 14:16:40 +0200735 --disable-qom-cast-debug) qom_cast_debug="no"
736 ;;
737 --enable-qom-cast-debug) qom_cast_debug="yes"
738 ;;
Meador Inge983eef52012-02-24 14:00:42 +0530739 --disable-virtfs) virtfs="no"
740 ;;
741 --enable-virtfs) virtfs="yes"
742 ;;
Jes Sorensen821601e2011-03-16 13:33:36 +0100743 --disable-vnc) vnc="no"
744 ;;
745 --enable-vnc) vnc="yes"
746 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000747 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000748 ;;
malcc2de5c92008-06-28 19:13:06 +0000749 --fmod-inc=*) fmod_inc="$optarg"
750 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000751 --oss-lib=*) oss_lib="$optarg"
752 ;;
malc0c58ac12008-06-25 21:04:05 +0000753 --audio-drv-list=*) audio_drv_list="$optarg"
754 ;;
Fam Zhengb64ec4e2013-05-29 19:35:40 +0800755 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
756 ;;
757 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
Markus Armbrustereb852012009-10-27 18:41:44 +0100758 ;;
aurel32f8393942009-04-13 18:45:38 +0000759 --enable-debug-tcg) debug_tcg="yes"
760 ;;
761 --disable-debug-tcg) debug_tcg="no"
762 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100763 --enable-debug)
764 # Enable debugging options that aren't excessively noisy
765 debug_tcg="yes"
766 debug="yes"
767 strip_opt="no"
768 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000769 --enable-sparse) sparse="yes"
770 ;;
771 --disable-sparse) sparse="no"
772 ;;
aliguori1625af82009-04-05 17:41:02 +0000773 --disable-strip) strip_opt="no"
774 ;;
ths8d5d2d42007-08-25 01:37:51 +0000775 --disable-vnc-tls) vnc_tls="no"
776 ;;
Juan Quintela1be10ad2009-08-12 18:20:28 +0200777 --enable-vnc-tls) vnc_tls="yes"
778 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000779 --disable-vnc-sasl) vnc_sasl="no"
780 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +0200781 --enable-vnc-sasl) vnc_sasl="yes"
782 ;;
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200783 --disable-vnc-jpeg) vnc_jpeg="no"
784 ;;
785 --enable-vnc-jpeg) vnc_jpeg="yes"
786 ;;
Corentin Charyefe556a2010-07-07 20:57:56 +0200787 --disable-vnc-png) vnc_png="no"
788 ;;
789 --enable-vnc-png) vnc_png="yes"
790 ;;
Tim Hardeck7536ee42013-01-21 11:04:44 +0100791 --disable-vnc-ws) vnc_ws="no"
792 ;;
793 --enable-vnc-ws) vnc_ws="yes"
794 ;;
bellard443f1372004-06-04 11:13:20 +0000795 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000796 ;;
Stefan Weilee682d22009-10-01 20:10:37 +0200797 --disable-uuid) uuid="no"
798 ;;
799 --enable-uuid) uuid="yes"
800 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000801 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000802 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +0200803 --enable-vde) vde="yes"
804 ;;
Vincenzo Maffione58952132013-11-06 11:44:06 +0100805 --disable-netmap) netmap="no"
806 ;;
807 --enable-netmap) netmap="yes"
808 ;;
aliguorie37630c2009-04-22 15:19:10 +0000809 --disable-xen) xen="no"
810 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +0200811 --enable-xen) xen="yes"
812 ;;
Anthony PERARDeb6fda02012-06-21 15:32:59 +0000813 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
814 ;;
815 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
816 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000817 --disable-brlapi) brlapi="no"
818 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200819 --enable-brlapi) brlapi="yes"
820 ;;
balrogfb599c92008-09-28 23:49:55 +0000821 --disable-bluez) bluez="no"
822 ;;
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200823 --enable-bluez) bluez="yes"
824 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000825 --disable-kvm) kvm="no"
826 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +0200827 --enable-kvm) kvm="yes"
828 ;;
Stefan Weil9195b2c2011-10-19 07:07:18 +0200829 --disable-tcg-interpreter) tcg_interpreter="no"
830 ;;
831 --enable-tcg-interpreter) tcg_interpreter="yes"
832 ;;
Corey Bryant47e98652012-01-26 09:42:26 -0500833 --disable-cap-ng) cap_ng="no"
834 ;;
835 --enable-cap-ng) cap_ng="yes"
836 ;;
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +0100837 --disable-spice) spice="no"
838 ;;
839 --enable-spice) spice="yes"
840 ;;
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100841 --disable-libiscsi) libiscsi="no"
842 ;;
843 --enable-libiscsi) libiscsi="yes"
844 ;;
Peter Lieven6542aa92014-02-03 10:26:13 +0100845 --disable-libnfs) libnfs="no"
846 ;;
847 --enable-libnfs) libnfs="yes"
848 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000849 --enable-profiler) profiler="yes"
850 ;;
Pavel Borzenkov14821032011-11-10 22:40:07 +0400851 --disable-cocoa) cocoa="no"
852 ;;
malcc2de5c92008-06-28 19:13:06 +0000853 --enable-cocoa)
854 cocoa="yes" ;
855 sdl="no" ;
856 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000857 ;;
pbrookcad25d62006-03-19 16:31:11 +0000858 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000859 ;;
pbrookcad25d62006-03-19 16:31:11 +0000860 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000861 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -1000862 --disable-user)
863 linux_user="no" ;
864 bsd_user="no" ;
Zachary Amsden0953a802009-07-30 00:14:59 -1000865 ;;
866 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +0000867 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000868 ;;
ths831b7822007-01-18 20:06:33 +0000869 --enable-linux-user) linux_user="yes"
870 ;;
blueswir184778502008-10-26 20:33:16 +0000871 --disable-bsd-user) bsd_user="no"
872 ;;
873 --enable-bsd-user) bsd_user="yes"
874 ;;
Paul Brook379f6692009-07-17 12:48:08 +0100875 --enable-guest-base) guest_base="yes"
876 ;;
877 --disable-guest-base) guest_base="no"
878 ;;
Avi Kivity40d64442011-11-15 20:12:17 +0200879 --enable-pie) pie="yes"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300880 ;;
Avi Kivity40d64442011-11-15 20:12:17 +0200881 --disable-pie) pie="no"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300882 ;;
pbrookc5937222006-05-14 11:30:38 +0000883 --enable-uname-release=*) uname_release="$optarg"
884 ;;
bellard85aa5182007-11-11 20:17:03 +0000885 --enable-werror) werror="yes"
886 ;;
887 --disable-werror) werror="no"
888 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000889 --disable-curses) curses="no"
890 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +0200891 --enable-curses) curses="yes"
892 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200893 --disable-curl) curl="no"
894 ;;
Juan Quintela788c8192009-08-12 18:29:47 +0200895 --enable-curl) curl="yes"
896 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +0200897 --disable-fdt) fdt="no"
898 ;;
899 --enable-fdt) fdt="yes"
900 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200901 --disable-linux-aio) linux_aio="no"
902 ;;
903 --enable-linux-aio) linux_aio="yes"
904 ;;
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700905 --disable-attr) attr="no"
906 ;;
907 --enable-attr) attr="yes"
908 ;;
ths77755342008-11-27 15:45:16 +0000909 --disable-blobs) blobs="no"
910 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000911 --with-pkgversion=*) pkgversion=" ($optarg)"
912 ;;
Alex Barcelo519175a2012-02-28 12:25:50 +0100913 --with-coroutine=*) coroutine="$optarg"
914 ;;
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +0200915 --disable-coroutine-pool) coroutine_pool="no"
916 ;;
917 --enable-coroutine-pool) coroutine_pool="yes"
918 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200919 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500920 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200921 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +0200922 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200923 --disable-vhost-net) vhost_net="no"
924 ;;
925 --enable-vhost-net) vhost_net="yes"
926 ;;
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000927 --disable-vhost-scsi) vhost_scsi="no"
928 ;;
929 --enable-vhost-scsi) vhost_scsi="yes"
930 ;;
Michael Walleb1e5fff2013-03-06 20:23:32 +0100931 --disable-glx) glx="no"
Michael Walle20ff0752011-03-07 23:32:39 +0100932 ;;
Michael Walleb1e5fff2013-03-06 20:23:32 +0100933 --enable-glx) glx="yes"
Michael Walle20ff0752011-03-07 23:32:39 +0100934 ;;
Christian Brunnerf27aaf42010-12-06 20:53:01 +0100935 --disable-rbd) rbd="no"
936 ;;
937 --enable-rbd) rbd="yes"
938 ;;
Sergei Trofimovich8c84cf12012-01-24 20:42:40 +0300939 --disable-xfsctl) xfs="no"
940 ;;
941 --enable-xfsctl) xfs="yes"
942 ;;
Robert Relyea111a38b2010-11-28 16:36:38 +0200943 --disable-smartcard-nss) smartcard_nss="no"
944 ;;
945 --enable-smartcard-nss) smartcard_nss="yes"
946 ;;
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +0100947 --disable-libusb) libusb="no"
948 ;;
949 --enable-libusb) libusb="yes"
950 ;;
Hans de Goede69354a82011-07-19 11:04:10 +0200951 --disable-usb-redir) usb_redir="no"
952 ;;
953 --enable-usb-redir) usb_redir="yes"
954 ;;
Alon Levy1ece9902011-07-26 12:30:40 +0300955 --disable-zlib-test) zlib="no"
956 ;;
Michael Rothd138cee2011-08-01 14:52:57 -0500957 --enable-guest-agent) guest_agent="yes"
958 ;;
959 --disable-guest-agent) guest_agent="no"
960 ;;
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -0400961 --with-vss-sdk) vss_win32_sdk=""
962 ;;
963 --with-vss-sdk=*) vss_win32_sdk="$optarg"
964 ;;
965 --without-vss-sdk) vss_win32_sdk="no"
966 ;;
967 --with-win-sdk) win_sdk=""
968 ;;
969 --with-win-sdk=*) win_sdk="$optarg"
970 ;;
971 --without-win-sdk) win_sdk="no"
972 ;;
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +0100973 --enable-tools) want_tools="yes"
974 ;;
975 --disable-tools) want_tools="no"
976 ;;
Eduardo Otubof7945732012-08-14 18:44:05 -0300977 --enable-seccomp) seccomp="yes"
978 ;;
979 --disable-seccomp) seccomp="no"
980 ;;
Bharata B Raoeb100392012-09-24 14:42:45 +0530981 --disable-glusterfs) glusterfs="no"
982 ;;
983 --enable-glusterfs) glusterfs="yes"
984 ;;
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +0100985 --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
986 ;;
987 --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
988 ;;
Anthony Liguoria4ccabc2013-02-20 07:43:20 -0600989 --disable-gtk) gtk="no"
990 ;;
991 --enable-gtk) gtk="yes"
992 ;;
Michael R. Hines2da776d2013-07-22 10:01:54 -0400993 --enable-rdma) rdma="yes"
994 ;;
995 --disable-rdma) rdma="no"
996 ;;
Daniel P. Berrange528de902013-02-25 15:20:44 +0000997 --with-gtkabi=*) gtkabi="$optarg"
998 ;;
Stefan Bergerab214c22013-02-27 12:47:52 -0500999 --enable-tpm) tpm="yes"
1000 ;;
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01001001 --disable-libssh2) libssh2="no"
1002 ;;
1003 --enable-libssh2) libssh2="yes"
1004 ;;
Jeff Cody4f18b782013-10-30 10:44:39 -04001005 --enable-vhdx) vhdx="yes"
1006 ;;
1007 --disable-vhdx) vhdx="no"
1008 ;;
Benoît Canet95c6bff2014-02-21 22:21:15 +01001009 --disable-quorum) quorum="no"
1010 ;;
1011 --enable-quorum) quorum="yes"
1012 ;;
balrog7f1559c2007-11-17 10:24:32 +00001013 *) echo "ERROR: unknown option $opt"; show_help="yes"
1014 ;;
bellard7d132992003-03-06 23:23:54 +00001015 esac
1016done
1017
Stefan Weilf6f0b7d2013-12-18 22:30:26 +01001018if ! has $python; then
1019 error_exit "Python not found. Use --python=/path/to/python"
1020fi
1021
1022# Note that if the Python conditional here evaluates True we will exit
1023# with status 1 which is a shell 'false' value.
1024if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1025 error_exit "Cannot use '$python', Python 2.4 or later is required." \
1026 "Note that Python 3 or later is not yet supported." \
1027 "Use --python=/path/to/python to specify a supported Python."
1028fi
1029
1030# The -B switch was added in Python 2.6.
1031# If it is supplied, compiled files are not written.
1032# Use it for Python versions which support it.
1033if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
1034 python="$python -B"
1035fi
1036
bellard40293e52008-01-31 11:32:10 +00001037case "$cpu" in
Richard Hendersone3608d62013-08-28 15:48:21 -07001038 ppc)
1039 CPU_CFLAGS="-m32"
1040 LDFLAGS="-m32 $LDFLAGS"
1041 ;;
1042 ppc64)
1043 CPU_CFLAGS="-m64"
1044 LDFLAGS="-m64 $LDFLAGS"
1045 ;;
Richard Henderson9b9c37c2012-09-21 10:34:21 -07001046 sparc)
Juan Quintelaed968ff2009-08-03 14:46:11 +02001047 LDFLAGS="-m32 $LDFLAGS"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001048 CPU_CFLAGS="-m32 -mcpu=ultrasparc"
blueswir131422552007-04-16 18:27:06 +00001049 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +02001050 sparc64)
Juan Quintelaed968ff2009-08-03 14:46:11 +02001051 LDFLAGS="-m64 $LDFLAGS"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001052 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
blueswir131422552007-04-16 18:27:06 +00001053 ;;
ths76d83bd2007-11-18 21:22:10 +00001054 s390)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001055 CPU_CFLAGS="-m31 -march=z990"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001056 LDFLAGS="-m31 $LDFLAGS"
1057 ;;
1058 s390x)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001059 CPU_CFLAGS="-m64 -march=z990"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001060 LDFLAGS="-m64 $LDFLAGS"
ths76d83bd2007-11-18 21:22:10 +00001061 ;;
bellard40293e52008-01-31 11:32:10 +00001062 i386)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001063 CPU_CFLAGS="-m32"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001064 LDFLAGS="-m32 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02001065 cc_i386='$(CC) -m32'
bellard40293e52008-01-31 11:32:10 +00001066 ;;
1067 x86_64)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001068 CPU_CFLAGS="-m64"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001069 LDFLAGS="-m64 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02001070 cc_i386='$(CC) -m32'
Paul Brook379f6692009-07-17 12:48:08 +01001071 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001072 x32)
1073 CPU_CFLAGS="-mx32"
1074 LDFLAGS="-mx32 $LDFLAGS"
1075 cc_i386='$(CC) -m32'
1076 ;;
Peter Maydell30163d82012-10-09 03:16:49 +00001077 # No special flags required for other host CPUs
blueswir131422552007-04-16 18:27:06 +00001078esac
1079
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001080QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1081EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1082
Peter Maydell60e0df22011-05-03 14:50:13 +01001083default_target_list=""
1084
Peter Maydell6e92f822013-05-20 16:16:15 +01001085mak_wilds=""
1086
1087if [ "$softmmu" = "yes" ]; then
1088 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001089fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001090if [ "$linux_user" = "yes" ]; then
1091 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001092fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001093if [ "$bsd_user" = "yes" ]; then
1094 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001095fi
1096
Peter Maydell6e92f822013-05-20 16:16:15 +01001097for config in $mak_wilds; do
1098 default_target_list="${default_target_list} $(basename "$config" .mak)"
1099done
1100
pbrookaf5db582006-04-08 14:26:41 +00001101if test x"$show_help" = x"yes" ; then
1102cat << EOF
1103
1104Usage: configure [options]
1105Options: [defaults in brackets after descriptions]
1106
Stefan Weil08fb77e2013-12-18 22:09:39 +01001107Standard options:
1108 --help print this message
1109 --prefix=PREFIX install in PREFIX [$prefix]
1110 --interp-prefix=PREFIX where to find shared libraries, etc.
1111 use %M for cpu name [$interp_prefix]
1112 --target-list=LIST set target list (default: build everything)
1113$(echo Available targets: $default_target_list | \
1114 fold -s -w 53 | sed -e 's/^/ /')
1115
1116Advanced options (experts only):
1117 --source-path=PATH path of source code [$source_path]
1118 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1119 --cc=CC use C compiler CC [$cc]
1120 --iasl=IASL use ACPI compiler IASL [$iasl]
1121 --host-cc=CC use C compiler CC [$host_cc] for code run at
1122 build time
1123 --cxx=CXX use C++ compiler CXX [$cxx]
1124 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1125 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
1126 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1127 --make=MAKE use specified make [$make]
1128 --install=INSTALL use specified install [$install]
1129 --python=PYTHON use specified python [$python]
1130 --smbd=SMBD use specified smbd [$smbd]
1131 --static enable static build [$static]
1132 --mandir=PATH install man pages in PATH
1133 --datadir=PATH install firmware in PATH$confsuffix
1134 --docdir=PATH install documentation in PATH$confsuffix
1135 --bindir=PATH install binaries in PATH
1136 --libdir=PATH install libraries in PATH
1137 --sysconfdir=PATH install config in PATH$confsuffix
1138 --localstatedir=PATH install local state in PATH (set at runtime on win32)
1139 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]
1140 --enable-debug-tcg enable TCG debugging
1141 --disable-debug-tcg disable TCG debugging (default)
1142 --enable-debug-info enable debugging information (default)
1143 --disable-debug-info disable debugging information
1144 --enable-debug enable common debug build options
1145 --enable-sparse enable sparse checker
1146 --disable-sparse disable sparse checker (default)
1147 --disable-strip disable stripping binaries
1148 --disable-werror disable compilation abort on warning
1149 --disable-sdl disable SDL
1150 --enable-sdl enable SDL
1151 --disable-gtk disable gtk UI
1152 --enable-gtk enable gtk UI
1153 --disable-virtfs disable VirtFS
1154 --enable-virtfs enable VirtFS
1155 --disable-vnc disable VNC
1156 --enable-vnc enable VNC
1157 --disable-cocoa disable Cocoa (Mac OS X only)
1158 --enable-cocoa enable Cocoa (default on Mac OS X)
1159 --audio-drv-list=LIST set audio drivers list:
1160 Available drivers: $audio_possible_drivers
1161 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1162 --block-drv-rw-whitelist=L
1163 set block driver read-write whitelist
1164 (affects only QEMU, not qemu-img)
1165 --block-drv-ro-whitelist=L
1166 set block driver read-only whitelist
1167 (affects only QEMU, not qemu-img)
1168 --disable-xen disable xen backend driver support
1169 --enable-xen enable xen backend driver support
1170 --disable-xen-pci-passthrough
1171 --enable-xen-pci-passthrough
1172 --disable-brlapi disable BrlAPI
1173 --enable-brlapi enable BrlAPI
1174 --disable-vnc-tls disable TLS encryption for VNC server
1175 --enable-vnc-tls enable TLS encryption for VNC server
1176 --disable-vnc-sasl disable SASL encryption for VNC server
1177 --enable-vnc-sasl enable SASL encryption for VNC server
1178 --disable-vnc-jpeg disable JPEG lossy compression for VNC server
1179 --enable-vnc-jpeg enable JPEG lossy compression for VNC server
1180 --disable-vnc-png disable PNG compression for VNC server (default)
1181 --enable-vnc-png enable PNG compression for VNC server
1182 --disable-vnc-ws disable Websockets support for VNC server
1183 --enable-vnc-ws enable Websockets support for VNC server
1184 --disable-curses disable curses output
1185 --enable-curses enable curses output
1186 --disable-curl disable curl connectivity
1187 --enable-curl enable curl connectivity
1188 --disable-fdt disable fdt device tree
1189 --enable-fdt enable fdt device tree
1190 --disable-bluez disable bluez stack connectivity
1191 --enable-bluez enable bluez stack connectivity
1192 --disable-slirp disable SLIRP userspace network connectivity
1193 --disable-kvm disable KVM acceleration support
1194 --enable-kvm enable KVM acceleration support
1195 --disable-rdma disable RDMA-based migration support
1196 --enable-rdma enable RDMA-based migration support
1197 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1198 --enable-system enable all system emulation targets
1199 --disable-system disable all system emulation targets
1200 --enable-user enable supported user emulation targets
1201 --disable-user disable all user emulation targets
1202 --enable-linux-user enable all linux usermode emulation targets
1203 --disable-linux-user disable all linux usermode emulation targets
1204 --enable-bsd-user enable all BSD usermode emulation targets
1205 --disable-bsd-user disable all BSD usermode emulation targets
1206 --enable-guest-base enable GUEST_BASE support for usermode
1207 emulation targets
1208 --disable-guest-base disable GUEST_BASE support
1209 --enable-pie build Position Independent Executables
1210 --disable-pie do not build Position Independent Executables
1211 --fmod-lib path to FMOD library
1212 --fmod-inc path to FMOD includes
1213 --oss-lib path to OSS library
1214 --enable-uname-release=R Return R for uname -r in usermode emulation
1215 --cpu=CPU Build for host CPU [$cpu]
1216 --disable-uuid disable uuid support
1217 --enable-uuid enable uuid support
1218 --disable-vde disable support for vde network
1219 --enable-vde enable support for vde network
1220 --disable-netmap disable support for netmap network
1221 --enable-netmap enable support for netmap network
1222 --disable-linux-aio disable Linux AIO support
1223 --enable-linux-aio enable Linux AIO support
1224 --disable-cap-ng disable libcap-ng support
1225 --enable-cap-ng enable libcap-ng support
1226 --disable-attr disables attr and xattr support
1227 --enable-attr enable attr and xattr support
1228 --disable-blobs disable installing provided firmware blobs
1229 --enable-docs enable documentation build
1230 --disable-docs disable documentation build
1231 --disable-vhost-net disable vhost-net acceleration support
1232 --enable-vhost-net enable vhost-net acceleration support
1233 --enable-trace-backend=B Set trace backend
1234 Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
1235 --with-trace-file=NAME Full PATH,NAME of file to store traces
1236 Default:trace-<pid>
1237 --disable-spice disable spice
1238 --enable-spice enable spice
1239 --enable-rbd enable building the rados block device (rbd)
1240 --disable-libiscsi disable iscsi support
1241 --enable-libiscsi enable iscsi support
Peter Lieven6542aa92014-02-03 10:26:13 +01001242 --disable-libnfs disable nfs support
1243 --enable-libnfs enable nfs support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001244 --disable-smartcard-nss disable smartcard nss support
1245 --enable-smartcard-nss enable smartcard nss support
1246 --disable-libusb disable libusb (for usb passthrough)
1247 --enable-libusb enable libusb (for usb passthrough)
1248 --disable-usb-redir disable usb network redirection support
1249 --enable-usb-redir enable usb network redirection support
1250 --disable-guest-agent disable building of the QEMU Guest Agent
1251 --enable-guest-agent enable building of the QEMU Guest Agent
1252 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1253 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1254 --disable-seccomp disable seccomp support
1255 --enable-seccomp enables seccomp support
1256 --with-coroutine=BACKEND coroutine backend. Supported options:
1257 gthread, ucontext, sigaltstack, windows
1258 --disable-coroutine-pool disable coroutine freelist (worse performance)
1259 --enable-coroutine-pool enable coroutine freelist (better performance)
1260 --enable-glusterfs enable GlusterFS backend
1261 --disable-glusterfs disable GlusterFS backend
1262 --enable-gcov enable test coverage analysis with gcov
1263 --gcov=GCOV use specified gcov [$gcov_tool]
1264 --enable-tpm enable TPM support
1265 --disable-libssh2 disable ssh block device support
1266 --enable-libssh2 enable ssh block device support
1267 --disable-vhdx disables support for the Microsoft VHDX image format
1268 --enable-vhdx enable support for the Microsoft VHDX image format
Benoît Canet95c6bff2014-02-21 22:21:15 +01001269 --disable-quorum disable quorum block filter support
1270 --enable-quorum enable quorum block filter support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001271
1272NOTE: The object files are built at the place where configure is launched
pbrookaf5db582006-04-08 14:26:41 +00001273EOF
pbrookaf5db582006-04-08 14:26:41 +00001274exit 1
1275fi
1276
Peter Maydell359bc952011-12-24 13:07:25 +00001277# Now we have handled --enable-tcg-interpreter and know we're not just
1278# printing the help message, bail out if the host CPU isn't supported.
1279if test "$ARCH" = "unknown"; then
1280 if test "$tcg_interpreter" = "yes" ; then
1281 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1282 ARCH=tci
1283 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001284 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
Peter Maydell359bc952011-12-24 13:07:25 +00001285 fi
1286fi
1287
Paolo Bonzini8d050952010-12-23 11:43:52 +01001288# check that the C compiler works.
1289cat > $TMPC <<EOF
Stefan Weil75cafad2011-12-17 09:27:29 +01001290int main(void) { return 0; }
Paolo Bonzini8d050952010-12-23 11:43:52 +01001291EOF
1292
1293if compile_object ; then
1294 : C compiler works ok
1295else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001296 error_exit "\"$cc\" either does not exist or does not work"
Paolo Bonzini8d050952010-12-23 11:43:52 +01001297fi
1298
Alexander Graf417c9d72012-07-09 14:38:08 +02001299# Consult white-list to determine whether to enable werror
1300# by default. Only enable by default for git builds
1301z_version=`cut -f3 -d. $source_path/VERSION`
1302
1303if test -z "$werror" ; then
Andreas Färber6c8fec82013-01-27 16:16:19 +01001304 if test -d "$source_path/.git" -a \
Alexander Graf417c9d72012-07-09 14:38:08 +02001305 "$linux" = "yes" ; then
1306 werror="yes"
1307 else
1308 werror="no"
1309 fi
1310fi
1311
Paolo Bonzini8d050952010-12-23 11:43:52 +01001312gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1313gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1314gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
Marc-André Lureau37746c52013-02-25 23:31:12 +01001315gcc_flags="-Wendif-labels $gcc_flags"
Peter Maydellc1556a82012-10-14 21:00:39 +01001316gcc_flags="-Wno-initializer-overrides $gcc_flags"
Peter Maydell71429092013-08-05 20:16:40 +01001317gcc_flags="-Wno-string-plus-int $gcc_flags"
Peter Maydell6ca026c2012-07-18 15:10:18 +01001318# Note that we do not add -Werror to gcc_flags here, because that would
1319# enable it for all configure tests. If a configure test failed due
1320# to -Werror this would just silently disable some features,
1321# so it's too error prone.
Paolo Bonzini8d050952010-12-23 11:43:52 +01001322cat > $TMPC << EOF
1323int main(void) { return 0; }
1324EOF
1325for flag in $gcc_flags; do
Peter Maydella1d29d62012-10-27 22:19:07 +01001326 # Use the positive sense of the flag when testing for -Wno-wombat
1327 # support (gcc will happily accept the -Wno- form of unknown
1328 # warning options).
1329 optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1330 if compile_prog "-Werror $optflag" "" ; then
Paolo Bonzini8d050952010-12-23 11:43:52 +01001331 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1332 fi
1333done
1334
Marc-André Lureau37746c52013-02-25 23:31:12 +01001335if compile_prog "-Werror -fstack-protector-all" "" ; then
1336 QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all"
1337 LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all"
1338fi
1339
Paolo Bonzinicbdd1992012-11-28 09:40:23 +01001340# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1341# large functions that use global variables. The bug is in all releases of
1342# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1343# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1344cat > $TMPC << EOF
1345#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1346int main(void) { return 0; }
1347#else
1348#error No bug in this compiler.
1349#endif
1350EOF
1351if compile_prog "-Werror -fno-gcse" "" ; then
1352 TRANSLATE_OPT_CFLAGS=-fno-gcse
1353fi
1354
Avi Kivity40d64442011-11-15 20:12:17 +02001355if test "$static" = "yes" ; then
1356 if test "$pie" = "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001357 error_exit "static and pie are mutually incompatible"
Avi Kivity40d64442011-11-15 20:12:17 +02001358 else
1359 pie="no"
1360 fi
1361fi
1362
1363if test "$pie" = ""; then
1364 case "$cpu-$targetos" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001365 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
Avi Kivity40d64442011-11-15 20:12:17 +02001366 ;;
1367 *)
1368 pie="no"
1369 ;;
1370 esac
1371fi
1372
1373if test "$pie" != "no" ; then
1374 cat > $TMPC << EOF
Avi Kivity21d4a792011-11-23 11:24:25 +02001375
1376#ifdef __linux__
1377# define THREAD __thread
1378#else
1379# define THREAD
1380#endif
1381
1382static THREAD int tls_var;
1383
1384int main(void) { return tls_var; }
1385
Avi Kivity40d64442011-11-15 20:12:17 +02001386EOF
1387 if compile_prog "-fPIE -DPIE" "-pie"; then
1388 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1389 LDFLAGS="-pie $LDFLAGS"
1390 pie="yes"
1391 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1392 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1393 fi
1394 else
1395 if test "$pie" = "yes"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001396 error_exit "PIE not available due to missing toolchain support"
Avi Kivity40d64442011-11-15 20:12:17 +02001397 else
1398 echo "Disabling PIE due to missing toolchain support"
1399 pie="no"
1400 fi
1401 fi
Brad46eef332013-12-10 19:49:08 -05001402
1403 if compile_prog "-fno-pie" "-nopie"; then
1404 CFLAGS_NOPIE="-fno-pie"
1405 LDFLAGS_NOPIE="-nopie"
1406 fi
Avi Kivity40d64442011-11-15 20:12:17 +02001407fi
1408
Paolo Bonzini09dada42013-04-17 16:26:47 +02001409##########################################
1410# __sync_fetch_and_and requires at least -march=i486. Many toolchains
1411# use i686 as default anyway, but for those that don't, an explicit
1412# specification is necessary
1413
1414if test "$cpu" = "i386"; then
1415 cat > $TMPC << EOF
1416static int sfaa(int *ptr)
1417{
1418 return __sync_fetch_and_and(ptr, 0);
1419}
1420
1421int main(void)
1422{
1423 int val = 42;
Stefan Weil1405b622013-05-11 21:46:58 +02001424 val = __sync_val_compare_and_swap(&val, 0, 1);
Paolo Bonzini09dada42013-04-17 16:26:47 +02001425 sfaa(&val);
1426 return val;
1427}
1428EOF
1429 if ! compile_prog "" "" ; then
1430 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1431 fi
1432fi
1433
1434#########################################
bellardec530c82006-04-25 22:36:06 +00001435# Solaris specific configure tool chain decisions
Paolo Bonzini09dada42013-04-17 16:26:47 +02001436
bellardec530c82006-04-25 22:36:06 +00001437if test "$solaris" = "yes" ; then
Loïc Minier6792aa12010-01-20 11:35:54 +01001438 if has $install; then
1439 :
1440 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001441 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1442 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1443 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
bellardec530c82006-04-25 22:36:06 +00001444 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001445 if test "`path_of $install`" = "/usr/sbin/install" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001446 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1447 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1448 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
bellardec530c82006-04-25 22:36:06 +00001449 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001450 if has ar; then
1451 :
1452 else
bellardec530c82006-04-25 22:36:06 +00001453 if test -f /usr/ccs/bin/ar ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001454 error_exit "No path includes ar" \
1455 "Add /usr/ccs/bin to your path and rerun configure"
bellardec530c82006-04-25 22:36:06 +00001456 fi
Peter Maydell76ad07a2013-04-08 12:11:26 +01001457 error_exit "No path includes ar"
bellardec530c82006-04-25 22:36:06 +00001458 fi
ths5fafdf22007-09-16 21:08:06 +00001459fi
bellardec530c82006-04-25 22:36:06 +00001460
Stefan Weilafb63eb2012-09-26 22:04:38 +02001461if test -z "${target_list+xxx}" ; then
Anthony Liguori121afa92012-09-14 08:17:03 -05001462 target_list="$default_target_list"
1463else
1464 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +00001465fi
Peter Maydell25b48332013-05-20 16:16:16 +01001466
1467# Check that we recognised the target name; this allows a more
1468# friendly error message than if we let it fall through.
1469for target in $target_list; do
1470 case " $default_target_list " in
1471 *" $target "*)
1472 ;;
1473 *)
1474 error_exit "Unknown target name '$target'"
1475 ;;
1476 esac
1477done
1478
Paolo Bonzinif55fe272010-05-26 16:08:17 +02001479# see if system emulation was really requested
1480case " $target_list " in
1481 *"-softmmu "*) softmmu=yes
1482 ;;
1483 *) softmmu=no
1484 ;;
1485esac
bellard5327cf42005-01-10 23:18:50 +00001486
Juan Quintela249247c2009-08-12 18:20:25 +02001487feature_not_found() {
1488 feature=$1
Stewart Smith21684af2014-01-24 12:39:10 +11001489 remedy=$2
Juan Quintela249247c2009-08-12 18:20:25 +02001490
Peter Maydell76ad07a2013-04-08 12:11:26 +01001491 error_exit "User requested feature $feature" \
Stewart Smith21684af2014-01-24 12:39:10 +11001492 "configure was not able to find it." \
1493 "$remedy"
Juan Quintela249247c2009-08-12 18:20:25 +02001494}
1495
bellard7d132992003-03-06 23:23:54 +00001496# ---
1497# big/little endian test
1498cat > $TMPC << EOF
Mike Frysinger61cc9192013-06-30 23:30:18 -04001499short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1500short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1501extern int foo(short *, short *);
1502int main(int argc, char *argv[]) {
1503 return foo(big_endian, little_endian);
bellard7d132992003-03-06 23:23:54 +00001504}
1505EOF
1506
Mike Frysinger61cc9192013-06-30 23:30:18 -04001507if compile_object ; then
1508 if grep -q BiGeNdIaN $TMPO ; then
1509 bigendian="yes"
1510 elif grep -q LiTtLeEnDiAn $TMPO ; then
1511 bigendian="no"
1512 else
1513 echo big/little test failed
Peter Maydell21d89f82011-11-30 10:57:48 +01001514 fi
Mike Frysinger61cc9192013-06-30 23:30:18 -04001515else
1516 echo big/little test failed
bellard7d132992003-03-06 23:23:54 +00001517fi
1518
Juan Quintelab0a47e72009-08-12 18:29:49 +02001519##########################################
Stefan Weil779ab5e2012-12-16 11:29:45 +01001520# pkg-config probe
1521
1522if ! has "$pkg_config_exe"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001523 error_exit "pkg-config binary '$pkg_config_exe' not found"
Stefan Weil779ab5e2012-12-16 11:29:45 +01001524fi
1525
1526##########################################
Juan Quintelab0a47e72009-08-12 18:29:49 +02001527# NPTL probe
1528
Peter Maydell24cb36a2013-07-16 18:45:00 +01001529if test "$linux_user" = "yes"; then
Juan Quintelab0a47e72009-08-12 18:29:49 +02001530 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00001531#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00001532#include <linux/futex.h>
Stefan Weil182eacc2011-12-17 09:27:30 +01001533int main(void) {
pbrookbd0c5662008-05-29 14:34:11 +00001534#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1535#error bork
1536#endif
Stefan Weil182eacc2011-12-17 09:27:30 +01001537 return 0;
pbrookbd0c5662008-05-29 14:34:11 +00001538}
1539EOF
Peter Maydell24cb36a2013-07-16 18:45:00 +01001540 if ! compile_object ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001541 feature_not_found "nptl" "Install glibc and linux kernel headers."
Juan Quintelab0a47e72009-08-12 18:29:49 +02001542 fi
pbrookbd0c5662008-05-29 14:34:11 +00001543fi
1544
bellard11d9f692004-04-02 20:55:59 +00001545##########################################
balrogac629222008-10-11 09:56:04 +00001546# zlib check
1547
Alon Levy1ece9902011-07-26 12:30:40 +03001548if test "$zlib" != "no" ; then
1549 cat > $TMPC << EOF
balrogac629222008-10-11 09:56:04 +00001550#include <zlib.h>
1551int main(void) { zlibVersion(); return 0; }
1552EOF
Alon Levy1ece9902011-07-26 12:30:40 +03001553 if compile_prog "" "-lz" ; then
1554 :
1555 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001556 error_exit "zlib check failed" \
1557 "Make sure to have the zlib libs and headers installed."
Alon Levy1ece9902011-07-26 12:30:40 +03001558 fi
balrogac629222008-10-11 09:56:04 +00001559fi
Paolo Bonzinif544a482013-04-17 16:26:44 +02001560libs_softmmu="$libs_softmmu -lz"
balrogac629222008-10-11 09:56:04 +00001561
1562##########################################
Eduardo Otubof7945732012-08-14 18:44:05 -03001563# libseccomp check
1564
1565if test "$seccomp" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02001566 if $pkg_config --atleast-version=2.1.0 libseccomp; then
Michael Tokarevb4451992013-01-19 18:58:09 +04001567 libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
Andreas Färber372e47e2013-04-28 16:27:26 +02001568 QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
Eduardo Otubof7945732012-08-14 18:44:05 -03001569 seccomp="yes"
1570 else
Eduardo Otubof7945732012-08-14 18:44:05 -03001571 if test "$seccomp" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11001572 feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
Eduardo Otubof7945732012-08-14 18:44:05 -03001573 fi
Yann E. MORINe84d5952012-09-06 22:40:30 +02001574 seccomp="no"
Eduardo Otubof7945732012-08-14 18:44:05 -03001575 fi
1576fi
1577##########################################
aliguorie37630c2009-04-22 15:19:10 +00001578# xen probe
1579
Juan Quintelafc321b42009-08-12 18:29:55 +02001580if test "$xen" != "no" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +02001581 xen_libs="-lxenstore -lxenctrl -lxenguest"
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001582
Stefan Weil50ced5b2011-12-17 09:27:39 +01001583 # First we test whether Xen headers and libraries are available.
1584 # If no, we are done and there is no Xen support.
1585 # If yes, more tests are run to detect the Xen version.
1586
1587 # Xen (any)
Juan Quintelab2266be2009-07-27 16:13:16 +02001588 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00001589#include <xenctrl.h>
Stefan Weil50ced5b2011-12-17 09:27:39 +01001590int main(void) {
1591 return 0;
1592}
1593EOF
1594 if ! compile_prog "" "$xen_libs" ; then
1595 # Xen not found
1596 if test "$xen" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001597 feature_not_found "xen" "Install xen devel"
Stefan Weil50ced5b2011-12-17 09:27:39 +01001598 fi
1599 xen=no
1600
1601 # Xen unstable
Peter Maydell69deef02012-08-02 18:30:26 +01001602 elif
1603 cat > $TMPC <<EOF &&
Stefan Weil50ced5b2011-12-17 09:27:39 +01001604#include <xenctrl.h>
Anthony PERARDe108a3c2012-06-21 11:44:35 +00001605#include <xenstore.h>
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001606#include <stdint.h>
1607#include <xen/hvm/hvm_info_table.h>
1608#if !defined(HVM_MAX_VCPUS)
1609# error HVM_MAX_VCPUS not defined
1610#endif
1611int main(void) {
1612 xc_interface *xc;
1613 xs_daemon_open();
1614 xc = xc_interface_open(0, 0, 0);
1615 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1616 xc_gnttab_open(NULL, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001617 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Stefano Stabellini8688e062012-04-17 17:04:18 +00001618 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1619 return 0;
1620}
1621EOF
1622 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001623 then
Stefano Stabellini8688e062012-04-17 17:04:18 +00001624 xen_ctrl_version=420
1625 xen=yes
1626
Peter Maydell69deef02012-08-02 18:30:26 +01001627 elif
1628 cat > $TMPC <<EOF &&
Stefano Stabellini8688e062012-04-17 17:04:18 +00001629#include <xenctrl.h>
1630#include <xs.h>
1631#include <stdint.h>
1632#include <xen/hvm/hvm_info_table.h>
1633#if !defined(HVM_MAX_VCPUS)
1634# error HVM_MAX_VCPUS not defined
1635#endif
1636int main(void) {
Stefano Stabellini8688e062012-04-17 17:04:18 +00001637 xs_daemon_open();
Peter Maydell9b4c0b52012-08-02 18:30:27 +01001638 xc_interface_open(0, 0, 0);
Stefano Stabellini8688e062012-04-17 17:04:18 +00001639 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1640 xc_gnttab_open(NULL, 0);
1641 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001642 return 0;
1643}
aliguorie37630c2009-04-22 15:19:10 +00001644EOF
Stefan Weil50ced5b2011-12-17 09:27:39 +01001645 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001646 then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001647 xen_ctrl_version=410
Juan Quintelafc321b42009-08-12 18:29:55 +02001648 xen=yes
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001649
1650 # Xen 4.0.0
Peter Maydell69deef02012-08-02 18:30:26 +01001651 elif
1652 cat > $TMPC <<EOF &&
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001653#include <xenctrl.h>
1654#include <xs.h>
1655#include <stdint.h>
1656#include <xen/hvm/hvm_info_table.h>
1657#if !defined(HVM_MAX_VCPUS)
1658# error HVM_MAX_VCPUS not defined
1659#endif
1660int main(void) {
Anthony PERARDb87de242011-05-24 14:34:20 +01001661 struct xen_add_to_physmap xatp = {
1662 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1663 };
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001664 xs_daemon_open();
1665 xc_interface_open();
1666 xc_gnttab_open();
1667 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001668 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001669 return 0;
1670}
1671EOF
1672 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001673 then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001674 xen_ctrl_version=400
1675 xen=yes
1676
Anthony PERARDb87de242011-05-24 14:34:20 +01001677 # Xen 3.4.0
Peter Maydell69deef02012-08-02 18:30:26 +01001678 elif
1679 cat > $TMPC <<EOF &&
Anthony PERARDb87de242011-05-24 14:34:20 +01001680#include <xenctrl.h>
1681#include <xs.h>
1682int main(void) {
1683 struct xen_add_to_physmap xatp = {
1684 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1685 };
1686 xs_daemon_open();
1687 xc_interface_open();
1688 xc_gnttab_open();
1689 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1690 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1691 return 0;
1692}
1693EOF
1694 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001695 then
Anthony PERARDb87de242011-05-24 14:34:20 +01001696 xen_ctrl_version=340
1697 xen=yes
1698
1699 # Xen 3.3.0
Peter Maydell69deef02012-08-02 18:30:26 +01001700 elif
1701 cat > $TMPC <<EOF &&
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001702#include <xenctrl.h>
1703#include <xs.h>
1704int main(void) {
1705 xs_daemon_open();
1706 xc_interface_open();
1707 xc_gnttab_open();
1708 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1709 return 0;
1710}
1711EOF
1712 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001713 then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001714 xen_ctrl_version=330
1715 xen=yes
1716
Stefan Weil50ced5b2011-12-17 09:27:39 +01001717 # Xen version unsupported
Juan Quintelab2266be2009-07-27 16:13:16 +02001718 else
Juan Quintelafc321b42009-08-12 18:29:55 +02001719 if test "$xen" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001720 feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
Juan Quintelafc321b42009-08-12 18:29:55 +02001721 fi
1722 xen=no
Juan Quintelab2266be2009-07-27 16:13:16 +02001723 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001724
1725 if test "$xen" = yes; then
1726 libs_softmmu="$xen_libs $libs_softmmu"
1727 fi
aliguorie37630c2009-04-22 15:19:10 +00001728fi
1729
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001730if test "$xen_pci_passthrough" != "no"; then
1731 if test "$xen" = "yes" && test "$linux" = "yes" &&
1732 test "$xen_ctrl_version" -ge 340; then
1733 xen_pci_passthrough=yes
1734 else
1735 if test "$xen_pci_passthrough" = "yes"; then
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001736 if test "$xen_ctrl_version" -lt 340; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001737 error_exit "User requested feature Xen PCI Passthrough" \
1738 "This feature does not work with Xen 3.3"
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001739 fi
Peter Maydell76ad07a2013-04-08 12:11:26 +01001740 error_exit "User requested feature Xen PCI Passthrough" \
1741 " but this feature requires /sys from Linux"
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001742 fi
1743 xen_pci_passthrough=no
1744 fi
1745fi
1746
aliguorie37630c2009-04-22 15:19:10 +00001747##########################################
Alon Levy44dc0ca2011-05-15 11:51:28 +03001748# libtool probe
1749
Brad3f534582011-08-13 20:30:14 -04001750if ! has $libtool; then
Alon Levy44dc0ca2011-05-15 11:51:28 +03001751 libtool=
Alon Levy44dc0ca2011-05-15 11:51:28 +03001752fi
1753
Peter Maydell8e515b12013-05-04 21:57:51 +01001754# MacOSX ships with a libtool which isn't the GNU one; weed this
1755# out by checking whether libtool supports the --version switch
1756if test -n "$libtool"; then
1757 if ! "$libtool" --version >/dev/null 2>&1; then
1758 libtool=
1759 fi
1760fi
1761
Alon Levy44dc0ca2011-05-15 11:51:28 +03001762##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02001763# Sparse probe
1764if test "$sparse" != "no" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001765 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02001766 sparse=yes
1767 else
1768 if test "$sparse" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001769 feature_not_found "sparse" "Install sparse binary"
Juan Quinteladfffc652009-08-12 18:29:57 +02001770 fi
1771 sparse=no
1772 fi
1773fi
1774
1775##########################################
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001776# GTK probe
1777
1778if test "$gtk" != "no"; then
Daniel P. Berrange528de902013-02-25 15:20:44 +00001779 gtkpackage="gtk+-$gtkabi"
1780 if test "$gtkabi" = "3.0" ; then
1781 gtkversion="3.0.0"
1782 vtepackage="vte-2.90"
1783 vteversion="0.32.0"
1784 else
1785 gtkversion="2.18.0"
1786 vtepackage="vte"
1787 vteversion="0.24.0"
1788 fi
Peter Maydell0d185e62013-07-18 16:42:01 +01001789 if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
1790 if test "$gtk" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001791 feature_not_found "gtk" "Install gtk2 or gtk3 (requires --with-gtkabi=3.0 option to configure) devel"
Peter Maydell0d185e62013-07-18 16:42:01 +01001792 fi
1793 gtk="no"
1794 elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
1795 if test "$gtk" = "yes" ; then
1796 error_exit "libvte not found (required for gtk support)"
1797 fi
1798 gtk="no"
1799 else
Stefan Weilca871ec2013-08-27 21:09:12 +02001800 gtk_cflags=`$pkg_config --cflags $gtkpackage`
1801 gtk_libs=`$pkg_config --libs $gtkpackage`
1802 vte_cflags=`$pkg_config --cflags $vtepackage`
1803 vte_libs=`$pkg_config --libs $vtepackage`
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001804 libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
1805 gtk="yes"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001806 fi
1807fi
1808
1809##########################################
bellard11d9f692004-04-02 20:55:59 +00001810# SDL probe
1811
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001812# Look for sdl configuration program (pkg-config or sdl-config). Try
1813# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1814if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1815 sdl_config=sdl-config
1816fi
1817
Stefan Weil65d5d3f2013-08-27 21:09:13 +02001818if $pkg_config sdl --exists; then
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001819 sdlconfig="$pkg_config sdl"
Stefan Weilfec0e3e2010-04-11 18:44:18 +02001820 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001821elif has ${sdl_config}; then
1822 sdlconfig="$sdl_config"
Paolo Bonzini9316f802010-01-13 09:52:55 +01001823 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00001824else
1825 if test "$sdl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001826 feature_not_found "sdl" "Install SDL devel"
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00001827 fi
1828 sdl=no
Paolo Bonzini9316f802010-01-13 09:52:55 +01001829fi
Scott Wood29e5bad2011-04-08 14:15:50 -05001830if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001831 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1832fi
bellard11d9f692004-04-02 20:55:59 +00001833
Paolo Bonzini9316f802010-01-13 09:52:55 +01001834sdl_too_old=no
Juan Quintelac4198152009-08-12 18:29:53 +02001835if test "$sdl" != "no" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001836 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00001837#include <SDL.h>
1838#undef main /* We don't want SDL to override our main() */
1839int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1840EOF
Paolo Bonzini9316f802010-01-13 09:52:55 +01001841 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
TeLeMan74f42e12010-02-08 13:56:44 +08001842 if test "$static" = "yes" ; then
1843 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1844 else
1845 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1846 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001847 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001848 if test "$_sdlversion" -lt 121 ; then
1849 sdl_too_old=yes
1850 else
1851 if test "$cocoa" = "no" ; then
1852 sdl=yes
1853 fi
1854 fi
aliguoricd01b4a2008-08-21 19:25:45 +00001855
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001856 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Juan Quintelaac119f92009-07-27 16:13:15 +02001857 if test "$sdl" = "yes" -a "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001858 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weilf8aa6c72010-03-01 22:10:46 +01001859 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1860 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
Juan Quintelaac119f92009-07-27 16:13:15 +02001861 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001862 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001863 :
1864 else
1865 sdl=no
1866 fi
1867 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02001868 else # sdl not found
1869 if test "$sdl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001870 feature_not_found "sdl" "Install SDL devel"
Juan Quintelac4198152009-08-12 18:29:53 +02001871 fi
1872 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02001873 fi # sdl compile test
Juan Quintelaa68551b2009-07-27 16:13:09 +02001874fi
bellard11d9f692004-04-02 20:55:59 +00001875
aliguori5368a422009-03-03 17:37:21 +00001876if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001877 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00001878#include <SDL.h>
1879#if defined(SDL_VIDEO_DRIVER_X11)
1880#include <X11/XKBlib.h>
1881#else
1882#error No x11 support
1883#endif
1884int main(void) { return 0; }
1885EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001886 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001887 sdl_libs="$sdl_libs -lX11"
1888 fi
Juan Quintela07056672009-08-03 14:46:27 +02001889 libs_softmmu="$sdl_libs $libs_softmmu"
aliguori5368a422009-03-03 17:37:21 +00001890fi
1891
ths8f28f3f2007-01-05 21:25:54 +00001892##########################################
Michael R. Hines2da776d2013-07-22 10:01:54 -04001893# RDMA needs OpenFabrics libraries
1894if test "$rdma" != "no" ; then
1895 cat > $TMPC <<EOF
1896#include <rdma/rdma_cma.h>
1897int main(void) { return 0; }
1898EOF
1899 rdma_libs="-lrdmacm -libverbs"
1900 if compile_prog "" "$rdma_libs" ; then
1901 rdma="yes"
1902 libs_softmmu="$libs_softmmu $rdma_libs"
1903 else
1904 if test "$rdma" = "yes" ; then
1905 error_exit \
1906 " OpenFabrics librdmacm/libibverbs not present." \
1907 " Your options:" \
1908 " (1) Fast: Install infiniband packages from your distro." \
1909 " (2) Cleanest: Install libraries from www.openfabrics.org" \
1910 " (3) Also: Install softiwarp if you don't have RDMA hardware"
1911 fi
1912 rdma="no"
1913 fi
1914fi
1915
1916##########################################
Tim Hardeck7536ee42013-01-21 11:04:44 +01001917# VNC TLS/WS detection
1918if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
Juan Quintela1be10ad2009-08-12 18:20:28 +02001919 cat > $TMPC <<EOF
aliguoriae6b5e52008-08-06 16:55:50 +00001920#include <gnutls/gnutls.h>
1921int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1922EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001923 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1924 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
Juan Quintela1be10ad2009-08-12 18:20:28 +02001925 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
Tim Hardeck7536ee42013-01-21 11:04:44 +01001926 if test "$vnc_tls" != "no" ; then
1927 vnc_tls=yes
1928 fi
1929 if test "$vnc_ws" != "no" ; then
1930 vnc_ws=yes
1931 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02001932 libs_softmmu="$vnc_tls_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01001933 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
Juan Quintela1be10ad2009-08-12 18:20:28 +02001934 else
1935 if test "$vnc_tls" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001936 feature_not_found "vnc-tls" "Install gnutls devel"
aliguoriae6b5e52008-08-06 16:55:50 +00001937 fi
Tim Hardeck7536ee42013-01-21 11:04:44 +01001938 if test "$vnc_ws" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001939 feature_not_found "vnc-ws" "Install gnutls devel"
Tim Hardeck7536ee42013-01-21 11:04:44 +01001940 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02001941 vnc_tls=no
Tim Hardeck7536ee42013-01-21 11:04:44 +01001942 vnc_ws=no
Juan Quintela1be10ad2009-08-12 18:20:28 +02001943 fi
ths8d5d2d42007-08-25 01:37:51 +00001944fi
1945
1946##########################################
Benoît Canet95c6bff2014-02-21 22:21:15 +01001947# Quorum probe (check for gnutls)
1948if test "$quorum" != "no" ; then
1949cat > $TMPC <<EOF
1950#include <gnutls/gnutls.h>
1951#include <gnutls/crypto.h>
1952int main(void) {char data[4096], digest[32];
1953gnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest);
1954return 0;
1955}
1956EOF
1957quorum_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1958quorum_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
1959if compile_prog "$quorum_tls_cflags" "$quorum_tls_libs" ; then
1960 qcow_tls=yes
1961 libs_softmmu="$quorum_tls_libs $libs_softmmu"
1962 libs_tools="$quorum_tls_libs $libs_softmmu"
1963 QEMU_CFLAGS="$QEMU_CFLAGS $quorum_tls_cflags"
1964else
1965 echo "gnutls > 2.10.0 required to compile Quorum"
1966 exit 1
1967fi
1968fi
1969
1970##########################################
aliguori2f9606b2009-03-06 20:27:28 +00001971# VNC SASL detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001972if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02001973 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00001974#include <sasl/sasl.h>
1975#include <stdio.h>
1976int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1977EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02001978 # Assuming Cyrus-SASL installed in /usr prefix
1979 vnc_sasl_cflags=""
1980 vnc_sasl_libs="-lsasl2"
1981 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1982 vnc_sasl=yes
1983 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01001984 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
Juan Quintelaea784e32009-08-12 18:20:29 +02001985 else
1986 if test "$vnc_sasl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001987 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
aliguori2f9606b2009-03-06 20:27:28 +00001988 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02001989 vnc_sasl=no
1990 fi
aliguori2f9606b2009-03-06 20:27:28 +00001991fi
1992
1993##########################################
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001994# VNC JPEG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01001995if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001996cat > $TMPC <<EOF
1997#include <stdio.h>
1998#include <jpeglib.h>
1999int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2000EOF
2001 vnc_jpeg_cflags=""
2002 vnc_jpeg_libs="-ljpeg"
2003 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2004 vnc_jpeg=yes
2005 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01002006 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002007 else
2008 if test "$vnc_jpeg" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002009 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002010 fi
2011 vnc_jpeg=no
2012 fi
2013fi
2014
2015##########################################
Corentin Charyefe556a2010-07-07 20:57:56 +02002016# VNC PNG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01002017if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02002018cat > $TMPC <<EOF
2019//#include <stdio.h>
2020#include <png.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002021#include <stddef.h>
Corentin Charyefe556a2010-07-07 20:57:56 +02002022int main(void) {
2023 png_structp png_ptr;
2024 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
Peter Maydell7edc3fe2012-07-18 15:10:24 +01002025 return png_ptr != 0;
Corentin Charyefe556a2010-07-07 20:57:56 +02002026}
2027EOF
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002028 if $pkg_config libpng --exists; then
Stefan Weilca871ec2013-08-27 21:09:12 +02002029 vnc_png_cflags=`$pkg_config libpng --cflags`
2030 vnc_png_libs=`$pkg_config libpng --libs`
Brad9af80252011-07-30 01:45:55 -04002031 else
Corentin Charyefe556a2010-07-07 20:57:56 +02002032 vnc_png_cflags=""
2033 vnc_png_libs="-lpng"
Brad9af80252011-07-30 01:45:55 -04002034 fi
Corentin Charyefe556a2010-07-07 20:57:56 +02002035 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2036 vnc_png=yes
2037 libs_softmmu="$vnc_png_libs $libs_softmmu"
Brad9af80252011-07-30 01:45:55 -04002038 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
Corentin Charyefe556a2010-07-07 20:57:56 +02002039 else
2040 if test "$vnc_png" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002041 feature_not_found "vnc-png" "Install libpng devel"
Corentin Charyefe556a2010-07-07 20:57:56 +02002042 fi
2043 vnc_png=no
2044 fi
2045fi
2046
2047##########################################
aliguori76655d62009-03-06 20:27:37 +00002048# fnmatch() probe, used for ACL routines
2049fnmatch="no"
2050cat > $TMPC << EOF
2051#include <fnmatch.h>
2052int main(void)
2053{
2054 fnmatch("foo", "foo", 0);
2055 return 0;
2056}
2057EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002058if compile_prog "" "" ; then
aliguori76655d62009-03-06 20:27:37 +00002059 fnmatch="yes"
2060fi
2061
2062##########################################
Stefan Weilee682d22009-10-01 20:10:37 +02002063# uuid_generate() probe, used for vdi block driver
Peter Maydell2d16c8e2013-05-14 21:36:39 +01002064# Note that on some systems (notably MacOSX) no extra library
2065# need be linked to get the uuid functions.
Stefan Weilee682d22009-10-01 20:10:37 +02002066if test "$uuid" != "no" ; then
2067 uuid_libs="-luuid"
2068 cat > $TMPC << EOF
2069#include <uuid/uuid.h>
2070int main(void)
2071{
2072 uuid_t my_uuid;
2073 uuid_generate(my_uuid);
2074 return 0;
2075}
2076EOF
Peter Maydell2d16c8e2013-05-14 21:36:39 +01002077 if compile_prog "" "" ; then
2078 uuid="yes"
2079 elif compile_prog "" "$uuid_libs" ; then
Stefan Weilee682d22009-10-01 20:10:37 +02002080 uuid="yes"
2081 libs_softmmu="$uuid_libs $libs_softmmu"
2082 libs_tools="$uuid_libs $libs_tools"
2083 else
2084 if test "$uuid" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002085 feature_not_found "uuid" "Install libuuid devel"
Stefan Weilee682d22009-10-01 20:10:37 +02002086 fi
2087 uuid=no
2088 fi
2089fi
2090
Jeff Cody4f18b782013-10-30 10:44:39 -04002091if test "$vhdx" = "yes" ; then
2092 if test "$uuid" = "no" ; then
2093 error_exit "uuid required for VHDX support"
2094 fi
2095elif test "$vhdx" != "no" ; then
2096 if test "$uuid" = "yes" ; then
2097 vhdx=yes
2098 else
2099 vhdx=no
2100 fi
2101fi
2102
Stefan Weilee682d22009-10-01 20:10:37 +02002103##########################################
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002104# xfsctl() probe, used for raw-posix
2105if test "$xfs" != "no" ; then
2106 cat > $TMPC << EOF
Stefan Weilffc41d12011-12-17 09:27:36 +01002107#include <stddef.h> /* NULL */
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002108#include <xfs/xfs.h>
2109int main(void)
2110{
2111 xfsctl(NULL, 0, 0, NULL);
2112 return 0;
2113}
2114EOF
2115 if compile_prog "" "" ; then
2116 xfs="yes"
2117 else
2118 if test "$xfs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002119 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002120 fi
2121 xfs=no
2122 fi
2123fi
2124
2125##########################################
ths8a16d272008-07-19 09:56:24 +00002126# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02002127if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02002128 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00002129 cat > $TMPC << EOF
2130#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00002131int main(void)
2132{
2133 struct vde_open_args a = {0, 0, 0};
Peter Maydellfea08e02012-07-18 15:10:25 +01002134 char s[] = "";
2135 vde_open(s, s, &a);
pbrook4a7f0e02008-09-07 16:42:53 +00002136 return 0;
2137}
ths8a16d272008-07-19 09:56:24 +00002138EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002139 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02002140 vde=yes
Juan Quintela8e02e542009-08-03 14:47:07 +02002141 libs_softmmu="$vde_libs $libs_softmmu"
2142 libs_tools="$vde_libs $libs_tools"
Juan Quinteladfb278b2009-08-12 18:20:27 +02002143 else
2144 if test "$vde" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002145 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
Juan Quinteladfb278b2009-08-12 18:20:27 +02002146 fi
2147 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02002148 fi
ths8a16d272008-07-19 09:56:24 +00002149fi
2150
2151##########################################
Vincenzo Maffione58952132013-11-06 11:44:06 +01002152# netmap headers probe
2153if test "$netmap" != "no" ; then
2154 cat > $TMPC << EOF
2155#include <inttypes.h>
2156#include <net/if.h>
2157#include <net/netmap.h>
2158#include <net/netmap_user.h>
2159int main(void) { return 0; }
2160EOF
2161 if compile_prog "" "" ; then
2162 netmap=yes
2163 else
2164 if test "$netmap" = "yes" ; then
2165 feature_not_found "netmap"
2166 fi
2167 netmap=no
2168 fi
2169fi
2170
2171##########################################
Corey Bryant47e98652012-01-26 09:42:26 -05002172# libcap-ng library probe
2173if test "$cap_ng" != "no" ; then
2174 cap_libs="-lcap-ng"
2175 cat > $TMPC << EOF
2176#include <cap-ng.h>
2177int main(void)
2178{
2179 capng_capability_to_name(CAPNG_EFFECTIVE);
2180 return 0;
2181}
2182EOF
2183 if compile_prog "" "$cap_libs" ; then
2184 cap_ng=yes
2185 libs_tools="$cap_libs $libs_tools"
2186 else
2187 if test "$cap_ng" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002188 feature_not_found "cap_ng" "Install libcap-ng devel"
Corey Bryant47e98652012-01-26 09:42:26 -05002189 fi
2190 cap_ng=no
2191 fi
2192fi
2193
2194##########################################
malcc2de5c92008-06-28 19:13:06 +00002195# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00002196
malcc2de5c92008-06-28 19:13:06 +00002197audio_drv_probe()
2198{
2199 drv=$1
2200 hdr=$2
2201 lib=$3
2202 exp=$4
2203 cfl=$5
2204 cat > $TMPC << EOF
2205#include <$hdr>
2206int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00002207EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002208 if compile_prog "$cfl" "$lib" ; then
malcc2de5c92008-06-28 19:13:06 +00002209 :
2210 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01002211 error_exit "$drv check failed" \
2212 "Make sure to have the $drv libs and headers installed."
malcc2de5c92008-06-28 19:13:06 +00002213 fi
2214}
2215
malc2fa7d3b2008-07-29 12:58:44 +00002216audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00002217for drv in $audio_drv_list; do
2218 case $drv in
2219 alsa)
2220 audio_drv_probe $drv alsa/asoundlib.h -lasound \
Stefan Weile35bcb02012-07-18 15:10:19 +01002221 "return snd_pcm_close((snd_pcm_t *)0);"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002222 libs_softmmu="-lasound $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00002223 ;;
2224
2225 fmod)
2226 if test -z $fmod_lib || test -z $fmod_inc; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002227 error_exit "You must specify path to FMOD library and headers" \
2228 "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
malcc2de5c92008-06-28 19:13:06 +00002229 fi
2230 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002231 libs_softmmu="$fmod_lib $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00002232 ;;
2233
2234 esd)
2235 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002236 libs_softmmu="-lesd $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02002237 audio_pt_int="yes"
malcc2de5c92008-06-28 19:13:06 +00002238 ;;
malcb8e59f12008-07-02 21:03:08 +00002239
2240 pa)
Marc-André Lureaua394aed2012-04-17 14:32:42 +02002241 audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2242 "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2243 libs_softmmu="-lpulse $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02002244 audio_pt_int="yes"
malcb8e59f12008-07-02 21:03:08 +00002245 ;;
2246
Juan Quintela997e6902009-08-03 14:46:29 +02002247 coreaudio)
2248 libs_softmmu="-framework CoreAudio $libs_softmmu"
2249 ;;
2250
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002251 dsound)
2252 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
malcd5631632009-10-10 01:13:41 +04002253 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002254 ;;
2255
2256 oss)
2257 libs_softmmu="$oss_lib $libs_softmmu"
2258 ;;
2259
2260 sdl|wav)
blueswir12f6a1ab2008-08-21 18:00:53 +00002261 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
2262 ;;
2263
malcd5631632009-10-10 01:13:41 +04002264 winwave)
2265 libs_softmmu="-lwinmm $libs_softmmu"
2266 audio_win_int="yes"
2267 ;;
2268
malce4c63a62008-07-19 16:15:16 +00002269 *)
malc1c9b2a52008-07-19 16:57:30 +00002270 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
Peter Maydell76ad07a2013-04-08 12:11:26 +01002271 error_exit "Unknown driver '$drv' selected" \
2272 "Possible drivers are: $audio_possible_drivers"
malce4c63a62008-07-19 16:15:16 +00002273 }
2274 ;;
malcc2de5c92008-06-28 19:13:06 +00002275 esac
2276done
ths8f28f3f2007-01-05 21:25:54 +00002277
balrog4d3b6f62008-02-10 16:33:14 +00002278##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00002279# BrlAPI probe
2280
Juan Quintela4ffcedb2009-08-12 18:20:26 +02002281if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02002282 brlapi_libs="-lbrlapi"
2283 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00002284#include <brlapi.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002285#include <stddef.h>
aurel322e4d9fb2008-04-08 06:01:02 +00002286int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
2287EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002288 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02002289 brlapi=yes
Juan Quintela264606b2009-08-03 14:46:39 +02002290 libs_softmmu="$brlapi_libs $libs_softmmu"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02002291 else
2292 if test "$brlapi" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002293 feature_not_found "brlapi" "Install brlapi devel"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02002294 fi
2295 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02002296 fi
2297fi
aurel322e4d9fb2008-04-08 06:01:02 +00002298
2299##########################################
balrog4d3b6f62008-02-10 16:33:14 +00002300# curses probe
Juan Quintelac584a6d2009-08-12 18:20:30 +02002301if test "$curses" != "no" ; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04002302 if test "$mingw32" = "yes" ; then
2303 curses_list="-lpdcurses"
2304 else
Ed Mastecfeda5f2013-05-24 16:07:00 -04002305 curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
Michael Tokareva3605bf2013-05-25 13:17:21 +04002306 fi
Juan Quintelac584a6d2009-08-12 18:20:30 +02002307 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00002308 cat > $TMPC << EOF
2309#include <curses.h>
Stefan Weilef9a2522011-12-17 17:46:02 +01002310int main(void) {
2311 const char *s = curses_version();
2312 resize_term(0, 0);
2313 return s != 0;
2314}
balrog4d3b6f62008-02-10 16:33:14 +00002315EOF
Vadim Evardecbe2512013-01-15 16:17:24 +04002316 IFS=:
Juan Quintela4f78ef92009-08-12 18:20:23 +02002317 for curses_lib in $curses_list; do
Vadim Evardecbe2512013-01-15 16:17:24 +04002318 unset IFS
Juan Quintela4f78ef92009-08-12 18:20:23 +02002319 if compile_prog "" "$curses_lib" ; then
Juan Quintelac584a6d2009-08-12 18:20:30 +02002320 curses_found=yes
Juan Quintela4f78ef92009-08-12 18:20:23 +02002321 libs_softmmu="$curses_lib $libs_softmmu"
2322 break
2323 fi
2324 done
Vadim Evardecbe2512013-01-15 16:17:24 +04002325 unset IFS
Juan Quintelac584a6d2009-08-12 18:20:30 +02002326 if test "$curses_found" = "yes" ; then
2327 curses=yes
2328 else
2329 if test "$curses" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002330 feature_not_found "curses" "Install ncurses devel"
Juan Quintelac584a6d2009-08-12 18:20:30 +02002331 fi
2332 curses=no
2333 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02002334fi
balrog4d3b6f62008-02-10 16:33:14 +00002335
blueswir1414f0da2008-08-15 18:20:52 +00002336##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02002337# curl probe
Juan Quintela788c8192009-08-12 18:29:47 +02002338if test "$curl" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002339 if $pkg_config libcurl --exists; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04002340 curlconfig="$pkg_config libcurl"
2341 else
2342 curlconfig=curl-config
2343 fi
Alexander Graf769ce762009-05-11 17:41:42 +02002344 cat > $TMPC << EOF
2345#include <curl/curl.h>
Peter Maydell0b862ce2011-06-09 22:54:29 +01002346int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
Alexander Graf769ce762009-05-11 17:41:42 +02002347EOF
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01002348 curl_cflags=`$curlconfig --cflags 2>/dev/null`
2349 curl_libs=`$curlconfig --libs 2>/dev/null`
Juan Quintelab1d5a272009-08-03 14:46:05 +02002350 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02002351 curl=yes
Juan Quintelaf0302932009-08-03 14:47:08 +02002352 libs_tools="$curl_libs $libs_tools"
2353 libs_softmmu="$curl_libs $libs_softmmu"
Juan Quintela788c8192009-08-12 18:29:47 +02002354 else
2355 if test "$curl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002356 feature_not_found "curl" "Install libcurl devel"
Juan Quintela788c8192009-08-12 18:29:47 +02002357 fi
2358 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02002359 fi
2360fi # test "$curl"
2361
2362##########################################
balrogfb599c92008-09-28 23:49:55 +00002363# bluez support probe
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002364if test "$bluez" != "no" ; then
balroge820e3f2008-09-30 02:27:44 +00002365 cat > $TMPC << EOF
2366#include <bluetooth/bluetooth.h>
2367int main(void) { return bt_error(0); }
2368EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01002369 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2370 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +02002371 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002372 bluez=yes
Juan Quintelae482d562009-08-03 14:46:37 +02002373 libs_softmmu="$bluez_libs $libs_softmmu"
balroge820e3f2008-09-30 02:27:44 +00002374 else
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002375 if test "$bluez" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002376 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002377 fi
balroge820e3f2008-09-30 02:27:44 +00002378 bluez="no"
2379 fi
balrogfb599c92008-09-28 23:49:55 +00002380fi
2381
2382##########################################
Anthony Liguorie18df142011-07-19 14:50:29 -05002383# glib support probe
Paolo Bonzinia52d28a2012-04-05 13:01:54 +02002384
2385if test "$mingw32" = yes; then
2386 # g_poll is required in order to integrate with the glib main loop.
2387 glib_req_ver=2.20
2388else
2389 glib_req_ver=2.12
2390fi
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002391if $pkg_config --atleast-version=$glib_req_ver gthread-2.0; then
Stefan Weilca871ec2013-08-27 21:09:12 +02002392 glib_cflags=`$pkg_config --cflags gthread-2.0`
2393 glib_libs=`$pkg_config --libs gthread-2.0`
Anthony Liguori14015302011-08-20 22:18:37 -05002394 LIBS="$glib_libs $LIBS"
Michael Roth957f1f92011-08-11 15:38:12 -05002395 libs_qga="$glib_libs $libs_qga"
Stefan Hajnoczi4b76a482011-08-08 13:04:05 +05302396else
Peter Maydell76ad07a2013-04-08 12:11:26 +01002397 error_exit "glib-$glib_req_ver required to compile QEMU"
Anthony Liguorie18df142011-07-19 14:50:29 -05002398fi
2399
2400##########################################
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002401# pixman support probe
2402
2403if test "$pixman" = ""; then
Robert Schiele74880fe2012-12-04 16:58:08 +01002404 if test "$want_tools" = "no" -a "$softmmu" = "no"; then
2405 pixman="none"
2406 elif $pkg_config pixman-1 > /dev/null 2>&1; then
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002407 pixman="system"
2408 else
2409 pixman="internal"
2410 fi
2411fi
Robert Schiele74880fe2012-12-04 16:58:08 +01002412if test "$pixman" = "none"; then
2413 if test "$want_tools" != "no" -o "$softmmu" != "no"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002414 error_exit "pixman disabled but system emulation or tools build" \
2415 "enabled. You can turn off pixman only if you also" \
2416 "disable all system emulation targets and the tools" \
2417 "build with '--disable-tools --disable-system'."
Robert Schiele74880fe2012-12-04 16:58:08 +01002418 fi
2419 pixman_cflags=
2420 pixman_libs=
2421elif test "$pixman" = "system"; then
Stefan Weilca871ec2013-08-27 21:09:12 +02002422 pixman_cflags=`$pkg_config --cflags pixman-1`
2423 pixman_libs=`$pkg_config --libs pixman-1`
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002424else
2425 if test ! -d ${source_path}/pixman/pixman; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002426 error_exit "pixman not present. Your options:" \
2427 " (1) Preferred: Install the pixman devel package (any recent" \
2428 " distro should have packages as Xorg needs pixman too)." \
2429 " (2) Fetch the pixman submodule, using:" \
2430 " git submodule update --init pixman"
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002431 fi
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01002432 mkdir -p pixman/pixman
2433 pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
2434 pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002435fi
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002436
2437##########################################
M. Mohan Kumar17bff522011-12-14 13:58:42 +05302438# libcap probe
2439
2440if test "$cap" != "no" ; then
2441 cat > $TMPC <<EOF
2442#include <stdio.h>
2443#include <sys/capability.h>
Stefan Weilcc939742012-07-18 15:10:20 +01002444int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
M. Mohan Kumar17bff522011-12-14 13:58:42 +05302445EOF
2446 if compile_prog "" "-lcap" ; then
2447 cap=yes
2448 else
2449 cap=no
2450 fi
2451fi
2452
2453##########################################
aliguorie5d355d2009-04-24 18:03:15 +00002454# pthread probe
Brad4b29ec42011-08-07 20:02:11 -04002455PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00002456
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02002457pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00002458cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00002459#include <pthread.h>
Stefan Weil7a42bbe2011-12-17 09:27:32 +01002460static void *f(void *p) { return NULL; }
2461int main(void) {
2462 pthread_t thread;
2463 pthread_create(&thread, 0, f, 0);
2464 return 0;
2465}
blueswir1414f0da2008-08-15 18:20:52 +00002466EOF
Andreas Färberbd00d532010-09-20 00:50:44 +02002467if compile_prog "" "" ; then
2468 pthread=yes
2469else
2470 for pthread_lib in $PTHREADLIBS_LIST; do
2471 if compile_prog "" "$pthread_lib" ; then
2472 pthread=yes
Peter Portantee3c56762012-04-20 10:36:12 -04002473 found=no
2474 for lib_entry in $LIBS; do
2475 if test "$lib_entry" = "$pthread_lib"; then
2476 found=yes
2477 break
2478 fi
2479 done
2480 if test "$found" = "no"; then
2481 LIBS="$pthread_lib $LIBS"
2482 fi
Andreas Färberbd00d532010-09-20 00:50:44 +02002483 break
2484 fi
2485 done
2486fi
blueswir1414f0da2008-08-15 18:20:52 +00002487
Anthony Liguori4617e592009-08-25 17:21:56 -05002488if test "$mingw32" != yes -a "$pthread" = no; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002489 error_exit "pthread check failed" \
2490 "Make sure to have the pthread libs and headers installed."
aliguorie5d355d2009-04-24 18:03:15 +00002491fi
2492
aliguoribf9298b2008-12-05 20:05:26 +00002493##########################################
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002494# rbd probe
2495if test "$rbd" != "no" ; then
2496 cat > $TMPC <<EOF
2497#include <stdio.h>
Josh Durginad32e9c2011-05-26 16:07:31 -07002498#include <rbd/librbd.h>
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002499int main(void) {
Josh Durginad32e9c2011-05-26 16:07:31 -07002500 rados_t cluster;
2501 rados_create(&cluster, NULL);
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002502 return 0;
2503}
2504EOF
Josh Durginad32e9c2011-05-26 16:07:31 -07002505 rbd_libs="-lrbd -lrados"
2506 if compile_prog "" "$rbd_libs" ; then
2507 rbd=yes
2508 libs_tools="$rbd_libs $libs_tools"
2509 libs_softmmu="$rbd_libs $libs_softmmu"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002510 else
2511 if test "$rbd" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002512 feature_not_found "rados block device" "Install librbd/ceph devel"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002513 fi
2514 rbd=no
2515 fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002516fi
2517
2518##########################################
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002519# libssh2 probe
Richard W.M. Jones4fc16832013-04-19 09:16:39 +01002520min_libssh2_version=1.2.8
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002521if test "$libssh2" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002522 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002523 libssh2_cflags=`$pkg_config libssh2 --cflags`
2524 libssh2_libs=`$pkg_config libssh2 --libs`
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002525 libssh2=yes
2526 libs_tools="$libssh2_libs $libs_tools"
2527 libs_softmmu="$libssh2_libs $libs_softmmu"
2528 QEMU_CFLAGS="$QEMU_CFLAGS $libssh2_cflags"
2529 else
2530 if test "$libssh2" = "yes" ; then
Richard W.M. Jones4fc16832013-04-19 09:16:39 +01002531 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002532 fi
2533 libssh2=no
2534 fi
2535fi
2536
2537##########################################
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01002538# libssh2_sftp_fsync probe
2539
2540if test "$libssh2" = "yes"; then
2541 cat > $TMPC <<EOF
2542#include <stdio.h>
2543#include <libssh2.h>
2544#include <libssh2_sftp.h>
2545int main(void) {
2546 LIBSSH2_SESSION *session;
2547 LIBSSH2_SFTP *sftp;
2548 LIBSSH2_SFTP_HANDLE *sftp_handle;
2549 session = libssh2_session_init ();
2550 sftp = libssh2_sftp_init (session);
2551 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
2552 libssh2_sftp_fsync (sftp_handle);
2553 return 0;
2554}
2555EOF
2556 # libssh2_cflags/libssh2_libs defined in previous test.
2557 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
2558 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
2559 fi
2560fi
2561
2562##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002563# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002564
2565if test "$linux_aio" != "no" ; then
2566 cat > $TMPC <<EOF
2567#include <libaio.h>
2568#include <sys/eventfd.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002569#include <stddef.h>
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002570int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2571EOF
2572 if compile_prog "" "-laio" ; then
2573 linux_aio=yes
Paul Brook048d1792010-05-05 16:32:59 +01002574 libs_softmmu="$libs_softmmu -laio"
2575 libs_tools="$libs_tools -laio"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002576 else
2577 if test "$linux_aio" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002578 feature_not_found "linux AIO" "Install libaio devel"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002579 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03002580 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002581 fi
2582fi
2583
2584##########################################
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01002585# TPM passthrough is only on x86 Linux
2586
2587if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
2588 tpm_passthrough=$tpm
2589else
2590 tpm_passthrough=no
2591fi
2592
2593##########################################
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01002594# adjust virtio-blk-data-plane based on linux-aio
2595
2596if test "$virtio_blk_data_plane" = "yes" -a \
2597 "$linux_aio" != "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002598 error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01002599elif test -z "$virtio_blk_data_plane" ; then
2600 virtio_blk_data_plane=$linux_aio
2601fi
2602
2603##########################################
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002604# attr probe
2605
2606if test "$attr" != "no" ; then
2607 cat > $TMPC <<EOF
2608#include <stdio.h>
2609#include <sys/types.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002610#ifdef CONFIG_LIBATTR
2611#include <attr/xattr.h>
2612#else
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002613#include <sys/xattr.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002614#endif
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002615int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2616EOF
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002617 if compile_prog "" "" ; then
2618 attr=yes
2619 # Older distros have <attr/xattr.h>, and need -lattr:
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002620 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002621 attr=yes
2622 LIBS="-lattr $LIBS"
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002623 libattr=yes
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002624 else
2625 if test "$attr" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002626 feature_not_found "ATTR" "Install libc6 or libattr devel"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002627 fi
2628 attr=no
2629 fi
2630fi
2631
2632##########################################
aliguoribf9298b2008-12-05 20:05:26 +00002633# iovec probe
2634cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00002635#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00002636#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00002637#include <unistd.h>
Stefan Weilf91f9be2011-12-17 09:27:33 +01002638int main(void) { return sizeof(struct iovec); }
aliguoribf9298b2008-12-05 20:05:26 +00002639EOF
2640iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002641if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00002642 iovec=yes
2643fi
2644
aurel32f652e6a2008-12-16 10:43:48 +00002645##########################################
aliguoriceb42de2009-04-07 18:43:28 +00002646# preadv probe
2647cat > $TMPC <<EOF
2648#include <sys/types.h>
2649#include <sys/uio.h>
2650#include <unistd.h>
Blue Swirlc075a722012-08-09 20:21:25 +00002651int main(void) { return preadv(0, 0, 0, 0); }
aliguoriceb42de2009-04-07 18:43:28 +00002652EOF
2653preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002654if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00002655 preadv=yes
2656fi
2657
2658##########################################
aurel32f652e6a2008-12-16 10:43:48 +00002659# fdt probe
Peter Maydelle169e1e2013-05-24 16:26:54 +01002660# fdt support is mandatory for at least some target architectures,
2661# so insist on it if we're building those system emulators.
2662fdt_required=no
2663for target in $target_list; do
2664 case $target in
Alexander Graf6a49fa92013-09-03 20:12:22 +01002665 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
Peter Maydelle169e1e2013-05-24 16:26:54 +01002666 fdt_required=yes
2667 ;;
2668 esac
2669done
2670
2671if test "$fdt_required" = "yes"; then
2672 if test "$fdt" = "no"; then
2673 error_exit "fdt disabled but some requested targets require it." \
2674 "You can turn off fdt only if you also disable all the system emulation" \
2675 "targets which need it (by specifying a cut down --target-list)."
2676 fi
2677 fdt=yes
2678fi
2679
Juan Quintela2df87df2009-08-12 18:29:54 +02002680if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02002681 fdt_libs="-lfdt"
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10002682 # explicitly check for libfdt_env.h as it is missing in some stable installs
Juan Quintelab41af4b2009-07-27 16:13:20 +02002683 cat > $TMPC << EOF
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10002684#include <libfdt_env.h>
aurel32f652e6a2008-12-16 10:43:48 +00002685int main(void) { return 0; }
2686EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002687 if compile_prog "" "$fdt_libs" ; then
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002688 # system DTC is good - use it
aurel32f652e6a2008-12-16 10:43:48 +00002689 fdt=yes
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002690 elif test -d ${source_path}/dtc/libfdt ; then
2691 # have submodule DTC - use it
2692 fdt=yes
2693 dtc_internal="yes"
2694 mkdir -p dtc
2695 if [ "$source_path" != `pwd` ] ; then
2696 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
2697 symlink "$source_path/dtc/scripts" "dtc/scripts"
Juan Quintela2df87df2009-08-12 18:29:54 +02002698 fi
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002699 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
2700 fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
2701 elif test "$fdt" = "yes" ; then
2702 # have neither and want - prompt for system/submodule install
Stewart Smith3f281822014-01-24 12:39:06 +11002703 error_exit "DTC (libfdt) not present. Your options:" \
2704 " (1) Preferred: Install the DTC (libfdt) devel package" \
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002705 " (2) Fetch the DTC submodule, using:" \
2706 " git submodule update --init dtc"
2707 else
2708 # don't have and don't want
Michael Wallede3a3542011-04-26 00:24:07 +02002709 fdt_libs=
Juan Quintela2df87df2009-08-12 18:29:54 +02002710 fdt=no
aurel32f652e6a2008-12-16 10:43:48 +00002711 fi
2712fi
2713
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002714libs_softmmu="$libs_softmmu $fdt_libs"
2715
Michael Walle20ff0752011-03-07 23:32:39 +01002716##########################################
Michael Walleb1e5fff2013-03-06 20:23:32 +01002717# GLX probe, used by milkymist-tmu2
2718if test "$glx" != "no" ; then
2719 glx_libs="-lGL -lX11"
Michael Walle20ff0752011-03-07 23:32:39 +01002720 cat > $TMPC << EOF
2721#include <X11/Xlib.h>
2722#include <GL/gl.h>
2723#include <GL/glx.h>
Michael Walled3fcbb12013-03-06 20:16:58 +01002724int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
Michael Walle20ff0752011-03-07 23:32:39 +01002725EOF
Michael Walled3fcbb12013-03-06 20:16:58 +01002726 if compile_prog "" "-lGL -lX11" ; then
Michael Walleb1e5fff2013-03-06 20:23:32 +01002727 glx=yes
Michael Walle20ff0752011-03-07 23:32:39 +01002728 else
Michael Walleb1e5fff2013-03-06 20:23:32 +01002729 if test "$glx" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002730 feature_not_found "glx" "Install GL devel (e.g. MESA)"
Michael Walle20ff0752011-03-07 23:32:39 +01002731 fi
Michael Walleb1e5fff2013-03-06 20:23:32 +01002732 glx_libs=
2733 glx=no
Michael Walle20ff0752011-03-07 23:32:39 +01002734 fi
2735fi
2736
Bharata B Raoeb100392012-09-24 14:42:45 +05302737##########################################
2738# glusterfs probe
2739if test "$glusterfs" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002740 if $pkg_config --atleast-version=3 glusterfs-api; then
Bharata B Raoe01bee02013-07-16 21:47:41 +05302741 glusterfs="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02002742 glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
2743 glusterfs_libs=`$pkg_config --libs glusterfs-api`
Bharata B Raoe01bee02013-07-16 21:47:41 +05302744 CFLAGS="$CFLAGS $glusterfs_cflags"
Bharata B Raoeb100392012-09-24 14:42:45 +05302745 libs_tools="$glusterfs_libs $libs_tools"
2746 libs_softmmu="$glusterfs_libs $libs_softmmu"
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002747 if $pkg_config --atleast-version=5 glusterfs-api; then
Bharata B Rao0c14fb42013-07-16 21:47:42 +05302748 glusterfs_discard="yes"
2749 fi
Bharata B Rao7c815372013-12-21 14:51:25 +05302750 if $pkg_config --atleast-version=6 glusterfs-api; then
2751 glusterfs_zerofill="yes"
2752 fi
Bharata B Raoeb100392012-09-24 14:42:45 +05302753 else
2754 if test "$glusterfs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002755 feature_not_found "GlusterFS backend support" "Install glusterfs-api devel"
Bharata B Raoeb100392012-09-24 14:42:45 +05302756 fi
Bharata B Raoe01bee02013-07-16 21:47:41 +05302757 glusterfs="no"
Bharata B Raoeb100392012-09-24 14:42:45 +05302758 fi
2759fi
2760
aurel3239386ac2009-04-15 19:48:17 +00002761# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00002762# emulator. This is done because older glibc versions don't
2763# have syscall stubs for these implemented. In that case we
2764# don't provide them even if kernel supports them.
2765#
2766inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03002767cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00002768#include <sys/inotify.h>
2769
2770int
2771main(void)
2772{
2773 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00002774 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00002775}
2776EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002777if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03002778 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00002779fi
2780
Riku Voipioc05c7a72010-03-26 15:25:11 +00002781inotify1=no
2782cat > $TMPC << EOF
2783#include <sys/inotify.h>
2784
2785int
2786main(void)
2787{
2788 /* try to start inotify */
2789 return inotify_init1(0);
2790}
2791EOF
2792if compile_prog "" "" ; then
2793 inotify1=yes
2794fi
2795
Riku Voipioebc996f2009-04-21 15:01:51 +03002796# check if utimensat and futimens are supported
2797utimens=no
2798cat > $TMPC << EOF
2799#define _ATFILE_SOURCE
Riku Voipioebc996f2009-04-21 15:01:51 +03002800#include <stddef.h>
2801#include <fcntl.h>
Peter Maydell3014ee02012-07-18 15:10:26 +01002802#include <sys/stat.h>
Riku Voipioebc996f2009-04-21 15:01:51 +03002803
2804int main(void)
2805{
2806 utimensat(AT_FDCWD, "foo", NULL, 0);
2807 futimens(0, NULL);
2808 return 0;
2809}
2810EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002811if compile_prog "" "" ; then
Riku Voipioebc996f2009-04-21 15:01:51 +03002812 utimens=yes
2813fi
2814
Riku Voipio099d6b02009-05-05 12:10:04 +03002815# check if pipe2 is there
2816pipe2=no
2817cat > $TMPC << EOF
Riku Voipio099d6b02009-05-05 12:10:04 +03002818#include <unistd.h>
2819#include <fcntl.h>
2820
2821int main(void)
2822{
2823 int pipefd[2];
Bruce Rogers9bca8162012-08-20 12:45:08 -06002824 return pipe2(pipefd, O_CLOEXEC);
Riku Voipio099d6b02009-05-05 12:10:04 +03002825}
2826EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002827if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03002828 pipe2=yes
2829fi
2830
Kevin Wolf40ff6d72009-12-02 12:24:42 +01002831# check if accept4 is there
2832accept4=no
2833cat > $TMPC << EOF
Kevin Wolf40ff6d72009-12-02 12:24:42 +01002834#include <sys/socket.h>
2835#include <stddef.h>
2836
2837int main(void)
2838{
2839 accept4(0, NULL, NULL, SOCK_CLOEXEC);
2840 return 0;
2841}
2842EOF
2843if compile_prog "" "" ; then
2844 accept4=yes
2845fi
2846
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302847# check if tee/splice is there. vmsplice was added same time.
2848splice=no
2849cat > $TMPC << EOF
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302850#include <unistd.h>
2851#include <fcntl.h>
2852#include <limits.h>
2853
2854int main(void)
2855{
Stefan Weil66ea0f22011-12-17 09:27:35 +01002856 int len, fd = 0;
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302857 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
2858 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
2859 return 0;
2860}
2861EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002862if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302863 splice=yes
2864fi
2865
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03002866##########################################
2867# signalfd probe
2868signalfd="no"
2869cat > $TMPC << EOF
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03002870#include <unistd.h>
2871#include <sys/syscall.h>
2872#include <signal.h>
2873int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2874EOF
2875
2876if compile_prog "" "" ; then
2877 signalfd=yes
2878fi
2879
Riku Voipioc2882b92009-08-12 15:08:24 +03002880# check if eventfd is supported
2881eventfd=no
2882cat > $TMPC << EOF
2883#include <sys/eventfd.h>
2884
2885int main(void)
2886{
Stefan Weil55cc7f32011-12-17 09:27:37 +01002887 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
Riku Voipioc2882b92009-08-12 15:08:24 +03002888}
2889EOF
2890if compile_prog "" "" ; then
2891 eventfd=yes
2892fi
2893
Ulrich Hechtd0927932009-09-17 20:22:14 +03002894# check for fallocate
2895fallocate=no
2896cat > $TMPC << EOF
2897#include <fcntl.h>
2898
2899int main(void)
2900{
2901 fallocate(0, 0, 0, 0);
2902 return 0;
2903}
2904EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01002905if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03002906 fallocate=yes
2907fi
2908
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01002909# check for fallocate hole punching
2910fallocate_punch_hole=no
2911cat > $TMPC << EOF
2912#include <fcntl.h>
2913#include <linux/falloc.h>
2914
2915int main(void)
2916{
2917 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
2918 return 0;
2919}
2920EOF
2921if compile_prog "" "" ; then
2922 fallocate_punch_hole=yes
2923fi
2924
Peter Maydellc727f472011-01-06 11:05:10 +00002925# check for sync_file_range
2926sync_file_range=no
2927cat > $TMPC << EOF
2928#include <fcntl.h>
2929
2930int main(void)
2931{
2932 sync_file_range(0, 0, 0, 0);
2933 return 0;
2934}
2935EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01002936if compile_prog "" "" ; then
Peter Maydellc727f472011-01-06 11:05:10 +00002937 sync_file_range=yes
2938fi
2939
Peter Maydelldace20d2011-01-10 13:11:24 +00002940# check for linux/fiemap.h and FS_IOC_FIEMAP
2941fiemap=no
2942cat > $TMPC << EOF
2943#include <sys/ioctl.h>
2944#include <linux/fs.h>
2945#include <linux/fiemap.h>
2946
2947int main(void)
2948{
2949 ioctl(0, FS_IOC_FIEMAP, 0);
2950 return 0;
2951}
2952EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01002953if compile_prog "" "" ; then
Peter Maydelldace20d2011-01-10 13:11:24 +00002954 fiemap=yes
2955fi
2956
Ulrich Hechtd0927932009-09-17 20:22:14 +03002957# check for dup3
2958dup3=no
2959cat > $TMPC << EOF
2960#include <unistd.h>
2961
2962int main(void)
2963{
2964 dup3(0, 0, 0);
2965 return 0;
2966}
2967EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01002968if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03002969 dup3=yes
2970fi
2971
Alex Bligh4e0c6522013-08-21 16:02:43 +01002972# check for ppoll support
2973ppoll=no
2974cat > $TMPC << EOF
2975#include <poll.h>
2976
2977int main(void)
2978{
2979 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
2980 ppoll(&pfd, 1, 0, 0);
2981 return 0;
2982}
2983EOF
2984if compile_prog "" "" ; then
2985 ppoll=yes
2986fi
2987
Alex Blighcd758dd2013-08-21 16:02:44 +01002988# check for prctl(PR_SET_TIMERSLACK , ... ) support
2989prctl_pr_set_timerslack=no
2990cat > $TMPC << EOF
2991#include <sys/prctl.h>
2992
2993int main(void)
2994{
2995 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
2996 return 0;
2997}
2998EOF
2999if compile_prog "" "" ; then
3000 prctl_pr_set_timerslack=yes
3001fi
3002
Peter Maydell3b6edd12011-02-15 18:35:05 +00003003# check for epoll support
3004epoll=no
3005cat > $TMPC << EOF
3006#include <sys/epoll.h>
3007
3008int main(void)
3009{
3010 epoll_create(0);
3011 return 0;
3012}
3013EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003014if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00003015 epoll=yes
3016fi
3017
3018# epoll_create1 and epoll_pwait are later additions
3019# so we must check separately for their presence
3020epoll_create1=no
3021cat > $TMPC << EOF
3022#include <sys/epoll.h>
3023
3024int main(void)
3025{
Peter Maydell19e83f62011-04-26 16:56:40 +01003026 /* Note that we use epoll_create1 as a value, not as
3027 * a function being called. This is necessary so that on
3028 * old SPARC glibc versions where the function was present in
3029 * the library but not declared in the header file we will
3030 * fail the configure check. (Otherwise we will get a compiler
3031 * warning but not an error, and will proceed to fail the
3032 * qemu compile where we compile with -Werror.)
3033 */
Blue Swirlc075a722012-08-09 20:21:25 +00003034 return (int)(uintptr_t)&epoll_create1;
Peter Maydell3b6edd12011-02-15 18:35:05 +00003035}
3036EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003037if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00003038 epoll_create1=yes
3039fi
3040
3041epoll_pwait=no
3042cat > $TMPC << EOF
3043#include <sys/epoll.h>
3044
3045int main(void)
3046{
3047 epoll_pwait(0, 0, 0, 0, 0);
3048 return 0;
3049}
3050EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003051if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00003052 epoll_pwait=yes
3053fi
3054
Peter Maydella8fd1ab2013-02-08 07:31:55 +00003055# check for sendfile support
3056sendfile=no
3057cat > $TMPC << EOF
3058#include <sys/sendfile.h>
3059
3060int main(void)
3061{
3062 return sendfile(0, 0, 0, 0);
3063}
3064EOF
3065if compile_prog "" "" ; then
3066 sendfile=yes
3067fi
3068
pbrookcc8ae6d2006-04-23 17:57:59 +00003069# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02003070if test "$docs" != "no" ; then
Stefan Weil01668d92010-03-04 22:21:02 +01003071 if has makeinfo && has pod2man; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02003072 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02003073 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02003074 if test "$docs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003075 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
Juan Quintela83a3ab82009-08-12 18:29:51 +02003076 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02003077 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02003078 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00003079fi
3080
Stefan Weilf514f412009-10-11 12:44:07 +02003081# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003082byteswap_h=no
3083cat > $TMPC << EOF
3084#include <byteswap.h>
3085int main(void) { return bswap_32(0); }
3086EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003087if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003088 byteswap_h=yes
3089fi
3090
Stefan Weil75f13592013-01-05 12:17:38 +01003091# Search for bswap32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003092bswap_h=no
3093cat > $TMPC << EOF
3094#include <sys/endian.h>
3095#include <sys/types.h>
3096#include <machine/bswap.h>
3097int main(void) { return bswap32(0); }
3098EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003099if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003100 bswap_h=yes
3101fi
3102
aliguorida93a1f2008-12-12 20:02:52 +00003103##########################################
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003104# Do we have libiscsi
Peter Lieven063c3372013-12-05 16:47:17 +01003105# We check for iscsi_write16_sync() to make sure we have a
3106# at least version 1.4.0 of libiscsi.
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003107if test "$libiscsi" != "no" ; then
3108 cat > $TMPC << EOF
Ronnie Sahlbergfa6acb02012-04-24 16:29:04 +10003109#include <stdio.h>
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003110#include <iscsi/iscsi.h>
Peter Lieven063c3372013-12-05 16:47:17 +01003111int main(void) { iscsi_write16_sync(NULL,0,0,NULL,0,0,0,0,0,0,0); return 0; }
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003112EOF
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003113 if $pkg_config --atleast-version=1.7.0 libiscsi; then
Paolo Bonzini3c33ea92013-02-22 18:14:28 +01003114 libiscsi="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02003115 libiscsi_cflags=$($pkg_config --cflags libiscsi)
3116 libiscsi_libs=$($pkg_config --libs libiscsi)
Paolo Bonzini3c33ea92013-02-22 18:14:28 +01003117 CFLAGS="$CFLAGS $libiscsi_cflags"
3118 LIBS="$LIBS $libiscsi_libs"
3119 elif compile_prog "" "-liscsi" ; then
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003120 libiscsi="yes"
3121 LIBS="$LIBS -liscsi"
3122 else
3123 if test "$libiscsi" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003124 feature_not_found "libiscsi" "Install libiscsi devel"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003125 fi
3126 libiscsi="no"
3127 fi
3128fi
3129
Stefan Weil219c2522013-12-17 08:57:10 +01003130# We also need to know the API version because there was an
3131# API change from 1.4.0 to 1.5.0.
3132if test "$libiscsi" = "yes"; then
3133 cat >$TMPC <<EOF
3134#include <iscsi/iscsi.h>
3135int main(void)
3136{
3137 iscsi_read10_task(0, 0, 0, 0, 0, 0, 0);
3138 return 0;
3139}
3140EOF
3141 if compile_prog "" "-liscsi"; then
3142 libiscsi_version="1.4.0"
3143 fi
3144fi
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003145
3146##########################################
Natanael Copa8bacde82012-09-12 09:06:51 +00003147# Do we need libm
3148cat > $TMPC << EOF
3149#include <math.h>
3150int main(void) { return isnan(sin(0.0)); }
3151EOF
3152if compile_prog "" "" ; then
3153 :
3154elif compile_prog "" "-lm" ; then
3155 LIBS="-lm $LIBS"
3156 libs_qga="-lm $libs_qga"
3157else
Peter Maydell76ad07a2013-04-08 12:11:26 +01003158 error_exit "libm check failed"
Natanael Copa8bacde82012-09-12 09:06:51 +00003159fi
3160
3161##########################################
aliguorida93a1f2008-12-12 20:02:52 +00003162# Do we need librt
Natanael Copa8bacde82012-09-12 09:06:51 +00003163# uClibc provides 2 versions of clock_gettime(), one with realtime
3164# support and one without. This means that the clock_gettime() don't
3165# need -lrt. We still need it for timer_create() so we check for this
3166# function in addition.
aliguorida93a1f2008-12-12 20:02:52 +00003167cat > $TMPC <<EOF
3168#include <signal.h>
3169#include <time.h>
Natanael Copa8bacde82012-09-12 09:06:51 +00003170int main(void) {
3171 timer_create(CLOCK_REALTIME, NULL, NULL);
3172 return clock_gettime(CLOCK_REALTIME, NULL);
3173}
aliguorida93a1f2008-12-12 20:02:52 +00003174EOF
3175
Juan Quintela52166aa2009-08-03 14:46:03 +02003176if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02003177 :
Natanael Copa8bacde82012-09-12 09:06:51 +00003178# we need pthread for static linking. use previous pthread test result
3179elif compile_prog "" "-lrt $pthread_lib" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02003180 LIBS="-lrt $LIBS"
Natanael Copa8bacde82012-09-12 09:06:51 +00003181 libs_qga="-lrt $libs_qga"
aliguorida93a1f2008-12-12 20:02:52 +00003182fi
3183
Blue Swirl31ff5042009-09-12 12:33:07 +00003184if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
Andreas Färber179cf402010-09-20 00:50:43 +02003185 "$aix" != "yes" -a "$haiku" != "yes" ; then
Juan Quintela6362a532009-08-03 14:46:32 +02003186 libs_softmmu="-lutil $libs_softmmu"
3187fi
3188
Blue Swirlde5071c2009-09-12 09:58:46 +00003189##########################################
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003190# spice probe
3191if test "$spice" != "no" ; then
3192 cat > $TMPC << EOF
3193#include <spice.h>
3194int main(void) { spice_server_new(); return 0; }
3195EOF
Jiri Denemark710fc4f2011-01-24 13:20:29 +01003196 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3197 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003198 if $pkg_config --atleast-version=0.12.0 spice-server && \
3199 $pkg_config --atleast-version=0.12.3 spice-protocol && \
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003200 compile_prog "$spice_cflags" "$spice_libs" ; then
3201 spice="yes"
3202 libs_softmmu="$libs_softmmu $spice_libs"
3203 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
Alon Levy2e0e3c32012-08-22 11:16:26 +03003204 spice_protocol_version=$($pkg_config --modversion spice-protocol)
3205 spice_server_version=$($pkg_config --modversion spice-server)
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003206 else
3207 if test "$spice" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003208 feature_not_found "spice" "Install spice-server and spice-protocol devel"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003209 fi
3210 spice="no"
3211 fi
3212fi
3213
Robert Relyea111a38b2010-11-28 16:36:38 +02003214# check for libcacard for smartcard support
Paolo Bonziniafd347a2012-12-20 20:39:36 +01003215smartcard_cflags=""
3216# TODO - what's the minimal nss version we support?
3217if test "$smartcard_nss" != "no"; then
3218 cat > $TMPC << EOF
Sergei Trofimovich5f01e062012-01-31 22:03:58 +03003219#include <pk11pub.h>
3220int main(void) { PK11_FreeSlot(0); return 0; }
3221EOF
Paolo Bonziniafd347a2012-12-20 20:39:36 +01003222 smartcard_includes="-I\$(SRC_PATH)/libcacard"
3223 libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
3224 libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
3225 test_cflags="$libcacard_cflags"
3226 # The header files in nss < 3.13.3 have a bug which causes them to
3227 # emit a warning. If we're going to compile QEMU with -Werror, then
3228 # test that the headers don't have this bug. Otherwise we would pass
3229 # the configure test but fail to compile QEMU later.
3230 if test "$werror" = "yes"; then
3231 test_cflags="-Werror $test_cflags"
Robert Relyea111a38b2010-11-28 16:36:38 +02003232 fi
Paolo Bonzinib6fc6752012-12-20 20:40:35 +01003233 if test -n "$libtool" &&
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003234 $pkg_config --atleast-version=3.12.8 nss && \
Paolo Bonziniafd347a2012-12-20 20:39:36 +01003235 compile_prog "$test_cflags" "$libcacard_libs"; then
3236 smartcard_nss="yes"
3237 QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
3238 QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
3239 libs_softmmu="$libcacard_libs $libs_softmmu"
3240 else
3241 if test "$smartcard_nss" = "yes"; then
3242 feature_not_found "nss"
3243 fi
3244 smartcard_nss="no"
3245 fi
Robert Relyea111a38b2010-11-28 16:36:38 +02003246fi
3247
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003248# check for libusb
3249if test "$libusb" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003250 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003251 libusb="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02003252 libusb_cflags=$($pkg_config --cflags libusb-1.0)
3253 libusb_libs=$($pkg_config --libs libusb-1.0)
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003254 QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
3255 libs_softmmu="$libs_softmmu $libusb_libs"
3256 else
3257 if test "$libusb" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11003258 feature_not_found "libusb" "Install libusb devel"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003259 fi
3260 libusb="no"
3261 fi
3262fi
3263
Hans de Goede69354a82011-07-19 11:04:10 +02003264# check for usbredirparser for usb network redirection support
3265if test "$usb_redir" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003266 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
Hans de Goede69354a82011-07-19 11:04:10 +02003267 usb_redir="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02003268 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3269 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
Hans de Goede69354a82011-07-19 11:04:10 +02003270 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
Aurelien Jarno56ab2ad2012-09-11 20:57:58 +02003271 libs_softmmu="$libs_softmmu $usb_redir_libs"
Hans de Goede69354a82011-07-19 11:04:10 +02003272 else
3273 if test "$usb_redir" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11003274 feature_not_found "usb-redir" "Install usbredir devel"
Hans de Goede69354a82011-07-19 11:04:10 +02003275 fi
3276 usb_redir="no"
3277 fi
3278fi
3279
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003280##########################################
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04003281# check if we have VSS SDK headers for win
3282
3283if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3284 case "$vss_win32_sdk" in
3285 "") vss_win32_include="-I$source_path" ;;
3286 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3287 # handle path with spaces. So we symlink the headers into ".sdk/vss".
3288 vss_win32_include="-I$source_path/.sdk/vss"
3289 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3290 ;;
3291 *) vss_win32_include="-I$vss_win32_sdk"
3292 esac
3293 cat > $TMPC << EOF
3294#define __MIDL_user_allocate_free_DEFINED__
3295#include <inc/win2003/vss.h>
3296int main(void) { return VSS_CTX_BACKUP; }
3297EOF
3298 if compile_prog "$vss_win32_include" "" ; then
3299 guest_agent_with_vss="yes"
3300 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3301 libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3302 else
3303 if test "$vss_win32_sdk" != "" ; then
3304 echo "ERROR: Please download and install Microsoft VSS SDK:"
3305 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3306 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3307 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
3308 echo "ERROR: The headers are extracted in the directory \`inc'."
3309 feature_not_found "VSS support"
3310 fi
3311 guest_agent_with_vss="no"
3312 fi
3313fi
3314
3315##########################################
3316# lookup Windows platform SDK (if not specified)
3317# The SDK is needed only to build .tlb (type library) file of guest agent
3318# VSS provider from the source. It is usually unnecessary because the
3319# pre-compiled .tlb file is included.
3320
3321if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3322 if test -z "$win_sdk"; then
3323 programfiles="$PROGRAMFILES"
3324 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3325 if test -n "$programfiles"; then
3326 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3327 else
3328 feature_not_found "Windows SDK"
3329 fi
3330 elif test "$win_sdk" = "no"; then
3331 win_sdk=""
3332 fi
3333fi
3334
3335##########################################
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003336
Blue Swirl747bbdf2009-10-18 16:26:06 +00003337##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00003338# check if we have fdatasync
3339
3340fdatasync=no
3341cat > $TMPC << EOF
3342#include <unistd.h>
Alexandre Raymondd1722a22011-05-29 18:22:48 -04003343int main(void) {
3344#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3345return fdatasync(0);
3346#else
Stefan Weile172fe12012-04-06 21:33:20 +02003347#error Not supported
Alexandre Raymondd1722a22011-05-29 18:22:48 -04003348#endif
3349}
Blue Swirl5f6b9e82009-09-20 06:56:26 +00003350EOF
3351if compile_prog "" "" ; then
3352 fdatasync=yes
3353fi
3354
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003355##########################################
Andreas Färbere78815a2010-09-25 11:26:05 +00003356# check if we have madvise
3357
3358madvise=no
3359cat > $TMPC << EOF
3360#include <sys/types.h>
3361#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003362#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00003363int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3364EOF
3365if compile_prog "" "" ; then
3366 madvise=yes
3367fi
3368
3369##########################################
3370# check if we have posix_madvise
3371
3372posix_madvise=no
3373cat > $TMPC << EOF
3374#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003375#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00003376int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3377EOF
3378if compile_prog "" "" ; then
3379 posix_madvise=yes
3380fi
3381
3382##########################################
Richard Henderson1e9737d2012-10-23 07:33:00 +10003383# check if we have usable SIGEV_THREAD_ID
3384
3385sigev_thread_id=no
3386cat > $TMPC << EOF
3387#include <signal.h>
3388int main(void) {
3389 struct sigevent ev;
3390 ev.sigev_notify = SIGEV_THREAD_ID;
3391 ev._sigev_un._tid = 0;
3392 asm volatile("" : : "g"(&ev));
3393 return 0;
3394}
3395EOF
3396if compile_prog "" "" ; then
3397 sigev_thread_id=yes
3398fi
3399
3400##########################################
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003401# check if trace backend exists
3402
Lluís Vilanova650ab982012-04-03 20:47:39 +02003403$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003404if test "$?" -ne 0 ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003405 error_exit "invalid trace backend" \
3406 "Please choose a supported trace backend."
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003407fi
3408
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003409##########################################
3410# For 'ust' backend, test if ust headers are present
3411if test "$trace_backend" = "ust"; then
3412 cat > $TMPC << EOF
Mohamad Gebaibf15f632014-01-29 22:47:54 -05003413#include <lttng/tracepoint.h>
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003414int main(void) { return 0; }
3415EOF
3416 if compile_prog "" "" ; then
Mohamad Gebaibf15f632014-01-29 22:47:54 -05003417 if $pkg_config lttng-ust --exists; then
3418 lttng_ust_libs=`$pkg_config --libs lttng-ust`
3419 else
3420 lttng_ust_libs="-llttng-ust"
3421 fi
3422 if $pkg_config liburcu-bp --exists; then
3423 urcu_bp_libs=`$pkg_config --libs liburcu-bp`
3424 else
3425 urcu_bp_libs="-lurcu-bp"
3426 fi
3427
3428 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
3429 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003430 else
Mohamad Gebaibf15f632014-01-29 22:47:54 -05003431 error_exit "Trace backend 'ust' missing lttng-ust header files"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003432 fi
3433fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00003434
3435##########################################
3436# For 'dtrace' backend, test if 'dtrace' command is present
3437if test "$trace_backend" = "dtrace"; then
3438 if ! has 'dtrace' ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003439 error_exit "dtrace command is not found in PATH $PATH"
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00003440 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00003441 trace_backend_stap="no"
3442 if has 'stap' ; then
3443 trace_backend_stap="yes"
3444 fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00003445fi
3446
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003447##########################################
Alex Barcelo519175a2012-02-28 12:25:50 +01003448# check and set a backend for coroutine
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303449
Peter Maydell7c2acc72013-04-08 12:11:27 +01003450# We prefer ucontext, but it's not always possible. The fallback
3451# is sigcontext. gthread is not selectable except explicitly, because
3452# it is not functional enough to run QEMU proper. (It is occasionally
3453# useful for debugging purposes.) On Windows the only valid backend
3454# is the Windows-specific one.
3455
3456ucontext_works=no
3457if test "$darwin" != "yes"; then
3458 cat > $TMPC << EOF
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303459#include <ucontext.h>
Peter Maydellcdf84802012-02-23 16:20:05 +00003460#ifdef __stub_makecontext
3461#error Ignoring glibc stub makecontext which will always fail
3462#endif
Stefan Weil75cafad2011-12-17 09:27:29 +01003463int main(void) { makecontext(0, 0, 0); return 0; }
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303464EOF
Peter Maydell7c2acc72013-04-08 12:11:27 +01003465 if compile_prog "" "" ; then
3466 ucontext_works=yes
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303467 fi
Peter Maydell7c2acc72013-04-08 12:11:27 +01003468fi
3469
3470if test "$coroutine" = ""; then
3471 if test "$mingw32" = "yes"; then
3472 coroutine=win32
3473 elif test "$ucontext_works" = "yes"; then
3474 coroutine=ucontext
3475 else
3476 coroutine=sigaltstack
3477 fi
Alex Barcelo519175a2012-02-28 12:25:50 +01003478else
Peter Maydell7c2acc72013-04-08 12:11:27 +01003479 case $coroutine in
3480 windows)
3481 if test "$mingw32" != "yes"; then
3482 error_exit "'windows' coroutine backend only valid for Windows"
3483 fi
3484 # Unfortunately the user visible backend name doesn't match the
3485 # coroutine-*.c filename for this case, so we have to adjust it here.
3486 coroutine=win32
3487 ;;
3488 ucontext)
3489 if test "$ucontext_works" != "yes"; then
3490 feature_not_found "ucontext"
3491 fi
3492 ;;
3493 gthread|sigaltstack)
3494 if test "$mingw32" = "yes"; then
3495 error_exit "only the 'windows' coroutine backend is valid for Windows"
3496 fi
3497 ;;
3498 *)
3499 error_exit "unknown coroutine backend $coroutine"
3500 ;;
3501 esac
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303502fi
3503
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02003504if test "$coroutine_pool" = ""; then
3505 if test "$coroutine" = "gthread"; then
3506 coroutine_pool=no
3507 else
3508 coroutine_pool=yes
3509 fi
3510fi
3511if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
3512 error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
3513fi
3514
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303515##########################################
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303516# check if we have open_by_handle_at
3517
Stefan Weil4e1797f2012-06-18 22:11:06 +02003518open_by_handle_at=no
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303519cat > $TMPC << EOF
3520#include <fcntl.h>
Stefan Weilacc55ba2012-06-06 19:35:57 +00003521#if !defined(AT_EMPTY_PATH)
3522# error missing definition
3523#else
Stefan Weil75cafad2011-12-17 09:27:29 +01003524int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
Stefan Weilacc55ba2012-06-06 19:35:57 +00003525#endif
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303526EOF
3527if compile_prog "" "" ; then
3528 open_by_handle_at=yes
3529fi
3530
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05303531########################################
3532# check if we have linux/magic.h
3533
3534linux_magic_h=no
3535cat > $TMPC << EOF
3536#include <linux/magic.h>
3537int main(void) {
Stefan Weil75cafad2011-12-17 09:27:29 +01003538 return 0;
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05303539}
3540EOF
3541if compile_prog "" "" ; then
3542 linux_magic_h=yes
3543fi
3544
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03003545########################################
Kevin Wolfc95e3082013-02-22 21:08:51 +01003546# check whether we can disable warning option with a pragma (this is needed
3547# to silence warnings in the headers of some versions of external libraries).
3548# This test has to be compiled with -Werror as otherwise an unknown pragma is
3549# only a warning.
3550#
3551# If we can't selectively disable warning in the code, disable -Werror so that
3552# the build doesn't fail anyway.
3553
Peter Maydell06d71fa2012-07-30 16:13:07 +01003554pragma_disable_unused_but_set=no
3555cat > $TMPC << EOF
Markus Armbrustere6f53fd2013-04-16 13:51:06 +02003556#pragma GCC diagnostic push
Peter Maydell06d71fa2012-07-30 16:13:07 +01003557#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
Kevin Wolfc95e3082013-02-22 21:08:51 +01003558#pragma GCC diagnostic ignored "-Wstrict-prototypes"
Markus Armbrustere6f53fd2013-04-16 13:51:06 +02003559#pragma GCC diagnostic pop
Kevin Wolfc95e3082013-02-22 21:08:51 +01003560
Peter Maydell06d71fa2012-07-30 16:13:07 +01003561int main(void) {
3562 return 0;
3563}
3564EOF
3565if compile_prog "-Werror" "" ; then
Gerd Hoffmanncc6e3ca2013-01-09 10:17:07 +01003566 pragma_diagnostic_available=yes
Kevin Wolfc95e3082013-02-22 21:08:51 +01003567else
3568 werror=no
Peter Maydell06d71fa2012-07-30 16:13:07 +01003569fi
3570
3571########################################
Christian Borntraeger62fe8332012-08-10 15:11:45 +02003572# check if we have valgrind/valgrind.h and valgrind/memcheck.h
Kevin Wolf3f4349d2012-06-29 13:40:27 +02003573
3574valgrind_h=no
3575cat > $TMPC << EOF
3576#include <valgrind/valgrind.h>
Christian Borntraeger62fe8332012-08-10 15:11:45 +02003577#include <valgrind/memcheck.h>
Kevin Wolf3f4349d2012-06-29 13:40:27 +02003578int main(void) {
Kevin Wolf3f4349d2012-06-29 13:40:27 +02003579 return 0;
3580}
3581EOF
3582if compile_prog "" "" ; then
3583 valgrind_h=yes
3584fi
3585
3586########################################
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03003587# check if environ is declared
3588
3589has_environ=no
3590cat > $TMPC << EOF
3591#include <unistd.h>
3592int main(void) {
Blue Swirlc075a722012-08-09 20:21:25 +00003593 environ = 0;
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03003594 return 0;
3595}
3596EOF
3597if compile_prog "" "" ; then
3598 has_environ=yes
3599fi
3600
Richard Henderson76a347e2012-12-28 14:17:02 -08003601########################################
3602# check if cpuid.h is usable.
3603
3604cpuid_h=no
3605cat > $TMPC << EOF
3606#include <cpuid.h>
3607int main(void) {
Peter Maydell774d5662014-02-20 19:42:53 +00003608 unsigned a, b, c, d;
3609 int max = __get_cpuid_max(0, 0);
3610
3611 if (max >= 1) {
3612 __cpuid(1, a, b, c, d);
3613 }
3614
3615 if (max >= 7) {
3616 __cpuid_count(7, 0, a, b, c, d);
3617 }
3618
3619 return 0;
Richard Henderson76a347e2012-12-28 14:17:02 -08003620}
3621EOF
3622if compile_prog "" "" ; then
3623 cpuid_h=yes
3624fi
3625
Richard Hendersonf5401662013-02-16 12:46:59 -08003626########################################
3627# check if __[u]int128_t is usable.
3628
3629int128=no
3630cat > $TMPC << EOF
3631__int128_t a;
3632__uint128_t b;
3633int main (void) {
3634 a = a + b;
3635 b = a * b;
Peter Maydell464e3672013-06-21 14:01:31 +01003636 a = a * a;
Richard Hendersonf5401662013-02-16 12:46:59 -08003637 return 0;
3638}
3639EOF
3640if compile_prog "" "" ; then
3641 int128=yes
3642fi
Richard Henderson76a347e2012-12-28 14:17:02 -08003643
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08003644########################################
3645# check if getauxval is available.
3646
3647getauxval=no
3648cat > $TMPC << EOF
3649#include <sys/auxv.h>
3650int main(void) {
3651 return getauxval(AT_HWCAP) == 0;
3652}
3653EOF
3654if compile_prog "" "" ; then
3655 getauxval=yes
3656fi
3657
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303658##########################################
Juan Quintelae86ecd42009-08-03 14:45:59 +02003659# End of CC checks
3660# After here, no more $cc or $ld runs
3661
Blue Swirl1d728c32012-05-01 18:45:39 +00003662if test "$gcov" = "yes" ; then
3663 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
3664 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
3665elif test "$debug" = "no" ; then
Michal Privoznike600cdf2013-09-05 12:54:49 +02003666 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02003667fi
Juan Quintelaa316e372009-09-30 01:10:55 +02003668
Peter Lieven6542aa92014-02-03 10:26:13 +01003669##########################################
3670# Do we have libnfs
3671if test "$libnfs" != "no" ; then
3672 if $pkg_config --atleast-version=1.9.2 libnfs; then
3673 libnfs="yes"
3674 libnfs_libs=$($pkg_config --libs libnfs)
3675 LIBS="$LIBS $libnfs_libs"
3676 else
3677 if test "$libnfs" = "yes" ; then
3678 feature_not_found "libnfs"
3679 fi
3680 libnfs="no"
3681 fi
3682fi
Blue Swirl1d728c32012-05-01 18:45:39 +00003683
Anthony Liguori20ff6c82009-12-09 12:59:36 -06003684# Disable zero malloc errors for official releases unless explicitly told to
3685# enable/disable
3686if test -z "$zero_malloc" ; then
3687 if test "$z_version" = "50" ; then
3688 zero_malloc="no"
3689 else
3690 zero_malloc="yes"
3691 fi
3692fi
3693
Peter Maydell6ca026c2012-07-18 15:10:18 +01003694# Now we've finished running tests it's OK to add -Werror to the compiler flags
3695if test "$werror" = "yes"; then
3696 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
3697fi
3698
Juan Quintelae86ecd42009-08-03 14:45:59 +02003699if test "$solaris" = "no" ; then
3700 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02003701 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02003702 fi
3703fi
3704
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02003705# test if pod2man has --utf8 option
3706if pod2man --help | grep -q utf8; then
3707 POD2MAN="pod2man --utf8"
3708else
3709 POD2MAN="pod2man"
3710fi
3711
Blue Swirl952afb72010-09-19 08:36:34 +00003712# Use ASLR, no-SEH and DEP if available
3713if test "$mingw32" = "yes" ; then
3714 for flag in --dynamicbase --no-seh --nxcompat; do
3715 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3716 LDFLAGS="-Wl,$flag $LDFLAGS"
3717 fi
3718 done
3719fi
3720
Eduardo Habkost10ea68b2012-04-18 16:55:39 -03003721qemu_confdir=$sysconfdir$confsuffix
Eduardo Habkost528ae5b2012-04-18 16:55:49 -03003722qemu_datadir=$datadir$confsuffix
Anthony Liguori834574e2013-02-20 07:43:24 -06003723qemu_localedir="$datadir/locale"
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02003724
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01003725tools=""
3726if test "$want_tools" = "yes" ; then
Paolo Bonzinica35f782010-05-26 16:08:29 +02003727 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01003728 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
3729 tools="qemu-nbd\$(EXESUF) $tools"
3730 fi
3731fi
3732if test "$softmmu" = yes ; then
Meador Inge983eef52012-02-24 14:00:42 +05303733 if test "$virtfs" != no ; then
Andreas Färberaabfd882012-05-01 01:12:02 +02003734 if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3735 virtfs=yes
3736 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3737 else
3738 if test "$virtfs" = yes; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003739 error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
Meador Inge983eef52012-02-24 14:00:42 +05303740 fi
Andreas Färber17500372012-05-01 01:12:03 +02003741 virtfs=no
Andreas Färberaabfd882012-05-01 01:12:02 +02003742 fi
M. Mohan Kumar17bff522011-12-14 13:58:42 +05303743 fi
Michael Tokareve8ef31a2013-07-31 14:22:07 +04003744fi
3745if [ "$guest_agent" != "no" ]; then
Tomoki Sekiyamab39297a2013-08-07 11:40:18 -04003746 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
Michael Roth48ff7a62011-07-20 15:19:37 -05003747 tools="qemu-ga\$(EXESUF) $tools"
Tomoki Sekiyamab39297a2013-08-07 11:40:18 -04003748 if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
3749 tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
3750 fi
Michael Tokareve8ef31a2013-07-31 14:22:07 +04003751 guest_agent=yes
3752 elif [ "$guest_agent" != yes ]; then
3753 guest_agent=no
3754 else
3755 error_exit "Guest agent is not supported on this platform"
Paolo Bonzinica35f782010-05-26 16:08:29 +02003756 fi
Paolo Bonzini00c705f2012-05-29 11:40:24 +02003757fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02003758
3759# Mac OS X ships with a broken assembler
3760roms=
3761if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3762 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3763 "$softmmu" = yes ; then
3764 roms="optionrom"
3765fi
Andreas Färberd0384d12011-05-01 18:23:56 +02003766if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
David Gibson39ac8452011-04-01 15:15:23 +11003767 roms="$roms spapr-rtas"
3768fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02003769
Christian Borntraeger9933c302013-04-23 01:23:03 +00003770if test "$cpu" = "s390x" ; then
3771 roms="$roms s390-ccw"
3772fi
3773
Richard Henderson964c6fa2013-06-21 19:10:16 -07003774# Probe for the need for relocating the user-only binary.
3775if test "$pie" = "no" ; then
3776 textseg_addr=
3777 case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07003778 arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64 | x32)
Richard Henderson964c6fa2013-06-21 19:10:16 -07003779 textseg_addr=0x60000000
3780 ;;
3781 mips)
3782 textseg_addr=0x400000
3783 ;;
3784 esac
3785 if [ -n "$textseg_addr" ]; then
3786 cat > $TMPC <<EOF
3787 int main(void) { return 0; }
3788EOF
3789 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
3790 if ! compile_prog "" "$textseg_ldflags"; then
3791 # In case ld does not support -Ttext-segment, edit the default linker
3792 # script via sed to set the .text start addr. This is needed on FreeBSD
3793 # at least.
3794 $ld --verbose | sed \
3795 -e '1,/==================================================/d' \
3796 -e '/==================================================/,$d' \
3797 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
3798 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
3799 textseg_ldflags="-Wl,-T../config-host.ld"
3800 fi
3801 fi
3802fi
3803
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01003804# add pixman flags after all config tests are done
Peter Crosthwaitea540f152013-04-18 14:47:31 +10003805QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01003806libs_softmmu="$libs_softmmu $pixman_libs"
3807
bellard43ce4df2003-06-09 19:53:12 +00003808echo "Install prefix $prefix"
Eduardo Habkostc00b2802012-04-18 16:55:37 -03003809echo "BIOS directory `eval echo $qemu_datadir`"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02003810echo "binary directory `eval echo $bindir`"
Alon Levy3aa5d2b2011-05-15 12:08:59 +03003811echo "library directory `eval echo $libdir`"
Michael Tokarev8bf188a2012-06-07 01:11:00 +04003812echo "libexec directory `eval echo $libexecdir`"
Alon Levy0f94d6d2011-06-27 11:58:20 +02003813echo "include directory `eval echo $includedir`"
Aurelien Jarno1c0fd162010-06-10 00:14:02 +02003814echo "config directory `eval echo $sysconfdir`"
bellard11d9f692004-04-02 20:55:59 +00003815if test "$mingw32" = "no" ; then
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02003816echo "local state directory `eval echo $local_statedir`"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02003817echo "Manual directory `eval echo $mandir`"
bellard43ce4df2003-06-09 19:53:12 +00003818echo "ELF interp prefix $interp_prefix"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02003819else
3820echo "local state directory queried at runtime"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04003821echo "Windows SDK $win_sdk"
bellard11d9f692004-04-02 20:55:59 +00003822fi
bellard5a671352003-10-01 00:13:48 +00003823echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00003824echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00003825echo "Host C compiler $host_cc"
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04003826echo "C++ compiler $cxx"
Peter Maydell3c4a4d02012-08-11 22:34:40 +01003827echo "Objective-C compiler $objcc"
Peter Maydell45d285a2013-10-21 21:03:06 +01003828echo "ARFLAGS $ARFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02003829echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02003830echo "QEMU_CFLAGS $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02003831echo "LDFLAGS $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00003832echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00003833echo "install $install"
Blue Swirlc886edf2011-07-22 21:08:09 +00003834echo "python $python"
Brade2d88302011-09-02 16:53:28 -04003835if test "$slirp" = "yes" ; then
3836 echo "smbd $smbd"
3837fi
bellard43ce4df2003-06-09 19:53:12 +00003838echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00003839echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00003840echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00003841echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00003842echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00003843echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00003844echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00003845echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00003846echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00003847echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00003848if test "$darwin" = "yes" ; then
3849 echo "Cocoa support $cocoa"
3850fi
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02003851echo "pixman $pixman"
bellard97a847b2003-08-10 21:36:04 +00003852echo "SDL support $sdl"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06003853echo "GTK support $gtk"
balrog4d3b6f62008-02-10 16:33:14 +00003854echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02003855echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00003856echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00003857echo "Audio drivers $audio_drv_list"
Fam Zhengb64ec4e2013-05-29 19:35:40 +08003858echo "Block whitelist (rw) $block_drv_rw_whitelist"
3859echo "Block whitelist (ro) $block_drv_ro_whitelist"
Meador Inge983eef52012-02-24 14:00:42 +05303860echo "VirtFS support $virtfs"
Jes Sorensen821601e2011-03-16 13:33:36 +01003861echo "VNC support $vnc"
3862if test "$vnc" = "yes" ; then
3863 echo "VNC TLS support $vnc_tls"
3864 echo "VNC SASL support $vnc_sasl"
3865 echo "VNC JPEG support $vnc_jpeg"
3866 echo "VNC PNG support $vnc_png"
Tim Hardeck7536ee42013-01-21 11:04:44 +01003867 echo "VNC WS support $vnc_ws"
Jes Sorensen821601e2011-03-16 13:33:36 +01003868fi
blueswir131422552007-04-16 18:27:06 +00003869if test -n "$sparc_cpu"; then
3870 echo "Target Sparc Arch $sparc_cpu"
3871fi
aliguorie37630c2009-04-22 15:19:10 +00003872echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00003873echo "brlapi support $brlapi"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02003874echo "bluez support $bluez"
Juan Quintelaa25dba12009-08-12 18:29:52 +02003875echo "Documentation $docs"
pbrookc5937222006-05-14 11:30:38 +00003876[ ! -z "$uname_release" ] && \
3877echo "uname -r $uname_release"
Paul Brook379f6692009-07-17 12:48:08 +01003878echo "GUEST_BASE $guest_base"
Avi Kivity40d64442011-11-15 20:12:17 +02003879echo "PIE $pie"
ths8a16d272008-07-19 09:56:24 +00003880echo "vde support $vde"
Vincenzo Maffione58952132013-11-06 11:44:06 +01003881echo "netmap support $netmap"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003882echo "Linux AIO support $linux_aio"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003883echo "ATTR/XATTR support $attr"
ths77755342008-11-27 15:45:16 +00003884echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02003885echo "KVM support $kvm"
Michael R. Hines2da776d2013-07-22 10:01:54 -04003886echo "RDMA support $rdma"
Stefan Weil9195b2c2011-10-19 07:07:18 +02003887echo "TCG interpreter $tcg_interpreter"
aurel32f652e6a2008-12-16 10:43:48 +00003888echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00003889echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00003890echo "fdatasync $fdatasync"
Andreas Färbere78815a2010-09-25 11:26:05 +00003891echo "madvise $madvise"
3892echo "posix_madvise $posix_madvise"
Richard Henderson1e9737d2012-10-23 07:33:00 +10003893echo "sigev_thread_id $sigev_thread_id"
Stefan Weilee682d22009-10-01 20:10:37 +02003894echo "uuid support $uuid"
Corey Bryant47e98652012-01-26 09:42:26 -05003895echo "libcap-ng support $cap_ng"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02003896echo "vhost-net support $vhost_net"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00003897echo "vhost-scsi support $vhost_scsi"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003898echo "Trace backend $trace_backend"
Prerna Saxena9410b562010-07-13 09:26:32 +01003899echo "Trace output file $trace_file-<pid>"
Alon Levy2e0e3c32012-08-22 11:16:26 +03003900echo "spice support $spice ($spice_protocol_version/$spice_server_version)"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003901echo "rbd support $rbd"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01003902echo "xfsctl support $xfs"
Robert Relyea111a38b2010-11-28 16:36:38 +02003903echo "nss used $smartcard_nss"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003904echo "libusb $libusb"
Hans de Goede69354a82011-07-19 11:04:10 +02003905echo "usb net redir $usb_redir"
Michael Walleb1e5fff2013-03-06 20:23:32 +01003906echo "GLX support $glx"
Stefan Weil219c2522013-12-17 08:57:10 +01003907if test "$libiscsi_version" = "1.4.0"; then
3908echo "libiscsi support $libiscsi (1.4.0)"
3909else
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003910echo "libiscsi support $libiscsi"
Stefan Weil219c2522013-12-17 08:57:10 +01003911fi
Peter Lieven6542aa92014-02-03 10:26:13 +01003912echo "libnfs support $libnfs"
Michael Rothd138cee2011-08-01 14:52:57 -05003913echo "build guest agent $guest_agent"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04003914echo "QGA VSS support $guest_agent_with_vss"
Eduardo Otubof7945732012-08-14 18:44:05 -03003915echo "seccomp support $seccomp"
Peter Maydell7c2acc72013-04-08 12:11:27 +01003916echo "coroutine backend $coroutine"
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02003917echo "coroutine pool $coroutine_pool"
Bharata B Raoeb100392012-09-24 14:42:45 +05303918echo "GlusterFS support $glusterfs"
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01003919echo "virtio-blk-data-plane $virtio_blk_data_plane"
Blue Swirl1d728c32012-05-01 18:45:39 +00003920echo "gcov $gcov_tool"
3921echo "gcov enabled $gcov"
Stefan Bergerab214c22013-02-27 12:47:52 -05003922echo "TPM support $tpm"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01003923echo "libssh2 support $libssh2"
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01003924echo "TPM passthrough $tpm_passthrough"
Paolo Bonzini3556c232013-05-10 14:16:40 +02003925echo "QOM debugging $qom_cast_debug"
Jeff Cody4f18b782013-10-30 10:44:39 -04003926echo "vhdx $vhdx"
Benoît Canet95c6bff2014-02-21 22:21:15 +01003927echo "Quorum $quorum"
bellard67b915a2004-03-31 23:37:16 +00003928
Stefan Weil1ba16962011-07-29 22:40:45 +02003929if test "$sdl_too_old" = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00003930echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00003931fi
bellard97a847b2003-08-10 21:36:04 +00003932
Juan Quintela98ec69a2009-07-16 18:34:18 +02003933config_host_mak="config-host.mak"
bellard97a847b2003-08-10 21:36:04 +00003934
Stefan Weildbd99ae2013-01-01 18:33:44 +01003935echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
3936
Juan Quintela98ec69a2009-07-16 18:34:18 +02003937echo "# Automatically generated by configure - do not modify" > $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02003938echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02003939
Paolo Bonzinie6c3b0f2010-10-21 10:18:35 +02003940echo all: >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02003941echo "prefix=$prefix" >> $config_host_mak
3942echo "bindir=$bindir" >> $config_host_mak
Alon Levy3aa5d2b2011-05-15 12:08:59 +03003943echo "libdir=$libdir" >> $config_host_mak
Michael Tokarev8bf188a2012-06-07 01:11:00 +04003944echo "libexecdir=$libexecdir" >> $config_host_mak
Alon Levy0f94d6d2011-06-27 11:58:20 +02003945echo "includedir=$includedir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02003946echo "mandir=$mandir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02003947echo "sysconfdir=$sysconfdir" >> $config_host_mak
Eduardo Habkost22d07032012-04-18 16:55:42 -03003948echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
Eduardo Habkost9afa52c2012-04-18 16:55:46 -03003949echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
3950echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02003951if test "$mingw32" = "no" ; then
3952 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
3953fi
Michael Tokarevf354b1a2012-10-21 22:52:54 +04003954echo "qemu_helperdir=$libexecdir" >> $config_host_mak
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +01003955echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
3956echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
Anthony Liguori834574e2013-02-20 07:43:24 -06003957echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
Paolo Bonzinif544a482013-04-17 16:26:44 +02003958echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02003959
Juan Quintela98ec69a2009-07-16 18:34:18 +02003960echo "ARCH=$ARCH" >> $config_host_mak
Paolo Bonzini727e5282013-04-17 16:26:43 +02003961
aurel32f8393942009-04-13 18:45:38 +00003962if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02003963 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00003964fi
aliguori1625af82009-04-05 17:41:02 +00003965if test "$strip_opt" = "yes" ; then
Hollis Blanchard52ba7842010-08-04 17:21:34 -07003966 echo "STRIP=${strip}" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00003967fi
bellard7d132992003-03-06 23:23:54 +00003968if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02003969 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00003970fi
bellard67b915a2004-03-31 23:37:16 +00003971if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003972 echo "CONFIG_WIN32=y" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00003973 rc_version=`cat $source_path/VERSION`
3974 version_major=${rc_version%%.*}
3975 rc_version=${rc_version#*.}
3976 version_minor=${rc_version%%.*}
3977 rc_version=${rc_version#*.}
3978 version_subminor=${rc_version%%.*}
3979 version_micro=0
3980 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
3981 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04003982 if test "$guest_agent_with_vss" = "yes" ; then
3983 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
3984 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
3985 fi
pbrook210fa552007-02-27 21:04:49 +00003986else
Juan Quintela35f4df22009-07-27 16:13:07 +02003987 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00003988fi
blueswir1128ab2f2008-08-15 18:33:42 +00003989
Mark McLoughlindffcb712009-10-22 17:49:11 +01003990if test "$linux" = "yes" ; then
3991 echo "CONFIG_LINUX=y" >> $config_host_mak
3992fi
3993
bellard83fb7ad2004-07-05 21:25:26 +00003994if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003995 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00003996fi
malcb29fe3e2008-11-18 01:42:22 +00003997
3998if test "$aix" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02003999 echo "CONFIG_AIX=y" >> $config_host_mak
malcb29fe3e2008-11-18 01:42:22 +00004000fi
4001
bellardec530c82006-04-25 22:36:06 +00004002if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004003 echo "CONFIG_SOLARIS=y" >> $config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02004004 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00004005 if test "$needs_libsunmath" = "yes" ; then
Juan Quintela75b5a692009-07-27 16:13:23 +02004006 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00004007 fi
bellardec530c82006-04-25 22:36:06 +00004008fi
Andreas Färber179cf402010-09-20 00:50:43 +02004009if test "$haiku" = "yes" ; then
4010 echo "CONFIG_HAIKU=y" >> $config_host_mak
4011fi
bellard97a847b2003-08-10 21:36:04 +00004012if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004013 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00004014fi
Stefan Weil1ba16962011-07-29 22:40:45 +02004015if test "$profiler" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004016 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00004017fi
bellardc20709a2004-04-21 23:27:19 +00004018if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004019 echo "CONFIG_SLIRP=y" >> $config_host_mak
Brade2d88302011-09-02 16:53:28 -04004020 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
bellardc20709a2004-04-21 23:27:19 +00004021fi
ths8a16d272008-07-19 09:56:24 +00004022if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004023 echo "CONFIG_VDE=y" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00004024fi
Vincenzo Maffione58952132013-11-06 11:44:06 +01004025if test "$netmap" = "yes" ; then
4026 echo "CONFIG_NETMAP=y" >> $config_host_mak
4027fi
Corey Bryant47e98652012-01-26 09:42:26 -05004028if test "$cap_ng" = "yes" ; then
4029 echo "CONFIG_LIBCAP=y" >> $config_host_mak
4030fi
Juan Quintela2358a492009-07-27 16:13:25 +02004031echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00004032for drv in $audio_drv_list; do
Stefan Weilbb55b712012-03-27 19:23:53 +02004033 def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02004034 echo "$def=y" >> $config_host_mak
malc923e4522008-07-02 18:13:46 +00004035 if test "$drv" = "fmod"; then
Juan Quintela7aac6cb2009-07-27 16:12:47 +02004036 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00004037 fi
4038done
Juan Quintela67f86e82009-08-03 14:46:59 +02004039if test "$audio_pt_int" = "yes" ; then
4040 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
4041fi
malcd5631632009-10-10 01:13:41 +04004042if test "$audio_win_int" = "yes" ; then
4043 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
4044fi
Fam Zhengb64ec4e2013-05-29 19:35:40 +08004045echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
4046echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
Jes Sorensen821601e2011-03-16 13:33:36 +01004047if test "$vnc" = "yes" ; then
4048 echo "CONFIG_VNC=y" >> $config_host_mak
4049fi
ths8d5d2d42007-08-25 01:37:51 +00004050if test "$vnc_tls" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004051 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
ths8d5d2d42007-08-25 01:37:51 +00004052fi
aliguori2f9606b2009-03-06 20:27:28 +00004053if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004054 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00004055fi
Jes Sorensen821601e2011-03-16 13:33:36 +01004056if test "$vnc_jpeg" = "yes" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02004057 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
Corentin Chary2f6f5c72010-07-07 20:57:49 +02004058fi
Jes Sorensen821601e2011-03-16 13:33:36 +01004059if test "$vnc_png" = "yes" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02004060 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
Corentin Charyefe556a2010-07-07 20:57:56 +02004061fi
Tim Hardeck7536ee42013-01-21 11:04:44 +01004062if test "$vnc_ws" = "yes" ; then
4063 echo "CONFIG_VNC_WS=y" >> $config_host_mak
4064 echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
4065fi
aliguori76655d62009-03-06 20:27:37 +00004066if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004067 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00004068fi
Stefan Weilee682d22009-10-01 20:10:37 +02004069if test "$uuid" = "yes" ; then
4070 echo "CONFIG_UUID=y" >> $config_host_mak
4071fi
Christoph Hellwigdce512d2010-12-17 11:41:15 +01004072if test "$xfs" = "yes" ; then
4073 echo "CONFIG_XFS=y" >> $config_host_mak
4074fi
pbrookb1a550a2006-04-16 13:28:56 +00004075qemu_version=`head $source_path/VERSION`
Juan Quintela98ec69a2009-07-16 18:34:18 +02004076echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02004077echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004078echo "SRC_PATH=$source_path" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004079echo "TARGET_DIRS=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02004080if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004081 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00004082fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02004083if test "$sdl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004084 echo "CONFIG_SDL=y" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02004085 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00004086fi
4087if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004088 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00004089fi
4090if test "$curses" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004091 echo "CONFIG_CURSES=y" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00004092fi
Riku Voipioebc996f2009-04-21 15:01:51 +03004093if test "$utimens" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004094 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
Riku Voipioebc996f2009-04-21 15:01:51 +03004095fi
Riku Voipio099d6b02009-05-05 12:10:04 +03004096if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004097 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03004098fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01004099if test "$accept4" = "yes" ; then
4100 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
4101fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304102if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004103 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304104fi
Riku Voipioc2882b92009-08-12 15:08:24 +03004105if test "$eventfd" = "yes" ; then
4106 echo "CONFIG_EVENTFD=y" >> $config_host_mak
4107fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03004108if test "$fallocate" = "yes" ; then
4109 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
4110fi
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01004111if test "$fallocate_punch_hole" = "yes" ; then
4112 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
4113fi
Peter Maydellc727f472011-01-06 11:05:10 +00004114if test "$sync_file_range" = "yes" ; then
4115 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
4116fi
Peter Maydelldace20d2011-01-10 13:11:24 +00004117if test "$fiemap" = "yes" ; then
4118 echo "CONFIG_FIEMAP=y" >> $config_host_mak
4119fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03004120if test "$dup3" = "yes" ; then
4121 echo "CONFIG_DUP3=y" >> $config_host_mak
4122fi
Alex Bligh4e0c6522013-08-21 16:02:43 +01004123if test "$ppoll" = "yes" ; then
4124 echo "CONFIG_PPOLL=y" >> $config_host_mak
4125fi
Alex Blighcd758dd2013-08-21 16:02:44 +01004126if test "$prctl_pr_set_timerslack" = "yes" ; then
4127 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
4128fi
Peter Maydell3b6edd12011-02-15 18:35:05 +00004129if test "$epoll" = "yes" ; then
4130 echo "CONFIG_EPOLL=y" >> $config_host_mak
4131fi
4132if test "$epoll_create1" = "yes" ; then
4133 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
4134fi
4135if test "$epoll_pwait" = "yes" ; then
4136 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
4137fi
Peter Maydella8fd1ab2013-02-08 07:31:55 +00004138if test "$sendfile" = "yes" ; then
4139 echo "CONFIG_SENDFILE=y" >> $config_host_mak
4140fi
aurel323b3f24a2009-04-15 16:12:13 +00004141if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004142 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00004143fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00004144if test "$inotify1" = "yes" ; then
4145 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
4146fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02004147if test "$byteswap_h" = "yes" ; then
4148 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
4149fi
4150if test "$bswap_h" = "yes" ; then
4151 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
4152fi
Alexander Graf769ce762009-05-11 17:41:42 +02004153if test "$curl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004154 echo "CONFIG_CURL=y" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02004155 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02004156fi
aurel322e4d9fb2008-04-08 06:01:02 +00004157if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004158 echo "CONFIG_BRLAPI=y" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00004159fi
balrogfb599c92008-09-28 23:49:55 +00004160if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004161 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02004162 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00004163fi
Anthony Liguorie18df142011-07-19 14:50:29 -05004164echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06004165if test "$gtk" = "yes" ; then
4166 echo "CONFIG_GTK=y" >> $config_host_mak
4167 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
4168 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
4169fi
aliguorie37630c2009-04-22 15:19:10 +00004170if test "$xen" = "yes" ; then
Jan Kiszka6dbd5882011-06-21 22:59:07 +02004171 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00004172 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00004173fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004174if test "$linux_aio" = "yes" ; then
4175 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
4176fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004177if test "$attr" = "yes" ; then
4178 echo "CONFIG_ATTR=y" >> $config_host_mak
4179fi
Avi Kivity4f26f2b2011-11-09 14:44:52 +02004180if test "$libattr" = "yes" ; then
4181 echo "CONFIG_LIBATTR=y" >> $config_host_mak
4182fi
Meador Inge983eef52012-02-24 14:00:42 +05304183if test "$virtfs" = "yes" ; then
4184 echo "CONFIG_VIRTFS=y" >> $config_host_mak
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004185fi
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00004186if test "$vhost_scsi" = "yes" ; then
4187 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
4188fi
ths77755342008-11-27 15:45:16 +00004189if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004190 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00004191fi
aliguoribf9298b2008-12-05 20:05:26 +00004192if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004193 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00004194fi
aliguoriceb42de2009-04-07 18:43:28 +00004195if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004196 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00004197fi
aurel32f652e6a2008-12-16 10:43:48 +00004198if test "$fdt" = "yes" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02004199 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00004200fi
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004201if test "$signalfd" = "yes" ; then
4202 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
4203fi
Stefan Weil9195b2c2011-10-19 07:07:18 +02004204if test "$tcg_interpreter" = "yes" ; then
4205 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
4206fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00004207if test "$fdatasync" = "yes" ; then
4208 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
4209fi
Andreas Färbere78815a2010-09-25 11:26:05 +00004210if test "$madvise" = "yes" ; then
4211 echo "CONFIG_MADVISE=y" >> $config_host_mak
4212fi
4213if test "$posix_madvise" = "yes" ; then
4214 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
4215fi
Richard Henderson1e9737d2012-10-23 07:33:00 +10004216if test "$sigev_thread_id" = "yes" ; then
4217 echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
4218fi
bellard97a847b2003-08-10 21:36:04 +00004219
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004220if test "$spice" = "yes" ; then
4221 echo "CONFIG_SPICE=y" >> $config_host_mak
4222fi
4223
Robert Relyea111a38b2010-11-28 16:36:38 +02004224if test "$smartcard_nss" = "yes" ; then
4225 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
Paul Brookad4cf3f2012-02-09 19:05:29 +00004226 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
4227 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
Robert Relyea111a38b2010-11-28 16:36:38 +02004228fi
4229
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004230if test "$libusb" = "yes" ; then
4231 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
4232fi
4233
Hans de Goede69354a82011-07-19 11:04:10 +02004234if test "$usb_redir" = "yes" ; then
4235 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
4236fi
4237
Michael Walleb1e5fff2013-03-06 20:23:32 +01004238if test "$glx" = "yes" ; then
4239 echo "CONFIG_GLX=y" >> $config_host_mak
Paolo Bonzini2b6b7092013-04-17 16:26:45 +02004240 echo "GLX_LIBS=$glx_libs" >> $config_host_mak
Michael Walle20ff0752011-03-07 23:32:39 +01004241fi
4242
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004243if test "$libiscsi" = "yes" ; then
4244 echo "CONFIG_LIBISCSI=y" >> $config_host_mak
Stefan Weil219c2522013-12-17 08:57:10 +01004245 if test "$libiscsi_version" = "1.4.0"; then
4246 echo "CONFIG_LIBISCSI_1_4=y" >> $config_host_mak
4247 fi
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004248fi
4249
Peter Lieven6542aa92014-02-03 10:26:13 +01004250if test "$libnfs" = "yes" ; then
4251 echo "CONFIG_LIBNFS=y" >> $config_host_mak
4252fi
4253
Eduardo Otubof7945732012-08-14 18:44:05 -03004254if test "$seccomp" = "yes"; then
4255 echo "CONFIG_SECCOMP=y" >> $config_host_mak
4256fi
4257
bellard83fb7ad2004-07-05 21:25:26 +00004258# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00004259if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004260 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00004261fi
4262
Juan Quintela2358a492009-07-27 16:13:25 +02004263echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
pbrookc5937222006-05-14 11:30:38 +00004264
Anthony Liguori20ff6c82009-12-09 12:59:36 -06004265if test "$zero_malloc" = "yes" ; then
4266 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
4267fi
Paolo Bonzini3556c232013-05-10 14:16:40 +02004268if test "$qom_cast_debug" = "yes" ; then
4269 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
4270fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004271if test "$rbd" = "yes" ; then
4272 echo "CONFIG_RBD=y" >> $config_host_mak
4273fi
Anthony Liguori20ff6c82009-12-09 12:59:36 -06004274
Peter Maydell7c2acc72013-04-08 12:11:27 +01004275echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02004276if test "$coroutine_pool" = "yes" ; then
4277 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
4278else
4279 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
4280fi
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05304281
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05304282if test "$open_by_handle_at" = "yes" ; then
4283 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
4284fi
4285
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05304286if test "$linux_magic_h" = "yes" ; then
4287 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
4288fi
4289
Gerd Hoffmanncc6e3ca2013-01-09 10:17:07 +01004290if test "$pragma_diagnostic_available" = "yes" ; then
4291 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
Peter Maydell06d71fa2012-07-30 16:13:07 +01004292fi
4293
Kevin Wolf3f4349d2012-06-29 13:40:27 +02004294if test "$valgrind_h" = "yes" ; then
4295 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
4296fi
4297
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03004298if test "$has_environ" = "yes" ; then
4299 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
4300fi
4301
Richard Henderson76a347e2012-12-28 14:17:02 -08004302if test "$cpuid_h" = "yes" ; then
4303 echo "CONFIG_CPUID_H=y" >> $config_host_mak
4304fi
4305
Richard Hendersonf5401662013-02-16 12:46:59 -08004306if test "$int128" = "yes" ; then
4307 echo "CONFIG_INT128=y" >> $config_host_mak
4308fi
4309
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08004310if test "$getauxval" = "yes" ; then
4311 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
4312fi
4313
Bharata B Raoeb100392012-09-24 14:42:45 +05304314if test "$glusterfs" = "yes" ; then
4315 echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
4316fi
4317
Bharata B Rao0c14fb42013-07-16 21:47:42 +05304318if test "$glusterfs_discard" = "yes" ; then
4319 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
4320fi
4321
Bharata B Rao7c815372013-12-21 14:51:25 +05304322if test "$glusterfs_zerofill" = "yes" ; then
4323 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
4324fi
4325
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004326if test "$libssh2" = "yes" ; then
4327 echo "CONFIG_LIBSSH2=y" >> $config_host_mak
4328fi
4329
Benoît Canet95c6bff2014-02-21 22:21:15 +01004330if test "$quorum" = "yes" ; then
4331 echo "CONFIG_QUORUM=y" >> $config_host_mak
4332fi
4333
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01004334if test "$virtio_blk_data_plane" = "yes" ; then
Paolo Bonzini6e790742013-02-05 12:42:31 +01004335 echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01004336fi
4337
Jeff Cody4f18b782013-10-30 10:44:39 -04004338if test "$vhdx" = "yes" ; then
4339 echo "CONFIG_VHDX=y" >> $config_host_mak
4340fi
4341
blueswir168063642008-11-22 21:03:55 +00004342# USB host support
Gerd Hoffmannb5613fd2013-09-10 11:02:59 +02004343if test "$libusb" = "yes"; then
4344 echo "HOST_USB=libusb legacy" >> $config_host_mak
4345else
Juan Quintela98ec69a2009-07-16 18:34:18 +02004346 echo "HOST_USB=stub" >> $config_host_mak
Gerd Hoffmannb5613fd2013-09-10 11:02:59 +02004347fi
blueswir168063642008-11-22 21:03:55 +00004348
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01004349# TPM passthrough support?
4350if test "$tpm" = "yes"; then
4351 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
4352 if test "$tpm_passthrough" = "yes"; then
4353 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
4354 fi
4355fi
4356
Lluíse4858972011-08-31 20:31:03 +02004357# use default implementation for tracing backend-specific routines
4358trace_default=yes
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01004359echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
Lluís6d8a7642011-08-31 20:30:43 +02004360if test "$trace_backend" = "nop"; then
4361 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
Prerna Saxena22890ab2010-06-24 17:04:53 +05304362fi
Prerna Saxena9410b562010-07-13 09:26:32 +01004363if test "$trace_backend" = "simple"; then
Lluís6d8a7642011-08-31 20:30:43 +02004364 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02004365 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02004366 # Set the appropriate trace file.
Andreas Färber953ffe02011-06-02 19:58:06 +02004367 trace_file="\"$trace_file-\" FMT_pid"
Prerna Saxena9410b562010-07-13 09:26:32 +01004368fi
Lluís6d8a7642011-08-31 20:30:43 +02004369if test "$trace_backend" = "stderr"; then
4370 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
Lluís9a82b6a2011-08-31 20:31:51 +02004371 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02004372fi
4373if test "$trace_backend" = "ust"; then
4374 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
4375fi
4376if test "$trace_backend" = "dtrace"; then
4377 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
4378 if test "$trace_backend_stap" = "yes" ; then
4379 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
4380 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00004381fi
Eiichi Tsukata781e9542013-04-11 20:25:15 +09004382if test "$trace_backend" = "ftrace"; then
4383 if test "$linux" = "yes" ; then
4384 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
4385 trace_default=no
4386 else
Stewart Smith21684af2014-01-24 12:39:10 +11004387 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
Eiichi Tsukata781e9542013-04-11 20:25:15 +09004388 fi
4389fi
Prerna Saxena9410b562010-07-13 09:26:32 +01004390echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02004391if test "$trace_default" = "yes"; then
4392 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
4393fi
Prerna Saxena9410b562010-07-13 09:26:32 +01004394
Michael R. Hines2da776d2013-07-22 10:01:54 -04004395if test "$rdma" = "yes" ; then
4396 echo "CONFIG_RDMA=y" >> $config_host_mak
4397fi
4398
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02004399if test "$tcg_interpreter" = "yes"; then
4400 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
4401elif test "$ARCH" = "sparc64" ; then
4402 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
4403elif test "$ARCH" = "s390x" ; then
4404 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
Richard Hendersonc72b26e2013-08-20 12:20:05 -07004405elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02004406 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
4407else
4408 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
4409fi
4410QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
4411
Juan Quintela98ec69a2009-07-16 18:34:18 +02004412echo "TOOLS=$tools" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004413echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004414echo "MAKE=$make" >> $config_host_mak
4415echo "INSTALL=$install" >> $config_host_mak
Brad1901cb12011-08-28 04:01:33 -04004416echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
4417echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
Paolo Bonzini21655882012-12-20 18:57:45 +01004418if test -n "$libtool"; then
4419 echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
4420 echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
4421else
4422 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
4423 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
4424fi
Blue Swirlc886edf2011-07-22 21:08:09 +00004425echo "PYTHON=$python" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004426echo "CC=$cc" >> $config_host_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03004427if $iasl -h > /dev/null 2>&1; then
4428 echo "IASL=$iasl" >> $config_host_mak
4429fi
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02004430echo "CC_I386=$cc_i386" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004431echo "HOST_CC=$host_cc" >> $config_host_mak
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04004432echo "CXX=$cxx" >> $config_host_mak
Peter Maydell3c4a4d02012-08-11 22:34:40 +01004433echo "OBJCC=$objcc" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004434echo "AR=$ar" >> $config_host_mak
Peter Maydell45d285a2013-10-21 21:03:06 +01004435echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00004436echo "AS=$as" >> $config_host_mak
4437echo "CPP=$cpp" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004438echo "OBJCOPY=$objcopy" >> $config_host_mak
4439echo "LD=$ld" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00004440echo "WINDRES=$windres" >> $config_host_mak
Alon Levy44dc0ca2011-05-15 11:51:28 +03004441echo "LIBTOOL=$libtool" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02004442echo "CFLAGS=$CFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05004443echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02004444echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01004445echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01004446if test "$sparse" = "yes" ; then
4447 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
4448 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
4449 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
4450fi
Gerd Hoffmann42da6042012-11-07 11:09:52 +01004451if test "$cross_prefix" != ""; then
4452 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
4453else
4454 echo "AUTOCONF_HOST := " >> $config_host_mak
4455fi
Juan Quintelae2a2ed02009-08-03 14:46:02 +02004456echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05004457echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
Marc-André Lureau37746c52013-02-25 23:31:12 +01004458echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02004459echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02004460echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004461echo "EXESUF=$EXESUF" >> $config_host_mak
Michael Roth957f1f92011-08-11 15:38:12 -05004462echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02004463echo "POD2MAN=$POD2MAN" >> $config_host_mak
Paolo Bonzinicbdd1992012-11-28 09:40:23 +01004464echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
Blue Swirl1d728c32012-05-01 18:45:39 +00004465if test "$gcov" = "yes" ; then
4466 echo "CONFIG_GCOV=y" >> $config_host_mak
4467 echo "GCOV=$gcov_tool" >> $config_host_mak
4468fi
Juan Quintela804edf22009-07-27 16:12:49 +02004469
Peter Maydell6efd7512011-11-30 11:59:04 +00004470# use included Linux headers
4471if test "$linux" = "yes" ; then
Andreas Färbera307beb2012-06-14 15:14:33 +00004472 mkdir -p linux-headers
Peter Maydell6efd7512011-11-30 11:59:04 +00004473 case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07004474 i386|x86_64|x32)
Peter Maydell08312a62012-08-03 13:51:25 +01004475 linux_arch=x86
Peter Maydell6efd7512011-11-30 11:59:04 +00004476 ;;
4477 ppcemb|ppc|ppc64)
Peter Maydell08312a62012-08-03 13:51:25 +01004478 linux_arch=powerpc
Peter Maydell6efd7512011-11-30 11:59:04 +00004479 ;;
4480 s390x)
Peter Maydell08312a62012-08-03 13:51:25 +01004481 linux_arch=s390
4482 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +01004483 aarch64)
4484 linux_arch=arm64
4485 ;;
Peter Maydell08312a62012-08-03 13:51:25 +01004486 *)
4487 # For most CPUs the kernel architecture name and QEMU CPU name match.
4488 linux_arch="$cpu"
Peter Maydell6efd7512011-11-30 11:59:04 +00004489 ;;
4490 esac
Peter Maydell08312a62012-08-03 13:51:25 +01004491 # For non-KVM architectures we will not have asm headers
4492 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
4493 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
4494 fi
Peter Maydell6efd7512011-11-30 11:59:04 +00004495fi
4496
bellard1d14ffa2005-10-30 18:58:22 +00004497for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00004498target_dir="$target"
Juan Quintela25be2102009-10-07 02:41:00 +02004499config_target_mak=$target_dir/config-target.mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004500target_name=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00004501target_bigendian="no"
Juan Quintela1f3d3c82009-10-07 02:41:02 +02004502
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004503case "$target_name" in
Anthony Greend15a9c22013-03-18 15:49:25 -04004504 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
Juan Quintelaea2d6a32009-07-16 18:34:10 +02004505 target_bigendian=yes
4506 ;;
4507esac
bellard97a847b2003-08-10 21:36:04 +00004508target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00004509target_user_only="no"
ths831b7822007-01-18 20:06:33 +00004510target_linux_user="no"
blueswir184778502008-10-26 20:33:16 +00004511target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00004512case "$target" in
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004513 ${target_name}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00004514 target_softmmu="yes"
4515 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004516 ${target_name}-linux-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00004517 if test "$linux" != "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01004518 error_exit "Target '$target' is only available on a Linux host"
Blue Swirl9c7a4202009-11-17 20:52:56 +00004519 fi
pbrook9e407a82007-05-26 16:38:53 +00004520 target_user_only="yes"
4521 target_linux_user="yes"
4522 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004523 ${target_name}-bsd-user)
Blue Swirl9cf55762009-11-17 21:27:18 +00004524 if test "$bsd" != "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01004525 error_exit "Target '$target' is only available on a BSD host"
Blue Swirl9c7a4202009-11-17 20:52:56 +00004526 fi
blueswir184778502008-10-26 20:33:16 +00004527 target_user_only="yes"
4528 target_bsd_user="yes"
4529 ;;
pbrook9e407a82007-05-26 16:38:53 +00004530 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01004531 error_exit "Target '$target' not recognised"
pbrook9e407a82007-05-26 16:38:53 +00004532 exit 1
4533 ;;
4534esac
ths831b7822007-01-18 20:06:33 +00004535
bellard97a847b2003-08-10 21:36:04 +00004536mkdir -p $target_dir
Juan Quintela25be2102009-10-07 02:41:00 +02004537echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00004538
pbrooke5fe0c52006-06-11 13:32:59 +00004539bflt="no"
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004540interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
pbrook56aebc82008-10-11 17:55:29 +00004541gdb_xml_files=""
aliguori7ba1e612008-11-05 16:04:33 +00004542
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004543TARGET_ARCH="$target_name"
Juan Quintela6acff7d2009-07-16 18:34:15 +02004544TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02004545TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02004546
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004547case "$target_name" in
aurel322408a522008-04-20 20:19:44 +00004548 i386)
aurel322408a522008-04-20 20:19:44 +00004549 ;;
4550 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004551 TARGET_BASE_ARCH=i386
aurel322408a522008-04-20 20:19:44 +00004552 ;;
4553 alpha)
aurel322408a522008-04-20 20:19:44 +00004554 ;;
4555 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004556 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00004557 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00004558 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00004559 ;;
Alexander Graf6a49fa92013-09-03 20:12:22 +01004560 aarch64)
4561 TARGET_BASE_ARCH=arm
4562 bflt="yes"
Peter Maydell6a669422013-12-17 19:42:32 +00004563 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml"
Alexander Graf6a49fa92013-09-03 20:12:22 +01004564 ;;
aurel322408a522008-04-20 20:19:44 +00004565 cris)
aurel322408a522008-04-20 20:19:44 +00004566 ;;
Michael Walle613a22c2011-02-17 23:45:17 +01004567 lm32)
Michael Walle613a22c2011-02-17 23:45:17 +01004568 ;;
aurel322408a522008-04-20 20:19:44 +00004569 m68k)
aurel322408a522008-04-20 20:19:44 +00004570 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00004571 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00004572 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01004573 microblaze|microblazeel)
4574 TARGET_ARCH=microblaze
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02004575 bflt="yes"
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02004576 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02004577 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004578 TARGET_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02004579 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004580 ;;
4581 mipsn32|mipsn32el)
Richard Henderson597e2ce2013-02-10 10:30:50 -08004582 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004583 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02004584 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Richard Henderson597e2ce2013-02-10 10:30:50 -08004585 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004586 ;;
4587 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004588 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004589 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02004590 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004591 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04004592 moxie)
4593 ;;
Jia Liue67db062012-07-20 15:50:39 +08004594 or32)
4595 TARGET_ARCH=openrisc
4596 TARGET_BASE_ARCH=openrisc
Jia Liue67db062012-07-20 15:50:39 +08004597 ;;
aurel322408a522008-04-20 20:19:44 +00004598 ppc)
aurel32c8b35322009-01-24 15:07:34 +00004599 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004600 ;;
4601 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004602 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004603 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00004604 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004605 ;;
4606 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004607 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004608 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00004609 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004610 ;;
4611 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004612 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004613 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004614 TARGET_ABI_DIR=ppc
Juan Quintela25be2102009-10-07 02:41:00 +02004615 echo "TARGET_ABI32=y" >> $config_target_mak
aurel32c8b35322009-01-24 15:07:34 +00004616 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004617 ;;
4618 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004619 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00004620 bflt="yes"
4621 ;;
4622 sparc)
aurel322408a522008-04-20 20:19:44 +00004623 ;;
4624 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004625 TARGET_BASE_ARCH=sparc
aurel322408a522008-04-20 20:19:44 +00004626 ;;
4627 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004628 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004629 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004630 TARGET_ABI_DIR=sparc
Juan Quintela25be2102009-10-07 02:41:00 +02004631 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004632 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01004633 s390x)
Alexander Graf24e804ec2009-12-05 12:44:22 +01004634 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +08004635 unicore32)
Guan Xuetaod2fbca92011-04-12 16:27:03 +08004636 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04004637 xtensa|xtensaeb)
4638 TARGET_ARCH=xtensa
Max Filippovcfa550c2011-09-06 03:55:26 +04004639 ;;
aurel322408a522008-04-20 20:19:44 +00004640 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01004641 error_exit "Unsupported target CPU"
aurel322408a522008-04-20 20:19:44 +00004642 ;;
4643esac
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02004644# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
4645if [ "$TARGET_BASE_ARCH" = "" ]; then
4646 TARGET_BASE_ARCH=$TARGET_ARCH
4647fi
4648
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02004649symlink "$source_path/Makefile.target" "$target_dir/Makefile"
4650
Daniel P. Berrange99afc912012-08-20 15:31:38 +01004651upper() {
4652 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
4653}
4654
Daniel P. Berrange99afc912012-08-20 15:31:38 +01004655target_arch_name="`upper $TARGET_ARCH`"
Juan Quintela25be2102009-10-07 02:41:00 +02004656echo "TARGET_$target_arch_name=y" >> $config_target_mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004657echo "TARGET_NAME=$target_name" >> $config_target_mak
Juan Quintela25be2102009-10-07 02:41:00 +02004658echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02004659if [ "$TARGET_ABI_DIR" = "" ]; then
4660 TARGET_ABI_DIR=$TARGET_ARCH
4661fi
Juan Quintela25be2102009-10-07 02:41:00 +02004662echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004663case "$target_name" in
Juan Quintela1b0c87f2009-07-16 18:33:59 +02004664 i386|x86_64)
4665 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004666 echo "CONFIG_XEN=y" >> $config_target_mak
Anthony PERARDeb6fda02012-06-21 15:32:59 +00004667 if test "$xen_pci_passthrough" = yes; then
4668 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4669 fi
Juan Quintela1b0c87f2009-07-16 18:33:59 +02004670 fi
Alexander Graf59d21e52011-07-17 07:30:29 +02004671 ;;
4672 *)
Juan Quintela1b0c87f2009-07-16 18:33:59 +02004673esac
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004674case "$target_name" in
Peter Maydell70a5f682013-12-17 19:42:30 +00004675 aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
Juan Quintelac59249f2009-07-16 18:34:00 +02004676 # Make sure the target and host cpus are compatible
4677 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004678 \( "$target_name" = "$cpu" -o \
4679 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
4680 \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
4681 \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
4682 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
4683 \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
4684 \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004685 echo "CONFIG_KVM=y" >> $config_target_mak
Stefan Weil1ba16962011-07-29 22:40:45 +02004686 if test "$vhost_net" = "yes" ; then
Michael S. Tsirkind5970052010-03-17 13:08:17 +02004687 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
4688 fi
Juan Quintelac59249f2009-07-16 18:34:00 +02004689 fi
4690esac
bellardde83cd02003-06-15 20:25:43 +00004691if test "$target_bigendian" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004692 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00004693fi
4694if test "$target_softmmu" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004695 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
bellardde83cd02003-06-15 20:25:43 +00004696fi
bellard997344f2003-10-27 21:10:39 +00004697if test "$target_user_only" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004698 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
Stefan Weila2c80be2011-12-22 11:26:10 +01004699 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00004700fi
ths831b7822007-01-18 20:06:33 +00004701if test "$target_linux_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004702 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00004703fi
pbrook56aebc82008-10-11 17:55:29 +00004704list=""
4705if test ! -z "$gdb_xml_files" ; then
4706 for x in $gdb_xml_files; do
4707 list="$list $source_path/gdb-xml/$x"
4708 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02004709 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00004710fi
bellardde83cd02003-06-15 20:25:43 +00004711
pbrooke5fe0c52006-06-11 13:32:59 +00004712if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02004713 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00004714fi
Paul Brook379f6692009-07-17 12:48:08 +01004715if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02004716 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
Paul Brook379f6692009-07-17 12:48:08 +01004717fi
blueswir184778502008-10-26 20:33:16 +00004718if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004719 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00004720fi
bellard5b0753e2005-03-01 21:37:28 +00004721
Juan Quintela4afddb52009-08-03 14:46:45 +02004722# generate QEMU_CFLAGS/LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02004723
Juan Quintela4afddb52009-08-03 14:46:45 +02004724cflags=""
Juan Quintelafa282482009-07-22 22:37:39 +02004725ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02004726
Juan Quintela64656022009-08-03 14:46:53 +02004727for i in $ARCH $TARGET_BASE_ARCH ; do
4728 case "$i" in
4729 alpha)
Juan Quintela25be2102009-10-07 02:41:00 +02004730 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004731 echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004732 ;;
4733 arm)
Juan Quintela25be2102009-10-07 02:41:00 +02004734 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004735 echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak
Claudio Fontana999b53e2014-02-05 17:27:28 +00004736 if test -n "${cxx}"; then
4737 echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
4738 echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
4739 fi
Juan Quintela64656022009-08-03 14:46:53 +02004740 ;;
4741 cris)
Juan Quintela25be2102009-10-07 02:41:00 +02004742 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004743 echo "CONFIG_CRIS_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004744 ;;
4745 hppa)
Juan Quintela25be2102009-10-07 02:41:00 +02004746 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004747 echo "CONFIG_HPPA_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004748 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07004749 i386|x86_64|x32)
Juan Quintela25be2102009-10-07 02:41:00 +02004750 echo "CONFIG_I386_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004751 echo "CONFIG_I386_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004752 ;;
Aurelien Jarno903ec552010-03-29 02:12:51 +02004753 ia64*)
4754 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004755 echo "CONFIG_IA64_DIS=y" >> config-all-disas.mak
Aurelien Jarno903ec552010-03-29 02:12:51 +02004756 ;;
Michael Walle79368f42012-03-31 19:54:20 +02004757 lm32)
4758 echo "CONFIG_LM32_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004759 echo "CONFIG_LM32_DIS=y" >> config-all-disas.mak
Michael Walle79368f42012-03-31 19:54:20 +02004760 ;;
Juan Quintela64656022009-08-03 14:46:53 +02004761 m68k)
Juan Quintela25be2102009-10-07 02:41:00 +02004762 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004763 echo "CONFIG_M68K_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004764 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01004765 microblaze*)
Juan Quintela25be2102009-10-07 02:41:00 +02004766 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004767 echo "CONFIG_MICROBLAZE_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004768 ;;
4769 mips*)
Juan Quintela25be2102009-10-07 02:41:00 +02004770 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004771 echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004772 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04004773 moxie*)
4774 echo "CONFIG_MOXIE_DIS=y" >> $config_target_mak
4775 echo "CONFIG_MOXIE_DIS=y" >> config-all-disas.mak
4776 ;;
Jia Liue67db062012-07-20 15:50:39 +08004777 or32)
4778 echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004779 echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak
Jia Liue67db062012-07-20 15:50:39 +08004780 ;;
Juan Quintela64656022009-08-03 14:46:53 +02004781 ppc*)
Juan Quintela25be2102009-10-07 02:41:00 +02004782 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004783 echo "CONFIG_PPC_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004784 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01004785 s390*)
Juan Quintela25be2102009-10-07 02:41:00 +02004786 echo "CONFIG_S390_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004787 echo "CONFIG_S390_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004788 ;;
4789 sh4)
Juan Quintela25be2102009-10-07 02:41:00 +02004790 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004791 echo "CONFIG_SH4_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004792 ;;
4793 sparc*)
Juan Quintela25be2102009-10-07 02:41:00 +02004794 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004795 echo "CONFIG_SPARC_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004796 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04004797 xtensa*)
4798 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004799 echo "CONFIG_XTENSA_DIS=y" >> config-all-disas.mak
Max Filippovcfa550c2011-09-06 03:55:26 +04004800 ;;
Juan Quintela64656022009-08-03 14:46:53 +02004801 esac
4802done
Stefan Weil9195b2c2011-10-19 07:07:18 +02004803if test "$tcg_interpreter" = "yes" ; then
4804 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004805 echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak
Stefan Weil9195b2c2011-10-19 07:07:18 +02004806fi
Juan Quintela64656022009-08-03 14:46:53 +02004807
Juan Quintela6ee71262009-08-03 14:46:47 +02004808case "$ARCH" in
4809alpha)
4810 # Ensure there's only a single GP
4811 cflags="-msmall-data $cflags"
4812;;
4813esac
4814
Juan Quintelad02c1db2009-08-03 14:46:50 +02004815if test "$gprof" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004816 echo "TARGET_GPROF=yes" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02004817 if test "$target_linux_user" = "yes" ; then
4818 cflags="-p $cflags"
4819 ldflags="-p $ldflags"
4820 fi
4821 if test "$target_softmmu" = "yes" ; then
4822 ldflags="-p $ldflags"
Juan Quintela25be2102009-10-07 02:41:00 +02004823 echo "GPROF_CFLAGS=-p" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02004824 fi
4825fi
4826
Juan Quintela9b8e1112009-08-03 14:46:46 +02004827if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
Richard Henderson964c6fa2013-06-21 19:10:16 -07004828 ldflags="$ldflags $textseg_ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02004829fi
Juan Quintelafa282482009-07-22 22:37:39 +02004830
Juan Quintela25be2102009-10-07 02:41:00 +02004831echo "LDFLAGS+=$ldflags" >> $config_target_mak
4832echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02004833
bellard97a847b2003-08-10 21:36:04 +00004834done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00004835
Gerd Hoffmannb776eca2012-11-12 12:18:38 +01004836if [ "$pixman" = "internal" ]; then
4837 echo "config-host.h: subdir-pixman" >> $config_host_mak
4838fi
4839
Michael R. Hines2da776d2013-07-22 10:01:54 -04004840if test "$rdma" = "yes" ; then
4841echo "CONFIG_RDMA=y" >> $config_host_mak
4842fi
4843
Peter Crosthwaitea540f152013-04-18 14:47:31 +10004844if [ "$dtc_internal" = "yes" ]; then
4845 echo "config-host.h: subdir-dtc" >> $config_host_mak
4846fi
4847
Paolo Bonzinid1807a42010-12-23 11:43:59 +01004848# build tree in object directory in case the source is not in the current directory
Wenchao Xiaf93296e2013-09-06 11:24:32 +08004849DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
Michael Tokarev2b170ef2013-10-21 12:33:58 +04004850DIRS="$DIRS fsdev"
Christian Borntraeger9933c302013-04-23 01:23:03 +00004851DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01004852DIRS="$DIRS roms/seabios roms/vgabios"
Paolo Bonzini2dee8d52012-06-04 09:15:43 +02004853DIRS="$DIRS qapi-generated"
Anthony Liguoric09015d2012-01-10 13:10:42 -06004854FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
4855FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
Andreas Färberaaa2ebc2013-07-06 20:41:37 +02004856FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01004857FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
Andreas Färber446b9162011-05-08 13:25:56 +02004858FILES="$FILES pc-bios/spapr-rtas/Makefile"
Christian Borntraeger9933c302013-04-23 01:23:03 +00004859FILES="$FILES pc-bios/s390-ccw/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01004860FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
Jan Kiszka4652b792013-02-22 21:05:01 +01004861FILES="$FILES pc-bios/qemu-icon.bmp"
Richard Henderson753d11f2011-06-24 11:58:37 -07004862for bios_file in \
4863 $source_path/pc-bios/*.bin \
Gerd Hoffmann5acc2ec2012-12-03 10:45:49 +01004864 $source_path/pc-bios/*.aml \
Richard Henderson753d11f2011-06-24 11:58:37 -07004865 $source_path/pc-bios/*.rom \
4866 $source_path/pc-bios/*.dtb \
Dominik Dingele89e33e2013-04-29 04:52:06 +00004867 $source_path/pc-bios/*.img \
Richard Henderson753d11f2011-06-24 11:58:37 -07004868 $source_path/pc-bios/openbios-* \
4869 $source_path/pc-bios/palcode-*
4870do
Paolo Bonzinid1807a42010-12-23 11:43:59 +01004871 FILES="$FILES pc-bios/`basename $bios_file`"
4872done
Marcel Apfelbaumc2304b52013-12-26 16:54:20 +02004873for test_file in `find $source_path/tests/acpi-test-data -type f`
4874do
4875 FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`"
4876done
Paolo Bonzinid1807a42010-12-23 11:43:59 +01004877mkdir -p $DIRS
4878for f in $FILES ; do
Stefan Weil72b8b5a2012-03-19 13:20:47 +01004879 if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
Peter Maydellf9245e12011-06-03 17:10:40 +01004880 symlink "$source_path/$f" "$f"
4881 fi
Paolo Bonzinid1807a42010-12-23 11:43:59 +01004882done
Paul Brook1ad21342009-05-19 16:17:58 +01004883
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05004884# temporary config to build submodules
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06004885for rom in seabios vgabios ; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05004886 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01004887 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05004888 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00004889 echo "AS=$as" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05004890 echo "CC=$cc" >> $config_mak
4891 echo "BCC=bcc" >> $config_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00004892 echo "CPP=$cpp" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05004893 echo "OBJCOPY=objcopy" >> $config_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03004894 echo "IASL=$iasl" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05004895 echo "LD=$ld" >> $config_mak
4896done
4897
Jan Kiszkab40292e2010-05-31 14:43:31 -03004898if test "$docs" = "yes" ; then
4899 mkdir -p QMP
4900fi