blob: 8b98ead239301c71c1c34fbaba91452990892713 [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"
Don Slutz66518bf2014-01-02 21:12:46 -050015TMPB="qemu-conf-${RANDOM}-$$-${RANDOM}"
16TMPO="${TMPDIR1}/${TMPB}.o"
17TMPL="${TMPDIR1}/${TMPB}.lo"
18TMPA="${TMPDIR1}/lib${TMPB}.la"
malca91b8572009-10-15 01:57:14 +040019TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
bellard7d132992003-03-06 23:23:54 +000020
Loïc Minier0ba86812010-09-25 21:52:30 +020021# NB: do not call "exit" in the trap handler; this is buggy with some shells;
22# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
23trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020024rm -f config.log
malc9ac81bb2008-11-29 20:09:56 +000025
Peter Maydellb48e3612011-11-23 17:26:44 +000026# Print a helpful header at the top of config.log
27echo "# QEMU configure log $(date)" >> config.log
Peter Maydell979ae162012-03-07 12:16:29 +000028printf "# Configured with:" >> config.log
29printf " '%s'" "$0" "$@" >> config.log
30echo >> config.log
Peter Maydellb48e3612011-11-23 17:26:44 +000031echo "#" >> config.log
32
Stefan Weilbdf523e2013-10-20 18:39:21 +020033# Save the configure command line for later reuse.
34cat <<EOD >config.status
35#!/bin/sh
36# Generated by configure.
37# Run this file to recreate the current configuration.
38# Compiler output produced by configure, useful for debugging
39# configure, is in config.log if it exists.
40EOD
41printf "exec" >>config.status
42printf " '%s'" "$0" "$@" >>config.status
43echo >>config.status
44chmod +x config.status
45
Peter Maydell76ad07a2013-04-08 12:11:26 +010046error_exit() {
47 echo
48 echo "ERROR: $1"
49 while test -n "$2"; do
50 echo " $2"
51 shift
52 done
53 echo
54 exit 1
55}
56
Peter Maydell8dc38a72012-07-18 15:10:28 +010057do_cc() {
58 # Run the compiler, capturing its output to the log.
59 echo $cc "$@" >> config.log
60 $cc "$@" >> config.log 2>&1 || return $?
61 # Test passed. If this is an --enable-werror build, rerun
62 # the test with -Werror and bail out if it fails. This
63 # makes warning-generating-errors in configure test code
64 # obvious to developers.
65 if test "$werror" != "yes"; then
66 return 0
67 fi
68 # Don't bother rerunning the compile if we were already using -Werror
69 case "$*" in
70 *-Werror*)
71 return 0
72 ;;
73 esac
74 echo $cc -Werror "$@" >> config.log
75 $cc -Werror "$@" >> config.log 2>&1 && return $?
Peter Maydell76ad07a2013-04-08 12:11:26 +010076 error_exit "configure test passed without -Werror but failed with -Werror." \
77 "This is probably a bug in the configure script. The failing command" \
78 "will be at the bottom of config.log." \
79 "You can run configure with --disable-werror to bypass this check."
Peter Maydell8dc38a72012-07-18 15:10:28 +010080}
81
Juan Quintela52166aa2009-08-03 14:46:03 +020082compile_object() {
Peter Maydell8dc38a72012-07-18 15:10:28 +010083 do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
Juan Quintela52166aa2009-08-03 14:46:03 +020084}
85
86compile_prog() {
87 local_cflags="$1"
88 local_ldflags="$2"
Peter Maydell8dc38a72012-07-18 15:10:28 +010089 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
Juan Quintela52166aa2009-08-03 14:46:03 +020090}
91
Don Slutz66518bf2014-01-02 21:12:46 -050092do_libtool() {
93 local mode=$1
94 shift
95 # Run the compiler, capturing its output to the log.
96 echo $libtool $mode --tag=CC $cc "$@" >> config.log
97 $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $?
98 # Test passed. If this is an --enable-werror build, rerun
99 # the test with -Werror and bail out if it fails. This
100 # makes warning-generating-errors in configure test code
101 # obvious to developers.
102 if test "$werror" != "yes"; then
103 return 0
104 fi
105 # Don't bother rerunning the compile if we were already using -Werror
106 case "$*" in
107 *-Werror*)
108 return 0
109 ;;
110 esac
111 echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log
112 $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $?
113 error_exit "configure test passed without -Werror but failed with -Werror." \
114 "This is probably a bug in the configure script. The failing command" \
115 "will be at the bottom of config.log." \
116 "You can run configure with --disable-werror to bypass this check."
117}
118
119libtool_prog() {
120 do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $?
121 do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib
122}
123
Paolo Bonzini11568d62010-12-23 11:43:58 +0100124# symbolically link $1 to $2. Portable version of "ln -sf".
125symlink() {
Stefan Weil72b8b5a2012-03-19 13:20:47 +0100126 rm -rf "$2"
Anthony Liguoriec5b06d2012-06-06 16:57:00 +0800127 mkdir -p "$(dirname "$2")"
Stefan Weil72b8b5a2012-03-19 13:20:47 +0100128 ln -s "$1" "$2"
Paolo Bonzini11568d62010-12-23 11:43:58 +0100129}
130
Loïc Minier0dba6192010-01-28 21:26:51 +0000131# check whether a command is available to this shell (may be either an
132# executable or a builtin)
133has() {
134 type "$1" >/dev/null 2>&1
135}
136
137# search for an executable in PATH
138path_of() {
139 local_command="$1"
140 local_ifs="$IFS"
141 local_dir=""
142
143 # pathname has a dir component?
144 if [ "${local_command#*/}" != "$local_command" ]; then
145 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
146 echo "$local_command"
147 return 0
148 fi
149 fi
150 if [ -z "$local_command" ]; then
151 return 1
152 fi
153
154 IFS=:
155 for local_dir in $PATH; do
156 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
157 echo "$local_dir/$local_command"
158 IFS="${local_ifs:-$(printf ' \t\n')}"
159 return 0
160 fi
161 done
162 # not found
163 IFS="${local_ifs:-$(printf ' \t\n')}"
164 return 1
165}
166
bellard7d132992003-03-06 23:23:54 +0000167# default parameters
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100168source_path=`dirname "$0"`
Juan Quintela2ff6b912009-08-03 14:45:55 +0200169cpu=""
Michael S. Tsirkina31a8642013-07-24 18:56:03 +0300170iasl="iasl"
bellard1e43adf2003-09-30 20:54:24 +0000171interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +0000172static="no"
bellard7d132992003-03-06 23:23:54 +0000173cross_prefix=""
malc0c58ac12008-06-25 21:04:05 +0000174audio_drv_list=""
Fam Zhengb64ec4e2013-05-29 19:35:40 +0800175block_drv_rw_whitelist=""
176block_drv_ro_whitelist=""
Peter Maydelle49d0212012-12-07 15:39:13 +0000177host_cc="cc"
Juan Quintela73da3752009-08-03 14:46:26 +0200178libs_softmmu=""
Juan Quintela3e2e0e62009-08-03 14:47:06 +0200179libs_tools=""
Juan Quintela67f86e82009-08-03 14:46:59 +0200180audio_pt_int=""
malcd5631632009-10-10 01:13:41 +0400181audio_win_int=""
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200182cc_i386=i386-pc-linux-gnu-gcc
Michael Roth957f1f92011-08-11 15:38:12 -0500183libs_qga=""
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100184debug_info="yes"
aliguoriac0df512008-12-29 17:14:15 +0000185
Stefan Weilafb63eb2012-09-26 22:04:38 +0200186# Don't accept a target_list environment variable.
187unset target_list
Paolo Bonzini377529c2010-12-23 11:43:50 +0100188
189# Default value for a variable defining feature "foo".
190# * foo="no" feature will only be used if --enable-foo arg is given
191# * foo="" feature will be searched for, and if found, will be used
192# unless --disable-foo is given
193# * foo="yes" this value will only be set by --enable-foo flag.
194# feature will searched for,
195# if not found, configure exits with error
196#
197# Always add --enable-foo and --disable-foo command line args.
198# Distributions want to ensure that several features are compiled in, and it
199# is impossible without a --enable-foo that exits if a feature is not found.
200
201bluez=""
202brlapi=""
203curl=""
204curses=""
205docs=""
206fdt=""
Vincenzo Maffione58952132013-11-06 11:44:06 +0100207netmap="no"
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +0200208pixman=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100209sdl=""
Dave Airlie47c03742013-12-10 14:05:51 +1000210sdlabi="1.2"
Meador Inge983eef52012-02-24 14:00:42 +0530211virtfs=""
Jes Sorensen821601e2011-03-16 13:33:36 +0100212vnc="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100213sparse="no"
214uuid=""
215vde=""
216vnc_tls=""
217vnc_sasl=""
218vnc_jpeg=""
219vnc_png=""
Tim Hardeck7536ee42013-01-21 11:04:44 +0100220vnc_ws=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100221xen=""
Anthony PERARDd5b93dd2011-02-25 16:20:34 +0000222xen_ctrl_version=""
Anthony PERARDeb6fda02012-06-21 15:32:59 +0000223xen_pci_passthrough=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100224linux_aio=""
Corey Bryant47e98652012-01-26 09:42:26 -0500225cap_ng=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100226attr=""
Avi Kivity4f26f2b2011-11-09 14:44:52 +0200227libattr=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100228xfs=""
229
Bradd41a75a2011-07-26 23:11:26 -0400230vhost_net="no"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000231vhost_scsi="no"
Bradd41a75a2011-07-26 23:11:26 -0400232kvm="no"
Michael R. Hines2da776d2013-07-22 10:01:54 -0400233rdma=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100234gprof="no"
235debug_tcg="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100236debug="no"
237strip_opt="yes"
Stefan Weil9195b2c2011-10-19 07:07:18 +0200238tcg_interpreter="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100239bigendian="no"
240mingw32="no"
Blue Swirl1d728c32012-05-01 18:45:39 +0000241gcov="no"
242gcov_tool="gcov"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100243EXESUF=""
Fam Zheng17969262014-02-10 14:48:56 +0800244DSOSUF=".so"
245LDFLAGS_SHARED="-shared"
246modules="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100247prefix="/usr/local"
248mandir="\${prefix}/share/man"
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300249datadir="\${prefix}/share"
Eduardo Habkost850da182012-04-18 16:55:38 -0300250qemu_docdir="\${prefix}/share/doc/qemu"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100251bindir="\${prefix}/bin"
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300252libdir="\${prefix}/lib"
Michael Tokarev8bf188a2012-06-07 01:11:00 +0400253libexecdir="\${prefix}/libexec"
Alon Levy0f94d6d2011-06-27 11:58:20 +0200254includedir="\${prefix}/include"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100255sysconfdir="\${prefix}/etc"
Luiz Capitulino785c23a2012-10-03 18:35:57 -0300256local_statedir="\${prefix}/var"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100257confsuffix="/qemu"
258slirp="yes"
259fmod_lib=""
260fmod_inc=""
261oss_lib=""
262bsd="no"
263linux="no"
264solaris="no"
265profiler="no"
266cocoa="no"
267softmmu="yes"
268linux_user="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100269bsd_user="no"
Peter Maydell30163d82012-10-09 03:16:49 +0000270guest_base="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100271uname_release=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100272aix="no"
273blobs="yes"
274pkgversion=""
Avi Kivity40d64442011-11-15 20:12:17 +0200275pie=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100276zero_malloc=""
Paolo Bonzini3556c232013-05-10 14:16:40 +0200277qom_cast_debug="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100278trace_backend="nop"
279trace_file="trace"
280spice=""
281rbd=""
Robert Relyea111a38b2010-11-28 16:36:38 +0200282smartcard_nss=""
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +0100283libusb=""
Hans de Goede69354a82011-07-19 11:04:10 +0200284usb_redir=""
Michael Walleb1e5fff2013-03-06 20:23:32 +0100285glx=""
Alon Levy1ece9902011-07-26 12:30:40 +0300286zlib="yes"
qiaonuohan607dacd2014-02-18 14:11:30 +0800287lzo="no"
288snappy="no"
Michael Tokareve8ef31a2013-07-31 14:22:07 +0400289guest_agent=""
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -0400290guest_agent_with_vss="no"
291vss_win32_sdk=""
292win_sdk="no"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +0100293want_tools="yes"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100294libiscsi=""
Peter Lieven6542aa92014-02-03 10:26:13 +0100295libnfs=""
Alex Barcelo519175a2012-02-28 12:25:50 +0100296coroutine=""
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +0200297coroutine_pool=""
Eduardo Otubof7945732012-08-14 18:44:05 -0300298seccomp=""
Bharata B Raoeb100392012-09-24 14:42:45 +0530299glusterfs=""
Bharata B Rao0c14fb42013-07-16 21:47:42 +0530300glusterfs_discard="no"
Bharata B Rao7c815372013-12-21 14:51:25 +0530301glusterfs_zerofill="no"
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +0100302virtio_blk_data_plane=""
Anthony Liguoria4ccabc2013-02-20 07:43:20 -0600303gtk=""
Daniel P. Berrange528de902013-02-25 15:20:44 +0000304gtkabi="2.0"
Stefan Bergerab214c22013-02-27 12:47:52 -0500305tpm="no"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +0100306libssh2=""
Jeff Cody4f18b782013-10-30 10:44:39 -0400307vhdx=""
Benoît Canet95c6bff2014-02-21 22:21:15 +0100308quorum="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100309
aliguoriac0df512008-12-29 17:14:15 +0000310# parse CC options first
311for opt do
312 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
313 case "$opt" in
314 --cross-prefix=*) cross_prefix="$optarg"
315 ;;
Paolo Bonzini3d8df642010-12-23 11:43:48 +0100316 --cc=*) CC="$optarg"
aliguoriac0df512008-12-29 17:14:15 +0000317 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400318 --cxx=*) CXX="$optarg"
319 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100320 --source-path=*) source_path="$optarg"
321 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200322 --cpu=*) cpu="$optarg"
323 ;;
Juan Quintelaa558ee12009-08-03 14:46:21 +0200324 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +0100325 EXTRA_CFLAGS="$optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200326 ;;
327 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +0100328 EXTRA_LDFLAGS="$optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200329 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100330 --enable-debug-info) debug_info="yes"
331 ;;
332 --disable-debug-info) debug_info="no"
333 ;;
aliguoriac0df512008-12-29 17:14:15 +0000334 esac
335done
aliguoriac0df512008-12-29 17:14:15 +0000336# OS specific
337# Using uname is really, really broken. Once we have the right set of checks
Stefan Weil93148aa2012-02-26 18:46:12 +0100338# we can eliminate its usage altogether.
aliguoriac0df512008-12-29 17:14:15 +0000339
Peter Maydelle49d0212012-12-07 15:39:13 +0000340# Preferred compiler:
341# ${CC} (if set)
342# ${cross_prefix}gcc (if cross-prefix specified)
343# system compiler
344if test -z "${CC}${cross_prefix}"; then
345 cc="$host_cc"
346else
347 cc="${CC-${cross_prefix}gcc}"
348fi
349
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400350if test -z "${CXX}${cross_prefix}"; then
351 cxx="c++"
352else
353 cxx="${CXX-${cross_prefix}g++}"
354fi
355
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500356ar="${AR-${cross_prefix}ar}"
Blue Swirl3dd46c72013-01-05 10:10:27 +0000357as="${AS-${cross_prefix}as}"
358cpp="${CPP-$cc -E}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500359objcopy="${OBJCOPY-${cross_prefix}objcopy}"
360ld="${LD-${cross_prefix}ld}"
Brad3f534582011-08-13 20:30:14 -0400361libtool="${LIBTOOL-${cross_prefix}libtool}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500362strip="${STRIP-${cross_prefix}strip}"
363windres="${WINDRES-${cross_prefix}windres}"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300364pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
365query_pkg_config() {
366 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
367}
368pkg_config=query_pkg_config
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500369sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
Dave Airlie47c03742013-12-10 14:05:51 +1000370sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
aliguoriac0df512008-12-29 17:14:15 +0000371
Peter Maydell45d285a2013-10-21 21:03:06 +0100372# If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
373ARFLAGS="${ARFLAGS-rv}"
374
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200375# default flags for all hosts
376QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
Mike Frysingerf9188222011-05-17 17:08:43 -0400377QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
Kevin Wolfc95e3082013-02-22 21:08:51 +0100378QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200379QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Paolo Bonzini6b4c3052012-10-24 13:12:00 +0200380QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100381if test "$debug_info" = "yes"; then
382 CFLAGS="-g $CFLAGS"
383 LDFLAGS="-g $LDFLAGS"
384fi
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200385
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100386# make source path absolute
387source_path=`cd "$source_path"; pwd`
388
aliguoriac0df512008-12-29 17:14:15 +0000389check_define() {
390cat > $TMPC <<EOF
391#if !defined($1)
Peter Maydellfd786e12011-11-23 17:26:43 +0000392#error $1 not defined
aliguoriac0df512008-12-29 17:14:15 +0000393#endif
394int main(void) { return 0; }
395EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200396 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000397}
398
Peter Maydellbbea4052012-08-14 15:35:34 +0100399if check_define __linux__ ; then
400 targetos="Linux"
401elif check_define _WIN32 ; then
402 targetos='MINGW32'
403elif check_define __OpenBSD__ ; then
404 targetos='OpenBSD'
405elif check_define __sun__ ; then
406 targetos='SunOS'
407elif check_define __HAIKU__ ; then
408 targetos='Haiku'
409else
410 targetos=`uname -s`
411fi
412
413# Some host OSes need non-standard checks for which CPU to use.
414# Note that these checks are broken for cross-compilation: if you're
415# cross-compiling to one of these OSes then you'll need to specify
416# the correct CPU with the --cpu option.
417case $targetos in
418Darwin)
419 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
420 # run 64-bit userspace code.
421 # If the user didn't specify a CPU explicitly and the kernel says this is
422 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
423 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
424 cpu="x86_64"
425 fi
426 ;;
427SunOS)
428 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
429 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
430 cpu="x86_64"
431 fi
432esac
433
Juan Quintela2ff6b912009-08-03 14:45:55 +0200434if test ! -z "$cpu" ; then
435 # command line argument
436 :
437elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000438 cpu="i386"
439elif check_define __x86_64__ ; then
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700440 if check_define __ILP32__ ; then
441 cpu="x32"
442 else
443 cpu="x86_64"
444 fi
blueswir13aa9bd62008-12-31 16:55:26 +0000445elif check_define __sparc__ ; then
blueswir13aa9bd62008-12-31 16:55:26 +0000446 if check_define __arch64__ ; then
447 cpu="sparc64"
448 else
449 cpu="sparc"
450 fi
malcfdf7ed92009-01-14 18:39:52 +0000451elif check_define _ARCH_PPC ; then
452 if check_define _ARCH_PPC64 ; then
453 cpu="ppc64"
454 else
455 cpu="ppc"
456 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200457elif check_define __mips__ ; then
458 cpu="mips"
Aurelien Jarno477ba622010-03-29 02:12:51 +0200459elif check_define __ia64__ ; then
460 cpu="ia64"
Aurelien Jarnod66ed0e2010-06-13 12:28:21 +0200461elif check_define __s390__ ; then
462 if check_define __s390x__ ; then
463 cpu="s390x"
464 else
465 cpu="s390"
466 fi
Peter Maydell21d89f82011-11-30 10:57:48 +0100467elif check_define __arm__ ; then
468 cpu="arm"
Claudio Fontana1f080312013-06-12 16:20:23 +0100469elif check_define __aarch64__ ; then
470 cpu="aarch64"
Bradf28ffed2011-09-07 21:24:56 -0400471elif check_define __hppa__ ; then
472 cpu="hppa"
aliguoriac0df512008-12-29 17:14:15 +0000473else
malcfdf7ed92009-01-14 18:39:52 +0000474 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +0000475fi
476
Peter Maydell359bc952011-12-24 13:07:25 +0000477ARCH=
478# Normalise host CPU name and set ARCH.
479# Note that this case should only have supported host CPUs, not guests.
bellard7d132992003-03-06 23:23:54 +0000480case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700481 ia64|ppc|ppc64|s390|s390x|sparc64|x32)
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200482 cpu="$cpu"
483 ;;
bellard7d132992003-03-06 23:23:54 +0000484 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000485 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000486 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000487 x86_64|amd64)
488 cpu="x86_64"
489 ;;
Peter Maydell21d89f82011-11-30 10:57:48 +0100490 armv*b|armv*l|arm)
491 cpu="arm"
bellard7d132992003-03-06 23:23:54 +0000492 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +0100493 aarch64)
494 cpu="aarch64"
495 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200496 mips*)
497 cpu="mips"
498 ;;
blueswir131422552007-04-16 18:27:06 +0000499 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000500 cpu="sparc"
501 ;;
bellard7d132992003-03-06 23:23:54 +0000502 *)
Peter Maydell359bc952011-12-24 13:07:25 +0000503 # This will result in either an error or falling back to TCI later
504 ARCH=unknown
bellard7d132992003-03-06 23:23:54 +0000505 ;;
506esac
Peter Maydell359bc952011-12-24 13:07:25 +0000507if test -z "$ARCH"; then
508 ARCH="$cpu"
509fi
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200510
bellard7d132992003-03-06 23:23:54 +0000511# OS specific
Juan Quintela0dbfc672009-08-03 14:46:13 +0200512
bellard7d132992003-03-06 23:23:54 +0000513case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000514CYGWIN*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200515 mingw32="yes"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200516 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
malcd5631632009-10-10 01:13:41 +0400517 audio_possible_drivers="winwave sdl"
518 audio_drv_list="winwave"
bellardc326e0a2005-04-23 18:30:28 +0000519;;
bellard67b915a2004-03-31 23:37:16 +0000520MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200521 mingw32="yes"
malcd5631632009-10-10 01:13:41 +0400522 audio_possible_drivers="winwave dsound sdl fmod"
523 audio_drv_list="winwave"
bellard67b915a2004-03-31 23:37:16 +0000524;;
ths5c40d2b2007-06-23 16:03:36 +0000525GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100526 bsd="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200527 audio_drv_list="oss"
528 audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000529;;
bellard7d3505c2004-05-12 19:32:15 +0000530FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200531 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100532 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200533 audio_drv_list="oss"
534 audio_possible_drivers="oss sdl esd pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100535 # needed for kinfo_getvmmap(3) in libutil.h
536 LIBS="-lutil $LIBS"
Vincenzo Maffione58952132013-11-06 11:44:06 +0100537 netmap="" # enable netmap autodetect
bellard7d3505c2004-05-12 19:32:15 +0000538;;
blueswir1c5e97232009-03-07 20:06:23 +0000539DragonFly)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200540 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100541 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200542 audio_drv_list="oss"
543 audio_possible_drivers="oss sdl esd pa"
blueswir1c5e97232009-03-07 20:06:23 +0000544;;
bellard7d3505c2004-05-12 19:32:15 +0000545NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200546 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100547 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200548 audio_drv_list="oss"
549 audio_possible_drivers="oss sdl esd"
550 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000551;;
552OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200553 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100554 make="${MAKE-gmake}"
Brad Smith4f6ab392013-05-24 19:01:07 -0400555 audio_drv_list="sdl"
556 audio_possible_drivers="sdl esd"
bellard7d3505c2004-05-12 19:32:15 +0000557;;
bellard83fb7ad2004-07-05 21:25:26 +0000558Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200559 bsd="yes"
560 darwin="yes"
Fam Zheng17969262014-02-10 14:48:56 +0800561 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200562 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200563 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200564 LDFLAGS="-arch x86_64 $LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200565 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200566 cocoa="yes"
567 audio_drv_list="coreaudio"
568 audio_possible_drivers="coreaudio sdl fmod"
569 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200570 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
Peter Maydella0b7cf62012-08-11 22:34:39 +0100571 # Disable attempts to use ObjectiveC features in os/object.h since they
572 # won't work when we're compiling with gcc as a C compiler.
573 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
bellard83fb7ad2004-07-05 21:25:26 +0000574;;
bellardec530c82006-04-25 22:36:06 +0000575SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200576 solaris="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100577 make="${MAKE-gmake}"
578 install="${INSTALL-ginstall}"
Blue Swirlfa589482009-10-02 19:38:25 +0000579 ld="gld"
Brade2d88302011-09-02 16:53:28 -0400580 smbd="${SMBD-/usr/sfw/sbin/smbd}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200581 needs_libsunmath="no"
582 solarisrev=`uname -r | cut -f2 -d.`
Juan Quintela0dbfc672009-08-03 14:46:13 +0200583 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
584 if test "$solarisrev" -le 9 ; then
585 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
586 needs_libsunmath="yes"
Juan Quintelaf14bfdf2009-08-03 14:47:11 +0200587 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
588 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
589 LIBS="-lsunmath $LIBS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200590 else
Peter Maydell76ad07a2013-04-08 12:11:26 +0100591 error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
592 "libsunmath from the Sun Studio compilers tools, due to a lack of" \
593 "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
594 "Studio 11 can be downloaded from www.sun.com."
Juan Quintela0dbfc672009-08-03 14:46:13 +0200595 fi
thsef18c882007-09-16 22:12:39 +0000596 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200597 fi
598 if test -f /usr/include/sys/soundcard.h ; then
599 audio_drv_list="oss"
600 fi
601 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000602# needed for CMSG_ macros in sys/socket.h
603 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
604# needed for TIOCWIN* defines in termios.h
605 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200606 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
Andreas Färber560d3752012-04-30 18:00:55 +0200607 solarisnetlibs="-lsocket -lnsl -lresolv"
608 LIBS="$solarisnetlibs $LIBS"
609 libs_qga="$solarisnetlibs $libs_qga"
ths86b2bd92007-02-11 00:31:33 +0000610;;
malcb29fe3e2008-11-18 01:42:22 +0000611AIX)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200612 aix="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100613 make="${MAKE-gmake}"
malcb29fe3e2008-11-18 01:42:22 +0000614;;
Andreas Färber179cf402010-09-20 00:50:43 +0200615Haiku)
616 haiku="yes"
617 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
618 LIBS="-lposix_error_mapper -lnetwork $LIBS"
619;;
bellard1d14ffa2005-10-30 18:58:22 +0000620*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200621 audio_drv_list="oss"
622 audio_possible_drivers="oss alsa sdl esd pa"
623 linux="yes"
624 linux_user="yes"
Jan Kiszkaaf2be202011-06-23 10:05:12 +0200625 kvm="yes"
626 vhost_net="yes"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000627 vhost_scsi="yes"
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700628 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
malcc2de5c92008-06-28 19:13:06 +0000629 audio_possible_drivers="$audio_possible_drivers fmod"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200630 fi
Alexey Kardashevskiya5851402013-05-29 23:30:43 +1000631 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
bellardfb065182004-11-09 23:09:44 +0000632;;
bellard7d132992003-03-06 23:23:54 +0000633esac
634
bellard7d3505c2004-05-12 19:32:15 +0000635if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000636 if [ "$darwin" != "yes" ] ; then
Andreas Färber08de3942012-04-26 11:57:39 +0200637 bsd_user="yes"
bellard83fb7ad2004-07-05 21:25:26 +0000638 fi
bellard7d3505c2004-05-12 19:32:15 +0000639fi
640
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100641: ${make=${MAKE-make}}
642: ${install=${INSTALL-install}}
Stefan Weil52510f82013-11-14 19:07:03 +0100643: ${python=${PYTHON-python}}
Brade2d88302011-09-02 16:53:28 -0400644: ${smbd=${SMBD-/usr/sbin/smbd}}
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100645
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100646# Default objcc to clang if available, otherwise use CC
647if has clang; then
648 objcc=clang
649else
650 objcc="$cc"
651fi
652
Juan Quintela3457a3f2009-08-03 14:46:07 +0200653if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +0200654 EXESUF=".exe"
Fam Zheng17969262014-02-10 14:48:56 +0800655 DSOSUF=".dll"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200656 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
Stefan Weile94a7932010-02-12 11:02:08 +0100657 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
658 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
Stefan Weilf7cf5d52012-03-10 11:14:32 +0100659 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
660cat > $TMPC << EOF
661int main(void) { return 0; }
662EOF
663 if compile_prog "" "-liberty" ; then
664 LIBS="-liberty $LIBS"
665 fi
Stefan Weilc5ec15e2012-04-07 09:23:38 +0200666 prefix="c:/Program Files/QEMU"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200667 mandir="\${prefix}"
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300668 datadir="\${prefix}"
Eduardo Habkost850da182012-04-18 16:55:38 -0300669 qemu_docdir="\${prefix}"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200670 bindir="\${prefix}"
671 sysconfdir="\${prefix}"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +0200672 local_statedir=
Paolo Bonzini683035d2010-05-26 16:08:28 +0200673 confsuffix=""
Stefan Hajnoczi368542b2012-03-27 08:26:18 +0100674 libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
Juan Quintela3457a3f2009-08-03 14:46:07 +0200675fi
676
Anthony Liguori487fefd2009-06-11 13:28:25 -0500677werror=""
bellard85aa5182007-11-11 20:17:03 +0000678
bellard7d132992003-03-06 23:23:54 +0000679for opt do
pbrooka46e4032006-04-29 23:05:22 +0000680 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000681 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000682 --help|-h) show_help=yes
683 ;;
Mike Frysinger99123e12011-04-07 01:12:28 -0400684 --version|-V) exec cat $source_path/VERSION
685 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000686 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000687 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000688 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000689 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100690 --source-path=*)
bellard7d132992003-03-06 23:23:54 +0000691 ;;
aliguoriac0df512008-12-29 17:14:15 +0000692 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000693 ;;
aliguoriac0df512008-12-29 17:14:15 +0000694 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000695 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000696 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000697 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400698 --cxx=*)
699 ;;
Michael S. Tsirkine007dbe2013-11-24 11:38:05 +0200700 --iasl=*) iasl="$optarg"
701 ;;
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100702 --objcc=*) objcc="$optarg"
703 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000704 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000705 ;;
pbrook6a882642006-04-17 13:57:12 +0000706 --install=*) install="$optarg"
707 ;;
Blue Swirlc886edf2011-07-22 21:08:09 +0000708 --python=*) python="$optarg"
709 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +0000710 --gcov=*) gcov_tool="$optarg"
711 ;;
Brade2d88302011-09-02 16:53:28 -0400712 --smbd=*) smbd="$optarg"
713 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200714 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000715 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200716 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000717 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100718 --enable-debug-info)
719 ;;
720 --disable-debug-info)
721 ;;
Fam Zheng17969262014-02-10 14:48:56 +0800722 --enable-modules)
723 modules="yes"
724 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200725 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000726 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000727 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000728 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100729 --enable-trace-backend=*) trace_backend="$optarg"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +0100730 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100731 --with-trace-file=*) trace_file="$optarg"
Prerna Saxena9410b562010-07-13 09:26:32 +0100732 ;;
bellard7d132992003-03-06 23:23:54 +0000733 --enable-gprof) gprof="yes"
734 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +0000735 --enable-gcov) gcov="yes"
736 ;;
Loïc Minier79427692010-01-31 12:23:45 +0100737 --static)
738 static="yes"
739 LDFLAGS="-static $LDFLAGS"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300740 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
bellard43ce4df2003-06-09 19:53:12 +0000741 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200742 --mandir=*) mandir="$optarg"
743 ;;
744 --bindir=*) bindir="$optarg"
745 ;;
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300746 --libdir=*) libdir="$optarg"
747 ;;
Michael Tokarev8bf188a2012-06-07 01:11:00 +0400748 --libexecdir=*) libexecdir="$optarg"
749 ;;
Alon Levy0f94d6d2011-06-27 11:58:20 +0200750 --includedir=*) includedir="$optarg"
751 ;;
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300752 --datadir=*) datadir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200753 ;;
Eduardo Habkost023d3d62012-04-18 16:55:50 -0300754 --with-confsuffix=*) confsuffix="$optarg"
755 ;;
Eduardo Habkost850da182012-04-18 16:55:38 -0300756 --docdir=*) qemu_docdir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200757 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +0100758 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -0600759 ;;
Luiz Capitulino785c23a2012-10-03 18:35:57 -0300760 --localstatedir=*) local_statedir="$optarg"
761 ;;
762 --sbindir=*|--sharedstatedir=*|\
Max Filippov023ddd72011-11-24 16:11:31 +0400763 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
764 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
765 # These switches are silently ignored, for compatibility with
766 # autoconf-generated configure scripts. This allows QEMU's
767 # configure to be used by RPM and similar macros that set
768 # lots of directory switches by default.
769 ;;
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +0200770 --with-system-pixman) pixman="system"
771 ;;
772 --without-system-pixman) pixman="internal"
773 ;;
Robert Schiele74880fe2012-12-04 16:58:08 +0100774 --without-pixman) pixman="none"
775 ;;
bellard97a847b2003-08-10 21:36:04 +0000776 --disable-sdl) sdl="no"
777 ;;
Juan Quintelac4198152009-08-12 18:29:53 +0200778 --enable-sdl) sdl="yes"
779 ;;
Dave Airlie47c03742013-12-10 14:05:51 +1000780 --with-sdlabi=*) sdlabi="$optarg"
781 ;;
Paolo Bonzini3556c232013-05-10 14:16:40 +0200782 --disable-qom-cast-debug) qom_cast_debug="no"
783 ;;
784 --enable-qom-cast-debug) qom_cast_debug="yes"
785 ;;
Meador Inge983eef52012-02-24 14:00:42 +0530786 --disable-virtfs) virtfs="no"
787 ;;
788 --enable-virtfs) virtfs="yes"
789 ;;
Jes Sorensen821601e2011-03-16 13:33:36 +0100790 --disable-vnc) vnc="no"
791 ;;
792 --enable-vnc) vnc="yes"
793 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000794 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000795 ;;
malcc2de5c92008-06-28 19:13:06 +0000796 --fmod-inc=*) fmod_inc="$optarg"
797 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000798 --oss-lib=*) oss_lib="$optarg"
799 ;;
malc0c58ac12008-06-25 21:04:05 +0000800 --audio-drv-list=*) audio_drv_list="$optarg"
801 ;;
Fam Zhengb64ec4e2013-05-29 19:35:40 +0800802 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
803 ;;
804 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
Markus Armbrustereb852012009-10-27 18:41:44 +0100805 ;;
aurel32f8393942009-04-13 18:45:38 +0000806 --enable-debug-tcg) debug_tcg="yes"
807 ;;
808 --disable-debug-tcg) debug_tcg="no"
809 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100810 --enable-debug)
811 # Enable debugging options that aren't excessively noisy
812 debug_tcg="yes"
813 debug="yes"
814 strip_opt="no"
815 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000816 --enable-sparse) sparse="yes"
817 ;;
818 --disable-sparse) sparse="no"
819 ;;
aliguori1625af82009-04-05 17:41:02 +0000820 --disable-strip) strip_opt="no"
821 ;;
ths8d5d2d42007-08-25 01:37:51 +0000822 --disable-vnc-tls) vnc_tls="no"
823 ;;
Juan Quintela1be10ad2009-08-12 18:20:28 +0200824 --enable-vnc-tls) vnc_tls="yes"
825 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000826 --disable-vnc-sasl) vnc_sasl="no"
827 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +0200828 --enable-vnc-sasl) vnc_sasl="yes"
829 ;;
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200830 --disable-vnc-jpeg) vnc_jpeg="no"
831 ;;
832 --enable-vnc-jpeg) vnc_jpeg="yes"
833 ;;
Corentin Charyefe556a2010-07-07 20:57:56 +0200834 --disable-vnc-png) vnc_png="no"
835 ;;
836 --enable-vnc-png) vnc_png="yes"
837 ;;
Tim Hardeck7536ee42013-01-21 11:04:44 +0100838 --disable-vnc-ws) vnc_ws="no"
839 ;;
840 --enable-vnc-ws) vnc_ws="yes"
841 ;;
bellard443f1372004-06-04 11:13:20 +0000842 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000843 ;;
Stefan Weilee682d22009-10-01 20:10:37 +0200844 --disable-uuid) uuid="no"
845 ;;
846 --enable-uuid) uuid="yes"
847 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000848 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000849 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +0200850 --enable-vde) vde="yes"
851 ;;
Vincenzo Maffione58952132013-11-06 11:44:06 +0100852 --disable-netmap) netmap="no"
853 ;;
854 --enable-netmap) netmap="yes"
855 ;;
aliguorie37630c2009-04-22 15:19:10 +0000856 --disable-xen) xen="no"
857 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +0200858 --enable-xen) xen="yes"
859 ;;
Anthony PERARDeb6fda02012-06-21 15:32:59 +0000860 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
861 ;;
862 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
863 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000864 --disable-brlapi) brlapi="no"
865 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200866 --enable-brlapi) brlapi="yes"
867 ;;
balrogfb599c92008-09-28 23:49:55 +0000868 --disable-bluez) bluez="no"
869 ;;
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200870 --enable-bluez) bluez="yes"
871 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000872 --disable-kvm) kvm="no"
873 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +0200874 --enable-kvm) kvm="yes"
875 ;;
Stefan Weil9195b2c2011-10-19 07:07:18 +0200876 --disable-tcg-interpreter) tcg_interpreter="no"
877 ;;
878 --enable-tcg-interpreter) tcg_interpreter="yes"
879 ;;
Corey Bryant47e98652012-01-26 09:42:26 -0500880 --disable-cap-ng) cap_ng="no"
881 ;;
882 --enable-cap-ng) cap_ng="yes"
883 ;;
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +0100884 --disable-spice) spice="no"
885 ;;
886 --enable-spice) spice="yes"
887 ;;
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100888 --disable-libiscsi) libiscsi="no"
889 ;;
890 --enable-libiscsi) libiscsi="yes"
891 ;;
Peter Lieven6542aa92014-02-03 10:26:13 +0100892 --disable-libnfs) libnfs="no"
893 ;;
894 --enable-libnfs) libnfs="yes"
895 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000896 --enable-profiler) profiler="yes"
897 ;;
Pavel Borzenkov14821032011-11-10 22:40:07 +0400898 --disable-cocoa) cocoa="no"
899 ;;
malcc2de5c92008-06-28 19:13:06 +0000900 --enable-cocoa)
901 cocoa="yes" ;
902 sdl="no" ;
903 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000904 ;;
pbrookcad25d62006-03-19 16:31:11 +0000905 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000906 ;;
pbrookcad25d62006-03-19 16:31:11 +0000907 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000908 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -1000909 --disable-user)
910 linux_user="no" ;
911 bsd_user="no" ;
Zachary Amsden0953a802009-07-30 00:14:59 -1000912 ;;
913 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +0000914 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000915 ;;
ths831b7822007-01-18 20:06:33 +0000916 --enable-linux-user) linux_user="yes"
917 ;;
blueswir184778502008-10-26 20:33:16 +0000918 --disable-bsd-user) bsd_user="no"
919 ;;
920 --enable-bsd-user) bsd_user="yes"
921 ;;
Paul Brook379f6692009-07-17 12:48:08 +0100922 --enable-guest-base) guest_base="yes"
923 ;;
924 --disable-guest-base) guest_base="no"
925 ;;
Avi Kivity40d64442011-11-15 20:12:17 +0200926 --enable-pie) pie="yes"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300927 ;;
Avi Kivity40d64442011-11-15 20:12:17 +0200928 --disable-pie) pie="no"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300929 ;;
pbrookc5937222006-05-14 11:30:38 +0000930 --enable-uname-release=*) uname_release="$optarg"
931 ;;
bellard85aa5182007-11-11 20:17:03 +0000932 --enable-werror) werror="yes"
933 ;;
934 --disable-werror) werror="no"
935 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000936 --disable-curses) curses="no"
937 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +0200938 --enable-curses) curses="yes"
939 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200940 --disable-curl) curl="no"
941 ;;
Juan Quintela788c8192009-08-12 18:29:47 +0200942 --enable-curl) curl="yes"
943 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +0200944 --disable-fdt) fdt="no"
945 ;;
946 --enable-fdt) fdt="yes"
947 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200948 --disable-linux-aio) linux_aio="no"
949 ;;
950 --enable-linux-aio) linux_aio="yes"
951 ;;
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700952 --disable-attr) attr="no"
953 ;;
954 --enable-attr) attr="yes"
955 ;;
ths77755342008-11-27 15:45:16 +0000956 --disable-blobs) blobs="no"
957 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000958 --with-pkgversion=*) pkgversion=" ($optarg)"
959 ;;
Alex Barcelo519175a2012-02-28 12:25:50 +0100960 --with-coroutine=*) coroutine="$optarg"
961 ;;
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +0200962 --disable-coroutine-pool) coroutine_pool="no"
963 ;;
964 --enable-coroutine-pool) coroutine_pool="yes"
965 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200966 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500967 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200968 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +0200969 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200970 --disable-vhost-net) vhost_net="no"
971 ;;
972 --enable-vhost-net) vhost_net="yes"
973 ;;
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000974 --disable-vhost-scsi) vhost_scsi="no"
975 ;;
976 --enable-vhost-scsi) vhost_scsi="yes"
977 ;;
Michael Walleb1e5fff2013-03-06 20:23:32 +0100978 --disable-glx) glx="no"
Michael Walle20ff0752011-03-07 23:32:39 +0100979 ;;
Michael Walleb1e5fff2013-03-06 20:23:32 +0100980 --enable-glx) glx="yes"
Michael Walle20ff0752011-03-07 23:32:39 +0100981 ;;
Christian Brunnerf27aaf42010-12-06 20:53:01 +0100982 --disable-rbd) rbd="no"
983 ;;
984 --enable-rbd) rbd="yes"
985 ;;
Sergei Trofimovich8c84cf12012-01-24 20:42:40 +0300986 --disable-xfsctl) xfs="no"
987 ;;
988 --enable-xfsctl) xfs="yes"
989 ;;
Robert Relyea111a38b2010-11-28 16:36:38 +0200990 --disable-smartcard-nss) smartcard_nss="no"
991 ;;
992 --enable-smartcard-nss) smartcard_nss="yes"
993 ;;
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +0100994 --disable-libusb) libusb="no"
995 ;;
996 --enable-libusb) libusb="yes"
997 ;;
Hans de Goede69354a82011-07-19 11:04:10 +0200998 --disable-usb-redir) usb_redir="no"
999 ;;
1000 --enable-usb-redir) usb_redir="yes"
1001 ;;
Alon Levy1ece9902011-07-26 12:30:40 +03001002 --disable-zlib-test) zlib="no"
1003 ;;
qiaonuohan607dacd2014-02-18 14:11:30 +08001004 --enable-lzo) lzo="yes"
1005 ;;
1006 --enable-snappy) snappy="yes"
1007 ;;
Michael Rothd138cee2011-08-01 14:52:57 -05001008 --enable-guest-agent) guest_agent="yes"
1009 ;;
1010 --disable-guest-agent) guest_agent="no"
1011 ;;
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04001012 --with-vss-sdk) vss_win32_sdk=""
1013 ;;
1014 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1015 ;;
1016 --without-vss-sdk) vss_win32_sdk="no"
1017 ;;
1018 --with-win-sdk) win_sdk=""
1019 ;;
1020 --with-win-sdk=*) win_sdk="$optarg"
1021 ;;
1022 --without-win-sdk) win_sdk="no"
1023 ;;
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01001024 --enable-tools) want_tools="yes"
1025 ;;
1026 --disable-tools) want_tools="no"
1027 ;;
Eduardo Otubof7945732012-08-14 18:44:05 -03001028 --enable-seccomp) seccomp="yes"
1029 ;;
1030 --disable-seccomp) seccomp="no"
1031 ;;
Bharata B Raoeb100392012-09-24 14:42:45 +05301032 --disable-glusterfs) glusterfs="no"
1033 ;;
1034 --enable-glusterfs) glusterfs="yes"
1035 ;;
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01001036 --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
1037 ;;
1038 --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
1039 ;;
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001040 --disable-gtk) gtk="no"
1041 ;;
1042 --enable-gtk) gtk="yes"
1043 ;;
Michael R. Hines2da776d2013-07-22 10:01:54 -04001044 --enable-rdma) rdma="yes"
1045 ;;
1046 --disable-rdma) rdma="no"
1047 ;;
Daniel P. Berrange528de902013-02-25 15:20:44 +00001048 --with-gtkabi=*) gtkabi="$optarg"
1049 ;;
Stefan Bergerab214c22013-02-27 12:47:52 -05001050 --enable-tpm) tpm="yes"
1051 ;;
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01001052 --disable-libssh2) libssh2="no"
1053 ;;
1054 --enable-libssh2) libssh2="yes"
1055 ;;
Jeff Cody4f18b782013-10-30 10:44:39 -04001056 --enable-vhdx) vhdx="yes"
1057 ;;
1058 --disable-vhdx) vhdx="no"
1059 ;;
Benoît Canet95c6bff2014-02-21 22:21:15 +01001060 --disable-quorum) quorum="no"
1061 ;;
1062 --enable-quorum) quorum="yes"
1063 ;;
balrog7f1559c2007-11-17 10:24:32 +00001064 *) echo "ERROR: unknown option $opt"; show_help="yes"
1065 ;;
bellard7d132992003-03-06 23:23:54 +00001066 esac
1067done
1068
Stefan Weilf6f0b7d2013-12-18 22:30:26 +01001069if ! has $python; then
1070 error_exit "Python not found. Use --python=/path/to/python"
1071fi
1072
1073# Note that if the Python conditional here evaluates True we will exit
1074# with status 1 which is a shell 'false' value.
1075if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1076 error_exit "Cannot use '$python', Python 2.4 or later is required." \
1077 "Note that Python 3 or later is not yet supported." \
1078 "Use --python=/path/to/python to specify a supported Python."
1079fi
1080
1081# The -B switch was added in Python 2.6.
1082# If it is supplied, compiled files are not written.
1083# Use it for Python versions which support it.
1084if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
1085 python="$python -B"
1086fi
1087
bellard40293e52008-01-31 11:32:10 +00001088case "$cpu" in
Richard Hendersone3608d62013-08-28 15:48:21 -07001089 ppc)
1090 CPU_CFLAGS="-m32"
1091 LDFLAGS="-m32 $LDFLAGS"
1092 ;;
1093 ppc64)
1094 CPU_CFLAGS="-m64"
1095 LDFLAGS="-m64 $LDFLAGS"
1096 ;;
Richard Henderson9b9c37c2012-09-21 10:34:21 -07001097 sparc)
Juan Quintelaed968ff2009-08-03 14:46:11 +02001098 LDFLAGS="-m32 $LDFLAGS"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001099 CPU_CFLAGS="-m32 -mcpu=ultrasparc"
blueswir131422552007-04-16 18:27:06 +00001100 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +02001101 sparc64)
Juan Quintelaed968ff2009-08-03 14:46:11 +02001102 LDFLAGS="-m64 $LDFLAGS"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001103 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
blueswir131422552007-04-16 18:27:06 +00001104 ;;
ths76d83bd2007-11-18 21:22:10 +00001105 s390)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001106 CPU_CFLAGS="-m31 -march=z990"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001107 LDFLAGS="-m31 $LDFLAGS"
1108 ;;
1109 s390x)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001110 CPU_CFLAGS="-m64 -march=z990"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001111 LDFLAGS="-m64 $LDFLAGS"
ths76d83bd2007-11-18 21:22:10 +00001112 ;;
bellard40293e52008-01-31 11:32:10 +00001113 i386)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001114 CPU_CFLAGS="-m32"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001115 LDFLAGS="-m32 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02001116 cc_i386='$(CC) -m32'
bellard40293e52008-01-31 11:32:10 +00001117 ;;
1118 x86_64)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001119 CPU_CFLAGS="-m64"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001120 LDFLAGS="-m64 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02001121 cc_i386='$(CC) -m32'
Paul Brook379f6692009-07-17 12:48:08 +01001122 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001123 x32)
1124 CPU_CFLAGS="-mx32"
1125 LDFLAGS="-mx32 $LDFLAGS"
1126 cc_i386='$(CC) -m32'
1127 ;;
Peter Maydell30163d82012-10-09 03:16:49 +00001128 # No special flags required for other host CPUs
blueswir131422552007-04-16 18:27:06 +00001129esac
1130
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001131QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1132EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1133
Peter Maydell60e0df22011-05-03 14:50:13 +01001134default_target_list=""
1135
Peter Maydell6e92f822013-05-20 16:16:15 +01001136mak_wilds=""
1137
1138if [ "$softmmu" = "yes" ]; then
1139 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001140fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001141if [ "$linux_user" = "yes" ]; then
1142 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001143fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001144if [ "$bsd_user" = "yes" ]; then
1145 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001146fi
1147
Peter Maydell6e92f822013-05-20 16:16:15 +01001148for config in $mak_wilds; do
1149 default_target_list="${default_target_list} $(basename "$config" .mak)"
1150done
1151
pbrookaf5db582006-04-08 14:26:41 +00001152if test x"$show_help" = x"yes" ; then
1153cat << EOF
1154
1155Usage: configure [options]
1156Options: [defaults in brackets after descriptions]
1157
Stefan Weil08fb77e2013-12-18 22:09:39 +01001158Standard options:
1159 --help print this message
1160 --prefix=PREFIX install in PREFIX [$prefix]
1161 --interp-prefix=PREFIX where to find shared libraries, etc.
1162 use %M for cpu name [$interp_prefix]
1163 --target-list=LIST set target list (default: build everything)
1164$(echo Available targets: $default_target_list | \
1165 fold -s -w 53 | sed -e 's/^/ /')
1166
1167Advanced options (experts only):
1168 --source-path=PATH path of source code [$source_path]
1169 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1170 --cc=CC use C compiler CC [$cc]
1171 --iasl=IASL use ACPI compiler IASL [$iasl]
1172 --host-cc=CC use C compiler CC [$host_cc] for code run at
1173 build time
1174 --cxx=CXX use C++ compiler CXX [$cxx]
1175 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1176 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
1177 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1178 --make=MAKE use specified make [$make]
1179 --install=INSTALL use specified install [$install]
1180 --python=PYTHON use specified python [$python]
1181 --smbd=SMBD use specified smbd [$smbd]
1182 --static enable static build [$static]
1183 --mandir=PATH install man pages in PATH
1184 --datadir=PATH install firmware in PATH$confsuffix
1185 --docdir=PATH install documentation in PATH$confsuffix
1186 --bindir=PATH install binaries in PATH
1187 --libdir=PATH install libraries in PATH
1188 --sysconfdir=PATH install config in PATH$confsuffix
1189 --localstatedir=PATH install local state in PATH (set at runtime on win32)
Fam Zhenge26110c2014-02-10 14:48:57 +08001190 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
Fam Zheng17969262014-02-10 14:48:56 +08001191 --enable-modules enable modules support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001192 --enable-debug-tcg enable TCG debugging
1193 --disable-debug-tcg disable TCG debugging (default)
1194 --enable-debug-info enable debugging information (default)
1195 --disable-debug-info disable debugging information
1196 --enable-debug enable common debug build options
1197 --enable-sparse enable sparse checker
1198 --disable-sparse disable sparse checker (default)
1199 --disable-strip disable stripping binaries
1200 --disable-werror disable compilation abort on warning
1201 --disable-sdl disable SDL
1202 --enable-sdl enable SDL
Dave Airlie47c03742013-12-10 14:05:51 +10001203 --with-sdlabi select preferred SDL ABI 1.2 or 2.0
Stefan Weil08fb77e2013-12-18 22:09:39 +01001204 --disable-gtk disable gtk UI
1205 --enable-gtk enable gtk UI
1206 --disable-virtfs disable VirtFS
1207 --enable-virtfs enable VirtFS
1208 --disable-vnc disable VNC
1209 --enable-vnc enable VNC
1210 --disable-cocoa disable Cocoa (Mac OS X only)
1211 --enable-cocoa enable Cocoa (default on Mac OS X)
1212 --audio-drv-list=LIST set audio drivers list:
1213 Available drivers: $audio_possible_drivers
1214 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1215 --block-drv-rw-whitelist=L
1216 set block driver read-write whitelist
1217 (affects only QEMU, not qemu-img)
1218 --block-drv-ro-whitelist=L
1219 set block driver read-only whitelist
1220 (affects only QEMU, not qemu-img)
1221 --disable-xen disable xen backend driver support
1222 --enable-xen enable xen backend driver support
1223 --disable-xen-pci-passthrough
1224 --enable-xen-pci-passthrough
1225 --disable-brlapi disable BrlAPI
1226 --enable-brlapi enable BrlAPI
1227 --disable-vnc-tls disable TLS encryption for VNC server
1228 --enable-vnc-tls enable TLS encryption for VNC server
1229 --disable-vnc-sasl disable SASL encryption for VNC server
1230 --enable-vnc-sasl enable SASL encryption for VNC server
1231 --disable-vnc-jpeg disable JPEG lossy compression for VNC server
1232 --enable-vnc-jpeg enable JPEG lossy compression for VNC server
1233 --disable-vnc-png disable PNG compression for VNC server (default)
1234 --enable-vnc-png enable PNG compression for VNC server
1235 --disable-vnc-ws disable Websockets support for VNC server
1236 --enable-vnc-ws enable Websockets support for VNC server
1237 --disable-curses disable curses output
1238 --enable-curses enable curses output
1239 --disable-curl disable curl connectivity
1240 --enable-curl enable curl connectivity
1241 --disable-fdt disable fdt device tree
1242 --enable-fdt enable fdt device tree
1243 --disable-bluez disable bluez stack connectivity
1244 --enable-bluez enable bluez stack connectivity
1245 --disable-slirp disable SLIRP userspace network connectivity
1246 --disable-kvm disable KVM acceleration support
1247 --enable-kvm enable KVM acceleration support
1248 --disable-rdma disable RDMA-based migration support
1249 --enable-rdma enable RDMA-based migration support
1250 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1251 --enable-system enable all system emulation targets
1252 --disable-system disable all system emulation targets
1253 --enable-user enable supported user emulation targets
1254 --disable-user disable all user emulation targets
1255 --enable-linux-user enable all linux usermode emulation targets
1256 --disable-linux-user disable all linux usermode emulation targets
1257 --enable-bsd-user enable all BSD usermode emulation targets
1258 --disable-bsd-user disable all BSD usermode emulation targets
1259 --enable-guest-base enable GUEST_BASE support for usermode
1260 emulation targets
1261 --disable-guest-base disable GUEST_BASE support
1262 --enable-pie build Position Independent Executables
1263 --disable-pie do not build Position Independent Executables
1264 --fmod-lib path to FMOD library
1265 --fmod-inc path to FMOD includes
1266 --oss-lib path to OSS library
1267 --enable-uname-release=R Return R for uname -r in usermode emulation
1268 --cpu=CPU Build for host CPU [$cpu]
1269 --disable-uuid disable uuid support
1270 --enable-uuid enable uuid support
1271 --disable-vde disable support for vde network
1272 --enable-vde enable support for vde network
1273 --disable-netmap disable support for netmap network
1274 --enable-netmap enable support for netmap network
1275 --disable-linux-aio disable Linux AIO support
1276 --enable-linux-aio enable Linux AIO support
1277 --disable-cap-ng disable libcap-ng support
1278 --enable-cap-ng enable libcap-ng support
1279 --disable-attr disables attr and xattr support
1280 --enable-attr enable attr and xattr support
1281 --disable-blobs disable installing provided firmware blobs
1282 --enable-docs enable documentation build
1283 --disable-docs disable documentation build
1284 --disable-vhost-net disable vhost-net acceleration support
1285 --enable-vhost-net enable vhost-net acceleration support
1286 --enable-trace-backend=B Set trace backend
1287 Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
1288 --with-trace-file=NAME Full PATH,NAME of file to store traces
1289 Default:trace-<pid>
1290 --disable-spice disable spice
1291 --enable-spice enable spice
1292 --enable-rbd enable building the rados block device (rbd)
1293 --disable-libiscsi disable iscsi support
1294 --enable-libiscsi enable iscsi support
Peter Lieven6542aa92014-02-03 10:26:13 +01001295 --disable-libnfs disable nfs support
1296 --enable-libnfs enable nfs support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001297 --disable-smartcard-nss disable smartcard nss support
1298 --enable-smartcard-nss enable smartcard nss support
1299 --disable-libusb disable libusb (for usb passthrough)
1300 --enable-libusb enable libusb (for usb passthrough)
1301 --disable-usb-redir disable usb network redirection support
1302 --enable-usb-redir enable usb network redirection support
qiaonuohan607dacd2014-02-18 14:11:30 +08001303 --enable-lzo enable the support of lzo compression library
1304 --enable-snappy enable the support of snappy compression library
Stefan Weil08fb77e2013-12-18 22:09:39 +01001305 --disable-guest-agent disable building of the QEMU Guest Agent
1306 --enable-guest-agent enable building of the QEMU Guest Agent
1307 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1308 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1309 --disable-seccomp disable seccomp support
1310 --enable-seccomp enables seccomp support
1311 --with-coroutine=BACKEND coroutine backend. Supported options:
1312 gthread, ucontext, sigaltstack, windows
1313 --disable-coroutine-pool disable coroutine freelist (worse performance)
1314 --enable-coroutine-pool enable coroutine freelist (better performance)
1315 --enable-glusterfs enable GlusterFS backend
1316 --disable-glusterfs disable GlusterFS backend
1317 --enable-gcov enable test coverage analysis with gcov
1318 --gcov=GCOV use specified gcov [$gcov_tool]
1319 --enable-tpm enable TPM support
1320 --disable-libssh2 disable ssh block device support
1321 --enable-libssh2 enable ssh block device support
1322 --disable-vhdx disables support for the Microsoft VHDX image format
1323 --enable-vhdx enable support for the Microsoft VHDX image format
Benoît Canet95c6bff2014-02-21 22:21:15 +01001324 --disable-quorum disable quorum block filter support
1325 --enable-quorum enable quorum block filter support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001326
1327NOTE: The object files are built at the place where configure is launched
pbrookaf5db582006-04-08 14:26:41 +00001328EOF
pbrookaf5db582006-04-08 14:26:41 +00001329exit 1
1330fi
1331
Peter Maydell359bc952011-12-24 13:07:25 +00001332# Now we have handled --enable-tcg-interpreter and know we're not just
1333# printing the help message, bail out if the host CPU isn't supported.
1334if test "$ARCH" = "unknown"; then
1335 if test "$tcg_interpreter" = "yes" ; then
1336 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1337 ARCH=tci
1338 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001339 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
Peter Maydell359bc952011-12-24 13:07:25 +00001340 fi
1341fi
1342
Paolo Bonzini8d050952010-12-23 11:43:52 +01001343# check that the C compiler works.
1344cat > $TMPC <<EOF
Stefan Weil75cafad2011-12-17 09:27:29 +01001345int main(void) { return 0; }
Paolo Bonzini8d050952010-12-23 11:43:52 +01001346EOF
1347
1348if compile_object ; then
1349 : C compiler works ok
1350else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001351 error_exit "\"$cc\" either does not exist or does not work"
Paolo Bonzini8d050952010-12-23 11:43:52 +01001352fi
1353
Peter Maydell98b21dc2014-02-20 15:10:16 +00001354# Check that the C++ compiler exists and works with the C compiler
1355if has $cxx; then
1356 cat > $TMPC <<EOF
1357int c_function(void);
1358int main(void) { return c_function(); }
1359EOF
1360
1361 compile_object
1362
1363 cat > $TMPC <<EOF
1364extern "C" {
1365 int c_function(void);
1366}
1367int c_function(void) { return 42; }
1368EOF
1369
1370 if (cc=$cxx do_cc $QEMU_CFLAGS -o $TMPE $TMPC $TMPO $LDFLAGS); then
1371 # C++ compiler $cxx works ok with C compiler $cc
1372 :
1373 else
1374 echo "C++ compiler $cxx does not work with C compiler $cc"
1375 echo "Disabling C++ specific optional code"
1376 cxx=
1377 fi
1378else
1379 echo "No C++ compiler available; disabling C++ specific optional code"
1380 cxx=
1381fi
1382
Alexander Graf417c9d72012-07-09 14:38:08 +02001383# Consult white-list to determine whether to enable werror
1384# by default. Only enable by default for git builds
1385z_version=`cut -f3 -d. $source_path/VERSION`
1386
1387if test -z "$werror" ; then
Andreas Färber6c8fec82013-01-27 16:16:19 +01001388 if test -d "$source_path/.git" -a \
Alexander Graf417c9d72012-07-09 14:38:08 +02001389 "$linux" = "yes" ; then
1390 werror="yes"
1391 else
1392 werror="no"
1393 fi
1394fi
1395
Paolo Bonzini8d050952010-12-23 11:43:52 +01001396gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1397gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1398gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
Marc-André Lureau37746c52013-02-25 23:31:12 +01001399gcc_flags="-Wendif-labels $gcc_flags"
Peter Maydellc1556a82012-10-14 21:00:39 +01001400gcc_flags="-Wno-initializer-overrides $gcc_flags"
Peter Maydell71429092013-08-05 20:16:40 +01001401gcc_flags="-Wno-string-plus-int $gcc_flags"
Peter Maydell6ca026c2012-07-18 15:10:18 +01001402# Note that we do not add -Werror to gcc_flags here, because that would
1403# enable it for all configure tests. If a configure test failed due
1404# to -Werror this would just silently disable some features,
1405# so it's too error prone.
Paolo Bonzini8d050952010-12-23 11:43:52 +01001406cat > $TMPC << EOF
1407int main(void) { return 0; }
1408EOF
1409for flag in $gcc_flags; do
Peter Maydella1d29d62012-10-27 22:19:07 +01001410 # Use the positive sense of the flag when testing for -Wno-wombat
1411 # support (gcc will happily accept the -Wno- form of unknown
1412 # warning options).
1413 optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1414 if compile_prog "-Werror $optflag" "" ; then
Paolo Bonzini8d050952010-12-23 11:43:52 +01001415 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1416 fi
1417done
1418
Marc-André Lureau37746c52013-02-25 23:31:12 +01001419if compile_prog "-Werror -fstack-protector-all" "" ; then
1420 QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all"
1421 LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all"
1422fi
1423
Paolo Bonzinicbdd1992012-11-28 09:40:23 +01001424# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1425# large functions that use global variables. The bug is in all releases of
1426# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1427# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1428cat > $TMPC << EOF
1429#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1430int main(void) { return 0; }
1431#else
1432#error No bug in this compiler.
1433#endif
1434EOF
1435if compile_prog "-Werror -fno-gcse" "" ; then
1436 TRANSLATE_OPT_CFLAGS=-fno-gcse
1437fi
1438
Avi Kivity40d64442011-11-15 20:12:17 +02001439if test "$static" = "yes" ; then
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01001440 if test "$modules" = "yes" ; then
1441 error_exit "static and modules are mutually incompatible"
1442 fi
Avi Kivity40d64442011-11-15 20:12:17 +02001443 if test "$pie" = "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001444 error_exit "static and pie are mutually incompatible"
Avi Kivity40d64442011-11-15 20:12:17 +02001445 else
1446 pie="no"
1447 fi
1448fi
1449
1450if test "$pie" = ""; then
1451 case "$cpu-$targetos" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001452 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
Avi Kivity40d64442011-11-15 20:12:17 +02001453 ;;
1454 *)
1455 pie="no"
1456 ;;
1457 esac
1458fi
1459
1460if test "$pie" != "no" ; then
1461 cat > $TMPC << EOF
Avi Kivity21d4a792011-11-23 11:24:25 +02001462
1463#ifdef __linux__
1464# define THREAD __thread
1465#else
1466# define THREAD
1467#endif
1468
1469static THREAD int tls_var;
1470
1471int main(void) { return tls_var; }
1472
Avi Kivity40d64442011-11-15 20:12:17 +02001473EOF
1474 if compile_prog "-fPIE -DPIE" "-pie"; then
1475 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1476 LDFLAGS="-pie $LDFLAGS"
1477 pie="yes"
1478 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1479 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1480 fi
1481 else
1482 if test "$pie" = "yes"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001483 error_exit "PIE not available due to missing toolchain support"
Avi Kivity40d64442011-11-15 20:12:17 +02001484 else
1485 echo "Disabling PIE due to missing toolchain support"
1486 pie="no"
1487 fi
1488 fi
Brad46eef332013-12-10 19:49:08 -05001489
1490 if compile_prog "-fno-pie" "-nopie"; then
1491 CFLAGS_NOPIE="-fno-pie"
1492 LDFLAGS_NOPIE="-nopie"
1493 fi
Avi Kivity40d64442011-11-15 20:12:17 +02001494fi
1495
Don Slutz66518bf2014-01-02 21:12:46 -05001496# check for broken gcc and libtool in RHEL5
1497if test -n "$libtool" -a "$pie" != "no" ; then
1498 cat > $TMPC <<EOF
1499
1500void *f(unsigned char *buf, int len);
1501void *g(unsigned char *buf, int len);
1502
1503void *
1504f(unsigned char *buf, int len)
1505{
1506 return (void*)0L;
1507}
1508
1509void *
1510g(unsigned char *buf, int len)
1511{
1512 return f(buf, len);
1513}
1514
1515EOF
1516 if ! libtool_prog; then
1517 echo "Disabling libtool due to broken toolchain support"
1518 libtool=
1519 fi
1520fi
1521
Paolo Bonzini09dada42013-04-17 16:26:47 +02001522##########################################
1523# __sync_fetch_and_and requires at least -march=i486. Many toolchains
1524# use i686 as default anyway, but for those that don't, an explicit
1525# specification is necessary
1526
1527if test "$cpu" = "i386"; then
1528 cat > $TMPC << EOF
1529static int sfaa(int *ptr)
1530{
1531 return __sync_fetch_and_and(ptr, 0);
1532}
1533
1534int main(void)
1535{
1536 int val = 42;
Stefan Weil1405b622013-05-11 21:46:58 +02001537 val = __sync_val_compare_and_swap(&val, 0, 1);
Paolo Bonzini09dada42013-04-17 16:26:47 +02001538 sfaa(&val);
1539 return val;
1540}
1541EOF
1542 if ! compile_prog "" "" ; then
1543 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1544 fi
1545fi
1546
1547#########################################
bellardec530c82006-04-25 22:36:06 +00001548# Solaris specific configure tool chain decisions
Paolo Bonzini09dada42013-04-17 16:26:47 +02001549
bellardec530c82006-04-25 22:36:06 +00001550if test "$solaris" = "yes" ; then
Loïc Minier6792aa12010-01-20 11:35:54 +01001551 if has $install; then
1552 :
1553 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001554 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1555 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1556 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
bellardec530c82006-04-25 22:36:06 +00001557 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001558 if test "`path_of $install`" = "/usr/sbin/install" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001559 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1560 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1561 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
bellardec530c82006-04-25 22:36:06 +00001562 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001563 if has ar; then
1564 :
1565 else
bellardec530c82006-04-25 22:36:06 +00001566 if test -f /usr/ccs/bin/ar ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001567 error_exit "No path includes ar" \
1568 "Add /usr/ccs/bin to your path and rerun configure"
bellardec530c82006-04-25 22:36:06 +00001569 fi
Peter Maydell76ad07a2013-04-08 12:11:26 +01001570 error_exit "No path includes ar"
bellardec530c82006-04-25 22:36:06 +00001571 fi
ths5fafdf22007-09-16 21:08:06 +00001572fi
bellardec530c82006-04-25 22:36:06 +00001573
Stefan Weilafb63eb2012-09-26 22:04:38 +02001574if test -z "${target_list+xxx}" ; then
Anthony Liguori121afa92012-09-14 08:17:03 -05001575 target_list="$default_target_list"
1576else
1577 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +00001578fi
Peter Maydell25b48332013-05-20 16:16:16 +01001579
1580# Check that we recognised the target name; this allows a more
1581# friendly error message than if we let it fall through.
1582for target in $target_list; do
1583 case " $default_target_list " in
1584 *" $target "*)
1585 ;;
1586 *)
1587 error_exit "Unknown target name '$target'"
1588 ;;
1589 esac
1590done
1591
Paolo Bonzinif55fe272010-05-26 16:08:17 +02001592# see if system emulation was really requested
1593case " $target_list " in
1594 *"-softmmu "*) softmmu=yes
1595 ;;
1596 *) softmmu=no
1597 ;;
1598esac
bellard5327cf42005-01-10 23:18:50 +00001599
Juan Quintela249247c2009-08-12 18:20:25 +02001600feature_not_found() {
1601 feature=$1
Stewart Smith21684af2014-01-24 12:39:10 +11001602 remedy=$2
Juan Quintela249247c2009-08-12 18:20:25 +02001603
Peter Maydell76ad07a2013-04-08 12:11:26 +01001604 error_exit "User requested feature $feature" \
Stewart Smith21684af2014-01-24 12:39:10 +11001605 "configure was not able to find it." \
1606 "$remedy"
Juan Quintela249247c2009-08-12 18:20:25 +02001607}
1608
bellard7d132992003-03-06 23:23:54 +00001609# ---
1610# big/little endian test
1611cat > $TMPC << EOF
Mike Frysinger61cc9192013-06-30 23:30:18 -04001612short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1613short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1614extern int foo(short *, short *);
1615int main(int argc, char *argv[]) {
1616 return foo(big_endian, little_endian);
bellard7d132992003-03-06 23:23:54 +00001617}
1618EOF
1619
Mike Frysinger61cc9192013-06-30 23:30:18 -04001620if compile_object ; then
1621 if grep -q BiGeNdIaN $TMPO ; then
1622 bigendian="yes"
1623 elif grep -q LiTtLeEnDiAn $TMPO ; then
1624 bigendian="no"
1625 else
1626 echo big/little test failed
Peter Maydell21d89f82011-11-30 10:57:48 +01001627 fi
Mike Frysinger61cc9192013-06-30 23:30:18 -04001628else
1629 echo big/little test failed
bellard7d132992003-03-06 23:23:54 +00001630fi
1631
Juan Quintelab0a47e72009-08-12 18:29:49 +02001632##########################################
Stefan Weil779ab5e2012-12-16 11:29:45 +01001633# pkg-config probe
1634
1635if ! has "$pkg_config_exe"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001636 error_exit "pkg-config binary '$pkg_config_exe' not found"
Stefan Weil779ab5e2012-12-16 11:29:45 +01001637fi
1638
1639##########################################
Juan Quintelab0a47e72009-08-12 18:29:49 +02001640# NPTL probe
1641
Peter Maydell24cb36a2013-07-16 18:45:00 +01001642if test "$linux_user" = "yes"; then
Juan Quintelab0a47e72009-08-12 18:29:49 +02001643 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00001644#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00001645#include <linux/futex.h>
Stefan Weil182eacc2011-12-17 09:27:30 +01001646int main(void) {
pbrookbd0c5662008-05-29 14:34:11 +00001647#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1648#error bork
1649#endif
Stefan Weil182eacc2011-12-17 09:27:30 +01001650 return 0;
pbrookbd0c5662008-05-29 14:34:11 +00001651}
1652EOF
Peter Maydell24cb36a2013-07-16 18:45:00 +01001653 if ! compile_object ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001654 feature_not_found "nptl" "Install glibc and linux kernel headers."
Juan Quintelab0a47e72009-08-12 18:29:49 +02001655 fi
pbrookbd0c5662008-05-29 14:34:11 +00001656fi
1657
bellard11d9f692004-04-02 20:55:59 +00001658##########################################
balrogac629222008-10-11 09:56:04 +00001659# zlib check
1660
Alon Levy1ece9902011-07-26 12:30:40 +03001661if test "$zlib" != "no" ; then
1662 cat > $TMPC << EOF
balrogac629222008-10-11 09:56:04 +00001663#include <zlib.h>
1664int main(void) { zlibVersion(); return 0; }
1665EOF
Alon Levy1ece9902011-07-26 12:30:40 +03001666 if compile_prog "" "-lz" ; then
1667 :
1668 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001669 error_exit "zlib check failed" \
1670 "Make sure to have the zlib libs and headers installed."
Alon Levy1ece9902011-07-26 12:30:40 +03001671 fi
balrogac629222008-10-11 09:56:04 +00001672fi
Will Newtoneb0ecd52014-02-26 17:20:07 +00001673LIBS="$LIBS -lz"
balrogac629222008-10-11 09:56:04 +00001674
1675##########################################
qiaonuohan607dacd2014-02-18 14:11:30 +08001676# lzo check
1677
1678if test "$lzo" != "no" ; then
1679 cat > $TMPC << EOF
1680#include <lzo/lzo1x.h>
1681int main(void) { lzo_version(); return 0; }
1682EOF
1683 if compile_prog "" "-llzo2" ; then
1684 :
1685 else
1686 error_exit "lzo check failed" \
1687 "Make sure to have the lzo libs and headers installed."
1688 fi
1689
1690 libs_softmmu="$libs_softmmu -llzo2"
1691fi
1692
1693##########################################
1694# snappy check
1695
1696if test "$snappy" != "no" ; then
1697 cat > $TMPC << EOF
1698#include <snappy-c.h>
1699int main(void) { snappy_max_compressed_length(4096); return 0; }
1700EOF
1701 if compile_prog "" "-lsnappy" ; then
1702 :
1703 else
1704 error_exit "snappy check failed" \
1705 "Make sure to have the snappy libs and headers installed."
1706 fi
1707
1708 libs_softmmu="$libs_softmmu -lsnappy"
1709fi
1710
1711##########################################
Eduardo Otubof7945732012-08-14 18:44:05 -03001712# libseccomp check
1713
1714if test "$seccomp" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02001715 if $pkg_config --atleast-version=2.1.0 libseccomp; then
Michael Tokarevb4451992013-01-19 18:58:09 +04001716 libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
Andreas Färber372e47e2013-04-28 16:27:26 +02001717 QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
Eduardo Otubof7945732012-08-14 18:44:05 -03001718 seccomp="yes"
1719 else
Eduardo Otubof7945732012-08-14 18:44:05 -03001720 if test "$seccomp" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11001721 feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
Eduardo Otubof7945732012-08-14 18:44:05 -03001722 fi
Yann E. MORINe84d5952012-09-06 22:40:30 +02001723 seccomp="no"
Eduardo Otubof7945732012-08-14 18:44:05 -03001724 fi
1725fi
1726##########################################
aliguorie37630c2009-04-22 15:19:10 +00001727# xen probe
1728
Juan Quintelafc321b42009-08-12 18:29:55 +02001729if test "$xen" != "no" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +02001730 xen_libs="-lxenstore -lxenctrl -lxenguest"
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001731
Stefan Weil50ced5b2011-12-17 09:27:39 +01001732 # First we test whether Xen headers and libraries are available.
1733 # If no, we are done and there is no Xen support.
1734 # If yes, more tests are run to detect the Xen version.
1735
1736 # Xen (any)
Juan Quintelab2266be2009-07-27 16:13:16 +02001737 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00001738#include <xenctrl.h>
Stefan Weil50ced5b2011-12-17 09:27:39 +01001739int main(void) {
1740 return 0;
1741}
1742EOF
1743 if ! compile_prog "" "$xen_libs" ; then
1744 # Xen not found
1745 if test "$xen" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001746 feature_not_found "xen" "Install xen devel"
Stefan Weil50ced5b2011-12-17 09:27:39 +01001747 fi
1748 xen=no
1749
1750 # Xen unstable
Peter Maydell69deef02012-08-02 18:30:26 +01001751 elif
1752 cat > $TMPC <<EOF &&
Stefan Weil50ced5b2011-12-17 09:27:39 +01001753#include <xenctrl.h>
Anthony PERARDe108a3c2012-06-21 11:44:35 +00001754#include <xenstore.h>
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001755#include <stdint.h>
1756#include <xen/hvm/hvm_info_table.h>
1757#if !defined(HVM_MAX_VCPUS)
1758# error HVM_MAX_VCPUS not defined
1759#endif
1760int main(void) {
1761 xc_interface *xc;
1762 xs_daemon_open();
1763 xc = xc_interface_open(0, 0, 0);
1764 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1765 xc_gnttab_open(NULL, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001766 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Stefano Stabellini8688e062012-04-17 17:04:18 +00001767 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1768 return 0;
1769}
1770EOF
1771 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001772 then
Stefano Stabellini8688e062012-04-17 17:04:18 +00001773 xen_ctrl_version=420
1774 xen=yes
1775
Peter Maydell69deef02012-08-02 18:30:26 +01001776 elif
1777 cat > $TMPC <<EOF &&
Stefano Stabellini8688e062012-04-17 17:04:18 +00001778#include <xenctrl.h>
1779#include <xs.h>
1780#include <stdint.h>
1781#include <xen/hvm/hvm_info_table.h>
1782#if !defined(HVM_MAX_VCPUS)
1783# error HVM_MAX_VCPUS not defined
1784#endif
1785int main(void) {
Stefano Stabellini8688e062012-04-17 17:04:18 +00001786 xs_daemon_open();
Peter Maydell9b4c0b52012-08-02 18:30:27 +01001787 xc_interface_open(0, 0, 0);
Stefano Stabellini8688e062012-04-17 17:04:18 +00001788 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1789 xc_gnttab_open(NULL, 0);
1790 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001791 return 0;
1792}
aliguorie37630c2009-04-22 15:19:10 +00001793EOF
Stefan Weil50ced5b2011-12-17 09:27:39 +01001794 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001795 then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001796 xen_ctrl_version=410
Juan Quintelafc321b42009-08-12 18:29:55 +02001797 xen=yes
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001798
1799 # Xen 4.0.0
Peter Maydell69deef02012-08-02 18:30:26 +01001800 elif
1801 cat > $TMPC <<EOF &&
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001802#include <xenctrl.h>
1803#include <xs.h>
1804#include <stdint.h>
1805#include <xen/hvm/hvm_info_table.h>
1806#if !defined(HVM_MAX_VCPUS)
1807# error HVM_MAX_VCPUS not defined
1808#endif
1809int main(void) {
Anthony PERARDb87de242011-05-24 14:34:20 +01001810 struct xen_add_to_physmap xatp = {
1811 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1812 };
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001813 xs_daemon_open();
1814 xc_interface_open();
1815 xc_gnttab_open();
1816 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001817 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001818 return 0;
1819}
1820EOF
1821 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001822 then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001823 xen_ctrl_version=400
1824 xen=yes
1825
Anthony PERARDb87de242011-05-24 14:34:20 +01001826 # Xen 3.4.0
Peter Maydell69deef02012-08-02 18:30:26 +01001827 elif
1828 cat > $TMPC <<EOF &&
Anthony PERARDb87de242011-05-24 14:34:20 +01001829#include <xenctrl.h>
1830#include <xs.h>
1831int main(void) {
1832 struct xen_add_to_physmap xatp = {
1833 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1834 };
1835 xs_daemon_open();
1836 xc_interface_open();
1837 xc_gnttab_open();
1838 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1839 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1840 return 0;
1841}
1842EOF
1843 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001844 then
Anthony PERARDb87de242011-05-24 14:34:20 +01001845 xen_ctrl_version=340
1846 xen=yes
1847
1848 # Xen 3.3.0
Peter Maydell69deef02012-08-02 18:30:26 +01001849 elif
1850 cat > $TMPC <<EOF &&
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001851#include <xenctrl.h>
1852#include <xs.h>
1853int main(void) {
1854 xs_daemon_open();
1855 xc_interface_open();
1856 xc_gnttab_open();
1857 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1858 return 0;
1859}
1860EOF
1861 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001862 then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001863 xen_ctrl_version=330
1864 xen=yes
1865
Stefan Weil50ced5b2011-12-17 09:27:39 +01001866 # Xen version unsupported
Juan Quintelab2266be2009-07-27 16:13:16 +02001867 else
Juan Quintelafc321b42009-08-12 18:29:55 +02001868 if test "$xen" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001869 feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
Juan Quintelafc321b42009-08-12 18:29:55 +02001870 fi
1871 xen=no
Juan Quintelab2266be2009-07-27 16:13:16 +02001872 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001873
1874 if test "$xen" = yes; then
1875 libs_softmmu="$xen_libs $libs_softmmu"
1876 fi
aliguorie37630c2009-04-22 15:19:10 +00001877fi
1878
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001879if test "$xen_pci_passthrough" != "no"; then
1880 if test "$xen" = "yes" && test "$linux" = "yes" &&
1881 test "$xen_ctrl_version" -ge 340; then
1882 xen_pci_passthrough=yes
1883 else
1884 if test "$xen_pci_passthrough" = "yes"; then
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001885 if test "$xen_ctrl_version" -lt 340; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001886 error_exit "User requested feature Xen PCI Passthrough" \
1887 "This feature does not work with Xen 3.3"
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001888 fi
Peter Maydell76ad07a2013-04-08 12:11:26 +01001889 error_exit "User requested feature Xen PCI Passthrough" \
1890 " but this feature requires /sys from Linux"
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001891 fi
1892 xen_pci_passthrough=no
1893 fi
1894fi
1895
aliguorie37630c2009-04-22 15:19:10 +00001896##########################################
Alon Levy44dc0ca2011-05-15 11:51:28 +03001897# libtool probe
1898
Brad3f534582011-08-13 20:30:14 -04001899if ! has $libtool; then
Alon Levy44dc0ca2011-05-15 11:51:28 +03001900 libtool=
Alon Levy44dc0ca2011-05-15 11:51:28 +03001901fi
1902
Peter Maydell8e515b12013-05-04 21:57:51 +01001903# MacOSX ships with a libtool which isn't the GNU one; weed this
1904# out by checking whether libtool supports the --version switch
1905if test -n "$libtool"; then
1906 if ! "$libtool" --version >/dev/null 2>&1; then
1907 libtool=
1908 fi
1909fi
1910
Alon Levy44dc0ca2011-05-15 11:51:28 +03001911##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02001912# Sparse probe
1913if test "$sparse" != "no" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001914 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02001915 sparse=yes
1916 else
1917 if test "$sparse" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001918 feature_not_found "sparse" "Install sparse binary"
Juan Quinteladfffc652009-08-12 18:29:57 +02001919 fi
1920 sparse=no
1921 fi
1922fi
1923
1924##########################################
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001925# GTK probe
1926
1927if test "$gtk" != "no"; then
Daniel P. Berrange528de902013-02-25 15:20:44 +00001928 gtkpackage="gtk+-$gtkabi"
1929 if test "$gtkabi" = "3.0" ; then
1930 gtkversion="3.0.0"
1931 vtepackage="vte-2.90"
1932 vteversion="0.32.0"
1933 else
1934 gtkversion="2.18.0"
1935 vtepackage="vte"
1936 vteversion="0.24.0"
1937 fi
Peter Maydell0d185e62013-07-18 16:42:01 +01001938 if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
1939 if test "$gtk" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001940 feature_not_found "gtk" "Install gtk2 or gtk3 (requires --with-gtkabi=3.0 option to configure) devel"
Peter Maydell0d185e62013-07-18 16:42:01 +01001941 fi
1942 gtk="no"
1943 elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
1944 if test "$gtk" = "yes" ; then
1945 error_exit "libvte not found (required for gtk support)"
1946 fi
1947 gtk="no"
1948 else
Stefan Weilca871ec2013-08-27 21:09:12 +02001949 gtk_cflags=`$pkg_config --cflags $gtkpackage`
1950 gtk_libs=`$pkg_config --libs $gtkpackage`
1951 vte_cflags=`$pkg_config --cflags $vtepackage`
1952 vte_libs=`$pkg_config --libs $vtepackage`
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001953 libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
1954 gtk="yes"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001955 fi
1956fi
1957
1958##########################################
bellard11d9f692004-04-02 20:55:59 +00001959# SDL probe
1960
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001961# Look for sdl configuration program (pkg-config or sdl-config). Try
1962# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
Dave Airlie47c03742013-12-10 14:05:51 +10001963
1964if test $sdlabi = "2.0"; then
1965 sdl_config=$sdl2_config
1966 sdlname=sdl2
1967 sdlconfigname=sdl2_config
1968else
1969 sdlname=sdl
1970 sdlconfigname=sdl_config
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001971fi
1972
Dave Airlie47c03742013-12-10 14:05:51 +10001973if test "`basename $sdl_config`" != $sdlconfigname && ! has ${sdl_config}; then
1974 sdl_config=$sdlconfigname
1975fi
1976
1977if $pkg_config $sdlname --exists; then
1978 sdlconfig="$pkg_config $sdlname"
Stefan Weilfec0e3e2010-04-11 18:44:18 +02001979 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001980elif has ${sdl_config}; then
1981 sdlconfig="$sdl_config"
Paolo Bonzini9316f802010-01-13 09:52:55 +01001982 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00001983else
1984 if test "$sdl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001985 feature_not_found "sdl" "Install SDL devel"
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00001986 fi
1987 sdl=no
Paolo Bonzini9316f802010-01-13 09:52:55 +01001988fi
Scott Wood29e5bad2011-04-08 14:15:50 -05001989if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001990 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1991fi
bellard11d9f692004-04-02 20:55:59 +00001992
Paolo Bonzini9316f802010-01-13 09:52:55 +01001993sdl_too_old=no
Juan Quintelac4198152009-08-12 18:29:53 +02001994if test "$sdl" != "no" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001995 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00001996#include <SDL.h>
1997#undef main /* We don't want SDL to override our main() */
1998int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1999EOF
Paolo Bonzini9316f802010-01-13 09:52:55 +01002000 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
TeLeMan74f42e12010-02-08 13:56:44 +08002001 if test "$static" = "yes" ; then
2002 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
2003 else
2004 sdl_libs=`$sdlconfig --libs 2> /dev/null`
2005 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02002006 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002007 if test "$_sdlversion" -lt 121 ; then
2008 sdl_too_old=yes
2009 else
2010 if test "$cocoa" = "no" ; then
2011 sdl=yes
2012 fi
2013 fi
aliguoricd01b4a2008-08-21 19:25:45 +00002014
Paolo Bonzini67c274d2010-01-13 09:52:54 +01002015 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Juan Quintelaac119f92009-07-27 16:13:15 +02002016 if test "$sdl" = "yes" -a "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01002017 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weilf8aa6c72010-03-01 22:10:46 +01002018 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
2019 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
Juan Quintelaac119f92009-07-27 16:13:15 +02002020 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02002021 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002022 :
2023 else
2024 sdl=no
2025 fi
2026 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02002027 else # sdl not found
2028 if test "$sdl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002029 feature_not_found "sdl" "Install SDL devel"
Juan Quintelac4198152009-08-12 18:29:53 +02002030 fi
2031 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02002032 fi # sdl compile test
Juan Quintelaa68551b2009-07-27 16:13:09 +02002033fi
bellard11d9f692004-04-02 20:55:59 +00002034
aliguori5368a422009-03-03 17:37:21 +00002035if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002036 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00002037#include <SDL.h>
2038#if defined(SDL_VIDEO_DRIVER_X11)
2039#include <X11/XKBlib.h>
2040#else
2041#error No x11 support
2042#endif
2043int main(void) { return 0; }
2044EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002045 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002046 sdl_libs="$sdl_libs -lX11"
2047 fi
Juan Quintela07056672009-08-03 14:46:27 +02002048 libs_softmmu="$sdl_libs $libs_softmmu"
aliguori5368a422009-03-03 17:37:21 +00002049fi
2050
ths8f28f3f2007-01-05 21:25:54 +00002051##########################################
Michael R. Hines2da776d2013-07-22 10:01:54 -04002052# RDMA needs OpenFabrics libraries
2053if test "$rdma" != "no" ; then
2054 cat > $TMPC <<EOF
2055#include <rdma/rdma_cma.h>
2056int main(void) { return 0; }
2057EOF
2058 rdma_libs="-lrdmacm -libverbs"
2059 if compile_prog "" "$rdma_libs" ; then
2060 rdma="yes"
2061 libs_softmmu="$libs_softmmu $rdma_libs"
2062 else
2063 if test "$rdma" = "yes" ; then
2064 error_exit \
2065 " OpenFabrics librdmacm/libibverbs not present." \
2066 " Your options:" \
2067 " (1) Fast: Install infiniband packages from your distro." \
2068 " (2) Cleanest: Install libraries from www.openfabrics.org" \
2069 " (3) Also: Install softiwarp if you don't have RDMA hardware"
2070 fi
2071 rdma="no"
2072 fi
2073fi
2074
2075##########################################
Tim Hardeck7536ee42013-01-21 11:04:44 +01002076# VNC TLS/WS detection
2077if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
Juan Quintela1be10ad2009-08-12 18:20:28 +02002078 cat > $TMPC <<EOF
aliguoriae6b5e52008-08-06 16:55:50 +00002079#include <gnutls/gnutls.h>
2080int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
2081EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01002082 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2083 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
Juan Quintela1be10ad2009-08-12 18:20:28 +02002084 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
Tim Hardeck7536ee42013-01-21 11:04:44 +01002085 if test "$vnc_tls" != "no" ; then
2086 vnc_tls=yes
2087 fi
2088 if test "$vnc_ws" != "no" ; then
2089 vnc_ws=yes
2090 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02002091 libs_softmmu="$vnc_tls_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01002092 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
Juan Quintela1be10ad2009-08-12 18:20:28 +02002093 else
2094 if test "$vnc_tls" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002095 feature_not_found "vnc-tls" "Install gnutls devel"
aliguoriae6b5e52008-08-06 16:55:50 +00002096 fi
Tim Hardeck7536ee42013-01-21 11:04:44 +01002097 if test "$vnc_ws" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002098 feature_not_found "vnc-ws" "Install gnutls devel"
Tim Hardeck7536ee42013-01-21 11:04:44 +01002099 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02002100 vnc_tls=no
Tim Hardeck7536ee42013-01-21 11:04:44 +01002101 vnc_ws=no
Juan Quintela1be10ad2009-08-12 18:20:28 +02002102 fi
ths8d5d2d42007-08-25 01:37:51 +00002103fi
2104
2105##########################################
Benoît Canet95c6bff2014-02-21 22:21:15 +01002106# Quorum probe (check for gnutls)
2107if test "$quorum" != "no" ; then
2108cat > $TMPC <<EOF
2109#include <gnutls/gnutls.h>
2110#include <gnutls/crypto.h>
2111int main(void) {char data[4096], digest[32];
2112gnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest);
2113return 0;
2114}
2115EOF
2116quorum_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2117quorum_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
2118if compile_prog "$quorum_tls_cflags" "$quorum_tls_libs" ; then
2119 qcow_tls=yes
2120 libs_softmmu="$quorum_tls_libs $libs_softmmu"
2121 libs_tools="$quorum_tls_libs $libs_softmmu"
2122 QEMU_CFLAGS="$QEMU_CFLAGS $quorum_tls_cflags"
2123else
2124 echo "gnutls > 2.10.0 required to compile Quorum"
2125 exit 1
2126fi
2127fi
2128
2129##########################################
aliguori2f9606b2009-03-06 20:27:28 +00002130# VNC SASL detection
Jes Sorensen821601e2011-03-16 13:33:36 +01002131if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02002132 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00002133#include <sasl/sasl.h>
2134#include <stdio.h>
2135int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
2136EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02002137 # Assuming Cyrus-SASL installed in /usr prefix
2138 vnc_sasl_cflags=""
2139 vnc_sasl_libs="-lsasl2"
2140 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
2141 vnc_sasl=yes
2142 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01002143 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
Juan Quintelaea784e32009-08-12 18:20:29 +02002144 else
2145 if test "$vnc_sasl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002146 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
aliguori2f9606b2009-03-06 20:27:28 +00002147 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02002148 vnc_sasl=no
2149 fi
aliguori2f9606b2009-03-06 20:27:28 +00002150fi
2151
2152##########################################
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002153# VNC JPEG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01002154if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002155cat > $TMPC <<EOF
2156#include <stdio.h>
2157#include <jpeglib.h>
2158int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2159EOF
2160 vnc_jpeg_cflags=""
2161 vnc_jpeg_libs="-ljpeg"
2162 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2163 vnc_jpeg=yes
2164 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01002165 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002166 else
2167 if test "$vnc_jpeg" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002168 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002169 fi
2170 vnc_jpeg=no
2171 fi
2172fi
2173
2174##########################################
Corentin Charyefe556a2010-07-07 20:57:56 +02002175# VNC PNG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01002176if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02002177cat > $TMPC <<EOF
2178//#include <stdio.h>
2179#include <png.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002180#include <stddef.h>
Corentin Charyefe556a2010-07-07 20:57:56 +02002181int main(void) {
2182 png_structp png_ptr;
2183 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
Peter Maydell7edc3fe2012-07-18 15:10:24 +01002184 return png_ptr != 0;
Corentin Charyefe556a2010-07-07 20:57:56 +02002185}
2186EOF
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002187 if $pkg_config libpng --exists; then
Stefan Weilca871ec2013-08-27 21:09:12 +02002188 vnc_png_cflags=`$pkg_config libpng --cflags`
2189 vnc_png_libs=`$pkg_config libpng --libs`
Brad9af80252011-07-30 01:45:55 -04002190 else
Corentin Charyefe556a2010-07-07 20:57:56 +02002191 vnc_png_cflags=""
2192 vnc_png_libs="-lpng"
Brad9af80252011-07-30 01:45:55 -04002193 fi
Corentin Charyefe556a2010-07-07 20:57:56 +02002194 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2195 vnc_png=yes
2196 libs_softmmu="$vnc_png_libs $libs_softmmu"
Brad9af80252011-07-30 01:45:55 -04002197 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
Corentin Charyefe556a2010-07-07 20:57:56 +02002198 else
2199 if test "$vnc_png" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002200 feature_not_found "vnc-png" "Install libpng devel"
Corentin Charyefe556a2010-07-07 20:57:56 +02002201 fi
2202 vnc_png=no
2203 fi
2204fi
2205
2206##########################################
aliguori76655d62009-03-06 20:27:37 +00002207# fnmatch() probe, used for ACL routines
2208fnmatch="no"
2209cat > $TMPC << EOF
2210#include <fnmatch.h>
2211int main(void)
2212{
2213 fnmatch("foo", "foo", 0);
2214 return 0;
2215}
2216EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002217if compile_prog "" "" ; then
aliguori76655d62009-03-06 20:27:37 +00002218 fnmatch="yes"
2219fi
2220
2221##########################################
Stefan Weilee682d22009-10-01 20:10:37 +02002222# uuid_generate() probe, used for vdi block driver
Peter Maydell2d16c8e2013-05-14 21:36:39 +01002223# Note that on some systems (notably MacOSX) no extra library
2224# need be linked to get the uuid functions.
Stefan Weilee682d22009-10-01 20:10:37 +02002225if test "$uuid" != "no" ; then
2226 uuid_libs="-luuid"
2227 cat > $TMPC << EOF
2228#include <uuid/uuid.h>
2229int main(void)
2230{
2231 uuid_t my_uuid;
2232 uuid_generate(my_uuid);
2233 return 0;
2234}
2235EOF
Peter Maydell2d16c8e2013-05-14 21:36:39 +01002236 if compile_prog "" "" ; then
2237 uuid="yes"
2238 elif compile_prog "" "$uuid_libs" ; then
Stefan Weilee682d22009-10-01 20:10:37 +02002239 uuid="yes"
2240 libs_softmmu="$uuid_libs $libs_softmmu"
2241 libs_tools="$uuid_libs $libs_tools"
2242 else
2243 if test "$uuid" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002244 feature_not_found "uuid" "Install libuuid devel"
Stefan Weilee682d22009-10-01 20:10:37 +02002245 fi
2246 uuid=no
2247 fi
2248fi
2249
Jeff Cody4f18b782013-10-30 10:44:39 -04002250if test "$vhdx" = "yes" ; then
2251 if test "$uuid" = "no" ; then
2252 error_exit "uuid required for VHDX support"
2253 fi
2254elif test "$vhdx" != "no" ; then
2255 if test "$uuid" = "yes" ; then
2256 vhdx=yes
2257 else
2258 vhdx=no
2259 fi
2260fi
2261
Stefan Weilee682d22009-10-01 20:10:37 +02002262##########################################
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002263# xfsctl() probe, used for raw-posix
2264if test "$xfs" != "no" ; then
2265 cat > $TMPC << EOF
Stefan Weilffc41d12011-12-17 09:27:36 +01002266#include <stddef.h> /* NULL */
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002267#include <xfs/xfs.h>
2268int main(void)
2269{
2270 xfsctl(NULL, 0, 0, NULL);
2271 return 0;
2272}
2273EOF
2274 if compile_prog "" "" ; then
2275 xfs="yes"
2276 else
2277 if test "$xfs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002278 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002279 fi
2280 xfs=no
2281 fi
2282fi
2283
2284##########################################
ths8a16d272008-07-19 09:56:24 +00002285# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02002286if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02002287 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00002288 cat > $TMPC << EOF
2289#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00002290int main(void)
2291{
2292 struct vde_open_args a = {0, 0, 0};
Peter Maydellfea08e02012-07-18 15:10:25 +01002293 char s[] = "";
2294 vde_open(s, s, &a);
pbrook4a7f0e02008-09-07 16:42:53 +00002295 return 0;
2296}
ths8a16d272008-07-19 09:56:24 +00002297EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002298 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02002299 vde=yes
Juan Quintela8e02e542009-08-03 14:47:07 +02002300 libs_softmmu="$vde_libs $libs_softmmu"
2301 libs_tools="$vde_libs $libs_tools"
Juan Quinteladfb278b2009-08-12 18:20:27 +02002302 else
2303 if test "$vde" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002304 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
Juan Quinteladfb278b2009-08-12 18:20:27 +02002305 fi
2306 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02002307 fi
ths8a16d272008-07-19 09:56:24 +00002308fi
2309
2310##########################################
Vincenzo Maffione0a985b32014-02-20 15:40:43 +01002311# netmap support probe
2312# Apart from looking for netmap headers, we make sure that the host API version
2313# supports the netmap backend (>=11). The upper bound (15) is meant to simulate
2314# a minor/major version number. Minor new features will be marked with values up
2315# to 15, and if something happens that requires a change to the backend we will
2316# move above 15, submit the backend fixes and modify this two bounds.
Vincenzo Maffione58952132013-11-06 11:44:06 +01002317if test "$netmap" != "no" ; then
2318 cat > $TMPC << EOF
2319#include <inttypes.h>
2320#include <net/if.h>
2321#include <net/netmap.h>
2322#include <net/netmap_user.h>
Vincenzo Maffione0a985b32014-02-20 15:40:43 +01002323#if (NETMAP_API < 11) || (NETMAP_API > 15)
2324#error
2325#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01002326int main(void) { return 0; }
2327EOF
2328 if compile_prog "" "" ; then
2329 netmap=yes
2330 else
2331 if test "$netmap" = "yes" ; then
2332 feature_not_found "netmap"
2333 fi
2334 netmap=no
2335 fi
2336fi
2337
2338##########################################
Corey Bryant47e98652012-01-26 09:42:26 -05002339# libcap-ng library probe
2340if test "$cap_ng" != "no" ; then
2341 cap_libs="-lcap-ng"
2342 cat > $TMPC << EOF
2343#include <cap-ng.h>
2344int main(void)
2345{
2346 capng_capability_to_name(CAPNG_EFFECTIVE);
2347 return 0;
2348}
2349EOF
2350 if compile_prog "" "$cap_libs" ; then
2351 cap_ng=yes
2352 libs_tools="$cap_libs $libs_tools"
2353 else
2354 if test "$cap_ng" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002355 feature_not_found "cap_ng" "Install libcap-ng devel"
Corey Bryant47e98652012-01-26 09:42:26 -05002356 fi
2357 cap_ng=no
2358 fi
2359fi
2360
2361##########################################
malcc2de5c92008-06-28 19:13:06 +00002362# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00002363
malcc2de5c92008-06-28 19:13:06 +00002364audio_drv_probe()
2365{
2366 drv=$1
2367 hdr=$2
2368 lib=$3
2369 exp=$4
2370 cfl=$5
2371 cat > $TMPC << EOF
2372#include <$hdr>
2373int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00002374EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002375 if compile_prog "$cfl" "$lib" ; then
malcc2de5c92008-06-28 19:13:06 +00002376 :
2377 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01002378 error_exit "$drv check failed" \
2379 "Make sure to have the $drv libs and headers installed."
malcc2de5c92008-06-28 19:13:06 +00002380 fi
2381}
2382
malc2fa7d3b2008-07-29 12:58:44 +00002383audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00002384for drv in $audio_drv_list; do
2385 case $drv in
2386 alsa)
2387 audio_drv_probe $drv alsa/asoundlib.h -lasound \
Stefan Weile35bcb02012-07-18 15:10:19 +01002388 "return snd_pcm_close((snd_pcm_t *)0);"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002389 libs_softmmu="-lasound $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00002390 ;;
2391
2392 fmod)
2393 if test -z $fmod_lib || test -z $fmod_inc; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002394 error_exit "You must specify path to FMOD library and headers" \
2395 "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
malcc2de5c92008-06-28 19:13:06 +00002396 fi
2397 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002398 libs_softmmu="$fmod_lib $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00002399 ;;
2400
2401 esd)
2402 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002403 libs_softmmu="-lesd $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02002404 audio_pt_int="yes"
malcc2de5c92008-06-28 19:13:06 +00002405 ;;
malcb8e59f12008-07-02 21:03:08 +00002406
2407 pa)
Marc-André Lureaua394aed2012-04-17 14:32:42 +02002408 audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2409 "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2410 libs_softmmu="-lpulse $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02002411 audio_pt_int="yes"
malcb8e59f12008-07-02 21:03:08 +00002412 ;;
2413
Juan Quintela997e6902009-08-03 14:46:29 +02002414 coreaudio)
2415 libs_softmmu="-framework CoreAudio $libs_softmmu"
2416 ;;
2417
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002418 dsound)
2419 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
malcd5631632009-10-10 01:13:41 +04002420 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002421 ;;
2422
2423 oss)
2424 libs_softmmu="$oss_lib $libs_softmmu"
2425 ;;
2426
2427 sdl|wav)
blueswir12f6a1ab2008-08-21 18:00:53 +00002428 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
2429 ;;
2430
malcd5631632009-10-10 01:13:41 +04002431 winwave)
2432 libs_softmmu="-lwinmm $libs_softmmu"
2433 audio_win_int="yes"
2434 ;;
2435
malce4c63a62008-07-19 16:15:16 +00002436 *)
malc1c9b2a52008-07-19 16:57:30 +00002437 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
Peter Maydell76ad07a2013-04-08 12:11:26 +01002438 error_exit "Unknown driver '$drv' selected" \
2439 "Possible drivers are: $audio_possible_drivers"
malce4c63a62008-07-19 16:15:16 +00002440 }
2441 ;;
malcc2de5c92008-06-28 19:13:06 +00002442 esac
2443done
ths8f28f3f2007-01-05 21:25:54 +00002444
balrog4d3b6f62008-02-10 16:33:14 +00002445##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00002446# BrlAPI probe
2447
Juan Quintela4ffcedb2009-08-12 18:20:26 +02002448if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02002449 brlapi_libs="-lbrlapi"
2450 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00002451#include <brlapi.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002452#include <stddef.h>
aurel322e4d9fb2008-04-08 06:01:02 +00002453int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
2454EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002455 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02002456 brlapi=yes
Juan Quintela264606b2009-08-03 14:46:39 +02002457 libs_softmmu="$brlapi_libs $libs_softmmu"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02002458 else
2459 if test "$brlapi" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002460 feature_not_found "brlapi" "Install brlapi devel"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02002461 fi
2462 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02002463 fi
2464fi
aurel322e4d9fb2008-04-08 06:01:02 +00002465
2466##########################################
balrog4d3b6f62008-02-10 16:33:14 +00002467# curses probe
Juan Quintelac584a6d2009-08-12 18:20:30 +02002468if test "$curses" != "no" ; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04002469 if test "$mingw32" = "yes" ; then
2470 curses_list="-lpdcurses"
2471 else
Ed Mastecfeda5f2013-05-24 16:07:00 -04002472 curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
Michael Tokareva3605bf2013-05-25 13:17:21 +04002473 fi
Juan Quintelac584a6d2009-08-12 18:20:30 +02002474 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00002475 cat > $TMPC << EOF
2476#include <curses.h>
Stefan Weilef9a2522011-12-17 17:46:02 +01002477int main(void) {
2478 const char *s = curses_version();
2479 resize_term(0, 0);
2480 return s != 0;
2481}
balrog4d3b6f62008-02-10 16:33:14 +00002482EOF
Vadim Evardecbe2512013-01-15 16:17:24 +04002483 IFS=:
Juan Quintela4f78ef92009-08-12 18:20:23 +02002484 for curses_lib in $curses_list; do
Vadim Evardecbe2512013-01-15 16:17:24 +04002485 unset IFS
Juan Quintela4f78ef92009-08-12 18:20:23 +02002486 if compile_prog "" "$curses_lib" ; then
Juan Quintelac584a6d2009-08-12 18:20:30 +02002487 curses_found=yes
Juan Quintela4f78ef92009-08-12 18:20:23 +02002488 libs_softmmu="$curses_lib $libs_softmmu"
2489 break
2490 fi
2491 done
Vadim Evardecbe2512013-01-15 16:17:24 +04002492 unset IFS
Juan Quintelac584a6d2009-08-12 18:20:30 +02002493 if test "$curses_found" = "yes" ; then
2494 curses=yes
2495 else
2496 if test "$curses" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002497 feature_not_found "curses" "Install ncurses devel"
Juan Quintelac584a6d2009-08-12 18:20:30 +02002498 fi
2499 curses=no
2500 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02002501fi
balrog4d3b6f62008-02-10 16:33:14 +00002502
blueswir1414f0da2008-08-15 18:20:52 +00002503##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02002504# curl probe
Juan Quintela788c8192009-08-12 18:29:47 +02002505if test "$curl" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002506 if $pkg_config libcurl --exists; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04002507 curlconfig="$pkg_config libcurl"
2508 else
2509 curlconfig=curl-config
2510 fi
Alexander Graf769ce762009-05-11 17:41:42 +02002511 cat > $TMPC << EOF
2512#include <curl/curl.h>
Peter Maydell0b862ce2011-06-09 22:54:29 +01002513int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
Alexander Graf769ce762009-05-11 17:41:42 +02002514EOF
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01002515 curl_cflags=`$curlconfig --cflags 2>/dev/null`
2516 curl_libs=`$curlconfig --libs 2>/dev/null`
Juan Quintelab1d5a272009-08-03 14:46:05 +02002517 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02002518 curl=yes
Juan Quintela788c8192009-08-12 18:29:47 +02002519 else
2520 if test "$curl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002521 feature_not_found "curl" "Install libcurl devel"
Juan Quintela788c8192009-08-12 18:29:47 +02002522 fi
2523 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02002524 fi
2525fi # test "$curl"
2526
2527##########################################
balrogfb599c92008-09-28 23:49:55 +00002528# bluez support probe
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002529if test "$bluez" != "no" ; then
balroge820e3f2008-09-30 02:27:44 +00002530 cat > $TMPC << EOF
2531#include <bluetooth/bluetooth.h>
2532int main(void) { return bt_error(0); }
2533EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01002534 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2535 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +02002536 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002537 bluez=yes
Juan Quintelae482d562009-08-03 14:46:37 +02002538 libs_softmmu="$bluez_libs $libs_softmmu"
balroge820e3f2008-09-30 02:27:44 +00002539 else
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002540 if test "$bluez" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002541 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002542 fi
balroge820e3f2008-09-30 02:27:44 +00002543 bluez="no"
2544 fi
balrogfb599c92008-09-28 23:49:55 +00002545fi
2546
2547##########################################
Anthony Liguorie18df142011-07-19 14:50:29 -05002548# glib support probe
Paolo Bonzinia52d28a2012-04-05 13:01:54 +02002549
2550if test "$mingw32" = yes; then
2551 # g_poll is required in order to integrate with the glib main loop.
2552 glib_req_ver=2.20
2553else
2554 glib_req_ver=2.12
2555fi
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01002556glib_modules=gthread-2.0
2557if test "$modules" = yes; then
2558 glib_modules="$glib_modules gmodule-2.0"
2559fi
Fam Zhenge26110c2014-02-10 14:48:57 +08002560
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01002561for i in $glib_modules; do
Fam Zhenge26110c2014-02-10 14:48:57 +08002562 if $pkg_config --atleast-version=$glib_req_ver $i; then
2563 glib_cflags=`$pkg_config --cflags $i`
2564 glib_libs=`$pkg_config --libs $i`
2565 CFLAGS="$glib_cflags $CFLAGS"
2566 LIBS="$glib_libs $LIBS"
2567 libs_qga="$glib_libs $libs_qga"
2568 else
2569 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
2570 fi
2571done
2572
2573##########################################
2574# SHA command probe for modules
2575if test "$modules" = yes; then
2576 shacmd_probe="sha1sum sha1 shasum"
2577 for c in $shacmd_probe; do
2578 if which $c &>/dev/null; then
2579 shacmd="$c"
2580 break
2581 fi
2582 done
2583 if test "$shacmd" = ""; then
2584 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
2585 fi
Anthony Liguorie18df142011-07-19 14:50:29 -05002586fi
2587
2588##########################################
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002589# pixman support probe
2590
2591if test "$pixman" = ""; then
Robert Schiele74880fe2012-12-04 16:58:08 +01002592 if test "$want_tools" = "no" -a "$softmmu" = "no"; then
2593 pixman="none"
2594 elif $pkg_config pixman-1 > /dev/null 2>&1; then
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002595 pixman="system"
2596 else
2597 pixman="internal"
2598 fi
2599fi
Robert Schiele74880fe2012-12-04 16:58:08 +01002600if test "$pixman" = "none"; then
2601 if test "$want_tools" != "no" -o "$softmmu" != "no"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002602 error_exit "pixman disabled but system emulation or tools build" \
2603 "enabled. You can turn off pixman only if you also" \
2604 "disable all system emulation targets and the tools" \
2605 "build with '--disable-tools --disable-system'."
Robert Schiele74880fe2012-12-04 16:58:08 +01002606 fi
2607 pixman_cflags=
2608 pixman_libs=
2609elif test "$pixman" = "system"; then
Stefan Weilca871ec2013-08-27 21:09:12 +02002610 pixman_cflags=`$pkg_config --cflags pixman-1`
2611 pixman_libs=`$pkg_config --libs pixman-1`
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002612else
2613 if test ! -d ${source_path}/pixman/pixman; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002614 error_exit "pixman not present. Your options:" \
2615 " (1) Preferred: Install the pixman devel package (any recent" \
2616 " distro should have packages as Xorg needs pixman too)." \
2617 " (2) Fetch the pixman submodule, using:" \
2618 " git submodule update --init pixman"
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002619 fi
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01002620 mkdir -p pixman/pixman
2621 pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
2622 pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002623fi
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002624
2625##########################################
M. Mohan Kumar17bff522011-12-14 13:58:42 +05302626# libcap probe
2627
2628if test "$cap" != "no" ; then
2629 cat > $TMPC <<EOF
2630#include <stdio.h>
2631#include <sys/capability.h>
Stefan Weilcc939742012-07-18 15:10:20 +01002632int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
M. Mohan Kumar17bff522011-12-14 13:58:42 +05302633EOF
2634 if compile_prog "" "-lcap" ; then
2635 cap=yes
2636 else
2637 cap=no
2638 fi
2639fi
2640
2641##########################################
aliguorie5d355d2009-04-24 18:03:15 +00002642# pthread probe
Brad4b29ec42011-08-07 20:02:11 -04002643PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00002644
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02002645pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00002646cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00002647#include <pthread.h>
Stefan Weil7a42bbe2011-12-17 09:27:32 +01002648static void *f(void *p) { return NULL; }
2649int main(void) {
2650 pthread_t thread;
2651 pthread_create(&thread, 0, f, 0);
2652 return 0;
2653}
blueswir1414f0da2008-08-15 18:20:52 +00002654EOF
Andreas Färberbd00d532010-09-20 00:50:44 +02002655if compile_prog "" "" ; then
2656 pthread=yes
2657else
2658 for pthread_lib in $PTHREADLIBS_LIST; do
2659 if compile_prog "" "$pthread_lib" ; then
2660 pthread=yes
Peter Portantee3c56762012-04-20 10:36:12 -04002661 found=no
2662 for lib_entry in $LIBS; do
2663 if test "$lib_entry" = "$pthread_lib"; then
2664 found=yes
2665 break
2666 fi
2667 done
2668 if test "$found" = "no"; then
2669 LIBS="$pthread_lib $LIBS"
2670 fi
Andreas Färberbd00d532010-09-20 00:50:44 +02002671 break
2672 fi
2673 done
2674fi
blueswir1414f0da2008-08-15 18:20:52 +00002675
Anthony Liguori4617e592009-08-25 17:21:56 -05002676if test "$mingw32" != yes -a "$pthread" = no; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002677 error_exit "pthread check failed" \
2678 "Make sure to have the pthread libs and headers installed."
aliguorie5d355d2009-04-24 18:03:15 +00002679fi
2680
aliguoribf9298b2008-12-05 20:05:26 +00002681##########################################
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002682# rbd probe
2683if test "$rbd" != "no" ; then
2684 cat > $TMPC <<EOF
2685#include <stdio.h>
Josh Durginad32e9c2011-05-26 16:07:31 -07002686#include <rbd/librbd.h>
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002687int main(void) {
Josh Durginad32e9c2011-05-26 16:07:31 -07002688 rados_t cluster;
2689 rados_create(&cluster, NULL);
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002690 return 0;
2691}
2692EOF
Josh Durginad32e9c2011-05-26 16:07:31 -07002693 rbd_libs="-lrbd -lrados"
2694 if compile_prog "" "$rbd_libs" ; then
2695 rbd=yes
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002696 else
2697 if test "$rbd" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002698 feature_not_found "rados block device" "Install librbd/ceph devel"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002699 fi
2700 rbd=no
2701 fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002702fi
2703
2704##########################################
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002705# libssh2 probe
Richard W.M. Jones4fc16832013-04-19 09:16:39 +01002706min_libssh2_version=1.2.8
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002707if test "$libssh2" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002708 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002709 libssh2_cflags=`$pkg_config libssh2 --cflags`
2710 libssh2_libs=`$pkg_config libssh2 --libs`
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002711 libssh2=yes
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002712 else
2713 if test "$libssh2" = "yes" ; then
Richard W.M. Jones4fc16832013-04-19 09:16:39 +01002714 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002715 fi
2716 libssh2=no
2717 fi
2718fi
2719
2720##########################################
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01002721# libssh2_sftp_fsync probe
2722
2723if test "$libssh2" = "yes"; then
2724 cat > $TMPC <<EOF
2725#include <stdio.h>
2726#include <libssh2.h>
2727#include <libssh2_sftp.h>
2728int main(void) {
2729 LIBSSH2_SESSION *session;
2730 LIBSSH2_SFTP *sftp;
2731 LIBSSH2_SFTP_HANDLE *sftp_handle;
2732 session = libssh2_session_init ();
2733 sftp = libssh2_sftp_init (session);
2734 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
2735 libssh2_sftp_fsync (sftp_handle);
2736 return 0;
2737}
2738EOF
2739 # libssh2_cflags/libssh2_libs defined in previous test.
2740 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
2741 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
2742 fi
2743fi
2744
2745##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002746# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002747
2748if test "$linux_aio" != "no" ; then
2749 cat > $TMPC <<EOF
2750#include <libaio.h>
2751#include <sys/eventfd.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002752#include <stddef.h>
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002753int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2754EOF
2755 if compile_prog "" "-laio" ; then
2756 linux_aio=yes
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002757 else
2758 if test "$linux_aio" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002759 feature_not_found "linux AIO" "Install libaio devel"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002760 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03002761 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002762 fi
2763fi
2764
2765##########################################
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01002766# TPM passthrough is only on x86 Linux
2767
2768if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
2769 tpm_passthrough=$tpm
2770else
2771 tpm_passthrough=no
2772fi
2773
2774##########################################
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01002775# adjust virtio-blk-data-plane based on linux-aio
2776
2777if test "$virtio_blk_data_plane" = "yes" -a \
2778 "$linux_aio" != "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002779 error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01002780elif test -z "$virtio_blk_data_plane" ; then
2781 virtio_blk_data_plane=$linux_aio
2782fi
2783
2784##########################################
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002785# attr probe
2786
2787if test "$attr" != "no" ; then
2788 cat > $TMPC <<EOF
2789#include <stdio.h>
2790#include <sys/types.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002791#ifdef CONFIG_LIBATTR
2792#include <attr/xattr.h>
2793#else
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002794#include <sys/xattr.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002795#endif
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002796int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2797EOF
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002798 if compile_prog "" "" ; then
2799 attr=yes
2800 # Older distros have <attr/xattr.h>, and need -lattr:
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002801 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002802 attr=yes
2803 LIBS="-lattr $LIBS"
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002804 libattr=yes
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002805 else
2806 if test "$attr" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002807 feature_not_found "ATTR" "Install libc6 or libattr devel"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002808 fi
2809 attr=no
2810 fi
2811fi
2812
2813##########################################
aliguoribf9298b2008-12-05 20:05:26 +00002814# iovec probe
2815cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00002816#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00002817#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00002818#include <unistd.h>
Stefan Weilf91f9be2011-12-17 09:27:33 +01002819int main(void) { return sizeof(struct iovec); }
aliguoribf9298b2008-12-05 20:05:26 +00002820EOF
2821iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002822if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00002823 iovec=yes
2824fi
2825
aurel32f652e6a2008-12-16 10:43:48 +00002826##########################################
aliguoriceb42de2009-04-07 18:43:28 +00002827# preadv probe
2828cat > $TMPC <<EOF
2829#include <sys/types.h>
2830#include <sys/uio.h>
2831#include <unistd.h>
Blue Swirlc075a722012-08-09 20:21:25 +00002832int main(void) { return preadv(0, 0, 0, 0); }
aliguoriceb42de2009-04-07 18:43:28 +00002833EOF
2834preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002835if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00002836 preadv=yes
2837fi
2838
2839##########################################
aurel32f652e6a2008-12-16 10:43:48 +00002840# fdt probe
Peter Maydelle169e1e2013-05-24 16:26:54 +01002841# fdt support is mandatory for at least some target architectures,
2842# so insist on it if we're building those system emulators.
2843fdt_required=no
2844for target in $target_list; do
2845 case $target in
Alexander Graf6a49fa92013-09-03 20:12:22 +01002846 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
Peter Maydelle169e1e2013-05-24 16:26:54 +01002847 fdt_required=yes
2848 ;;
2849 esac
2850done
2851
2852if test "$fdt_required" = "yes"; then
2853 if test "$fdt" = "no"; then
2854 error_exit "fdt disabled but some requested targets require it." \
2855 "You can turn off fdt only if you also disable all the system emulation" \
2856 "targets which need it (by specifying a cut down --target-list)."
2857 fi
2858 fdt=yes
2859fi
2860
Juan Quintela2df87df2009-08-12 18:29:54 +02002861if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02002862 fdt_libs="-lfdt"
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10002863 # explicitly check for libfdt_env.h as it is missing in some stable installs
Juan Quintelab41af4b2009-07-27 16:13:20 +02002864 cat > $TMPC << EOF
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10002865#include <libfdt_env.h>
aurel32f652e6a2008-12-16 10:43:48 +00002866int main(void) { return 0; }
2867EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002868 if compile_prog "" "$fdt_libs" ; then
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002869 # system DTC is good - use it
aurel32f652e6a2008-12-16 10:43:48 +00002870 fdt=yes
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002871 elif test -d ${source_path}/dtc/libfdt ; then
2872 # have submodule DTC - use it
2873 fdt=yes
2874 dtc_internal="yes"
2875 mkdir -p dtc
2876 if [ "$source_path" != `pwd` ] ; then
2877 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
2878 symlink "$source_path/dtc/scripts" "dtc/scripts"
Juan Quintela2df87df2009-08-12 18:29:54 +02002879 fi
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002880 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
2881 fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
2882 elif test "$fdt" = "yes" ; then
2883 # have neither and want - prompt for system/submodule install
Stewart Smith3f281822014-01-24 12:39:06 +11002884 error_exit "DTC (libfdt) not present. Your options:" \
2885 " (1) Preferred: Install the DTC (libfdt) devel package" \
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002886 " (2) Fetch the DTC submodule, using:" \
2887 " git submodule update --init dtc"
2888 else
2889 # don't have and don't want
Michael Wallede3a3542011-04-26 00:24:07 +02002890 fdt_libs=
Juan Quintela2df87df2009-08-12 18:29:54 +02002891 fdt=no
aurel32f652e6a2008-12-16 10:43:48 +00002892 fi
2893fi
2894
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002895libs_softmmu="$libs_softmmu $fdt_libs"
2896
Michael Walle20ff0752011-03-07 23:32:39 +01002897##########################################
Michael Walleb1e5fff2013-03-06 20:23:32 +01002898# GLX probe, used by milkymist-tmu2
2899if test "$glx" != "no" ; then
2900 glx_libs="-lGL -lX11"
Michael Walle20ff0752011-03-07 23:32:39 +01002901 cat > $TMPC << EOF
2902#include <X11/Xlib.h>
2903#include <GL/gl.h>
2904#include <GL/glx.h>
Michael Walled3fcbb12013-03-06 20:16:58 +01002905int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
Michael Walle20ff0752011-03-07 23:32:39 +01002906EOF
Michael Walled3fcbb12013-03-06 20:16:58 +01002907 if compile_prog "" "-lGL -lX11" ; then
Michael Walleb1e5fff2013-03-06 20:23:32 +01002908 glx=yes
Michael Walle20ff0752011-03-07 23:32:39 +01002909 else
Michael Walleb1e5fff2013-03-06 20:23:32 +01002910 if test "$glx" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002911 feature_not_found "glx" "Install GL devel (e.g. MESA)"
Michael Walle20ff0752011-03-07 23:32:39 +01002912 fi
Michael Walleb1e5fff2013-03-06 20:23:32 +01002913 glx_libs=
2914 glx=no
Michael Walle20ff0752011-03-07 23:32:39 +01002915 fi
2916fi
2917
Bharata B Raoeb100392012-09-24 14:42:45 +05302918##########################################
2919# glusterfs probe
2920if test "$glusterfs" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002921 if $pkg_config --atleast-version=3 glusterfs-api; then
Bharata B Raoe01bee02013-07-16 21:47:41 +05302922 glusterfs="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02002923 glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
2924 glusterfs_libs=`$pkg_config --libs glusterfs-api`
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002925 if $pkg_config --atleast-version=5 glusterfs-api; then
Bharata B Rao0c14fb42013-07-16 21:47:42 +05302926 glusterfs_discard="yes"
2927 fi
Bharata B Rao7c815372013-12-21 14:51:25 +05302928 if $pkg_config --atleast-version=6 glusterfs-api; then
2929 glusterfs_zerofill="yes"
2930 fi
Bharata B Raoeb100392012-09-24 14:42:45 +05302931 else
2932 if test "$glusterfs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002933 feature_not_found "GlusterFS backend support" "Install glusterfs-api devel"
Bharata B Raoeb100392012-09-24 14:42:45 +05302934 fi
Bharata B Raoe01bee02013-07-16 21:47:41 +05302935 glusterfs="no"
Bharata B Raoeb100392012-09-24 14:42:45 +05302936 fi
2937fi
2938
aurel3239386ac2009-04-15 19:48:17 +00002939# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00002940# emulator. This is done because older glibc versions don't
2941# have syscall stubs for these implemented. In that case we
2942# don't provide them even if kernel supports them.
2943#
2944inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03002945cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00002946#include <sys/inotify.h>
2947
2948int
2949main(void)
2950{
2951 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00002952 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00002953}
2954EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002955if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03002956 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00002957fi
2958
Riku Voipioc05c7a72010-03-26 15:25:11 +00002959inotify1=no
2960cat > $TMPC << EOF
2961#include <sys/inotify.h>
2962
2963int
2964main(void)
2965{
2966 /* try to start inotify */
2967 return inotify_init1(0);
2968}
2969EOF
2970if compile_prog "" "" ; then
2971 inotify1=yes
2972fi
2973
Riku Voipioebc996f2009-04-21 15:01:51 +03002974# check if utimensat and futimens are supported
2975utimens=no
2976cat > $TMPC << EOF
2977#define _ATFILE_SOURCE
Riku Voipioebc996f2009-04-21 15:01:51 +03002978#include <stddef.h>
2979#include <fcntl.h>
Peter Maydell3014ee02012-07-18 15:10:26 +01002980#include <sys/stat.h>
Riku Voipioebc996f2009-04-21 15:01:51 +03002981
2982int main(void)
2983{
2984 utimensat(AT_FDCWD, "foo", NULL, 0);
2985 futimens(0, NULL);
2986 return 0;
2987}
2988EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002989if compile_prog "" "" ; then
Riku Voipioebc996f2009-04-21 15:01:51 +03002990 utimens=yes
2991fi
2992
Riku Voipio099d6b02009-05-05 12:10:04 +03002993# check if pipe2 is there
2994pipe2=no
2995cat > $TMPC << EOF
Riku Voipio099d6b02009-05-05 12:10:04 +03002996#include <unistd.h>
2997#include <fcntl.h>
2998
2999int main(void)
3000{
3001 int pipefd[2];
Bruce Rogers9bca8162012-08-20 12:45:08 -06003002 return pipe2(pipefd, O_CLOEXEC);
Riku Voipio099d6b02009-05-05 12:10:04 +03003003}
3004EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003005if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03003006 pipe2=yes
3007fi
3008
Kevin Wolf40ff6d72009-12-02 12:24:42 +01003009# check if accept4 is there
3010accept4=no
3011cat > $TMPC << EOF
Kevin Wolf40ff6d72009-12-02 12:24:42 +01003012#include <sys/socket.h>
3013#include <stddef.h>
3014
3015int main(void)
3016{
3017 accept4(0, NULL, NULL, SOCK_CLOEXEC);
3018 return 0;
3019}
3020EOF
3021if compile_prog "" "" ; then
3022 accept4=yes
3023fi
3024
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303025# check if tee/splice is there. vmsplice was added same time.
3026splice=no
3027cat > $TMPC << EOF
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303028#include <unistd.h>
3029#include <fcntl.h>
3030#include <limits.h>
3031
3032int main(void)
3033{
Stefan Weil66ea0f22011-12-17 09:27:35 +01003034 int len, fd = 0;
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303035 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
3036 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
3037 return 0;
3038}
3039EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003040if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303041 splice=yes
3042fi
3043
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03003044##########################################
3045# signalfd probe
3046signalfd="no"
3047cat > $TMPC << EOF
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03003048#include <unistd.h>
3049#include <sys/syscall.h>
3050#include <signal.h>
3051int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
3052EOF
3053
3054if compile_prog "" "" ; then
3055 signalfd=yes
3056fi
3057
Riku Voipioc2882b92009-08-12 15:08:24 +03003058# check if eventfd is supported
3059eventfd=no
3060cat > $TMPC << EOF
3061#include <sys/eventfd.h>
3062
3063int main(void)
3064{
Stefan Weil55cc7f32011-12-17 09:27:37 +01003065 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
Riku Voipioc2882b92009-08-12 15:08:24 +03003066}
3067EOF
3068if compile_prog "" "" ; then
3069 eventfd=yes
3070fi
3071
Ulrich Hechtd0927932009-09-17 20:22:14 +03003072# check for fallocate
3073fallocate=no
3074cat > $TMPC << EOF
3075#include <fcntl.h>
3076
3077int main(void)
3078{
3079 fallocate(0, 0, 0, 0);
3080 return 0;
3081}
3082EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003083if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03003084 fallocate=yes
3085fi
3086
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01003087# check for fallocate hole punching
3088fallocate_punch_hole=no
3089cat > $TMPC << EOF
3090#include <fcntl.h>
3091#include <linux/falloc.h>
3092
3093int main(void)
3094{
3095 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
3096 return 0;
3097}
3098EOF
3099if compile_prog "" "" ; then
3100 fallocate_punch_hole=yes
3101fi
3102
Peter Maydellc727f472011-01-06 11:05:10 +00003103# check for sync_file_range
3104sync_file_range=no
3105cat > $TMPC << EOF
3106#include <fcntl.h>
3107
3108int main(void)
3109{
3110 sync_file_range(0, 0, 0, 0);
3111 return 0;
3112}
3113EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003114if compile_prog "" "" ; then
Peter Maydellc727f472011-01-06 11:05:10 +00003115 sync_file_range=yes
3116fi
3117
Peter Maydelldace20d2011-01-10 13:11:24 +00003118# check for linux/fiemap.h and FS_IOC_FIEMAP
3119fiemap=no
3120cat > $TMPC << EOF
3121#include <sys/ioctl.h>
3122#include <linux/fs.h>
3123#include <linux/fiemap.h>
3124
3125int main(void)
3126{
3127 ioctl(0, FS_IOC_FIEMAP, 0);
3128 return 0;
3129}
3130EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003131if compile_prog "" "" ; then
Peter Maydelldace20d2011-01-10 13:11:24 +00003132 fiemap=yes
3133fi
3134
Ulrich Hechtd0927932009-09-17 20:22:14 +03003135# check for dup3
3136dup3=no
3137cat > $TMPC << EOF
3138#include <unistd.h>
3139
3140int main(void)
3141{
3142 dup3(0, 0, 0);
3143 return 0;
3144}
3145EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01003146if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03003147 dup3=yes
3148fi
3149
Alex Bligh4e0c6522013-08-21 16:02:43 +01003150# check for ppoll support
3151ppoll=no
3152cat > $TMPC << EOF
3153#include <poll.h>
3154
3155int main(void)
3156{
3157 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
3158 ppoll(&pfd, 1, 0, 0);
3159 return 0;
3160}
3161EOF
3162if compile_prog "" "" ; then
3163 ppoll=yes
3164fi
3165
Alex Blighcd758dd2013-08-21 16:02:44 +01003166# check for prctl(PR_SET_TIMERSLACK , ... ) support
3167prctl_pr_set_timerslack=no
3168cat > $TMPC << EOF
3169#include <sys/prctl.h>
3170
3171int main(void)
3172{
3173 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
3174 return 0;
3175}
3176EOF
3177if compile_prog "" "" ; then
3178 prctl_pr_set_timerslack=yes
3179fi
3180
Peter Maydell3b6edd12011-02-15 18:35:05 +00003181# check for epoll support
3182epoll=no
3183cat > $TMPC << EOF
3184#include <sys/epoll.h>
3185
3186int main(void)
3187{
3188 epoll_create(0);
3189 return 0;
3190}
3191EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003192if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00003193 epoll=yes
3194fi
3195
3196# epoll_create1 and epoll_pwait are later additions
3197# so we must check separately for their presence
3198epoll_create1=no
3199cat > $TMPC << EOF
3200#include <sys/epoll.h>
3201
3202int main(void)
3203{
Peter Maydell19e83f62011-04-26 16:56:40 +01003204 /* Note that we use epoll_create1 as a value, not as
3205 * a function being called. This is necessary so that on
3206 * old SPARC glibc versions where the function was present in
3207 * the library but not declared in the header file we will
3208 * fail the configure check. (Otherwise we will get a compiler
3209 * warning but not an error, and will proceed to fail the
3210 * qemu compile where we compile with -Werror.)
3211 */
Blue Swirlc075a722012-08-09 20:21:25 +00003212 return (int)(uintptr_t)&epoll_create1;
Peter Maydell3b6edd12011-02-15 18:35:05 +00003213}
3214EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003215if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00003216 epoll_create1=yes
3217fi
3218
3219epoll_pwait=no
3220cat > $TMPC << EOF
3221#include <sys/epoll.h>
3222
3223int main(void)
3224{
3225 epoll_pwait(0, 0, 0, 0, 0);
3226 return 0;
3227}
3228EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003229if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00003230 epoll_pwait=yes
3231fi
3232
Peter Maydella8fd1ab2013-02-08 07:31:55 +00003233# check for sendfile support
3234sendfile=no
3235cat > $TMPC << EOF
3236#include <sys/sendfile.h>
3237
3238int main(void)
3239{
3240 return sendfile(0, 0, 0, 0);
3241}
3242EOF
3243if compile_prog "" "" ; then
3244 sendfile=yes
3245fi
3246
pbrookcc8ae6d2006-04-23 17:57:59 +00003247# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02003248if test "$docs" != "no" ; then
Stefan Weil01668d92010-03-04 22:21:02 +01003249 if has makeinfo && has pod2man; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02003250 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02003251 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02003252 if test "$docs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003253 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
Juan Quintela83a3ab82009-08-12 18:29:51 +02003254 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02003255 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02003256 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00003257fi
3258
Stefan Weilf514f412009-10-11 12:44:07 +02003259# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003260byteswap_h=no
3261cat > $TMPC << EOF
3262#include <byteswap.h>
3263int main(void) { return bswap_32(0); }
3264EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003265if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003266 byteswap_h=yes
3267fi
3268
Stefan Weil75f13592013-01-05 12:17:38 +01003269# Search for bswap32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003270bswap_h=no
3271cat > $TMPC << EOF
3272#include <sys/endian.h>
3273#include <sys/types.h>
3274#include <machine/bswap.h>
3275int main(void) { return bswap32(0); }
3276EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003277if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003278 bswap_h=yes
3279fi
3280
aliguorida93a1f2008-12-12 20:02:52 +00003281##########################################
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003282# Do we have libiscsi
Peter Lieven063c3372013-12-05 16:47:17 +01003283# We check for iscsi_write16_sync() to make sure we have a
3284# at least version 1.4.0 of libiscsi.
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003285if test "$libiscsi" != "no" ; then
3286 cat > $TMPC << EOF
Ronnie Sahlbergfa6acb02012-04-24 16:29:04 +10003287#include <stdio.h>
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003288#include <iscsi/iscsi.h>
Peter Lieven063c3372013-12-05 16:47:17 +01003289int 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 +11003290EOF
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003291 if $pkg_config --atleast-version=1.7.0 libiscsi; then
Paolo Bonzini3c33ea92013-02-22 18:14:28 +01003292 libiscsi="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02003293 libiscsi_cflags=$($pkg_config --cflags libiscsi)
3294 libiscsi_libs=$($pkg_config --libs libiscsi)
Paolo Bonzini3c33ea92013-02-22 18:14:28 +01003295 elif compile_prog "" "-liscsi" ; then
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003296 libiscsi="yes"
Fam Zheng6ebc91e2014-02-10 14:48:54 +08003297 libiscsi_libs="-liscsi"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003298 else
3299 if test "$libiscsi" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003300 feature_not_found "libiscsi" "Install libiscsi devel"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003301 fi
3302 libiscsi="no"
3303 fi
3304fi
3305
Stefan Weil219c2522013-12-17 08:57:10 +01003306# We also need to know the API version because there was an
3307# API change from 1.4.0 to 1.5.0.
3308if test "$libiscsi" = "yes"; then
3309 cat >$TMPC <<EOF
3310#include <iscsi/iscsi.h>
3311int main(void)
3312{
3313 iscsi_read10_task(0, 0, 0, 0, 0, 0, 0);
3314 return 0;
3315}
3316EOF
3317 if compile_prog "" "-liscsi"; then
3318 libiscsi_version="1.4.0"
3319 fi
3320fi
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003321
3322##########################################
Natanael Copa8bacde82012-09-12 09:06:51 +00003323# Do we need libm
3324cat > $TMPC << EOF
3325#include <math.h>
3326int main(void) { return isnan(sin(0.0)); }
3327EOF
3328if compile_prog "" "" ; then
3329 :
3330elif compile_prog "" "-lm" ; then
3331 LIBS="-lm $LIBS"
3332 libs_qga="-lm $libs_qga"
3333else
Peter Maydell76ad07a2013-04-08 12:11:26 +01003334 error_exit "libm check failed"
Natanael Copa8bacde82012-09-12 09:06:51 +00003335fi
3336
3337##########################################
aliguorida93a1f2008-12-12 20:02:52 +00003338# Do we need librt
Natanael Copa8bacde82012-09-12 09:06:51 +00003339# uClibc provides 2 versions of clock_gettime(), one with realtime
3340# support and one without. This means that the clock_gettime() don't
3341# need -lrt. We still need it for timer_create() so we check for this
3342# function in addition.
aliguorida93a1f2008-12-12 20:02:52 +00003343cat > $TMPC <<EOF
3344#include <signal.h>
3345#include <time.h>
Natanael Copa8bacde82012-09-12 09:06:51 +00003346int main(void) {
3347 timer_create(CLOCK_REALTIME, NULL, NULL);
3348 return clock_gettime(CLOCK_REALTIME, NULL);
3349}
aliguorida93a1f2008-12-12 20:02:52 +00003350EOF
3351
Juan Quintela52166aa2009-08-03 14:46:03 +02003352if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02003353 :
Natanael Copa8bacde82012-09-12 09:06:51 +00003354# we need pthread for static linking. use previous pthread test result
3355elif compile_prog "" "-lrt $pthread_lib" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02003356 LIBS="-lrt $LIBS"
Natanael Copa8bacde82012-09-12 09:06:51 +00003357 libs_qga="-lrt $libs_qga"
aliguorida93a1f2008-12-12 20:02:52 +00003358fi
3359
Blue Swirl31ff5042009-09-12 12:33:07 +00003360if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
Andreas Färber179cf402010-09-20 00:50:43 +02003361 "$aix" != "yes" -a "$haiku" != "yes" ; then
Juan Quintela6362a532009-08-03 14:46:32 +02003362 libs_softmmu="-lutil $libs_softmmu"
3363fi
3364
Blue Swirlde5071c2009-09-12 09:58:46 +00003365##########################################
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003366# spice probe
3367if test "$spice" != "no" ; then
3368 cat > $TMPC << EOF
3369#include <spice.h>
3370int main(void) { spice_server_new(); return 0; }
3371EOF
Jiri Denemark710fc4f2011-01-24 13:20:29 +01003372 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3373 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003374 if $pkg_config --atleast-version=0.12.0 spice-server && \
3375 $pkg_config --atleast-version=0.12.3 spice-protocol && \
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003376 compile_prog "$spice_cflags" "$spice_libs" ; then
3377 spice="yes"
3378 libs_softmmu="$libs_softmmu $spice_libs"
3379 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
Alon Levy2e0e3c32012-08-22 11:16:26 +03003380 spice_protocol_version=$($pkg_config --modversion spice-protocol)
3381 spice_server_version=$($pkg_config --modversion spice-server)
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003382 else
3383 if test "$spice" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003384 feature_not_found "spice" "Install spice-server and spice-protocol devel"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003385 fi
3386 spice="no"
3387 fi
3388fi
3389
Robert Relyea111a38b2010-11-28 16:36:38 +02003390# check for libcacard for smartcard support
Paolo Bonziniafd347a2012-12-20 20:39:36 +01003391smartcard_cflags=""
3392# TODO - what's the minimal nss version we support?
3393if test "$smartcard_nss" != "no"; then
3394 cat > $TMPC << EOF
Sergei Trofimovich5f01e062012-01-31 22:03:58 +03003395#include <pk11pub.h>
3396int main(void) { PK11_FreeSlot(0); return 0; }
3397EOF
Paolo Bonziniafd347a2012-12-20 20:39:36 +01003398 smartcard_includes="-I\$(SRC_PATH)/libcacard"
3399 libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
3400 libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
3401 test_cflags="$libcacard_cflags"
3402 # The header files in nss < 3.13.3 have a bug which causes them to
3403 # emit a warning. If we're going to compile QEMU with -Werror, then
3404 # test that the headers don't have this bug. Otherwise we would pass
3405 # the configure test but fail to compile QEMU later.
3406 if test "$werror" = "yes"; then
3407 test_cflags="-Werror $test_cflags"
Robert Relyea111a38b2010-11-28 16:36:38 +02003408 fi
Paolo Bonzinib6fc6752012-12-20 20:40:35 +01003409 if test -n "$libtool" &&
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003410 $pkg_config --atleast-version=3.12.8 nss && \
Paolo Bonziniafd347a2012-12-20 20:39:36 +01003411 compile_prog "$test_cflags" "$libcacard_libs"; then
3412 smartcard_nss="yes"
3413 QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
3414 QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
3415 libs_softmmu="$libcacard_libs $libs_softmmu"
3416 else
3417 if test "$smartcard_nss" = "yes"; then
3418 feature_not_found "nss"
3419 fi
3420 smartcard_nss="no"
3421 fi
Robert Relyea111a38b2010-11-28 16:36:38 +02003422fi
3423
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003424# check for libusb
3425if test "$libusb" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003426 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003427 libusb="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02003428 libusb_cflags=$($pkg_config --cflags libusb-1.0)
3429 libusb_libs=$($pkg_config --libs libusb-1.0)
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003430 QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
3431 libs_softmmu="$libs_softmmu $libusb_libs"
3432 else
3433 if test "$libusb" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11003434 feature_not_found "libusb" "Install libusb devel"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003435 fi
3436 libusb="no"
3437 fi
3438fi
3439
Hans de Goede69354a82011-07-19 11:04:10 +02003440# check for usbredirparser for usb network redirection support
3441if test "$usb_redir" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003442 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
Hans de Goede69354a82011-07-19 11:04:10 +02003443 usb_redir="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02003444 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3445 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
Hans de Goede69354a82011-07-19 11:04:10 +02003446 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
Aurelien Jarno56ab2ad2012-09-11 20:57:58 +02003447 libs_softmmu="$libs_softmmu $usb_redir_libs"
Hans de Goede69354a82011-07-19 11:04:10 +02003448 else
3449 if test "$usb_redir" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11003450 feature_not_found "usb-redir" "Install usbredir devel"
Hans de Goede69354a82011-07-19 11:04:10 +02003451 fi
3452 usb_redir="no"
3453 fi
3454fi
3455
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003456##########################################
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04003457# check if we have VSS SDK headers for win
3458
3459if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3460 case "$vss_win32_sdk" in
3461 "") vss_win32_include="-I$source_path" ;;
3462 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3463 # handle path with spaces. So we symlink the headers into ".sdk/vss".
3464 vss_win32_include="-I$source_path/.sdk/vss"
3465 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3466 ;;
3467 *) vss_win32_include="-I$vss_win32_sdk"
3468 esac
3469 cat > $TMPC << EOF
3470#define __MIDL_user_allocate_free_DEFINED__
3471#include <inc/win2003/vss.h>
3472int main(void) { return VSS_CTX_BACKUP; }
3473EOF
3474 if compile_prog "$vss_win32_include" "" ; then
3475 guest_agent_with_vss="yes"
3476 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3477 libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3478 else
3479 if test "$vss_win32_sdk" != "" ; then
3480 echo "ERROR: Please download and install Microsoft VSS SDK:"
3481 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3482 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3483 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
3484 echo "ERROR: The headers are extracted in the directory \`inc'."
3485 feature_not_found "VSS support"
3486 fi
3487 guest_agent_with_vss="no"
3488 fi
3489fi
3490
3491##########################################
3492# lookup Windows platform SDK (if not specified)
3493# The SDK is needed only to build .tlb (type library) file of guest agent
3494# VSS provider from the source. It is usually unnecessary because the
3495# pre-compiled .tlb file is included.
3496
3497if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3498 if test -z "$win_sdk"; then
3499 programfiles="$PROGRAMFILES"
3500 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3501 if test -n "$programfiles"; then
3502 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3503 else
3504 feature_not_found "Windows SDK"
3505 fi
3506 elif test "$win_sdk" = "no"; then
3507 win_sdk=""
3508 fi
3509fi
3510
3511##########################################
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003512
Blue Swirl747bbdf2009-10-18 16:26:06 +00003513##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00003514# check if we have fdatasync
3515
3516fdatasync=no
3517cat > $TMPC << EOF
3518#include <unistd.h>
Alexandre Raymondd1722a22011-05-29 18:22:48 -04003519int main(void) {
3520#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3521return fdatasync(0);
3522#else
Stefan Weile172fe12012-04-06 21:33:20 +02003523#error Not supported
Alexandre Raymondd1722a22011-05-29 18:22:48 -04003524#endif
3525}
Blue Swirl5f6b9e82009-09-20 06:56:26 +00003526EOF
3527if compile_prog "" "" ; then
3528 fdatasync=yes
3529fi
3530
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003531##########################################
Andreas Färbere78815a2010-09-25 11:26:05 +00003532# check if we have madvise
3533
3534madvise=no
3535cat > $TMPC << EOF
3536#include <sys/types.h>
3537#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003538#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00003539int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3540EOF
3541if compile_prog "" "" ; then
3542 madvise=yes
3543fi
3544
3545##########################################
3546# check if we have posix_madvise
3547
3548posix_madvise=no
3549cat > $TMPC << EOF
3550#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003551#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00003552int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3553EOF
3554if compile_prog "" "" ; then
3555 posix_madvise=yes
3556fi
3557
3558##########################################
Richard Henderson1e9737d2012-10-23 07:33:00 +10003559# check if we have usable SIGEV_THREAD_ID
3560
3561sigev_thread_id=no
3562cat > $TMPC << EOF
3563#include <signal.h>
3564int main(void) {
3565 struct sigevent ev;
3566 ev.sigev_notify = SIGEV_THREAD_ID;
3567 ev._sigev_un._tid = 0;
3568 asm volatile("" : : "g"(&ev));
3569 return 0;
3570}
3571EOF
3572if compile_prog "" "" ; then
3573 sigev_thread_id=yes
3574fi
3575
3576##########################################
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003577# check if trace backend exists
3578
Lluís Vilanova650ab982012-04-03 20:47:39 +02003579$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003580if test "$?" -ne 0 ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003581 error_exit "invalid trace backend" \
3582 "Please choose a supported trace backend."
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003583fi
3584
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003585##########################################
3586# For 'ust' backend, test if ust headers are present
3587if test "$trace_backend" = "ust"; then
3588 cat > $TMPC << EOF
Mohamad Gebaibf15f632014-01-29 22:47:54 -05003589#include <lttng/tracepoint.h>
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003590int main(void) { return 0; }
3591EOF
3592 if compile_prog "" "" ; then
Mohamad Gebaibf15f632014-01-29 22:47:54 -05003593 if $pkg_config lttng-ust --exists; then
3594 lttng_ust_libs=`$pkg_config --libs lttng-ust`
3595 else
3596 lttng_ust_libs="-llttng-ust"
3597 fi
3598 if $pkg_config liburcu-bp --exists; then
3599 urcu_bp_libs=`$pkg_config --libs liburcu-bp`
3600 else
3601 urcu_bp_libs="-lurcu-bp"
3602 fi
3603
3604 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
3605 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003606 else
Mohamad Gebaibf15f632014-01-29 22:47:54 -05003607 error_exit "Trace backend 'ust' missing lttng-ust header files"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003608 fi
3609fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00003610
3611##########################################
3612# For 'dtrace' backend, test if 'dtrace' command is present
3613if test "$trace_backend" = "dtrace"; then
3614 if ! has 'dtrace' ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003615 error_exit "dtrace command is not found in PATH $PATH"
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00003616 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00003617 trace_backend_stap="no"
3618 if has 'stap' ; then
3619 trace_backend_stap="yes"
3620 fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00003621fi
3622
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003623##########################################
Alex Barcelo519175a2012-02-28 12:25:50 +01003624# check and set a backend for coroutine
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303625
Peter Maydell7c2acc72013-04-08 12:11:27 +01003626# We prefer ucontext, but it's not always possible. The fallback
3627# is sigcontext. gthread is not selectable except explicitly, because
3628# it is not functional enough to run QEMU proper. (It is occasionally
3629# useful for debugging purposes.) On Windows the only valid backend
3630# is the Windows-specific one.
3631
3632ucontext_works=no
3633if test "$darwin" != "yes"; then
3634 cat > $TMPC << EOF
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303635#include <ucontext.h>
Peter Maydellcdf84802012-02-23 16:20:05 +00003636#ifdef __stub_makecontext
3637#error Ignoring glibc stub makecontext which will always fail
3638#endif
Stefan Weil75cafad2011-12-17 09:27:29 +01003639int main(void) { makecontext(0, 0, 0); return 0; }
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303640EOF
Peter Maydell7c2acc72013-04-08 12:11:27 +01003641 if compile_prog "" "" ; then
3642 ucontext_works=yes
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303643 fi
Peter Maydell7c2acc72013-04-08 12:11:27 +01003644fi
3645
3646if test "$coroutine" = ""; then
3647 if test "$mingw32" = "yes"; then
3648 coroutine=win32
3649 elif test "$ucontext_works" = "yes"; then
3650 coroutine=ucontext
3651 else
3652 coroutine=sigaltstack
3653 fi
Alex Barcelo519175a2012-02-28 12:25:50 +01003654else
Peter Maydell7c2acc72013-04-08 12:11:27 +01003655 case $coroutine in
3656 windows)
3657 if test "$mingw32" != "yes"; then
3658 error_exit "'windows' coroutine backend only valid for Windows"
3659 fi
3660 # Unfortunately the user visible backend name doesn't match the
3661 # coroutine-*.c filename for this case, so we have to adjust it here.
3662 coroutine=win32
3663 ;;
3664 ucontext)
3665 if test "$ucontext_works" != "yes"; then
3666 feature_not_found "ucontext"
3667 fi
3668 ;;
3669 gthread|sigaltstack)
3670 if test "$mingw32" = "yes"; then
3671 error_exit "only the 'windows' coroutine backend is valid for Windows"
3672 fi
3673 ;;
3674 *)
3675 error_exit "unknown coroutine backend $coroutine"
3676 ;;
3677 esac
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303678fi
3679
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02003680if test "$coroutine_pool" = ""; then
3681 if test "$coroutine" = "gthread"; then
3682 coroutine_pool=no
3683 else
3684 coroutine_pool=yes
3685 fi
3686fi
3687if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
3688 error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
3689fi
3690
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303691##########################################
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303692# check if we have open_by_handle_at
3693
Stefan Weil4e1797f2012-06-18 22:11:06 +02003694open_by_handle_at=no
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303695cat > $TMPC << EOF
3696#include <fcntl.h>
Stefan Weilacc55ba2012-06-06 19:35:57 +00003697#if !defined(AT_EMPTY_PATH)
3698# error missing definition
3699#else
Stefan Weil75cafad2011-12-17 09:27:29 +01003700int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
Stefan Weilacc55ba2012-06-06 19:35:57 +00003701#endif
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303702EOF
3703if compile_prog "" "" ; then
3704 open_by_handle_at=yes
3705fi
3706
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05303707########################################
3708# check if we have linux/magic.h
3709
3710linux_magic_h=no
3711cat > $TMPC << EOF
3712#include <linux/magic.h>
3713int main(void) {
Stefan Weil75cafad2011-12-17 09:27:29 +01003714 return 0;
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05303715}
3716EOF
3717if compile_prog "" "" ; then
3718 linux_magic_h=yes
3719fi
3720
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03003721########################################
Kevin Wolfc95e3082013-02-22 21:08:51 +01003722# check whether we can disable warning option with a pragma (this is needed
3723# to silence warnings in the headers of some versions of external libraries).
3724# This test has to be compiled with -Werror as otherwise an unknown pragma is
3725# only a warning.
3726#
3727# If we can't selectively disable warning in the code, disable -Werror so that
3728# the build doesn't fail anyway.
3729
Peter Maydell06d71fa2012-07-30 16:13:07 +01003730pragma_disable_unused_but_set=no
3731cat > $TMPC << EOF
Markus Armbrustere6f53fd2013-04-16 13:51:06 +02003732#pragma GCC diagnostic push
Peter Maydell06d71fa2012-07-30 16:13:07 +01003733#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
Kevin Wolfc95e3082013-02-22 21:08:51 +01003734#pragma GCC diagnostic ignored "-Wstrict-prototypes"
Markus Armbrustere6f53fd2013-04-16 13:51:06 +02003735#pragma GCC diagnostic pop
Kevin Wolfc95e3082013-02-22 21:08:51 +01003736
Peter Maydell06d71fa2012-07-30 16:13:07 +01003737int main(void) {
3738 return 0;
3739}
3740EOF
3741if compile_prog "-Werror" "" ; then
Gerd Hoffmanncc6e3ca2013-01-09 10:17:07 +01003742 pragma_diagnostic_available=yes
Kevin Wolfc95e3082013-02-22 21:08:51 +01003743else
3744 werror=no
Peter Maydell06d71fa2012-07-30 16:13:07 +01003745fi
3746
3747########################################
Christian Borntraeger62fe8332012-08-10 15:11:45 +02003748# check if we have valgrind/valgrind.h and valgrind/memcheck.h
Kevin Wolf3f4349d2012-06-29 13:40:27 +02003749
3750valgrind_h=no
3751cat > $TMPC << EOF
3752#include <valgrind/valgrind.h>
Christian Borntraeger62fe8332012-08-10 15:11:45 +02003753#include <valgrind/memcheck.h>
Kevin Wolf3f4349d2012-06-29 13:40:27 +02003754int main(void) {
Kevin Wolf3f4349d2012-06-29 13:40:27 +02003755 return 0;
3756}
3757EOF
3758if compile_prog "" "" ; then
3759 valgrind_h=yes
3760fi
3761
3762########################################
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03003763# check if environ is declared
3764
3765has_environ=no
3766cat > $TMPC << EOF
3767#include <unistd.h>
3768int main(void) {
Blue Swirlc075a722012-08-09 20:21:25 +00003769 environ = 0;
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03003770 return 0;
3771}
3772EOF
3773if compile_prog "" "" ; then
3774 has_environ=yes
3775fi
3776
Richard Henderson76a347e2012-12-28 14:17:02 -08003777########################################
3778# check if cpuid.h is usable.
3779
3780cpuid_h=no
3781cat > $TMPC << EOF
3782#include <cpuid.h>
3783int main(void) {
Peter Maydell774d5662014-02-20 19:42:53 +00003784 unsigned a, b, c, d;
3785 int max = __get_cpuid_max(0, 0);
3786
3787 if (max >= 1) {
3788 __cpuid(1, a, b, c, d);
3789 }
3790
3791 if (max >= 7) {
3792 __cpuid_count(7, 0, a, b, c, d);
3793 }
3794
3795 return 0;
Richard Henderson76a347e2012-12-28 14:17:02 -08003796}
3797EOF
3798if compile_prog "" "" ; then
3799 cpuid_h=yes
3800fi
3801
Richard Hendersonf5401662013-02-16 12:46:59 -08003802########################################
3803# check if __[u]int128_t is usable.
3804
3805int128=no
3806cat > $TMPC << EOF
3807__int128_t a;
3808__uint128_t b;
3809int main (void) {
3810 a = a + b;
3811 b = a * b;
Peter Maydell464e3672013-06-21 14:01:31 +01003812 a = a * a;
Richard Hendersonf5401662013-02-16 12:46:59 -08003813 return 0;
3814}
3815EOF
3816if compile_prog "" "" ; then
3817 int128=yes
3818fi
Richard Henderson76a347e2012-12-28 14:17:02 -08003819
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08003820########################################
3821# check if getauxval is available.
3822
3823getauxval=no
3824cat > $TMPC << EOF
3825#include <sys/auxv.h>
3826int main(void) {
3827 return getauxval(AT_HWCAP) == 0;
3828}
3829EOF
3830if compile_prog "" "" ; then
3831 getauxval=yes
3832fi
3833
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303834##########################################
Juan Quintelae86ecd42009-08-03 14:45:59 +02003835# End of CC checks
3836# After here, no more $cc or $ld runs
3837
Blue Swirl1d728c32012-05-01 18:45:39 +00003838if test "$gcov" = "yes" ; then
3839 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
3840 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
3841elif test "$debug" = "no" ; then
Michal Privoznike600cdf2013-09-05 12:54:49 +02003842 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02003843fi
Juan Quintelaa316e372009-09-30 01:10:55 +02003844
Peter Lieven6542aa92014-02-03 10:26:13 +01003845##########################################
3846# Do we have libnfs
3847if test "$libnfs" != "no" ; then
3848 if $pkg_config --atleast-version=1.9.2 libnfs; then
3849 libnfs="yes"
3850 libnfs_libs=$($pkg_config --libs libnfs)
3851 LIBS="$LIBS $libnfs_libs"
3852 else
3853 if test "$libnfs" = "yes" ; then
3854 feature_not_found "libnfs"
3855 fi
3856 libnfs="no"
3857 fi
3858fi
Blue Swirl1d728c32012-05-01 18:45:39 +00003859
Anthony Liguori20ff6c82009-12-09 12:59:36 -06003860# Disable zero malloc errors for official releases unless explicitly told to
3861# enable/disable
3862if test -z "$zero_malloc" ; then
3863 if test "$z_version" = "50" ; then
3864 zero_malloc="no"
3865 else
3866 zero_malloc="yes"
3867 fi
3868fi
3869
Peter Maydell6ca026c2012-07-18 15:10:18 +01003870# Now we've finished running tests it's OK to add -Werror to the compiler flags
3871if test "$werror" = "yes"; then
3872 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
3873fi
3874
Juan Quintelae86ecd42009-08-03 14:45:59 +02003875if test "$solaris" = "no" ; then
3876 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02003877 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02003878 fi
3879fi
3880
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02003881# test if pod2man has --utf8 option
3882if pod2man --help | grep -q utf8; then
3883 POD2MAN="pod2man --utf8"
3884else
3885 POD2MAN="pod2man"
3886fi
3887
Blue Swirl952afb72010-09-19 08:36:34 +00003888# Use ASLR, no-SEH and DEP if available
3889if test "$mingw32" = "yes" ; then
3890 for flag in --dynamicbase --no-seh --nxcompat; do
3891 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3892 LDFLAGS="-Wl,$flag $LDFLAGS"
3893 fi
3894 done
3895fi
3896
Eduardo Habkost10ea68b2012-04-18 16:55:39 -03003897qemu_confdir=$sysconfdir$confsuffix
Fam Zhenge26110c2014-02-10 14:48:57 +08003898qemu_moddir=$libdir$confsuffix
Eduardo Habkost528ae5b2012-04-18 16:55:49 -03003899qemu_datadir=$datadir$confsuffix
Anthony Liguori834574e2013-02-20 07:43:24 -06003900qemu_localedir="$datadir/locale"
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02003901
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01003902tools=""
3903if test "$want_tools" = "yes" ; then
Paolo Bonzinica35f782010-05-26 16:08:29 +02003904 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01003905 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
3906 tools="qemu-nbd\$(EXESUF) $tools"
3907 fi
3908fi
3909if test "$softmmu" = yes ; then
Meador Inge983eef52012-02-24 14:00:42 +05303910 if test "$virtfs" != no ; then
Andreas Färberaabfd882012-05-01 01:12:02 +02003911 if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3912 virtfs=yes
3913 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3914 else
3915 if test "$virtfs" = yes; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003916 error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
Meador Inge983eef52012-02-24 14:00:42 +05303917 fi
Andreas Färber17500372012-05-01 01:12:03 +02003918 virtfs=no
Andreas Färberaabfd882012-05-01 01:12:02 +02003919 fi
M. Mohan Kumar17bff522011-12-14 13:58:42 +05303920 fi
Michael Tokareve8ef31a2013-07-31 14:22:07 +04003921fi
3922if [ "$guest_agent" != "no" ]; then
Tomoki Sekiyamab39297a2013-08-07 11:40:18 -04003923 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
Michael Roth48ff7a62011-07-20 15:19:37 -05003924 tools="qemu-ga\$(EXESUF) $tools"
Tomoki Sekiyamab39297a2013-08-07 11:40:18 -04003925 if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
3926 tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
3927 fi
Michael Tokareve8ef31a2013-07-31 14:22:07 +04003928 guest_agent=yes
3929 elif [ "$guest_agent" != yes ]; then
3930 guest_agent=no
3931 else
3932 error_exit "Guest agent is not supported on this platform"
Paolo Bonzinica35f782010-05-26 16:08:29 +02003933 fi
Paolo Bonzini00c705f2012-05-29 11:40:24 +02003934fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02003935
3936# Mac OS X ships with a broken assembler
3937roms=
3938if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3939 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3940 "$softmmu" = yes ; then
3941 roms="optionrom"
3942fi
Andreas Färberd0384d12011-05-01 18:23:56 +02003943if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
David Gibson39ac8452011-04-01 15:15:23 +11003944 roms="$roms spapr-rtas"
3945fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02003946
Christian Borntraeger9933c302013-04-23 01:23:03 +00003947if test "$cpu" = "s390x" ; then
3948 roms="$roms s390-ccw"
3949fi
3950
Richard Henderson964c6fa2013-06-21 19:10:16 -07003951# Probe for the need for relocating the user-only binary.
3952if test "$pie" = "no" ; then
3953 textseg_addr=
3954 case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07003955 arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64 | x32)
Richard Henderson964c6fa2013-06-21 19:10:16 -07003956 textseg_addr=0x60000000
3957 ;;
3958 mips)
3959 textseg_addr=0x400000
3960 ;;
3961 esac
3962 if [ -n "$textseg_addr" ]; then
3963 cat > $TMPC <<EOF
3964 int main(void) { return 0; }
3965EOF
3966 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
3967 if ! compile_prog "" "$textseg_ldflags"; then
3968 # In case ld does not support -Ttext-segment, edit the default linker
3969 # script via sed to set the .text start addr. This is needed on FreeBSD
3970 # at least.
3971 $ld --verbose | sed \
3972 -e '1,/==================================================/d' \
3973 -e '/==================================================/,$d' \
3974 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
3975 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
3976 textseg_ldflags="-Wl,-T../config-host.ld"
3977 fi
3978 fi
3979fi
3980
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01003981# add pixman flags after all config tests are done
Peter Crosthwaitea540f152013-04-18 14:47:31 +10003982QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01003983libs_softmmu="$libs_softmmu $pixman_libs"
3984
bellard43ce4df2003-06-09 19:53:12 +00003985echo "Install prefix $prefix"
Eduardo Habkostc00b2802012-04-18 16:55:37 -03003986echo "BIOS directory `eval echo $qemu_datadir`"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02003987echo "binary directory `eval echo $bindir`"
Alon Levy3aa5d2b2011-05-15 12:08:59 +03003988echo "library directory `eval echo $libdir`"
Fam Zhenge26110c2014-02-10 14:48:57 +08003989echo "module directory `eval echo $qemu_moddir`"
Michael Tokarev8bf188a2012-06-07 01:11:00 +04003990echo "libexec directory `eval echo $libexecdir`"
Alon Levy0f94d6d2011-06-27 11:58:20 +02003991echo "include directory `eval echo $includedir`"
Aurelien Jarno1c0fd162010-06-10 00:14:02 +02003992echo "config directory `eval echo $sysconfdir`"
bellard11d9f692004-04-02 20:55:59 +00003993if test "$mingw32" = "no" ; then
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02003994echo "local state directory `eval echo $local_statedir`"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02003995echo "Manual directory `eval echo $mandir`"
bellard43ce4df2003-06-09 19:53:12 +00003996echo "ELF interp prefix $interp_prefix"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02003997else
3998echo "local state directory queried at runtime"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04003999echo "Windows SDK $win_sdk"
bellard11d9f692004-04-02 20:55:59 +00004000fi
bellard5a671352003-10-01 00:13:48 +00004001echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00004002echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00004003echo "Host C compiler $host_cc"
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04004004echo "C++ compiler $cxx"
Peter Maydell3c4a4d02012-08-11 22:34:40 +01004005echo "Objective-C compiler $objcc"
Peter Maydell45d285a2013-10-21 21:03:06 +01004006echo "ARFLAGS $ARFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02004007echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02004008echo "QEMU_CFLAGS $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02004009echo "LDFLAGS $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00004010echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00004011echo "install $install"
Blue Swirlc886edf2011-07-22 21:08:09 +00004012echo "python $python"
Brade2d88302011-09-02 16:53:28 -04004013if test "$slirp" = "yes" ; then
4014 echo "smbd $smbd"
4015fi
Fam Zheng17969262014-02-10 14:48:56 +08004016echo "module support $modules"
bellard43ce4df2003-06-09 19:53:12 +00004017echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00004018echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00004019echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00004020echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00004021echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00004022echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00004023echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00004024echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00004025echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00004026echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00004027if test "$darwin" = "yes" ; then
4028 echo "Cocoa support $cocoa"
4029fi
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02004030echo "pixman $pixman"
bellard97a847b2003-08-10 21:36:04 +00004031echo "SDL support $sdl"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06004032echo "GTK support $gtk"
balrog4d3b6f62008-02-10 16:33:14 +00004033echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02004034echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00004035echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00004036echo "Audio drivers $audio_drv_list"
Fam Zhengb64ec4e2013-05-29 19:35:40 +08004037echo "Block whitelist (rw) $block_drv_rw_whitelist"
4038echo "Block whitelist (ro) $block_drv_ro_whitelist"
Meador Inge983eef52012-02-24 14:00:42 +05304039echo "VirtFS support $virtfs"
Jes Sorensen821601e2011-03-16 13:33:36 +01004040echo "VNC support $vnc"
4041if test "$vnc" = "yes" ; then
4042 echo "VNC TLS support $vnc_tls"
4043 echo "VNC SASL support $vnc_sasl"
4044 echo "VNC JPEG support $vnc_jpeg"
4045 echo "VNC PNG support $vnc_png"
Tim Hardeck7536ee42013-01-21 11:04:44 +01004046 echo "VNC WS support $vnc_ws"
Jes Sorensen821601e2011-03-16 13:33:36 +01004047fi
blueswir131422552007-04-16 18:27:06 +00004048if test -n "$sparc_cpu"; then
4049 echo "Target Sparc Arch $sparc_cpu"
4050fi
aliguorie37630c2009-04-22 15:19:10 +00004051echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00004052echo "brlapi support $brlapi"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02004053echo "bluez support $bluez"
Juan Quintelaa25dba12009-08-12 18:29:52 +02004054echo "Documentation $docs"
pbrookc5937222006-05-14 11:30:38 +00004055[ ! -z "$uname_release" ] && \
4056echo "uname -r $uname_release"
Paul Brook379f6692009-07-17 12:48:08 +01004057echo "GUEST_BASE $guest_base"
Avi Kivity40d64442011-11-15 20:12:17 +02004058echo "PIE $pie"
ths8a16d272008-07-19 09:56:24 +00004059echo "vde support $vde"
Vincenzo Maffione58952132013-11-06 11:44:06 +01004060echo "netmap support $netmap"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004061echo "Linux AIO support $linux_aio"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004062echo "ATTR/XATTR support $attr"
ths77755342008-11-27 15:45:16 +00004063echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02004064echo "KVM support $kvm"
Michael R. Hines2da776d2013-07-22 10:01:54 -04004065echo "RDMA support $rdma"
Stefan Weil9195b2c2011-10-19 07:07:18 +02004066echo "TCG interpreter $tcg_interpreter"
aurel32f652e6a2008-12-16 10:43:48 +00004067echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00004068echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00004069echo "fdatasync $fdatasync"
Andreas Färbere78815a2010-09-25 11:26:05 +00004070echo "madvise $madvise"
4071echo "posix_madvise $posix_madvise"
Richard Henderson1e9737d2012-10-23 07:33:00 +10004072echo "sigev_thread_id $sigev_thread_id"
Stefan Weilee682d22009-10-01 20:10:37 +02004073echo "uuid support $uuid"
Corey Bryant47e98652012-01-26 09:42:26 -05004074echo "libcap-ng support $cap_ng"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02004075echo "vhost-net support $vhost_net"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00004076echo "vhost-scsi support $vhost_scsi"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01004077echo "Trace backend $trace_backend"
Prerna Saxena9410b562010-07-13 09:26:32 +01004078echo "Trace output file $trace_file-<pid>"
Alon Levy2e0e3c32012-08-22 11:16:26 +03004079echo "spice support $spice ($spice_protocol_version/$spice_server_version)"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004080echo "rbd support $rbd"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01004081echo "xfsctl support $xfs"
Robert Relyea111a38b2010-11-28 16:36:38 +02004082echo "nss used $smartcard_nss"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004083echo "libusb $libusb"
Hans de Goede69354a82011-07-19 11:04:10 +02004084echo "usb net redir $usb_redir"
Michael Walleb1e5fff2013-03-06 20:23:32 +01004085echo "GLX support $glx"
Stefan Weil219c2522013-12-17 08:57:10 +01004086if test "$libiscsi_version" = "1.4.0"; then
4087echo "libiscsi support $libiscsi (1.4.0)"
4088else
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004089echo "libiscsi support $libiscsi"
Stefan Weil219c2522013-12-17 08:57:10 +01004090fi
Peter Lieven6542aa92014-02-03 10:26:13 +01004091echo "libnfs support $libnfs"
Michael Rothd138cee2011-08-01 14:52:57 -05004092echo "build guest agent $guest_agent"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004093echo "QGA VSS support $guest_agent_with_vss"
Eduardo Otubof7945732012-08-14 18:44:05 -03004094echo "seccomp support $seccomp"
Peter Maydell7c2acc72013-04-08 12:11:27 +01004095echo "coroutine backend $coroutine"
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02004096echo "coroutine pool $coroutine_pool"
Bharata B Raoeb100392012-09-24 14:42:45 +05304097echo "GlusterFS support $glusterfs"
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01004098echo "virtio-blk-data-plane $virtio_blk_data_plane"
Blue Swirl1d728c32012-05-01 18:45:39 +00004099echo "gcov $gcov_tool"
4100echo "gcov enabled $gcov"
Stefan Bergerab214c22013-02-27 12:47:52 -05004101echo "TPM support $tpm"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004102echo "libssh2 support $libssh2"
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01004103echo "TPM passthrough $tpm_passthrough"
Paolo Bonzini3556c232013-05-10 14:16:40 +02004104echo "QOM debugging $qom_cast_debug"
Jeff Cody4f18b782013-10-30 10:44:39 -04004105echo "vhdx $vhdx"
Benoît Canet95c6bff2014-02-21 22:21:15 +01004106echo "Quorum $quorum"
qiaonuohan607dacd2014-02-18 14:11:30 +08004107echo "lzo support $lzo"
4108echo "snappy support $snappy"
bellard67b915a2004-03-31 23:37:16 +00004109
Stefan Weil1ba16962011-07-29 22:40:45 +02004110if test "$sdl_too_old" = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00004111echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00004112fi
bellard97a847b2003-08-10 21:36:04 +00004113
Juan Quintela98ec69a2009-07-16 18:34:18 +02004114config_host_mak="config-host.mak"
bellard97a847b2003-08-10 21:36:04 +00004115
Stefan Weildbd99ae2013-01-01 18:33:44 +01004116echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
4117
Juan Quintela98ec69a2009-07-16 18:34:18 +02004118echo "# Automatically generated by configure - do not modify" > $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004119echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004120
Paolo Bonzinie6c3b0f2010-10-21 10:18:35 +02004121echo all: >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02004122echo "prefix=$prefix" >> $config_host_mak
4123echo "bindir=$bindir" >> $config_host_mak
Alon Levy3aa5d2b2011-05-15 12:08:59 +03004124echo "libdir=$libdir" >> $config_host_mak
Michael Tokarev8bf188a2012-06-07 01:11:00 +04004125echo "libexecdir=$libexecdir" >> $config_host_mak
Alon Levy0f94d6d2011-06-27 11:58:20 +02004126echo "includedir=$includedir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02004127echo "mandir=$mandir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02004128echo "sysconfdir=$sysconfdir" >> $config_host_mak
Eduardo Habkost22d07032012-04-18 16:55:42 -03004129echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
Eduardo Habkost9afa52c2012-04-18 16:55:46 -03004130echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
4131echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
Fam Zhenge26110c2014-02-10 14:48:57 +08004132echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02004133if test "$mingw32" = "no" ; then
4134 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
4135fi
Michael Tokarevf354b1a2012-10-21 22:52:54 +04004136echo "qemu_helperdir=$libexecdir" >> $config_host_mak
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +01004137echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
4138echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
Anthony Liguori834574e2013-02-20 07:43:24 -06004139echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
Paolo Bonzinif544a482013-04-17 16:26:44 +02004140echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004141
Juan Quintela98ec69a2009-07-16 18:34:18 +02004142echo "ARCH=$ARCH" >> $config_host_mak
Paolo Bonzini727e5282013-04-17 16:26:43 +02004143
aurel32f8393942009-04-13 18:45:38 +00004144if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004145 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00004146fi
aliguori1625af82009-04-05 17:41:02 +00004147if test "$strip_opt" = "yes" ; then
Hollis Blanchard52ba7842010-08-04 17:21:34 -07004148 echo "STRIP=${strip}" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00004149fi
bellard7d132992003-03-06 23:23:54 +00004150if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02004151 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00004152fi
bellard67b915a2004-03-31 23:37:16 +00004153if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004154 echo "CONFIG_WIN32=y" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00004155 rc_version=`cat $source_path/VERSION`
4156 version_major=${rc_version%%.*}
4157 rc_version=${rc_version#*.}
4158 version_minor=${rc_version%%.*}
4159 rc_version=${rc_version#*.}
4160 version_subminor=${rc_version%%.*}
4161 version_micro=0
4162 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
4163 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004164 if test "$guest_agent_with_vss" = "yes" ; then
4165 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
4166 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
4167 fi
pbrook210fa552007-02-27 21:04:49 +00004168else
Juan Quintela35f4df22009-07-27 16:13:07 +02004169 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00004170fi
blueswir1128ab2f2008-08-15 18:33:42 +00004171
Mark McLoughlindffcb712009-10-22 17:49:11 +01004172if test "$linux" = "yes" ; then
4173 echo "CONFIG_LINUX=y" >> $config_host_mak
4174fi
4175
bellard83fb7ad2004-07-05 21:25:26 +00004176if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004177 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00004178fi
malcb29fe3e2008-11-18 01:42:22 +00004179
4180if test "$aix" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004181 echo "CONFIG_AIX=y" >> $config_host_mak
malcb29fe3e2008-11-18 01:42:22 +00004182fi
4183
bellardec530c82006-04-25 22:36:06 +00004184if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004185 echo "CONFIG_SOLARIS=y" >> $config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02004186 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00004187 if test "$needs_libsunmath" = "yes" ; then
Juan Quintela75b5a692009-07-27 16:13:23 +02004188 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00004189 fi
bellardec530c82006-04-25 22:36:06 +00004190fi
Andreas Färber179cf402010-09-20 00:50:43 +02004191if test "$haiku" = "yes" ; then
4192 echo "CONFIG_HAIKU=y" >> $config_host_mak
4193fi
bellard97a847b2003-08-10 21:36:04 +00004194if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004195 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00004196fi
Stefan Weil1ba16962011-07-29 22:40:45 +02004197if test "$profiler" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004198 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00004199fi
bellardc20709a2004-04-21 23:27:19 +00004200if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004201 echo "CONFIG_SLIRP=y" >> $config_host_mak
Brade2d88302011-09-02 16:53:28 -04004202 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
bellardc20709a2004-04-21 23:27:19 +00004203fi
ths8a16d272008-07-19 09:56:24 +00004204if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004205 echo "CONFIG_VDE=y" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00004206fi
Vincenzo Maffione58952132013-11-06 11:44:06 +01004207if test "$netmap" = "yes" ; then
4208 echo "CONFIG_NETMAP=y" >> $config_host_mak
4209fi
Corey Bryant47e98652012-01-26 09:42:26 -05004210if test "$cap_ng" = "yes" ; then
4211 echo "CONFIG_LIBCAP=y" >> $config_host_mak
4212fi
Juan Quintela2358a492009-07-27 16:13:25 +02004213echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00004214for drv in $audio_drv_list; do
Stefan Weilbb55b712012-03-27 19:23:53 +02004215 def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02004216 echo "$def=y" >> $config_host_mak
malc923e4522008-07-02 18:13:46 +00004217 if test "$drv" = "fmod"; then
Juan Quintela7aac6cb2009-07-27 16:12:47 +02004218 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00004219 fi
4220done
Juan Quintela67f86e82009-08-03 14:46:59 +02004221if test "$audio_pt_int" = "yes" ; then
4222 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
4223fi
malcd5631632009-10-10 01:13:41 +04004224if test "$audio_win_int" = "yes" ; then
4225 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
4226fi
Fam Zhengb64ec4e2013-05-29 19:35:40 +08004227echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
4228echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
Jes Sorensen821601e2011-03-16 13:33:36 +01004229if test "$vnc" = "yes" ; then
4230 echo "CONFIG_VNC=y" >> $config_host_mak
4231fi
ths8d5d2d42007-08-25 01:37:51 +00004232if test "$vnc_tls" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004233 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
ths8d5d2d42007-08-25 01:37:51 +00004234fi
aliguori2f9606b2009-03-06 20:27:28 +00004235if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004236 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00004237fi
Jes Sorensen821601e2011-03-16 13:33:36 +01004238if test "$vnc_jpeg" = "yes" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02004239 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
Corentin Chary2f6f5c72010-07-07 20:57:49 +02004240fi
Jes Sorensen821601e2011-03-16 13:33:36 +01004241if test "$vnc_png" = "yes" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02004242 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
Corentin Charyefe556a2010-07-07 20:57:56 +02004243fi
Tim Hardeck7536ee42013-01-21 11:04:44 +01004244if test "$vnc_ws" = "yes" ; then
4245 echo "CONFIG_VNC_WS=y" >> $config_host_mak
4246 echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
4247fi
aliguori76655d62009-03-06 20:27:37 +00004248if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004249 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00004250fi
Stefan Weilee682d22009-10-01 20:10:37 +02004251if test "$uuid" = "yes" ; then
4252 echo "CONFIG_UUID=y" >> $config_host_mak
4253fi
Christoph Hellwigdce512d2010-12-17 11:41:15 +01004254if test "$xfs" = "yes" ; then
4255 echo "CONFIG_XFS=y" >> $config_host_mak
4256fi
pbrookb1a550a2006-04-16 13:28:56 +00004257qemu_version=`head $source_path/VERSION`
Juan Quintela98ec69a2009-07-16 18:34:18 +02004258echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02004259echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004260echo "SRC_PATH=$source_path" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004261echo "TARGET_DIRS=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02004262if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004263 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00004264fi
Fam Zheng17969262014-02-10 14:48:56 +08004265if test "$modules" = "yes"; then
Fam Zhenge26110c2014-02-10 14:48:57 +08004266 # $shacmd can generate a hash started with digit, which the compiler doesn't
4267 # like as an symbol. So prefix it with an underscore
4268 echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak
Fam Zheng17969262014-02-10 14:48:56 +08004269 echo "CONFIG_MODULES=y" >> $config_host_mak
4270fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02004271if test "$sdl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004272 echo "CONFIG_SDL=y" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02004273 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00004274fi
4275if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004276 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00004277fi
4278if test "$curses" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004279 echo "CONFIG_CURSES=y" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00004280fi
Riku Voipioebc996f2009-04-21 15:01:51 +03004281if test "$utimens" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004282 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
Riku Voipioebc996f2009-04-21 15:01:51 +03004283fi
Riku Voipio099d6b02009-05-05 12:10:04 +03004284if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004285 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03004286fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01004287if test "$accept4" = "yes" ; then
4288 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
4289fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304290if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004291 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304292fi
Riku Voipioc2882b92009-08-12 15:08:24 +03004293if test "$eventfd" = "yes" ; then
4294 echo "CONFIG_EVENTFD=y" >> $config_host_mak
4295fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03004296if test "$fallocate" = "yes" ; then
4297 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
4298fi
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01004299if test "$fallocate_punch_hole" = "yes" ; then
4300 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
4301fi
Peter Maydellc727f472011-01-06 11:05:10 +00004302if test "$sync_file_range" = "yes" ; then
4303 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
4304fi
Peter Maydelldace20d2011-01-10 13:11:24 +00004305if test "$fiemap" = "yes" ; then
4306 echo "CONFIG_FIEMAP=y" >> $config_host_mak
4307fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03004308if test "$dup3" = "yes" ; then
4309 echo "CONFIG_DUP3=y" >> $config_host_mak
4310fi
Alex Bligh4e0c6522013-08-21 16:02:43 +01004311if test "$ppoll" = "yes" ; then
4312 echo "CONFIG_PPOLL=y" >> $config_host_mak
4313fi
Alex Blighcd758dd2013-08-21 16:02:44 +01004314if test "$prctl_pr_set_timerslack" = "yes" ; then
4315 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
4316fi
Peter Maydell3b6edd12011-02-15 18:35:05 +00004317if test "$epoll" = "yes" ; then
4318 echo "CONFIG_EPOLL=y" >> $config_host_mak
4319fi
4320if test "$epoll_create1" = "yes" ; then
4321 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
4322fi
4323if test "$epoll_pwait" = "yes" ; then
4324 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
4325fi
Peter Maydella8fd1ab2013-02-08 07:31:55 +00004326if test "$sendfile" = "yes" ; then
4327 echo "CONFIG_SENDFILE=y" >> $config_host_mak
4328fi
aurel323b3f24a2009-04-15 16:12:13 +00004329if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004330 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00004331fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00004332if test "$inotify1" = "yes" ; then
4333 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
4334fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02004335if test "$byteswap_h" = "yes" ; then
4336 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
4337fi
4338if test "$bswap_h" = "yes" ; then
4339 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
4340fi
Alexander Graf769ce762009-05-11 17:41:42 +02004341if test "$curl" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004342 echo "CONFIG_CURL=m" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02004343 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004344 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02004345fi
aurel322e4d9fb2008-04-08 06:01:02 +00004346if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004347 echo "CONFIG_BRLAPI=y" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00004348fi
balrogfb599c92008-09-28 23:49:55 +00004349if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004350 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02004351 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00004352fi
Anthony Liguorie18df142011-07-19 14:50:29 -05004353echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06004354if test "$gtk" = "yes" ; then
4355 echo "CONFIG_GTK=y" >> $config_host_mak
4356 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
4357 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
4358fi
aliguorie37630c2009-04-22 15:19:10 +00004359if test "$xen" = "yes" ; then
Jan Kiszka6dbd5882011-06-21 22:59:07 +02004360 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00004361 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00004362fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004363if test "$linux_aio" = "yes" ; then
4364 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
4365fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004366if test "$attr" = "yes" ; then
4367 echo "CONFIG_ATTR=y" >> $config_host_mak
4368fi
Avi Kivity4f26f2b2011-11-09 14:44:52 +02004369if test "$libattr" = "yes" ; then
4370 echo "CONFIG_LIBATTR=y" >> $config_host_mak
4371fi
Meador Inge983eef52012-02-24 14:00:42 +05304372if test "$virtfs" = "yes" ; then
4373 echo "CONFIG_VIRTFS=y" >> $config_host_mak
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004374fi
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00004375if test "$vhost_scsi" = "yes" ; then
4376 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
4377fi
ths77755342008-11-27 15:45:16 +00004378if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004379 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00004380fi
aliguoribf9298b2008-12-05 20:05:26 +00004381if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004382 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00004383fi
aliguoriceb42de2009-04-07 18:43:28 +00004384if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004385 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00004386fi
aurel32f652e6a2008-12-16 10:43:48 +00004387if test "$fdt" = "yes" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02004388 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00004389fi
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004390if test "$signalfd" = "yes" ; then
4391 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
4392fi
Stefan Weil9195b2c2011-10-19 07:07:18 +02004393if test "$tcg_interpreter" = "yes" ; then
4394 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
4395fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00004396if test "$fdatasync" = "yes" ; then
4397 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
4398fi
Andreas Färbere78815a2010-09-25 11:26:05 +00004399if test "$madvise" = "yes" ; then
4400 echo "CONFIG_MADVISE=y" >> $config_host_mak
4401fi
4402if test "$posix_madvise" = "yes" ; then
4403 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
4404fi
Richard Henderson1e9737d2012-10-23 07:33:00 +10004405if test "$sigev_thread_id" = "yes" ; then
4406 echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
4407fi
bellard97a847b2003-08-10 21:36:04 +00004408
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004409if test "$spice" = "yes" ; then
4410 echo "CONFIG_SPICE=y" >> $config_host_mak
4411fi
4412
Robert Relyea111a38b2010-11-28 16:36:38 +02004413if test "$smartcard_nss" = "yes" ; then
4414 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
Paul Brookad4cf3f2012-02-09 19:05:29 +00004415 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
4416 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
Robert Relyea111a38b2010-11-28 16:36:38 +02004417fi
4418
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004419if test "$libusb" = "yes" ; then
4420 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
4421fi
4422
Hans de Goede69354a82011-07-19 11:04:10 +02004423if test "$usb_redir" = "yes" ; then
4424 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
4425fi
4426
Michael Walleb1e5fff2013-03-06 20:23:32 +01004427if test "$glx" = "yes" ; then
4428 echo "CONFIG_GLX=y" >> $config_host_mak
Paolo Bonzini2b6b7092013-04-17 16:26:45 +02004429 echo "GLX_LIBS=$glx_libs" >> $config_host_mak
Michael Walle20ff0752011-03-07 23:32:39 +01004430fi
4431
qiaonuohan607dacd2014-02-18 14:11:30 +08004432if test "$lzo" = "yes" ; then
4433 echo "CONFIG_LZO=y" >> $config_host_mak
4434fi
4435
4436if test "$snappy" = "yes" ; then
4437 echo "CONFIG_SNAPPY=y" >> $config_host_mak
4438fi
4439
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004440if test "$libiscsi" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004441 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
Stefan Weil219c2522013-12-17 08:57:10 +01004442 if test "$libiscsi_version" = "1.4.0"; then
4443 echo "CONFIG_LIBISCSI_1_4=y" >> $config_host_mak
4444 fi
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004445 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
4446 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004447fi
4448
Peter Lieven6542aa92014-02-03 10:26:13 +01004449if test "$libnfs" = "yes" ; then
4450 echo "CONFIG_LIBNFS=y" >> $config_host_mak
4451fi
4452
Eduardo Otubof7945732012-08-14 18:44:05 -03004453if test "$seccomp" = "yes"; then
4454 echo "CONFIG_SECCOMP=y" >> $config_host_mak
4455fi
4456
bellard83fb7ad2004-07-05 21:25:26 +00004457# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00004458if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004459 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00004460fi
4461
Juan Quintela2358a492009-07-27 16:13:25 +02004462echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
pbrookc5937222006-05-14 11:30:38 +00004463
Anthony Liguori20ff6c82009-12-09 12:59:36 -06004464if test "$zero_malloc" = "yes" ; then
4465 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
4466fi
Paolo Bonzini3556c232013-05-10 14:16:40 +02004467if test "$qom_cast_debug" = "yes" ; then
4468 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
4469fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004470if test "$rbd" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004471 echo "CONFIG_RBD=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004472 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
4473 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004474fi
Anthony Liguori20ff6c82009-12-09 12:59:36 -06004475
Peter Maydell7c2acc72013-04-08 12:11:27 +01004476echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02004477if test "$coroutine_pool" = "yes" ; then
4478 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
4479else
4480 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
4481fi
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05304482
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05304483if test "$open_by_handle_at" = "yes" ; then
4484 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
4485fi
4486
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05304487if test "$linux_magic_h" = "yes" ; then
4488 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
4489fi
4490
Gerd Hoffmanncc6e3ca2013-01-09 10:17:07 +01004491if test "$pragma_diagnostic_available" = "yes" ; then
4492 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
Peter Maydell06d71fa2012-07-30 16:13:07 +01004493fi
4494
Kevin Wolf3f4349d2012-06-29 13:40:27 +02004495if test "$valgrind_h" = "yes" ; then
4496 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
4497fi
4498
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03004499if test "$has_environ" = "yes" ; then
4500 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
4501fi
4502
Richard Henderson76a347e2012-12-28 14:17:02 -08004503if test "$cpuid_h" = "yes" ; then
4504 echo "CONFIG_CPUID_H=y" >> $config_host_mak
4505fi
4506
Richard Hendersonf5401662013-02-16 12:46:59 -08004507if test "$int128" = "yes" ; then
4508 echo "CONFIG_INT128=y" >> $config_host_mak
4509fi
4510
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08004511if test "$getauxval" = "yes" ; then
4512 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
4513fi
4514
Bharata B Raoeb100392012-09-24 14:42:45 +05304515if test "$glusterfs" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004516 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004517 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
4518 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
Bharata B Raoeb100392012-09-24 14:42:45 +05304519fi
4520
Bharata B Rao0c14fb42013-07-16 21:47:42 +05304521if test "$glusterfs_discard" = "yes" ; then
4522 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
4523fi
4524
Bharata B Rao7c815372013-12-21 14:51:25 +05304525if test "$glusterfs_zerofill" = "yes" ; then
4526 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
4527fi
4528
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004529if test "$libssh2" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004530 echo "CONFIG_LIBSSH2=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004531 echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
4532 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004533fi
4534
Benoît Canet95c6bff2014-02-21 22:21:15 +01004535if test "$quorum" = "yes" ; then
4536 echo "CONFIG_QUORUM=y" >> $config_host_mak
4537fi
4538
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01004539if test "$virtio_blk_data_plane" = "yes" ; then
Paolo Bonzini6e790742013-02-05 12:42:31 +01004540 echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01004541fi
4542
Jeff Cody4f18b782013-10-30 10:44:39 -04004543if test "$vhdx" = "yes" ; then
4544 echo "CONFIG_VHDX=y" >> $config_host_mak
4545fi
4546
blueswir168063642008-11-22 21:03:55 +00004547# USB host support
Gerd Hoffmannb5613fd2013-09-10 11:02:59 +02004548if test "$libusb" = "yes"; then
4549 echo "HOST_USB=libusb legacy" >> $config_host_mak
4550else
Juan Quintela98ec69a2009-07-16 18:34:18 +02004551 echo "HOST_USB=stub" >> $config_host_mak
Gerd Hoffmannb5613fd2013-09-10 11:02:59 +02004552fi
blueswir168063642008-11-22 21:03:55 +00004553
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01004554# TPM passthrough support?
4555if test "$tpm" = "yes"; then
4556 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
4557 if test "$tpm_passthrough" = "yes"; then
4558 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
4559 fi
4560fi
4561
Lluíse4858972011-08-31 20:31:03 +02004562# use default implementation for tracing backend-specific routines
4563trace_default=yes
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01004564echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
Lluís6d8a7642011-08-31 20:30:43 +02004565if test "$trace_backend" = "nop"; then
4566 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
Prerna Saxena22890ab2010-06-24 17:04:53 +05304567fi
Prerna Saxena9410b562010-07-13 09:26:32 +01004568if test "$trace_backend" = "simple"; then
Lluís6d8a7642011-08-31 20:30:43 +02004569 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02004570 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02004571 # Set the appropriate trace file.
Andreas Färber953ffe02011-06-02 19:58:06 +02004572 trace_file="\"$trace_file-\" FMT_pid"
Prerna Saxena9410b562010-07-13 09:26:32 +01004573fi
Lluís6d8a7642011-08-31 20:30:43 +02004574if test "$trace_backend" = "stderr"; then
4575 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
Lluís9a82b6a2011-08-31 20:31:51 +02004576 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02004577fi
4578if test "$trace_backend" = "ust"; then
4579 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
4580fi
4581if test "$trace_backend" = "dtrace"; then
4582 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
4583 if test "$trace_backend_stap" = "yes" ; then
4584 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
4585 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00004586fi
Eiichi Tsukata781e9542013-04-11 20:25:15 +09004587if test "$trace_backend" = "ftrace"; then
4588 if test "$linux" = "yes" ; then
4589 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
4590 trace_default=no
4591 else
Stewart Smith21684af2014-01-24 12:39:10 +11004592 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
Eiichi Tsukata781e9542013-04-11 20:25:15 +09004593 fi
4594fi
Prerna Saxena9410b562010-07-13 09:26:32 +01004595echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02004596if test "$trace_default" = "yes"; then
4597 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
4598fi
Prerna Saxena9410b562010-07-13 09:26:32 +01004599
Michael R. Hines2da776d2013-07-22 10:01:54 -04004600if test "$rdma" = "yes" ; then
4601 echo "CONFIG_RDMA=y" >> $config_host_mak
4602fi
4603
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02004604if test "$tcg_interpreter" = "yes"; then
4605 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
4606elif test "$ARCH" = "sparc64" ; then
4607 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
4608elif test "$ARCH" = "s390x" ; then
4609 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
Richard Hendersonc72b26e2013-08-20 12:20:05 -07004610elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02004611 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
4612else
4613 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
4614fi
4615QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
4616
Juan Quintela98ec69a2009-07-16 18:34:18 +02004617echo "TOOLS=$tools" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004618echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004619echo "MAKE=$make" >> $config_host_mak
4620echo "INSTALL=$install" >> $config_host_mak
Brad1901cb12011-08-28 04:01:33 -04004621echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
4622echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
Paolo Bonzini21655882012-12-20 18:57:45 +01004623if test -n "$libtool"; then
4624 echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
4625 echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
4626else
4627 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
4628 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
4629fi
Blue Swirlc886edf2011-07-22 21:08:09 +00004630echo "PYTHON=$python" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004631echo "CC=$cc" >> $config_host_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03004632if $iasl -h > /dev/null 2>&1; then
4633 echo "IASL=$iasl" >> $config_host_mak
4634fi
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02004635echo "CC_I386=$cc_i386" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004636echo "HOST_CC=$host_cc" >> $config_host_mak
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04004637echo "CXX=$cxx" >> $config_host_mak
Peter Maydell3c4a4d02012-08-11 22:34:40 +01004638echo "OBJCC=$objcc" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004639echo "AR=$ar" >> $config_host_mak
Peter Maydell45d285a2013-10-21 21:03:06 +01004640echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00004641echo "AS=$as" >> $config_host_mak
4642echo "CPP=$cpp" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004643echo "OBJCOPY=$objcopy" >> $config_host_mak
4644echo "LD=$ld" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00004645echo "WINDRES=$windres" >> $config_host_mak
Alon Levy44dc0ca2011-05-15 11:51:28 +03004646echo "LIBTOOL=$libtool" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02004647echo "CFLAGS=$CFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05004648echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02004649echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01004650echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01004651if test "$sparse" = "yes" ; then
4652 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
4653 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
4654 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
4655fi
Gerd Hoffmann42da6042012-11-07 11:09:52 +01004656if test "$cross_prefix" != ""; then
4657 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
4658else
4659 echo "AUTOCONF_HOST := " >> $config_host_mak
4660fi
Juan Quintelae2a2ed02009-08-03 14:46:02 +02004661echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05004662echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
Marc-André Lureau37746c52013-02-25 23:31:12 +01004663echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02004664echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02004665echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004666echo "EXESUF=$EXESUF" >> $config_host_mak
Fam Zheng17969262014-02-10 14:48:56 +08004667echo "DSOSUF=$DSOSUF" >> $config_host_mak
4668echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
Michael Roth957f1f92011-08-11 15:38:12 -05004669echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02004670echo "POD2MAN=$POD2MAN" >> $config_host_mak
Paolo Bonzinicbdd1992012-11-28 09:40:23 +01004671echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
Blue Swirl1d728c32012-05-01 18:45:39 +00004672if test "$gcov" = "yes" ; then
4673 echo "CONFIG_GCOV=y" >> $config_host_mak
4674 echo "GCOV=$gcov_tool" >> $config_host_mak
4675fi
Juan Quintela804edf22009-07-27 16:12:49 +02004676
Peter Maydell6efd7512011-11-30 11:59:04 +00004677# use included Linux headers
4678if test "$linux" = "yes" ; then
Andreas Färbera307beb2012-06-14 15:14:33 +00004679 mkdir -p linux-headers
Peter Maydell6efd7512011-11-30 11:59:04 +00004680 case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07004681 i386|x86_64|x32)
Peter Maydell08312a62012-08-03 13:51:25 +01004682 linux_arch=x86
Peter Maydell6efd7512011-11-30 11:59:04 +00004683 ;;
4684 ppcemb|ppc|ppc64)
Peter Maydell08312a62012-08-03 13:51:25 +01004685 linux_arch=powerpc
Peter Maydell6efd7512011-11-30 11:59:04 +00004686 ;;
4687 s390x)
Peter Maydell08312a62012-08-03 13:51:25 +01004688 linux_arch=s390
4689 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +01004690 aarch64)
4691 linux_arch=arm64
4692 ;;
Peter Maydell08312a62012-08-03 13:51:25 +01004693 *)
4694 # For most CPUs the kernel architecture name and QEMU CPU name match.
4695 linux_arch="$cpu"
Peter Maydell6efd7512011-11-30 11:59:04 +00004696 ;;
4697 esac
Peter Maydell08312a62012-08-03 13:51:25 +01004698 # For non-KVM architectures we will not have asm headers
4699 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
4700 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
4701 fi
Peter Maydell6efd7512011-11-30 11:59:04 +00004702fi
4703
bellard1d14ffa2005-10-30 18:58:22 +00004704for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00004705target_dir="$target"
Juan Quintela25be2102009-10-07 02:41:00 +02004706config_target_mak=$target_dir/config-target.mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004707target_name=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00004708target_bigendian="no"
Juan Quintela1f3d3c82009-10-07 02:41:02 +02004709
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004710case "$target_name" in
Anthony Greend15a9c22013-03-18 15:49:25 -04004711 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 +02004712 target_bigendian=yes
4713 ;;
4714esac
bellard97a847b2003-08-10 21:36:04 +00004715target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00004716target_user_only="no"
ths831b7822007-01-18 20:06:33 +00004717target_linux_user="no"
blueswir184778502008-10-26 20:33:16 +00004718target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00004719case "$target" in
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004720 ${target_name}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00004721 target_softmmu="yes"
4722 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004723 ${target_name}-linux-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00004724 if test "$linux" != "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01004725 error_exit "Target '$target' is only available on a Linux host"
Blue Swirl9c7a4202009-11-17 20:52:56 +00004726 fi
pbrook9e407a82007-05-26 16:38:53 +00004727 target_user_only="yes"
4728 target_linux_user="yes"
4729 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004730 ${target_name}-bsd-user)
Blue Swirl9cf55762009-11-17 21:27:18 +00004731 if test "$bsd" != "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01004732 error_exit "Target '$target' is only available on a BSD host"
Blue Swirl9c7a4202009-11-17 20:52:56 +00004733 fi
blueswir184778502008-10-26 20:33:16 +00004734 target_user_only="yes"
4735 target_bsd_user="yes"
4736 ;;
pbrook9e407a82007-05-26 16:38:53 +00004737 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01004738 error_exit "Target '$target' not recognised"
pbrook9e407a82007-05-26 16:38:53 +00004739 exit 1
4740 ;;
4741esac
ths831b7822007-01-18 20:06:33 +00004742
bellard97a847b2003-08-10 21:36:04 +00004743mkdir -p $target_dir
Juan Quintela25be2102009-10-07 02:41:00 +02004744echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00004745
pbrooke5fe0c52006-06-11 13:32:59 +00004746bflt="no"
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004747interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
pbrook56aebc82008-10-11 17:55:29 +00004748gdb_xml_files=""
aliguori7ba1e612008-11-05 16:04:33 +00004749
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004750TARGET_ARCH="$target_name"
Juan Quintela6acff7d2009-07-16 18:34:15 +02004751TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02004752TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02004753
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004754case "$target_name" in
aurel322408a522008-04-20 20:19:44 +00004755 i386)
aurel322408a522008-04-20 20:19:44 +00004756 ;;
4757 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004758 TARGET_BASE_ARCH=i386
aurel322408a522008-04-20 20:19:44 +00004759 ;;
4760 alpha)
aurel322408a522008-04-20 20:19:44 +00004761 ;;
4762 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004763 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00004764 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00004765 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00004766 ;;
Alexander Graf6a49fa92013-09-03 20:12:22 +01004767 aarch64)
4768 TARGET_BASE_ARCH=arm
4769 bflt="yes"
Peter Maydell6a669422013-12-17 19:42:32 +00004770 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml"
Alexander Graf6a49fa92013-09-03 20:12:22 +01004771 ;;
aurel322408a522008-04-20 20:19:44 +00004772 cris)
aurel322408a522008-04-20 20:19:44 +00004773 ;;
Michael Walle613a22c2011-02-17 23:45:17 +01004774 lm32)
Michael Walle613a22c2011-02-17 23:45:17 +01004775 ;;
aurel322408a522008-04-20 20:19:44 +00004776 m68k)
aurel322408a522008-04-20 20:19:44 +00004777 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00004778 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00004779 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01004780 microblaze|microblazeel)
4781 TARGET_ARCH=microblaze
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02004782 bflt="yes"
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02004783 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02004784 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004785 TARGET_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02004786 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004787 ;;
4788 mipsn32|mipsn32el)
Richard Henderson597e2ce2013-02-10 10:30:50 -08004789 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004790 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02004791 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Richard Henderson597e2ce2013-02-10 10:30:50 -08004792 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004793 ;;
4794 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004795 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004796 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02004797 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004798 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04004799 moxie)
4800 ;;
Jia Liue67db062012-07-20 15:50:39 +08004801 or32)
4802 TARGET_ARCH=openrisc
4803 TARGET_BASE_ARCH=openrisc
Jia Liue67db062012-07-20 15:50:39 +08004804 ;;
aurel322408a522008-04-20 20:19:44 +00004805 ppc)
aurel32c8b35322009-01-24 15:07:34 +00004806 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004807 ;;
4808 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004809 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004810 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00004811 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004812 ;;
4813 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004814 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004815 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00004816 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004817 ;;
4818 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004819 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004820 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004821 TARGET_ABI_DIR=ppc
Juan Quintela25be2102009-10-07 02:41:00 +02004822 echo "TARGET_ABI32=y" >> $config_target_mak
aurel32c8b35322009-01-24 15:07:34 +00004823 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004824 ;;
4825 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004826 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00004827 bflt="yes"
4828 ;;
4829 sparc)
aurel322408a522008-04-20 20:19:44 +00004830 ;;
4831 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004832 TARGET_BASE_ARCH=sparc
aurel322408a522008-04-20 20:19:44 +00004833 ;;
4834 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004835 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004836 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004837 TARGET_ABI_DIR=sparc
Juan Quintela25be2102009-10-07 02:41:00 +02004838 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004839 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01004840 s390x)
Alexander Graf24e804ec2009-12-05 12:44:22 +01004841 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +08004842 unicore32)
Guan Xuetaod2fbca92011-04-12 16:27:03 +08004843 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04004844 xtensa|xtensaeb)
4845 TARGET_ARCH=xtensa
Max Filippovcfa550c2011-09-06 03:55:26 +04004846 ;;
aurel322408a522008-04-20 20:19:44 +00004847 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01004848 error_exit "Unsupported target CPU"
aurel322408a522008-04-20 20:19:44 +00004849 ;;
4850esac
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02004851# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
4852if [ "$TARGET_BASE_ARCH" = "" ]; then
4853 TARGET_BASE_ARCH=$TARGET_ARCH
4854fi
4855
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02004856symlink "$source_path/Makefile.target" "$target_dir/Makefile"
4857
Daniel P. Berrange99afc912012-08-20 15:31:38 +01004858upper() {
4859 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
4860}
4861
Daniel P. Berrange99afc912012-08-20 15:31:38 +01004862target_arch_name="`upper $TARGET_ARCH`"
Juan Quintela25be2102009-10-07 02:41:00 +02004863echo "TARGET_$target_arch_name=y" >> $config_target_mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004864echo "TARGET_NAME=$target_name" >> $config_target_mak
Juan Quintela25be2102009-10-07 02:41:00 +02004865echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02004866if [ "$TARGET_ABI_DIR" = "" ]; then
4867 TARGET_ABI_DIR=$TARGET_ARCH
4868fi
Juan Quintela25be2102009-10-07 02:41:00 +02004869echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004870case "$target_name" in
Juan Quintela1b0c87f2009-07-16 18:33:59 +02004871 i386|x86_64)
4872 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004873 echo "CONFIG_XEN=y" >> $config_target_mak
Anthony PERARDeb6fda02012-06-21 15:32:59 +00004874 if test "$xen_pci_passthrough" = yes; then
4875 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4876 fi
Juan Quintela1b0c87f2009-07-16 18:33:59 +02004877 fi
Alexander Graf59d21e52011-07-17 07:30:29 +02004878 ;;
4879 *)
Juan Quintela1b0c87f2009-07-16 18:33:59 +02004880esac
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004881case "$target_name" in
Peter Maydell70a5f682013-12-17 19:42:30 +00004882 aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
Juan Quintelac59249f2009-07-16 18:34:00 +02004883 # Make sure the target and host cpus are compatible
4884 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004885 \( "$target_name" = "$cpu" -o \
4886 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
4887 \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
4888 \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
4889 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
4890 \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
4891 \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004892 echo "CONFIG_KVM=y" >> $config_target_mak
Stefan Weil1ba16962011-07-29 22:40:45 +02004893 if test "$vhost_net" = "yes" ; then
Michael S. Tsirkind5970052010-03-17 13:08:17 +02004894 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
4895 fi
Juan Quintelac59249f2009-07-16 18:34:00 +02004896 fi
4897esac
bellardde83cd02003-06-15 20:25:43 +00004898if test "$target_bigendian" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004899 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00004900fi
4901if test "$target_softmmu" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004902 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
bellardde83cd02003-06-15 20:25:43 +00004903fi
bellard997344f2003-10-27 21:10:39 +00004904if test "$target_user_only" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004905 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
Stefan Weila2c80be2011-12-22 11:26:10 +01004906 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00004907fi
ths831b7822007-01-18 20:06:33 +00004908if test "$target_linux_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004909 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00004910fi
pbrook56aebc82008-10-11 17:55:29 +00004911list=""
4912if test ! -z "$gdb_xml_files" ; then
4913 for x in $gdb_xml_files; do
4914 list="$list $source_path/gdb-xml/$x"
4915 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02004916 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00004917fi
bellardde83cd02003-06-15 20:25:43 +00004918
pbrooke5fe0c52006-06-11 13:32:59 +00004919if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02004920 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00004921fi
Paul Brook379f6692009-07-17 12:48:08 +01004922if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02004923 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
Paul Brook379f6692009-07-17 12:48:08 +01004924fi
blueswir184778502008-10-26 20:33:16 +00004925if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004926 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00004927fi
bellard5b0753e2005-03-01 21:37:28 +00004928
Juan Quintela4afddb52009-08-03 14:46:45 +02004929# generate QEMU_CFLAGS/LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02004930
Juan Quintela4afddb52009-08-03 14:46:45 +02004931cflags=""
Juan Quintelafa282482009-07-22 22:37:39 +02004932ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02004933
Juan Quintela64656022009-08-03 14:46:53 +02004934for i in $ARCH $TARGET_BASE_ARCH ; do
4935 case "$i" in
4936 alpha)
Juan Quintela25be2102009-10-07 02:41:00 +02004937 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004938 echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004939 ;;
4940 arm)
Juan Quintela25be2102009-10-07 02:41:00 +02004941 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004942 echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak
Claudio Fontana999b53e2014-02-05 17:27:28 +00004943 if test -n "${cxx}"; then
4944 echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
4945 echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
4946 fi
Juan Quintela64656022009-08-03 14:46:53 +02004947 ;;
4948 cris)
Juan Quintela25be2102009-10-07 02:41:00 +02004949 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004950 echo "CONFIG_CRIS_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004951 ;;
4952 hppa)
Juan Quintela25be2102009-10-07 02:41:00 +02004953 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004954 echo "CONFIG_HPPA_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004955 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07004956 i386|x86_64|x32)
Juan Quintela25be2102009-10-07 02:41:00 +02004957 echo "CONFIG_I386_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004958 echo "CONFIG_I386_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004959 ;;
Aurelien Jarno903ec552010-03-29 02:12:51 +02004960 ia64*)
4961 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004962 echo "CONFIG_IA64_DIS=y" >> config-all-disas.mak
Aurelien Jarno903ec552010-03-29 02:12:51 +02004963 ;;
Michael Walle79368f42012-03-31 19:54:20 +02004964 lm32)
4965 echo "CONFIG_LM32_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004966 echo "CONFIG_LM32_DIS=y" >> config-all-disas.mak
Michael Walle79368f42012-03-31 19:54:20 +02004967 ;;
Juan Quintela64656022009-08-03 14:46:53 +02004968 m68k)
Juan Quintela25be2102009-10-07 02:41:00 +02004969 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004970 echo "CONFIG_M68K_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004971 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01004972 microblaze*)
Juan Quintela25be2102009-10-07 02:41:00 +02004973 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004974 echo "CONFIG_MICROBLAZE_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004975 ;;
4976 mips*)
Juan Quintela25be2102009-10-07 02:41:00 +02004977 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004978 echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004979 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04004980 moxie*)
4981 echo "CONFIG_MOXIE_DIS=y" >> $config_target_mak
4982 echo "CONFIG_MOXIE_DIS=y" >> config-all-disas.mak
4983 ;;
Jia Liue67db062012-07-20 15:50:39 +08004984 or32)
4985 echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004986 echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak
Jia Liue67db062012-07-20 15:50:39 +08004987 ;;
Juan Quintela64656022009-08-03 14:46:53 +02004988 ppc*)
Juan Quintela25be2102009-10-07 02:41:00 +02004989 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004990 echo "CONFIG_PPC_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004991 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01004992 s390*)
Juan Quintela25be2102009-10-07 02:41:00 +02004993 echo "CONFIG_S390_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004994 echo "CONFIG_S390_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004995 ;;
4996 sh4)
Juan Quintela25be2102009-10-07 02:41:00 +02004997 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004998 echo "CONFIG_SH4_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004999 ;;
5000 sparc*)
Juan Quintela25be2102009-10-07 02:41:00 +02005001 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005002 echo "CONFIG_SPARC_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02005003 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04005004 xtensa*)
5005 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005006 echo "CONFIG_XTENSA_DIS=y" >> config-all-disas.mak
Max Filippovcfa550c2011-09-06 03:55:26 +04005007 ;;
Juan Quintela64656022009-08-03 14:46:53 +02005008 esac
5009done
Stefan Weil9195b2c2011-10-19 07:07:18 +02005010if test "$tcg_interpreter" = "yes" ; then
5011 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005012 echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak
Stefan Weil9195b2c2011-10-19 07:07:18 +02005013fi
Juan Quintela64656022009-08-03 14:46:53 +02005014
Juan Quintela6ee71262009-08-03 14:46:47 +02005015case "$ARCH" in
5016alpha)
5017 # Ensure there's only a single GP
5018 cflags="-msmall-data $cflags"
5019;;
5020esac
5021
Juan Quintelad02c1db2009-08-03 14:46:50 +02005022if test "$gprof" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02005023 echo "TARGET_GPROF=yes" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02005024 if test "$target_linux_user" = "yes" ; then
5025 cflags="-p $cflags"
5026 ldflags="-p $ldflags"
5027 fi
5028 if test "$target_softmmu" = "yes" ; then
5029 ldflags="-p $ldflags"
Juan Quintela25be2102009-10-07 02:41:00 +02005030 echo "GPROF_CFLAGS=-p" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02005031 fi
5032fi
5033
Juan Quintela9b8e1112009-08-03 14:46:46 +02005034if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
Richard Henderson964c6fa2013-06-21 19:10:16 -07005035 ldflags="$ldflags $textseg_ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02005036fi
Juan Quintelafa282482009-07-22 22:37:39 +02005037
Juan Quintela25be2102009-10-07 02:41:00 +02005038echo "LDFLAGS+=$ldflags" >> $config_target_mak
5039echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02005040
bellard97a847b2003-08-10 21:36:04 +00005041done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00005042
Gerd Hoffmannb776eca2012-11-12 12:18:38 +01005043if [ "$pixman" = "internal" ]; then
5044 echo "config-host.h: subdir-pixman" >> $config_host_mak
5045fi
5046
Michael R. Hines2da776d2013-07-22 10:01:54 -04005047if test "$rdma" = "yes" ; then
5048echo "CONFIG_RDMA=y" >> $config_host_mak
5049fi
5050
Peter Crosthwaitea540f152013-04-18 14:47:31 +10005051if [ "$dtc_internal" = "yes" ]; then
5052 echo "config-host.h: subdir-dtc" >> $config_host_mak
5053fi
5054
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005055# build tree in object directory in case the source is not in the current directory
Wenchao Xiaf93296e2013-09-06 11:24:32 +08005056DIRS="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 +04005057DIRS="$DIRS fsdev"
Christian Borntraeger9933c302013-04-23 01:23:03 +00005058DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005059DIRS="$DIRS roms/seabios roms/vgabios"
Paolo Bonzini2dee8d52012-06-04 09:15:43 +02005060DIRS="$DIRS qapi-generated"
Anthony Liguoric09015d2012-01-10 13:10:42 -06005061FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
5062FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
Andreas Färberaaa2ebc2013-07-06 20:41:37 +02005063FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005064FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
Andreas Färber446b9162011-05-08 13:25:56 +02005065FILES="$FILES pc-bios/spapr-rtas/Makefile"
Christian Borntraeger9933c302013-04-23 01:23:03 +00005066FILES="$FILES pc-bios/s390-ccw/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005067FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
Jan Kiszka4652b792013-02-22 21:05:01 +01005068FILES="$FILES pc-bios/qemu-icon.bmp"
Richard Henderson753d11f2011-06-24 11:58:37 -07005069for bios_file in \
5070 $source_path/pc-bios/*.bin \
Gerd Hoffmann5acc2ec2012-12-03 10:45:49 +01005071 $source_path/pc-bios/*.aml \
Richard Henderson753d11f2011-06-24 11:58:37 -07005072 $source_path/pc-bios/*.rom \
5073 $source_path/pc-bios/*.dtb \
Dominik Dingele89e33e2013-04-29 04:52:06 +00005074 $source_path/pc-bios/*.img \
Richard Henderson753d11f2011-06-24 11:58:37 -07005075 $source_path/pc-bios/openbios-* \
5076 $source_path/pc-bios/palcode-*
5077do
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005078 FILES="$FILES pc-bios/`basename $bios_file`"
5079done
Marcel Apfelbaumc2304b52013-12-26 16:54:20 +02005080for test_file in `find $source_path/tests/acpi-test-data -type f`
5081do
5082 FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`"
5083done
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005084mkdir -p $DIRS
5085for f in $FILES ; do
Stefan Weil72b8b5a2012-03-19 13:20:47 +01005086 if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
Peter Maydellf9245e12011-06-03 17:10:40 +01005087 symlink "$source_path/$f" "$f"
5088 fi
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005089done
Paul Brook1ad21342009-05-19 16:17:58 +01005090
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005091# temporary config to build submodules
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06005092for rom in seabios vgabios ; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005093 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01005094 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005095 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00005096 echo "AS=$as" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005097 echo "CC=$cc" >> $config_mak
5098 echo "BCC=bcc" >> $config_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00005099 echo "CPP=$cpp" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005100 echo "OBJCOPY=objcopy" >> $config_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03005101 echo "IASL=$iasl" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005102 echo "LD=$ld" >> $config_mak
5103done
5104
Jan Kiszkab40292e2010-05-31 14:43:31 -03005105if test "$docs" = "yes" ; then
5106 mkdir -p QMP
5107fi