blob: ca7de4f55fc8f9018dde551c981e9d73767bfaa9 [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#
Peter Maydell8cd05ab2014-05-23 17:07:24 +01005
Cornelia Huck99519e62014-05-28 12:39:17 +02006# Unset some variables known to interfere with behavior of common tools,
7# just as autoconf does.
8CLICOLOR_FORCE= GREP_OPTIONS=
9unset CLICOLOR_FORCE GREP_OPTIONS
10
John Snow5e4dfd32015-10-28 13:56:40 -040011# Don't allow CCACHE, if present, to use cached results of compile tests!
12export CCACHE_RECACHE=yes
13
Peter Maydell8cd05ab2014-05-23 17:07:24 +010014# Temporary directory used for files created while
15# configure runs. Since it is in the build directory
16# we can safely blow away any previous version of it
17# (and we need not jump through hoops to try to delete
18# it when configure exits.)
19TMPDIR1="config-temp"
20rm -rf "${TMPDIR1}"
21mkdir -p "${TMPDIR1}"
22if [ $? -ne 0 ]; then
23 echo "ERROR: failed to create temporary directory"
24 exit 1
bellard7d132992003-03-06 23:23:54 +000025fi
26
Peter Maydell8cd05ab2014-05-23 17:07:24 +010027TMPB="qemu-conf"
28TMPC="${TMPDIR1}/${TMPB}.c"
Don Slutz66518bf2014-01-02 21:12:46 -050029TMPO="${TMPDIR1}/${TMPB}.o"
Peter Maydell9c83ffd2014-02-25 18:27:49 +000030TMPCXX="${TMPDIR1}/${TMPB}.cxx"
Peter Maydell8cd05ab2014-05-23 17:07:24 +010031TMPE="${TMPDIR1}/${TMPB}.exe"
James Clarke6969ec62016-06-06 12:02:50 +010032TMPMO="${TMPDIR1}/${TMPB}.mo"
bellard7d132992003-03-06 23:23:54 +000033
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020034rm -f config.log
malc9ac81bb2008-11-29 20:09:56 +000035
Peter Maydellb48e3612011-11-23 17:26:44 +000036# Print a helpful header at the top of config.log
37echo "# QEMU configure log $(date)" >> config.log
Peter Maydell979ae162012-03-07 12:16:29 +000038printf "# Configured with:" >> config.log
39printf " '%s'" "$0" "$@" >> config.log
40echo >> config.log
Peter Maydellb48e3612011-11-23 17:26:44 +000041echo "#" >> config.log
42
Paolo Bonzinid880a3b2017-07-03 16:58:28 +020043print_error() {
44 (echo
Peter Maydell76ad07a2013-04-08 12:11:26 +010045 echo "ERROR: $1"
46 while test -n "$2"; do
47 echo " $2"
48 shift
49 done
Paolo Bonzinid880a3b2017-07-03 16:58:28 +020050 echo) >&2
51}
52
53error_exit() {
54 print_error "$@"
Peter Maydell76ad07a2013-04-08 12:11:26 +010055 exit 1
56}
57
Peter Maydell9c83ffd2014-02-25 18:27:49 +000058do_compiler() {
59 # Run the compiler, capturing its output to the log. First argument
60 # is compiler binary to execute.
61 local compiler="$1"
62 shift
Ian Jackson8bbe05d2017-09-25 16:41:03 +010063 if test -n "$BASH_VERSION"; then eval '
64 echo >>config.log "
65funcs: ${FUNCNAME[*]}
66lines: ${BASH_LINENO[*]}"
67 '; fi
Peter Maydell9c83ffd2014-02-25 18:27:49 +000068 echo $compiler "$@" >> config.log
69 $compiler "$@" >> config.log 2>&1 || return $?
Peter Maydell8dc38a72012-07-18 15:10:28 +010070 # Test passed. If this is an --enable-werror build, rerun
71 # the test with -Werror and bail out if it fails. This
72 # makes warning-generating-errors in configure test code
73 # obvious to developers.
74 if test "$werror" != "yes"; then
75 return 0
76 fi
77 # Don't bother rerunning the compile if we were already using -Werror
78 case "$*" in
79 *-Werror*)
80 return 0
81 ;;
82 esac
Peter Maydell9c83ffd2014-02-25 18:27:49 +000083 echo $compiler -Werror "$@" >> config.log
84 $compiler -Werror "$@" >> config.log 2>&1 && return $?
Peter Maydell76ad07a2013-04-08 12:11:26 +010085 error_exit "configure test passed without -Werror but failed with -Werror." \
86 "This is probably a bug in the configure script. The failing command" \
87 "will be at the bottom of config.log." \
88 "You can run configure with --disable-werror to bypass this check."
Peter Maydell8dc38a72012-07-18 15:10:28 +010089}
90
Peter Maydell9c83ffd2014-02-25 18:27:49 +000091do_cc() {
92 do_compiler "$cc" "$@"
93}
94
95do_cxx() {
96 do_compiler "$cxx" "$@"
97}
98
99update_cxxflags() {
100 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
101 # options which some versions of GCC's C++ compiler complain about
102 # because they only make sense for C programs.
Bruno Dominguez11cde1c2017-06-06 14:07:47 +0100103 QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS"
104
Peter Maydell9c83ffd2014-02-25 18:27:49 +0000105 for arg in $QEMU_CFLAGS; do
106 case $arg in
107 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
108 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
109 ;;
110 *)
111 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
112 ;;
113 esac
114 done
115}
116
Juan Quintela52166aa2009-08-03 14:46:03 +0200117compile_object() {
John Snowfd0e6052015-03-25 18:57:39 -0400118 local_cflags="$1"
119 do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
Juan Quintela52166aa2009-08-03 14:46:03 +0200120}
121
122compile_prog() {
123 local_cflags="$1"
124 local_ldflags="$2"
Peter Maydell8dc38a72012-07-18 15:10:28 +0100125 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
Juan Quintela52166aa2009-08-03 14:46:03 +0200126}
127
Paolo Bonzini11568d62010-12-23 11:43:58 +0100128# symbolically link $1 to $2. Portable version of "ln -sf".
129symlink() {
Stefan Weil72b8b5a2012-03-19 13:20:47 +0100130 rm -rf "$2"
Anthony Liguoriec5b06d2012-06-06 16:57:00 +0800131 mkdir -p "$(dirname "$2")"
Stefan Weil72b8b5a2012-03-19 13:20:47 +0100132 ln -s "$1" "$2"
Paolo Bonzini11568d62010-12-23 11:43:58 +0100133}
134
Loïc Minier0dba6192010-01-28 21:26:51 +0000135# check whether a command is available to this shell (may be either an
136# executable or a builtin)
137has() {
138 type "$1" >/dev/null 2>&1
139}
140
141# search for an executable in PATH
142path_of() {
143 local_command="$1"
144 local_ifs="$IFS"
145 local_dir=""
146
147 # pathname has a dir component?
148 if [ "${local_command#*/}" != "$local_command" ]; then
149 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
150 echo "$local_command"
151 return 0
152 fi
153 fi
154 if [ -z "$local_command" ]; then
155 return 1
156 fi
157
158 IFS=:
159 for local_dir in $PATH; do
160 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
161 echo "$local_dir/$local_command"
162 IFS="${local_ifs:-$(printf ' \t\n')}"
163 return 0
164 fi
165 done
166 # not found
167 IFS="${local_ifs:-$(printf ' \t\n')}"
168 return 1
169}
170
Lluís Vilanova5b808272014-05-27 15:02:14 +0200171have_backend () {
172 echo "$trace_backends" | grep "$1" >/dev/null
173}
174
Paolo Bonzini3b6b7552012-09-17 11:59:41 +0200175glob() {
176 eval test -z '"${1#'"$2"'}"'
177}
178
179supported_hax_target() {
180 test "$hax" = "yes" || return 1
181 glob "$1" "*-softmmu" || return 1
182 case "${1%-softmmu}" in
183 i386|x86_64)
184 return 0
185 ;;
186 esac
187 return 1
188}
189
190supported_kvm_target() {
191 test "$kvm" = "yes" || return 1
192 glob "$1" "*-softmmu" || return 1
193 case "${1%-softmmu}:$cpu" in
194 arm:arm | aarch64:aarch64 | \
195 i386:i386 | i386:x86_64 | i386:x32 | \
196 x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \
197 mips:mips | mipsel:mips | \
198 ppc:ppc | ppcemb:ppc | ppc64:ppc | \
199 ppc:ppc64 | ppcemb:ppc64 | ppc64:ppc64 | \
200 s390x:s390x)
201 return 0
202 ;;
203 esac
204 return 1
205}
206
207supported_xen_target() {
208 test "$xen" = "yes" || return 1
209 glob "$1" "*-softmmu" || return 1
Paolo Bonzinib5ed2e12017-07-11 12:00:49 +0200210 # Only i386 and x86_64 provide the xenpv machine.
211 case "${1%-softmmu}" in
212 i386|x86_64)
Paolo Bonzini3b6b7552012-09-17 11:59:41 +0200213 return 0
214 ;;
215 esac
216 return 1
217}
218
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -0500219supported_hvf_target() {
220 test "$hvf" = "yes" || return 1
221 glob "$1" "*-softmmu" || return 1
222 case "${1%-softmmu}" in
223 x86_64)
224 return 0
225 ;;
226 esac
227 return 1
228}
229
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -0800230supported_whpx_target() {
231 test "$whpx" = "yes" || return 1
232 glob "$1" "*-softmmu" || return 1
233 case "${1%-softmmu}" in
234 i386|x86_64)
235 return 0
236 ;;
237 esac
238 return 1
239}
240
Paolo Bonzinid880a3b2017-07-03 16:58:28 +0200241supported_target() {
242 case "$1" in
243 *-softmmu)
244 ;;
245 *-linux-user)
246 if test "$linux" != "yes"; then
247 print_error "Target '$target' is only available on a Linux host"
248 return 1
249 fi
250 ;;
251 *-bsd-user)
252 if test "$bsd" != "yes"; then
253 print_error "Target '$target' is only available on a BSD host"
254 return 1
255 fi
256 ;;
257 *)
258 print_error "Invalid target name '$target'"
259 return 1
260 ;;
261 esac
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +0200262 test "$tcg" = "yes" && return 0
263 supported_kvm_target "$1" && return 0
264 supported_xen_target "$1" && return 0
265 supported_hax_target "$1" && return 0
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -0500266 supported_hvf_target "$1" && return 0
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -0800267 supported_whpx_target "$1" && return 0
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +0200268 print_error "TCG disabled, but hardware accelerator not available for '$target'"
269 return 1
Paolo Bonzinid880a3b2017-07-03 16:58:28 +0200270}
271
Christian Borntraegere9a35912017-08-23 12:16:23 +0200272
273ld_has() {
274 $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
275}
276
bellard7d132992003-03-06 23:23:54 +0000277# default parameters
Stefan Weil89138852016-05-16 15:10:20 +0200278source_path=$(dirname "$0")
Juan Quintela2ff6b912009-08-03 14:45:55 +0200279cpu=""
Michael S. Tsirkina31a8642013-07-24 18:56:03 +0300280iasl="iasl"
bellard1e43adf2003-09-30 20:54:24 +0000281interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +0000282static="no"
bellard7d132992003-03-06 23:23:54 +0000283cross_prefix=""
malc0c58ac12008-06-25 21:04:05 +0000284audio_drv_list=""
Fam Zhengb64ec4e2013-05-29 19:35:40 +0800285block_drv_rw_whitelist=""
286block_drv_ro_whitelist=""
Peter Maydelle49d0212012-12-07 15:39:13 +0000287host_cc="cc"
Juan Quintela73da3752009-08-03 14:46:26 +0200288libs_softmmu=""
Juan Quintela3e2e0e62009-08-03 14:47:06 +0200289libs_tools=""
Juan Quintela67f86e82009-08-03 14:46:59 +0200290audio_pt_int=""
malcd5631632009-10-10 01:13:41 +0400291audio_win_int=""
Michael Roth957f1f92011-08-11 15:38:12 -0500292libs_qga=""
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100293debug_info="yes"
Steven Noonan63678e12014-03-28 17:19:02 +0100294stack_protector=""
aliguoriac0df512008-12-29 17:14:15 +0000295
Daniel P. Berrange92712822017-09-29 11:11:58 +0100296if test -e "$source_path/.git"
297then
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +0100298 git_update=yes
Daniel P. Berrange92712822017-09-29 11:11:58 +0100299 git_submodules="ui/keycodemapdb"
300else
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +0100301 git_update=no
Daniel P. Berrange92712822017-09-29 11:11:58 +0100302 git_submodules=""
303fi
Daniel P. Berrangecc84d632017-10-20 15:02:43 +0100304git="git"
aliguoriac0df512008-12-29 17:14:15 +0000305
Stefan Weilafb63eb2012-09-26 22:04:38 +0200306# Don't accept a target_list environment variable.
307unset target_list
Paolo Bonzini377529c2010-12-23 11:43:50 +0100308
309# Default value for a variable defining feature "foo".
310# * foo="no" feature will only be used if --enable-foo arg is given
311# * foo="" feature will be searched for, and if found, will be used
312# unless --disable-foo is given
313# * foo="yes" this value will only be set by --enable-foo flag.
314# feature will searched for,
315# if not found, configure exits with error
316#
317# Always add --enable-foo and --disable-foo command line args.
318# Distributions want to ensure that several features are compiled in, and it
319# is impossible without a --enable-foo that exits if a feature is not found.
320
321bluez=""
322brlapi=""
323curl=""
324curses=""
325docs=""
326fdt=""
Vincenzo Maffione58952132013-11-06 11:44:06 +0100327netmap="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100328sdl=""
Cole Robinsonee8466d2016-05-06 14:03:07 -0400329sdlabi=""
Meador Inge983eef52012-02-24 14:00:42 +0530330virtfs=""
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +0200331mpath=""
Jes Sorensen821601e2011-03-16 13:33:36 +0100332vnc="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100333sparse="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100334vde=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100335vnc_sasl=""
336vnc_jpeg=""
337vnc_png=""
Gerd Hoffmann6a021532017-10-05 17:33:28 +0200338xkbcommon=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100339xen=""
Anthony PERARDd5b93dd2011-02-25 16:20:34 +0000340xen_ctrl_version=""
Ian Campbell64a7ad62016-01-15 13:23:44 +0000341xen_pv_domain_build="no"
Anthony PERARDeb6fda02012-06-21 15:32:59 +0000342xen_pci_passthrough=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100343linux_aio=""
Corey Bryant47e98652012-01-26 09:42:26 -0500344cap_ng=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100345attr=""
Avi Kivity4f26f2b2011-11-09 14:44:52 +0200346libattr=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100347xfs=""
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +0200348tcg="yes"
Paolo Bonzinia40161c2018-02-16 10:05:23 +0100349membarrier=""
Bradd41a75a2011-07-26 23:11:26 -0400350vhost_net="no"
Gonglei042cea22018-03-01 21:46:28 +0800351vhost_crypto="no"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000352vhost_scsi="no"
Stefan Hajnoczifc0b9b02016-08-16 13:27:22 +0100353vhost_vsock="no"
Marc-André Lureaue6a74862017-08-03 11:07:46 +0200354vhost_user=""
Bradd41a75a2011-07-26 23:11:26 -0400355kvm="no"
Vincent Palatinb0cb0a62017-01-10 11:59:57 +0100356hax="no"
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -0500357hvf="no"
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -0800358whpx="no"
Michael R. Hines2da776d2013-07-22 10:01:54 -0400359rdma=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100360gprof="no"
361debug_tcg="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100362debug="no"
Marc-André Lureau247724c2018-01-16 16:11:51 +0100363sanitizers="no"
John Snowb553a042015-11-03 15:43:42 -0500364fortify_source=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100365strip_opt="yes"
Stefan Weil9195b2c2011-10-19 07:07:18 +0200366tcg_interpreter="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100367bigendian="no"
368mingw32="no"
Blue Swirl1d728c32012-05-01 18:45:39 +0000369gcov="no"
370gcov_tool="gcov"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100371EXESUF=""
Fam Zheng17969262014-02-10 14:48:56 +0800372DSOSUF=".so"
373LDFLAGS_SHARED="-shared"
374modules="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100375prefix="/usr/local"
376mandir="\${prefix}/share/man"
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300377datadir="\${prefix}/share"
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +0200378firmwarepath="\${prefix}/share/qemu-firmware"
Eduardo Habkost850da182012-04-18 16:55:38 -0300379qemu_docdir="\${prefix}/share/doc/qemu"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100380bindir="\${prefix}/bin"
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300381libdir="\${prefix}/lib"
Michael Tokarev8bf188a2012-06-07 01:11:00 +0400382libexecdir="\${prefix}/libexec"
Alon Levy0f94d6d2011-06-27 11:58:20 +0200383includedir="\${prefix}/include"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100384sysconfdir="\${prefix}/etc"
Luiz Capitulino785c23a2012-10-03 18:35:57 -0300385local_statedir="\${prefix}/var"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100386confsuffix="/qemu"
387slirp="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100388oss_lib=""
389bsd="no"
390linux="no"
391solaris="no"
392profiler="no"
393cocoa="no"
394softmmu="yes"
395linux_user="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100396bsd_user="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100397blobs="yes"
398pkgversion=""
Avi Kivity40d64442011-11-15 20:12:17 +0200399pie=""
Paolo Bonzini3556c232013-05-10 14:16:40 +0200400qom_cast_debug="yes"
Paolo Bonzinibaf86d62016-01-07 16:55:31 +0300401trace_backends="log"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100402trace_file="trace"
403spice=""
404rbd=""
Marc-André Lureau7b02f542015-08-30 11:48:40 +0200405smartcard=""
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +0100406libusb=""
Hans de Goede69354a82011-07-19 11:04:10 +0200407usb_redir=""
Gerd Hoffmannda076ff2014-11-20 09:49:44 +0100408opengl=""
Gerd Hoffmann014cb152015-12-03 12:56:34 +0100409opengl_dmabuf="no"
Richard Henderson5dd89902017-07-18 18:40:18 -1000410cpuid_h="no"
Liang Li99f2dbd2016-03-08 13:53:16 +0800411avx2_opt="no"
Alon Levy1ece9902011-07-26 12:30:40 +0300412zlib="yes"
Richard Henderson8ca80762017-09-14 09:41:12 -0700413capstone=""
Stefan Weilb25c9df2014-04-29 08:21:16 +0200414lzo=""
415snappy=""
Peter Wu6b383c02015-01-06 18:48:14 +0100416bzip2=""
Michael Tokareve8ef31a2013-07-31 14:22:07 +0400417guest_agent=""
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -0400418guest_agent_with_vss="no"
Michael Roth50cbebb2015-07-07 18:10:09 -0500419guest_agent_ntddscsi="no"
Yossi Hindin9dacf322015-05-06 14:57:40 +0300420guest_agent_msi=""
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -0400421vss_win32_sdk=""
422win_sdk="no"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +0100423want_tools="yes"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100424libiscsi=""
Peter Lieven6542aa92014-02-03 10:26:13 +0100425libnfs=""
Alex Barcelo519175a2012-02-28 12:25:50 +0100426coroutine=""
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +0200427coroutine_pool=""
Peter Lieven7d992e42016-09-27 11:58:45 +0200428debug_stack_usage="no"
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -0400429crypto_afalg="no"
Eduardo Otubof7945732012-08-14 18:44:05 -0300430seccomp=""
Bharata B Raoeb100392012-09-24 14:42:45 +0530431glusterfs=""
Jeff Codyd85fa9e2016-04-05 10:40:09 -0400432glusterfs_xlator_opt="no"
Bharata B Rao0c14fb42013-07-16 21:47:42 +0530433glusterfs_discard="no"
Niels de Vosdf3a4292017-05-28 12:01:14 +0530434glusterfs_fallocate="no"
Bharata B Rao7c815372013-12-21 14:51:25 +0530435glusterfs_zerofill="no"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -0600436gtk=""
Stefan Weil9e04c682014-05-17 16:29:18 +0200437gtkabi=""
Gerd Hoffmann925a0402015-05-26 12:26:21 +0200438gtk_gl="no"
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +0100439tls_priority="NORMAL"
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +0100440gnutls=""
Daniel P. Berrangeb917da42015-10-31 14:39:52 +0900441gnutls_rnd=""
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +0100442nettle=""
Daniel P. Berrangefff2f982016-03-29 15:47:51 +0100443nettle_kdf="no"
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +0100444gcrypt=""
Longpeng(Mike)1f923c72016-12-13 18:42:55 +0800445gcrypt_hmac="no"
Daniel P. Berrange37788f22015-10-14 13:14:04 +0100446gcrypt_kdf="no"
Stefan Weilbbbf9bf2014-02-19 07:04:34 +0100447vte=""
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +0200448virglrenderer=""
Cole Robinsone91c7932014-06-16 15:32:47 -0400449tpm="yes"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +0100450libssh2=""
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +0100451live_block_migration="yes"
Wanlong Gaoa99d57b2014-05-14 17:43:28 +0800452numa=""
Fam Zheng2847b462015-03-26 11:03:12 +0800453tcmalloc="no"
Alexandre Derumier7b01cb92015-06-19 12:56:58 +0200454jemalloc="no"
Changlong Xiea6b1d4c2016-07-27 15:01:48 +0800455replication="yes"
Ashish Mittalda92c3f2017-04-03 20:48:08 -0700456vxhs=""
Klim Kireeved279a02018-01-12 12:01:19 +0300457libxml2=""
Alex Bennée51a12b52018-04-04 14:24:39 +0100458docker="no"
Paolo Bonziniba59fb72018-06-13 14:23:08 +0200459debug_mutex="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100460
Alex Bennéed75402b2018-04-04 20:27:05 +0100461# cross compilers defaults, can be overridden with --cross-cc-ARCH
462cross_cc_aarch64="aarch64-linux-gnu-gcc"
Alex Bennéed422b2b2018-04-13 11:07:58 +0100463cross_cc_aarch64_be="$cross_cc_aarch64"
464cross_cc_cflags_aarch64_be="-mbig-endian"
Alex Bennéed75402b2018-04-04 20:27:05 +0100465cross_cc_arm="arm-linux-gnueabihf-gcc"
Alex Bennéed422b2b2018-04-13 11:07:58 +0100466cross_cc_cflags_armeb="-mbig-endian"
Alex Bennée716a5072018-04-10 12:19:40 +0100467cross_cc_i386="i386-pc-linux-gnu-gcc"
468cross_cc_cflags_i386=""
Alex Bennéed75402b2018-04-04 20:27:05 +0100469cross_cc_powerpc="powerpc-linux-gnu-gcc"
Alex Bennéed422b2b2018-04-13 11:07:58 +0100470cross_cc_powerpc="powerpc-linux-gnu-gcc"
Alex Bennéed75402b2018-04-04 20:27:05 +0100471
472enabled_cross_compilers=""
473
Peter Maydell898be3e2017-03-21 14:31:57 +0000474supported_cpu="no"
475supported_os="no"
Peter Maydellfb59dab2017-03-28 14:01:52 +0100476bogus_os="no"
Yang Zhong5a22ab72017-12-20 21:16:46 +0800477malloc_trim=""
Peter Maydell898be3e2017-03-21 14:31:57 +0000478
aliguoriac0df512008-12-29 17:14:15 +0000479# parse CC options first
480for opt do
Stefan Weil89138852016-05-16 15:10:20 +0200481 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
aliguoriac0df512008-12-29 17:14:15 +0000482 case "$opt" in
483 --cross-prefix=*) cross_prefix="$optarg"
484 ;;
Paolo Bonzini3d8df642010-12-23 11:43:48 +0100485 --cc=*) CC="$optarg"
aliguoriac0df512008-12-29 17:14:15 +0000486 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400487 --cxx=*) CXX="$optarg"
488 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100489 --source-path=*) source_path="$optarg"
490 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200491 --cpu=*) cpu="$optarg"
492 ;;
Alex Bennéede385282015-06-03 09:56:37 +0100493 --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200494 ;;
Bruno Dominguez11cde1c2017-06-06 14:07:47 +0100495 --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
Bruno Dominguez11cde1c2017-06-06 14:07:47 +0100496 ;;
Alex Bennéea4969e92015-06-03 14:22:41 +0100497 --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +0100498 EXTRA_LDFLAGS="$optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200499 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100500 --enable-debug-info) debug_info="yes"
501 ;;
502 --disable-debug-info) debug_info="no"
503 ;;
Alex Bennéed75402b2018-04-04 20:27:05 +0100504 --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option"
505 ;;
Alex Bennéed422b2b2018-04-13 11:07:58 +0100506 --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*}
507 eval "cross_cc_cflags_${cc_arch}=\$optarg"
508 ;;
Alex Bennéed75402b2018-04-04 20:27:05 +0100509 --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
510 eval "cross_cc_${cc_arch}=\$optarg"
511 ;;
aliguoriac0df512008-12-29 17:14:15 +0000512 esac
513done
aliguoriac0df512008-12-29 17:14:15 +0000514# OS specific
515# Using uname is really, really broken. Once we have the right set of checks
Stefan Weil93148aa2012-02-26 18:46:12 +0100516# we can eliminate its usage altogether.
aliguoriac0df512008-12-29 17:14:15 +0000517
Peter Maydelle49d0212012-12-07 15:39:13 +0000518# Preferred compiler:
519# ${CC} (if set)
520# ${cross_prefix}gcc (if cross-prefix specified)
521# system compiler
522if test -z "${CC}${cross_prefix}"; then
523 cc="$host_cc"
524else
525 cc="${CC-${cross_prefix}gcc}"
526fi
527
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400528if test -z "${CXX}${cross_prefix}"; then
529 cxx="c++"
530else
531 cxx="${CXX-${cross_prefix}g++}"
532fi
533
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500534ar="${AR-${cross_prefix}ar}"
Richard Hendersoncdbd7272016-07-07 21:49:36 -0700535as="${AS-${cross_prefix}as}"
Richard Henderson5f6f0e22016-06-23 10:39:18 -0700536ccas="${CCAS-$cc}"
Blue Swirl3dd46c72013-01-05 10:10:27 +0000537cpp="${CPP-$cc -E}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500538objcopy="${OBJCOPY-${cross_prefix}objcopy}"
539ld="${LD-${cross_prefix}ld}"
Alistair Francis9f81aeb2017-11-07 17:10:46 -0800540ranlib="${RANLIB-${cross_prefix}ranlib}"
Stefan Weil4852ee92014-09-18 21:55:08 +0200541nm="${NM-${cross_prefix}nm}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500542strip="${STRIP-${cross_prefix}strip}"
543windres="${WINDRES-${cross_prefix}windres}"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300544pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
545query_pkg_config() {
546 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
547}
548pkg_config=query_pkg_config
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500549sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
Dave Airlie47c03742013-12-10 14:05:51 +1000550sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
aliguoriac0df512008-12-29 17:14:15 +0000551
Peter Maydell45d285a2013-10-21 21:03:06 +0100552# If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
553ARFLAGS="${ARFLAGS-rv}"
554
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200555# default flags for all hosts
Peter Maydell2d315152016-09-12 14:10:08 +0100556# We use -fwrapv to tell the compiler that we require a C dialect where
557# left shift of signed integers is well defined and has the expected
558# 2s-complement style results. (Both clang and gcc agree that it
559# provides these semantics.)
560QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
Mike Frysingerf9188222011-05-17 17:08:43 -0400561QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
Kevin Wolfc95e3082013-02-22 21:08:51 +0100562QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200563QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +0200564QEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg -iquote \$(SRC_PATH)/include"
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100565if test "$debug_info" = "yes"; then
566 CFLAGS="-g $CFLAGS"
567 LDFLAGS="-g $LDFLAGS"
568fi
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200569
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100570# make source path absolute
Stefan Weil89138852016-05-16 15:10:20 +0200571source_path=$(cd "$source_path"; pwd)
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100572
Michael S. Tsirkincab00a52014-04-28 15:09:01 +0300573# running configure in the source tree?
574# we know that's the case if configure is there.
575if test -f "./configure"; then
576 pwd_is_source_path="y"
577else
578 pwd_is_source_path="n"
579fi
580
aliguoriac0df512008-12-29 17:14:15 +0000581check_define() {
582cat > $TMPC <<EOF
583#if !defined($1)
Peter Maydellfd786e12011-11-23 17:26:43 +0000584#error $1 not defined
aliguoriac0df512008-12-29 17:14:15 +0000585#endif
586int main(void) { return 0; }
587EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200588 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000589}
590
Gerd Hoffmann307119e2015-06-10 09:07:35 +0200591check_include() {
592cat > $TMPC <<EOF
593#include <$1>
594int main(void) { return 0; }
595EOF
596 compile_object
597}
598
John Snow93b25862015-03-25 18:57:37 -0400599write_c_skeleton() {
600 cat > $TMPC <<EOF
601int main(void) { return 0; }
602EOF
603}
604
Peter Maydellbbea4052012-08-14 15:35:34 +0100605if check_define __linux__ ; then
606 targetos="Linux"
607elif check_define _WIN32 ; then
608 targetos='MINGW32'
609elif check_define __OpenBSD__ ; then
610 targetos='OpenBSD'
611elif check_define __sun__ ; then
612 targetos='SunOS'
613elif check_define __HAIKU__ ; then
614 targetos='Haiku'
Peter Maydell951fedf2017-07-13 16:15:32 +0100615elif check_define __FreeBSD__ ; then
616 targetos='FreeBSD'
617elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then
618 targetos='GNU/kFreeBSD'
619elif check_define __DragonFly__ ; then
620 targetos='DragonFly'
621elif check_define __NetBSD__; then
622 targetos='NetBSD'
623elif check_define __APPLE__; then
624 targetos='Darwin'
Peter Maydellbbea4052012-08-14 15:35:34 +0100625else
Peter Maydell951fedf2017-07-13 16:15:32 +0100626 # This is a fatal error, but don't report it yet, because we
627 # might be going to just print the --help text, or it might
628 # be the result of a missing compiler.
629 targetos='bogus'
630 bogus_os='yes'
Peter Maydellbbea4052012-08-14 15:35:34 +0100631fi
632
633# Some host OSes need non-standard checks for which CPU to use.
634# Note that these checks are broken for cross-compilation: if you're
635# cross-compiling to one of these OSes then you'll need to specify
636# the correct CPU with the --cpu option.
637case $targetos in
638Darwin)
639 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
640 # run 64-bit userspace code.
641 # If the user didn't specify a CPU explicitly and the kernel says this is
642 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
643 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
644 cpu="x86_64"
645 fi
646 ;;
647SunOS)
Stefan Weil89138852016-05-16 15:10:20 +0200648 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
Peter Maydellbbea4052012-08-14 15:35:34 +0100649 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
650 cpu="x86_64"
651 fi
652esac
653
Juan Quintela2ff6b912009-08-03 14:45:55 +0200654if test ! -z "$cpu" ; then
655 # command line argument
656 :
657elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000658 cpu="i386"
659elif check_define __x86_64__ ; then
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700660 if check_define __ILP32__ ; then
661 cpu="x32"
662 else
663 cpu="x86_64"
664 fi
blueswir13aa9bd62008-12-31 16:55:26 +0000665elif check_define __sparc__ ; then
blueswir13aa9bd62008-12-31 16:55:26 +0000666 if check_define __arch64__ ; then
667 cpu="sparc64"
668 else
669 cpu="sparc"
670 fi
malcfdf7ed92009-01-14 18:39:52 +0000671elif check_define _ARCH_PPC ; then
672 if check_define _ARCH_PPC64 ; then
673 cpu="ppc64"
674 else
675 cpu="ppc"
676 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200677elif check_define __mips__ ; then
678 cpu="mips"
Aurelien Jarnod66ed0e2010-06-13 12:28:21 +0200679elif check_define __s390__ ; then
680 if check_define __s390x__ ; then
681 cpu="s390x"
682 else
683 cpu="s390"
684 fi
Peter Maydell21d89f82011-11-30 10:57:48 +0100685elif check_define __arm__ ; then
686 cpu="arm"
Claudio Fontana1f080312013-06-12 16:20:23 +0100687elif check_define __aarch64__ ; then
688 cpu="aarch64"
aliguoriac0df512008-12-29 17:14:15 +0000689else
Stefan Weil89138852016-05-16 15:10:20 +0200690 cpu=$(uname -m)
aliguoriac0df512008-12-29 17:14:15 +0000691fi
692
Peter Maydell359bc952011-12-24 13:07:25 +0000693ARCH=
694# Normalise host CPU name and set ARCH.
695# Note that this case should only have supported host CPUs, not guests.
bellard7d132992003-03-06 23:23:54 +0000696case "$cpu" in
Peter Maydell6499fd12017-03-28 11:58:38 +0100697 ppc|ppc64|s390|s390x|sparc64|x32)
Peter Maydell898be3e2017-03-21 14:31:57 +0000698 cpu="$cpu"
699 supported_cpu="yes"
Alex Bennéed75402b2018-04-04 20:27:05 +0100700 eval "cross_cc_${cpu}=\$host_cc"
Peter Maydell898be3e2017-03-21 14:31:57 +0000701 ;;
bellard7d132992003-03-06 23:23:54 +0000702 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000703 cpu="i386"
Peter Maydell898be3e2017-03-21 14:31:57 +0000704 supported_cpu="yes"
Alex Bennéed75402b2018-04-04 20:27:05 +0100705 cross_cc_i386=$host_cc
bellard7d132992003-03-06 23:23:54 +0000706 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000707 x86_64|amd64)
708 cpu="x86_64"
Peter Maydell898be3e2017-03-21 14:31:57 +0000709 supported_cpu="yes"
Alex Bennéed75402b2018-04-04 20:27:05 +0100710 cross_cc_x86_64=$host_cc
aurel32aaa5fa12008-04-11 22:04:22 +0000711 ;;
Peter Maydell21d89f82011-11-30 10:57:48 +0100712 armv*b|armv*l|arm)
713 cpu="arm"
Peter Maydell898be3e2017-03-21 14:31:57 +0000714 supported_cpu="yes"
Alex Bennéed75402b2018-04-04 20:27:05 +0100715 cross_cc_arm=$host_cc
bellard7d132992003-03-06 23:23:54 +0000716 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +0100717 aarch64)
718 cpu="aarch64"
Peter Maydell898be3e2017-03-21 14:31:57 +0000719 supported_cpu="yes"
Alex Bennéed75402b2018-04-04 20:27:05 +0100720 cross_cc_aarch64=$host_cc
Claudio Fontana1f080312013-06-12 16:20:23 +0100721 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200722 mips*)
723 cpu="mips"
Peter Maydell898be3e2017-03-21 14:31:57 +0000724 supported_cpu="yes"
Alex Bennéed75402b2018-04-04 20:27:05 +0100725 cross_cc_mips=$host_cc
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200726 ;;
blueswir131422552007-04-16 18:27:06 +0000727 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000728 cpu="sparc"
Peter Maydell6499fd12017-03-28 11:58:38 +0100729 supported_cpu="yes"
Alex Bennéed75402b2018-04-04 20:27:05 +0100730 cross_cc_sparc=$host_cc
bellardae228532003-05-13 18:59:59 +0000731 ;;
bellard7d132992003-03-06 23:23:54 +0000732 *)
Peter Maydell359bc952011-12-24 13:07:25 +0000733 # This will result in either an error or falling back to TCI later
734 ARCH=unknown
bellard7d132992003-03-06 23:23:54 +0000735 ;;
736esac
Peter Maydell359bc952011-12-24 13:07:25 +0000737if test -z "$ARCH"; then
738 ARCH="$cpu"
739fi
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200740
bellard7d132992003-03-06 23:23:54 +0000741# OS specific
Juan Quintela0dbfc672009-08-03 14:46:13 +0200742
Stacey Sonadfc3e92014-06-08 09:57:22 -0700743# host *BSD for user mode
744HOST_VARIANT_DIR=""
745
bellard7d132992003-03-06 23:23:54 +0000746case $targetos in
bellard67b915a2004-03-31 23:37:16 +0000747MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200748 mingw32="yes"
Vincent Palatinb0cb0a62017-01-10 11:59:57 +0100749 hax="yes"
Kővágó, Zoltán3cec7cc2015-06-03 23:03:46 +0200750 audio_possible_drivers="dsound sdl"
Gerd Hoffmann307119e2015-06-10 09:07:35 +0200751 if check_include dsound.h; then
752 audio_drv_list="dsound"
753 else
754 audio_drv_list=""
755 fi
Peter Maydell898be3e2017-03-21 14:31:57 +0000756 supported_os="yes"
bellard67b915a2004-03-31 23:37:16 +0000757;;
ths5c40d2b2007-06-23 16:03:36 +0000758GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100759 bsd="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200760 audio_drv_list="oss"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200761 audio_possible_drivers="oss sdl pa"
ths5c40d2b2007-06-23 16:03:36 +0000762;;
bellard7d3505c2004-05-12 19:32:15 +0000763FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200764 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100765 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200766 audio_drv_list="oss"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200767 audio_possible_drivers="oss sdl pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100768 # needed for kinfo_getvmmap(3) in libutil.h
769 LIBS="-lutil $LIBS"
Ed Mastea7764f12016-11-21 20:32:45 -0500770 # needed for kinfo_getproc
771 libs_qga="-lutil $libs_qga"
Vincenzo Maffione58952132013-11-06 11:44:06 +0100772 netmap="" # enable netmap autodetect
Stacey Sonadfc3e92014-06-08 09:57:22 -0700773 HOST_VARIANT_DIR="freebsd"
Peter Maydell898be3e2017-03-21 14:31:57 +0000774 supported_os="yes"
bellard7d3505c2004-05-12 19:32:15 +0000775;;
blueswir1c5e97232009-03-07 20:06:23 +0000776DragonFly)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200777 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100778 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200779 audio_drv_list="oss"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200780 audio_possible_drivers="oss sdl pa"
Stacey Sonadfc3e92014-06-08 09:57:22 -0700781 HOST_VARIANT_DIR="dragonfly"
blueswir1c5e97232009-03-07 20:06:23 +0000782;;
bellard7d3505c2004-05-12 19:32:15 +0000783NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200784 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100785 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200786 audio_drv_list="oss"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200787 audio_possible_drivers="oss sdl"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200788 oss_lib="-lossaudio"
Stacey Sonadfc3e92014-06-08 09:57:22 -0700789 HOST_VARIANT_DIR="netbsd"
Kamil Rytarowski3c2bdbc2017-05-13 04:21:43 +0200790 supported_os="yes"
bellard7d3505c2004-05-12 19:32:15 +0000791;;
792OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200793 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100794 make="${MAKE-gmake}"
Brad Smith4f6ab392013-05-24 19:01:07 -0400795 audio_drv_list="sdl"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200796 audio_possible_drivers="sdl"
Stacey Sonadfc3e92014-06-08 09:57:22 -0700797 HOST_VARIANT_DIR="openbsd"
Brad Smith0a773d52018-02-16 11:46:20 -0500798 supported_os="yes"
bellard7d3505c2004-05-12 19:32:15 +0000799;;
bellard83fb7ad2004-07-05 21:25:26 +0000800Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200801 bsd="yes"
802 darwin="yes"
Vincent Palatinb0cb0a62017-01-10 11:59:57 +0100803 hax="yes"
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -0500804 hvf="yes"
Fam Zheng17969262014-02-10 14:48:56 +0800805 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200806 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200807 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200808 LDFLAGS="-arch x86_64 $LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200809 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200810 cocoa="yes"
811 audio_drv_list="coreaudio"
Kővágó, Zoltán14382602015-06-03 23:03:45 +0200812 audio_possible_drivers="coreaudio sdl"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200813 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200814 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
Peter Maydella0b7cf62012-08-11 22:34:39 +0100815 # Disable attempts to use ObjectiveC features in os/object.h since they
816 # won't work when we're compiling with gcc as a C compiler.
817 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
Stacey Sonadfc3e92014-06-08 09:57:22 -0700818 HOST_VARIANT_DIR="darwin"
Peter Maydell898be3e2017-03-21 14:31:57 +0000819 supported_os="yes"
bellard83fb7ad2004-07-05 21:25:26 +0000820;;
bellardec530c82006-04-25 22:36:06 +0000821SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200822 solaris="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100823 make="${MAKE-gmake}"
824 install="${INSTALL-ginstall}"
Brade2d88302011-09-02 16:53:28 -0400825 smbd="${SMBD-/usr/sfw/sbin/smbd}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200826 if test -f /usr/include/sys/soundcard.h ; then
827 audio_drv_list="oss"
828 fi
829 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000830# needed for CMSG_ macros in sys/socket.h
831 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
832# needed for TIOCWIN* defines in termios.h
833 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200834 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
Andreas Färber560d3752012-04-30 18:00:55 +0200835 solarisnetlibs="-lsocket -lnsl -lresolv"
836 LIBS="$solarisnetlibs $LIBS"
837 libs_qga="$solarisnetlibs $libs_qga"
ths86b2bd92007-02-11 00:31:33 +0000838;;
Andreas Färber179cf402010-09-20 00:50:43 +0200839Haiku)
840 haiku="yes"
841 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
842 LIBS="-lposix_error_mapper -lnetwork $LIBS"
843;;
Peter Maydell898be3e2017-03-21 14:31:57 +0000844Linux)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200845 audio_drv_list="oss"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200846 audio_possible_drivers="oss alsa sdl pa"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200847 linux="yes"
848 linux_user="yes"
Jan Kiszkaaf2be202011-06-23 10:05:12 +0200849 kvm="yes"
850 vhost_net="yes"
Gonglei042cea22018-03-01 21:46:28 +0800851 vhost_crypto="yes"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000852 vhost_scsi="yes"
Stefan Hajnoczifc0b9b02016-08-16 13:27:22 +0100853 vhost_vsock="yes"
Alexey Kardashevskiya5851402013-05-29 23:30:43 +1000854 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
Peter Maydell898be3e2017-03-21 14:31:57 +0000855 supported_os="yes"
856;;
bellard7d132992003-03-06 23:23:54 +0000857esac
858
bellard7d3505c2004-05-12 19:32:15 +0000859if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000860 if [ "$darwin" != "yes" ] ; then
Andreas Färber08de3942012-04-26 11:57:39 +0200861 bsd_user="yes"
bellard83fb7ad2004-07-05 21:25:26 +0000862 fi
bellard7d3505c2004-05-12 19:32:15 +0000863fi
864
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100865: ${make=${MAKE-make}}
866: ${install=${INSTALL-install}}
Stefan Weil52510f82013-11-14 19:07:03 +0100867: ${python=${PYTHON-python}}
Brade2d88302011-09-02 16:53:28 -0400868: ${smbd=${SMBD-/usr/sbin/smbd}}
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100869
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100870# Default objcc to clang if available, otherwise use CC
871if has clang; then
872 objcc=clang
873else
874 objcc="$cc"
875fi
876
Juan Quintela3457a3f2009-08-03 14:46:07 +0200877if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +0200878 EXESUF=".exe"
Fam Zheng17969262014-02-10 14:48:56 +0800879 DSOSUF=".dll"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200880 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
Stefan Weile94a7932010-02-12 11:02:08 +0100881 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
882 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
Stefan Weil78e9d4a2015-11-26 12:13:12 +0100883 # MinGW needs -mthreads for TLS and macro _MT.
884 QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
Stefan Weilf7cf5d52012-03-10 11:14:32 +0100885 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
John Snow93b25862015-03-25 18:57:37 -0400886 write_c_skeleton;
Stefan Weilf7cf5d52012-03-10 11:14:32 +0100887 if compile_prog "" "-liberty" ; then
888 LIBS="-liberty $LIBS"
889 fi
Stefan Weilc5ec15e2012-04-07 09:23:38 +0200890 prefix="c:/Program Files/QEMU"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200891 mandir="\${prefix}"
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300892 datadir="\${prefix}"
Eduardo Habkost850da182012-04-18 16:55:38 -0300893 qemu_docdir="\${prefix}"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200894 bindir="\${prefix}"
895 sysconfdir="\${prefix}"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +0200896 local_statedir=
Paolo Bonzini683035d2010-05-26 16:08:28 +0200897 confsuffix=""
Bishara AbuHattoum105fad62017-08-22 16:55:04 +0300898 libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga"
Juan Quintela3457a3f2009-08-03 14:46:07 +0200899fi
900
Anthony Liguori487fefd2009-06-11 13:28:25 -0500901werror=""
bellard85aa5182007-11-11 20:17:03 +0000902
bellard7d132992003-03-06 23:23:54 +0000903for opt do
Stefan Weil89138852016-05-16 15:10:20 +0200904 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
bellard7d132992003-03-06 23:23:54 +0000905 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000906 --help|-h) show_help=yes
907 ;;
Mike Frysinger99123e12011-04-07 01:12:28 -0400908 --version|-V) exec cat $source_path/VERSION
909 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000910 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000911 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000912 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000913 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100914 --source-path=*)
bellard7d132992003-03-06 23:23:54 +0000915 ;;
aliguoriac0df512008-12-29 17:14:15 +0000916 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000917 ;;
aliguoriac0df512008-12-29 17:14:15 +0000918 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000919 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000920 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000921 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400922 --cxx=*)
923 ;;
Michael S. Tsirkine007dbe2013-11-24 11:38:05 +0200924 --iasl=*) iasl="$optarg"
925 ;;
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100926 --objcc=*) objcc="$optarg"
927 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000928 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000929 ;;
pbrook6a882642006-04-17 13:57:12 +0000930 --install=*) install="$optarg"
931 ;;
Blue Swirlc886edf2011-07-22 21:08:09 +0000932 --python=*) python="$optarg"
933 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +0000934 --gcov=*) gcov_tool="$optarg"
935 ;;
Brade2d88302011-09-02 16:53:28 -0400936 --smbd=*) smbd="$optarg"
937 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200938 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000939 ;;
Bruno Dominguez11cde1c2017-06-06 14:07:47 +0100940 --extra-cxxflags=*)
941 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200942 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000943 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100944 --enable-debug-info)
945 ;;
946 --disable-debug-info)
947 ;;
Alex Bennéed75402b2018-04-04 20:27:05 +0100948 --cross-cc-*)
949 ;;
Fam Zheng17969262014-02-10 14:48:56 +0800950 --enable-modules)
951 modules="yes"
952 ;;
Stefan Hajnoczi3aa88b32015-11-02 14:06:23 +0000953 --disable-modules)
954 modules="no"
955 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200956 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000957 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000958 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000959 ;;
Lluís Vilanova5b808272014-05-27 15:02:14 +0200960 --enable-trace-backends=*) trace_backends="$optarg"
961 ;;
962 # XXX: backwards compatibility
963 --enable-trace-backend=*) trace_backends="$optarg"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +0100964 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100965 --with-trace-file=*) trace_file="$optarg"
Prerna Saxena9410b562010-07-13 09:26:32 +0100966 ;;
bellard7d132992003-03-06 23:23:54 +0000967 --enable-gprof) gprof="yes"
968 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +0000969 --enable-gcov) gcov="yes"
970 ;;
Loïc Minier79427692010-01-31 12:23:45 +0100971 --static)
972 static="yes"
973 LDFLAGS="-static $LDFLAGS"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300974 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
bellard43ce4df2003-06-09 19:53:12 +0000975 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200976 --mandir=*) mandir="$optarg"
977 ;;
978 --bindir=*) bindir="$optarg"
979 ;;
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300980 --libdir=*) libdir="$optarg"
981 ;;
Michael Tokarev8bf188a2012-06-07 01:11:00 +0400982 --libexecdir=*) libexecdir="$optarg"
983 ;;
Alon Levy0f94d6d2011-06-27 11:58:20 +0200984 --includedir=*) includedir="$optarg"
985 ;;
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300986 --datadir=*) datadir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200987 ;;
Eduardo Habkost023d3d62012-04-18 16:55:50 -0300988 --with-confsuffix=*) confsuffix="$optarg"
989 ;;
Eduardo Habkost850da182012-04-18 16:55:38 -0300990 --docdir=*) qemu_docdir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200991 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +0100992 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -0600993 ;;
Luiz Capitulino785c23a2012-10-03 18:35:57 -0300994 --localstatedir=*) local_statedir="$optarg"
995 ;;
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +0200996 --firmwarepath=*) firmwarepath="$optarg"
997 ;;
Olaf Hering181ce1d2018-04-18 09:50:44 +0200998 --host=*|--build=*|\
999 --disable-dependency-tracking|\
Luiz Capitulino785c23a2012-10-03 18:35:57 -03001000 --sbindir=*|--sharedstatedir=*|\
Max Filippov023ddd72011-11-24 16:11:31 +04001001 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
1002 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
1003 # These switches are silently ignored, for compatibility with
1004 # autoconf-generated configure scripts. This allows QEMU's
1005 # configure to be used by RPM and similar macros that set
1006 # lots of directory switches by default.
1007 ;;
bellard97a847b2003-08-10 21:36:04 +00001008 --disable-sdl) sdl="no"
1009 ;;
Juan Quintelac4198152009-08-12 18:29:53 +02001010 --enable-sdl) sdl="yes"
1011 ;;
Dave Airlie47c03742013-12-10 14:05:51 +10001012 --with-sdlabi=*) sdlabi="$optarg"
1013 ;;
Paolo Bonzini3556c232013-05-10 14:16:40 +02001014 --disable-qom-cast-debug) qom_cast_debug="no"
1015 ;;
1016 --enable-qom-cast-debug) qom_cast_debug="yes"
1017 ;;
Meador Inge983eef52012-02-24 14:00:42 +05301018 --disable-virtfs) virtfs="no"
1019 ;;
1020 --enable-virtfs) virtfs="yes"
1021 ;;
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02001022 --disable-mpath) mpath="no"
1023 ;;
1024 --enable-mpath) mpath="yes"
1025 ;;
Jes Sorensen821601e2011-03-16 13:33:36 +01001026 --disable-vnc) vnc="no"
1027 ;;
1028 --enable-vnc) vnc="yes"
1029 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +00001030 --oss-lib=*) oss_lib="$optarg"
1031 ;;
malc0c58ac12008-06-25 21:04:05 +00001032 --audio-drv-list=*) audio_drv_list="$optarg"
1033 ;;
Stefan Weil89138852016-05-16 15:10:20 +02001034 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
Fam Zhengb64ec4e2013-05-29 19:35:40 +08001035 ;;
Stefan Weil89138852016-05-16 15:10:20 +02001036 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
Markus Armbrustereb852012009-10-27 18:41:44 +01001037 ;;
aurel32f8393942009-04-13 18:45:38 +00001038 --enable-debug-tcg) debug_tcg="yes"
1039 ;;
1040 --disable-debug-tcg) debug_tcg="no"
1041 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +01001042 --enable-debug)
1043 # Enable debugging options that aren't excessively noisy
1044 debug_tcg="yes"
Peter Xu1fcc6d42018-04-25 10:54:59 +08001045 debug_mutex="yes"
Paul Brookf3d08ee2009-06-04 11:39:04 +01001046 debug="yes"
1047 strip_opt="no"
John Snowb553a042015-11-03 15:43:42 -05001048 fortify_source="no"
Paul Brookf3d08ee2009-06-04 11:39:04 +01001049 ;;
Marc-André Lureau247724c2018-01-16 16:11:51 +01001050 --enable-sanitizers) sanitizers="yes"
1051 ;;
1052 --disable-sanitizers) sanitizers="no"
1053 ;;
aliguori03b4fe72008-10-07 19:16:17 +00001054 --enable-sparse) sparse="yes"
1055 ;;
1056 --disable-sparse) sparse="no"
1057 ;;
aliguori1625af82009-04-05 17:41:02 +00001058 --disable-strip) strip_opt="no"
1059 ;;
aliguori2f9606b2009-03-06 20:27:28 +00001060 --disable-vnc-sasl) vnc_sasl="no"
1061 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +02001062 --enable-vnc-sasl) vnc_sasl="yes"
1063 ;;
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001064 --disable-vnc-jpeg) vnc_jpeg="no"
1065 ;;
1066 --enable-vnc-jpeg) vnc_jpeg="yes"
1067 ;;
Corentin Charyefe556a2010-07-07 20:57:56 +02001068 --disable-vnc-png) vnc_png="no"
1069 ;;
1070 --enable-vnc-png) vnc_png="yes"
1071 ;;
bellard443f1372004-06-04 11:13:20 +00001072 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +00001073 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +00001074 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +00001075 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +02001076 --enable-vde) vde="yes"
1077 ;;
Vincenzo Maffione58952132013-11-06 11:44:06 +01001078 --disable-netmap) netmap="no"
1079 ;;
1080 --enable-netmap) netmap="yes"
1081 ;;
aliguorie37630c2009-04-22 15:19:10 +00001082 --disable-xen) xen="no"
1083 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +02001084 --enable-xen) xen="yes"
1085 ;;
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001086 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
1087 ;;
1088 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
1089 ;;
Ian Campbell64a7ad62016-01-15 13:23:44 +00001090 --disable-xen-pv-domain-build) xen_pv_domain_build="no"
1091 ;;
1092 --enable-xen-pv-domain-build) xen_pv_domain_build="yes"
1093 ;;
aurel322e4d9fb2008-04-08 06:01:02 +00001094 --disable-brlapi) brlapi="no"
1095 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001096 --enable-brlapi) brlapi="yes"
1097 ;;
balrogfb599c92008-09-28 23:49:55 +00001098 --disable-bluez) bluez="no"
1099 ;;
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001100 --enable-bluez) bluez="yes"
1101 ;;
aliguori7ba1e612008-11-05 16:04:33 +00001102 --disable-kvm) kvm="no"
1103 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +02001104 --enable-kvm) kvm="yes"
1105 ;;
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01001106 --disable-hax) hax="no"
zhanghailiang180fb752016-10-27 14:43:08 +08001107 ;;
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01001108 --enable-hax) hax="yes"
zhanghailiang180fb752016-10-27 14:43:08 +08001109 ;;
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05001110 --disable-hvf) hvf="no"
1111 ;;
1112 --enable-hvf) hvf="yes"
1113 ;;
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08001114 --disable-whpx) whpx="no"
1115 ;;
1116 --enable-whpx) whpx="yes"
1117 ;;
Stefan Weil9195b2c2011-10-19 07:07:18 +02001118 --disable-tcg-interpreter) tcg_interpreter="no"
1119 ;;
1120 --enable-tcg-interpreter) tcg_interpreter="yes"
1121 ;;
Corey Bryant47e98652012-01-26 09:42:26 -05001122 --disable-cap-ng) cap_ng="no"
1123 ;;
1124 --enable-cap-ng) cap_ng="yes"
1125 ;;
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +02001126 --disable-tcg) tcg="no"
1127 ;;
1128 --enable-tcg) tcg="yes"
1129 ;;
Yang Zhong5a22ab72017-12-20 21:16:46 +08001130 --disable-malloc-trim) malloc_trim="no"
1131 ;;
1132 --enable-malloc-trim) malloc_trim="yes"
1133 ;;
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01001134 --disable-spice) spice="no"
1135 ;;
1136 --enable-spice) spice="yes"
1137 ;;
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11001138 --disable-libiscsi) libiscsi="no"
1139 ;;
1140 --enable-libiscsi) libiscsi="yes"
1141 ;;
Peter Lieven6542aa92014-02-03 10:26:13 +01001142 --disable-libnfs) libnfs="no"
1143 ;;
1144 --enable-libnfs) libnfs="yes"
1145 ;;
bellard05c2a3e2006-02-08 22:39:17 +00001146 --enable-profiler) profiler="yes"
1147 ;;
Pavel Borzenkov14821032011-11-10 22:40:07 +04001148 --disable-cocoa) cocoa="no"
1149 ;;
malcc2de5c92008-06-28 19:13:06 +00001150 --enable-cocoa)
1151 cocoa="yes" ;
Stefan Weil89138852016-05-16 15:10:20 +02001152 audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
bellard1d14ffa2005-10-30 18:58:22 +00001153 ;;
pbrookcad25d62006-03-19 16:31:11 +00001154 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +00001155 ;;
pbrookcad25d62006-03-19 16:31:11 +00001156 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +00001157 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -10001158 --disable-user)
1159 linux_user="no" ;
1160 bsd_user="no" ;
Zachary Amsden0953a802009-07-30 00:14:59 -10001161 ;;
1162 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +00001163 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +00001164 ;;
ths831b7822007-01-18 20:06:33 +00001165 --enable-linux-user) linux_user="yes"
1166 ;;
blueswir184778502008-10-26 20:33:16 +00001167 --disable-bsd-user) bsd_user="no"
1168 ;;
1169 --enable-bsd-user) bsd_user="yes"
1170 ;;
Avi Kivity40d64442011-11-15 20:12:17 +02001171 --enable-pie) pie="yes"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03001172 ;;
Avi Kivity40d64442011-11-15 20:12:17 +02001173 --disable-pie) pie="no"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03001174 ;;
bellard85aa5182007-11-11 20:17:03 +00001175 --enable-werror) werror="yes"
1176 ;;
1177 --disable-werror) werror="no"
1178 ;;
Steven Noonan63678e12014-03-28 17:19:02 +01001179 --enable-stack-protector) stack_protector="yes"
1180 ;;
1181 --disable-stack-protector) stack_protector="no"
1182 ;;
balrog4d3b6f62008-02-10 16:33:14 +00001183 --disable-curses) curses="no"
1184 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +02001185 --enable-curses) curses="yes"
1186 ;;
Alexander Graf769ce762009-05-11 17:41:42 +02001187 --disable-curl) curl="no"
1188 ;;
Juan Quintela788c8192009-08-12 18:29:47 +02001189 --enable-curl) curl="yes"
1190 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +02001191 --disable-fdt) fdt="no"
1192 ;;
1193 --enable-fdt) fdt="yes"
1194 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001195 --disable-linux-aio) linux_aio="no"
1196 ;;
1197 --enable-linux-aio) linux_aio="yes"
1198 ;;
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07001199 --disable-attr) attr="no"
1200 ;;
1201 --enable-attr) attr="yes"
1202 ;;
Paolo Bonzinia40161c2018-02-16 10:05:23 +01001203 --disable-membarrier) membarrier="no"
1204 ;;
1205 --enable-membarrier) membarrier="yes"
1206 ;;
ths77755342008-11-27 15:45:16 +00001207 --disable-blobs) blobs="no"
1208 ;;
Thomas Huth7e563bf2018-02-15 12:06:47 +01001209 --with-pkgversion=*) pkgversion="$optarg"
pbrook4a19f1e2009-04-07 23:17:49 +00001210 ;;
Alex Barcelo519175a2012-02-28 12:25:50 +01001211 --with-coroutine=*) coroutine="$optarg"
1212 ;;
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02001213 --disable-coroutine-pool) coroutine_pool="no"
1214 ;;
1215 --enable-coroutine-pool) coroutine_pool="yes"
1216 ;;
Peter Lieven7d992e42016-09-27 11:58:45 +02001217 --enable-debug-stack-usage) debug_stack_usage="yes"
1218 ;;
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04001219 --enable-crypto-afalg) crypto_afalg="yes"
1220 ;;
1221 --disable-crypto-afalg) crypto_afalg="no"
1222 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +02001223 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -05001224 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +02001225 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +02001226 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +02001227 --disable-vhost-net) vhost_net="no"
1228 ;;
1229 --enable-vhost-net) vhost_net="yes"
1230 ;;
Gonglei042cea22018-03-01 21:46:28 +08001231 --disable-vhost-crypto) vhost_crypto="no"
1232 ;;
1233 --enable-vhost-crypto)
1234 vhost_crypto="yes"
1235 if test "$mingw32" = "yes"; then
1236 error_exit "vhost-crypto isn't available on win32"
1237 fi
1238 ;;
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00001239 --disable-vhost-scsi) vhost_scsi="no"
1240 ;;
1241 --enable-vhost-scsi) vhost_scsi="yes"
1242 ;;
Stefan Hajnoczifc0b9b02016-08-16 13:27:22 +01001243 --disable-vhost-vsock) vhost_vsock="no"
1244 ;;
1245 --enable-vhost-vsock) vhost_vsock="yes"
1246 ;;
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01001247 --disable-opengl) opengl="no"
Michael Walle20ff0752011-03-07 23:32:39 +01001248 ;;
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01001249 --enable-opengl) opengl="yes"
Michael Walle20ff0752011-03-07 23:32:39 +01001250 ;;
Christian Brunnerf27aaf42010-12-06 20:53:01 +01001251 --disable-rbd) rbd="no"
1252 ;;
1253 --enable-rbd) rbd="yes"
1254 ;;
Sergei Trofimovich8c84cf12012-01-24 20:42:40 +03001255 --disable-xfsctl) xfs="no"
1256 ;;
1257 --enable-xfsctl) xfs="yes"
1258 ;;
Marc-André Lureau7b02f542015-08-30 11:48:40 +02001259 --disable-smartcard) smartcard="no"
Robert Relyea111a38b2010-11-28 16:36:38 +02001260 ;;
Marc-André Lureau7b02f542015-08-30 11:48:40 +02001261 --enable-smartcard) smartcard="yes"
Robert Relyea111a38b2010-11-28 16:36:38 +02001262 ;;
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01001263 --disable-libusb) libusb="no"
1264 ;;
1265 --enable-libusb) libusb="yes"
1266 ;;
Hans de Goede69354a82011-07-19 11:04:10 +02001267 --disable-usb-redir) usb_redir="no"
1268 ;;
1269 --enable-usb-redir) usb_redir="yes"
1270 ;;
Alon Levy1ece9902011-07-26 12:30:40 +03001271 --disable-zlib-test) zlib="no"
1272 ;;
Stefan Weilb25c9df2014-04-29 08:21:16 +02001273 --disable-lzo) lzo="no"
1274 ;;
qiaonuohan607dacd2014-02-18 14:11:30 +08001275 --enable-lzo) lzo="yes"
1276 ;;
Stefan Weilb25c9df2014-04-29 08:21:16 +02001277 --disable-snappy) snappy="no"
1278 ;;
qiaonuohan607dacd2014-02-18 14:11:30 +08001279 --enable-snappy) snappy="yes"
1280 ;;
Peter Wu6b383c02015-01-06 18:48:14 +01001281 --disable-bzip2) bzip2="no"
1282 ;;
1283 --enable-bzip2) bzip2="yes"
1284 ;;
Michael Rothd138cee2011-08-01 14:52:57 -05001285 --enable-guest-agent) guest_agent="yes"
1286 ;;
1287 --disable-guest-agent) guest_agent="no"
1288 ;;
Yossi Hindin9dacf322015-05-06 14:57:40 +03001289 --enable-guest-agent-msi) guest_agent_msi="yes"
1290 ;;
1291 --disable-guest-agent-msi) guest_agent_msi="no"
1292 ;;
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04001293 --with-vss-sdk) vss_win32_sdk=""
1294 ;;
1295 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1296 ;;
1297 --without-vss-sdk) vss_win32_sdk="no"
1298 ;;
1299 --with-win-sdk) win_sdk=""
1300 ;;
1301 --with-win-sdk=*) win_sdk="$optarg"
1302 ;;
1303 --without-win-sdk) win_sdk="no"
1304 ;;
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01001305 --enable-tools) want_tools="yes"
1306 ;;
1307 --disable-tools) want_tools="no"
1308 ;;
Eduardo Otubof7945732012-08-14 18:44:05 -03001309 --enable-seccomp) seccomp="yes"
1310 ;;
1311 --disable-seccomp) seccomp="no"
1312 ;;
Bharata B Raoeb100392012-09-24 14:42:45 +05301313 --disable-glusterfs) glusterfs="no"
1314 ;;
1315 --enable-glusterfs) glusterfs="yes"
1316 ;;
Fam Zheng52b53c02014-09-10 14:17:51 +08001317 --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
1318 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01001319 ;;
Fam Zhengcb6414d2016-09-21 12:27:16 +08001320 --enable-vhdx|--disable-vhdx)
1321 echo "$0: $opt is obsolete, VHDX driver is always built" >&2
1322 ;;
Fam Zheng315d3182016-09-21 12:27:21 +08001323 --enable-uuid|--disable-uuid)
1324 echo "$0: $opt is obsolete, UUID support is always built" >&2
1325 ;;
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001326 --disable-gtk) gtk="no"
1327 ;;
1328 --enable-gtk) gtk="yes"
1329 ;;
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +01001330 --tls-priority=*) tls_priority="$optarg"
1331 ;;
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01001332 --disable-gnutls) gnutls="no"
1333 ;;
1334 --enable-gnutls) gnutls="yes"
1335 ;;
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01001336 --disable-nettle) nettle="no"
1337 ;;
1338 --enable-nettle) nettle="yes"
1339 ;;
1340 --disable-gcrypt) gcrypt="no"
1341 ;;
1342 --enable-gcrypt) gcrypt="yes"
1343 ;;
Michael R. Hines2da776d2013-07-22 10:01:54 -04001344 --enable-rdma) rdma="yes"
1345 ;;
1346 --disable-rdma) rdma="no"
1347 ;;
Daniel P. Berrange528de902013-02-25 15:20:44 +00001348 --with-gtkabi=*) gtkabi="$optarg"
1349 ;;
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01001350 --disable-vte) vte="no"
1351 ;;
1352 --enable-vte) vte="yes"
1353 ;;
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +02001354 --disable-virglrenderer) virglrenderer="no"
1355 ;;
1356 --enable-virglrenderer) virglrenderer="yes"
1357 ;;
Cole Robinsone91c7932014-06-16 15:32:47 -04001358 --disable-tpm) tpm="no"
1359 ;;
Stefan Bergerab214c22013-02-27 12:47:52 -05001360 --enable-tpm) tpm="yes"
1361 ;;
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01001362 --disable-libssh2) libssh2="no"
1363 ;;
1364 --enable-libssh2) libssh2="yes"
1365 ;;
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +01001366 --disable-live-block-migration) live_block_migration="no"
1367 ;;
1368 --enable-live-block-migration) live_block_migration="yes"
1369 ;;
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08001370 --disable-numa) numa="no"
1371 ;;
1372 --enable-numa) numa="yes"
1373 ;;
Klim Kireeved279a02018-01-12 12:01:19 +03001374 --disable-libxml2) libxml2="no"
1375 ;;
1376 --enable-libxml2) libxml2="yes"
1377 ;;
Fam Zheng2847b462015-03-26 11:03:12 +08001378 --disable-tcmalloc) tcmalloc="no"
1379 ;;
1380 --enable-tcmalloc) tcmalloc="yes"
1381 ;;
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02001382 --disable-jemalloc) jemalloc="no"
1383 ;;
1384 --enable-jemalloc) jemalloc="yes"
1385 ;;
Changlong Xiea6b1d4c2016-07-27 15:01:48 +08001386 --disable-replication) replication="no"
1387 ;;
1388 --enable-replication) replication="yes"
1389 ;;
Ashish Mittalda92c3f2017-04-03 20:48:08 -07001390 --disable-vxhs) vxhs="no"
1391 ;;
1392 --enable-vxhs) vxhs="yes"
1393 ;;
Marc-André Lureaue6a74862017-08-03 11:07:46 +02001394 --disable-vhost-user) vhost_user="no"
1395 ;;
1396 --enable-vhost-user)
1397 vhost_user="yes"
1398 if test "$mingw32" = "yes"; then
1399 error_exit "vhost-user isn't available on win32"
1400 fi
1401 ;;
Richard Henderson8ca80762017-09-14 09:41:12 -07001402 --disable-capstone) capstone="no"
1403 ;;
1404 --enable-capstone) capstone="yes"
1405 ;;
Richard Hendersone219c492017-09-28 09:01:23 -07001406 --enable-capstone=git) capstone="git"
1407 ;;
1408 --enable-capstone=system) capstone="system"
1409 ;;
Daniel P. Berrangecc84d632017-10-20 15:02:43 +01001410 --with-git=*) git="$optarg"
1411 ;;
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +01001412 --enable-git-update) git_update=yes
1413 ;;
1414 --disable-git-update) git_update=no
1415 ;;
Paolo Bonziniba59fb72018-06-13 14:23:08 +02001416 --enable-debug-mutex) debug_mutex=yes
1417 ;;
1418 --disable-debug-mutex) debug_mutex=no
1419 ;;
Fam Zheng2d2ad6d2014-04-18 14:55:36 +08001420 *)
1421 echo "ERROR: unknown option $opt"
1422 echo "Try '$0 --help' for more information"
1423 exit 1
balrog7f1559c2007-11-17 10:24:32 +00001424 ;;
bellard7d132992003-03-06 23:23:54 +00001425 esac
1426done
1427
Marc-André Lureaue6a74862017-08-03 11:07:46 +02001428if test "$vhost_user" = ""; then
1429 if test "$mingw32" = "yes"; then
1430 vhost_user="no"
1431 else
1432 vhost_user="yes"
1433 fi
1434fi
1435
bellard40293e52008-01-31 11:32:10 +00001436case "$cpu" in
Richard Hendersone3608d62013-08-28 15:48:21 -07001437 ppc)
1438 CPU_CFLAGS="-m32"
1439 LDFLAGS="-m32 $LDFLAGS"
Alex Bennée13a5abe2018-04-13 16:15:07 +01001440 cross_cc_powerpc=$cc
1441 cross_cc_cflags_powerpc=$CPU_CFLAGS
Richard Hendersone3608d62013-08-28 15:48:21 -07001442 ;;
1443 ppc64)
1444 CPU_CFLAGS="-m64"
1445 LDFLAGS="-m64 $LDFLAGS"
Alex Bennée13a5abe2018-04-13 16:15:07 +01001446 cross_cc_ppc64=$cc
1447 cross_cc_cflags_ppc64=$CPU_CFLAGS
Richard Hendersone3608d62013-08-28 15:48:21 -07001448 ;;
Richard Henderson9b9c37c2012-09-21 10:34:21 -07001449 sparc)
Richard Hendersonf1079bb2017-04-26 10:39:08 -07001450 CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc"
1451 LDFLAGS="-m32 -mv8plus $LDFLAGS"
Alex Bennée13a5abe2018-04-13 16:15:07 +01001452 cross_cc_sparc=$cc
1453 cross_cc_cflags_sparc=$CPU_CFLAGS
blueswir131422552007-04-16 18:27:06 +00001454 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +02001455 sparc64)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001456 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
Richard Hendersonf1079bb2017-04-26 10:39:08 -07001457 LDFLAGS="-m64 $LDFLAGS"
Alex Bennée13a5abe2018-04-13 16:15:07 +01001458 cross_cc_sparc64=$cc
1459 cross_cc_cflags_sparc64=$CPU_CFLAGS
blueswir131422552007-04-16 18:27:06 +00001460 ;;
ths76d83bd2007-11-18 21:22:10 +00001461 s390)
Richard Henderson061cdd82014-03-31 13:40:49 -04001462 CPU_CFLAGS="-m31"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001463 LDFLAGS="-m31 $LDFLAGS"
Alex Bennée13a5abe2018-04-13 16:15:07 +01001464 cross_cc_s390=$cc
1465 cross_cc_cflags_s390=$CPU_CFLAGS
Richard Henderson28d7cc42010-06-04 12:14:09 -07001466 ;;
1467 s390x)
Richard Henderson061cdd82014-03-31 13:40:49 -04001468 CPU_CFLAGS="-m64"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001469 LDFLAGS="-m64 $LDFLAGS"
Alex Bennée13a5abe2018-04-13 16:15:07 +01001470 cross_cc_s390x=$cc
1471 cross_cc_cflags_s390x=$CPU_CFLAGS
ths76d83bd2007-11-18 21:22:10 +00001472 ;;
bellard40293e52008-01-31 11:32:10 +00001473 i386)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001474 CPU_CFLAGS="-m32"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001475 LDFLAGS="-m32 $LDFLAGS"
Alex Bennée716a5072018-04-10 12:19:40 +01001476 cross_cc_i386=$cc
1477 cross_cc_cflags_i386=$CPU_CFLAGS
bellard40293e52008-01-31 11:32:10 +00001478 ;;
1479 x86_64)
Richard Henderson7ebee432016-06-29 21:10:59 -07001480 # ??? Only extremely old AMD cpus do not have cmpxchg16b.
1481 # If we truly care, we should simply detect this case at
1482 # runtime and generate the fallback to serial emulation.
1483 CPU_CFLAGS="-m64 -mcx16"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001484 LDFLAGS="-m64 $LDFLAGS"
Alex Bennée716a5072018-04-10 12:19:40 +01001485 cross_cc_x86_64=$cc
1486 cross_cc_cflags_x86_64=$CPU_CFLAGS
Paul Brook379f6692009-07-17 12:48:08 +01001487 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001488 x32)
1489 CPU_CFLAGS="-mx32"
1490 LDFLAGS="-mx32 $LDFLAGS"
Alex Bennée716a5072018-04-10 12:19:40 +01001491 cross_cc_i386=$cc
Alex Bennée13a5abe2018-04-13 16:15:07 +01001492 cross_cc_cflags_i386=$CPU_CFLAGS
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001493 ;;
Peter Maydell30163d82012-10-09 03:16:49 +00001494 # No special flags required for other host CPUs
blueswir131422552007-04-16 18:27:06 +00001495esac
1496
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001497QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001498
Peter Maydellaffc88c2016-06-13 11:32:24 +01001499# For user-mode emulation the host arch has to be one we explicitly
1500# support, even if we're using TCI.
1501if [ "$ARCH" = "unknown" ]; then
1502 bsd_user="no"
1503 linux_user="no"
1504fi
1505
Peter Maydell60e0df22011-05-03 14:50:13 +01001506default_target_list=""
1507
Peter Maydell6e92f822013-05-20 16:16:15 +01001508mak_wilds=""
1509
1510if [ "$softmmu" = "yes" ]; then
1511 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001512fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001513if [ "$linux_user" = "yes" ]; then
1514 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001515fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001516if [ "$bsd_user" = "yes" ]; then
1517 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001518fi
1519
Peter Maydell6e92f822013-05-20 16:16:15 +01001520for config in $mak_wilds; do
1521 default_target_list="${default_target_list} $(basename "$config" .mak)"
1522done
1523
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01001524# Enumerate public trace backends for --help output
Greg Kurz64a60472017-04-26 15:36:07 +02001525trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/'))
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01001526
pbrookaf5db582006-04-08 14:26:41 +00001527if test x"$show_help" = x"yes" ; then
1528cat << EOF
1529
1530Usage: configure [options]
1531Options: [defaults in brackets after descriptions]
1532
Stefan Weil08fb77e2013-12-18 22:09:39 +01001533Standard options:
1534 --help print this message
1535 --prefix=PREFIX install in PREFIX [$prefix]
1536 --interp-prefix=PREFIX where to find shared libraries, etc.
1537 use %M for cpu name [$interp_prefix]
1538 --target-list=LIST set target list (default: build everything)
1539$(echo Available targets: $default_target_list | \
1540 fold -s -w 53 | sed -e 's/^/ /')
1541
1542Advanced options (experts only):
1543 --source-path=PATH path of source code [$source_path]
1544 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1545 --cc=CC use C compiler CC [$cc]
1546 --iasl=IASL use ACPI compiler IASL [$iasl]
1547 --host-cc=CC use C compiler CC [$host_cc] for code run at
1548 build time
1549 --cxx=CXX use C++ compiler CXX [$cxx]
1550 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1551 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
Bruno Dominguez11cde1c2017-06-06 14:07:47 +01001552 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS
Stefan Weil08fb77e2013-12-18 22:09:39 +01001553 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
Alex Bennéed75402b2018-04-04 20:27:05 +01001554 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases
Alex Bennéed422b2b2018-04-13 11:07:58 +01001555 --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests
Stefan Weil08fb77e2013-12-18 22:09:39 +01001556 --make=MAKE use specified make [$make]
1557 --install=INSTALL use specified install [$install]
1558 --python=PYTHON use specified python [$python]
1559 --smbd=SMBD use specified smbd [$smbd]
Thomas Huthdb1b5f12018-03-27 17:09:30 +02001560 --with-git=GIT use specified git [$git]
Stefan Weil08fb77e2013-12-18 22:09:39 +01001561 --static enable static build [$static]
1562 --mandir=PATH install man pages in PATH
1563 --datadir=PATH install firmware in PATH$confsuffix
1564 --docdir=PATH install documentation in PATH$confsuffix
1565 --bindir=PATH install binaries in PATH
1566 --libdir=PATH install libraries in PATH
Thomas Huthdb1b5f12018-03-27 17:09:30 +02001567 --libexecdir=PATH install helper binaries in PATH
Stefan Weil08fb77e2013-12-18 22:09:39 +01001568 --sysconfdir=PATH install config in PATH$confsuffix
1569 --localstatedir=PATH install local state in PATH (set at runtime on win32)
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +02001570 --firmwarepath=PATH search PATH for firmware files
Fam Zhenge26110c2014-02-10 14:48:57 +08001571 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
Thomas Huthdb1b5f12018-03-27 17:09:30 +02001572 --with-pkgversion=VERS use specified string as sub-version of the package
Stefan Weil08fb77e2013-12-18 22:09:39 +01001573 --enable-debug enable common debug build options
Marc-André Lureau247724c2018-01-16 16:11:51 +01001574 --enable-sanitizers enable default sanitizers
Stefan Weil08fb77e2013-12-18 22:09:39 +01001575 --disable-strip disable stripping binaries
1576 --disable-werror disable compilation abort on warning
Steven Noonan63678e12014-03-28 17:19:02 +01001577 --disable-stack-protector disable compiler-provided stack protection
Stefan Weil08fb77e2013-12-18 22:09:39 +01001578 --audio-drv-list=LIST set audio drivers list:
1579 Available drivers: $audio_possible_drivers
1580 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1581 --block-drv-rw-whitelist=L
1582 set block driver read-write whitelist
1583 (affects only QEMU, not qemu-img)
1584 --block-drv-ro-whitelist=L
1585 set block driver read-only whitelist
1586 (affects only QEMU, not qemu-img)
Lluís Vilanova5b808272014-05-27 15:02:14 +02001587 --enable-trace-backends=B Set trace backend
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01001588 Available backends: $trace_backend_list
Stefan Weil08fb77e2013-12-18 22:09:39 +01001589 --with-trace-file=NAME Full PATH,NAME of file to store traces
1590 Default:trace-<pid>
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001591 --disable-slirp disable SLIRP userspace network connectivity
1592 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
Yang Zhong5a22ab72017-12-20 21:16:46 +08001593 --enable-malloc-trim enable libc malloc_trim() for memory optimization
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001594 --oss-lib path to OSS library
1595 --cpu=CPU Build for host CPU [$cpu]
Stefan Weil08fb77e2013-12-18 22:09:39 +01001596 --with-coroutine=BACKEND coroutine backend. Supported options:
Daniel P. Berrange33c53c52017-04-28 13:24:44 +01001597 ucontext, sigaltstack, windows
Stefan Weil08fb77e2013-12-18 22:09:39 +01001598 --enable-gcov enable test coverage analysis with gcov
1599 --gcov=GCOV use specified gcov [$gcov_tool]
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001600 --disable-blobs disable installing provided firmware blobs
1601 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1602 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +01001603 --tls-priority default TLS protocol/cipher priority string
Lin Mac12d66a2017-03-10 18:14:05 +08001604 --enable-gprof QEMU profiling with gprof
1605 --enable-profiler profiler support
1606 --enable-xen-pv-domain-build
1607 xen pv domain builder
1608 --enable-debug-stack-usage
1609 track the maximum stack usage of stacks created by qemu_alloc_stack
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001610
1611Optional features, enabled with --enable-FEATURE and
1612disabled with --disable-FEATURE, default is enabled if available:
1613
1614 system all system emulation targets
1615 user supported user emulation targets
1616 linux-user all linux usermode emulation targets
1617 bsd-user all BSD usermode emulation targets
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001618 docs build documentation
1619 guest-agent build the QEMU Guest Agent
1620 guest-agent-msi build guest agent Windows MSI installation package
1621 pie Position Independent Executables
1622 modules modules support
1623 debug-tcg TCG debugging (default is disabled)
1624 debug-info debugging information
1625 sparse sparse checker
1626
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01001627 gnutls GNUTLS cryptography support
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01001628 nettle nettle cryptography support
1629 gcrypt libgcrypt cryptography support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001630 sdl SDL UI
1631 --with-sdlabi select preferred SDL ABI 1.2 or 2.0
1632 gtk gtk UI
1633 --with-gtkabi select preferred GTK ABI 2.0 or 3.0
1634 vte vte support for the gtk UI
1635 curses curses UI
1636 vnc VNC UI support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001637 vnc-sasl SASL encryption for VNC server
1638 vnc-jpeg JPEG lossy compression for VNC server
1639 vnc-png PNG compression for VNC server
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001640 cocoa Cocoa UI (Mac OS X only)
1641 virtfs VirtFS
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02001642 mpath Multipath persistent reservation passthrough
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001643 xen xen backend driver support
Anthony PERARD70c292a2018-05-04 10:17:56 +01001644 xen-pci-passthrough PCI passthrough support for Xen
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001645 brlapi BrlAPI (Braile)
1646 curl curl connectivity
Paolo Bonzinia40161c2018-02-16 10:05:23 +01001647 membarrier membarrier system call (for Linux 4.14+ or Windows)
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001648 fdt fdt device tree
1649 bluez bluez stack connectivity
1650 kvm KVM acceleration support
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01001651 hax HAX acceleration support
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05001652 hvf Hypervisor.framework acceleration support
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08001653 whpx Windows Hypervisor Platform acceleration support
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02001654 rdma Enable RDMA-based migration and PVRDMA support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001655 vde support for vde network
1656 netmap support for netmap network
1657 linux-aio Linux AIO support
1658 cap-ng libcap-ng support
1659 attr attr and xattr support
1660 vhost-net vhost-net acceleration support
Gonglei042cea22018-03-01 21:46:28 +08001661 vhost-crypto vhost-crypto acceleration support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001662 spice spice
1663 rbd rados block device (rbd)
1664 libiscsi iscsi support
1665 libnfs nfs support
Marc-André Lureau7b02f542015-08-30 11:48:40 +02001666 smartcard smartcard support (libcacard)
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001667 libusb libusb (for usb passthrough)
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +01001668 live-block-migration Block migration in the main migration stream
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001669 usb-redir usb network redirection support
1670 lzo support of lzo compression library
1671 snappy support of snappy compression library
1672 bzip2 support of bzip2 compression library
1673 (for reading bzip2-compressed dmg images)
1674 seccomp seccomp support
1675 coroutine-pool coroutine freelist (better performance)
1676 glusterfs GlusterFS backend
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001677 tpm TPM support
1678 libssh2 ssh block device support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001679 numa libnuma support
Klim Kireeved279a02018-01-12 12:01:19 +03001680 libxml2 for Parallels image format
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001681 tcmalloc tcmalloc support
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02001682 jemalloc jemalloc support
Changlong Xiea6b1d4c2016-07-27 15:01:48 +08001683 replication replication support
Lin Mac12d66a2017-03-10 18:14:05 +08001684 vhost-vsock virtio sockets device support
1685 opengl opengl support
1686 virglrenderer virgl rendering support
1687 xfsctl xfsctl support
1688 qom-cast-debug cast debugging support
1689 tools build qemu-io, qemu-nbd and qemu-image tools
Ashish Mittalda92c3f2017-04-03 20:48:08 -07001690 vxhs Veritas HyperScale vDisk backend support
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04001691 crypto-afalg Linux AF_ALG crypto backend driver
Marc-André Lureaue6a74862017-08-03 11:07:46 +02001692 vhost-user vhost-user support
Richard Henderson8ca80762017-09-14 09:41:12 -07001693 capstone capstone disassembler support
Paolo Bonziniba59fb72018-06-13 14:23:08 +02001694 debug-mutex mutex debugging support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001695
1696NOTE: The object files are built at the place where configure is launched
pbrookaf5db582006-04-08 14:26:41 +00001697EOF
Fam Zheng2d2ad6d2014-04-18 14:55:36 +08001698exit 0
pbrookaf5db582006-04-08 14:26:41 +00001699fi
1700
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01001701if ! has $python; then
1702 error_exit "Python not found. Use --python=/path/to/python"
1703fi
1704
1705# Note that if the Python conditional here evaluates True we will exit
1706# with status 1 which is a shell 'false' value.
Eduardo Habkost7f2b5542018-06-08 11:30:26 -03001707if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then
1708 error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 is required." \
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01001709 "Use --python=/path/to/python to specify a supported Python."
1710fi
1711
1712# Suppress writing compiled files
1713python="$python -B"
1714
Daniel Henrique Barboza9aae6e52017-11-02 07:09:06 -02001715# Check that the C compiler works. Doing this here before testing
1716# the host CPU ensures that we had a valid CC to autodetect the
1717# $cpu var (and we should bail right here if that's not the case).
1718# It also allows the help message to be printed without a CC.
1719write_c_skeleton;
1720if compile_object ; then
1721 : C compiler works ok
1722else
1723 error_exit "\"$cc\" either does not exist or does not work"
1724fi
1725if ! compile_prog ; then
1726 error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
1727fi
1728
Peter Maydell359bc952011-12-24 13:07:25 +00001729# Now we have handled --enable-tcg-interpreter and know we're not just
1730# printing the help message, bail out if the host CPU isn't supported.
1731if test "$ARCH" = "unknown"; then
1732 if test "$tcg_interpreter" = "yes" ; then
1733 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
Peter Maydell359bc952011-12-24 13:07:25 +00001734 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001735 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
Peter Maydell359bc952011-12-24 13:07:25 +00001736 fi
1737fi
1738
Peter Maydell9c83ffd2014-02-25 18:27:49 +00001739# Consult white-list to determine whether to enable werror
1740# by default. Only enable by default for git builds
Peter Maydell9c83ffd2014-02-25 18:27:49 +00001741if test -z "$werror" ; then
1742 if test -d "$source_path/.git" -a \
Thomas Huthe4650c82016-06-08 10:13:26 +02001743 \( "$linux" = "yes" -o "$mingw32" = "yes" \) ; then
Peter Maydell9c83ffd2014-02-25 18:27:49 +00001744 werror="yes"
1745 else
1746 werror="no"
1747 fi
1748fi
1749
Peter Maydellfb59dab2017-03-28 14:01:52 +01001750if test "$bogus_os" = "yes"; then
1751 # Now that we know that we're not printing the help and that
1752 # the compiler works (so the results of the check_defines we used
1753 # to identify the OS are reliable), if we didn't recognize the
1754 # host OS we should stop now.
Peter Maydell951fedf2017-07-13 16:15:32 +01001755 error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
Peter Maydellfb59dab2017-03-28 14:01:52 +01001756fi
1757
Paolo Bonzini8d050952010-12-23 11:43:52 +01001758gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1759gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
Daniel P. Berrangeac7568b2017-02-06 11:29:53 +00001760gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
Pranith Kumar435405a2016-08-09 15:02:26 -04001761gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
Paolo Bonzinib98fcfd2017-07-11 10:08:55 +02001762gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags"
Peter Maydell71429092013-08-05 20:16:40 +01001763gcc_flags="-Wno-string-plus-int $gcc_flags"
Gerd Hoffmann0e39c4a2018-03-09 14:59:45 +01001764gcc_flags="-Wno-error=address-of-packed-member $gcc_flags"
Peter Maydell6ca026c2012-07-18 15:10:18 +01001765# Note that we do not add -Werror to gcc_flags here, because that would
1766# enable it for all configure tests. If a configure test failed due
1767# to -Werror this would just silently disable some features,
1768# so it's too error prone.
John Snow93b25862015-03-25 18:57:37 -04001769
1770cc_has_warning_flag() {
1771 write_c_skeleton;
1772
Peter Maydella1d29d62012-10-27 22:19:07 +01001773 # Use the positive sense of the flag when testing for -Wno-wombat
1774 # support (gcc will happily accept the -Wno- form of unknown
1775 # warning options).
John Snow93b25862015-03-25 18:57:37 -04001776 optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
1777 compile_prog "-Werror $optflag" ""
1778}
1779
1780for flag in $gcc_flags; do
1781 if cc_has_warning_flag $flag ; then
1782 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
Paolo Bonzini8d050952010-12-23 11:43:52 +01001783 fi
1784done
1785
Miroslav Rezanina3b463a32014-07-02 10:05:24 +02001786if test "$stack_protector" != "no"; then
Rodrigo Rebellofccd35a2015-11-12 12:04:28 -02001787 cat > $TMPC << EOF
1788int main(int argc, char *argv[])
1789{
1790 char arr[64], *p = arr, *c = argv[0];
1791 while (*c) {
1792 *p++ = *c++;
1793 }
1794 return 0;
1795}
1796EOF
Steven Noonan63678e12014-03-28 17:19:02 +01001797 gcc_flags="-fstack-protector-strong -fstack-protector-all"
Miroslav Rezanina3b463a32014-07-02 10:05:24 +02001798 sp_on=0
Steven Noonan63678e12014-03-28 17:19:02 +01001799 for flag in $gcc_flags; do
Peter Maydell590e5dd2014-04-11 17:13:52 +01001800 # We need to check both a compile and a link, since some compiler
1801 # setups fail only on a .c->.o compile and some only at link time
1802 if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
1803 compile_prog "-Werror $flag" ""; then
Steven Noonan63678e12014-03-28 17:19:02 +01001804 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
Miroslav Rezanina3b463a32014-07-02 10:05:24 +02001805 sp_on=1
Steven Noonan63678e12014-03-28 17:19:02 +01001806 break
1807 fi
1808 done
Miroslav Rezanina3b463a32014-07-02 10:05:24 +02001809 if test "$stack_protector" = yes; then
1810 if test $sp_on = 0; then
1811 error_exit "Stack protector not supported"
1812 fi
1813 fi
Marc-André Lureau37746c52013-02-25 23:31:12 +01001814fi
1815
Paolo Bonzini20bc94a2017-10-20 12:11:32 +02001816# Disable -Wmissing-braces on older compilers that warn even for
1817# the "universal" C zero initializer {0}.
1818cat > $TMPC << EOF
1819struct {
1820 int a[2];
1821} x = {0};
1822EOF
1823if compile_object "-Werror" "" ; then
1824 :
1825else
1826 QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces"
1827fi
1828
Paolo Bonzinicbdd1992012-11-28 09:40:23 +01001829# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1830# large functions that use global variables. The bug is in all releases of
1831# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1832# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1833cat > $TMPC << EOF
1834#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1835int main(void) { return 0; }
1836#else
1837#error No bug in this compiler.
1838#endif
1839EOF
1840if compile_prog "-Werror -fno-gcse" "" ; then
1841 TRANSLATE_OPT_CFLAGS=-fno-gcse
1842fi
1843
Avi Kivity40d64442011-11-15 20:12:17 +02001844if test "$static" = "yes" ; then
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01001845 if test "$modules" = "yes" ; then
1846 error_exit "static and modules are mutually incompatible"
1847 fi
Avi Kivity40d64442011-11-15 20:12:17 +02001848 if test "$pie" = "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001849 error_exit "static and pie are mutually incompatible"
Avi Kivity40d64442011-11-15 20:12:17 +02001850 else
1851 pie="no"
1852 fi
1853fi
1854
Emilio G. Cota768b7852015-04-29 13:09:02 +02001855# Unconditional check for compiler __thread support
1856 cat > $TMPC << EOF
1857static __thread int tls_var;
1858int main(void) { return tls_var; }
1859EOF
1860
1861if ! compile_prog "-Werror" "" ; then
1862 error_exit "Your compiler does not support the __thread specifier for " \
1863 "Thread-Local Storage (TLS). Please upgrade to a version that does."
1864fi
1865
Avi Kivity40d64442011-11-15 20:12:17 +02001866if test "$pie" = ""; then
1867 case "$cpu-$targetos" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001868 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
Avi Kivity40d64442011-11-15 20:12:17 +02001869 ;;
1870 *)
1871 pie="no"
1872 ;;
1873 esac
1874fi
1875
1876if test "$pie" != "no" ; then
1877 cat > $TMPC << EOF
Avi Kivity21d4a792011-11-23 11:24:25 +02001878
1879#ifdef __linux__
1880# define THREAD __thread
1881#else
1882# define THREAD
1883#endif
1884
1885static THREAD int tls_var;
1886
1887int main(void) { return tls_var; }
1888
Avi Kivity40d64442011-11-15 20:12:17 +02001889EOF
1890 if compile_prog "-fPIE -DPIE" "-pie"; then
1891 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1892 LDFLAGS="-pie $LDFLAGS"
1893 pie="yes"
1894 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1895 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1896 fi
1897 else
1898 if test "$pie" = "yes"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001899 error_exit "PIE not available due to missing toolchain support"
Avi Kivity40d64442011-11-15 20:12:17 +02001900 else
1901 echo "Disabling PIE due to missing toolchain support"
1902 pie="no"
1903 fi
1904 fi
Brad46eef332013-12-10 19:49:08 -05001905
Stefan Hajnoczie4a7b342015-03-25 18:57:36 -04001906 if compile_prog "-Werror -fno-pie" "-nopie"; then
Brad46eef332013-12-10 19:49:08 -05001907 CFLAGS_NOPIE="-fno-pie"
1908 LDFLAGS_NOPIE="-nopie"
1909 fi
Avi Kivity40d64442011-11-15 20:12:17 +02001910fi
1911
Paolo Bonzini09dada42013-04-17 16:26:47 +02001912##########################################
1913# __sync_fetch_and_and requires at least -march=i486. Many toolchains
1914# use i686 as default anyway, but for those that don't, an explicit
1915# specification is necessary
1916
1917if test "$cpu" = "i386"; then
1918 cat > $TMPC << EOF
1919static int sfaa(int *ptr)
1920{
1921 return __sync_fetch_and_and(ptr, 0);
1922}
1923
1924int main(void)
1925{
1926 int val = 42;
Stefan Weil1405b622013-05-11 21:46:58 +02001927 val = __sync_val_compare_and_swap(&val, 0, 1);
Paolo Bonzini09dada42013-04-17 16:26:47 +02001928 sfaa(&val);
1929 return val;
1930}
1931EOF
1932 if ! compile_prog "" "" ; then
1933 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1934 fi
1935fi
1936
1937#########################################
bellardec530c82006-04-25 22:36:06 +00001938# Solaris specific configure tool chain decisions
Paolo Bonzini09dada42013-04-17 16:26:47 +02001939
bellardec530c82006-04-25 22:36:06 +00001940if test "$solaris" = "yes" ; then
Loïc Minier6792aa12010-01-20 11:35:54 +01001941 if has $install; then
1942 :
1943 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001944 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1945 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1946 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
bellardec530c82006-04-25 22:36:06 +00001947 fi
Stefan Weil89138852016-05-16 15:10:20 +02001948 if test "$(path_of $install)" = "/usr/sbin/install" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001949 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1950 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1951 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
bellardec530c82006-04-25 22:36:06 +00001952 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001953 if has ar; then
1954 :
1955 else
bellardec530c82006-04-25 22:36:06 +00001956 if test -f /usr/ccs/bin/ar ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001957 error_exit "No path includes ar" \
1958 "Add /usr/ccs/bin to your path and rerun configure"
bellardec530c82006-04-25 22:36:06 +00001959 fi
Peter Maydell76ad07a2013-04-08 12:11:26 +01001960 error_exit "No path includes ar"
bellardec530c82006-04-25 22:36:06 +00001961 fi
ths5fafdf22007-09-16 21:08:06 +00001962fi
bellardec530c82006-04-25 22:36:06 +00001963
Stefan Weilafb63eb2012-09-26 22:04:38 +02001964if test -z "${target_list+xxx}" ; then
Paolo Bonzinid880a3b2017-07-03 16:58:28 +02001965 for target in $default_target_list; do
1966 supported_target $target 2>/dev/null && \
1967 target_list="$target_list $target"
1968 done
1969 target_list="${target_list# }"
Anthony Liguori121afa92012-09-14 08:17:03 -05001970else
Stefan Weil89138852016-05-16 15:10:20 +02001971 target_list=$(echo "$target_list" | sed -e 's/,/ /g')
Paolo Bonzinid880a3b2017-07-03 16:58:28 +02001972 for target in $target_list; do
1973 # Check that we recognised the target name; this allows a more
1974 # friendly error message than if we let it fall through.
1975 case " $default_target_list " in
1976 *" $target "*)
1977 ;;
1978 *)
1979 error_exit "Unknown target name '$target'"
1980 ;;
1981 esac
1982 supported_target $target || exit 1
1983 done
bellard5327cf42005-01-10 23:18:50 +00001984fi
Peter Maydell25b48332013-05-20 16:16:16 +01001985
Paolo Bonzinif55fe272010-05-26 16:08:17 +02001986# see if system emulation was really requested
1987case " $target_list " in
1988 *"-softmmu "*) softmmu=yes
1989 ;;
1990 *) softmmu=no
1991 ;;
1992esac
bellard5327cf42005-01-10 23:18:50 +00001993
Juan Quintela249247c2009-08-12 18:20:25 +02001994feature_not_found() {
1995 feature=$1
Stewart Smith21684af2014-01-24 12:39:10 +11001996 remedy=$2
Juan Quintela249247c2009-08-12 18:20:25 +02001997
Peter Maydell76ad07a2013-04-08 12:11:26 +01001998 error_exit "User requested feature $feature" \
Stewart Smith21684af2014-01-24 12:39:10 +11001999 "configure was not able to find it." \
2000 "$remedy"
Juan Quintela249247c2009-08-12 18:20:25 +02002001}
2002
bellard7d132992003-03-06 23:23:54 +00002003# ---
2004# big/little endian test
2005cat > $TMPC << EOF
Mike Frysinger61cc9192013-06-30 23:30:18 -04002006short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
2007short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
2008extern int foo(short *, short *);
2009int main(int argc, char *argv[]) {
2010 return foo(big_endian, little_endian);
bellard7d132992003-03-06 23:23:54 +00002011}
2012EOF
2013
Mike Frysinger61cc9192013-06-30 23:30:18 -04002014if compile_object ; then
Alice Frosi12f15c92018-01-30 14:38:28 +01002015 if strings -a $TMPO | grep -q BiGeNdIaN ; then
Mike Frysinger61cc9192013-06-30 23:30:18 -04002016 bigendian="yes"
Alice Frosi12f15c92018-01-30 14:38:28 +01002017 elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
Mike Frysinger61cc9192013-06-30 23:30:18 -04002018 bigendian="no"
2019 else
2020 echo big/little test failed
Peter Maydell21d89f82011-11-30 10:57:48 +01002021 fi
Mike Frysinger61cc9192013-06-30 23:30:18 -04002022else
2023 echo big/little test failed
bellard7d132992003-03-06 23:23:54 +00002024fi
2025
Juan Quintelab0a47e72009-08-12 18:29:49 +02002026##########################################
Peter Maydella30878e2015-08-14 16:10:52 +01002027# cocoa implies not SDL or GTK
2028# (the cocoa UI code currently assumes it is always the active UI
2029# and doesn't interact well with other UI frontend code)
2030if test "$cocoa" = "yes"; then
2031 if test "$sdl" = "yes"; then
2032 error_exit "Cocoa and SDL UIs cannot both be enabled at once"
2033 fi
2034 if test "$gtk" = "yes"; then
2035 error_exit "Cocoa and GTK UIs cannot both be enabled at once"
2036 fi
2037 gtk=no
2038 sdl=no
2039fi
2040
Eric Blake6b39b062016-10-11 10:46:23 -05002041# Some versions of Mac OS X incorrectly define SIZE_MAX
2042cat > $TMPC << EOF
2043#include <stdint.h>
2044#include <stdio.h>
2045int main(int argc, char *argv[]) {
2046 return printf("%zu", SIZE_MAX);
2047}
2048EOF
2049have_broken_size_max=no
2050if ! compile_object -Werror ; then
2051 have_broken_size_max=yes
2052fi
2053
Peter Maydella30878e2015-08-14 16:10:52 +01002054##########################################
Gonglei015a33b2014-07-01 20:58:08 +08002055# L2TPV3 probe
2056
2057cat > $TMPC <<EOF
2058#include <sys/socket.h>
Michael Tokarevbff6cb72014-08-01 23:20:24 +04002059#include <linux/ip.h>
Gonglei015a33b2014-07-01 20:58:08 +08002060int main(void) { return sizeof(struct mmsghdr); }
2061EOF
2062if compile_prog "" "" ; then
2063 l2tpv3=yes
2064else
2065 l2tpv3=no
2066fi
2067
2068##########################################
Daniel P. Berrange4d9310f2015-09-22 15:13:26 +01002069# MinGW / Mingw-w64 localtime_r/gmtime_r check
2070
2071if test "$mingw32" = "yes"; then
2072 # Some versions of MinGW / Mingw-w64 lack localtime_r
2073 # and gmtime_r entirely.
2074 #
2075 # Some versions of Mingw-w64 define a macro for
2076 # localtime_r/gmtime_r.
2077 #
2078 # Some versions of Mingw-w64 will define functions
2079 # for localtime_r/gmtime_r, but only if you have
2080 # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
2081 # though, unistd.h and pthread.h both define
2082 # that for you.
2083 #
2084 # So this #undef localtime_r and #include <unistd.h>
2085 # are not in fact redundant.
2086cat > $TMPC << EOF
2087#include <unistd.h>
2088#include <time.h>
2089#undef localtime_r
2090int main(void) { localtime_r(NULL, NULL); return 0; }
2091EOF
2092 if compile_prog "" "" ; then
2093 localtime_r="yes"
2094 else
2095 localtime_r="no"
2096 fi
2097fi
2098
2099##########################################
Stefan Weil779ab5e2012-12-16 11:29:45 +01002100# pkg-config probe
2101
2102if ! has "$pkg_config_exe"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002103 error_exit "pkg-config binary '$pkg_config_exe' not found"
Stefan Weil779ab5e2012-12-16 11:29:45 +01002104fi
2105
2106##########################################
Juan Quintelab0a47e72009-08-12 18:29:49 +02002107# NPTL probe
2108
Peter Maydell24cb36a2013-07-16 18:45:00 +01002109if test "$linux_user" = "yes"; then
Juan Quintelab0a47e72009-08-12 18:29:49 +02002110 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00002111#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00002112#include <linux/futex.h>
Stefan Weil182eacc2011-12-17 09:27:30 +01002113int main(void) {
pbrookbd0c5662008-05-29 14:34:11 +00002114#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
2115#error bork
2116#endif
Stefan Weil182eacc2011-12-17 09:27:30 +01002117 return 0;
pbrookbd0c5662008-05-29 14:34:11 +00002118}
2119EOF
Peter Maydell24cb36a2013-07-16 18:45:00 +01002120 if ! compile_object ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002121 feature_not_found "nptl" "Install glibc and linux kernel headers."
Juan Quintelab0a47e72009-08-12 18:29:49 +02002122 fi
pbrookbd0c5662008-05-29 14:34:11 +00002123fi
2124
Liang Li99f2dbd2016-03-08 13:53:16 +08002125#########################################
balrogac629222008-10-11 09:56:04 +00002126# zlib check
2127
Alon Levy1ece9902011-07-26 12:30:40 +03002128if test "$zlib" != "no" ; then
2129 cat > $TMPC << EOF
balrogac629222008-10-11 09:56:04 +00002130#include <zlib.h>
2131int main(void) { zlibVersion(); return 0; }
2132EOF
Alon Levy1ece9902011-07-26 12:30:40 +03002133 if compile_prog "" "-lz" ; then
2134 :
2135 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01002136 error_exit "zlib check failed" \
2137 "Make sure to have the zlib libs and headers installed."
Alon Levy1ece9902011-07-26 12:30:40 +03002138 fi
balrogac629222008-10-11 09:56:04 +00002139fi
Will Newtoneb0ecd52014-02-26 17:20:07 +00002140LIBS="$LIBS -lz"
balrogac629222008-10-11 09:56:04 +00002141
2142##########################################
qiaonuohan607dacd2014-02-18 14:11:30 +08002143# lzo check
2144
2145if test "$lzo" != "no" ; then
2146 cat > $TMPC << EOF
2147#include <lzo/lzo1x.h>
2148int main(void) { lzo_version(); return 0; }
2149EOF
2150 if compile_prog "" "-llzo2" ; then
Stefan Weilb25c9df2014-04-29 08:21:16 +02002151 libs_softmmu="$libs_softmmu -llzo2"
2152 lzo="yes"
qiaonuohan607dacd2014-02-18 14:11:30 +08002153 else
Stefan Weilb25c9df2014-04-29 08:21:16 +02002154 if test "$lzo" = "yes"; then
2155 feature_not_found "liblzo2" "Install liblzo2 devel"
2156 fi
2157 lzo="no"
qiaonuohan607dacd2014-02-18 14:11:30 +08002158 fi
qiaonuohan607dacd2014-02-18 14:11:30 +08002159fi
2160
2161##########################################
2162# snappy check
2163
2164if test "$snappy" != "no" ; then
2165 cat > $TMPC << EOF
2166#include <snappy-c.h>
2167int main(void) { snappy_max_compressed_length(4096); return 0; }
2168EOF
2169 if compile_prog "" "-lsnappy" ; then
Stefan Weilb25c9df2014-04-29 08:21:16 +02002170 libs_softmmu="$libs_softmmu -lsnappy"
2171 snappy="yes"
qiaonuohan607dacd2014-02-18 14:11:30 +08002172 else
Stefan Weilb25c9df2014-04-29 08:21:16 +02002173 if test "$snappy" = "yes"; then
2174 feature_not_found "libsnappy" "Install libsnappy devel"
2175 fi
2176 snappy="no"
qiaonuohan607dacd2014-02-18 14:11:30 +08002177 fi
qiaonuohan607dacd2014-02-18 14:11:30 +08002178fi
2179
2180##########################################
Peter Wu6b383c02015-01-06 18:48:14 +01002181# bzip2 check
2182
2183if test "$bzip2" != "no" ; then
2184 cat > $TMPC << EOF
2185#include <bzlib.h>
2186int main(void) { BZ2_bzlibVersion(); return 0; }
2187EOF
2188 if compile_prog "" "-lbz2" ; then
2189 bzip2="yes"
2190 else
2191 if test "$bzip2" = "yes"; then
2192 feature_not_found "libbzip2" "Install libbzip2 devel"
2193 fi
2194 bzip2="no"
2195 fi
2196fi
2197
2198##########################################
Eduardo Otubof7945732012-08-14 18:44:05 -03002199# libseccomp check
2200
2201if test "$seccomp" != "no" ; then
Andrew Jones693e5912015-09-30 11:59:18 -04002202 case "$cpu" in
2203 i386|x86_64)
dann frazierba060c52015-10-23 15:34:22 -06002204 libseccomp_minver="2.1.0"
Andrew Jones693e5912015-09-30 11:59:18 -04002205 ;;
James Hogan5ce43972016-04-08 14:16:34 +01002206 mips)
2207 libseccomp_minver="2.2.0"
2208 ;;
Andrew Jones693e5912015-09-30 11:59:18 -04002209 arm|aarch64)
2210 libseccomp_minver="2.2.3"
2211 ;;
Thomas Huth3aa35fc2017-09-14 12:36:03 +02002212 ppc|ppc64|s390x)
Michael Strosaker3e684452016-06-01 18:30:18 -05002213 libseccomp_minver="2.3.0"
2214 ;;
Andrew Jones693e5912015-09-30 11:59:18 -04002215 *)
2216 libseccomp_minver=""
2217 ;;
2218 esac
2219
2220 if test "$libseccomp_minver" != "" &&
2221 $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
Fam Zhengc3883e12017-09-07 16:53:16 +08002222 seccomp_cflags="$($pkg_config --cflags libseccomp)"
2223 seccomp_libs="$($pkg_config --libs libseccomp)"
Andrew Jones693e5912015-09-30 11:59:18 -04002224 seccomp="yes"
Eduardo Otubof7945732012-08-14 18:44:05 -03002225 else
Andrew Jones693e5912015-09-30 11:59:18 -04002226 if test "$seccomp" = "yes" ; then
2227 if test "$libseccomp_minver" != "" ; then
2228 feature_not_found "libseccomp" \
2229 "Install libseccomp devel >= $libseccomp_minver"
2230 else
2231 feature_not_found "libseccomp" \
2232 "libseccomp is not supported for host cpu $cpu"
2233 fi
2234 fi
2235 seccomp="no"
Eduardo Otubof7945732012-08-14 18:44:05 -03002236 fi
2237fi
2238##########################################
aliguorie37630c2009-04-22 15:19:10 +00002239# xen probe
2240
Juan Quintelafc321b42009-08-12 18:29:55 +02002241if test "$xen" != "no" ; then
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002242 # Check whether Xen library path is specified via --extra-ldflags to avoid
2243 # overriding this setting with pkg-config output. If not, try pkg-config
2244 # to obtain all needed flags.
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00002245
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002246 if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \
2247 $pkg_config --exists xencontrol ; then
2248 xen_ctrl_version="$(printf '%d%02d%02d' \
2249 $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
2250 xen=yes
2251 xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
2252 xen_pc="$xen_pc xenevtchn xendevicemodel"
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002253 if $pkg_config --exists xentoolcore; then
2254 xen_pc="$xen_pc xentoolcore"
2255 fi
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002256 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
2257 libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
2258 LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS"
2259 else
Stefan Weil50ced5b2011-12-17 09:27:39 +01002260
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002261 xen_libs="-lxenstore -lxenctrl -lxenguest"
Anthony PERARDd9506ca2017-05-11 12:35:42 +01002262 xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002263
2264 # First we test whether Xen headers and libraries are available.
2265 # If no, we are done and there is no Xen support.
2266 # If yes, more tests are run to detect the Xen version.
2267
2268 # Xen (any)
2269 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00002270#include <xenctrl.h>
Stefan Weil50ced5b2011-12-17 09:27:39 +01002271int main(void) {
2272 return 0;
2273}
2274EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002275 if ! compile_prog "" "$xen_libs" ; then
2276 # Xen not found
2277 if test "$xen" = "yes" ; then
2278 feature_not_found "xen" "Install xen devel"
2279 fi
2280 xen=no
Stefan Weil50ced5b2011-12-17 09:27:39 +01002281
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002282 # Xen unstable
2283 elif
2284 cat > $TMPC <<EOF &&
Ross Lagerwall2cbf8902017-10-23 10:27:27 +01002285#undef XC_WANT_COMPAT_DEVICEMODEL_API
2286#define __XEN_TOOLS__
2287#include <xendevicemodel.h>
Paul Durrantd3c49eb2018-05-15 17:40:53 +01002288#include <xenforeignmemory.h>
Ross Lagerwall2cbf8902017-10-23 10:27:27 +01002289int main(void) {
2290 xendevicemodel_handle *xd;
Paul Durrantd3c49eb2018-05-15 17:40:53 +01002291 xenforeignmemory_handle *xfmem;
Ross Lagerwall2cbf8902017-10-23 10:27:27 +01002292
2293 xd = xendevicemodel_open(0, 0);
2294 xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0);
2295
Paul Durrantd3c49eb2018-05-15 17:40:53 +01002296 xfmem = xenforeignmemory_open(0, 0);
2297 xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0);
2298
Ross Lagerwall2cbf8902017-10-23 10:27:27 +01002299 return 0;
2300}
2301EOF
2302 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
2303 then
2304 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
2305 xen_ctrl_version=41100
2306 xen=yes
2307 elif
2308 cat > $TMPC <<EOF &&
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002309#undef XC_WANT_COMPAT_MAP_FOREIGN_API
2310#include <xenforeignmemory.h>
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002311#include <xentoolcore.h>
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002312int main(void) {
2313 xenforeignmemory_handle *xfmem;
2314
2315 xfmem = xenforeignmemory_open(0, 0);
2316 xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0);
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002317 xentoolcore_restrict_all(0);
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002318
2319 return 0;
2320}
2321EOF
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002322 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002323 then
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002324 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002325 xen_ctrl_version=41000
2326 xen=yes
2327 elif
2328 cat > $TMPC <<EOF &&
Paul Durrantda8090c2017-03-07 10:55:33 +00002329#undef XC_WANT_COMPAT_DEVICEMODEL_API
2330#define __XEN_TOOLS__
2331#include <xendevicemodel.h>
2332int main(void) {
2333 xendevicemodel_handle *xd;
2334
2335 xd = xendevicemodel_open(0, 0);
2336 xendevicemodel_close(xd);
2337
2338 return 0;
2339}
2340EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002341 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
2342 then
2343 xen_stable_libs="-lxendevicemodel $xen_stable_libs"
2344 xen_ctrl_version=40900
2345 xen=yes
2346 elif
2347 cat > $TMPC <<EOF &&
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002348/*
2349 * If we have stable libs the we don't want the libxc compat
2350 * layers, regardless of what CFLAGS we may have been given.
Paulina Szubarczykb6eb9b42016-09-14 21:10:03 +02002351 *
2352 * Also, check if xengnttab_grant_copy_segment_t is defined and
2353 * grant copy operation is implemented.
2354 */
2355#undef XC_WANT_COMPAT_EVTCHN_API
2356#undef XC_WANT_COMPAT_GNTTAB_API
2357#undef XC_WANT_COMPAT_MAP_FOREIGN_API
2358#include <xenctrl.h>
2359#include <xenstore.h>
2360#include <xenevtchn.h>
2361#include <xengnttab.h>
2362#include <xenforeignmemory.h>
2363#include <stdint.h>
2364#include <xen/hvm/hvm_info_table.h>
2365#if !defined(HVM_MAX_VCPUS)
2366# error HVM_MAX_VCPUS not defined
2367#endif
2368int main(void) {
2369 xc_interface *xc = NULL;
2370 xenforeignmemory_handle *xfmem;
2371 xenevtchn_handle *xe;
2372 xengnttab_handle *xg;
2373 xen_domain_handle_t handle;
2374 xengnttab_grant_copy_segment_t* seg = NULL;
2375
2376 xs_daemon_open();
2377
2378 xc = xc_interface_open(0, 0, 0);
2379 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2380 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2381 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2382 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2383 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2384
2385 xfmem = xenforeignmemory_open(0, 0);
2386 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2387
2388 xe = xenevtchn_open(0, 0);
2389 xenevtchn_fd(xe);
2390
2391 xg = xengnttab_open(0, 0);
2392 xengnttab_grant_copy(xg, 0, seg);
2393
2394 return 0;
2395}
2396EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002397 compile_prog "" "$xen_libs $xen_stable_libs"
2398 then
2399 xen_ctrl_version=40800
2400 xen=yes
2401 elif
2402 cat > $TMPC <<EOF &&
Paulina Szubarczykb6eb9b42016-09-14 21:10:03 +02002403/*
2404 * If we have stable libs the we don't want the libxc compat
2405 * layers, regardless of what CFLAGS we may have been given.
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002406 */
2407#undef XC_WANT_COMPAT_EVTCHN_API
2408#undef XC_WANT_COMPAT_GNTTAB_API
2409#undef XC_WANT_COMPAT_MAP_FOREIGN_API
2410#include <xenctrl.h>
2411#include <xenstore.h>
2412#include <xenevtchn.h>
2413#include <xengnttab.h>
2414#include <xenforeignmemory.h>
2415#include <stdint.h>
2416#include <xen/hvm/hvm_info_table.h>
2417#if !defined(HVM_MAX_VCPUS)
2418# error HVM_MAX_VCPUS not defined
2419#endif
2420int main(void) {
2421 xc_interface *xc = NULL;
2422 xenforeignmemory_handle *xfmem;
2423 xenevtchn_handle *xe;
2424 xengnttab_handle *xg;
2425 xen_domain_handle_t handle;
2426
2427 xs_daemon_open();
2428
2429 xc = xc_interface_open(0, 0, 0);
2430 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2431 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2432 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2433 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2434 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2435
2436 xfmem = xenforeignmemory_open(0, 0);
2437 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2438
2439 xe = xenevtchn_open(0, 0);
2440 xenevtchn_fd(xe);
2441
2442 xg = xengnttab_open(0, 0);
2443 xengnttab_map_grant_ref(xg, 0, 0, 0);
2444
2445 return 0;
2446}
2447EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002448 compile_prog "" "$xen_libs $xen_stable_libs"
2449 then
2450 xen_ctrl_version=40701
2451 xen=yes
2452 elif
2453 cat > $TMPC <<EOF &&
Stefan Weil50ced5b2011-12-17 09:27:39 +01002454#include <xenctrl.h>
Roger Pau Monnecdadde32015-11-13 17:38:06 +00002455#include <stdint.h>
2456int main(void) {
2457 xc_interface *xc = NULL;
2458 xen_domain_handle_t handle;
2459 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2460 return 0;
2461}
2462EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002463 compile_prog "" "$xen_libs"
2464 then
2465 xen_ctrl_version=40700
2466 xen=yes
Roger Pau Monnecdadde32015-11-13 17:38:06 +00002467
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002468 # Xen 4.6
2469 elif
2470 cat > $TMPC <<EOF &&
Roger Pau Monnecdadde32015-11-13 17:38:06 +00002471#include <xenctrl.h>
Anthony PERARDe108a3c2012-06-21 11:44:35 +00002472#include <xenstore.h>
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00002473#include <stdint.h>
2474#include <xen/hvm/hvm_info_table.h>
2475#if !defined(HVM_MAX_VCPUS)
2476# error HVM_MAX_VCPUS not defined
2477#endif
2478int main(void) {
2479 xc_interface *xc;
2480 xs_daemon_open();
2481 xc = xc_interface_open(0, 0, 0);
2482 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2483 xc_gnttab_open(NULL, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01002484 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Stefano Stabellini8688e062012-04-17 17:04:18 +00002485 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
Jan Beulichd8b441a2015-07-24 03:38:28 -06002486 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
Konrad Rzeszutek Wilk20a544c2015-06-29 12:51:05 -04002487 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
Jan Beulichd8b441a2015-07-24 03:38:28 -06002488 return 0;
2489}
2490EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002491 compile_prog "" "$xen_libs"
2492 then
2493 xen_ctrl_version=40600
2494 xen=yes
Jan Beulichd8b441a2015-07-24 03:38:28 -06002495
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002496 # Xen 4.5
2497 elif
2498 cat > $TMPC <<EOF &&
Jan Beulichd8b441a2015-07-24 03:38:28 -06002499#include <xenctrl.h>
2500#include <xenstore.h>
2501#include <stdint.h>
2502#include <xen/hvm/hvm_info_table.h>
2503#if !defined(HVM_MAX_VCPUS)
2504# error HVM_MAX_VCPUS not defined
2505#endif
2506int main(void) {
2507 xc_interface *xc;
2508 xs_daemon_open();
2509 xc = xc_interface_open(0, 0, 0);
2510 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2511 xc_gnttab_open(NULL, 0);
2512 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2513 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
Paul Durrant3996e852015-01-20 11:06:19 +00002514 xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
2515 return 0;
2516}
2517EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002518 compile_prog "" "$xen_libs"
2519 then
2520 xen_ctrl_version=40500
2521 xen=yes
Paul Durrant3996e852015-01-20 11:06:19 +00002522
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002523 elif
2524 cat > $TMPC <<EOF &&
Paul Durrant3996e852015-01-20 11:06:19 +00002525#include <xenctrl.h>
2526#include <xenstore.h>
2527#include <stdint.h>
2528#include <xen/hvm/hvm_info_table.h>
2529#if !defined(HVM_MAX_VCPUS)
2530# error HVM_MAX_VCPUS not defined
2531#endif
2532int main(void) {
2533 xc_interface *xc;
2534 xs_daemon_open();
2535 xc = xc_interface_open(0, 0, 0);
2536 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2537 xc_gnttab_open(NULL, 0);
2538 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2539 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
Stefano Stabellini8688e062012-04-17 17:04:18 +00002540 return 0;
2541}
2542EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002543 compile_prog "" "$xen_libs"
2544 then
2545 xen_ctrl_version=40200
2546 xen=yes
Stefano Stabellini8688e062012-04-17 17:04:18 +00002547
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002548 else
2549 if test "$xen" = "yes" ; then
2550 feature_not_found "xen (unsupported version)" \
2551 "Install a supported xen (xen 4.2 or newer)"
2552 fi
2553 xen=no
Juan Quintelafc321b42009-08-12 18:29:55 +02002554 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00002555
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002556 if test "$xen" = yes; then
2557 if test $xen_ctrl_version -ge 40701 ; then
2558 libs_softmmu="$xen_stable_libs $libs_softmmu"
2559 fi
2560 libs_softmmu="$xen_libs $libs_softmmu"
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002561 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00002562 fi
aliguorie37630c2009-04-22 15:19:10 +00002563fi
2564
Anthony PERARDeb6fda02012-06-21 15:32:59 +00002565if test "$xen_pci_passthrough" != "no"; then
Ian Campbelledfb07e2016-02-10 11:07:01 +00002566 if test "$xen" = "yes" && test "$linux" = "yes"; then
Anthony PERARDeb6fda02012-06-21 15:32:59 +00002567 xen_pci_passthrough=yes
2568 else
2569 if test "$xen_pci_passthrough" = "yes"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002570 error_exit "User requested feature Xen PCI Passthrough" \
2571 " but this feature requires /sys from Linux"
Anthony PERARDeb6fda02012-06-21 15:32:59 +00002572 fi
2573 xen_pci_passthrough=no
2574 fi
2575fi
2576
Ian Campbell64a7ad62016-01-15 13:23:44 +00002577if test "$xen_pv_domain_build" = "yes" &&
2578 test "$xen" != "yes"; then
2579 error_exit "User requested Xen PV domain builder support" \
2580 "which requires Xen support."
2581fi
2582
aliguorie37630c2009-04-22 15:19:10 +00002583##########################################
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08002584# Windows Hypervisor Platform accelerator (WHPX) check
2585if test "$whpx" != "no" ; then
Lucian Petrut327fccb2018-05-15 20:35:21 +03002586 if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08002587 whpx="yes"
2588 else
2589 if test "$whpx" = "yes"; then
Justin Terry (VM) via Qemu-devel53537bb2018-02-26 09:13:29 -08002590 feature_not_found "WinHvPlatform" "WinHvEmulation is not installed"
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08002591 fi
2592 whpx="no"
2593 fi
2594fi
2595
2596##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02002597# Sparse probe
2598if test "$sparse" != "no" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00002599 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02002600 sparse=yes
2601 else
2602 if test "$sparse" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002603 feature_not_found "sparse" "Install sparse binary"
Juan Quinteladfffc652009-08-12 18:29:57 +02002604 fi
2605 sparse=no
2606 fi
2607fi
2608
2609##########################################
Jeremy Whitef676c672015-01-09 13:08:49 -06002610# X11 probe
Jeremy Whitef676c672015-01-09 13:08:49 -06002611if $pkg_config --exists "x11"; then
Gerd Hoffmann87815952018-03-01 11:05:42 +01002612 have_x11=yes
Stefan Weil89138852016-05-16 15:10:20 +02002613 x11_cflags=$($pkg_config --cflags x11)
2614 x11_libs=$($pkg_config --libs x11)
Jeremy Whitef676c672015-01-09 13:08:49 -06002615fi
2616
2617##########################################
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06002618# GTK probe
2619
2620if test "$gtk" != "no"; then
Peter Xu5a464e62018-04-09 16:23:23 +08002621 if test "$gtkabi" = ""; then
2622 # The GTK ABI was not specified explicitly, so try whether 3.0 is available.
2623 # Use 2.0 as a fallback if that is available.
2624 if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
2625 gtkabi=3.0
2626 elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
2627 gtkabi=2.0
2628 else
2629 gtkabi=3.0
2630 fi
2631 fi
Daniel P. Berrange528de902013-02-25 15:20:44 +00002632 gtkpackage="gtk+-$gtkabi"
Gerd Hoffmann0a337ed2014-05-28 22:33:06 +02002633 gtkx11package="gtk+-x11-$gtkabi"
Daniel P. Berrange528de902013-02-25 15:20:44 +00002634 if test "$gtkabi" = "3.0" ; then
2635 gtkversion="3.0.0"
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002636 else
2637 gtkversion="2.18.0"
2638 fi
2639 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
Stefan Weil89138852016-05-16 15:10:20 +02002640 gtk_cflags=$($pkg_config --cflags $gtkpackage)
2641 gtk_libs=$($pkg_config --libs $gtkpackage)
2642 gtk_version=$($pkg_config --modversion $gtkpackage)
Gerd Hoffmann0a337ed2014-05-28 22:33:06 +02002643 if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
Gerd Hoffmann87815952018-03-01 11:05:42 +01002644 need_x11=yes
Jeremy Whitef676c672015-01-09 13:08:49 -06002645 gtk_cflags="$gtk_cflags $x11_cflags"
2646 gtk_libs="$gtk_libs $x11_libs"
Gerd Hoffmann0a337ed2014-05-28 22:33:06 +02002647 fi
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002648 gtk="yes"
2649 elif test "$gtk" = "yes"; then
Gerd Hoffmann5fe309f2017-06-06 12:53:36 +02002650 feature_not_found "gtk" "Install gtk3-devel"
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002651 else
2652 gtk="no"
2653 fi
2654fi
2655
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01002656
2657##########################################
2658# GNUTLS probe
2659
Peter Maydell37371292015-07-24 18:28:08 +01002660gnutls_works() {
2661 # Unfortunately some distros have bad pkg-config information for gnutls
2662 # such that it claims to exist but you get a compiler error if you try
2663 # to use the options returned by --libs. Specifically, Ubuntu for --static
2664 # builds doesn't work:
2665 # https://bugs.launchpad.net/ubuntu/+source/gnutls26/+bug/1478035
2666 #
2667 # So sanity check the cflags/libs before assuming gnutls can be used.
2668 if ! $pkg_config --exists "gnutls"; then
2669 return 1
2670 fi
2671
2672 write_c_skeleton
2673 compile_prog "$($pkg_config --cflags gnutls)" "$($pkg_config --libs gnutls)"
2674}
2675
Daniel P. Berrange62893b62015-07-01 18:10:33 +01002676gnutls_gcrypt=no
Daniel P. Berrangeed754742015-07-01 18:10:34 +01002677gnutls_nettle=no
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01002678if test "$gnutls" != "no"; then
Peter Maydell37371292015-07-24 18:28:08 +01002679 if gnutls_works; then
Stefan Weil89138852016-05-16 15:10:20 +02002680 gnutls_cflags=$($pkg_config --cflags gnutls)
2681 gnutls_libs=$($pkg_config --libs gnutls)
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01002682 libs_softmmu="$gnutls_libs $libs_softmmu"
2683 libs_tools="$gnutls_libs $libs_tools"
2684 QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
2685 gnutls="yes"
2686
Daniel P. Berrangeb917da42015-10-31 14:39:52 +09002687 # gnutls_rnd requires >= 2.11.0
2688 if $pkg_config --exists "gnutls >= 2.11.0"; then
2689 gnutls_rnd="yes"
2690 else
2691 gnutls_rnd="no"
2692 fi
2693
Daniel P. Berrange62893b62015-07-01 18:10:33 +01002694 if $pkg_config --exists 'gnutls >= 3.0'; then
2695 gnutls_gcrypt=no
Daniel P. Berrangeed754742015-07-01 18:10:34 +01002696 gnutls_nettle=yes
Daniel P. Berrange62893b62015-07-01 18:10:33 +01002697 elif $pkg_config --exists 'gnutls >= 2.12'; then
Stefan Weil89138852016-05-16 15:10:20 +02002698 case $($pkg_config --libs --static gnutls) in
Daniel P. Berrangeed754742015-07-01 18:10:34 +01002699 *gcrypt*)
2700 gnutls_gcrypt=yes
2701 gnutls_nettle=no
2702 ;;
2703 *nettle*)
2704 gnutls_gcrypt=no
2705 gnutls_nettle=yes
2706 ;;
2707 *)
2708 gnutls_gcrypt=yes
2709 gnutls_nettle=no
2710 ;;
Daniel P. Berrange62893b62015-07-01 18:10:33 +01002711 esac
2712 else
2713 gnutls_gcrypt=yes
Daniel P. Berrangeed754742015-07-01 18:10:34 +01002714 gnutls_nettle=no
Daniel P. Berrange62893b62015-07-01 18:10:33 +01002715 fi
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01002716 elif test "$gnutls" = "yes"; then
2717 feature_not_found "gnutls" "Install gnutls devel"
2718 else
2719 gnutls="no"
Daniel P. Berrangeb917da42015-10-31 14:39:52 +09002720 gnutls_rnd="no"
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01002721 fi
2722else
Daniel P. Berrangeb917da42015-10-31 14:39:52 +09002723 gnutls_rnd="no"
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01002724fi
2725
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002726
2727# If user didn't give a --disable/enable-gcrypt flag,
2728# then mark as disabled if user requested nettle
2729# explicitly, or if gnutls links to nettle
2730if test -z "$gcrypt"
2731then
2732 if test "$nettle" = "yes" || test "$gnutls_nettle" = "yes"
2733 then
2734 gcrypt="no"
2735 fi
2736fi
2737
2738# If user didn't give a --disable/enable-nettle flag,
2739# then mark as disabled if user requested gcrypt
2740# explicitly, or if gnutls links to gcrypt
2741if test -z "$nettle"
2742then
2743 if test "$gcrypt" = "yes" || test "$gnutls_gcrypt" = "yes"
2744 then
2745 nettle="no"
2746 fi
2747fi
2748
2749has_libgcrypt_config() {
2750 if ! has "libgcrypt-config"
2751 then
2752 return 1
2753 fi
2754
2755 if test -n "$cross_prefix"
2756 then
Stefan Weil89138852016-05-16 15:10:20 +02002757 host=$(libgcrypt-config --host)
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002758 if test "$host-" != $cross_prefix
2759 then
2760 return 1
2761 fi
2762 fi
2763
2764 return 0
2765}
2766
2767if test "$gcrypt" != "no"; then
2768 if has_libgcrypt_config; then
Stefan Weil89138852016-05-16 15:10:20 +02002769 gcrypt_cflags=$(libgcrypt-config --cflags)
2770 gcrypt_libs=$(libgcrypt-config --libs)
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002771 # Debian has remove -lgpg-error from libgcrypt-config
2772 # as it "spreads unnecessary dependencies" which in
2773 # turn breaks static builds...
2774 if test "$static" = "yes"
2775 then
2776 gcrypt_libs="$gcrypt_libs -lgpg-error"
2777 fi
Daniel P. Berrange62893b62015-07-01 18:10:33 +01002778 libs_softmmu="$gcrypt_libs $libs_softmmu"
2779 libs_tools="$gcrypt_libs $libs_tools"
2780 QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002781 gcrypt="yes"
2782 if test -z "$nettle"; then
2783 nettle="no"
2784 fi
Daniel P. Berrange37788f22015-10-14 13:14:04 +01002785
2786 cat > $TMPC << EOF
2787#include <gcrypt.h>
2788int main(void) {
2789 gcry_kdf_derive(NULL, 0, GCRY_KDF_PBKDF2,
2790 GCRY_MD_SHA256,
2791 NULL, 0, 0, 0, NULL);
2792 return 0;
2793}
2794EOF
2795 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2796 gcrypt_kdf=yes
2797 fi
Longpeng(Mike)1f923c72016-12-13 18:42:55 +08002798
2799 cat > $TMPC << EOF
2800#include <gcrypt.h>
2801int main(void) {
2802 gcry_mac_hd_t handle;
2803 gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5,
2804 GCRY_MAC_FLAG_SECURE, NULL);
2805 return 0;
2806}
2807EOF
2808 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2809 gcrypt_hmac=yes
2810 fi
Daniel P. Berrange62893b62015-07-01 18:10:33 +01002811 else
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002812 if test "$gcrypt" = "yes"; then
2813 feature_not_found "gcrypt" "Install gcrypt devel"
2814 else
2815 gcrypt="no"
2816 fi
Daniel P. Berrange62893b62015-07-01 18:10:33 +01002817 fi
2818fi
2819
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01002820
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002821if test "$nettle" != "no"; then
Daniel P. Berrangeed754742015-07-01 18:10:34 +01002822 if $pkg_config --exists "nettle"; then
Stefan Weil89138852016-05-16 15:10:20 +02002823 nettle_cflags=$($pkg_config --cflags nettle)
2824 nettle_libs=$($pkg_config --libs nettle)
2825 nettle_version=$($pkg_config --modversion nettle)
Daniel P. Berrangeed754742015-07-01 18:10:34 +01002826 libs_softmmu="$nettle_libs $libs_softmmu"
2827 libs_tools="$nettle_libs $libs_tools"
2828 QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002829 nettle="yes"
Daniel P. Berrangefff2f982016-03-29 15:47:51 +01002830
2831 cat > $TMPC << EOF
Steven Luo9e87a692016-05-26 21:53:13 -07002832#include <stddef.h>
Daniel P. Berrangefff2f982016-03-29 15:47:51 +01002833#include <nettle/pbkdf2.h>
2834int main(void) {
2835 pbkdf2_hmac_sha256(8, NULL, 1000, 8, NULL, 8, NULL);
2836 return 0;
2837}
2838EOF
2839 if compile_prog "$nettle_cflags" "$nettle_libs" ; then
2840 nettle_kdf=yes
2841 fi
Daniel P. Berrangeed754742015-07-01 18:10:34 +01002842 else
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002843 if test "$nettle" = "yes"; then
2844 feature_not_found "nettle" "Install nettle devel"
2845 else
2846 nettle="no"
2847 fi
Daniel P. Berrangeed754742015-07-01 18:10:34 +01002848 fi
2849fi
2850
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002851if test "$gcrypt" = "yes" && test "$nettle" = "yes"
2852then
2853 error_exit "Only one of gcrypt & nettle can be enabled"
2854fi
2855
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01002856##########################################
2857# libtasn1 - only for the TLS creds/session test suite
2858
2859tasn1=yes
Daniel P. Berrange90246032015-09-21 17:25:34 +01002860tasn1_cflags=""
2861tasn1_libs=""
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01002862if $pkg_config --exists "libtasn1"; then
Stefan Weil89138852016-05-16 15:10:20 +02002863 tasn1_cflags=$($pkg_config --cflags libtasn1)
2864 tasn1_libs=$($pkg_config --libs libtasn1)
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01002865else
2866 tasn1=no
2867fi
2868
Daniel P. Berrangeed754742015-07-01 18:10:34 +01002869
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002870##########################################
Daniel P. Berrange559607e2015-02-27 16:19:33 +00002871# getifaddrs (for tests/test-io-channel-socket )
2872
2873have_ifaddrs_h=yes
2874if ! check_include "ifaddrs.h" ; then
2875 have_ifaddrs_h=no
2876fi
2877
2878##########################################
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002879# VTE probe
2880
2881if test "$vte" != "no"; then
2882 if test "$gtkabi" = "3.0"; then
Cole Robinsonc6feff92016-05-06 14:03:12 -04002883 vteminversion="0.32.0"
2884 if $pkg_config --exists "vte-2.91"; then
2885 vtepackage="vte-2.91"
2886 else
2887 vtepackage="vte-2.90"
2888 fi
Daniel P. Berrange528de902013-02-25 15:20:44 +00002889 else
Daniel P. Berrange528de902013-02-25 15:20:44 +00002890 vtepackage="vte"
Cole Robinsonc6feff92016-05-06 14:03:12 -04002891 vteminversion="0.24.0"
Daniel P. Berrange528de902013-02-25 15:20:44 +00002892 fi
Cole Robinsonc6feff92016-05-06 14:03:12 -04002893 if $pkg_config --exists "$vtepackage >= $vteminversion"; then
Stefan Weil89138852016-05-16 15:10:20 +02002894 vte_cflags=$($pkg_config --cflags $vtepackage)
2895 vte_libs=$($pkg_config --libs $vtepackage)
2896 vteversion=$($pkg_config --modversion $vtepackage)
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002897 vte="yes"
2898 elif test "$vte" = "yes"; then
Stefan Weil9e04c682014-05-17 16:29:18 +02002899 if test "$gtkabi" = "3.0"; then
Cole Robinsonc6feff92016-05-06 14:03:12 -04002900 feature_not_found "vte" "Install libvte-2.90/2.91 devel"
Stefan Weil9e04c682014-05-17 16:29:18 +02002901 else
2902 feature_not_found "vte" "Install libvte devel"
2903 fi
Peter Maydell0d185e62013-07-18 16:42:01 +01002904 else
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002905 vte="no"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06002906 fi
2907fi
2908
2909##########################################
bellard11d9f692004-04-02 20:55:59 +00002910# SDL probe
2911
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01002912# Look for sdl configuration program (pkg-config or sdl-config). Try
2913# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
Dave Airlie47c03742013-12-10 14:05:51 +10002914
Peter Xuc6093a02018-04-10 13:40:34 +08002915sdl_probe ()
2916{
2917 sdl_too_old=no
2918 if test "$sdlabi" = ""; then
2919 if $pkg_config --exists "sdl2"; then
2920 sdlabi=2.0
2921 elif $pkg_config --exists "sdl"; then
2922 sdlabi=1.2
2923 else
2924 sdlabi=2.0
2925 fi
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00002926 fi
bellard11d9f692004-04-02 20:55:59 +00002927
Peter Xuc6093a02018-04-10 13:40:34 +08002928 if test $sdlabi = "2.0"; then
2929 sdl_config=$sdl2_config
2930 sdlname=sdl2
2931 sdlconfigname=sdl2_config
2932 elif test $sdlabi = "1.2"; then
2933 sdlname=sdl
2934 sdlconfigname=sdl_config
2935 else
2936 error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0"
2937 fi
2938
2939 if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then
2940 sdl_config=$sdlconfigname
2941 fi
2942
2943 if $pkg_config $sdlname --exists; then
2944 sdlconfig="$pkg_config $sdlname"
2945 sdlversion=$($sdlconfig --modversion 2>/dev/null)
2946 elif has ${sdl_config}; then
2947 sdlconfig="$sdl_config"
2948 sdlversion=$($sdlconfig --version)
2949 else
2950 if test "$sdl" = "yes" ; then
2951 feature_not_found "sdl" "Install SDL2-devel"
2952 fi
2953 sdl=no
2954 # no need to do the rest
2955 return
2956 fi
2957 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
2958 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
2959 fi
2960
Juan Quintelaac119f92009-07-27 16:13:15 +02002961 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00002962#include <SDL.h>
2963#undef main /* We don't want SDL to override our main() */
2964int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
2965EOF
Stefan Weil89138852016-05-16 15:10:20 +02002966 sdl_cflags=$($sdlconfig --cflags 2>/dev/null)
Gerd Hoffmann2ca5c432018-03-07 16:42:57 +01002967 sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug
TeLeMan74f42e12010-02-08 13:56:44 +08002968 if test "$static" = "yes" ; then
Thomas Huth5f37e6d2017-06-13 20:00:44 +02002969 if $pkg_config $sdlname --exists; then
2970 sdl_libs=$($pkg_config $sdlname --static --libs 2>/dev/null)
2971 else
2972 sdl_libs=$($sdlconfig --static-libs 2>/dev/null)
2973 fi
TeLeMan74f42e12010-02-08 13:56:44 +08002974 else
Stefan Weil89138852016-05-16 15:10:20 +02002975 sdl_libs=$($sdlconfig --libs 2>/dev/null)
TeLeMan74f42e12010-02-08 13:56:44 +08002976 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02002977 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Stefan Weil89138852016-05-16 15:10:20 +02002978 if test $(echo $sdlversion | sed 's/[^0-9]//g') -lt 121 ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002979 sdl_too_old=yes
2980 else
Peter Maydella30878e2015-08-14 16:10:52 +01002981 sdl=yes
Juan Quintelaac119f92009-07-27 16:13:15 +02002982 fi
aliguoricd01b4a2008-08-21 19:25:45 +00002983
Paolo Bonzini67c274d2010-01-13 09:52:54 +01002984 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Juan Quintelaac119f92009-07-27 16:13:15 +02002985 if test "$sdl" = "yes" -a "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01002986 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weil89138852016-05-16 15:10:20 +02002987 sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)"
2988 sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)"
Juan Quintelaac119f92009-07-27 16:13:15 +02002989 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02002990 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002991 :
2992 else
2993 sdl=no
2994 fi
2995 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02002996 else # sdl not found
2997 if test "$sdl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002998 feature_not_found "sdl" "Install SDL devel"
Juan Quintelac4198152009-08-12 18:29:53 +02002999 fi
3000 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02003001 fi # sdl compile test
Peter Xuc6093a02018-04-10 13:40:34 +08003002}
3003
3004if test "$sdl" != "no" ; then
3005 sdl_probe
Juan Quintelaa68551b2009-07-27 16:13:09 +02003006fi
bellard11d9f692004-04-02 20:55:59 +00003007
aliguori5368a422009-03-03 17:37:21 +00003008if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02003009 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00003010#include <SDL.h>
3011#if defined(SDL_VIDEO_DRIVER_X11)
3012#include <X11/XKBlib.h>
3013#else
3014#error No x11 support
3015#endif
3016int main(void) { return 0; }
3017EOF
Jeremy Whitef676c672015-01-09 13:08:49 -06003018 if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then
Gerd Hoffmann87815952018-03-01 11:05:42 +01003019 need_x11=yes
Jeremy Whitef676c672015-01-09 13:08:49 -06003020 sdl_cflags="$sdl_cflags $x11_cflags"
3021 sdl_libs="$sdl_libs $x11_libs"
Juan Quintelaac119f92009-07-27 16:13:15 +02003022 fi
aliguori5368a422009-03-03 17:37:21 +00003023fi
3024
ths8f28f3f2007-01-05 21:25:54 +00003025##########################################
Michael R. Hines2da776d2013-07-22 10:01:54 -04003026# RDMA needs OpenFabrics libraries
3027if test "$rdma" != "no" ; then
3028 cat > $TMPC <<EOF
3029#include <rdma/rdma_cma.h>
3030int main(void) { return 0; }
3031EOF
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02003032 rdma_libs="-lrdmacm -libverbs -libumad"
Michael R. Hines2da776d2013-07-22 10:01:54 -04003033 if compile_prog "" "$rdma_libs" ; then
3034 rdma="yes"
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02003035 libs_softmmu="$libs_softmmu $rdma_libs"
Michael R. Hines2da776d2013-07-22 10:01:54 -04003036 else
3037 if test "$rdma" = "yes" ; then
3038 error_exit \
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02003039 " OpenFabrics librdmacm/libibverbs/libibumad not present." \
Michael R. Hines2da776d2013-07-22 10:01:54 -04003040 " Your options:" \
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02003041 " (1) Fast: Install infiniband packages (devel) from your distro." \
Michael R. Hines2da776d2013-07-22 10:01:54 -04003042 " (2) Cleanest: Install libraries from www.openfabrics.org" \
3043 " (3) Also: Install softiwarp if you don't have RDMA hardware"
3044 fi
3045 rdma="no"
3046 fi
3047fi
3048
ths8d5d2d42007-08-25 01:37:51 +00003049
3050##########################################
aliguori2f9606b2009-03-06 20:27:28 +00003051# VNC SASL detection
Jes Sorensen821601e2011-03-16 13:33:36 +01003052if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02003053 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00003054#include <sasl/sasl.h>
3055#include <stdio.h>
3056int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
3057EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02003058 # Assuming Cyrus-SASL installed in /usr prefix
3059 vnc_sasl_cflags=""
3060 vnc_sasl_libs="-lsasl2"
3061 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
3062 vnc_sasl=yes
3063 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01003064 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
Juan Quintelaea784e32009-08-12 18:20:29 +02003065 else
3066 if test "$vnc_sasl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003067 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
aliguori2f9606b2009-03-06 20:27:28 +00003068 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02003069 vnc_sasl=no
3070 fi
aliguori2f9606b2009-03-06 20:27:28 +00003071fi
3072
3073##########################################
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003074# VNC JPEG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01003075if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003076cat > $TMPC <<EOF
3077#include <stdio.h>
3078#include <jpeglib.h>
3079int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
3080EOF
3081 vnc_jpeg_cflags=""
3082 vnc_jpeg_libs="-ljpeg"
3083 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
3084 vnc_jpeg=yes
3085 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01003086 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003087 else
3088 if test "$vnc_jpeg" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003089 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003090 fi
3091 vnc_jpeg=no
3092 fi
3093fi
3094
3095##########################################
Corentin Charyefe556a2010-07-07 20:57:56 +02003096# VNC PNG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01003097if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02003098cat > $TMPC <<EOF
3099//#include <stdio.h>
3100#include <png.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003101#include <stddef.h>
Corentin Charyefe556a2010-07-07 20:57:56 +02003102int main(void) {
3103 png_structp png_ptr;
3104 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
Peter Maydell7edc3fe2012-07-18 15:10:24 +01003105 return png_ptr != 0;
Corentin Charyefe556a2010-07-07 20:57:56 +02003106}
3107EOF
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003108 if $pkg_config libpng --exists; then
Stefan Weil89138852016-05-16 15:10:20 +02003109 vnc_png_cflags=$($pkg_config libpng --cflags)
3110 vnc_png_libs=$($pkg_config libpng --libs)
Brad9af80252011-07-30 01:45:55 -04003111 else
Corentin Charyefe556a2010-07-07 20:57:56 +02003112 vnc_png_cflags=""
3113 vnc_png_libs="-lpng"
Brad9af80252011-07-30 01:45:55 -04003114 fi
Corentin Charyefe556a2010-07-07 20:57:56 +02003115 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
3116 vnc_png=yes
3117 libs_softmmu="$vnc_png_libs $libs_softmmu"
Brad9af80252011-07-30 01:45:55 -04003118 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
Corentin Charyefe556a2010-07-07 20:57:56 +02003119 else
3120 if test "$vnc_png" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003121 feature_not_found "vnc-png" "Install libpng devel"
Corentin Charyefe556a2010-07-07 20:57:56 +02003122 fi
3123 vnc_png=no
3124 fi
3125fi
3126
3127##########################################
Gerd Hoffmann6a021532017-10-05 17:33:28 +02003128# xkbcommon probe
3129if test "$xkbcommon" != "no" ; then
3130 if $pkg_config xkbcommon --exists; then
3131 xkbcommon_cflags=$($pkg_config xkbcommon --cflags)
3132 xkbcommon_libs=$($pkg_config xkbcommon --libs)
3133 xkbcommon=yes
3134 else
3135 if test "$xkbcommon" = "yes" ; then
3136 feature_not_found "xkbcommon" "Install libxkbcommon-devel"
3137 fi
3138 xkbcommon=no
3139 fi
3140fi
3141
3142##########################################
aliguori76655d62009-03-06 20:27:37 +00003143# fnmatch() probe, used for ACL routines
3144fnmatch="no"
3145cat > $TMPC << EOF
3146#include <fnmatch.h>
3147int main(void)
3148{
3149 fnmatch("foo", "foo", 0);
3150 return 0;
3151}
3152EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003153if compile_prog "" "" ; then
aliguori76655d62009-03-06 20:27:37 +00003154 fnmatch="yes"
3155fi
3156
3157##########################################
Eric Blakec1bb86c2016-12-02 13:48:54 -06003158# xfsctl() probe, used for file-posix.c
Christoph Hellwigdce512d2010-12-17 11:41:15 +01003159if test "$xfs" != "no" ; then
3160 cat > $TMPC << EOF
Stefan Weilffc41d12011-12-17 09:27:36 +01003161#include <stddef.h> /* NULL */
Christoph Hellwigdce512d2010-12-17 11:41:15 +01003162#include <xfs/xfs.h>
3163int main(void)
3164{
3165 xfsctl(NULL, 0, 0, NULL);
3166 return 0;
3167}
3168EOF
3169 if compile_prog "" "" ; then
3170 xfs="yes"
3171 else
3172 if test "$xfs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003173 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01003174 fi
3175 xfs=no
3176 fi
3177fi
3178
3179##########################################
ths8a16d272008-07-19 09:56:24 +00003180# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02003181if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02003182 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00003183 cat > $TMPC << EOF
3184#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00003185int main(void)
3186{
3187 struct vde_open_args a = {0, 0, 0};
Peter Maydellfea08e02012-07-18 15:10:25 +01003188 char s[] = "";
3189 vde_open(s, s, &a);
pbrook4a7f0e02008-09-07 16:42:53 +00003190 return 0;
3191}
ths8a16d272008-07-19 09:56:24 +00003192EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003193 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02003194 vde=yes
Juan Quinteladfb278b2009-08-12 18:20:27 +02003195 else
3196 if test "$vde" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003197 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
Juan Quinteladfb278b2009-08-12 18:20:27 +02003198 fi
3199 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02003200 fi
ths8a16d272008-07-19 09:56:24 +00003201fi
3202
3203##########################################
Vincenzo Maffione0a985b32014-02-20 15:40:43 +01003204# netmap support probe
3205# Apart from looking for netmap headers, we make sure that the host API version
3206# supports the netmap backend (>=11). The upper bound (15) is meant to simulate
3207# a minor/major version number. Minor new features will be marked with values up
3208# to 15, and if something happens that requires a change to the backend we will
3209# move above 15, submit the backend fixes and modify this two bounds.
Vincenzo Maffione58952132013-11-06 11:44:06 +01003210if test "$netmap" != "no" ; then
3211 cat > $TMPC << EOF
3212#include <inttypes.h>
3213#include <net/if.h>
3214#include <net/netmap.h>
3215#include <net/netmap_user.h>
Vincenzo Maffione0a985b32014-02-20 15:40:43 +01003216#if (NETMAP_API < 11) || (NETMAP_API > 15)
3217#error
3218#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01003219int main(void) { return 0; }
3220EOF
3221 if compile_prog "" "" ; then
3222 netmap=yes
3223 else
3224 if test "$netmap" = "yes" ; then
3225 feature_not_found "netmap"
3226 fi
3227 netmap=no
3228 fi
3229fi
3230
3231##########################################
Corey Bryant47e98652012-01-26 09:42:26 -05003232# libcap-ng library probe
3233if test "$cap_ng" != "no" ; then
3234 cap_libs="-lcap-ng"
3235 cat > $TMPC << EOF
3236#include <cap-ng.h>
3237int main(void)
3238{
3239 capng_capability_to_name(CAPNG_EFFECTIVE);
3240 return 0;
3241}
3242EOF
3243 if compile_prog "" "$cap_libs" ; then
3244 cap_ng=yes
3245 libs_tools="$cap_libs $libs_tools"
3246 else
3247 if test "$cap_ng" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003248 feature_not_found "cap_ng" "Install libcap-ng devel"
Corey Bryant47e98652012-01-26 09:42:26 -05003249 fi
3250 cap_ng=no
3251 fi
3252fi
3253
3254##########################################
malcc2de5c92008-06-28 19:13:06 +00003255# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00003256
malcc2de5c92008-06-28 19:13:06 +00003257audio_drv_probe()
3258{
3259 drv=$1
3260 hdr=$2
3261 lib=$3
3262 exp=$4
3263 cfl=$5
3264 cat > $TMPC << EOF
3265#include <$hdr>
3266int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00003267EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003268 if compile_prog "$cfl" "$lib" ; then
malcc2de5c92008-06-28 19:13:06 +00003269 :
3270 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01003271 error_exit "$drv check failed" \
3272 "Make sure to have the $drv libs and headers installed."
malcc2de5c92008-06-28 19:13:06 +00003273 fi
3274}
3275
Stefan Weil89138852016-05-16 15:10:20 +02003276audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g')
malcc2de5c92008-06-28 19:13:06 +00003277for drv in $audio_drv_list; do
3278 case $drv in
3279 alsa)
3280 audio_drv_probe $drv alsa/asoundlib.h -lasound \
Stefan Weile35bcb02012-07-18 15:10:19 +01003281 "return snd_pcm_close((snd_pcm_t *)0);"
Fam Zhengb1149912017-09-07 16:29:13 +08003282 alsa_libs="-lasound"
malcc2de5c92008-06-28 19:13:06 +00003283 ;;
3284
malcb8e59f12008-07-02 21:03:08 +00003285 pa)
Peter Krempae58ff622016-05-11 12:31:04 +02003286 audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \
3287 "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;"
Fam Zhengb1149912017-09-07 16:29:13 +08003288 pulse_libs="-lpulse"
Juan Quintela67f86e82009-08-03 14:46:59 +02003289 audio_pt_int="yes"
malcb8e59f12008-07-02 21:03:08 +00003290 ;;
3291
Gerd Hoffmann373967b2017-03-20 10:05:43 +01003292 sdl)
3293 if test "$sdl" = "no"; then
3294 error_exit "sdl not found or disabled, can not use sdl audio driver"
3295 fi
3296 ;;
3297
Juan Quintela997e6902009-08-03 14:46:29 +02003298 coreaudio)
Fam Zhengb1149912017-09-07 16:29:13 +08003299 coreaudio_libs="-framework CoreAudio"
Juan Quintela997e6902009-08-03 14:46:29 +02003300 ;;
3301
Juan Quintelaa4bf6782009-08-03 14:46:30 +02003302 dsound)
Fam Zhengb1149912017-09-07 16:29:13 +08003303 dsound_libs="-lole32 -ldxguid"
malcd5631632009-10-10 01:13:41 +04003304 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02003305 ;;
3306
3307 oss)
Fam Zhengb1149912017-09-07 16:29:13 +08003308 oss_libs="$oss_lib"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02003309 ;;
3310
Gerd Hoffmann373967b2017-03-20 10:05:43 +01003311 wav)
3312 # XXX: Probes for CoreAudio, DirectSound
blueswir12f6a1ab2008-08-21 18:00:53 +00003313 ;;
3314
malce4c63a62008-07-19 16:15:16 +00003315 *)
malc1c9b2a52008-07-19 16:57:30 +00003316 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
Peter Maydell76ad07a2013-04-08 12:11:26 +01003317 error_exit "Unknown driver '$drv' selected" \
3318 "Possible drivers are: $audio_possible_drivers"
malce4c63a62008-07-19 16:15:16 +00003319 }
3320 ;;
malcc2de5c92008-06-28 19:13:06 +00003321 esac
3322done
ths8f28f3f2007-01-05 21:25:54 +00003323
balrog4d3b6f62008-02-10 16:33:14 +00003324##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00003325# BrlAPI probe
3326
Juan Quintela4ffcedb2009-08-12 18:20:26 +02003327if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02003328 brlapi_libs="-lbrlapi"
3329 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00003330#include <brlapi.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003331#include <stddef.h>
aurel322e4d9fb2008-04-08 06:01:02 +00003332int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
3333EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003334 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02003335 brlapi=yes
Juan Quintela4ffcedb2009-08-12 18:20:26 +02003336 else
3337 if test "$brlapi" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003338 feature_not_found "brlapi" "Install brlapi devel"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02003339 fi
3340 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02003341 fi
3342fi
aurel322e4d9fb2008-04-08 06:01:02 +00003343
3344##########################################
balrog4d3b6f62008-02-10 16:33:14 +00003345# curses probe
Juan Quintelac584a6d2009-08-12 18:20:30 +02003346if test "$curses" != "no" ; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04003347 if test "$mingw32" = "yes" ; then
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003348 curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
3349 curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
Michael Tokareva3605bf2013-05-25 13:17:21 +04003350 else
Samuel Thibault7c703002016-11-09 11:27:52 +01003351 curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003352 curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
Michael Tokareva3605bf2013-05-25 13:17:21 +04003353 fi
Juan Quintelac584a6d2009-08-12 18:20:30 +02003354 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00003355 cat > $TMPC << EOF
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003356#include <locale.h>
balrog4d3b6f62008-02-10 16:33:14 +00003357#include <curses.h>
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003358#include <wchar.h>
Stefan Weilef9a2522011-12-17 17:46:02 +01003359int main(void) {
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003360 wchar_t wch = L'w';
3361 setlocale(LC_ALL, "");
Stefan Weilef9a2522011-12-17 17:46:02 +01003362 resize_term(0, 0);
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003363 addwstr(L"wide chars\n");
3364 addnwstr(&wch, 1);
Samuel Thibault7c703002016-11-09 11:27:52 +01003365 add_wch(WACS_DEGREE);
Kamil Rytarowski271f37a2017-04-26 12:50:27 +02003366 return 0;
Stefan Weilef9a2522011-12-17 17:46:02 +01003367}
balrog4d3b6f62008-02-10 16:33:14 +00003368EOF
Vadim Evardecbe2512013-01-15 16:17:24 +04003369 IFS=:
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003370 for curses_inc in $curses_inc_list; do
Peter Maydellb01a4fd2017-06-02 15:35:38 +01003371 # Make sure we get the wide character prototypes
3372 curses_inc="-DNCURSES_WIDECHAR $curses_inc"
Samuel Thibault7c703002016-11-09 11:27:52 +01003373 IFS=:
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003374 for curses_lib in $curses_lib_list; do
3375 unset IFS
3376 if compile_prog "$curses_inc" "$curses_lib" ; then
3377 curses_found=yes
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003378 break
3379 fi
3380 done
Samuel Thibault7c703002016-11-09 11:27:52 +01003381 if test "$curses_found" = yes ; then
3382 break
3383 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02003384 done
Vadim Evardecbe2512013-01-15 16:17:24 +04003385 unset IFS
Juan Quintelac584a6d2009-08-12 18:20:30 +02003386 if test "$curses_found" = "yes" ; then
3387 curses=yes
3388 else
3389 if test "$curses" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003390 feature_not_found "curses" "Install ncurses devel"
Juan Quintelac584a6d2009-08-12 18:20:30 +02003391 fi
3392 curses=no
3393 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02003394fi
balrog4d3b6f62008-02-10 16:33:14 +00003395
blueswir1414f0da2008-08-15 18:20:52 +00003396##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02003397# curl probe
Juan Quintela788c8192009-08-12 18:29:47 +02003398if test "$curl" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003399 if $pkg_config libcurl --exists; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04003400 curlconfig="$pkg_config libcurl"
3401 else
3402 curlconfig=curl-config
3403 fi
Alexander Graf769ce762009-05-11 17:41:42 +02003404 cat > $TMPC << EOF
3405#include <curl/curl.h>
Peter Maydell0b862ce2011-06-09 22:54:29 +01003406int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
Alexander Graf769ce762009-05-11 17:41:42 +02003407EOF
Stefan Weil89138852016-05-16 15:10:20 +02003408 curl_cflags=$($curlconfig --cflags 2>/dev/null)
3409 curl_libs=$($curlconfig --libs 2>/dev/null)
Juan Quintelab1d5a272009-08-03 14:46:05 +02003410 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02003411 curl=yes
Juan Quintela788c8192009-08-12 18:29:47 +02003412 else
3413 if test "$curl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003414 feature_not_found "curl" "Install libcurl devel"
Juan Quintela788c8192009-08-12 18:29:47 +02003415 fi
3416 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02003417 fi
3418fi # test "$curl"
3419
3420##########################################
balrogfb599c92008-09-28 23:49:55 +00003421# bluez support probe
Juan Quintelaa20a6f42009-08-12 18:29:50 +02003422if test "$bluez" != "no" ; then
balroge820e3f2008-09-30 02:27:44 +00003423 cat > $TMPC << EOF
3424#include <bluetooth/bluetooth.h>
3425int main(void) { return bt_error(0); }
3426EOF
Stefan Weil89138852016-05-16 15:10:20 +02003427 bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null)
3428 bluez_libs=$($pkg_config --libs bluez 2>/dev/null)
Juan Quintela52166aa2009-08-03 14:46:03 +02003429 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
Juan Quintelaa20a6f42009-08-12 18:29:50 +02003430 bluez=yes
Juan Quintelae482d562009-08-03 14:46:37 +02003431 libs_softmmu="$bluez_libs $libs_softmmu"
balroge820e3f2008-09-30 02:27:44 +00003432 else
Juan Quintelaa20a6f42009-08-12 18:29:50 +02003433 if test "$bluez" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003434 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02003435 fi
balroge820e3f2008-09-30 02:27:44 +00003436 bluez="no"
3437 fi
balrogfb599c92008-09-28 23:49:55 +00003438fi
3439
3440##########################################
Anthony Liguorie18df142011-07-19 14:50:29 -05003441# glib support probe
Paolo Bonzinia52d28a2012-04-05 13:01:54 +02003442
Peter Maydellad04d8c2017-04-03 14:04:15 +01003443if test "$mingw32" = yes; then
3444 glib_req_ver=2.30
3445else
3446 glib_req_ver=2.22
3447fi
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01003448glib_modules=gthread-2.0
3449if test "$modules" = yes; then
Gerd Hoffmanna88afc62018-03-08 09:53:00 +01003450 glib_modules="$glib_modules gmodule-export-2.0"
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01003451fi
Fam Zhenge26110c2014-02-10 14:48:57 +08003452
Sameeh Jubran4eaf7202017-03-26 12:56:22 +03003453# This workaround is required due to a bug in pkg-config file for glib as it
3454# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
3455
3456if test "$static" = yes -a "$mingw32" = yes; then
3457 QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS"
3458fi
3459
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01003460for i in $glib_modules; do
Fam Zhenge26110c2014-02-10 14:48:57 +08003461 if $pkg_config --atleast-version=$glib_req_ver $i; then
Stefan Weil89138852016-05-16 15:10:20 +02003462 glib_cflags=$($pkg_config --cflags $i)
3463 glib_libs=$($pkg_config --libs $i)
Marc-André Lureau4a058892016-09-26 00:57:48 +04003464 QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
Fam Zhenge26110c2014-02-10 14:48:57 +08003465 LIBS="$glib_libs $LIBS"
3466 libs_qga="$glib_libs $libs_qga"
3467 else
3468 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
3469 fi
3470done
3471
Daniel P. Berrange977a82a2016-01-27 09:00:45 +00003472# Sanity check that the current size_t matches the
3473# size that glib thinks it should be. This catches
3474# problems on multi-arch where people try to build
3475# 32-bit QEMU while pointing at 64-bit glib headers
3476cat > $TMPC <<EOF
3477#include <glib.h>
3478#include <unistd.h>
3479
3480#define QEMU_BUILD_BUG_ON(x) \
3481 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
3482
3483int main(void) {
3484 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
3485 return 0;
3486}
3487EOF
3488
Stefan Weil5919e032016-04-28 23:33:41 +02003489if ! compile_prog "$CFLAGS" "$LIBS" ; then
Daniel P. Berrange977a82a2016-01-27 09:00:45 +00003490 error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
3491 "You probably need to set PKG_CONFIG_LIBDIR"\
3492 "to point to the right pkg-config files for your"\
3493 "build target"
3494fi
3495
Michael S. Tsirkin9d414012014-09-18 20:46:45 +03003496# g_test_trap_subprocess added in 2.38. Used by some tests.
3497glib_subprocess=yes
Marc-André Lureaua0492232017-01-04 21:57:22 +01003498if ! $pkg_config --atleast-version=2.38 glib-2.0; then
Michael S. Tsirkin9d414012014-09-18 20:46:45 +03003499 glib_subprocess=no
3500fi
3501
John Snowbbbf2e02015-03-25 18:57:38 -04003502# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage
3503cat > $TMPC << EOF
3504#include <glib.h>
3505int main(void) { return 0; }
3506EOF
3507if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
3508 if cc_has_warning_flag "-Wno-unknown-attributes"; then
3509 glib_cflags="-Wno-unknown-attributes $glib_cflags"
3510 CFLAGS="-Wno-unknown-attributes $CFLAGS"
3511 fi
3512fi
3513
Fam Zhenge26110c2014-02-10 14:48:57 +08003514##########################################
3515# SHA command probe for modules
3516if test "$modules" = yes; then
3517 shacmd_probe="sha1sum sha1 shasum"
3518 for c in $shacmd_probe; do
Fam Zheng8ccefb92014-12-04 14:18:16 +08003519 if has $c; then
Fam Zhenge26110c2014-02-10 14:48:57 +08003520 shacmd="$c"
3521 break
3522 fi
3523 done
3524 if test "$shacmd" = ""; then
3525 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
3526 fi
Anthony Liguorie18df142011-07-19 14:50:29 -05003527fi
3528
3529##########################################
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02003530# pixman support probe
3531
Gerd Hoffmann35c4e862017-09-05 16:01:16 +02003532if test "$want_tools" = "no" -a "$softmmu" = "no"; then
Robert Schiele74880fe2012-12-04 16:58:08 +01003533 pixman_cflags=
3534 pixman_libs=
Gerd Hoffmann35c4e862017-09-05 16:01:16 +02003535elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
Stefan Weil89138852016-05-16 15:10:20 +02003536 pixman_cflags=$($pkg_config --cflags pixman-1)
3537 pixman_libs=$($pkg_config --libs pixman-1)
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02003538else
Gerd Hoffmannc12b6d72017-09-05 16:01:15 +02003539 error_exit "pixman >= 0.21.8 not present." \
3540 "Please install the pixman devel package."
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02003541fi
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02003542
3543##########################################
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02003544# libmpathpersist probe
3545
3546if test "$mpath" != "no" ; then
3547 cat > $TMPC <<EOF
3548#include <libudev.h>
3549#include <mpath_persist.h>
3550unsigned mpath_mx_alloc_len = 1024;
3551int logsink;
Paolo Bonzinib3f1c8c2017-10-17 20:11:58 +02003552static struct config *multipath_conf;
3553extern struct udev *udev;
3554extern struct config *get_multipath_config(void);
3555extern void put_multipath_config(struct config *conf);
3556struct udev *udev;
3557struct config *get_multipath_config(void) { return multipath_conf; }
3558void put_multipath_config(struct config *conf) { }
3559
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02003560int main(void) {
Paolo Bonzinib3f1c8c2017-10-17 20:11:58 +02003561 udev = udev_new();
3562 multipath_conf = mpath_lib_init();
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02003563 return 0;
3564}
3565EOF
3566 if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then
3567 mpathpersist=yes
3568 else
3569 mpathpersist=no
3570 fi
3571else
3572 mpathpersist=no
3573fi
3574
3575##########################################
M. Mohan Kumar17bff522011-12-14 13:58:42 +05303576# libcap probe
3577
3578if test "$cap" != "no" ; then
3579 cat > $TMPC <<EOF
3580#include <stdio.h>
3581#include <sys/capability.h>
Stefan Weilcc939742012-07-18 15:10:20 +01003582int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
M. Mohan Kumar17bff522011-12-14 13:58:42 +05303583EOF
3584 if compile_prog "" "-lcap" ; then
3585 cap=yes
3586 else
3587 cap=no
3588 fi
3589fi
3590
3591##########################################
aliguorie5d355d2009-04-24 18:03:15 +00003592# pthread probe
Brad4b29ec42011-08-07 20:02:11 -04003593PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00003594
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02003595pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00003596cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00003597#include <pthread.h>
Stefan Weil7a42bbe2011-12-17 09:27:32 +01003598static void *f(void *p) { return NULL; }
3599int main(void) {
3600 pthread_t thread;
3601 pthread_create(&thread, 0, f, 0);
3602 return 0;
3603}
blueswir1414f0da2008-08-15 18:20:52 +00003604EOF
Andreas Färberbd00d532010-09-20 00:50:44 +02003605if compile_prog "" "" ; then
3606 pthread=yes
3607else
3608 for pthread_lib in $PTHREADLIBS_LIST; do
3609 if compile_prog "" "$pthread_lib" ; then
3610 pthread=yes
Peter Portantee3c56762012-04-20 10:36:12 -04003611 found=no
3612 for lib_entry in $LIBS; do
3613 if test "$lib_entry" = "$pthread_lib"; then
3614 found=yes
3615 break
3616 fi
3617 done
3618 if test "$found" = "no"; then
3619 LIBS="$pthread_lib $LIBS"
Marc-André Lureau14ab3aa2018-01-04 17:05:06 +01003620 libs_qga="$pthread_lib $libs_qga"
Peter Portantee3c56762012-04-20 10:36:12 -04003621 fi
Daniel P. Berrange409437e2016-07-20 14:23:13 +01003622 PTHREAD_LIB="$pthread_lib"
Andreas Färberbd00d532010-09-20 00:50:44 +02003623 break
3624 fi
3625 done
3626fi
blueswir1414f0da2008-08-15 18:20:52 +00003627
Anthony Liguori4617e592009-08-25 17:21:56 -05003628if test "$mingw32" != yes -a "$pthread" = no; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003629 error_exit "pthread check failed" \
3630 "Make sure to have the pthread libs and headers installed."
aliguorie5d355d2009-04-24 18:03:15 +00003631fi
3632
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00003633# check for pthread_setname_np
3634pthread_setname_np=no
3635cat > $TMPC << EOF
3636#include <pthread.h>
3637
3638static void *f(void *p) { return NULL; }
3639int main(void)
3640{
3641 pthread_t thread;
3642 pthread_create(&thread, 0, f, 0);
3643 pthread_setname_np(thread, "QEMU");
3644 return 0;
3645}
3646EOF
3647if compile_prog "" "$pthread_lib" ; then
3648 pthread_setname_np=yes
3649fi
3650
aliguoribf9298b2008-12-05 20:05:26 +00003651##########################################
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003652# rbd probe
3653if test "$rbd" != "no" ; then
3654 cat > $TMPC <<EOF
3655#include <stdio.h>
Josh Durginad32e9c2011-05-26 16:07:31 -07003656#include <rbd/librbd.h>
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003657int main(void) {
Josh Durginad32e9c2011-05-26 16:07:31 -07003658 rados_t cluster;
3659 rados_create(&cluster, NULL);
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003660 return 0;
3661}
3662EOF
Josh Durginad32e9c2011-05-26 16:07:31 -07003663 rbd_libs="-lrbd -lrados"
3664 if compile_prog "" "$rbd_libs" ; then
3665 rbd=yes
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003666 else
3667 if test "$rbd" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003668 feature_not_found "rados block device" "Install librbd/ceph devel"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003669 fi
3670 rbd=no
3671 fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003672fi
3673
3674##########################################
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01003675# libssh2 probe
Richard W.M. Jones4fc16832013-04-19 09:16:39 +01003676min_libssh2_version=1.2.8
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01003677if test "$libssh2" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003678 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
Stefan Weil89138852016-05-16 15:10:20 +02003679 libssh2_cflags=$($pkg_config libssh2 --cflags)
3680 libssh2_libs=$($pkg_config libssh2 --libs)
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01003681 libssh2=yes
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01003682 else
3683 if test "$libssh2" = "yes" ; then
Richard W.M. Jones4fc16832013-04-19 09:16:39 +01003684 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01003685 fi
3686 libssh2=no
3687 fi
3688fi
3689
3690##########################################
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01003691# libssh2_sftp_fsync probe
3692
3693if test "$libssh2" = "yes"; then
3694 cat > $TMPC <<EOF
3695#include <stdio.h>
3696#include <libssh2.h>
3697#include <libssh2_sftp.h>
3698int main(void) {
3699 LIBSSH2_SESSION *session;
3700 LIBSSH2_SFTP *sftp;
3701 LIBSSH2_SFTP_HANDLE *sftp_handle;
3702 session = libssh2_session_init ();
3703 sftp = libssh2_sftp_init (session);
3704 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
3705 libssh2_sftp_fsync (sftp_handle);
3706 return 0;
3707}
3708EOF
3709 # libssh2_cflags/libssh2_libs defined in previous test.
3710 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
3711 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
3712 fi
3713fi
3714
3715##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003716# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003717
3718if test "$linux_aio" != "no" ; then
3719 cat > $TMPC <<EOF
3720#include <libaio.h>
3721#include <sys/eventfd.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003722#include <stddef.h>
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003723int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
3724EOF
3725 if compile_prog "" "-laio" ; then
3726 linux_aio=yes
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003727 else
3728 if test "$linux_aio" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003729 feature_not_found "linux AIO" "Install libaio devel"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003730 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03003731 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003732 fi
3733fi
3734
3735##########################################
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01003736# TPM passthrough is only on x86 Linux
3737
3738if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
3739 tpm_passthrough=$tpm
3740else
3741 tpm_passthrough=no
3742fi
3743
Amarnath Vallurif4ede812017-09-29 14:10:20 +03003744# TPM emulator is for all posix systems
3745if test "$mingw32" != "yes"; then
3746 tpm_emulator=$tpm
3747else
3748 tpm_emulator=no
3749fi
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01003750##########################################
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003751# attr probe
3752
3753if test "$attr" != "no" ; then
3754 cat > $TMPC <<EOF
3755#include <stdio.h>
3756#include <sys/types.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04003757#ifdef CONFIG_LIBATTR
3758#include <attr/xattr.h>
3759#else
Avi Kivity4f26f2b2011-11-09 14:44:52 +02003760#include <sys/xattr.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04003761#endif
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003762int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
3763EOF
Avi Kivity4f26f2b2011-11-09 14:44:52 +02003764 if compile_prog "" "" ; then
3765 attr=yes
3766 # Older distros have <attr/xattr.h>, and need -lattr:
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04003767 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003768 attr=yes
3769 LIBS="-lattr $LIBS"
Avi Kivity4f26f2b2011-11-09 14:44:52 +02003770 libattr=yes
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003771 else
3772 if test "$attr" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003773 feature_not_found "ATTR" "Install libc6 or libattr devel"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003774 fi
3775 attr=no
3776 fi
3777fi
3778
3779##########################################
aliguoribf9298b2008-12-05 20:05:26 +00003780# iovec probe
3781cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00003782#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00003783#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00003784#include <unistd.h>
Stefan Weilf91f9be2011-12-17 09:27:33 +01003785int main(void) { return sizeof(struct iovec); }
aliguoribf9298b2008-12-05 20:05:26 +00003786EOF
3787iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02003788if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00003789 iovec=yes
3790fi
3791
aurel32f652e6a2008-12-16 10:43:48 +00003792##########################################
aliguoriceb42de2009-04-07 18:43:28 +00003793# preadv probe
3794cat > $TMPC <<EOF
3795#include <sys/types.h>
3796#include <sys/uio.h>
3797#include <unistd.h>
Blue Swirlc075a722012-08-09 20:21:25 +00003798int main(void) { return preadv(0, 0, 0, 0); }
aliguoriceb42de2009-04-07 18:43:28 +00003799EOF
3800preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02003801if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00003802 preadv=yes
3803fi
3804
3805##########################################
aurel32f652e6a2008-12-16 10:43:48 +00003806# fdt probe
Peter Maydelle169e1e2013-05-24 16:26:54 +01003807# fdt support is mandatory for at least some target architectures,
3808# so insist on it if we're building those system emulators.
3809fdt_required=no
3810for target in $target_list; do
3811 case $target in
KONRAD Frederica6664092018-05-03 17:17:16 +02003812 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu)
Peter Maydelle169e1e2013-05-24 16:26:54 +01003813 fdt_required=yes
3814 ;;
3815 esac
3816done
3817
3818if test "$fdt_required" = "yes"; then
3819 if test "$fdt" = "no"; then
3820 error_exit "fdt disabled but some requested targets require it." \
3821 "You can turn off fdt only if you also disable all the system emulation" \
3822 "targets which need it (by specifying a cut down --target-list)."
3823 fi
3824 fdt=yes
3825fi
3826
Juan Quintela2df87df2009-08-12 18:29:54 +02003827if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02003828 fdt_libs="-lfdt"
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10003829 # explicitly check for libfdt_env.h as it is missing in some stable installs
Paul Burton6e85fce2016-09-08 15:51:55 +01003830 # and test for required functions to make sure we are on a version >= 1.4.2
Juan Quintelab41af4b2009-07-27 16:13:20 +02003831 cat > $TMPC << EOF
Thomas Huth31ce0ad2015-05-18 12:59:49 +02003832#include <libfdt.h>
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10003833#include <libfdt_env.h>
Paul Burton6e85fce2016-09-08 15:51:55 +01003834int main(void) { fdt_first_subnode(0, 0); return 0; }
aurel32f652e6a2008-12-16 10:43:48 +00003835EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003836 if compile_prog "" "$fdt_libs" ; then
Peter Crosthwaitea540f152013-04-18 14:47:31 +10003837 # system DTC is good - use it
Philippe Mathieu-Daudée3971d62018-04-15 20:05:20 -03003838 fdt=system
Peter Crosthwaitea540f152013-04-18 14:47:31 +10003839 else
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01003840 # have GIT checkout, so activate dtc submodule
3841 if test -e "${source_path}/.git" ; then
3842 git_submodules="${git_submodules} dtc"
3843 fi
3844 if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
Philippe Mathieu-Daudée3971d62018-04-15 20:05:20 -03003845 fdt=git
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01003846 mkdir -p dtc
3847 if [ "$pwd_is_source_path" != "y" ] ; then
3848 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
3849 symlink "$source_path/dtc/scripts" "dtc/scripts"
3850 fi
3851 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
Philippe Mathieu-Daudé8a99e9a2018-04-15 20:05:19 -03003852 fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt"
3853 fdt_libs="$fdt_libs"
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01003854 elif test "$fdt" = "yes" ; then
3855 # Not a git build & no libfdt found, prompt for system install
3856 error_exit "DTC (libfdt) version >= 1.4.2 not present." \
3857 "Please install the DTC (libfdt) devel package"
3858 else
3859 # don't have and don't want
3860 fdt_libs=
3861 fdt=no
3862 fi
aurel32f652e6a2008-12-16 10:43:48 +00003863 fi
3864fi
3865
Peter Crosthwaitea540f152013-04-18 14:47:31 +10003866libs_softmmu="$libs_softmmu $fdt_libs"
3867
Michael Walle20ff0752011-03-07 23:32:39 +01003868##########################################
OGAWA Hirofumifb719562015-10-27 02:45:48 +09003869# opengl probe (for sdl2, gtk, milkymist-tmu2)
Gerd Hoffmannb1546f32015-03-16 10:03:53 +01003870
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01003871if test "$opengl" != "no" ; then
Gerd Hoffmann014cb152015-12-03 12:56:34 +01003872 opengl_pkgs="epoxy libdrm gbm"
Gerd Hoffmann5f9b1e32018-03-01 11:05:43 +01003873 if $pkg_config $opengl_pkgs; then
3874 opengl_cflags="$($pkg_config --cflags $opengl_pkgs)"
3875 opengl_libs="$($pkg_config --libs $opengl_pkgs)"
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01003876 opengl=yes
Gerd Hoffmann925a0402015-05-26 12:26:21 +02003877 if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
3878 gtk_gl="yes"
3879 fi
Gerd Hoffmanncc720a52017-03-21 08:04:48 +01003880 QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
Michael Walle20ff0752011-03-07 23:32:39 +01003881 else
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01003882 if test "$opengl" = "yes" ; then
Gerd Hoffmanndcf30022015-05-11 12:24:43 +02003883 feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
Michael Walle20ff0752011-03-07 23:32:39 +01003884 fi
Jeremy Whitef676c672015-01-09 13:08:49 -06003885 opengl_cflags=""
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01003886 opengl_libs=""
3887 opengl=no
Michael Walle20ff0752011-03-07 23:32:39 +01003888 fi
3889fi
3890
Gerd Hoffmann014cb152015-12-03 12:56:34 +01003891if test "$opengl" = "yes"; then
3892 cat > $TMPC << EOF
3893#include <epoxy/egl.h>
3894#ifndef EGL_MESA_image_dma_buf_export
3895# error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
3896#endif
3897int main(void) { return 0; }
3898EOF
3899 if compile_prog "" "" ; then
3900 opengl_dmabuf=yes
3901 fi
3902fi
Chrysostomos Nanakosc9a12e72014-08-04 17:35:32 +03003903
Klim Kireeved279a02018-01-12 12:01:19 +03003904##########################################
3905# libxml2 probe
3906if test "$libxml2" != "no" ; then
3907 if $pkg_config --exists libxml-2.0; then
3908 libxml2="yes"
3909 libxml2_cflags=$($pkg_config --cflags libxml-2.0)
3910 libxml2_libs=$($pkg_config --libs libxml-2.0)
3911 else
3912 if test "$libxml2" = "yes"; then
3913 feature_not_found "libxml2" "Install libxml2 devel"
3914 fi
3915 libxml2="no"
3916 fi
3917fi
Chrysostomos Nanakosc9a12e72014-08-04 17:35:32 +03003918
Bharata B Raoeb100392012-09-24 14:42:45 +05303919##########################################
3920# glusterfs probe
3921if test "$glusterfs" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003922 if $pkg_config --atleast-version=3 glusterfs-api; then
Bharata B Raoe01bee02013-07-16 21:47:41 +05303923 glusterfs="yes"
Stefan Weil89138852016-05-16 15:10:20 +02003924 glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
3925 glusterfs_libs=$($pkg_config --libs glusterfs-api)
Jeff Codyd85fa9e2016-04-05 10:40:09 -04003926 if $pkg_config --atleast-version=4 glusterfs-api; then
3927 glusterfs_xlator_opt="yes"
3928 fi
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003929 if $pkg_config --atleast-version=5 glusterfs-api; then
Bharata B Rao0c14fb42013-07-16 21:47:42 +05303930 glusterfs_discard="yes"
3931 fi
Bharata B Rao7c815372013-12-21 14:51:25 +05303932 if $pkg_config --atleast-version=6 glusterfs-api; then
Niels de Vosdf3a4292017-05-28 12:01:14 +05303933 glusterfs_fallocate="yes"
Bharata B Rao7c815372013-12-21 14:51:25 +05303934 glusterfs_zerofill="yes"
3935 fi
Bharata B Raoeb100392012-09-24 14:42:45 +05303936 else
3937 if test "$glusterfs" = "yes" ; then
Hu Tao8efc9362014-06-26 17:34:50 +08003938 feature_not_found "GlusterFS backend support" \
3939 "Install glusterfs-api devel >= 3"
Bharata B Raoeb100392012-09-24 14:42:45 +05303940 fi
Bharata B Raoe01bee02013-07-16 21:47:41 +05303941 glusterfs="no"
Bharata B Raoeb100392012-09-24 14:42:45 +05303942 fi
3943fi
3944
aurel3239386ac2009-04-15 19:48:17 +00003945# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00003946# emulator. This is done because older glibc versions don't
3947# have syscall stubs for these implemented. In that case we
3948# don't provide them even if kernel supports them.
3949#
3950inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03003951cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00003952#include <sys/inotify.h>
3953
3954int
3955main(void)
3956{
3957 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00003958 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00003959}
3960EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003961if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03003962 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00003963fi
3964
Riku Voipioc05c7a72010-03-26 15:25:11 +00003965inotify1=no
3966cat > $TMPC << EOF
3967#include <sys/inotify.h>
3968
3969int
3970main(void)
3971{
3972 /* try to start inotify */
3973 return inotify_init1(0);
3974}
3975EOF
3976if compile_prog "" "" ; then
3977 inotify1=yes
3978fi
3979
Riku Voipio099d6b02009-05-05 12:10:04 +03003980# check if pipe2 is there
3981pipe2=no
3982cat > $TMPC << EOF
Riku Voipio099d6b02009-05-05 12:10:04 +03003983#include <unistd.h>
3984#include <fcntl.h>
3985
3986int main(void)
3987{
3988 int pipefd[2];
Bruce Rogers9bca8162012-08-20 12:45:08 -06003989 return pipe2(pipefd, O_CLOEXEC);
Riku Voipio099d6b02009-05-05 12:10:04 +03003990}
3991EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003992if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03003993 pipe2=yes
3994fi
3995
Kevin Wolf40ff6d72009-12-02 12:24:42 +01003996# check if accept4 is there
3997accept4=no
3998cat > $TMPC << EOF
Kevin Wolf40ff6d72009-12-02 12:24:42 +01003999#include <sys/socket.h>
4000#include <stddef.h>
4001
4002int main(void)
4003{
4004 accept4(0, NULL, NULL, SOCK_CLOEXEC);
4005 return 0;
4006}
4007EOF
4008if compile_prog "" "" ; then
4009 accept4=yes
4010fi
4011
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304012# check if tee/splice is there. vmsplice was added same time.
4013splice=no
4014cat > $TMPC << EOF
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304015#include <unistd.h>
4016#include <fcntl.h>
4017#include <limits.h>
4018
4019int main(void)
4020{
Stefan Weil66ea0f22011-12-17 09:27:35 +01004021 int len, fd = 0;
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304022 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
4023 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
4024 return 0;
4025}
4026EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004027if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304028 splice=yes
4029fi
4030
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004031##########################################
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08004032# libnuma probe
4033
4034if test "$numa" != "no" ; then
4035 cat > $TMPC << EOF
4036#include <numa.h>
4037int main(void) { return numa_available(); }
4038EOF
4039
4040 if compile_prog "" "-lnuma" ; then
4041 numa=yes
4042 libs_softmmu="-lnuma $libs_softmmu"
4043 else
4044 if test "$numa" = "yes" ; then
4045 feature_not_found "numa" "install numactl devel"
4046 fi
4047 numa=no
4048 fi
4049fi
4050
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02004051if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
4052 echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
4053 exit 1
4054fi
4055
Yang Zhong5a22ab72017-12-20 21:16:46 +08004056# Even if malloc_trim() is available, these non-libc memory allocators
4057# do not support it.
4058if test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then
4059 if test "$malloc_trim" = "yes" ; then
4060 echo "Disabling malloc_trim with non-libc memory allocator"
4061 fi
4062 malloc_trim="no"
4063fi
4064
4065#######################################
4066# malloc_trim
4067
4068if test "$malloc_trim" != "no" ; then
4069 cat > $TMPC << EOF
4070#include <malloc.h>
4071int main(void) { malloc_trim(0); return 0; }
4072EOF
4073 if compile_prog "" "" ; then
4074 malloc_trim="yes"
4075 else
4076 malloc_trim="no"
4077 fi
4078fi
4079
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08004080##########################################
Fam Zheng2847b462015-03-26 11:03:12 +08004081# tcmalloc probe
4082
4083if test "$tcmalloc" = "yes" ; then
4084 cat > $TMPC << EOF
4085#include <stdlib.h>
4086int main(void) { malloc(1); return 0; }
4087EOF
4088
4089 if compile_prog "" "-ltcmalloc" ; then
4090 LIBS="-ltcmalloc $LIBS"
4091 else
4092 feature_not_found "tcmalloc" "install gperftools devel"
4093 fi
4094fi
4095
4096##########################################
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02004097# jemalloc probe
4098
4099if test "$jemalloc" = "yes" ; then
4100 cat > $TMPC << EOF
4101#include <stdlib.h>
4102int main(void) { malloc(1); return 0; }
4103EOF
4104
4105 if compile_prog "" "-ljemalloc" ; then
4106 LIBS="-ljemalloc $LIBS"
4107 else
4108 feature_not_found "jemalloc" "install jemalloc devel"
4109 fi
4110fi
4111
4112##########################################
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004113# signalfd probe
4114signalfd="no"
4115cat > $TMPC << EOF
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004116#include <unistd.h>
4117#include <sys/syscall.h>
4118#include <signal.h>
4119int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
4120EOF
4121
4122if compile_prog "" "" ; then
4123 signalfd=yes
4124fi
4125
Riku Voipioc2882b92009-08-12 15:08:24 +03004126# check if eventfd is supported
4127eventfd=no
4128cat > $TMPC << EOF
4129#include <sys/eventfd.h>
4130
4131int main(void)
4132{
Stefan Weil55cc7f32011-12-17 09:27:37 +01004133 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
Riku Voipioc2882b92009-08-12 15:08:24 +03004134}
4135EOF
4136if compile_prog "" "" ; then
4137 eventfd=yes
4138fi
4139
Marc-André Lureau751bcc32015-10-09 17:17:16 +02004140# check if memfd is supported
4141memfd=no
4142cat > $TMPC << EOF
Paolo Bonzini75e5b702017-11-28 11:51:27 +01004143#include <sys/mman.h>
Marc-André Lureau751bcc32015-10-09 17:17:16 +02004144
4145int main(void)
4146{
4147 return memfd_create("foo", MFD_ALLOW_SEALING);
4148}
4149EOF
4150if compile_prog "" "" ; then
4151 memfd=yes
4152fi
4153
4154
4155
Ulrich Hechtd0927932009-09-17 20:22:14 +03004156# check for fallocate
4157fallocate=no
4158cat > $TMPC << EOF
4159#include <fcntl.h>
4160
4161int main(void)
4162{
4163 fallocate(0, 0, 0, 0);
4164 return 0;
4165}
4166EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004167if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03004168 fallocate=yes
4169fi
4170
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01004171# check for fallocate hole punching
4172fallocate_punch_hole=no
4173cat > $TMPC << EOF
4174#include <fcntl.h>
4175#include <linux/falloc.h>
4176
4177int main(void)
4178{
4179 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
4180 return 0;
4181}
4182EOF
4183if compile_prog "" "" ; then
4184 fallocate_punch_hole=yes
4185fi
4186
Denis V. Lunevb953f072015-01-30 11:42:14 +03004187# check that fallocate supports range zeroing inside the file
4188fallocate_zero_range=no
4189cat > $TMPC << EOF
4190#include <fcntl.h>
4191#include <linux/falloc.h>
4192
4193int main(void)
4194{
4195 fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0);
4196 return 0;
4197}
4198EOF
4199if compile_prog "" "" ; then
4200 fallocate_zero_range=yes
4201fi
4202
Kevin Wolfed911432014-09-29 17:12:59 +02004203# check for posix_fallocate
4204posix_fallocate=no
4205cat > $TMPC << EOF
4206#include <fcntl.h>
4207
4208int main(void)
4209{
4210 posix_fallocate(0, 0, 0);
4211 return 0;
4212}
4213EOF
4214if compile_prog "" "" ; then
4215 posix_fallocate=yes
4216fi
4217
Peter Maydellc727f472011-01-06 11:05:10 +00004218# check for sync_file_range
4219sync_file_range=no
4220cat > $TMPC << EOF
4221#include <fcntl.h>
4222
4223int main(void)
4224{
4225 sync_file_range(0, 0, 0, 0);
4226 return 0;
4227}
4228EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004229if compile_prog "" "" ; then
Peter Maydellc727f472011-01-06 11:05:10 +00004230 sync_file_range=yes
4231fi
4232
Peter Maydelldace20d2011-01-10 13:11:24 +00004233# check for linux/fiemap.h and FS_IOC_FIEMAP
4234fiemap=no
4235cat > $TMPC << EOF
4236#include <sys/ioctl.h>
4237#include <linux/fs.h>
4238#include <linux/fiemap.h>
4239
4240int main(void)
4241{
4242 ioctl(0, FS_IOC_FIEMAP, 0);
4243 return 0;
4244}
4245EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004246if compile_prog "" "" ; then
Peter Maydelldace20d2011-01-10 13:11:24 +00004247 fiemap=yes
4248fi
4249
Ulrich Hechtd0927932009-09-17 20:22:14 +03004250# check for dup3
4251dup3=no
4252cat > $TMPC << EOF
4253#include <unistd.h>
4254
4255int main(void)
4256{
4257 dup3(0, 0, 0);
4258 return 0;
4259}
4260EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01004261if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03004262 dup3=yes
4263fi
4264
Alex Bligh4e0c6522013-08-21 16:02:43 +01004265# check for ppoll support
4266ppoll=no
4267cat > $TMPC << EOF
4268#include <poll.h>
4269
4270int main(void)
4271{
4272 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
4273 ppoll(&pfd, 1, 0, 0);
4274 return 0;
4275}
4276EOF
4277if compile_prog "" "" ; then
4278 ppoll=yes
4279fi
4280
Alex Blighcd758dd2013-08-21 16:02:44 +01004281# check for prctl(PR_SET_TIMERSLACK , ... ) support
4282prctl_pr_set_timerslack=no
4283cat > $TMPC << EOF
4284#include <sys/prctl.h>
4285
4286int main(void)
4287{
4288 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
4289 return 0;
4290}
4291EOF
4292if compile_prog "" "" ; then
4293 prctl_pr_set_timerslack=yes
4294fi
4295
Peter Maydell3b6edd12011-02-15 18:35:05 +00004296# check for epoll support
4297epoll=no
4298cat > $TMPC << EOF
4299#include <sys/epoll.h>
4300
4301int main(void)
4302{
4303 epoll_create(0);
4304 return 0;
4305}
4306EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004307if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00004308 epoll=yes
4309fi
4310
Peter Maydell227f0212016-06-06 19:58:11 +01004311# epoll_create1 is a later addition
4312# so we must check separately for its presence
Peter Maydell3b6edd12011-02-15 18:35:05 +00004313epoll_create1=no
4314cat > $TMPC << EOF
4315#include <sys/epoll.h>
4316
4317int main(void)
4318{
Peter Maydell19e83f62011-04-26 16:56:40 +01004319 /* Note that we use epoll_create1 as a value, not as
4320 * a function being called. This is necessary so that on
4321 * old SPARC glibc versions where the function was present in
4322 * the library but not declared in the header file we will
4323 * fail the configure check. (Otherwise we will get a compiler
4324 * warning but not an error, and will proceed to fail the
4325 * qemu compile where we compile with -Werror.)
4326 */
Blue Swirlc075a722012-08-09 20:21:25 +00004327 return (int)(uintptr_t)&epoll_create1;
Peter Maydell3b6edd12011-02-15 18:35:05 +00004328}
4329EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004330if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00004331 epoll_create1=yes
4332fi
4333
Peter Maydella8fd1ab2013-02-08 07:31:55 +00004334# check for sendfile support
4335sendfile=no
4336cat > $TMPC << EOF
4337#include <sys/sendfile.h>
4338
4339int main(void)
4340{
4341 return sendfile(0, 0, 0, 0);
4342}
4343EOF
4344if compile_prog "" "" ; then
4345 sendfile=yes
4346fi
4347
Riku Voipio51834342014-06-22 11:25:42 +01004348# check for timerfd support (glibc 2.8 and newer)
4349timerfd=no
4350cat > $TMPC << EOF
4351#include <sys/timerfd.h>
4352
4353int main(void)
4354{
4355 return(timerfd_create(CLOCK_REALTIME, 0));
4356}
4357EOF
4358if compile_prog "" "" ; then
4359 timerfd=yes
4360fi
4361
Riku Voipio9af5c902014-08-12 15:58:57 +03004362# check for setns and unshare support
4363setns=no
4364cat > $TMPC << EOF
4365#include <sched.h>
4366
4367int main(void)
4368{
4369 int ret;
4370 ret = setns(0, 0);
4371 ret = unshare(0);
4372 return ret;
4373}
4374EOF
4375if compile_prog "" "" ; then
4376 setns=yes
4377fi
4378
Aleksandar Markovic38860a02016-10-10 13:23:29 +02004379# clock_adjtime probe
4380clock_adjtime=no
4381cat > $TMPC <<EOF
4382#include <time.h>
4383
4384int main(void)
4385{
4386 return clock_adjtime(0, 0);
4387}
4388EOF
4389clock_adjtime=no
4390if compile_prog "" "" ; then
4391 clock_adjtime=yes
4392fi
4393
Aleksandar Markovic5a03cd02016-10-10 13:23:30 +02004394# syncfs probe
4395syncfs=no
4396cat > $TMPC <<EOF
4397#include <unistd.h>
4398
4399int main(void)
4400{
4401 return syncfs(0);
4402}
4403EOF
4404syncfs=no
4405if compile_prog "" "" ; then
4406 syncfs=yes
4407fi
4408
pbrookcc8ae6d2006-04-23 17:57:59 +00004409# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02004410if test "$docs" != "no" ; then
Stefan Weil01668d92010-03-04 22:21:02 +01004411 if has makeinfo && has pod2man; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02004412 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02004413 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02004414 if test "$docs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11004415 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
Juan Quintela83a3ab82009-08-12 18:29:51 +02004416 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02004417 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02004418 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00004419fi
4420
Stefan Weilf514f412009-10-11 12:44:07 +02004421# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02004422byteswap_h=no
4423cat > $TMPC << EOF
4424#include <byteswap.h>
4425int main(void) { return bswap_32(0); }
4426EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004427if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02004428 byteswap_h=yes
4429fi
4430
Stefan Weil75f13592013-01-05 12:17:38 +01004431# Search for bswap32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02004432bswap_h=no
4433cat > $TMPC << EOF
4434#include <sys/endian.h>
4435#include <sys/types.h>
4436#include <machine/bswap.h>
4437int main(void) { return bswap32(0); }
4438EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004439if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02004440 bswap_h=yes
4441fi
4442
aliguorida93a1f2008-12-12 20:02:52 +00004443##########################################
Peter Lievene49ab192014-06-04 14:33:26 +02004444# Do we have libiscsi >= 1.9.0
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004445if test "$libiscsi" != "no" ; then
Peter Lievene49ab192014-06-04 14:33:26 +02004446 if $pkg_config --atleast-version=1.9.0 libiscsi; then
Paolo Bonzini3c33ea92013-02-22 18:14:28 +01004447 libiscsi="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02004448 libiscsi_cflags=$($pkg_config --cflags libiscsi)
4449 libiscsi_libs=$($pkg_config --libs libiscsi)
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004450 else
4451 if test "$libiscsi" = "yes" ; then
Peter Lievene49ab192014-06-04 14:33:26 +02004452 feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004453 fi
4454 libiscsi="no"
4455 fi
4456fi
4457
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004458##########################################
Natanael Copa8bacde82012-09-12 09:06:51 +00004459# Do we need libm
4460cat > $TMPC << EOF
4461#include <math.h>
Alexey Kardashevskiyf80ea982014-07-01 17:30:27 +10004462int main(int argc, char **argv) { return isnan(sin((double)argc)); }
Natanael Copa8bacde82012-09-12 09:06:51 +00004463EOF
4464if compile_prog "" "" ; then
4465 :
4466elif compile_prog "" "-lm" ; then
4467 LIBS="-lm $LIBS"
4468 libs_qga="-lm $libs_qga"
4469else
Peter Maydell76ad07a2013-04-08 12:11:26 +01004470 error_exit "libm check failed"
Natanael Copa8bacde82012-09-12 09:06:51 +00004471fi
4472
4473##########################################
aliguorida93a1f2008-12-12 20:02:52 +00004474# Do we need librt
Natanael Copa8bacde82012-09-12 09:06:51 +00004475# uClibc provides 2 versions of clock_gettime(), one with realtime
4476# support and one without. This means that the clock_gettime() don't
4477# need -lrt. We still need it for timer_create() so we check for this
4478# function in addition.
aliguorida93a1f2008-12-12 20:02:52 +00004479cat > $TMPC <<EOF
4480#include <signal.h>
4481#include <time.h>
Natanael Copa8bacde82012-09-12 09:06:51 +00004482int main(void) {
4483 timer_create(CLOCK_REALTIME, NULL, NULL);
4484 return clock_gettime(CLOCK_REALTIME, NULL);
4485}
aliguorida93a1f2008-12-12 20:02:52 +00004486EOF
4487
Juan Quintela52166aa2009-08-03 14:46:03 +02004488if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02004489 :
Natanael Copa8bacde82012-09-12 09:06:51 +00004490# we need pthread for static linking. use previous pthread test result
Rick Liu18e588b2014-05-30 14:10:20 -07004491elif compile_prog "" "$pthread_lib -lrt" ; then
4492 LIBS="$LIBS -lrt"
4493 libs_qga="$libs_qga -lrt"
aliguorida93a1f2008-12-12 20:02:52 +00004494fi
4495
Blue Swirl31ff5042009-09-12 12:33:07 +00004496if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
Peter Maydell78723752017-09-04 18:19:00 +01004497 "$haiku" != "yes" ; then
Juan Quintela6362a532009-08-03 14:46:32 +02004498 libs_softmmu="-lutil $libs_softmmu"
4499fi
4500
Blue Swirlde5071c2009-09-12 09:58:46 +00004501##########################################
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004502# spice probe
4503if test "$spice" != "no" ; then
4504 cat > $TMPC << EOF
4505#include <spice.h>
4506int main(void) { spice_server_new(); return 0; }
4507EOF
Jiri Denemark710fc4f2011-01-24 13:20:29 +01004508 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
4509 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
Stefan Weil65d5d3f2013-08-27 21:09:13 +02004510 if $pkg_config --atleast-version=0.12.0 spice-server && \
4511 $pkg_config --atleast-version=0.12.3 spice-protocol && \
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004512 compile_prog "$spice_cflags" "$spice_libs" ; then
4513 spice="yes"
4514 libs_softmmu="$libs_softmmu $spice_libs"
4515 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
Alon Levy2e0e3c32012-08-22 11:16:26 +03004516 spice_protocol_version=$($pkg_config --modversion spice-protocol)
4517 spice_server_version=$($pkg_config --modversion spice-server)
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004518 else
4519 if test "$spice" = "yes" ; then
Hu Tao8efc9362014-06-26 17:34:50 +08004520 feature_not_found "spice" \
4521 "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004522 fi
4523 spice="no"
4524 fi
4525fi
4526
Marc-André Lureau7b02f542015-08-30 11:48:40 +02004527# check for smartcard support
Marc-André Lureau7b02f542015-08-30 11:48:40 +02004528if test "$smartcard" != "no"; then
Michal Privoznik0f5c6422018-04-03 12:34:37 +02004529 if $pkg_config --atleast-version=2.5.1 libcacard; then
Marc-André Lureau7b02f542015-08-30 11:48:40 +02004530 libcacard_cflags=$($pkg_config --cflags libcacard)
4531 libcacard_libs=$($pkg_config --libs libcacard)
Marc-André Lureau7b02f542015-08-30 11:48:40 +02004532 smartcard="yes"
Paolo Bonziniafd347a2012-12-20 20:39:36 +01004533 else
Marc-André Lureau7b02f542015-08-30 11:48:40 +02004534 if test "$smartcard" = "yes"; then
4535 feature_not_found "smartcard" "Install libcacard devel"
Paolo Bonziniafd347a2012-12-20 20:39:36 +01004536 fi
Marc-André Lureau7b02f542015-08-30 11:48:40 +02004537 smartcard="no"
Paolo Bonziniafd347a2012-12-20 20:39:36 +01004538 fi
Robert Relyea111a38b2010-11-28 16:36:38 +02004539fi
4540
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004541# check for libusb
4542if test "$libusb" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02004543 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004544 libusb="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02004545 libusb_cflags=$($pkg_config --cflags libusb-1.0)
4546 libusb_libs=$($pkg_config --libs libusb-1.0)
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004547 else
4548 if test "$libusb" = "yes"; then
Hu Tao8efc9362014-06-26 17:34:50 +08004549 feature_not_found "libusb" "Install libusb devel >= 1.0.13"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004550 fi
4551 libusb="no"
4552 fi
4553fi
4554
Hans de Goede69354a82011-07-19 11:04:10 +02004555# check for usbredirparser for usb network redirection support
4556if test "$usb_redir" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02004557 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
Hans de Goede69354a82011-07-19 11:04:10 +02004558 usb_redir="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02004559 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
4560 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
Hans de Goede69354a82011-07-19 11:04:10 +02004561 else
4562 if test "$usb_redir" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11004563 feature_not_found "usb-redir" "Install usbredir devel"
Hans de Goede69354a82011-07-19 11:04:10 +02004564 fi
4565 usb_redir="no"
4566 fi
4567fi
4568
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004569##########################################
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004570# check if we have VSS SDK headers for win
4571
4572if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
4573 case "$vss_win32_sdk" in
Michael Roth690604f2016-06-28 17:31:49 -05004574 "") vss_win32_include="-isystem $source_path" ;;
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004575 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
4576 # handle path with spaces. So we symlink the headers into ".sdk/vss".
Michael Roth690604f2016-06-28 17:31:49 -05004577 vss_win32_include="-isystem $source_path/.sdk/vss"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004578 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
4579 ;;
Michael Roth690604f2016-06-28 17:31:49 -05004580 *) vss_win32_include="-isystem $vss_win32_sdk"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004581 esac
4582 cat > $TMPC << EOF
4583#define __MIDL_user_allocate_free_DEFINED__
4584#include <inc/win2003/vss.h>
4585int main(void) { return VSS_CTX_BACKUP; }
4586EOF
4587 if compile_prog "$vss_win32_include" "" ; then
4588 guest_agent_with_vss="yes"
4589 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
Fam Zheng315d3182016-09-21 12:27:21 +08004590 libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
Michael Rothf33ca812015-08-26 16:19:41 -05004591 qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004592 else
4593 if test "$vss_win32_sdk" != "" ; then
4594 echo "ERROR: Please download and install Microsoft VSS SDK:"
4595 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
4596 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
4597 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
4598 echo "ERROR: The headers are extracted in the directory \`inc'."
4599 feature_not_found "VSS support"
4600 fi
4601 guest_agent_with_vss="no"
4602 fi
4603fi
4604
4605##########################################
4606# lookup Windows platform SDK (if not specified)
4607# The SDK is needed only to build .tlb (type library) file of guest agent
4608# VSS provider from the source. It is usually unnecessary because the
4609# pre-compiled .tlb file is included.
4610
4611if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
4612 if test -z "$win_sdk"; then
4613 programfiles="$PROGRAMFILES"
4614 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
4615 if test -n "$programfiles"; then
4616 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
4617 else
4618 feature_not_found "Windows SDK"
4619 fi
4620 elif test "$win_sdk" = "no"; then
4621 win_sdk=""
4622 fi
4623fi
4624
4625##########################################
Michael Roth50cbebb2015-07-07 18:10:09 -05004626# check if mingw environment provides a recent ntddscsi.h
4627if test "$mingw32" = "yes" -a "$guest_agent" != "no"; then
4628 cat > $TMPC << EOF
4629#include <windows.h>
4630#include <ntddscsi.h>
4631int main(void) {
4632#if !defined(IOCTL_SCSI_GET_ADDRESS)
4633#error Missing required ioctl definitions
4634#endif
4635 SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
4636 return addr.Lun;
4637}
4638EOF
4639 if compile_prog "" "" ; then
4640 guest_agent_ntddscsi=yes
Michael Rothc54e1eb2015-07-07 19:12:18 -05004641 libs_qga="-lsetupapi $libs_qga"
Michael Roth50cbebb2015-07-07 18:10:09 -05004642 fi
4643fi
4644
4645##########################################
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +02004646# virgl renderer probe
4647
4648if test "$virglrenderer" != "no" ; then
4649 cat > $TMPC << EOF
4650#include <virglrenderer.h>
4651int main(void) { virgl_renderer_poll(); return 0; }
4652EOF
4653 virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null)
4654 virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null)
Marc-André Lureau47479c52018-05-25 17:36:09 +02004655 virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null)
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +02004656 if $pkg_config virglrenderer >/dev/null 2>&1 && \
4657 compile_prog "$virgl_cflags" "$virgl_libs" ; then
4658 virglrenderer="yes"
4659 else
4660 if test "$virglrenderer" = "yes" ; then
4661 feature_not_found "virglrenderer"
4662 fi
4663 virglrenderer="no"
4664 fi
4665fi
4666
4667##########################################
Richard Henderson8ca80762017-09-14 09:41:12 -07004668# capstone
4669
Richard Hendersone219c492017-09-28 09:01:23 -07004670case "$capstone" in
4671 "" | yes)
4672 if $pkg_config capstone; then
4673 capstone=system
Alexey Kardashevskiy123ac0b2018-01-15 13:35:01 +11004674 elif test -e "${source_path}/.git" -a $git_update = 'yes' ; then
Richard Hendersone219c492017-09-28 09:01:23 -07004675 capstone=git
4676 elif test -e "${source_path}/capstone/Makefile" ; then
4677 capstone=internal
4678 elif test -z "$capstone" ; then
4679 capstone=no
4680 else
4681 feature_not_found "capstone" "Install capstone devel or git submodule"
4682 fi
4683 ;;
4684
4685 system)
4686 if ! $pkg_config capstone; then
4687 feature_not_found "capstone" "Install capstone devel"
4688 fi
4689 ;;
4690esac
4691
4692case "$capstone" in
4693 git | internal)
4694 if test "$capstone" = git; then
4695 git_submodules="${git_submodules} capstone"
4696 fi
4697 mkdir -p capstone
4698 QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include"
4699 if test "$mingw32" = "yes"; then
4700 LIBCAPSTONE=capstone.lib
4701 else
4702 LIBCAPSTONE=libcapstone.a
4703 fi
4704 LIBS="-L\$(BUILD_DIR)/capstone -lcapstone $LIBS"
4705 ;;
4706
4707 system)
Richard Henderson8ca80762017-09-14 09:41:12 -07004708 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)"
4709 LIBS="$($pkg_config --libs capstone) $LIBS"
Richard Hendersone219c492017-09-28 09:01:23 -07004710 ;;
4711
4712 no)
4713 ;;
4714 *)
4715 error_exit "Unknown state for capstone: $capstone"
4716 ;;
4717esac
Richard Henderson8ca80762017-09-14 09:41:12 -07004718
4719##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00004720# check if we have fdatasync
4721
4722fdatasync=no
4723cat > $TMPC << EOF
4724#include <unistd.h>
Alexandre Raymondd1722a22011-05-29 18:22:48 -04004725int main(void) {
4726#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
4727return fdatasync(0);
4728#else
Stefan Weile172fe12012-04-06 21:33:20 +02004729#error Not supported
Alexandre Raymondd1722a22011-05-29 18:22:48 -04004730#endif
4731}
Blue Swirl5f6b9e82009-09-20 06:56:26 +00004732EOF
4733if compile_prog "" "" ; then
4734 fdatasync=yes
4735fi
4736
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01004737##########################################
Andreas Färbere78815a2010-09-25 11:26:05 +00004738# check if we have madvise
4739
4740madvise=no
4741cat > $TMPC << EOF
4742#include <sys/types.h>
4743#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05004744#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00004745int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
4746EOF
4747if compile_prog "" "" ; then
4748 madvise=yes
4749fi
4750
4751##########################################
4752# check if we have posix_madvise
4753
4754posix_madvise=no
4755cat > $TMPC << EOF
4756#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05004757#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00004758int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
4759EOF
4760if compile_prog "" "" ; then
4761 posix_madvise=yes
4762fi
4763
4764##########################################
Andreas Gustafsson9bc5a712018-01-04 19:39:36 +02004765# check if we have posix_memalign()
4766
4767posix_memalign=no
4768cat > $TMPC << EOF
4769#include <stdlib.h>
4770int main(void) {
4771 void *p;
4772 return posix_memalign(&p, 8, 8);
4773}
4774EOF
4775if compile_prog "" "" ; then
4776 posix_memalign=yes
4777fi
4778
4779##########################################
Paul Durrant0a852412016-08-04 14:44:14 +01004780# check if we have posix_syslog
4781
4782posix_syslog=no
4783cat > $TMPC << EOF
4784#include <syslog.h>
4785int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; }
4786EOF
4787if compile_prog "" "" ; then
4788 posix_syslog=yes
4789fi
4790
4791##########################################
Peter Maydell401bc052017-09-05 13:19:32 +01004792# check if we have sem_timedwait
4793
4794sem_timedwait=no
4795cat > $TMPC << EOF
4796#include <semaphore.h>
4797int main(void) { return sem_timedwait(0, 0); }
4798EOF
4799if compile_prog "" "" ; then
4800 sem_timedwait=yes
4801fi
4802
4803##########################################
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01004804# check if trace backend exists
4805
Lluís Vilanova5b808272014-05-27 15:02:14 +02004806$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01004807if test "$?" -ne 0 ; then
Lluís Vilanova5b808272014-05-27 15:02:14 +02004808 error_exit "invalid trace backends" \
4809 "Please choose supported trace backends."
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01004810fi
4811
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01004812##########################################
4813# For 'ust' backend, test if ust headers are present
Lluís Vilanova5b808272014-05-27 15:02:14 +02004814if have_backend "ust"; then
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01004815 cat > $TMPC << EOF
Mohamad Gebaibf15f632014-01-29 22:47:54 -05004816#include <lttng/tracepoint.h>
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01004817int main(void) { return 0; }
4818EOF
Francis Deslauriersc79ed232016-11-28 10:52:17 -05004819 if compile_prog "" "-Wl,--no-as-needed -ldl" ; then
Mohamad Gebaibf15f632014-01-29 22:47:54 -05004820 if $pkg_config lttng-ust --exists; then
Stefan Weil89138852016-05-16 15:10:20 +02004821 lttng_ust_libs=$($pkg_config --libs lttng-ust)
Mohamad Gebaibf15f632014-01-29 22:47:54 -05004822 else
Francis Deslauriersc79ed232016-11-28 10:52:17 -05004823 lttng_ust_libs="-llttng-ust -ldl"
Mohamad Gebaibf15f632014-01-29 22:47:54 -05004824 fi
4825 if $pkg_config liburcu-bp --exists; then
Stefan Weil89138852016-05-16 15:10:20 +02004826 urcu_bp_libs=$($pkg_config --libs liburcu-bp)
Mohamad Gebaibf15f632014-01-29 22:47:54 -05004827 else
4828 urcu_bp_libs="-lurcu-bp"
4829 fi
4830
4831 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
4832 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01004833 else
Mohamad Gebaibf15f632014-01-29 22:47:54 -05004834 error_exit "Trace backend 'ust' missing lttng-ust header files"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01004835 fi
4836fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00004837
4838##########################################
4839# For 'dtrace' backend, test if 'dtrace' command is present
Lluís Vilanova5b808272014-05-27 15:02:14 +02004840if have_backend "dtrace"; then
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00004841 if ! has 'dtrace' ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01004842 error_exit "dtrace command is not found in PATH $PATH"
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00004843 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00004844 trace_backend_stap="no"
4845 if has 'stap' ; then
4846 trace_backend_stap="yes"
4847 fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00004848fi
4849
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01004850##########################################
Alex Barcelo519175a2012-02-28 12:25:50 +01004851# check and set a backend for coroutine
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05304852
Peter Maydell7c2acc72013-04-08 12:11:27 +01004853# We prefer ucontext, but it's not always possible. The fallback
Daniel P. Berrange33c53c52017-04-28 13:24:44 +01004854# is sigcontext. On Windows the only valid backend is the Windows
4855# specific one.
Peter Maydell7c2acc72013-04-08 12:11:27 +01004856
4857ucontext_works=no
4858if test "$darwin" != "yes"; then
4859 cat > $TMPC << EOF
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05304860#include <ucontext.h>
Peter Maydellcdf84802012-02-23 16:20:05 +00004861#ifdef __stub_makecontext
4862#error Ignoring glibc stub makecontext which will always fail
4863#endif
Stefan Weil75cafad2011-12-17 09:27:29 +01004864int main(void) { makecontext(0, 0, 0); return 0; }
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05304865EOF
Peter Maydell7c2acc72013-04-08 12:11:27 +01004866 if compile_prog "" "" ; then
4867 ucontext_works=yes
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05304868 fi
Peter Maydell7c2acc72013-04-08 12:11:27 +01004869fi
4870
4871if test "$coroutine" = ""; then
4872 if test "$mingw32" = "yes"; then
4873 coroutine=win32
4874 elif test "$ucontext_works" = "yes"; then
4875 coroutine=ucontext
4876 else
4877 coroutine=sigaltstack
4878 fi
Alex Barcelo519175a2012-02-28 12:25:50 +01004879else
Peter Maydell7c2acc72013-04-08 12:11:27 +01004880 case $coroutine in
4881 windows)
4882 if test "$mingw32" != "yes"; then
4883 error_exit "'windows' coroutine backend only valid for Windows"
4884 fi
4885 # Unfortunately the user visible backend name doesn't match the
4886 # coroutine-*.c filename for this case, so we have to adjust it here.
4887 coroutine=win32
4888 ;;
4889 ucontext)
4890 if test "$ucontext_works" != "yes"; then
4891 feature_not_found "ucontext"
4892 fi
4893 ;;
Daniel P. Berrange33c53c52017-04-28 13:24:44 +01004894 sigaltstack)
Peter Maydell7c2acc72013-04-08 12:11:27 +01004895 if test "$mingw32" = "yes"; then
4896 error_exit "only the 'windows' coroutine backend is valid for Windows"
4897 fi
4898 ;;
4899 *)
4900 error_exit "unknown coroutine backend $coroutine"
4901 ;;
4902 esac
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05304903fi
4904
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02004905if test "$coroutine_pool" = ""; then
Daniel P. Berrange33c53c52017-04-28 13:24:44 +01004906 coroutine_pool=yes
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02004907fi
4908
Peter Lieven7d992e42016-09-27 11:58:45 +02004909if test "$debug_stack_usage" = "yes"; then
Peter Lieven7d992e42016-09-27 11:58:45 +02004910 if test "$coroutine_pool" = "yes"; then
4911 echo "WARN: disabling coroutine pool for stack usage debugging"
4912 coroutine_pool=no
4913 fi
4914fi
4915
4916
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05304917##########################################
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05304918# check if we have open_by_handle_at
4919
Stefan Weil4e1797f2012-06-18 22:11:06 +02004920open_by_handle_at=no
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05304921cat > $TMPC << EOF
4922#include <fcntl.h>
Stefan Weilacc55ba2012-06-06 19:35:57 +00004923#if !defined(AT_EMPTY_PATH)
4924# error missing definition
4925#else
Stefan Weil75cafad2011-12-17 09:27:29 +01004926int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
Stefan Weilacc55ba2012-06-06 19:35:57 +00004927#endif
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05304928EOF
4929if compile_prog "" "" ; then
4930 open_by_handle_at=yes
4931fi
4932
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05304933########################################
4934# check if we have linux/magic.h
4935
4936linux_magic_h=no
4937cat > $TMPC << EOF
4938#include <linux/magic.h>
4939int main(void) {
Stefan Weil75cafad2011-12-17 09:27:29 +01004940 return 0;
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05304941}
4942EOF
4943if compile_prog "" "" ; then
4944 linux_magic_h=yes
4945fi
4946
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03004947########################################
Kevin Wolfc95e3082013-02-22 21:08:51 +01004948# check whether we can disable warning option with a pragma (this is needed
4949# to silence warnings in the headers of some versions of external libraries).
4950# This test has to be compiled with -Werror as otherwise an unknown pragma is
4951# only a warning.
4952#
4953# If we can't selectively disable warning in the code, disable -Werror so that
4954# the build doesn't fail anyway.
4955
Peter Maydell06d71fa2012-07-30 16:13:07 +01004956pragma_disable_unused_but_set=no
4957cat > $TMPC << EOF
Markus Armbrustere6f53fd2013-04-16 13:51:06 +02004958#pragma GCC diagnostic push
Kevin Wolfc95e3082013-02-22 21:08:51 +01004959#pragma GCC diagnostic ignored "-Wstrict-prototypes"
Markus Armbrustere6f53fd2013-04-16 13:51:06 +02004960#pragma GCC diagnostic pop
Kevin Wolfc95e3082013-02-22 21:08:51 +01004961
Peter Maydell06d71fa2012-07-30 16:13:07 +01004962int main(void) {
4963 return 0;
4964}
4965EOF
4966if compile_prog "-Werror" "" ; then
Gerd Hoffmanncc6e3ca2013-01-09 10:17:07 +01004967 pragma_diagnostic_available=yes
Kevin Wolfc95e3082013-02-22 21:08:51 +01004968else
4969 werror=no
Peter Maydell06d71fa2012-07-30 16:13:07 +01004970fi
4971
4972########################################
Christian Borntraeger541be922014-09-25 21:07:54 +02004973# check if we have valgrind/valgrind.h
Kevin Wolf3f4349d2012-06-29 13:40:27 +02004974
4975valgrind_h=no
4976cat > $TMPC << EOF
4977#include <valgrind/valgrind.h>
Kevin Wolf3f4349d2012-06-29 13:40:27 +02004978int main(void) {
Kevin Wolf3f4349d2012-06-29 13:40:27 +02004979 return 0;
4980}
4981EOF
4982if compile_prog "" "" ; then
4983 valgrind_h=yes
4984fi
4985
4986########################################
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03004987# check if environ is declared
4988
4989has_environ=no
4990cat > $TMPC << EOF
4991#include <unistd.h>
4992int main(void) {
Blue Swirlc075a722012-08-09 20:21:25 +00004993 environ = 0;
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03004994 return 0;
4995}
4996EOF
4997if compile_prog "" "" ; then
4998 has_environ=yes
4999fi
5000
Richard Henderson76a347e2012-12-28 14:17:02 -08005001########################################
5002# check if cpuid.h is usable.
5003
Richard Henderson76a347e2012-12-28 14:17:02 -08005004cat > $TMPC << EOF
5005#include <cpuid.h>
5006int main(void) {
Peter Maydell774d5662014-02-20 19:42:53 +00005007 unsigned a, b, c, d;
5008 int max = __get_cpuid_max(0, 0);
5009
5010 if (max >= 1) {
5011 __cpuid(1, a, b, c, d);
5012 }
5013
5014 if (max >= 7) {
5015 __cpuid_count(7, 0, a, b, c, d);
5016 }
5017
5018 return 0;
Richard Henderson76a347e2012-12-28 14:17:02 -08005019}
5020EOF
5021if compile_prog "" "" ; then
5022 cpuid_h=yes
5023fi
5024
Richard Henderson5dd89902017-07-18 18:40:18 -10005025##########################################
5026# avx2 optimization requirement check
5027#
5028# There is no point enabling this if cpuid.h is not usable,
5029# since we won't be able to select the new routines.
5030
5031if test $cpuid_h = yes; then
5032 cat > $TMPC << EOF
5033#pragma GCC push_options
5034#pragma GCC target("avx2")
5035#include <cpuid.h>
5036#include <immintrin.h>
5037static int bar(void *a) {
5038 __m256i x = *(__m256i *)a;
5039 return _mm256_testz_si256(x, x);
5040}
5041int main(int argc, char *argv[]) { return bar(argv[0]); }
5042EOF
5043 if compile_object "" ; then
5044 avx2_opt="yes"
5045 fi
5046fi
5047
Richard Hendersonf5401662013-02-16 12:46:59 -08005048########################################
5049# check if __[u]int128_t is usable.
5050
5051int128=no
5052cat > $TMPC << EOF
Stefan Weila00f66a2014-03-07 10:43:38 +01005053#if defined(__clang_major__) && defined(__clang_minor__)
5054# if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
5055# error __int128_t does not work in CLANG before 3.2
5056# endif
5057#endif
Richard Hendersonf5401662013-02-16 12:46:59 -08005058__int128_t a;
5059__uint128_t b;
5060int main (void) {
5061 a = a + b;
5062 b = a * b;
Peter Maydell464e3672013-06-21 14:01:31 +01005063 a = a * a;
Richard Hendersonf5401662013-02-16 12:46:59 -08005064 return 0;
5065}
5066EOF
5067if compile_prog "" "" ; then
5068 int128=yes
5069fi
Richard Henderson76a347e2012-12-28 14:17:02 -08005070
Richard Henderson7ebee432016-06-29 21:10:59 -07005071#########################################
5072# See if 128-bit atomic operations are supported.
5073
5074atomic128=no
5075if test "$int128" = "yes"; then
5076 cat > $TMPC << EOF
5077int main(void)
5078{
5079 unsigned __int128 x = 0, y = 0;
5080 y = __atomic_load_16(&x, 0);
5081 __atomic_store_16(&x, y, 0);
5082 __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0);
5083 return 0;
5084}
5085EOF
5086 if compile_prog "" "" ; then
5087 atomic128=yes
5088 fi
5089fi
5090
Richard Hendersondf79b992016-09-02 12:23:57 -07005091#########################################
5092# See if 64-bit atomic operations are supported.
5093# Note that without __atomic builtins, we can only
5094# assume atomic loads/stores max at pointer size.
5095
5096cat > $TMPC << EOF
5097#include <stdint.h>
5098int main(void)
5099{
5100 uint64_t x = 0, y = 0;
5101#ifdef __ATOMIC_RELAXED
5102 y = __atomic_load_8(&x, 0);
5103 __atomic_store_8(&x, y, 0);
5104 __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
5105 __atomic_exchange_8(&x, y, 0);
5106 __atomic_fetch_add_8(&x, y, 0);
5107#else
5108 typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
5109 __sync_lock_test_and_set(&x, y);
5110 __sync_val_compare_and_swap(&x, y, 0);
5111 __sync_fetch_and_add(&x, y);
5112#endif
5113 return 0;
5114}
5115EOF
5116if compile_prog "" "" ; then
5117 atomic64=yes
5118fi
5119
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08005120########################################
Richard Hendersondb432672017-09-15 14:11:45 -07005121# See if 16-byte vector operations are supported.
5122# Even without a vector unit the compiler may expand these.
5123# There is a bug in old GCC for PPC that crashes here.
5124# Unfortunately it's the system compiler for Centos 7.
5125
5126cat > $TMPC << EOF
5127typedef unsigned char U1 __attribute__((vector_size(16)));
5128typedef unsigned short U2 __attribute__((vector_size(16)));
5129typedef unsigned int U4 __attribute__((vector_size(16)));
5130typedef unsigned long long U8 __attribute__((vector_size(16)));
5131typedef signed char S1 __attribute__((vector_size(16)));
5132typedef signed short S2 __attribute__((vector_size(16)));
5133typedef signed int S4 __attribute__((vector_size(16)));
5134typedef signed long long S8 __attribute__((vector_size(16)));
5135static U1 a1, b1;
5136static U2 a2, b2;
5137static U4 a4, b4;
5138static U8 a8, b8;
5139static S1 c1;
5140static S2 c2;
5141static S4 c4;
5142static S8 c8;
5143static int i;
Laurent Vivier74912f62018-03-28 15:31:52 +02005144void helper(void *d, void *a, int shift, int i);
5145void helper(void *d, void *a, int shift, int i)
5146{
5147 *(U1 *)(d + i) = *(U1 *)(a + i) << shift;
5148 *(U2 *)(d + i) = *(U2 *)(a + i) << shift;
5149 *(U4 *)(d + i) = *(U4 *)(a + i) << shift;
5150 *(U8 *)(d + i) = *(U8 *)(a + i) << shift;
5151}
Richard Hendersondb432672017-09-15 14:11:45 -07005152int main(void)
5153{
5154 a1 += b1; a2 += b2; a4 += b4; a8 += b8;
5155 a1 -= b1; a2 -= b2; a4 -= b4; a8 -= b8;
5156 a1 *= b1; a2 *= b2; a4 *= b4; a8 *= b8;
5157 a1 &= b1; a2 &= b2; a4 &= b4; a8 &= b8;
5158 a1 |= b1; a2 |= b2; a4 |= b4; a8 |= b8;
5159 a1 ^= b1; a2 ^= b2; a4 ^= b4; a8 ^= b8;
5160 a1 <<= i; a2 <<= i; a4 <<= i; a8 <<= i;
5161 a1 >>= i; a2 >>= i; a4 >>= i; a8 >>= i;
5162 c1 >>= i; c2 >>= i; c4 >>= i; c8 >>= i;
5163 return 0;
5164}
5165EOF
5166
5167vector16=no
5168if compile_prog "" "" ; then
5169 vector16=yes
5170fi
5171
5172########################################
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08005173# check if getauxval is available.
5174
5175getauxval=no
5176cat > $TMPC << EOF
5177#include <sys/auxv.h>
5178int main(void) {
5179 return getauxval(AT_HWCAP) == 0;
5180}
5181EOF
5182if compile_prog "" "" ; then
5183 getauxval=yes
5184fi
5185
John Snowfd0e6052015-03-25 18:57:39 -04005186########################################
5187# check if ccache is interfering with
5188# semantic analysis of macros
5189
John Snow5e4dfd32015-10-28 13:56:40 -04005190unset CCACHE_CPP2
John Snowfd0e6052015-03-25 18:57:39 -04005191ccache_cpp2=no
5192cat > $TMPC << EOF
5193static const int Z = 1;
5194#define fn() ({ Z; })
5195#define TAUT(X) ((X) == Z)
5196#define PAREN(X, Y) (X == Y)
5197#define ID(X) (X)
5198int main(int argc, char *argv[])
5199{
5200 int x = 0, y = 0;
5201 x = ID(x);
5202 x = fn();
5203 fn();
5204 if (PAREN(x, y)) return 0;
5205 if (TAUT(Z)) return 0;
5206 return 0;
5207}
5208EOF
5209
5210if ! compile_object "-Werror"; then
5211 ccache_cpp2=yes
5212fi
5213
John Snowb553a042015-11-03 15:43:42 -05005214#################################################
5215# clang does not support glibc + FORTIFY_SOURCE.
5216
5217if test "$fortify_source" != "no"; then
5218 if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
5219 fortify_source="no";
Peter Maydelle1890912017-06-26 16:25:24 +01005220 elif test -n "$cxx" && has $cxx &&
John Snowcfcc7c12015-11-12 11:29:49 -05005221 echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then
John Snowb553a042015-11-03 15:43:42 -05005222 fortify_source="no";
5223 else
5224 fortify_source="yes"
5225 fi
5226fi
5227
Fam Zheng1efad062018-06-01 17:26:43 +08005228###############################################
5229# Check if copy_file_range is provided by glibc
5230have_copy_file_range=no
5231cat > $TMPC << EOF
5232#include <unistd.h>
5233int main(void) {
5234 copy_file_range(0, NULL, 0, NULL, 0, 0);
5235 return 0;
5236}
5237EOF
5238if compile_prog "" "" ; then
5239 have_copy_file_range=yes
5240fi
5241
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05305242##########################################
Jan Vesely277abf12016-04-29 13:15:23 -04005243# check if struct fsxattr is available via linux/fs.h
5244
5245have_fsxattr=no
5246cat > $TMPC << EOF
5247#include <linux/fs.h>
5248struct fsxattr foo;
5249int main(void) {
5250 return 0;
5251}
5252EOF
5253if compile_prog "" "" ; then
5254 have_fsxattr=yes
5255fi
5256
Peter Maydellb66e10e2016-06-08 18:34:32 +01005257##########################################
Paolo Bonzinia40161c2018-02-16 10:05:23 +01005258# check for usable membarrier system call
5259if test "$membarrier" = "yes"; then
5260 have_membarrier=no
5261 if test "$mingw32" = "yes" ; then
5262 have_membarrier=yes
5263 elif test "$linux" = "yes" ; then
5264 cat > $TMPC << EOF
5265 #include <linux/membarrier.h>
5266 #include <sys/syscall.h>
5267 #include <unistd.h>
5268 #include <stdlib.h>
5269 int main(void) {
5270 syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0);
5271 syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0);
5272 exit(0);
5273 }
5274EOF
5275 if compile_prog "" "" ; then
5276 have_membarrier=yes
5277 fi
5278 fi
5279 if test "$have_membarrier" = "no"; then
5280 feature_not_found "membarrier" "membarrier system call not available"
5281 fi
5282else
5283 # Do not enable it by default even for Mingw32, because it doesn't
5284 # work on Wine.
5285 membarrier=no
5286fi
5287
5288##########################################
Peter Maydellb66e10e2016-06-08 18:34:32 +01005289# check if rtnetlink.h exists and is useful
Laurent Vivier575b22b2016-06-02 22:14:15 +02005290have_rtnetlink=no
5291cat > $TMPC << EOF
5292#include <linux/rtnetlink.h>
5293int main(void) {
5294 return IFLA_PROTO_DOWN;
5295}
5296EOF
5297if compile_prog "" "" ; then
5298 have_rtnetlink=yes
5299fi
5300
Stefan Hajnoczi6a02c802016-10-14 10:00:55 +01005301##########################################
5302# check for usable AF_VSOCK environment
5303have_af_vsock=no
5304cat > $TMPC << EOF
5305#include <errno.h>
5306#include <sys/types.h>
5307#include <sys/socket.h>
5308#if !defined(AF_VSOCK)
5309# error missing AF_VSOCK flag
5310#endif
5311#include <linux/vm_sockets.h>
5312int main(void) {
5313 int sock, ret;
5314 struct sockaddr_vm svm;
5315 socklen_t len = sizeof(svm);
5316 sock = socket(AF_VSOCK, SOCK_STREAM, 0);
5317 ret = getpeername(sock, (struct sockaddr *)&svm, &len);
5318 if ((ret == -1) && (errno == ENOTCONN)) {
5319 return 0;
5320 }
5321 return -1;
5322}
5323EOF
5324if compile_prog "" "" ; then
5325 have_af_vsock=yes
5326fi
5327
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04005328##########################################
5329# check for usable AF_ALG environment
5330hava_afalg=no
5331cat > $TMPC << EOF
5332#include <errno.h>
5333#include <sys/types.h>
5334#include <sys/socket.h>
5335#include <linux/if_alg.h>
5336int main(void) {
5337 int sock;
5338 sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
5339 return sock;
5340}
5341EOF
5342if compile_prog "" "" ; then
5343 have_afalg=yes
5344fi
5345if test "$crypto_afalg" = "yes"
5346then
5347 if test "$have_afalg" != "yes"
5348 then
5349 error_exit "AF_ALG requested but could not be detected"
5350 fi
5351fi
5352
5353
James Clarke6969ec62016-06-06 12:02:50 +01005354#################################################
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05005355# Check to see if we have the Hypervisor framework
Peter Maydelld2d08522018-01-08 17:10:42 +00005356if [ "$darwin" = "yes" ] ; then
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05005357 cat > $TMPC << EOF
5358#include <Hypervisor/hv.h>
5359int main() { return 0;}
5360EOF
5361 if ! compile_object ""; then
5362 hvf='no'
5363 else
5364 hvf='yes'
5365 LDFLAGS="-framework Hypervisor $LDFLAGS"
5366 fi
5367fi
5368
5369#################################################
James Clarke6969ec62016-06-06 12:02:50 +01005370# Sparc implicitly links with --relax, which is
5371# incompatible with -r, so --no-relax should be
5372# given. It does no harm to give it on other
5373# platforms too.
5374
5375# Note: the prototype is needed since QEMU_CFLAGS
5376# contains -Wmissing-prototypes
5377cat > $TMPC << EOF
5378extern int foo(void);
5379int foo(void) { return 0; }
5380EOF
5381if ! compile_object ""; then
5382 error_exit "Failed to compile object file for LD_REL_FLAGS test"
5383fi
Paolo Bonzini7ecf44a2016-11-29 16:37:20 +01005384for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do
5385 if do_cc -nostdlib $i -o $TMPMO $TMPO; then
5386 LD_REL_FLAGS=$i
5387 break
5388 fi
5389done
5390if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then
5391 feature_not_found "modules" "Cannot find how to build relocatable objects"
James Clarke6969ec62016-06-06 12:02:50 +01005392fi
5393
Jan Vesely277abf12016-04-29 13:15:23 -04005394##########################################
Christopher Covington4d043512016-12-28 15:04:33 -05005395# check for sysmacros.h
5396
5397have_sysmacros=no
5398cat > $TMPC << EOF
5399#include <sys/sysmacros.h>
5400int main(void) {
5401 return makedev(0, 0);
5402}
5403EOF
5404if compile_prog "" "" ; then
5405 have_sysmacros=yes
5406fi
5407
5408##########################################
Ashish Mittalda92c3f2017-04-03 20:48:08 -07005409# Veritas HyperScale block driver VxHS
5410# Check if libvxhs is installed
5411
5412if test "$vxhs" != "no" ; then
5413 cat > $TMPC <<EOF
5414#include <stdint.h>
5415#include <qnio/qnio_api.h>
5416
5417void *vxhs_callback;
5418
5419int main(void) {
5420 iio_init(QNIO_VERSION, vxhs_callback);
5421 return 0;
5422}
5423EOF
5424 vxhs_libs="-lvxhs -lssl"
5425 if compile_prog "" "$vxhs_libs" ; then
5426 vxhs=yes
5427 else
5428 if test "$vxhs" = "yes" ; then
5429 feature_not_found "vxhs block device" "Install libvxhs See github"
5430 fi
5431 vxhs=no
5432 fi
5433fi
5434
5435##########################################
Andreas Grapentin49e00a12017-03-14 17:59:53 +01005436# check for _Static_assert()
5437
5438have_static_assert=no
5439cat > $TMPC << EOF
5440_Static_assert(1, "success");
5441int main(void) {
5442 return 0;
5443}
5444EOF
5445if compile_prog "" "" ; then
5446 have_static_assert=yes
5447fi
5448
5449##########################################
Tomáš Golembiovskýe6746052017-07-17 15:58:33 +02005450# check for utmpx.h, it is missing e.g. on OpenBSD
5451
5452have_utmpx=no
5453cat > $TMPC << EOF
5454#include <utmpx.h>
5455struct utmpx user_info;
5456int main(void) {
5457 return 0;
5458}
5459EOF
5460if compile_prog "" "" ; then
5461 have_utmpx=yes
5462fi
5463
5464##########################################
Marc-André Lureau247724c2018-01-16 16:11:51 +01005465# checks for sanitizers
5466
Marc-André Lureau247724c2018-01-16 16:11:51 +01005467have_asan=no
5468have_ubsan=no
Marc-André Lureaud83414e2018-01-16 16:11:52 +01005469have_asan_iface_h=no
5470have_asan_iface_fiber=no
Marc-André Lureau247724c2018-01-16 16:11:51 +01005471
5472if test "$sanitizers" = "yes" ; then
Marc-André Lureaub9f44da2018-02-15 22:25:47 +01005473 write_c_skeleton
Marc-André Lureau247724c2018-01-16 16:11:51 +01005474 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then
5475 have_asan=yes
5476 fi
Marc-André Lureaub9f44da2018-02-15 22:25:47 +01005477
5478 # we could use a simple skeleton for flags checks, but this also
5479 # detect the static linking issue of ubsan, see also:
5480 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
5481 cat > $TMPC << EOF
5482#include <stdlib.h>
5483int main(void) {
5484 void *tmp = malloc(10);
5485 return *(int *)(tmp + 2);
5486}
5487EOF
Marc-André Lureau247724c2018-01-16 16:11:51 +01005488 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
5489 have_ubsan=yes
5490 fi
Marc-André Lureaud83414e2018-01-16 16:11:52 +01005491
5492 if check_include "sanitizer/asan_interface.h" ; then
5493 have_asan_iface_h=yes
5494 fi
5495
5496 cat > $TMPC << EOF
5497#include <sanitizer/asan_interface.h>
5498int main(void) {
5499 __sanitizer_start_switch_fiber(0, 0, 0);
5500 return 0;
5501}
5502EOF
5503 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then
5504 have_asan_iface_fiber=yes
5505 fi
Marc-André Lureau247724c2018-01-16 16:11:51 +01005506fi
5507
5508##########################################
Alex Bennée51a12b52018-04-04 14:24:39 +01005509# Docker and cross-compiler support
5510#
5511# This is specifically for building test
5512# cases for foreign architectures, not
5513# cross-compiling QEMU itself.
5514
5515if has "docker"; then
5516 docker=$($python $source_path/tests/docker/docker.py probe)
5517fi
5518
5519##########################################
Juan Quintelae86ecd42009-08-03 14:45:59 +02005520# End of CC checks
5521# After here, no more $cc or $ld runs
5522
Marc-André Lureaud83414e2018-01-16 16:11:52 +01005523write_c_skeleton
5524
Blue Swirl1d728c32012-05-01 18:45:39 +00005525if test "$gcov" = "yes" ; then
5526 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
5527 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
John Snowb553a042015-11-03 15:43:42 -05005528elif test "$fortify_source" = "yes" ; then
Michal Privoznike600cdf2013-09-05 12:54:49 +02005529 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
Paolo Bonzini48e56d52018-03-06 11:32:44 +01005530elif test "$debug" = "no"; then
5531 CFLAGS="-O2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02005532fi
Juan Quintelaa316e372009-09-30 01:10:55 +02005533
Marc-André Lureau247724c2018-01-16 16:11:51 +01005534if test "$have_asan" = "yes"; then
5535 CFLAGS="-fsanitize=address $CFLAGS"
Marc-André Lureaud83414e2018-01-16 16:11:52 +01005536 if test "$have_asan_iface_h" = "no" ; then
5537 echo "ASAN build enabled, but ASAN header missing." \
5538 "Without code annotation, the report may be inferior."
5539 elif test "$have_asan_iface_fiber" = "no" ; then
5540 echo "ASAN build enabled, but ASAN header is too old." \
5541 "Without code annotation, the report may be inferior."
5542 fi
Marc-André Lureau247724c2018-01-16 16:11:51 +01005543fi
5544if test "$have_ubsan" = "yes"; then
5545 CFLAGS="-fsanitize=undefined $CFLAGS"
5546fi
5547
Peter Lieven6542aa92014-02-03 10:26:13 +01005548##########################################
5549# Do we have libnfs
5550if test "$libnfs" != "no" ; then
Peter Lievenb7d769c2014-03-17 09:37:33 +01005551 if $pkg_config --atleast-version=1.9.3 libnfs; then
Peter Lieven6542aa92014-02-03 10:26:13 +01005552 libnfs="yes"
5553 libnfs_libs=$($pkg_config --libs libnfs)
Peter Lieven6542aa92014-02-03 10:26:13 +01005554 else
5555 if test "$libnfs" = "yes" ; then
Hu Tao8efc9362014-06-26 17:34:50 +08005556 feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
Peter Lieven6542aa92014-02-03 10:26:13 +01005557 fi
5558 libnfs="no"
5559 fi
5560fi
Blue Swirl1d728c32012-05-01 18:45:39 +00005561
Peter Maydell6ca026c2012-07-18 15:10:18 +01005562# Now we've finished running tests it's OK to add -Werror to the compiler flags
5563if test "$werror" = "yes"; then
5564 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
5565fi
5566
Juan Quintelae86ecd42009-08-03 14:45:59 +02005567if test "$solaris" = "no" ; then
5568 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02005569 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02005570 fi
5571fi
5572
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02005573# test if pod2man has --utf8 option
5574if pod2man --help | grep -q utf8; then
5575 POD2MAN="pod2man --utf8"
5576else
5577 POD2MAN="pod2man"
5578fi
5579
Blue Swirl952afb72010-09-19 08:36:34 +00005580# Use ASLR, no-SEH and DEP if available
5581if test "$mingw32" = "yes" ; then
5582 for flag in --dynamicbase --no-seh --nxcompat; do
Christian Borntraegere9a35912017-08-23 12:16:23 +02005583 if ld_has $flag ; then
Blue Swirl952afb72010-09-19 08:36:34 +00005584 LDFLAGS="-Wl,$flag $LDFLAGS"
5585 fi
5586 done
5587fi
5588
Eduardo Habkost10ea68b2012-04-18 16:55:39 -03005589qemu_confdir=$sysconfdir$confsuffix
Fam Zhenge26110c2014-02-10 14:48:57 +08005590qemu_moddir=$libdir$confsuffix
Eduardo Habkost528ae5b2012-04-18 16:55:49 -03005591qemu_datadir=$datadir$confsuffix
Anthony Liguori834574e2013-02-20 07:43:24 -06005592qemu_localedir="$datadir/locale"
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02005593
Kamil Rytarowskie0580342017-07-14 09:33:44 +01005594# We can only support ivshmem if we have eventfd
5595if [ "$eventfd" = "yes" ]; then
5596 ivshmem=yes
5597fi
5598
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01005599tools=""
5600if test "$want_tools" = "yes" ; then
Paolo Bonzinica35f782010-05-26 16:08:29 +02005601 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01005602 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
5603 tools="qemu-nbd\$(EXESUF) $tools"
Kamil Rytarowskib1449ed2017-07-14 09:33:45 +01005604 fi
5605 if [ "$ivshmem" = "yes" ]; then
David Marchanda75eb032014-09-08 11:17:48 +02005606 tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01005607 fi
5608fi
5609if test "$softmmu" = yes ; then
Paolo Bonzinib855f8d2017-08-22 06:50:18 +02005610 if test "$linux" = yes; then
5611 if test "$virtfs" != no && test "$cap" = yes && test "$attr" = yes ; then
Andreas Färberaabfd882012-05-01 01:12:02 +02005612 virtfs=yes
5613 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
5614 else
5615 if test "$virtfs" = yes; then
Paolo Bonzinib855f8d2017-08-22 06:50:18 +02005616 error_exit "VirtFS requires libcap devel and libattr devel"
Meador Inge983eef52012-02-24 14:00:42 +05305617 fi
Andreas Färber17500372012-05-01 01:12:03 +02005618 virtfs=no
Andreas Färberaabfd882012-05-01 01:12:02 +02005619 fi
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02005620 if test "$mpath" != no && test "$mpathpersist" = yes ; then
5621 mpath=yes
5622 else
5623 if test "$mpath" = yes; then
5624 error_exit "Multipath requires libmpathpersist devel"
5625 fi
5626 mpath=no
5627 fi
Paolo Bonzinib855f8d2017-08-22 06:50:18 +02005628 tools="$tools scsi/qemu-pr-helper\$(EXESUF)"
5629 else
5630 if test "$virtfs" = yes; then
5631 error_exit "VirtFS is supported only on Linux"
5632 fi
5633 virtfs=no
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02005634 if test "$mpath" = yes; then
5635 error_exit "Multipath is supported only on Linux"
5636 fi
5637 mpath=no
M. Mohan Kumar17bff522011-12-14 13:58:42 +05305638 fi
Laurent Vivierff69fd82017-10-19 21:16:06 +02005639 if test "$xkbcommon" = "yes"; then
5640 tools="qemu-keymap\$(EXESUF) $tools"
5641 fi
Gerd Hoffmann6a021532017-10-05 17:33:28 +02005642fi
Michael Roth9d6bc272015-08-26 10:49:13 -05005643
5644# Probe for guest agent support/options
5645
Michael Tokareve8ef31a2013-07-31 14:22:07 +04005646if [ "$guest_agent" != "no" ]; then
Tomoki Sekiyamab39297a2013-08-07 11:40:18 -04005647 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
Michael Rothfafcaf12015-09-07 18:47:05 -05005648 tools="qemu-ga $tools"
Michael Tokareve8ef31a2013-07-31 14:22:07 +04005649 guest_agent=yes
5650 elif [ "$guest_agent" != yes ]; then
5651 guest_agent=no
5652 else
5653 error_exit "Guest agent is not supported on this platform"
Paolo Bonzinica35f782010-05-26 16:08:29 +02005654 fi
Paolo Bonzini00c705f2012-05-29 11:40:24 +02005655fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02005656
Michael Roth9d6bc272015-08-26 10:49:13 -05005657# Guest agent Window MSI package
5658
5659if test "$guest_agent" != yes; then
5660 if test "$guest_agent_msi" = yes; then
5661 error_exit "MSI guest agent package requires guest agent enabled"
5662 fi
5663 guest_agent_msi=no
5664elif test "$mingw32" != "yes"; then
5665 if test "$guest_agent_msi" = "yes"; then
5666 error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation"
5667 fi
5668 guest_agent_msi=no
5669elif ! has wixl; then
5670 if test "$guest_agent_msi" = "yes"; then
5671 error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )"
5672 fi
5673 guest_agent_msi=no
Michael Roth1a349042015-08-26 11:14:31 -05005674else
5675 # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't
5676 # disabled explicitly
5677 if test "$guest_agent_msi" != "no"; then
5678 guest_agent_msi=yes
5679 fi
Michael Roth9d6bc272015-08-26 10:49:13 -05005680fi
5681
Michael Roth1a349042015-08-26 11:14:31 -05005682if test "$guest_agent_msi" = "yes"; then
Michael Roth9d6bc272015-08-26 10:49:13 -05005683 if test "$guest_agent_with_vss" = "yes"; then
5684 QEMU_GA_MSI_WITH_VSS="-D InstallVss"
5685 fi
5686
5687 if test "$QEMU_GA_MANUFACTURER" = ""; then
5688 QEMU_GA_MANUFACTURER=QEMU
5689 fi
5690
5691 if test "$QEMU_GA_DISTRO" = ""; then
5692 QEMU_GA_DISTRO=Linux
5693 fi
5694
5695 if test "$QEMU_GA_VERSION" = ""; then
Stefan Weil89138852016-05-16 15:10:20 +02005696 QEMU_GA_VERSION=$(cat $source_path/VERSION)
Michael Roth9d6bc272015-08-26 10:49:13 -05005697 fi
5698
Stefan Weil89138852016-05-16 15:10:20 +02005699 QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin"
Michael Roth9d6bc272015-08-26 10:49:13 -05005700
5701 case "$cpu" in
5702 x86_64)
5703 QEMU_GA_MSI_ARCH="-a x64 -D Arch=64"
5704 ;;
5705 i386)
5706 QEMU_GA_MSI_ARCH="-D Arch=32"
5707 ;;
5708 *)
5709 error_exit "CPU $cpu not supported for building installation package"
5710 ;;
5711 esac
5712fi
5713
Paolo Bonzinica35f782010-05-26 16:08:29 +02005714# Mac OS X ships with a broken assembler
5715roms=
5716if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
5717 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
5718 "$softmmu" = yes ; then
Peter Maydelle57218b2016-08-08 17:11:28 +01005719 # Different host OS linkers have different ideas about the name of the ELF
Brad Smithc65d5e42017-11-07 18:46:11 -05005720 # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
5721 # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
5722 for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do
Peter Maydelle57218b2016-08-08 17:11:28 +01005723 if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
5724 ld_i386_emulation="$emu"
5725 roms="optionrom"
5726 break
5727 fi
5728 done
Paolo Bonzinica35f782010-05-26 16:08:29 +02005729fi
Andreas Färberd0384d12011-05-01 18:23:56 +02005730if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
David Gibson39ac8452011-04-01 15:15:23 +11005731 roms="$roms spapr-rtas"
5732fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02005733
Christian Borntraeger9933c302013-04-23 01:23:03 +00005734if test "$cpu" = "s390x" ; then
5735 roms="$roms s390-ccw"
5736fi
5737
Richard Henderson964c6fa2013-06-21 19:10:16 -07005738# Probe for the need for relocating the user-only binary.
Peter Maydell92fe2ba2016-06-18 23:05:01 +01005739if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
Richard Henderson964c6fa2013-06-21 19:10:16 -07005740 textseg_addr=
5741 case "$cpu" in
Richard Henderson479eb122014-04-24 08:25:03 -07005742 arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
5743 # ??? Rationale for choosing this address
Richard Henderson964c6fa2013-06-21 19:10:16 -07005744 textseg_addr=0x60000000
5745 ;;
5746 mips)
Richard Henderson479eb122014-04-24 08:25:03 -07005747 # A 256M aligned address, high in the address space, with enough
5748 # room for the code_gen_buffer above it before the stack.
5749 textseg_addr=0x60000000
Richard Henderson964c6fa2013-06-21 19:10:16 -07005750 ;;
5751 esac
5752 if [ -n "$textseg_addr" ]; then
5753 cat > $TMPC <<EOF
5754 int main(void) { return 0; }
5755EOF
5756 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
5757 if ! compile_prog "" "$textseg_ldflags"; then
5758 # In case ld does not support -Ttext-segment, edit the default linker
5759 # script via sed to set the .text start addr. This is needed on FreeBSD
5760 # at least.
Peter Maydell92fe2ba2016-06-18 23:05:01 +01005761 if ! $ld --verbose >/dev/null 2>&1; then
5762 error_exit \
5763 "We need to link the QEMU user mode binaries at a" \
5764 "specific text address. Unfortunately your linker" \
5765 "doesn't support either the -Ttext-segment option or" \
5766 "printing the default linker script with --verbose." \
5767 "If you don't want the user mode binaries, pass the" \
5768 "--disable-user option to configure."
5769 fi
5770
Richard Henderson964c6fa2013-06-21 19:10:16 -07005771 $ld --verbose | sed \
5772 -e '1,/==================================================/d' \
5773 -e '/==================================================/,$d' \
5774 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
5775 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
5776 textseg_ldflags="-Wl,-T../config-host.ld"
5777 fi
5778 fi
5779fi
5780
Bruno Dominguez11cde1c2017-06-06 14:07:47 +01005781# Check that the C++ compiler exists and works with the C compiler.
5782# All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
5783if has $cxx; then
5784 cat > $TMPC <<EOF
5785int c_function(void);
5786int main(void) { return c_function(); }
5787EOF
5788
5789 compile_object
5790
5791 cat > $TMPCXX <<EOF
5792extern "C" {
5793 int c_function(void);
5794}
5795int c_function(void) { return 42; }
5796EOF
5797
5798 update_cxxflags
5799
5800 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
5801 # C++ compiler $cxx works ok with C compiler $cc
5802 :
5803 else
5804 echo "C++ compiler $cxx does not work with C compiler $cc"
5805 echo "Disabling C++ specific optional code"
5806 cxx=
5807 fi
5808else
5809 echo "No C++ compiler available; disabling C++ specific optional code"
5810 cxx=
5811fi
5812
Cole Robinson02d34f62016-05-06 14:03:09 -04005813echo_version() {
5814 if test "$1" = "yes" ; then
5815 echo "($2)"
5816 fi
5817}
5818
Jan Kiszka50e12062014-10-02 10:03:55 +02005819# prepend pixman and ftd flags after all config tests are done
5820QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
Philippe Mathieu-Daudé8a99e9a2018-04-15 20:05:19 -03005821QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS"
Jan Kiszka50e12062014-10-02 10:03:55 +02005822libs_softmmu="$pixman_libs $libs_softmmu"
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01005823
bellard43ce4df2003-06-09 19:53:12 +00005824echo "Install prefix $prefix"
Stefan Weil89138852016-05-16 15:10:20 +02005825echo "BIOS directory $(eval echo $qemu_datadir)"
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +02005826echo "firmware path $(eval echo $firmwarepath)"
Stefan Weil89138852016-05-16 15:10:20 +02005827echo "binary directory $(eval echo $bindir)"
5828echo "library directory $(eval echo $libdir)"
5829echo "module directory $(eval echo $qemu_moddir)"
5830echo "libexec directory $(eval echo $libexecdir)"
5831echo "include directory $(eval echo $includedir)"
5832echo "config directory $(eval echo $sysconfdir)"
bellard11d9f692004-04-02 20:55:59 +00005833if test "$mingw32" = "no" ; then
Stefan Weil89138852016-05-16 15:10:20 +02005834echo "local state directory $(eval echo $local_statedir)"
5835echo "Manual directory $(eval echo $mandir)"
bellard43ce4df2003-06-09 19:53:12 +00005836echo "ELF interp prefix $interp_prefix"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02005837else
5838echo "local state directory queried at runtime"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04005839echo "Windows SDK $win_sdk"
bellard11d9f692004-04-02 20:55:59 +00005840fi
bellard5a671352003-10-01 00:13:48 +00005841echo "Source path $source_path"
Daniel P. Berrangecc84d632017-10-20 15:02:43 +01005842echo "GIT binary $git"
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01005843echo "GIT submodules $git_submodules"
bellard43ce4df2003-06-09 19:53:12 +00005844echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00005845echo "Host C compiler $host_cc"
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04005846echo "C++ compiler $cxx"
Peter Maydell3c4a4d02012-08-11 22:34:40 +01005847echo "Objective-C compiler $objcc"
Peter Maydell45d285a2013-10-21 21:03:06 +01005848echo "ARFLAGS $ARFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02005849echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02005850echo "QEMU_CFLAGS $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02005851echo "LDFLAGS $LDFLAGS"
Philippe Mathieu-Daudé8a99e9a2018-04-15 20:05:19 -03005852echo "QEMU_LDFLAGS $QEMU_LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00005853echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00005854echo "install $install"
Blue Swirlc886edf2011-07-22 21:08:09 +00005855echo "python $python"
Brade2d88302011-09-02 16:53:28 -04005856if test "$slirp" = "yes" ; then
5857 echo "smbd $smbd"
5858fi
Fam Zheng17969262014-02-10 14:48:56 +08005859echo "module support $modules"
bellard43ce4df2003-06-09 19:53:12 +00005860echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00005861echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00005862echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00005863echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00005864echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00005865echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00005866echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00005867echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +00005868if test "$darwin" = "yes" ; then
5869 echo "Cocoa support $cocoa"
5870fi
Stefan Weil89138852016-05-16 15:10:20 +02005871echo "SDL support $sdl $(echo_version $sdl $sdlversion)"
5872echo "GTK support $gtk $(echo_version $gtk $gtk_version)"
Gerd Hoffmann925a0402015-05-26 12:26:21 +02005873echo "GTK GL support $gtk_gl"
Stefan Weil89138852016-05-16 15:10:20 +02005874echo "VTE support $vte $(echo_version $vte $vteversion)"
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +01005875echo "TLS priority $tls_priority"
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01005876echo "GNUTLS support $gnutls"
Daniel P. Berrangeb917da42015-10-31 14:39:52 +09005877echo "GNUTLS rnd $gnutls_rnd"
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01005878echo "libgcrypt $gcrypt"
Daniel P. Berrange37788f22015-10-14 13:14:04 +01005879echo "libgcrypt kdf $gcrypt_kdf"
Stefan Weil89138852016-05-16 15:10:20 +02005880echo "nettle $nettle $(echo_version $nettle $nettle_version)"
Daniel P. Berrangefff2f982016-03-29 15:47:51 +01005881echo "nettle kdf $nettle_kdf"
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01005882echo "libtasn1 $tasn1"
balrog4d3b6f62008-02-10 16:33:14 +00005883echo "curses support $curses"
Marc-André Lureau47479c52018-05-25 17:36:09 +02005884echo "virgl support $virglrenderer $(echo_version $virglrenderer $virgl_version)"
Alexander Graf769ce762009-05-11 17:41:42 +02005885echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00005886echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00005887echo "Audio drivers $audio_drv_list"
Fam Zhengb64ec4e2013-05-29 19:35:40 +08005888echo "Block whitelist (rw) $block_drv_rw_whitelist"
5889echo "Block whitelist (ro) $block_drv_ro_whitelist"
Meador Inge983eef52012-02-24 14:00:42 +05305890echo "VirtFS support $virtfs"
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02005891echo "Multipath support $mpath"
Jes Sorensen821601e2011-03-16 13:33:36 +01005892echo "VNC support $vnc"
5893if test "$vnc" = "yes" ; then
Jes Sorensen821601e2011-03-16 13:33:36 +01005894 echo "VNC SASL support $vnc_sasl"
5895 echo "VNC JPEG support $vnc_jpeg"
5896 echo "VNC PNG support $vnc_png"
Jes Sorensen821601e2011-03-16 13:33:36 +01005897fi
blueswir131422552007-04-16 18:27:06 +00005898if test -n "$sparc_cpu"; then
5899 echo "Target Sparc Arch $sparc_cpu"
5900fi
aliguorie37630c2009-04-22 15:19:10 +00005901echo "xen support $xen"
Paul Durrant3996e852015-01-20 11:06:19 +00005902if test "$xen" = "yes" ; then
5903 echo "xen ctrl version $xen_ctrl_version"
Ian Campbell64a7ad62016-01-15 13:23:44 +00005904 echo "pv dom build $xen_pv_domain_build"
Paul Durrant3996e852015-01-20 11:06:19 +00005905fi
aurel322e4d9fb2008-04-08 06:01:02 +00005906echo "brlapi support $brlapi"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02005907echo "bluez support $bluez"
Juan Quintelaa25dba12009-08-12 18:29:52 +02005908echo "Documentation $docs"
Avi Kivity40d64442011-11-15 20:12:17 +02005909echo "PIE $pie"
ths8a16d272008-07-19 09:56:24 +00005910echo "vde support $vde"
Vincenzo Maffione58952132013-11-06 11:44:06 +01005911echo "netmap support $netmap"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02005912echo "Linux AIO support $linux_aio"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07005913echo "ATTR/XATTR support $attr"
ths77755342008-11-27 15:45:16 +00005914echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02005915echo "KVM support $kvm"
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01005916echo "HAX support $hax"
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05005917echo "HVF support $hvf"
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08005918echo "WHPX support $whpx"
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +02005919echo "TCG support $tcg"
5920if test "$tcg" = "yes" ; then
5921 echo "TCG debug enabled $debug_tcg"
5922 echo "TCG interpreter $tcg_interpreter"
5923fi
Yang Zhong5a22ab72017-12-20 21:16:46 +08005924echo "malloc trim support $malloc_trim"
Michael R. Hines2da776d2013-07-22 10:01:54 -04005925echo "RDMA support $rdma"
aurel32f652e6a2008-12-16 10:43:48 +00005926echo "fdt support $fdt"
Paolo Bonzinia40161c2018-02-16 10:05:23 +01005927echo "membarrier $membarrier"
aliguoriceb42de2009-04-07 18:43:28 +00005928echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00005929echo "fdatasync $fdatasync"
Andreas Färbere78815a2010-09-25 11:26:05 +00005930echo "madvise $madvise"
5931echo "posix_madvise $posix_madvise"
Andreas Gustafsson9bc5a712018-01-04 19:39:36 +02005932echo "posix_memalign $posix_memalign"
Corey Bryant47e98652012-01-26 09:42:26 -05005933echo "libcap-ng support $cap_ng"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02005934echo "vhost-net support $vhost_net"
Gonglei042cea22018-03-01 21:46:28 +08005935echo "vhost-crypto support $vhost_crypto"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00005936echo "vhost-scsi support $vhost_scsi"
Stefan Hajnoczifc0b9b02016-08-16 13:27:22 +01005937echo "vhost-vsock support $vhost_vsock"
Marc-André Lureaue6a74862017-08-03 11:07:46 +02005938echo "vhost-user support $vhost_user"
Lluís Vilanova5b808272014-05-27 15:02:14 +02005939echo "Trace backends $trace_backends"
Marc-André Lureau713572a2015-12-10 01:47:46 +01005940if have_backend "simple"; then
Prerna Saxena9410b562010-07-13 09:26:32 +01005941echo "Trace output file $trace_file-<pid>"
Stefan Weile00e36f2014-03-14 21:09:10 +01005942fi
Stefan Weil89138852016-05-16 15:10:20 +02005943echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01005944echo "rbd support $rbd"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01005945echo "xfsctl support $xfs"
Marc-André Lureau7b02f542015-08-30 11:48:40 +02005946echo "smartcard support $smartcard"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01005947echo "libusb $libusb"
Hans de Goede69354a82011-07-19 11:04:10 +02005948echo "usb net redir $usb_redir"
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01005949echo "OpenGL support $opengl"
Gerd Hoffmann014cb152015-12-03 12:56:34 +01005950echo "OpenGL dmabufs $opengl_dmabuf"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11005951echo "libiscsi support $libiscsi"
Peter Lieven6542aa92014-02-03 10:26:13 +01005952echo "libnfs support $libnfs"
Michael Rothd138cee2011-08-01 14:52:57 -05005953echo "build guest agent $guest_agent"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04005954echo "QGA VSS support $guest_agent_with_vss"
Michael Roth50cbebb2015-07-07 18:10:09 -05005955echo "QGA w32 disk info $guest_agent_ntddscsi"
Michael Roth4c875d82015-08-25 15:46:18 -05005956echo "QGA MSI support $guest_agent_msi"
Eduardo Otubof7945732012-08-14 18:44:05 -03005957echo "seccomp support $seccomp"
Peter Maydell7c2acc72013-04-08 12:11:27 +01005958echo "coroutine backend $coroutine"
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02005959echo "coroutine pool $coroutine_pool"
Peter Lieven7d992e42016-09-27 11:58:45 +02005960echo "debug stack usage $debug_stack_usage"
Paolo Bonziniba59fb72018-06-13 14:23:08 +02005961echo "mutex debugging $debug_mutex"
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04005962echo "crypto afalg $crypto_afalg"
Bharata B Raoeb100392012-09-24 14:42:45 +05305963echo "GlusterFS support $glusterfs"
Blue Swirl1d728c32012-05-01 18:45:39 +00005964echo "gcov $gcov_tool"
5965echo "gcov enabled $gcov"
Stefan Bergerab214c22013-02-27 12:47:52 -05005966echo "TPM support $tpm"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01005967echo "libssh2 support $libssh2"
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01005968echo "TPM passthrough $tpm_passthrough"
Amarnath Vallurif4ede812017-09-29 14:10:20 +03005969echo "TPM emulator $tpm_emulator"
Paolo Bonzini3556c232013-05-10 14:16:40 +02005970echo "QOM debugging $qom_cast_debug"
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +01005971echo "Live block migration $live_block_migration"
qiaonuohan607dacd2014-02-18 14:11:30 +08005972echo "lzo support $lzo"
5973echo "snappy support $snappy"
Peter Wu6b383c02015-01-06 18:48:14 +01005974echo "bzip2 support $bzip2"
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08005975echo "NUMA host support $numa"
Klim Kireeved279a02018-01-12 12:01:19 +03005976echo "libxml2 $libxml2"
Fam Zheng2847b462015-03-26 11:03:12 +08005977echo "tcmalloc support $tcmalloc"
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02005978echo "jemalloc support $jemalloc"
Liang Li99f2dbd2016-03-08 13:53:16 +08005979echo "avx2 optimization $avx2_opt"
Changlong Xiea6b1d4c2016-07-27 15:01:48 +08005980echo "replication support $replication"
Ashish Mittalda92c3f2017-04-03 20:48:08 -07005981echo "VxHS block device $vxhs"
Richard Henderson8ca80762017-09-14 09:41:12 -07005982echo "capstone $capstone"
Alex Bennée51a12b52018-04-04 14:24:39 +01005983echo "docker $docker"
bellard67b915a2004-03-31 23:37:16 +00005984
Stefan Weil1ba16962011-07-29 22:40:45 +02005985if test "$sdl_too_old" = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00005986echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00005987fi
bellard97a847b2003-08-10 21:36:04 +00005988
Daniel P. Berrangeb7715af2017-12-12 11:34:40 +00005989if test "$gtkabi" = "2.0"; then
5990 echo
5991 echo "WARNING: Use of GTK 2.0 is deprecated and will be removed in"
5992 echo "WARNING: future releases. Please switch to using GTK 3.0"
5993fi
5994
Daniel P. Berrangee52c6ba2018-01-15 14:25:33 +00005995if test "$sdlabi" = "1.2"; then
5996 echo
5997 echo "WARNING: Use of SDL 1.2 is deprecated and will be removed in"
5998 echo "WARNING: future releases. Please switch to using SDL 2.0"
5999fi
6000
Peter Maydell898be3e2017-03-21 14:31:57 +00006001if test "$supported_cpu" = "no"; then
6002 echo
6003 echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
6004 echo
6005 echo "CPU host architecture $cpu support is not currently maintained."
6006 echo "The QEMU project intends to remove support for this host CPU in"
6007 echo "a future release if nobody volunteers to maintain it and to"
6008 echo "provide a build host for our continuous integration setup."
6009 echo "configure has succeeded and you can continue to build, but"
6010 echo "if you care about QEMU on this platform you should contact"
6011 echo "us upstream at qemu-devel@nongnu.org."
6012fi
6013
6014if test "$supported_os" = "no"; then
6015 echo
6016 echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!"
6017 echo
Peter Maydellc50126a2017-03-21 18:08:49 +00006018 echo "Host OS $targetos support is not currently maintained."
6019 echo "The QEMU project intends to remove support for this host OS in"
Peter Maydell898be3e2017-03-21 14:31:57 +00006020 echo "a future release if nobody volunteers to maintain it and to"
6021 echo "provide a build host for our continuous integration setup."
6022 echo "configure has succeeded and you can continue to build, but"
6023 echo "if you care about QEMU on this platform you should contact"
6024 echo "us upstream at qemu-devel@nongnu.org."
6025fi
6026
Juan Quintela98ec69a2009-07-16 18:34:18 +02006027config_host_mak="config-host.mak"
bellard97a847b2003-08-10 21:36:04 +00006028
Stefan Weildbd99ae2013-01-01 18:33:44 +01006029echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
6030
Juan Quintela98ec69a2009-07-16 18:34:18 +02006031echo "# Automatically generated by configure - do not modify" > $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02006032echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02006033
Paolo Bonzinie6c3b0f2010-10-21 10:18:35 +02006034echo all: >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02006035echo "prefix=$prefix" >> $config_host_mak
6036echo "bindir=$bindir" >> $config_host_mak
Alon Levy3aa5d2b2011-05-15 12:08:59 +03006037echo "libdir=$libdir" >> $config_host_mak
Michael Tokarev8bf188a2012-06-07 01:11:00 +04006038echo "libexecdir=$libexecdir" >> $config_host_mak
Alon Levy0f94d6d2011-06-27 11:58:20 +02006039echo "includedir=$includedir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02006040echo "mandir=$mandir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02006041echo "sysconfdir=$sysconfdir" >> $config_host_mak
Eduardo Habkost22d07032012-04-18 16:55:42 -03006042echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
Eduardo Habkost9afa52c2012-04-18 16:55:46 -03006043echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +02006044echo "qemu_firmwarepath=$firmwarepath" >> $config_host_mak
Eduardo Habkost9afa52c2012-04-18 16:55:46 -03006045echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
Fam Zhenge26110c2014-02-10 14:48:57 +08006046echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02006047if test "$mingw32" = "no" ; then
6048 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
6049fi
Michael Tokarevf354b1a2012-10-21 22:52:54 +04006050echo "qemu_helperdir=$libexecdir" >> $config_host_mak
Anthony Liguori834574e2013-02-20 07:43:24 -06006051echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
Paolo Bonzinif544a482013-04-17 16:26:44 +02006052echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
Daniel P. Berrangecc84d632017-10-20 15:02:43 +01006053echo "GIT=$git" >> $config_host_mak
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01006054echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +01006055echo "GIT_UPDATE=$git_update" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02006056
Juan Quintela98ec69a2009-07-16 18:34:18 +02006057echo "ARCH=$ARCH" >> $config_host_mak
Paolo Bonzini727e5282013-04-17 16:26:43 +02006058
aurel32f8393942009-04-13 18:45:38 +00006059if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006060 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00006061fi
aliguori1625af82009-04-05 17:41:02 +00006062if test "$strip_opt" = "yes" ; then
Hollis Blanchard52ba7842010-08-04 17:21:34 -07006063 echo "STRIP=${strip}" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00006064fi
bellard7d132992003-03-06 23:23:54 +00006065if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02006066 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00006067fi
bellard67b915a2004-03-31 23:37:16 +00006068if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006069 echo "CONFIG_WIN32=y" >> $config_host_mak
Stefan Weil89138852016-05-16 15:10:20 +02006070 rc_version=$(cat $source_path/VERSION)
Blue Swirl9fe6de92010-09-26 16:07:57 +00006071 version_major=${rc_version%%.*}
6072 rc_version=${rc_version#*.}
6073 version_minor=${rc_version%%.*}
6074 rc_version=${rc_version#*.}
6075 version_subminor=${rc_version%%.*}
6076 version_micro=0
6077 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
6078 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04006079 if test "$guest_agent_with_vss" = "yes" ; then
6080 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
Michael Rothf33ca812015-08-26 16:19:41 -05006081 echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04006082 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
6083 fi
Michael Roth50cbebb2015-07-07 18:10:09 -05006084 if test "$guest_agent_ntddscsi" = "yes" ; then
6085 echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak
6086 fi
Michael Roth1a349042015-08-26 11:14:31 -05006087 if test "$guest_agent_msi" = "yes"; then
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08006088 echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
Yossi Hindin9dacf322015-05-06 14:57:40 +03006089 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
6090 echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
6091 echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
6092 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
6093 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
6094 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
6095 fi
pbrook210fa552007-02-27 21:04:49 +00006096else
Juan Quintela35f4df22009-07-27 16:13:07 +02006097 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00006098fi
blueswir1128ab2f2008-08-15 18:33:42 +00006099
Mark McLoughlindffcb712009-10-22 17:49:11 +01006100if test "$linux" = "yes" ; then
6101 echo "CONFIG_LINUX=y" >> $config_host_mak
6102fi
6103
bellard83fb7ad2004-07-05 21:25:26 +00006104if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006105 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00006106fi
malcb29fe3e2008-11-18 01:42:22 +00006107
bellardec530c82006-04-25 22:36:06 +00006108if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006109 echo "CONFIG_SOLARIS=y" >> $config_host_mak
bellardec530c82006-04-25 22:36:06 +00006110fi
Andreas Färber179cf402010-09-20 00:50:43 +02006111if test "$haiku" = "yes" ; then
6112 echo "CONFIG_HAIKU=y" >> $config_host_mak
6113fi
bellard97a847b2003-08-10 21:36:04 +00006114if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006115 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00006116fi
Stefan Weil1ba16962011-07-29 22:40:45 +02006117if test "$profiler" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006118 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00006119fi
bellardc20709a2004-04-21 23:27:19 +00006120if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006121 echo "CONFIG_SLIRP=y" >> $config_host_mak
Brade2d88302011-09-02 16:53:28 -04006122 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
bellardc20709a2004-04-21 23:27:19 +00006123fi
ths8a16d272008-07-19 09:56:24 +00006124if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006125 echo "CONFIG_VDE=y" >> $config_host_mak
Fam Zhenge2ad6f12017-09-07 16:35:52 +08006126 echo "VDE_LIBS=$vde_libs" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00006127fi
Vincenzo Maffione58952132013-11-06 11:44:06 +01006128if test "$netmap" = "yes" ; then
6129 echo "CONFIG_NETMAP=y" >> $config_host_mak
6130fi
Gonglei015a33b2014-07-01 20:58:08 +08006131if test "$l2tpv3" = "yes" ; then
6132 echo "CONFIG_L2TPV3=y" >> $config_host_mak
6133fi
Corey Bryant47e98652012-01-26 09:42:26 -05006134if test "$cap_ng" = "yes" ; then
6135 echo "CONFIG_LIBCAP=y" >> $config_host_mak
6136fi
Juan Quintela2358a492009-07-27 16:13:25 +02006137echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00006138for drv in $audio_drv_list; do
Gerd Hoffmann1ef1ec22018-03-01 11:05:46 +01006139 def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
Gerd Hoffmannce3dc032018-03-06 08:40:50 +01006140 case "$drv" in
Gerd Hoffmann051c7d52018-03-06 08:40:53 +01006141 alsa | oss | pa | sdl)
Gerd Hoffmannce3dc032018-03-06 08:40:50 +01006142 echo "$def=m" >> $config_host_mak ;;
6143 *)
6144 echo "$def=y" >> $config_host_mak ;;
6145 esac
malc0c58ac12008-06-25 21:04:05 +00006146done
Fam Zhengb1149912017-09-07 16:29:13 +08006147echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak
6148echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak
6149echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak
6150echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak
6151echo "OSS_LIBS=$oss_libs" >> $config_host_mak
Juan Quintela67f86e82009-08-03 14:46:59 +02006152if test "$audio_pt_int" = "yes" ; then
6153 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
6154fi
malcd5631632009-10-10 01:13:41 +04006155if test "$audio_win_int" = "yes" ; then
6156 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
6157fi
Fam Zhengb64ec4e2013-05-29 19:35:40 +08006158echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
6159echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
Jes Sorensen821601e2011-03-16 13:33:36 +01006160if test "$vnc" = "yes" ; then
6161 echo "CONFIG_VNC=y" >> $config_host_mak
6162fi
aliguori2f9606b2009-03-06 20:27:28 +00006163if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006164 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00006165fi
Jes Sorensen821601e2011-03-16 13:33:36 +01006166if test "$vnc_jpeg" = "yes" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02006167 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
Corentin Chary2f6f5c72010-07-07 20:57:49 +02006168fi
Jes Sorensen821601e2011-03-16 13:33:36 +01006169if test "$vnc_png" = "yes" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02006170 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
Corentin Charyefe556a2010-07-07 20:57:56 +02006171fi
Gerd Hoffmann6a021532017-10-05 17:33:28 +02006172if test "$xkbcommon" = "yes" ; then
6173 echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak
6174 echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak
6175fi
aliguori76655d62009-03-06 20:27:37 +00006176if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006177 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00006178fi
Christoph Hellwigdce512d2010-12-17 11:41:15 +01006179if test "$xfs" = "yes" ; then
6180 echo "CONFIG_XFS=y" >> $config_host_mak
6181fi
Stefan Weil89138852016-05-16 15:10:20 +02006182qemu_version=$(head $source_path/VERSION)
Juan Quintela98ec69a2009-07-16 18:34:18 +02006183echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02006184echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02006185echo "SRC_PATH=$source_path" >> $config_host_mak
Fam Zheng208ecb32017-09-08 17:16:54 +08006186echo "TARGET_LIST=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02006187if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006188 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00006189fi
Fam Zheng17969262014-02-10 14:48:56 +08006190if test "$modules" = "yes"; then
Fam Zhenge26110c2014-02-10 14:48:57 +08006191 # $shacmd can generate a hash started with digit, which the compiler doesn't
6192 # like as an symbol. So prefix it with an underscore
Stefan Weil89138852016-05-16 15:10:20 +02006193 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
Fam Zheng17969262014-02-10 14:48:56 +08006194 echo "CONFIG_MODULES=y" >> $config_host_mak
6195fi
Gerd Hoffmann87815952018-03-01 11:05:42 +01006196if test "$have_x11" = "yes" -a "$need_x11" = "yes"; then
6197 echo "CONFIG_X11=y" >> $config_host_mak
6198 echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak
6199 echo "X11_LIBS=$x11_libs" >> $config_host_mak
6200fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02006201if test "$sdl" = "yes" ; then
Gerd Hoffmann96400a12018-03-01 11:05:47 +01006202 echo "CONFIG_SDL=m" >> $config_host_mak
Cole Robinsona3f4d632014-04-24 13:35:52 -04006203 echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02006204 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
Fam Zheng8ecc89f2017-09-07 16:29:11 +08006205 echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00006206fi
6207if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006208 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00006209fi
6210if test "$curses" = "yes" ; then
Gerd Hoffmann2373f7d2018-03-01 11:05:45 +01006211 echo "CONFIG_CURSES=m" >> $config_host_mak
6212 echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak
6213 echo "CURSES_LIBS=$curses_lib" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00006214fi
Riku Voipio099d6b02009-05-05 12:10:04 +03006215if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006216 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03006217fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01006218if test "$accept4" = "yes" ; then
6219 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
6220fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05306221if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006222 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05306223fi
Riku Voipioc2882b92009-08-12 15:08:24 +03006224if test "$eventfd" = "yes" ; then
6225 echo "CONFIG_EVENTFD=y" >> $config_host_mak
6226fi
Marc-André Lureau751bcc32015-10-09 17:17:16 +02006227if test "$memfd" = "yes" ; then
6228 echo "CONFIG_MEMFD=y" >> $config_host_mak
6229fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03006230if test "$fallocate" = "yes" ; then
6231 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
6232fi
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01006233if test "$fallocate_punch_hole" = "yes" ; then
6234 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
6235fi
Denis V. Lunevb953f072015-01-30 11:42:14 +03006236if test "$fallocate_zero_range" = "yes" ; then
6237 echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak
6238fi
Kevin Wolfed911432014-09-29 17:12:59 +02006239if test "$posix_fallocate" = "yes" ; then
6240 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
6241fi
Peter Maydellc727f472011-01-06 11:05:10 +00006242if test "$sync_file_range" = "yes" ; then
6243 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
6244fi
Peter Maydelldace20d2011-01-10 13:11:24 +00006245if test "$fiemap" = "yes" ; then
6246 echo "CONFIG_FIEMAP=y" >> $config_host_mak
6247fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03006248if test "$dup3" = "yes" ; then
6249 echo "CONFIG_DUP3=y" >> $config_host_mak
6250fi
Alex Bligh4e0c6522013-08-21 16:02:43 +01006251if test "$ppoll" = "yes" ; then
6252 echo "CONFIG_PPOLL=y" >> $config_host_mak
6253fi
Alex Blighcd758dd2013-08-21 16:02:44 +01006254if test "$prctl_pr_set_timerslack" = "yes" ; then
6255 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
6256fi
Peter Maydell3b6edd12011-02-15 18:35:05 +00006257if test "$epoll" = "yes" ; then
6258 echo "CONFIG_EPOLL=y" >> $config_host_mak
6259fi
6260if test "$epoll_create1" = "yes" ; then
6261 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
6262fi
Peter Maydella8fd1ab2013-02-08 07:31:55 +00006263if test "$sendfile" = "yes" ; then
6264 echo "CONFIG_SENDFILE=y" >> $config_host_mak
6265fi
Riku Voipio51834342014-06-22 11:25:42 +01006266if test "$timerfd" = "yes" ; then
6267 echo "CONFIG_TIMERFD=y" >> $config_host_mak
6268fi
Riku Voipio9af5c902014-08-12 15:58:57 +03006269if test "$setns" = "yes" ; then
6270 echo "CONFIG_SETNS=y" >> $config_host_mak
6271fi
Aleksandar Markovic38860a02016-10-10 13:23:29 +02006272if test "$clock_adjtime" = "yes" ; then
6273 echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak
6274fi
Aleksandar Markovic5a03cd02016-10-10 13:23:30 +02006275if test "$syncfs" = "yes" ; then
6276 echo "CONFIG_SYNCFS=y" >> $config_host_mak
6277fi
aurel323b3f24a2009-04-15 16:12:13 +00006278if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006279 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00006280fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00006281if test "$inotify1" = "yes" ; then
6282 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
6283fi
Peter Maydell401bc052017-09-05 13:19:32 +01006284if test "$sem_timedwait" = "yes" ; then
6285 echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak
6286fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02006287if test "$byteswap_h" = "yes" ; then
6288 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
6289fi
6290if test "$bswap_h" = "yes" ; then
6291 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
6292fi
Alexander Graf769ce762009-05-11 17:41:42 +02006293if test "$curl" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08006294 echo "CONFIG_CURL=m" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02006295 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08006296 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02006297fi
aurel322e4d9fb2008-04-08 06:01:02 +00006298if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006299 echo "CONFIG_BRLAPI=y" >> $config_host_mak
Fam Zheng8eca2882017-09-07 16:47:00 +08006300 echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00006301fi
balrogfb599c92008-09-28 23:49:55 +00006302if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006303 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02006304 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00006305fi
Dr. David Alan Gilbertd46f7c92015-06-24 10:45:42 +01006306if test "$glib_subprocess" = "yes" ; then
Michael S. Tsirkin9d414012014-09-18 20:46:45 +03006307 echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak
6308fi
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06006309if test "$gtk" = "yes" ; then
Gerd Hoffmanne0fb1292018-03-01 11:05:44 +01006310 echo "CONFIG_GTK=m" >> $config_host_mak
Cole Robinsona3f4d632014-04-24 13:35:52 -04006311 echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06006312 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
Gerd Hoffmann014cb152015-12-03 12:56:34 +01006313 echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
Gerd Hoffmann925a0402015-05-26 12:26:21 +02006314 if test "$gtk_gl" = "yes" ; then
6315 echo "CONFIG_GTK_GL=y" >> $config_host_mak
6316 fi
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01006317fi
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +01006318echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01006319if test "$gnutls" = "yes" ; then
6320 echo "CONFIG_GNUTLS=y" >> $config_host_mak
6321fi
Daniel P. Berrangeb917da42015-10-31 14:39:52 +09006322if test "$gnutls_rnd" = "yes" ; then
6323 echo "CONFIG_GNUTLS_RND=y" >> $config_host_mak
6324fi
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01006325if test "$gcrypt" = "yes" ; then
6326 echo "CONFIG_GCRYPT=y" >> $config_host_mak
Longpeng(Mike)1f923c72016-12-13 18:42:55 +08006327 if test "$gcrypt_hmac" = "yes" ; then
6328 echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak
6329 fi
Daniel P. Berrange37788f22015-10-14 13:14:04 +01006330 if test "$gcrypt_kdf" = "yes" ; then
6331 echo "CONFIG_GCRYPT_KDF=y" >> $config_host_mak
6332 fi
Daniel P. Berrange62893b62015-07-01 18:10:33 +01006333fi
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01006334if test "$nettle" = "yes" ; then
6335 echo "CONFIG_NETTLE=y" >> $config_host_mak
Radim Krčmářbecaeb72015-07-10 19:18:00 +02006336 echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak
Daniel P. Berrangefff2f982016-03-29 15:47:51 +01006337 if test "$nettle_kdf" = "yes" ; then
6338 echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak
6339 fi
Daniel P. Berrangeed754742015-07-01 18:10:34 +01006340fi
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01006341if test "$tasn1" = "yes" ; then
6342 echo "CONFIG_TASN1=y" >> $config_host_mak
6343fi
Daniel P. Berrange559607e2015-02-27 16:19:33 +00006344if test "$have_ifaddrs_h" = "yes" ; then
6345 echo "HAVE_IFADDRS_H=y" >> $config_host_mak
6346fi
Eric Blake6b39b062016-10-11 10:46:23 -05006347if test "$have_broken_size_max" = "yes" ; then
6348 echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
6349fi
Jan Vesely277abf12016-04-29 13:15:23 -04006350
6351# Work around a system header bug with some kernel/XFS header
6352# versions where they both try to define 'struct fsxattr':
6353# xfs headers will not try to redefine structs from linux headers
6354# if this macro is set.
6355if test "$have_fsxattr" = "yes" ; then
6356 echo "HAVE_FSXATTR=y" >> $config_host_mak
6357fi
Fam Zheng1efad062018-06-01 17:26:43 +08006358if test "$have_copy_file_range" = "yes" ; then
6359 echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak
6360fi
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01006361if test "$vte" = "yes" ; then
6362 echo "CONFIG_VTE=y" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06006363 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
Gerd Hoffmanne0fb1292018-03-01 11:05:44 +01006364 echo "VTE_LIBS=$vte_libs" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06006365fi
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +02006366if test "$virglrenderer" = "yes" ; then
6367 echo "CONFIG_VIRGL=y" >> $config_host_mak
6368 echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak
6369 echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak
6370fi
aliguorie37630c2009-04-22 15:19:10 +00006371if test "$xen" = "yes" ; then
Jan Kiszka6dbd5882011-06-21 22:59:07 +02006372 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00006373 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
Ian Campbell64a7ad62016-01-15 13:23:44 +00006374 if test "$xen_pv_domain_build" = "yes" ; then
6375 echo "CONFIG_XEN_PV_DOMAIN_BUILD=y" >> $config_host_mak
6376 fi
aliguorie37630c2009-04-22 15:19:10 +00006377fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02006378if test "$linux_aio" = "yes" ; then
6379 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
6380fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07006381if test "$attr" = "yes" ; then
6382 echo "CONFIG_ATTR=y" >> $config_host_mak
6383fi
Avi Kivity4f26f2b2011-11-09 14:44:52 +02006384if test "$libattr" = "yes" ; then
6385 echo "CONFIG_LIBATTR=y" >> $config_host_mak
6386fi
Meador Inge983eef52012-02-24 14:00:42 +05306387if test "$virtfs" = "yes" ; then
6388 echo "CONFIG_VIRTFS=y" >> $config_host_mak
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07006389fi
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02006390if test "$mpath" = "yes" ; then
6391 echo "CONFIG_MPATH=y" >> $config_host_mak
6392fi
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00006393if test "$vhost_scsi" = "yes" ; then
6394 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
6395fi
Marc-André Lureaue6a74862017-08-03 11:07:46 +02006396if test "$vhost_net" = "yes" -a "$vhost_user" = "yes"; then
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +03006397 echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
6398fi
Gonglei042cea22018-03-01 21:46:28 +08006399if test "$vhost_crypto" = "yes" ; then
6400 echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
6401fi
Stefan Hajnoczifc0b9b02016-08-16 13:27:22 +01006402if test "$vhost_vsock" = "yes" ; then
6403 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
6404fi
Marc-André Lureaue6a74862017-08-03 11:07:46 +02006405if test "$vhost_user" = "yes" ; then
6406 echo "CONFIG_VHOST_USER=y" >> $config_host_mak
6407fi
ths77755342008-11-27 15:45:16 +00006408if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006409 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00006410fi
aliguoribf9298b2008-12-05 20:05:26 +00006411if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006412 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00006413fi
aliguoriceb42de2009-04-07 18:43:28 +00006414if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006415 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00006416fi
Philippe Mathieu-Daudée3971d62018-04-15 20:05:20 -03006417if test "$fdt" != "no" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02006418 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00006419fi
Paolo Bonzinia40161c2018-02-16 10:05:23 +01006420if test "$membarrier" = "yes" ; then
6421 echo "CONFIG_MEMBARRIER=y" >> $config_host_mak
6422fi
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03006423if test "$signalfd" = "yes" ; then
6424 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
6425fi
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +02006426if test "$tcg" = "yes"; then
6427 echo "CONFIG_TCG=y" >> $config_host_mak
6428 if test "$tcg_interpreter" = "yes" ; then
6429 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
6430 fi
Stefan Weil9195b2c2011-10-19 07:07:18 +02006431fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00006432if test "$fdatasync" = "yes" ; then
6433 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
6434fi
Andreas Färbere78815a2010-09-25 11:26:05 +00006435if test "$madvise" = "yes" ; then
6436 echo "CONFIG_MADVISE=y" >> $config_host_mak
6437fi
6438if test "$posix_madvise" = "yes" ; then
6439 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
6440fi
Andreas Gustafsson9bc5a712018-01-04 19:39:36 +02006441if test "$posix_memalign" = "yes" ; then
6442 echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak
6443fi
bellard97a847b2003-08-10 21:36:04 +00006444
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01006445if test "$spice" = "yes" ; then
6446 echo "CONFIG_SPICE=y" >> $config_host_mak
6447fi
6448
Marc-André Lureau7b02f542015-08-30 11:48:40 +02006449if test "$smartcard" = "yes" ; then
6450 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
Fam Zheng7b62bf52017-09-07 16:29:16 +08006451 echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak
6452 echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak
Robert Relyea111a38b2010-11-28 16:36:38 +02006453fi
6454
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01006455if test "$libusb" = "yes" ; then
6456 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
Fam Zhengb878b652017-09-07 16:29:17 +08006457 echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak
6458 echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01006459fi
6460
Hans de Goede69354a82011-07-19 11:04:10 +02006461if test "$usb_redir" = "yes" ; then
6462 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
Fam Zhengcc7923f2017-09-07 16:29:18 +08006463 echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak
6464 echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak
Hans de Goede69354a82011-07-19 11:04:10 +02006465fi
6466
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01006467if test "$opengl" = "yes" ; then
6468 echo "CONFIG_OPENGL=y" >> $config_host_mak
6469 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
Gerd Hoffmann014cb152015-12-03 12:56:34 +01006470 if test "$opengl_dmabuf" = "yes" ; then
6471 echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
6472 fi
Michael Walle20ff0752011-03-07 23:32:39 +01006473fi
6474
Yang Zhong5a22ab72017-12-20 21:16:46 +08006475if test "$malloc_trim" = "yes" ; then
6476 echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak
6477fi
6478
Liang Li99f2dbd2016-03-08 13:53:16 +08006479if test "$avx2_opt" = "yes" ; then
6480 echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
6481fi
6482
qiaonuohan607dacd2014-02-18 14:11:30 +08006483if test "$lzo" = "yes" ; then
6484 echo "CONFIG_LZO=y" >> $config_host_mak
6485fi
6486
6487if test "$snappy" = "yes" ; then
6488 echo "CONFIG_SNAPPY=y" >> $config_host_mak
6489fi
6490
Peter Wu6b383c02015-01-06 18:48:14 +01006491if test "$bzip2" = "yes" ; then
6492 echo "CONFIG_BZIP2=y" >> $config_host_mak
6493 echo "BZIP2_LIBS=-lbz2" >> $config_host_mak
6494fi
6495
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11006496if test "$libiscsi" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08006497 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08006498 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
6499 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11006500fi
6501
Peter Lieven6542aa92014-02-03 10:26:13 +01006502if test "$libnfs" = "yes" ; then
Colin Lord4be48792016-08-12 09:27:04 -04006503 echo "CONFIG_LIBNFS=m" >> $config_host_mak
6504 echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
Peter Lieven6542aa92014-02-03 10:26:13 +01006505fi
6506
Eduardo Otubof7945732012-08-14 18:44:05 -03006507if test "$seccomp" = "yes"; then
6508 echo "CONFIG_SECCOMP=y" >> $config_host_mak
Fam Zhengc3883e12017-09-07 16:53:16 +08006509 echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
6510 echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak
Eduardo Otubof7945732012-08-14 18:44:05 -03006511fi
6512
bellard83fb7ad2004-07-05 21:25:26 +00006513# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00006514if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006515 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00006516fi
6517
Daniel P. Berrange4d9310f2015-09-22 15:13:26 +01006518if test "$localtime_r" = "yes" ; then
6519 echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
6520fi
Paolo Bonzini3556c232013-05-10 14:16:40 +02006521if test "$qom_cast_debug" = "yes" ; then
6522 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
6523fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01006524if test "$rbd" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08006525 echo "CONFIG_RBD=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08006526 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
6527 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
Christian Brunnerf27aaf42010-12-06 20:53:01 +01006528fi
Anthony Liguori20ff6c82009-12-09 12:59:36 -06006529
Peter Maydell7c2acc72013-04-08 12:11:27 +01006530echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02006531if test "$coroutine_pool" = "yes" ; then
6532 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
6533else
6534 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
6535fi
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05306536
Peter Lieven7d992e42016-09-27 11:58:45 +02006537if test "$debug_stack_usage" = "yes" ; then
6538 echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
6539fi
6540
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04006541if test "$crypto_afalg" = "yes" ; then
6542 echo "CONFIG_AF_ALG=y" >> $config_host_mak
6543fi
6544
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05306545if test "$open_by_handle_at" = "yes" ; then
6546 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
6547fi
6548
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05306549if test "$linux_magic_h" = "yes" ; then
6550 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
6551fi
6552
Gerd Hoffmanncc6e3ca2013-01-09 10:17:07 +01006553if test "$pragma_diagnostic_available" = "yes" ; then
6554 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
Peter Maydell06d71fa2012-07-30 16:13:07 +01006555fi
6556
Kevin Wolf3f4349d2012-06-29 13:40:27 +02006557if test "$valgrind_h" = "yes" ; then
6558 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
6559fi
6560
Marc-André Lureaud83414e2018-01-16 16:11:52 +01006561if test "$have_asan_iface_fiber" = "yes" ; then
6562 echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak
6563fi
6564
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03006565if test "$has_environ" = "yes" ; then
6566 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
6567fi
6568
Richard Henderson76a347e2012-12-28 14:17:02 -08006569if test "$cpuid_h" = "yes" ; then
6570 echo "CONFIG_CPUID_H=y" >> $config_host_mak
6571fi
6572
Richard Hendersonf5401662013-02-16 12:46:59 -08006573if test "$int128" = "yes" ; then
6574 echo "CONFIG_INT128=y" >> $config_host_mak
6575fi
6576
Richard Henderson7ebee432016-06-29 21:10:59 -07006577if test "$atomic128" = "yes" ; then
6578 echo "CONFIG_ATOMIC128=y" >> $config_host_mak
6579fi
6580
Richard Hendersondf79b992016-09-02 12:23:57 -07006581if test "$atomic64" = "yes" ; then
6582 echo "CONFIG_ATOMIC64=y" >> $config_host_mak
6583fi
6584
Richard Hendersondb432672017-09-15 14:11:45 -07006585if test "$vector16" = "yes" ; then
6586 echo "CONFIG_VECTOR16=y" >> $config_host_mak
6587fi
6588
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08006589if test "$getauxval" = "yes" ; then
6590 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
6591fi
6592
Bharata B Raoeb100392012-09-24 14:42:45 +05306593if test "$glusterfs" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08006594 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08006595 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
6596 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
Bharata B Raoeb100392012-09-24 14:42:45 +05306597fi
6598
Jeff Codyd85fa9e2016-04-05 10:40:09 -04006599if test "$glusterfs_xlator_opt" = "yes" ; then
6600 echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
6601fi
6602
Bharata B Rao0c14fb42013-07-16 21:47:42 +05306603if test "$glusterfs_discard" = "yes" ; then
6604 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
6605fi
6606
Niels de Vosdf3a4292017-05-28 12:01:14 +05306607if test "$glusterfs_fallocate" = "yes" ; then
6608 echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
6609fi
6610
Bharata B Rao7c815372013-12-21 14:51:25 +05306611if test "$glusterfs_zerofill" = "yes" ; then
6612 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
6613fi
6614
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01006615if test "$libssh2" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08006616 echo "CONFIG_LIBSSH2=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08006617 echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
6618 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01006619fi
6620
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +01006621if test "$live_block_migration" = "yes" ; then
6622 echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
6623fi
6624
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01006625if test "$tpm" = "yes"; then
6626 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
Amarnath Vallurif4ede812017-09-29 14:10:20 +03006627 # TPM passthrough support?
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01006628 if test "$tpm_passthrough" = "yes"; then
6629 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
6630 fi
Amarnath Vallurif4ede812017-09-29 14:10:20 +03006631 # TPM emulator support?
6632 if test "$tpm_emulator" = "yes"; then
6633 echo "CONFIG_TPM_EMULATOR=y" >> $config_host_mak
6634 fi
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01006635fi
6636
Lluís Vilanova5b808272014-05-27 15:02:14 +02006637echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
6638if have_backend "nop"; then
Lluís6d8a7642011-08-31 20:30:43 +02006639 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
Prerna Saxena22890ab2010-06-24 17:04:53 +05306640fi
Lluís Vilanova5b808272014-05-27 15:02:14 +02006641if have_backend "simple"; then
Lluís6d8a7642011-08-31 20:30:43 +02006642 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
6643 # Set the appropriate trace file.
Andreas Färber953ffe02011-06-02 19:58:06 +02006644 trace_file="\"$trace_file-\" FMT_pid"
Prerna Saxena9410b562010-07-13 09:26:32 +01006645fi
Paolo Bonzinied7f5f12016-01-07 16:55:30 +03006646if have_backend "log"; then
6647 echo "CONFIG_TRACE_LOG=y" >> $config_host_mak
Lluís6d8a7642011-08-31 20:30:43 +02006648fi
Lluís Vilanova5b808272014-05-27 15:02:14 +02006649if have_backend "ust"; then
Lluís6d8a7642011-08-31 20:30:43 +02006650 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
6651fi
Lluís Vilanova5b808272014-05-27 15:02:14 +02006652if have_backend "dtrace"; then
Lluís6d8a7642011-08-31 20:30:43 +02006653 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
6654 if test "$trace_backend_stap" = "yes" ; then
6655 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
6656 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00006657fi
Lluís Vilanova5b808272014-05-27 15:02:14 +02006658if have_backend "ftrace"; then
Eiichi Tsukata781e9542013-04-11 20:25:15 +09006659 if test "$linux" = "yes" ; then
6660 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
Eiichi Tsukata781e9542013-04-11 20:25:15 +09006661 else
Stewart Smith21684af2014-01-24 12:39:10 +11006662 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
Eiichi Tsukata781e9542013-04-11 20:25:15 +09006663 fi
6664fi
Paul Durrant0a852412016-08-04 14:44:14 +01006665if have_backend "syslog"; then
6666 if test "$posix_syslog" = "yes" ; then
6667 echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak
6668 else
6669 feature_not_found "syslog(trace backend)" "syslog not available"
6670 fi
6671fi
Prerna Saxena9410b562010-07-13 09:26:32 +01006672echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
6673
Michael R. Hines2da776d2013-07-22 10:01:54 -04006674if test "$rdma" = "yes" ; then
6675 echo "CONFIG_RDMA=y" >> $config_host_mak
Fam Zheng392fb642017-09-07 16:42:30 +08006676 echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
Michael R. Hines2da776d2013-07-22 10:01:54 -04006677fi
6678
Laurent Vivier575b22b2016-06-02 22:14:15 +02006679if test "$have_rtnetlink" = "yes" ; then
6680 echo "CONFIG_RTNETLINK=y" >> $config_host_mak
6681fi
6682
Klim Kireeved279a02018-01-12 12:01:19 +03006683if test "$libxml2" = "yes" ; then
6684 echo "CONFIG_LIBXML2=y" >> $config_host_mak
6685 echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak
6686 echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak
6687fi
6688
Changlong Xiea6b1d4c2016-07-27 15:01:48 +08006689if test "$replication" = "yes" ; then
6690 echo "CONFIG_REPLICATION=y" >> $config_host_mak
6691fi
6692
Stefan Hajnoczi6a02c802016-10-14 10:00:55 +01006693if test "$have_af_vsock" = "yes" ; then
6694 echo "CONFIG_AF_VSOCK=y" >> $config_host_mak
6695fi
6696
Christopher Covington4d043512016-12-28 15:04:33 -05006697if test "$have_sysmacros" = "yes" ; then
6698 echo "CONFIG_SYSMACROS=y" >> $config_host_mak
6699fi
6700
Andreas Grapentin49e00a12017-03-14 17:59:53 +01006701if test "$have_static_assert" = "yes" ; then
6702 echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak
6703fi
6704
Tomáš Golembiovskýe6746052017-07-17 15:58:33 +02006705if test "$have_utmpx" = "yes" ; then
6706 echo "HAVE_UTMPX=y" >> $config_host_mak
6707fi
6708
Kamil Rytarowskie0580342017-07-14 09:33:44 +01006709if test "$ivshmem" = "yes" ; then
6710 echo "CONFIG_IVSHMEM=y" >> $config_host_mak
6711fi
Richard Hendersone219c492017-09-28 09:01:23 -07006712if test "$capstone" != "no" ; then
Richard Henderson8ca80762017-09-14 09:41:12 -07006713 echo "CONFIG_CAPSTONE=y" >> $config_host_mak
6714fi
Paolo Bonziniba59fb72018-06-13 14:23:08 +02006715if test "$debug_mutex" = "yes" ; then
6716 echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak
6717fi
Kamil Rytarowskie0580342017-07-14 09:33:44 +01006718
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00006719# Hold two types of flag:
6720# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
6721# a thread we have a handle to
6722# CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
6723# platform
6724if test "$pthread_setname_np" = "yes" ; then
6725 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
6726 echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
6727fi
6728
Ashish Mittalda92c3f2017-04-03 20:48:08 -07006729if test "$vxhs" = "yes" ; then
6730 echo "CONFIG_VXHS=y" >> $config_host_mak
6731 echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
6732fi
6733
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02006734if test "$tcg_interpreter" = "yes"; then
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02006735 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02006736elif test "$ARCH" = "sparc64" ; then
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02006737 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02006738elif test "$ARCH" = "s390x" ; then
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02006739 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
Richard Hendersonc72b26e2013-08-20 12:20:05 -07006740elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02006741 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
Richard Henderson40d964b2014-04-30 14:07:47 -07006742elif test "$ARCH" = "ppc64" ; then
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02006743 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02006744else
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02006745 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02006746fi
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02006747QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02006748
Juan Quintela98ec69a2009-07-16 18:34:18 +02006749echo "TOOLS=$tools" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02006750echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02006751echo "MAKE=$make" >> $config_host_mak
6752echo "INSTALL=$install" >> $config_host_mak
Brad1901cb12011-08-28 04:01:33 -04006753echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
6754echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
Michael Tokareve999ee42016-01-27 14:36:43 +03006755echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
6756echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
Blue Swirlc886edf2011-07-22 21:08:09 +00006757echo "PYTHON=$python" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02006758echo "CC=$cc" >> $config_host_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03006759if $iasl -h > /dev/null 2>&1; then
6760 echo "IASL=$iasl" >> $config_host_mak
6761fi
Juan Quintela804edf22009-07-27 16:12:49 +02006762echo "HOST_CC=$host_cc" >> $config_host_mak
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04006763echo "CXX=$cxx" >> $config_host_mak
Peter Maydell3c4a4d02012-08-11 22:34:40 +01006764echo "OBJCC=$objcc" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02006765echo "AR=$ar" >> $config_host_mak
Peter Maydell45d285a2013-10-21 21:03:06 +01006766echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
Richard Hendersoncdbd7272016-07-07 21:49:36 -07006767echo "AS=$as" >> $config_host_mak
Richard Henderson5f6f0e22016-06-23 10:39:18 -07006768echo "CCAS=$ccas" >> $config_host_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00006769echo "CPP=$cpp" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02006770echo "OBJCOPY=$objcopy" >> $config_host_mak
6771echo "LD=$ld" >> $config_host_mak
Alistair Francis9f81aeb2017-11-07 17:10:46 -08006772echo "RANLIB=$ranlib" >> $config_host_mak
Stefan Weil4852ee92014-09-18 21:55:08 +02006773echo "NM=$nm" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00006774echo "WINDRES=$windres" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02006775echo "CFLAGS=$CFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05006776echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02006777echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Bruno Dominguez11cde1c2017-06-06 14:07:47 +01006778echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01006779echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01006780if test "$sparse" = "yes" ; then
6781 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
Christian Borntraeger80fd48d2015-01-22 10:53:46 +01006782 echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak
Gerd Hoffmann2944d742014-10-15 11:51:09 +02006783 echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01006784 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
6785 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
6786fi
Gerd Hoffmann42da6042012-11-07 11:09:52 +01006787if test "$cross_prefix" != ""; then
6788 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
6789else
6790 echo "AUTOCONF_HOST := " >> $config_host_mak
6791fi
Juan Quintelae2a2ed02009-08-03 14:46:02 +02006792echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05006793echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
Philippe Mathieu-Daudé8a99e9a2018-04-15 20:05:19 -03006794echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
James Clarke6969ec62016-06-06 12:02:50 +01006795echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
Peter Maydelle57218b2016-08-08 17:11:28 +01006796echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02006797echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02006798echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Daniel P. Berrange409437e2016-07-20 14:23:13 +01006799echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02006800echo "EXESUF=$EXESUF" >> $config_host_mak
Fam Zheng17969262014-02-10 14:48:56 +08006801echo "DSOSUF=$DSOSUF" >> $config_host_mak
6802echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
Michael Roth957f1f92011-08-11 15:38:12 -05006803echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
Daniel P. Berrange90246032015-09-21 17:25:34 +01006804echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
6805echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02006806echo "POD2MAN=$POD2MAN" >> $config_host_mak
Paolo Bonzinicbdd1992012-11-28 09:40:23 +01006807echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
Blue Swirl1d728c32012-05-01 18:45:39 +00006808if test "$gcov" = "yes" ; then
6809 echo "CONFIG_GCOV=y" >> $config_host_mak
6810 echo "GCOV=$gcov_tool" >> $config_host_mak
6811fi
Juan Quintela804edf22009-07-27 16:12:49 +02006812
Alex Bennée51a12b52018-04-04 14:24:39 +01006813if test "$docker" != "no"; then
6814 echo "HAVE_USER_DOCKER=y" >> $config_host_mak
6815fi
6816
Peter Maydell6efd7512011-11-30 11:59:04 +00006817# use included Linux headers
6818if test "$linux" = "yes" ; then
Andreas Färbera307beb2012-06-14 15:14:33 +00006819 mkdir -p linux-headers
Peter Maydell6efd7512011-11-30 11:59:04 +00006820 case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07006821 i386|x86_64|x32)
Peter Maydell08312a62012-08-03 13:51:25 +01006822 linux_arch=x86
Peter Maydell6efd7512011-11-30 11:59:04 +00006823 ;;
6824 ppcemb|ppc|ppc64)
Peter Maydell08312a62012-08-03 13:51:25 +01006825 linux_arch=powerpc
Peter Maydell6efd7512011-11-30 11:59:04 +00006826 ;;
6827 s390x)
Peter Maydell08312a62012-08-03 13:51:25 +01006828 linux_arch=s390
6829 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +01006830 aarch64)
6831 linux_arch=arm64
6832 ;;
Sanjay Lal222e7d12014-06-17 23:10:36 +01006833 mips64)
6834 linux_arch=mips
6835 ;;
Peter Maydell08312a62012-08-03 13:51:25 +01006836 *)
6837 # For most CPUs the kernel architecture name and QEMU CPU name match.
6838 linux_arch="$cpu"
Peter Maydell6efd7512011-11-30 11:59:04 +00006839 ;;
6840 esac
Peter Maydell08312a62012-08-03 13:51:25 +01006841 # For non-KVM architectures we will not have asm headers
6842 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
6843 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
6844 fi
Peter Maydell6efd7512011-11-30 11:59:04 +00006845fi
6846
bellard1d14ffa2005-10-30 18:58:22 +00006847for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00006848target_dir="$target"
Juan Quintela25be2102009-10-07 02:41:00 +02006849config_target_mak=$target_dir/config-target.mak
Stefan Weil89138852016-05-16 15:10:20 +02006850target_name=$(echo $target | cut -d '-' -f 1)
bellard97a847b2003-08-10 21:36:04 +00006851target_bigendian="no"
Juan Quintela1f3d3c82009-10-07 02:41:02 +02006852
Paolo Bonzinic1799a82013-06-14 15:19:07 +01006853case "$target_name" in
Michael Weiser722dd7b2018-01-11 13:25:32 +00006854 armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
Juan Quintelaea2d6a32009-07-16 18:34:10 +02006855 target_bigendian=yes
6856 ;;
6857esac
bellard97a847b2003-08-10 21:36:04 +00006858target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00006859target_user_only="no"
ths831b7822007-01-18 20:06:33 +00006860target_linux_user="no"
blueswir184778502008-10-26 20:33:16 +00006861target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00006862case "$target" in
Paolo Bonzinic1799a82013-06-14 15:19:07 +01006863 ${target_name}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00006864 target_softmmu="yes"
6865 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01006866 ${target_name}-linux-user)
pbrook9e407a82007-05-26 16:38:53 +00006867 target_user_only="yes"
6868 target_linux_user="yes"
6869 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01006870 ${target_name}-bsd-user)
blueswir184778502008-10-26 20:33:16 +00006871 target_user_only="yes"
6872 target_bsd_user="yes"
6873 ;;
pbrook9e407a82007-05-26 16:38:53 +00006874 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01006875 error_exit "Target '$target' not recognised"
pbrook9e407a82007-05-26 16:38:53 +00006876 exit 1
6877 ;;
6878esac
ths831b7822007-01-18 20:06:33 +00006879
Alex Bennéed75402b2018-04-04 20:27:05 +01006880target_compiler=""
6881target_compiler_static=""
Alex Bennée716a5072018-04-10 12:19:40 +01006882target_compiler_cflags=""
Alex Bennéed75402b2018-04-04 20:27:05 +01006883
bellard97a847b2003-08-10 21:36:04 +00006884mkdir -p $target_dir
Juan Quintela25be2102009-10-07 02:41:00 +02006885echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00006886
pbrooke5fe0c52006-06-11 13:32:59 +00006887bflt="no"
Alex Bennéeca759f92017-02-23 18:29:27 +00006888mttcg="no"
Stefan Weil89138852016-05-16 15:10:20 +02006889interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g")
pbrook56aebc82008-10-11 17:55:29 +00006890gdb_xml_files=""
aliguori7ba1e612008-11-05 16:04:33 +00006891
Paolo Bonzinic1799a82013-06-14 15:19:07 +01006892TARGET_ARCH="$target_name"
Juan Quintela6acff7d2009-07-16 18:34:15 +02006893TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02006894TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02006895
Paolo Bonzinic1799a82013-06-14 15:19:07 +01006896case "$target_name" in
aurel322408a522008-04-20 20:19:44 +00006897 i386)
Abdallah Bouassidab8158192017-06-01 11:33:15 +02006898 gdb_xml_files="i386-32bit.xml i386-32bit-core.xml i386-32bit-sse.xml"
Alex Bennéed75402b2018-04-04 20:27:05 +01006899 target_compiler=$cross_cc_i386
Alex Bennée716a5072018-04-10 12:19:40 +01006900 target_compiler_cflags=$cross_cc_ccflags_i386
aurel322408a522008-04-20 20:19:44 +00006901 ;;
6902 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02006903 TARGET_BASE_ARCH=i386
Abdallah Bouassidab8158192017-06-01 11:33:15 +02006904 gdb_xml_files="i386-64bit.xml i386-64bit-core.xml i386-64bit-sse.xml"
Alex Bennéed75402b2018-04-04 20:27:05 +01006905 target_compiler=$cross_cc_x86_64
aurel322408a522008-04-20 20:19:44 +00006906 ;;
6907 alpha)
Richard Henderson5ee4f3c2017-02-24 09:12:43 +11006908 mttcg="yes"
Alex Bennéed75402b2018-04-04 20:27:05 +01006909 target_compiler=$cross_cc_alpha
aurel322408a522008-04-20 20:19:44 +00006910 ;;
6911 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02006912 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00006913 bflt="yes"
Alex Bennéeca759f92017-02-23 18:29:27 +00006914 mttcg="yes"
pbrook56aebc82008-10-11 17:55:29 +00006915 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Alex Bennéed75402b2018-04-04 20:27:05 +01006916 target_compiler=$cross_cc_arm
Alex Bennéed422b2b2018-04-13 11:07:58 +01006917 eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}"
aurel322408a522008-04-20 20:19:44 +00006918 ;;
Michael Weiser722dd7b2018-01-11 13:25:32 +00006919 aarch64|aarch64_be)
6920 TARGET_ARCH=aarch64
Alexander Graf6a49fa92013-09-03 20:12:22 +01006921 TARGET_BASE_ARCH=arm
6922 bflt="yes"
Alex Bennéeca759f92017-02-23 18:29:27 +00006923 mttcg="yes"
Peter Maydell8f95ce22014-09-29 18:48:47 +01006924 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Alex Bennéed75402b2018-04-04 20:27:05 +01006925 target_compiler=$cross_cc_aarch64
Alex Bennéed422b2b2018-04-13 11:07:58 +01006926 eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}"
Alexander Graf6a49fa92013-09-03 20:12:22 +01006927 ;;
aurel322408a522008-04-20 20:19:44 +00006928 cris)
Alex Bennéed75402b2018-04-04 20:27:05 +01006929 target_compiler=$cross_cc_cris
aurel322408a522008-04-20 20:19:44 +00006930 ;;
Richard Henderson61766fe2016-12-15 11:26:14 -08006931 hppa)
Richard Henderson7b93dab2018-01-06 16:02:27 -08006932 mttcg="yes"
Alex Bennéed75402b2018-04-04 20:27:05 +01006933 target_compiler=$cross_cc_hppa
Richard Henderson61766fe2016-12-15 11:26:14 -08006934 ;;
Michael Walle613a22c2011-02-17 23:45:17 +01006935 lm32)
Alex Bennéed75402b2018-04-04 20:27:05 +01006936 target_compiler=$cross_cc_lm32
Michael Walle613a22c2011-02-17 23:45:17 +01006937 ;;
aurel322408a522008-04-20 20:19:44 +00006938 m68k)
aurel322408a522008-04-20 20:19:44 +00006939 bflt="yes"
Laurent Vivier5a4526b2017-06-20 22:51:19 +02006940 gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml"
Alex Bennéed75402b2018-04-04 20:27:05 +01006941 target_compiler=$cross_cc_m68k
aurel322408a522008-04-20 20:19:44 +00006942 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01006943 microblaze|microblazeel)
6944 TARGET_ARCH=microblaze
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02006945 bflt="yes"
Edgar E. Iglesiasbe73ef62018-04-13 18:10:00 +02006946 echo "TARGET_ABI32=y" >> $config_target_mak
Alex Bennéed75402b2018-04-04 20:27:05 +01006947 target_compiler=$cross_cc_microblaze
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02006948 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02006949 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02006950 TARGET_ARCH=mips
Alex Bennéed75402b2018-04-04 20:27:05 +01006951 target_compiler=$cross_cc_mips
Juan Quintela25be2102009-10-07 02:41:00 +02006952 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00006953 ;;
6954 mipsn32|mipsn32el)
Richard Henderson597e2ce2013-02-10 10:30:50 -08006955 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02006956 TARGET_BASE_ARCH=mips
Alex Bennéed75402b2018-04-04 20:27:05 +01006957 target_compiler=$cross_cc_mipsn32
Juan Quintela25be2102009-10-07 02:41:00 +02006958 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Richard Henderson597e2ce2013-02-10 10:30:50 -08006959 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00006960 ;;
6961 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02006962 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02006963 TARGET_BASE_ARCH=mips
Alex Bennéed75402b2018-04-04 20:27:05 +01006964 target_compiler=$cross_cc_mips64
Juan Quintela25be2102009-10-07 02:41:00 +02006965 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00006966 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04006967 moxie)
Alex Bennéed75402b2018-04-04 20:27:05 +01006968 target_compiler=$cross_cc_moxie
Anthony Greend15a9c22013-03-18 15:49:25 -04006969 ;;
Marek Vasute6717112017-01-18 23:01:46 +01006970 nios2)
Alex Bennéed75402b2018-04-04 20:27:05 +01006971 target_compiler=$cross_cc_nios2
Marek Vasute6717112017-01-18 23:01:46 +01006972 ;;
Richard Henderson4a09d0b2017-02-08 15:06:54 -08006973 or1k)
Alex Bennéed75402b2018-04-04 20:27:05 +01006974 target_compiler=$cross_cc_or1k
Jia Liue67db062012-07-20 15:50:39 +08006975 TARGET_ARCH=openrisc
6976 TARGET_BASE_ARCH=openrisc
Jia Liue67db062012-07-20 15:50:39 +08006977 ;;
aurel322408a522008-04-20 20:19:44 +00006978 ppc)
aurel32c8b35322009-01-24 15:07:34 +00006979 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Alex Bennéed75402b2018-04-04 20:27:05 +01006980 target_compiler=$cross_cc_powerpc
aurel322408a522008-04-20 20:19:44 +00006981 ;;
6982 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02006983 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02006984 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00006985 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Alex Bennéed75402b2018-04-04 20:27:05 +01006986 target_compiler=$cross_cc_ppcemb
aurel322408a522008-04-20 20:19:44 +00006987 ;;
6988 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02006989 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02006990 TARGET_ABI_DIR=ppc
Nikunj A Dadhaniaf0b06852017-04-27 10:48:23 +05306991 mttcg=yes
Anton Blanchard1438eff2016-01-15 16:00:51 +01006992 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
Alex Bennéed75402b2018-04-04 20:27:05 +01006993 target_compiler=$cross_cc_ppc64
aurel322408a522008-04-20 20:19:44 +00006994 ;;
Doug Kwan9c351262014-05-29 09:12:21 -05006995 ppc64le)
6996 TARGET_ARCH=ppc64
6997 TARGET_BASE_ARCH=ppc
6998 TARGET_ABI_DIR=ppc
Nikunj A Dadhaniaf0b06852017-04-27 10:48:23 +05306999 mttcg=yes
Anton Blanchard1438eff2016-01-15 16:00:51 +01007000 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
Alex Bennéed75402b2018-04-04 20:27:05 +01007001 target_compiler=$cross_cc_ppc64le
Doug Kwan9c351262014-05-29 09:12:21 -05007002 ;;
aurel322408a522008-04-20 20:19:44 +00007003 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02007004 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02007005 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02007006 TARGET_ABI_DIR=ppc
Juan Quintela25be2102009-10-07 02:41:00 +02007007 echo "TARGET_ABI32=y" >> $config_target_mak
Anton Blanchard1438eff2016-01-15 16:00:51 +01007008 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
Alex Bennéed75402b2018-04-04 20:27:05 +01007009 target_compiler=$cross_cc_ppc64abi32
aurel322408a522008-04-20 20:19:44 +00007010 ;;
Michael Clark25fa1942018-03-03 01:32:59 +13007011 riscv32)
7012 TARGET_BASE_ARCH=riscv
7013 TARGET_ABI_DIR=riscv
7014 mttcg=yes
Alex Bennéed75402b2018-04-04 20:27:05 +01007015 target_compiler=$cross_cc_riscv32
Michael Clark25fa1942018-03-03 01:32:59 +13007016 ;;
7017 riscv64)
7018 TARGET_BASE_ARCH=riscv
7019 TARGET_ABI_DIR=riscv
7020 mttcg=yes
Alex Bennéed75402b2018-04-04 20:27:05 +01007021 target_compiler=$cross_cc_riscv64
Michael Clark25fa1942018-03-03 01:32:59 +13007022 ;;
aurel322408a522008-04-20 20:19:44 +00007023 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02007024 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00007025 bflt="yes"
Alex Bennéed75402b2018-04-04 20:27:05 +01007026 target_compiler=$cross_cc_sh4
aurel322408a522008-04-20 20:19:44 +00007027 ;;
7028 sparc)
Alex Bennéed75402b2018-04-04 20:27:05 +01007029 target_compiler=$cross_cc_sparc
aurel322408a522008-04-20 20:19:44 +00007030 ;;
7031 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02007032 TARGET_BASE_ARCH=sparc
Alex Bennéed75402b2018-04-04 20:27:05 +01007033 target_compiler=$cross_cc_sparc64
aurel322408a522008-04-20 20:19:44 +00007034 ;;
7035 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02007036 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02007037 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02007038 TARGET_ABI_DIR=sparc
Alex Bennéed75402b2018-04-04 20:27:05 +01007039 target_compiler=$cross_cc_sparc32plus
Juan Quintela25be2102009-10-07 02:41:00 +02007040 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00007041 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01007042 s390x)
David Hildenbrand63685bc2018-01-29 13:56:20 +01007043 mttcg=yes
Christian Borntraeger86158a22017-03-08 12:41:14 +01007044 gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml"
Alex Bennéed75402b2018-04-04 20:27:05 +01007045 target_compiler=$cross_cc_s390x
Alexander Graf24e804ec2009-12-05 12:44:22 +01007046 ;;
Chen Gang444e06b2015-08-21 05:43:37 +08007047 tilegx)
Alex Bennéed75402b2018-04-04 20:27:05 +01007048 target_compiler=$cross_cc_tilegx
Chen Gang444e06b2015-08-21 05:43:37 +08007049 ;;
Peter Crosthwaite5ecaa4e2015-04-26 19:14:26 -07007050 tricore)
Alex Bennéed75402b2018-04-04 20:27:05 +01007051 target_compiler=$cross_cc_tricore
Peter Crosthwaite5ecaa4e2015-04-26 19:14:26 -07007052 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +08007053 unicore32)
Alex Bennéed75402b2018-04-04 20:27:05 +01007054 target_compiler=$cross_cc_unicore32
Guan Xuetaod2fbca92011-04-12 16:27:03 +08007055 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04007056 xtensa|xtensaeb)
7057 TARGET_ARCH=xtensa
Max Filippov9fb40342017-03-06 17:17:43 -08007058 mttcg="yes"
Alex Bennéed75402b2018-04-04 20:27:05 +01007059 target_compiler=$cross_cc_xtensa
Max Filippovcfa550c2011-09-06 03:55:26 +04007060 ;;
aurel322408a522008-04-20 20:19:44 +00007061 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01007062 error_exit "Unsupported target CPU"
aurel322408a522008-04-20 20:19:44 +00007063 ;;
7064esac
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02007065# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
7066if [ "$TARGET_BASE_ARCH" = "" ]; then
7067 TARGET_BASE_ARCH=$TARGET_ARCH
7068fi
7069
Alex Bennéed75402b2018-04-04 20:27:05 +01007070# Do we have a cross compiler for this target?
7071if has $target_compiler; then
7072
7073 write_c_skeleton
7074
Alex Bennée716a5072018-04-10 12:19:40 +01007075 if ! do_compiler "$target_compiler" $target_compiler_cflags -o $TMPE $TMPC -static ; then
Alex Bennéed75402b2018-04-04 20:27:05 +01007076 # For host systems we might get away with building without -static
Alex Bennée716a5072018-04-10 12:19:40 +01007077 if ! do_compiler "$target_compiler" $target_compiler_cflags -o $TMPE $TMPC ; then
Alex Bennéed75402b2018-04-04 20:27:05 +01007078 target_compiler=""
7079 else
7080 enabled_cross_compilers="${enabled_cross_compilers} '${target_compiler}'"
7081 target_compiler_static="n"
7082 fi
7083 else
7084 enabled_cross_compilers="${enabled_cross_compilers} '${target_compiler}'"
7085 target_compiler_static="y"
7086 fi
7087else
7088 target_compiler=""
7089fi
7090
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02007091symlink "$source_path/Makefile.target" "$target_dir/Makefile"
7092
Daniel P. Berrange99afc912012-08-20 15:31:38 +01007093upper() {
7094 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
7095}
7096
Stefan Weil89138852016-05-16 15:10:20 +02007097target_arch_name="$(upper $TARGET_ARCH)"
Juan Quintela25be2102009-10-07 02:41:00 +02007098echo "TARGET_$target_arch_name=y" >> $config_target_mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01007099echo "TARGET_NAME=$target_name" >> $config_target_mak
Juan Quintela25be2102009-10-07 02:41:00 +02007100echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02007101if [ "$TARGET_ABI_DIR" = "" ]; then
7102 TARGET_ABI_DIR=$TARGET_ARCH
7103fi
Juan Quintela25be2102009-10-07 02:41:00 +02007104echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Stacey Sonadfc3e92014-06-08 09:57:22 -07007105if [ "$HOST_VARIANT_DIR" != "" ]; then
7106 echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
7107fi
Paolo Bonzini3b6b7552012-09-17 11:59:41 +02007108
7109if supported_xen_target $target; then
7110 echo "CONFIG_XEN=y" >> $config_target_mak
7111 if test "$xen_pci_passthrough" = yes; then
Anthony PERARDeb6fda02012-06-21 15:32:59 +00007112 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
Juan Quintela1b0c87f2009-07-16 18:33:59 +02007113 fi
Paolo Bonzini3b6b7552012-09-17 11:59:41 +02007114fi
7115if supported_kvm_target $target; then
7116 echo "CONFIG_KVM=y" >> $config_target_mak
7117 if test "$vhost_net" = "yes" ; then
Michael S. Tsirkind5970052010-03-17 13:08:17 +02007118 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
Marc-André Lureaue6a74862017-08-03 11:07:46 +02007119 if test "$vhost_user" = "yes" ; then
7120 echo "CONFIG_VHOST_USER_NET_TEST_$target_name=y" >> $config_host_mak
7121 fi
Juan Quintelac59249f2009-07-16 18:34:00 +02007122 fi
Paolo Bonzini3b6b7552012-09-17 11:59:41 +02007123fi
7124if supported_hax_target $target; then
7125 echo "CONFIG_HAX=y" >> $config_target_mak
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01007126fi
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05007127if supported_hvf_target $target; then
7128 echo "CONFIG_HVF=y" >> $config_target_mak
7129fi
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08007130if supported_whpx_target $target; then
7131 echo "CONFIG_WHPX=y" >> $config_target_mak
7132fi
bellardde83cd02003-06-15 20:25:43 +00007133if test "$target_bigendian" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02007134 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00007135fi
7136if test "$target_softmmu" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02007137 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
Alex Bennéeca759f92017-02-23 18:29:27 +00007138 if test "$mttcg" = "yes" ; then
7139 echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak
7140 fi
bellardde83cd02003-06-15 20:25:43 +00007141fi
bellard997344f2003-10-27 21:10:39 +00007142if test "$target_user_only" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02007143 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
Stefan Weila2c80be2011-12-22 11:26:10 +01007144 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00007145fi
ths831b7822007-01-18 20:06:33 +00007146if test "$target_linux_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02007147 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00007148fi
pbrook56aebc82008-10-11 17:55:29 +00007149list=""
7150if test ! -z "$gdb_xml_files" ; then
7151 for x in $gdb_xml_files; do
7152 list="$list $source_path/gdb-xml/$x"
7153 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02007154 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00007155fi
bellardde83cd02003-06-15 20:25:43 +00007156
pbrooke5fe0c52006-06-11 13:32:59 +00007157if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02007158 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00007159fi
blueswir184778502008-10-26 20:33:16 +00007160if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02007161 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00007162fi
bellard5b0753e2005-03-01 21:37:28 +00007163
Alex Bennéed75402b2018-04-04 20:27:05 +01007164if test -n "$target_compiler"; then
7165 echo "CROSS_CC_GUEST=\"$target_compiler\"" >> $config_target_mak
7166
7167 if test -n "$target_compiler_static"; then
7168 echo "CROSS_CC_GUEST_STATIC=$target_compiler_static" >> $config_target_mak
7169 fi
Alex Bennée716a5072018-04-10 12:19:40 +01007170
7171 if test -n "$target_compiler_cflags"; then
7172 echo "CROSS_CC_GUEST_CFLAGS=$target_compiler_cflags" >> $config_target_mak
7173 fi
Alex Bennéed75402b2018-04-04 20:27:05 +01007174fi
7175
Alex Bennée716a5072018-04-10 12:19:40 +01007176
Juan Quintela4afddb52009-08-03 14:46:45 +02007177# generate QEMU_CFLAGS/LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02007178
Juan Quintela4afddb52009-08-03 14:46:45 +02007179cflags=""
Juan Quintelafa282482009-07-22 22:37:39 +02007180ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02007181
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007182disas_config() {
7183 echo "CONFIG_${1}_DIS=y" >> $config_target_mak
7184 echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak
7185}
7186
Juan Quintela64656022009-08-03 14:46:53 +02007187for i in $ARCH $TARGET_BASE_ARCH ; do
7188 case "$i" in
7189 alpha)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007190 disas_config "ALPHA"
Juan Quintela64656022009-08-03 14:46:53 +02007191 ;;
Richard Henderson82295d82014-03-03 22:53:27 -05007192 aarch64)
7193 if test -n "${cxx}"; then
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007194 disas_config "ARM_A64"
Richard Henderson82295d82014-03-03 22:53:27 -05007195 fi
7196 ;;
Juan Quintela64656022009-08-03 14:46:53 +02007197 arm)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007198 disas_config "ARM"
Claudio Fontana999b53e2014-02-05 17:27:28 +00007199 if test -n "${cxx}"; then
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007200 disas_config "ARM_A64"
Claudio Fontana999b53e2014-02-05 17:27:28 +00007201 fi
Juan Quintela64656022009-08-03 14:46:53 +02007202 ;;
7203 cris)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007204 disas_config "CRIS"
Juan Quintela64656022009-08-03 14:46:53 +02007205 ;;
Richard Henderson429b31a2016-09-29 10:55:53 -07007206 hppa)
7207 disas_config "HPPA"
7208 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07007209 i386|x86_64|x32)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007210 disas_config "I386"
Juan Quintela64656022009-08-03 14:46:53 +02007211 ;;
Michael Walle79368f42012-03-31 19:54:20 +02007212 lm32)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007213 disas_config "LM32"
Michael Walle79368f42012-03-31 19:54:20 +02007214 ;;
Juan Quintela64656022009-08-03 14:46:53 +02007215 m68k)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007216 disas_config "M68K"
Juan Quintela64656022009-08-03 14:46:53 +02007217 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01007218 microblaze*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007219 disas_config "MICROBLAZE"
Juan Quintela64656022009-08-03 14:46:53 +02007220 ;;
7221 mips*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007222 disas_config "MIPS"
Juan Quintela64656022009-08-03 14:46:53 +02007223 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04007224 moxie*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007225 disas_config "MOXIE"
Anthony Greend15a9c22013-03-18 15:49:25 -04007226 ;;
Marek Vasute6717112017-01-18 23:01:46 +01007227 nios2)
7228 disas_config "NIOS2"
7229 ;;
Richard Henderson4a09d0b2017-02-08 15:06:54 -08007230 or1k)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007231 disas_config "OPENRISC"
Jia Liue67db062012-07-20 15:50:39 +08007232 ;;
Juan Quintela64656022009-08-03 14:46:53 +02007233 ppc*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007234 disas_config "PPC"
Juan Quintela64656022009-08-03 14:46:53 +02007235 ;;
Michael Clark25fa1942018-03-03 01:32:59 +13007236 riscv)
7237 disas_config "RISCV"
7238 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01007239 s390*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007240 disas_config "S390"
Juan Quintela64656022009-08-03 14:46:53 +02007241 ;;
7242 sh4)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007243 disas_config "SH4"
Juan Quintela64656022009-08-03 14:46:53 +02007244 ;;
7245 sparc*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007246 disas_config "SPARC"
Juan Quintela64656022009-08-03 14:46:53 +02007247 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04007248 xtensa*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007249 disas_config "XTENSA"
Max Filippovcfa550c2011-09-06 03:55:26 +04007250 ;;
Juan Quintela64656022009-08-03 14:46:53 +02007251 esac
7252done
Stefan Weil9195b2c2011-10-19 07:07:18 +02007253if test "$tcg_interpreter" = "yes" ; then
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007254 disas_config "TCI"
Stefan Weil9195b2c2011-10-19 07:07:18 +02007255fi
Juan Quintela64656022009-08-03 14:46:53 +02007256
Juan Quintela6ee71262009-08-03 14:46:47 +02007257case "$ARCH" in
7258alpha)
7259 # Ensure there's only a single GP
7260 cflags="-msmall-data $cflags"
7261;;
7262esac
7263
Juan Quintelad02c1db2009-08-03 14:46:50 +02007264if test "$gprof" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02007265 echo "TARGET_GPROF=yes" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02007266 if test "$target_linux_user" = "yes" ; then
7267 cflags="-p $cflags"
7268 ldflags="-p $ldflags"
7269 fi
7270 if test "$target_softmmu" = "yes" ; then
7271 ldflags="-p $ldflags"
Juan Quintela25be2102009-10-07 02:41:00 +02007272 echo "GPROF_CFLAGS=-p" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02007273 fi
7274fi
7275
Juan Quintela9b8e1112009-08-03 14:46:46 +02007276if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
Richard Henderson964c6fa2013-06-21 19:10:16 -07007277 ldflags="$ldflags $textseg_ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02007278fi
Juan Quintelafa282482009-07-22 22:37:39 +02007279
Christian Borntraegere9a35912017-08-23 12:16:23 +02007280# Newer kernels on s390 check for an S390_PGSTE program header and
7281# enable the pgste page table extensions in that case. This makes
7282# the vm.allocate_pgste sysctl unnecessary. We enable this program
7283# header if
7284# - we build on s390x
7285# - we build the system emulation for s390x (qemu-system-s390x)
7286# - KVM is enabled
7287# - the linker supports --s390-pgste
7288if test "$TARGET_ARCH" = "s390x" -a "$target_softmmu" = "yes" -a "$ARCH" = "s390x" -a "$kvm" = "yes"; then
7289 if ld_has --s390-pgste ; then
7290 ldflags="-Wl,--s390-pgste $ldflags"
7291 fi
7292fi
7293
Juan Quintela25be2102009-10-07 02:41:00 +02007294echo "LDFLAGS+=$ldflags" >> $config_target_mak
7295echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02007296
bellard97a847b2003-08-10 21:36:04 +00007297done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00007298
Alex Bennéed75402b2018-04-04 20:27:05 +01007299if test -n "$enabled_cross_compilers"; then
7300 echo
7301 echo "NOTE: cross-compilers enabled: $enabled_cross_compilers"
7302fi
7303
Philippe Mathieu-Daudée3971d62018-04-15 20:05:20 -03007304if [ "$fdt" = "git" ]; then
Peter Crosthwaitea540f152013-04-18 14:47:31 +10007305 echo "config-host.h: subdir-dtc" >> $config_host_mak
7306fi
Richard Hendersone219c492017-09-28 09:01:23 -07007307if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then
7308 echo "config-host.h: subdir-capstone" >> $config_host_mak
7309fi
7310if test -n "$LIBCAPSTONE"; then
7311 echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak
7312fi
Peter Crosthwaitea540f152013-04-18 14:47:31 +10007313
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08007314if test "$numa" = "yes"; then
7315 echo "CONFIG_NUMA=y" >> $config_host_mak
7316fi
7317
John Snowfd0e6052015-03-25 18:57:39 -04007318if test "$ccache_cpp2" = "yes"; then
7319 echo "export CCACHE_CPP2=y" >> $config_host_mak
7320fi
7321
Paolo Bonzinid1807a42010-12-23 11:43:59 +01007322# build tree in object directory in case the source is not in the current directory
Fam Zhengb1fb9a62017-09-05 10:11:58 +08007323DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm"
Paolo Bonzinib855f8d2017-08-22 06:50:18 +02007324DIRS="$DIRS docs docs/interop fsdev scsi"
Christian Borntraeger9933c302013-04-23 01:23:03 +00007325DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01007326DIRS="$DIRS roms/seabios roms/vgabios"
Anthony Liguoric09015d2012-01-10 13:10:42 -06007327FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
7328FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
Andreas Färberaaa2ebc2013-07-06 20:41:37 +02007329FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01007330FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
Andreas Färber446b9162011-05-08 13:25:56 +02007331FILES="$FILES pc-bios/spapr-rtas/Makefile"
Christian Borntraeger9933c302013-04-23 01:23:03 +00007332FILES="$FILES pc-bios/s390-ccw/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01007333FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
Jan Kiszka4652b792013-02-22 21:05:01 +01007334FILES="$FILES pc-bios/qemu-icon.bmp"
Stefan Hajnoczi3a586d22017-05-17 13:40:42 +01007335FILES="$FILES .gdbinit scripts" # scripts needed by relative path in .gdbinit
Richard Henderson753d11f2011-06-24 11:58:37 -07007336for bios_file in \
7337 $source_path/pc-bios/*.bin \
Alexey Kardashevskiy225a9ab2016-10-26 13:18:03 +11007338 $source_path/pc-bios/*.lid \
Gerd Hoffmann5acc2ec2012-12-03 10:45:49 +01007339 $source_path/pc-bios/*.aml \
Richard Henderson753d11f2011-06-24 11:58:37 -07007340 $source_path/pc-bios/*.rom \
7341 $source_path/pc-bios/*.dtb \
Dominik Dingele89e33e2013-04-29 04:52:06 +00007342 $source_path/pc-bios/*.img \
Richard Henderson753d11f2011-06-24 11:58:37 -07007343 $source_path/pc-bios/openbios-* \
Alexander Graf4e73c782014-01-20 00:25:40 +01007344 $source_path/pc-bios/u-boot.* \
Richard Henderson753d11f2011-06-24 11:58:37 -07007345 $source_path/pc-bios/palcode-*
7346do
Stefan Weil89138852016-05-16 15:10:20 +02007347 FILES="$FILES pc-bios/$(basename $bios_file)"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01007348done
Stefan Weil89138852016-05-16 15:10:20 +02007349for test_file in $(find $source_path/tests/acpi-test-data -type f)
Marcel Apfelbaumc2304b52013-12-26 16:54:20 +02007350do
Stefan Weil89138852016-05-16 15:10:20 +02007351 FILES="$FILES tests/acpi-test-data$(echo $test_file | sed -e 's/.*acpi-test-data//')"
Marcel Apfelbaumc2304b52013-12-26 16:54:20 +02007352done
Paolo Bonzinid1807a42010-12-23 11:43:59 +01007353mkdir -p $DIRS
7354for f in $FILES ; do
Michael S. Tsirkincab00a52014-04-28 15:09:01 +03007355 if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
Peter Maydellf9245e12011-06-03 17:10:40 +01007356 symlink "$source_path/$f" "$f"
7357 fi
Paolo Bonzinid1807a42010-12-23 11:43:59 +01007358done
Paul Brook1ad21342009-05-19 16:17:58 +01007359
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007360# temporary config to build submodules
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06007361for rom in seabios vgabios ; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007362 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01007363 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007364 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
Richard Hendersoncdbd7272016-07-07 21:49:36 -07007365 echo "AS=$as" >> $config_mak
Richard Henderson5f6f0e22016-06-23 10:39:18 -07007366 echo "CCAS=$ccas" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007367 echo "CC=$cc" >> $config_mak
7368 echo "BCC=bcc" >> $config_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00007369 echo "CPP=$cpp" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007370 echo "OBJCOPY=objcopy" >> $config_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03007371 echo "IASL=$iasl" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007372 echo "LD=$ld" >> $config_mak
Alistair Francis9f81aeb2017-11-07 17:10:46 -08007373 echo "RANLIB=$ranlib" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007374done
7375
Marc-André Lureaufe310172016-06-15 13:06:00 +02007376# set up tests data directory
Philippe Mathieu-Daudé1b145d52018-06-12 14:34:37 -03007377for tests_subdir in acceptance data; do
7378 if [ ! -e tests/$tests_subdir ]; then
7379 symlink "$source_path/tests/$tests_subdir" tests/$tests_subdir
7380 fi
7381done
Marc-André Lureaufe310172016-06-15 13:06:00 +02007382
Max Reitz76c75602014-05-24 23:24:56 +02007383# set up qemu-iotests in this build directory
7384iotests_common_env="tests/qemu-iotests/common.env"
7385iotests_check="tests/qemu-iotests/check"
7386
7387echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
7388echo >> "$iotests_common_env"
7389echo "export PYTHON='$python'" >> "$iotests_common_env"
7390
7391if [ ! -e "$iotests_check" ]; then
7392 symlink "$source_path/$iotests_check" "$iotests_check"
7393fi
7394
Michael S. Tsirkindc655402014-03-09 17:37:49 +02007395# Save the configure command line for later reuse.
7396cat <<EOD >config.status
7397#!/bin/sh
7398# Generated by configure.
7399# Run this file to recreate the current configuration.
7400# Compiler output produced by configure, useful for debugging
7401# configure, is in config.log if it exists.
7402EOD
7403printf "exec" >>config.status
7404printf " '%s'" "$0" "$@" >>config.status
Dr. David Alan Gilbertcf7cc922016-01-12 11:58:48 +00007405echo ' "$@"' >>config.status
Michael S. Tsirkindc655402014-03-09 17:37:49 +02007406chmod +x config.status
7407
Peter Maydell8cd05ab2014-05-23 17:07:24 +01007408rm -r "$TMPDIR1"