blob: f86e03981e896296434eaed96e756cc23fe9e40d [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
Daniel P. Berrangédedad022020-08-21 12:22:04 +020014# make source path absolute
15source_path=$(cd "$(dirname -- "$0")"; pwd)
16
17if test "$PWD" = "$source_path"
18then
19 echo "Using './build' as the directory for build output"
20
21 MARKER=build/auto-created-by-configure
22
23 if test -e build
24 then
25 if test -f $MARKER
26 then
27 rm -rf build
28 else
29 echo "ERROR: ./build dir already exists and was not previously created by configure"
30 exit 1
31 fi
32 fi
33
34 mkdir build
35 touch $MARKER
36
37 cat > GNUmakefile <<'EOF'
38# This file is auto-generated by configure to support in-source tree
39# 'make' command invocation
40
41ifeq ($(MAKECMDGOALS),)
42recurse: all
43endif
44
45.NOTPARALLEL: %
46%: force
47 @echo 'changing dir to build for $(MAKE) "$(MAKECMDGOALS)"...'
48 @$(MAKE) -C build -f Makefile $(MAKECMDGOALS)
49 @if test "$(MAKECMDGOALS)" = "distclean" && \
50 test -e build/auto-created-by-configure ; \
51 then \
52 rm -rf build GNUmakefile ; \
53 fi
54force: ;
55.PHONY: force
56GNUmakefile: ;
57
58EOF
59 cd build
60 exec $source_path/configure "$@"
61fi
62
Peter Maydell8cd05ab2014-05-23 17:07:24 +010063# Temporary directory used for files created while
64# configure runs. Since it is in the build directory
65# we can safely blow away any previous version of it
66# (and we need not jump through hoops to try to delete
67# it when configure exits.)
68TMPDIR1="config-temp"
69rm -rf "${TMPDIR1}"
70mkdir -p "${TMPDIR1}"
71if [ $? -ne 0 ]; then
72 echo "ERROR: failed to create temporary directory"
73 exit 1
bellard7d132992003-03-06 23:23:54 +000074fi
75
Peter Maydell8cd05ab2014-05-23 17:07:24 +010076TMPB="qemu-conf"
77TMPC="${TMPDIR1}/${TMPB}.c"
Don Slutz66518bf2014-01-02 21:12:46 -050078TMPO="${TMPDIR1}/${TMPB}.o"
Peter Maydell9c83ffd2014-02-25 18:27:49 +000079TMPCXX="${TMPDIR1}/${TMPB}.cxx"
Peter Maydell8cd05ab2014-05-23 17:07:24 +010080TMPE="${TMPDIR1}/${TMPB}.exe"
James Clarke6969ec62016-06-06 12:02:50 +010081TMPMO="${TMPDIR1}/${TMPB}.mo"
Emilio G. Cota26fffe22018-10-21 13:56:29 -040082TMPTXT="${TMPDIR1}/${TMPB}.txt"
bellard7d132992003-03-06 23:23:54 +000083
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020084rm -f config.log
malc9ac81bb2008-11-29 20:09:56 +000085
Peter Maydellb48e3612011-11-23 17:26:44 +000086# Print a helpful header at the top of config.log
87echo "# QEMU configure log $(date)" >> config.log
Peter Maydell979ae162012-03-07 12:16:29 +000088printf "# Configured with:" >> config.log
89printf " '%s'" "$0" "$@" >> config.log
90echo >> config.log
Peter Maydellb48e3612011-11-23 17:26:44 +000091echo "#" >> config.log
92
Paolo Bonzinid880a3b2017-07-03 16:58:28 +020093print_error() {
94 (echo
Peter Maydell76ad07a2013-04-08 12:11:26 +010095 echo "ERROR: $1"
96 while test -n "$2"; do
97 echo " $2"
98 shift
99 done
Paolo Bonzinid880a3b2017-07-03 16:58:28 +0200100 echo) >&2
101}
102
103error_exit() {
104 print_error "$@"
Peter Maydell76ad07a2013-04-08 12:11:26 +0100105 exit 1
106}
107
Peter Maydell9c83ffd2014-02-25 18:27:49 +0000108do_compiler() {
109 # Run the compiler, capturing its output to the log. First argument
110 # is compiler binary to execute.
111 local compiler="$1"
112 shift
Ian Jackson8bbe05d2017-09-25 16:41:03 +0100113 if test -n "$BASH_VERSION"; then eval '
114 echo >>config.log "
115funcs: ${FUNCNAME[*]}
116lines: ${BASH_LINENO[*]}"
117 '; fi
Peter Maydell9c83ffd2014-02-25 18:27:49 +0000118 echo $compiler "$@" >> config.log
119 $compiler "$@" >> config.log 2>&1 || return $?
Peter Maydell8dc38a72012-07-18 15:10:28 +0100120 # Test passed. If this is an --enable-werror build, rerun
121 # the test with -Werror and bail out if it fails. This
122 # makes warning-generating-errors in configure test code
123 # obvious to developers.
124 if test "$werror" != "yes"; then
125 return 0
126 fi
127 # Don't bother rerunning the compile if we were already using -Werror
128 case "$*" in
129 *-Werror*)
130 return 0
131 ;;
132 esac
Peter Maydell9c83ffd2014-02-25 18:27:49 +0000133 echo $compiler -Werror "$@" >> config.log
134 $compiler -Werror "$@" >> config.log 2>&1 && return $?
Peter Maydell76ad07a2013-04-08 12:11:26 +0100135 error_exit "configure test passed without -Werror but failed with -Werror." \
136 "This is probably a bug in the configure script. The failing command" \
137 "will be at the bottom of config.log." \
138 "You can run configure with --disable-werror to bypass this check."
Peter Maydell8dc38a72012-07-18 15:10:28 +0100139}
140
Peter Maydell9c83ffd2014-02-25 18:27:49 +0000141do_cc() {
142 do_compiler "$cc" "$@"
143}
144
145do_cxx() {
146 do_compiler "$cxx" "$@"
147}
148
Richard Henderson00849b92020-06-17 13:13:06 -0700149# Append $2 to the variable named $1, with space separation
150add_to() {
151 eval $1=\${$1:+\"\$$1 \"}\$2
152}
153
Peter Maydell9c83ffd2014-02-25 18:27:49 +0000154update_cxxflags() {
155 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
156 # options which some versions of GCC's C++ compiler complain about
157 # because they only make sense for C programs.
Paolo Bonzini53422042019-07-29 12:50:04 +0200158 QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS"
Paolo Bonzini086d5f72020-02-03 15:22:17 +0100159 CXXFLAGS=$(echo "$CFLAGS" | sed s/-std=gnu99/-std=gnu++11/)
Peter Maydell9c83ffd2014-02-25 18:27:49 +0000160 for arg in $QEMU_CFLAGS; do
161 case $arg in
162 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
163 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
164 ;;
165 *)
166 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
167 ;;
168 esac
169 done
170}
171
Juan Quintela52166aa2009-08-03 14:46:03 +0200172compile_object() {
John Snowfd0e6052015-03-25 18:57:39 -0400173 local_cflags="$1"
Paolo Bonzini086d5f72020-02-03 15:22:17 +0100174 do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
Juan Quintela52166aa2009-08-03 14:46:03 +0200175}
176
177compile_prog() {
178 local_cflags="$1"
179 local_ldflags="$2"
Paolo Bonzini086d5f72020-02-03 15:22:17 +0100180 do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $QEMU_LDFLAGS $local_ldflags
Juan Quintela52166aa2009-08-03 14:46:03 +0200181}
182
Paolo Bonzini11568d62010-12-23 11:43:58 +0100183# symbolically link $1 to $2. Portable version of "ln -sf".
184symlink() {
Stefan Weil72b8b5a2012-03-19 13:20:47 +0100185 rm -rf "$2"
Anthony Liguoriec5b06d2012-06-06 16:57:00 +0800186 mkdir -p "$(dirname "$2")"
Stefan Weil72b8b5a2012-03-19 13:20:47 +0100187 ln -s "$1" "$2"
Paolo Bonzini11568d62010-12-23 11:43:58 +0100188}
189
Loïc Minier0dba6192010-01-28 21:26:51 +0000190# check whether a command is available to this shell (may be either an
191# executable or a builtin)
192has() {
193 type "$1" >/dev/null 2>&1
194}
195
196# search for an executable in PATH
197path_of() {
198 local_command="$1"
199 local_ifs="$IFS"
200 local_dir=""
201
202 # pathname has a dir component?
203 if [ "${local_command#*/}" != "$local_command" ]; then
204 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
205 echo "$local_command"
206 return 0
207 fi
208 fi
209 if [ -z "$local_command" ]; then
210 return 1
211 fi
212
213 IFS=:
214 for local_dir in $PATH; do
215 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
216 echo "$local_dir/$local_command"
217 IFS="${local_ifs:-$(printf ' \t\n')}"
218 return 0
219 fi
220 done
221 # not found
222 IFS="${local_ifs:-$(printf ' \t\n')}"
223 return 1
224}
225
Lluís Vilanova5b808272014-05-27 15:02:14 +0200226have_backend () {
227 echo "$trace_backends" | grep "$1" >/dev/null
228}
229
Paolo Bonzini3b6b7552012-09-17 11:59:41 +0200230glob() {
231 eval test -z '"${1#'"$2"'}"'
232}
233
234supported_hax_target() {
235 test "$hax" = "yes" || return 1
236 glob "$1" "*-softmmu" || return 1
237 case "${1%-softmmu}" in
238 i386|x86_64)
239 return 0
240 ;;
241 esac
242 return 1
243}
244
245supported_kvm_target() {
246 test "$kvm" = "yes" || return 1
247 glob "$1" "*-softmmu" || return 1
248 case "${1%-softmmu}:$cpu" in
249 arm:arm | aarch64:aarch64 | \
250 i386:i386 | i386:x86_64 | i386:x32 | \
251 x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \
Huacai Chenaa2953f2020-05-03 18:20:15 +0800252 mips:mips | mipsel:mips | mips64:mips | mips64el:mips | \
Richard Hendersonf8378ac2019-05-01 15:38:18 -0700253 ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | ppc64:ppc64le | \
Paolo Bonzini3b6b7552012-09-17 11:59:41 +0200254 s390x:s390x)
255 return 0
256 ;;
257 esac
258 return 1
259}
260
261supported_xen_target() {
262 test "$xen" = "yes" || return 1
263 glob "$1" "*-softmmu" || return 1
Paolo Bonzinib5ed2e12017-07-11 12:00:49 +0200264 # Only i386 and x86_64 provide the xenpv machine.
265 case "${1%-softmmu}" in
266 i386|x86_64)
Paolo Bonzini3b6b7552012-09-17 11:59:41 +0200267 return 0
268 ;;
269 esac
270 return 1
271}
272
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -0500273supported_hvf_target() {
274 test "$hvf" = "yes" || return 1
275 glob "$1" "*-softmmu" || return 1
276 case "${1%-softmmu}" in
277 x86_64)
278 return 0
279 ;;
280 esac
281 return 1
282}
283
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -0800284supported_whpx_target() {
285 test "$whpx" = "yes" || return 1
286 glob "$1" "*-softmmu" || return 1
287 case "${1%-softmmu}" in
288 i386|x86_64)
289 return 0
290 ;;
291 esac
292 return 1
293}
294
Paolo Bonzinid880a3b2017-07-03 16:58:28 +0200295supported_target() {
296 case "$1" in
297 *-softmmu)
298 ;;
299 *-linux-user)
300 if test "$linux" != "yes"; then
301 print_error "Target '$target' is only available on a Linux host"
302 return 1
303 fi
304 ;;
305 *-bsd-user)
306 if test "$bsd" != "yes"; then
307 print_error "Target '$target' is only available on a BSD host"
308 return 1
309 fi
310 ;;
311 *)
312 print_error "Invalid target name '$target'"
313 return 1
314 ;;
315 esac
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +0200316 test "$tcg" = "yes" && return 0
317 supported_kvm_target "$1" && return 0
318 supported_xen_target "$1" && return 0
319 supported_hax_target "$1" && return 0
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -0500320 supported_hvf_target "$1" && return 0
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -0800321 supported_whpx_target "$1" && return 0
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +0200322 print_error "TCG disabled, but hardware accelerator not available for '$target'"
323 return 1
Paolo Bonzinid880a3b2017-07-03 16:58:28 +0200324}
325
Christian Borntraegere9a35912017-08-23 12:16:23 +0200326
327ld_has() {
328 $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
329}
330
Antonio Ospite4ace32e2019-05-26 16:47:47 +0200331if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]";
332then
333 error_exit "main directory cannot contain spaces nor colons"
334fi
335
Antonio Ospite14211822019-05-26 16:47:46 +0200336# default parameters
Juan Quintela2ff6b912009-08-03 14:45:55 +0200337cpu=""
Michael S. Tsirkina31a8642013-07-24 18:56:03 +0300338iasl="iasl"
bellard1e43adf2003-09-30 20:54:24 +0000339interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +0000340static="no"
bellard7d132992003-03-06 23:23:54 +0000341cross_prefix=""
malc0c58ac12008-06-25 21:04:05 +0000342audio_drv_list=""
Fam Zhengb64ec4e2013-05-29 19:35:40 +0800343block_drv_rw_whitelist=""
344block_drv_ro_whitelist=""
Peter Maydelle49d0212012-12-07 15:39:13 +0000345host_cc="cc"
Daniel P. Berrangé02f91352019-05-16 10:51:34 +0100346libs_cpu=""
Juan Quintela73da3752009-08-03 14:46:26 +0200347libs_softmmu=""
Juan Quintela3e2e0e62009-08-03 14:47:06 +0200348libs_tools=""
malcd5631632009-10-10 01:13:41 +0400349audio_win_int=""
Michael Roth957f1f92011-08-11 15:38:12 -0500350libs_qga=""
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100351debug_info="yes"
Steven Noonan63678e12014-03-28 17:19:02 +0100352stack_protector=""
Daniele Buono1e4f6062020-05-29 16:51:21 -0400353safe_stack=""
Alex Bennéeafc3a8f2019-11-28 16:35:24 +0100354use_containers="yes"
Alex Bennéef2385392020-04-30 20:01:14 +0100355gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
aliguoriac0df512008-12-29 17:14:15 +0000356
Daniel P. Berrange92712822017-09-29 11:11:58 +0100357if test -e "$source_path/.git"
358then
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +0100359 git_update=yes
Daniel P. Berrange92712822017-09-29 11:11:58 +0100360 git_submodules="ui/keycodemapdb"
Emilio G. Cota3ac1f812018-03-08 21:09:40 -0500361 git_submodules="$git_submodules tests/fp/berkeley-testfloat-3"
362 git_submodules="$git_submodules tests/fp/berkeley-softfloat-3"
Daniel P. Berrange92712822017-09-29 11:11:58 +0100363else
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +0100364 git_update=no
Daniel P. Berrange92712822017-09-29 11:11:58 +0100365 git_submodules=""
Daniel P. Berrangé5c0ef672018-04-18 18:11:51 +0100366
367 if ! test -f "$source_path/ui/keycodemapdb/README"
368 then
369 echo
370 echo "ERROR: missing file $source_path/ui/keycodemapdb/README"
371 echo
372 echo "This is not a GIT checkout but module content appears to"
373 echo "be missing. Do not use 'git archive' or GitHub download links"
374 echo "to acquire QEMU source archives. Non-GIT builds are only"
375 echo "supported with source archives linked from:"
376 echo
Peter Maydella3e3b522019-07-22 14:07:39 +0100377 echo " https://www.qemu.org/download/#source"
Daniel P. Berrangé5c0ef672018-04-18 18:11:51 +0100378 echo
379 echo "Developers working with GIT can use scripts/archive-source.sh"
380 echo "if they need to create valid source archives."
381 echo
382 exit 1
383 fi
Daniel P. Berrange92712822017-09-29 11:11:58 +0100384fi
Daniel P. Berrangecc84d632017-10-20 15:02:43 +0100385git="git"
aliguoriac0df512008-12-29 17:14:15 +0000386
Stefan Weilafb63eb2012-09-26 22:04:38 +0200387# Don't accept a target_list environment variable.
388unset target_list
Alex Bennée447e1332019-03-19 11:59:12 +0000389unset target_list_exclude
Paolo Bonzini377529c2010-12-23 11:43:50 +0100390
391# Default value for a variable defining feature "foo".
392# * foo="no" feature will only be used if --enable-foo arg is given
393# * foo="" feature will be searched for, and if found, will be used
394# unless --disable-foo is given
395# * foo="yes" this value will only be set by --enable-foo flag.
396# feature will searched for,
397# if not found, configure exits with error
398#
399# Always add --enable-foo and --disable-foo command line args.
400# Distributions want to ensure that several features are compiled in, and it
401# is impossible without a --enable-foo that exits if a feature is not found.
402
Paolo Bonzini377529c2010-12-23 11:43:50 +0100403brlapi=""
404curl=""
405curses=""
406docs=""
407fdt=""
Vincenzo Maffione58952132013-11-06 11:44:06 +0100408netmap="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100409sdl=""
Daniel P. Berrangéa442fe22019-01-10 12:00:47 +0000410sdl_image=""
Meador Inge983eef52012-02-24 14:00:42 +0530411virtfs=""
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +0200412mpath=""
Jes Sorensen821601e2011-03-16 13:33:36 +0100413vnc="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100414sparse="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100415vde=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100416vnc_sasl=""
417vnc_jpeg=""
418vnc_png=""
Gerd Hoffmann6a021532017-10-05 17:33:28 +0200419xkbcommon=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100420xen=""
Anthony PERARDd5b93dd2011-02-25 16:20:34 +0000421xen_ctrl_version=""
Anthony PERARDeb6fda02012-06-21 15:32:59 +0000422xen_pci_passthrough=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100423linux_aio=""
Aarushi Mehtac10dd852020-01-20 14:18:44 +0000424linux_io_uring=""
Corey Bryant47e98652012-01-26 09:42:26 -0500425cap_ng=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100426attr=""
Avi Kivity4f26f2b2011-11-09 14:44:52 +0200427libattr=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100428xfs=""
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +0200429tcg="yes"
Paolo Bonzinia40161c2018-02-16 10:05:23 +0100430membarrier=""
Paolo Bonzini299e6f12019-02-14 18:35:53 +0100431vhost_net=""
432vhost_crypto=""
433vhost_scsi=""
434vhost_vsock=""
Marc-André Lureaue6a74862017-08-03 11:07:46 +0200435vhost_user=""
Dr. David Alan Gilbert98fc1ad2019-09-30 11:51:34 +0100436vhost_user_fs=""
Bradd41a75a2011-07-26 23:11:26 -0400437kvm="no"
Vincent Palatinb0cb0a62017-01-10 11:59:57 +0100438hax="no"
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -0500439hvf="no"
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -0800440whpx="no"
Michael R. Hines2da776d2013-07-22 10:01:54 -0400441rdma=""
Marcel Apfelbaum21ab34c2018-08-16 18:16:37 +0300442pvrdma=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100443gprof="no"
444debug_tcg="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100445debug="no"
Marc-André Lureau247724c2018-01-16 16:11:51 +0100446sanitizers="no"
Lingfeng Yang0aebab02020-06-12 20:02:23 +0100447tsan="no"
John Snowb553a042015-11-03 15:43:42 -0500448fortify_source=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100449strip_opt="yes"
Stefan Weil9195b2c2011-10-19 07:07:18 +0200450tcg_interpreter="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100451bigendian="no"
452mingw32="no"
Blue Swirl1d728c32012-05-01 18:45:39 +0000453gcov="no"
454gcov_tool="gcov"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100455EXESUF=""
Fam Zheng17969262014-02-10 14:48:56 +0800456DSOSUF=".so"
457LDFLAGS_SHARED="-shared"
458modules="no"
Christian Ehrhardtbd83c862020-03-10 15:58:06 +0100459module_upgrades="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100460prefix="/usr/local"
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +0200461firmwarepath="\${prefix}/share/qemu-firmware"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100462confsuffix="/qemu"
Marc-André Lureau675b9b52019-02-12 17:25:23 +0100463slirp=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100464oss_lib=""
465bsd="no"
466linux="no"
467solaris="no"
468profiler="no"
469cocoa="no"
470softmmu="yes"
471linux_user="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100472bsd_user="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100473blobs="yes"
Philippe Mathieu-Daudé05dfa222019-11-08 12:45:30 +0100474edk2_blobs="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100475pkgversion=""
Avi Kivity40d64442011-11-15 20:12:17 +0200476pie=""
Paolo Bonzini3556c232013-05-10 14:16:40 +0200477qom_cast_debug="yes"
Paolo Bonzinibaf86d62016-01-07 16:55:31 +0300478trace_backends="log"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100479trace_file="trace"
480spice=""
481rbd=""
Marc-André Lureau7b02f542015-08-30 11:48:40 +0200482smartcard=""
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +0100483libusb=""
Hans de Goede69354a82011-07-19 11:04:10 +0200484usb_redir=""
Gerd Hoffmannda076ff2014-11-20 09:49:44 +0100485opengl=""
Gerd Hoffmann014cb152015-12-03 12:56:34 +0100486opengl_dmabuf="no"
Richard Henderson5dd89902017-07-18 18:40:18 -1000487cpuid_h="no"
Liam Merwick86583a02018-10-19 21:38:59 +0100488avx2_opt=""
Alon Levy1ece9902011-07-26 12:30:40 +0300489zlib="yes"
Richard Henderson8ca80762017-09-14 09:41:12 -0700490capstone=""
Stefan Weilb25c9df2014-04-29 08:21:16 +0200491lzo=""
492snappy=""
Peter Wu6b383c02015-01-06 18:48:14 +0100493bzip2=""
Julio Faracco83bc1f92018-11-05 13:08:04 -0200494lzfse=""
Juan Quintela3a678482019-12-17 21:15:24 +0100495zstd=""
Michael Tokareve8ef31a2013-07-31 14:22:07 +0400496guest_agent=""
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -0400497guest_agent_with_vss="no"
Michael Roth50cbebb2015-07-07 18:10:09 -0500498guest_agent_ntddscsi="no"
Yossi Hindin9dacf322015-05-06 14:57:40 +0300499guest_agent_msi=""
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -0400500vss_win32_sdk=""
501win_sdk="no"
Philippe Mathieu-Daudée10ee3f2020-02-17 14:33:27 +0100502want_tools=""
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100503libiscsi=""
Peter Lieven6542aa92014-02-03 10:26:13 +0100504libnfs=""
Alex Barcelo519175a2012-02-28 12:25:50 +0100505coroutine=""
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +0200506coroutine_pool=""
Peter Lieven7d992e42016-09-27 11:58:45 +0200507debug_stack_usage="no"
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -0400508crypto_afalg="no"
Eduardo Otubof7945732012-08-14 18:44:05 -0300509seccomp=""
Bharata B Raoeb100392012-09-24 14:42:45 +0530510glusterfs=""
Jeff Codyd85fa9e2016-04-05 10:40:09 -0400511glusterfs_xlator_opt="no"
Bharata B Rao0c14fb42013-07-16 21:47:42 +0530512glusterfs_discard="no"
Niels de Vosdf3a4292017-05-28 12:01:14 +0530513glusterfs_fallocate="no"
Bharata B Rao7c815372013-12-21 14:51:25 +0530514glusterfs_zerofill="no"
Prasanna Kumar Kalevere014dbe2019-03-05 16:46:33 +0100515glusterfs_ftruncate_has_stat="no"
Niels de Vos0e3b8912019-03-05 16:46:34 +0100516glusterfs_iocb_has_stat="no"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -0600517gtk=""
Gerd Hoffmann925a0402015-05-26 12:26:21 +0200518gtk_gl="no"
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +0100519tls_priority="NORMAL"
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +0100520gnutls=""
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +0100521nettle=""
Daniel P. Berrangédc2207a2019-10-14 17:28:27 +0100522nettle_xts="no"
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +0100523gcrypt=""
Longpeng(Mike)1f923c72016-12-13 18:42:55 +0800524gcrypt_hmac="no"
Daniel P. Berrangée0576942019-10-14 17:28:27 +0100525gcrypt_xts="no"
526qemu_private_xts="yes"
Daniel P. Berrange8953caf2016-07-27 14:13:56 +0100527auth_pam=""
Stefan Weilbbbf9bf2014-02-19 07:04:34 +0100528vte=""
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +0200529virglrenderer=""
Paolo Bonzini7aaa6a12019-01-23 14:56:07 +0800530tpm=""
Pino Toscanob10d49d2019-06-20 22:08:40 +0200531libssh=""
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +0100532live_block_migration="yes"
Wanlong Gaoa99d57b2014-05-14 17:43:28 +0800533numa=""
Fam Zheng2847b462015-03-26 11:03:12 +0800534tcmalloc="no"
Alexandre Derumier7b01cb92015-06-19 12:56:58 +0200535jemalloc="no"
Changlong Xiea6b1d4c2016-07-27 15:01:48 +0800536replication="yes"
Jeff Cody2f740132018-11-07 07:36:44 +0100537bochs="yes"
538cloop="yes"
539dmg="yes"
540qcow1="yes"
541vdi="yes"
542vvfat="yes"
543qed="yes"
544parallels="yes"
545sheepdog="yes"
Klim Kireeved279a02018-01-12 12:01:19 +0300546libxml2=""
Paolo Bonziniba59fb72018-06-13 14:23:08 +0200547debug_mutex="no"
Junyan He17824402018-07-18 15:47:59 +0800548libpmem=""
Paolo Bonzinif3494742019-01-23 14:56:17 +0800549default_devices="yes"
Alex Bennée40e8c6f2019-06-13 14:52:25 +0100550plugins="no"
Alexander Bulekovadc28022020-02-19 23:11:14 -0500551fuzzing="no"
Marek Marczykowski-Góreckib767d252020-05-20 15:20:23 +0200552rng_none="no"
Alexey Krasikov54e7aac2020-05-25 14:19:12 +0300553secret_keyring=""
Jingqi Liu21b2eca2020-04-29 16:50:11 +0800554libdaxctl=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100555
Peter Maydell898be3e2017-03-21 14:31:57 +0000556supported_cpu="no"
557supported_os="no"
Peter Maydellfb59dab2017-03-28 14:01:52 +0100558bogus_os="no"
Yang Zhong5a22ab72017-12-20 21:16:46 +0800559malloc_trim=""
Peter Maydell898be3e2017-03-21 14:31:57 +0000560
aliguoriac0df512008-12-29 17:14:15 +0000561# parse CC options first
562for opt do
Stefan Weil89138852016-05-16 15:10:20 +0200563 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
aliguoriac0df512008-12-29 17:14:15 +0000564 case "$opt" in
565 --cross-prefix=*) cross_prefix="$optarg"
566 ;;
Paolo Bonzini3d8df642010-12-23 11:43:48 +0100567 --cc=*) CC="$optarg"
aliguoriac0df512008-12-29 17:14:15 +0000568 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400569 --cxx=*) CXX="$optarg"
570 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200571 --cpu=*) cpu="$optarg"
572 ;;
Alex Bennéede385282015-06-03 09:56:37 +0100573 --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +0100574 QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200575 ;;
Bruno Dominguez11cde1c2017-06-06 14:07:47 +0100576 --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
Bruno Dominguez11cde1c2017-06-06 14:07:47 +0100577 ;;
Paolo Bonzinidb5adea2019-12-11 15:34:27 +0100578 --extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg"
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +0100579 EXTRA_LDFLAGS="$optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200580 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100581 --enable-debug-info) debug_info="yes"
582 ;;
583 --disable-debug-info) debug_info="no"
584 ;;
Alex Bennéed75402b2018-04-04 20:27:05 +0100585 --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option"
586 ;;
Alex Bennéed422b2b2018-04-13 11:07:58 +0100587 --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*}
588 eval "cross_cc_cflags_${cc_arch}=\$optarg"
Paolo Bonzini2038f8c2019-08-07 16:35:23 +0200589 cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}"
Alex Bennéed422b2b2018-04-13 11:07:58 +0100590 ;;
Alex Bennéed75402b2018-04-04 20:27:05 +0100591 --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
Paolo Bonzini2038f8c2019-08-07 16:35:23 +0200592 cc_archs="$cc_archs $cc_arch"
Alex Bennéed75402b2018-04-04 20:27:05 +0100593 eval "cross_cc_${cc_arch}=\$optarg"
Paolo Bonzini2038f8c2019-08-07 16:35:23 +0200594 cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}"
Alex Bennéed75402b2018-04-04 20:27:05 +0100595 ;;
aliguoriac0df512008-12-29 17:14:15 +0000596 esac
597done
aliguoriac0df512008-12-29 17:14:15 +0000598# OS specific
599# Using uname is really, really broken. Once we have the right set of checks
Stefan Weil93148aa2012-02-26 18:46:12 +0100600# we can eliminate its usage altogether.
aliguoriac0df512008-12-29 17:14:15 +0000601
Peter Maydelle49d0212012-12-07 15:39:13 +0000602# Preferred compiler:
603# ${CC} (if set)
604# ${cross_prefix}gcc (if cross-prefix specified)
605# system compiler
606if test -z "${CC}${cross_prefix}"; then
607 cc="$host_cc"
608else
609 cc="${CC-${cross_prefix}gcc}"
610fi
611
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400612if test -z "${CXX}${cross_prefix}"; then
613 cxx="c++"
614else
615 cxx="${CXX-${cross_prefix}g++}"
616fi
617
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500618ar="${AR-${cross_prefix}ar}"
Richard Hendersoncdbd7272016-07-07 21:49:36 -0700619as="${AS-${cross_prefix}as}"
Richard Henderson5f6f0e22016-06-23 10:39:18 -0700620ccas="${CCAS-$cc}"
Blue Swirl3dd46c72013-01-05 10:10:27 +0000621cpp="${CPP-$cc -E}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500622objcopy="${OBJCOPY-${cross_prefix}objcopy}"
623ld="${LD-${cross_prefix}ld}"
Alistair Francis9f81aeb2017-11-07 17:10:46 -0800624ranlib="${RANLIB-${cross_prefix}ranlib}"
Stefan Weil4852ee92014-09-18 21:55:08 +0200625nm="${NM-${cross_prefix}nm}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500626strip="${STRIP-${cross_prefix}strip}"
627windres="${WINDRES-${cross_prefix}windres}"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300628pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
629query_pkg_config() {
630 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
631}
632pkg_config=query_pkg_config
Dave Airlie47c03742013-12-10 14:05:51 +1000633sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
aliguoriac0df512008-12-29 17:14:15 +0000634
Peter Maydell45d285a2013-10-21 21:03:06 +0100635# If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
636ARFLAGS="${ARFLAGS-rv}"
637
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200638# default flags for all hosts
Peter Maydell2d315152016-09-12 14:10:08 +0100639# We use -fwrapv to tell the compiler that we require a C dialect where
640# left shift of signed integers is well defined and has the expected
641# 2s-complement style results. (Both clang and gcc agree that it
642# provides these semantics.)
Paolo Bonzini086d5f72020-02-03 15:22:17 +0100643QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
644QEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
Kevin Wolfc95e3082013-02-22 21:08:51 +0100645QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200646QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Paolo Bonzini25211442019-06-10 12:03:04 +0200647QEMU_INCLUDES="-iquote . -iquote ${source_path} -iquote ${source_path}/accel/tcg -iquote ${source_path}/include"
648QEMU_INCLUDES="$QEMU_INCLUDES -iquote ${source_path}/disas/libvixl"
Paolo Bonzini086d5f72020-02-03 15:22:17 +0100649CFLAGS="-std=gnu99 -Wall"
650
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200651
Michael S. Tsirkincab00a52014-04-28 15:09:01 +0300652# running configure in the source tree?
653# we know that's the case if configure is there.
654if test -f "./configure"; then
655 pwd_is_source_path="y"
656else
657 pwd_is_source_path="n"
658fi
659
aliguoriac0df512008-12-29 17:14:15 +0000660check_define() {
661cat > $TMPC <<EOF
662#if !defined($1)
Peter Maydellfd786e12011-11-23 17:26:43 +0000663#error $1 not defined
aliguoriac0df512008-12-29 17:14:15 +0000664#endif
665int main(void) { return 0; }
666EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200667 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000668}
669
Gerd Hoffmann307119e2015-06-10 09:07:35 +0200670check_include() {
671cat > $TMPC <<EOF
672#include <$1>
673int main(void) { return 0; }
674EOF
675 compile_object
676}
677
John Snow93b25862015-03-25 18:57:37 -0400678write_c_skeleton() {
679 cat > $TMPC <<EOF
680int main(void) { return 0; }
681EOF
682}
683
Alexander Bulekovadc28022020-02-19 23:11:14 -0500684write_c_fuzzer_skeleton() {
685 cat > $TMPC <<EOF
686#include <stdint.h>
687#include <sys/types.h>
688int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);
689int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; }
690EOF
691}
692
Peter Maydellbbea4052012-08-14 15:35:34 +0100693if check_define __linux__ ; then
694 targetos="Linux"
695elif check_define _WIN32 ; then
696 targetos='MINGW32'
697elif check_define __OpenBSD__ ; then
698 targetos='OpenBSD'
699elif check_define __sun__ ; then
700 targetos='SunOS'
701elif check_define __HAIKU__ ; then
702 targetos='Haiku'
Peter Maydell951fedf2017-07-13 16:15:32 +0100703elif check_define __FreeBSD__ ; then
704 targetos='FreeBSD'
705elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then
706 targetos='GNU/kFreeBSD'
707elif check_define __DragonFly__ ; then
708 targetos='DragonFly'
709elif check_define __NetBSD__; then
710 targetos='NetBSD'
711elif check_define __APPLE__; then
712 targetos='Darwin'
Peter Maydellbbea4052012-08-14 15:35:34 +0100713else
Peter Maydell951fedf2017-07-13 16:15:32 +0100714 # This is a fatal error, but don't report it yet, because we
715 # might be going to just print the --help text, or it might
716 # be the result of a missing compiler.
717 targetos='bogus'
718 bogus_os='yes'
Peter Maydellbbea4052012-08-14 15:35:34 +0100719fi
720
721# Some host OSes need non-standard checks for which CPU to use.
722# Note that these checks are broken for cross-compilation: if you're
723# cross-compiling to one of these OSes then you'll need to specify
724# the correct CPU with the --cpu option.
725case $targetos in
726Darwin)
727 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
728 # run 64-bit userspace code.
729 # If the user didn't specify a CPU explicitly and the kernel says this is
730 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
731 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
732 cpu="x86_64"
733 fi
734 ;;
735SunOS)
Stefan Weil89138852016-05-16 15:10:20 +0200736 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
Peter Maydellbbea4052012-08-14 15:35:34 +0100737 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
738 cpu="x86_64"
739 fi
740esac
741
Juan Quintela2ff6b912009-08-03 14:45:55 +0200742if test ! -z "$cpu" ; then
743 # command line argument
744 :
745elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000746 cpu="i386"
747elif check_define __x86_64__ ; then
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700748 if check_define __ILP32__ ; then
749 cpu="x32"
750 else
751 cpu="x86_64"
752 fi
blueswir13aa9bd62008-12-31 16:55:26 +0000753elif check_define __sparc__ ; then
blueswir13aa9bd62008-12-31 16:55:26 +0000754 if check_define __arch64__ ; then
755 cpu="sparc64"
756 else
757 cpu="sparc"
758 fi
malcfdf7ed92009-01-14 18:39:52 +0000759elif check_define _ARCH_PPC ; then
760 if check_define _ARCH_PPC64 ; then
Richard Hendersonf8378ac2019-05-01 15:38:18 -0700761 if check_define _LITTLE_ENDIAN ; then
762 cpu="ppc64le"
763 else
764 cpu="ppc64"
765 fi
malcfdf7ed92009-01-14 18:39:52 +0000766 else
767 cpu="ppc"
768 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200769elif check_define __mips__ ; then
770 cpu="mips"
Aurelien Jarnod66ed0e2010-06-13 12:28:21 +0200771elif check_define __s390__ ; then
772 if check_define __s390x__ ; then
773 cpu="s390x"
774 else
775 cpu="s390"
776 fi
Alistair Francisc4f80542018-12-19 19:20:19 +0000777elif check_define __riscv ; then
778 if check_define _LP64 ; then
779 cpu="riscv64"
780 else
781 cpu="riscv32"
782 fi
Peter Maydell21d89f82011-11-30 10:57:48 +0100783elif check_define __arm__ ; then
784 cpu="arm"
Claudio Fontana1f080312013-06-12 16:20:23 +0100785elif check_define __aarch64__ ; then
786 cpu="aarch64"
aliguoriac0df512008-12-29 17:14:15 +0000787else
Stefan Weil89138852016-05-16 15:10:20 +0200788 cpu=$(uname -m)
aliguoriac0df512008-12-29 17:14:15 +0000789fi
790
Peter Maydell359bc952011-12-24 13:07:25 +0000791ARCH=
792# Normalise host CPU name and set ARCH.
793# Note that this case should only have supported host CPUs, not guests.
bellard7d132992003-03-06 23:23:54 +0000794case "$cpu" in
Thomas Huthee35e962019-09-28 21:03:34 +0200795 ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64)
Peter Maydell898be3e2017-03-21 14:31:57 +0000796 supported_cpu="yes"
797 ;;
Richard Hendersonf8378ac2019-05-01 15:38:18 -0700798 ppc64le)
799 ARCH="ppc64"
800 supported_cpu="yes"
Richard Hendersonf8378ac2019-05-01 15:38:18 -0700801 ;;
bellard7d132992003-03-06 23:23:54 +0000802 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000803 cpu="i386"
Peter Maydell898be3e2017-03-21 14:31:57 +0000804 supported_cpu="yes"
bellard7d132992003-03-06 23:23:54 +0000805 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000806 x86_64|amd64)
807 cpu="x86_64"
Peter Maydell898be3e2017-03-21 14:31:57 +0000808 supported_cpu="yes"
aurel32aaa5fa12008-04-11 22:04:22 +0000809 ;;
Peter Maydell21d89f82011-11-30 10:57:48 +0100810 armv*b|armv*l|arm)
811 cpu="arm"
Peter Maydell898be3e2017-03-21 14:31:57 +0000812 supported_cpu="yes"
bellard7d132992003-03-06 23:23:54 +0000813 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +0100814 aarch64)
815 cpu="aarch64"
Peter Maydell898be3e2017-03-21 14:31:57 +0000816 supported_cpu="yes"
Claudio Fontana1f080312013-06-12 16:20:23 +0100817 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200818 mips*)
819 cpu="mips"
Peter Maydell898be3e2017-03-21 14:31:57 +0000820 supported_cpu="yes"
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200821 ;;
blueswir131422552007-04-16 18:27:06 +0000822 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000823 cpu="sparc"
Peter Maydell6499fd12017-03-28 11:58:38 +0100824 supported_cpu="yes"
bellardae228532003-05-13 18:59:59 +0000825 ;;
bellard7d132992003-03-06 23:23:54 +0000826 *)
Peter Maydell359bc952011-12-24 13:07:25 +0000827 # This will result in either an error or falling back to TCI later
828 ARCH=unknown
bellard7d132992003-03-06 23:23:54 +0000829 ;;
830esac
Peter Maydell359bc952011-12-24 13:07:25 +0000831if test -z "$ARCH"; then
832 ARCH="$cpu"
833fi
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200834
bellard7d132992003-03-06 23:23:54 +0000835# OS specific
Juan Quintela0dbfc672009-08-03 14:46:13 +0200836
Stacey Sonadfc3e92014-06-08 09:57:22 -0700837# host *BSD for user mode
838HOST_VARIANT_DIR=""
839
bellard7d132992003-03-06 23:23:54 +0000840case $targetos in
bellard67b915a2004-03-31 23:37:16 +0000841MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200842 mingw32="yes"
Vincent Palatinb0cb0a62017-01-10 11:59:57 +0100843 hax="yes"
Paolo Bonzini299e6f12019-02-14 18:35:53 +0100844 vhost_user="no"
Kővágó, Zoltán3cec7cc2015-06-03 23:03:46 +0200845 audio_possible_drivers="dsound sdl"
Gerd Hoffmann307119e2015-06-10 09:07:35 +0200846 if check_include dsound.h; then
847 audio_drv_list="dsound"
848 else
849 audio_drv_list=""
850 fi
Peter Maydell898be3e2017-03-21 14:31:57 +0000851 supported_os="yes"
Alex Bennée469a7882020-04-14 21:06:22 +0100852 pie="no"
bellard67b915a2004-03-31 23:37:16 +0000853;;
ths5c40d2b2007-06-23 16:03:36 +0000854GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100855 bsd="yes"
Gerd Hoffmann6a485412019-01-24 12:20:55 +0100856 audio_drv_list="oss try-sdl"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200857 audio_possible_drivers="oss sdl pa"
ths5c40d2b2007-06-23 16:03:36 +0000858;;
bellard7d3505c2004-05-12 19:32:15 +0000859FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200860 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100861 make="${MAKE-gmake}"
Gerd Hoffmann6a485412019-01-24 12:20:55 +0100862 audio_drv_list="oss try-sdl"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200863 audio_possible_drivers="oss sdl pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100864 # needed for kinfo_getvmmap(3) in libutil.h
865 LIBS="-lutil $LIBS"
Ed Mastea7764f12016-11-21 20:32:45 -0500866 # needed for kinfo_getproc
867 libs_qga="-lutil $libs_qga"
Vincenzo Maffione58952132013-11-06 11:44:06 +0100868 netmap="" # enable netmap autodetect
Stacey Sonadfc3e92014-06-08 09:57:22 -0700869 HOST_VARIANT_DIR="freebsd"
Peter Maydell898be3e2017-03-21 14:31:57 +0000870 supported_os="yes"
bellard7d3505c2004-05-12 19:32:15 +0000871;;
blueswir1c5e97232009-03-07 20:06:23 +0000872DragonFly)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200873 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100874 make="${MAKE-gmake}"
Gerd Hoffmann6a485412019-01-24 12:20:55 +0100875 audio_drv_list="oss try-sdl"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200876 audio_possible_drivers="oss sdl pa"
Stacey Sonadfc3e92014-06-08 09:57:22 -0700877 HOST_VARIANT_DIR="dragonfly"
blueswir1c5e97232009-03-07 20:06:23 +0000878;;
bellard7d3505c2004-05-12 19:32:15 +0000879NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200880 bsd="yes"
Kamil Rytarowski604a5b92019-02-08 00:37:04 +0100881 hax="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100882 make="${MAKE-gmake}"
Gerd Hoffmann6a485412019-01-24 12:20:55 +0100883 audio_drv_list="oss try-sdl"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200884 audio_possible_drivers="oss sdl"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200885 oss_lib="-lossaudio"
Stacey Sonadfc3e92014-06-08 09:57:22 -0700886 HOST_VARIANT_DIR="netbsd"
Kamil Rytarowski3c2bdbc2017-05-13 04:21:43 +0200887 supported_os="yes"
bellard7d3505c2004-05-12 19:32:15 +0000888;;
889OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200890 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100891 make="${MAKE-gmake}"
Gerd Hoffmannf92c7162019-01-24 12:20:52 +0100892 audio_drv_list="try-sdl"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200893 audio_possible_drivers="sdl"
Stacey Sonadfc3e92014-06-08 09:57:22 -0700894 HOST_VARIANT_DIR="openbsd"
Brad Smith0a773d52018-02-16 11:46:20 -0500895 supported_os="yes"
bellard7d3505c2004-05-12 19:32:15 +0000896;;
bellard83fb7ad2004-07-05 21:25:26 +0000897Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200898 bsd="yes"
899 darwin="yes"
Vincent Palatinb0cb0a62017-01-10 11:59:57 +0100900 hax="yes"
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -0500901 hvf="yes"
Fam Zheng17969262014-02-10 14:48:56 +0800902 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200903 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200904 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +0100905 QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200906 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200907 cocoa="yes"
Gerd Hoffmann6a485412019-01-24 12:20:55 +0100908 audio_drv_list="coreaudio try-sdl"
Kővágó, Zoltán14382602015-06-03 23:03:45 +0200909 audio_possible_drivers="coreaudio sdl"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +0100910 QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200911 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
Peter Maydella0b7cf62012-08-11 22:34:39 +0100912 # Disable attempts to use ObjectiveC features in os/object.h since they
913 # won't work when we're compiling with gcc as a C compiler.
914 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
Stacey Sonadfc3e92014-06-08 09:57:22 -0700915 HOST_VARIANT_DIR="darwin"
Peter Maydell898be3e2017-03-21 14:31:57 +0000916 supported_os="yes"
bellard83fb7ad2004-07-05 21:25:26 +0000917;;
bellardec530c82006-04-25 22:36:06 +0000918SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200919 solaris="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100920 make="${MAKE-gmake}"
921 install="${INSTALL-ginstall}"
Brade2d88302011-09-02 16:53:28 -0400922 smbd="${SMBD-/usr/sfw/sbin/smbd}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200923 if test -f /usr/include/sys/soundcard.h ; then
Gerd Hoffmann6a485412019-01-24 12:20:55 +0100924 audio_drv_list="oss try-sdl"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200925 fi
926 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000927# needed for CMSG_ macros in sys/socket.h
928 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
929# needed for TIOCWIN* defines in termios.h
930 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Andreas Färber560d3752012-04-30 18:00:55 +0200931 solarisnetlibs="-lsocket -lnsl -lresolv"
932 LIBS="$solarisnetlibs $LIBS"
933 libs_qga="$solarisnetlibs $libs_qga"
ths86b2bd92007-02-11 00:31:33 +0000934;;
Andreas Färber179cf402010-09-20 00:50:43 +0200935Haiku)
936 haiku="yes"
David CARLIERfc433432020-07-13 14:36:08 +0100937 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -DBSD_SOURCE $QEMU_CFLAGS"
938 LIBS="-lposix_error_mapper -lnetwork -lbsd $LIBS"
Andreas Färber179cf402010-09-20 00:50:43 +0200939;;
Peter Maydell898be3e2017-03-21 14:31:57 +0000940Linux)
Gerd Hoffmann71838342019-02-19 13:42:57 +0100941 audio_drv_list="try-pa oss"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200942 audio_possible_drivers="oss alsa sdl pa"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200943 linux="yes"
944 linux_user="yes"
Jan Kiszkaaf2be202011-06-23 10:05:12 +0200945 kvm="yes"
Paolo Bonzini25211442019-06-10 12:03:04 +0200946 QEMU_INCLUDES="-isystem ${source_path}/linux-headers -I$PWD/linux-headers $QEMU_INCLUDES"
Peter Maydell898be3e2017-03-21 14:31:57 +0000947 supported_os="yes"
Tomáš Golembiovský3efac6e2018-10-23 13:23:10 +0200948 libudev="yes"
Peter Maydell898be3e2017-03-21 14:31:57 +0000949;;
bellard7d132992003-03-06 23:23:54 +0000950esac
951
bellard7d3505c2004-05-12 19:32:15 +0000952if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000953 if [ "$darwin" != "yes" ] ; then
Andreas Färber08de3942012-04-26 11:57:39 +0200954 bsd_user="yes"
bellard83fb7ad2004-07-05 21:25:26 +0000955 fi
bellard7d3505c2004-05-12 19:32:15 +0000956fi
957
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100958: ${make=${MAKE-make}}
959: ${install=${INSTALL-install}}
Daniel P. Berrangéfaf44142019-03-27 17:07:01 +0000960# We prefer python 3.x. A bare 'python' is traditionally
961# python 2.x, but some distros have it as python 3.x, so
Eduardo Habkostddf90692019-10-16 19:42:37 -0300962# we check that too
Daniel P. Berrangéfaf44142019-03-27 17:07:01 +0000963python=
Eduardo Habkostddf90692019-10-16 19:42:37 -0300964for binary in "${PYTHON-python3}" python
Daniel P. Berrangéfaf44142019-03-27 17:07:01 +0000965do
966 if has "$binary"
967 then
Paolo Bonzini95c5f2d2019-06-10 12:03:44 +0200968 python=$(command -v "$binary")
Daniel P. Berrangéfaf44142019-03-27 17:07:01 +0000969 break
970 fi
971done
Markus Armbruster903458c2020-02-14 18:18:41 +0100972
973sphinx_build=
974for binary in sphinx-build-3 sphinx-build
975do
976 if has "$binary"
977 then
978 sphinx_build=$(command -v "$binary")
979 break
980 fi
981done
982
Alex Bennée39d87c82020-03-03 15:06:20 +0000983# Check for ancillary tools used in testing
984genisoimage=
Alex Bennée3df437c2020-05-19 09:22:48 -0400985for binary in genisoimage mkisofs
Alex Bennée39d87c82020-03-03 15:06:20 +0000986do
987 if has $binary
988 then
989 genisoimage=$(command -v "$binary")
990 break
991 fi
992done
993
Brade2d88302011-09-02 16:53:28 -0400994: ${smbd=${SMBD-/usr/sbin/smbd}}
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100995
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100996# Default objcc to clang if available, otherwise use CC
997if has clang; then
998 objcc=clang
999else
1000 objcc="$cc"
1001fi
1002
Juan Quintela3457a3f2009-08-03 14:46:07 +02001003if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +02001004 EXESUF=".exe"
Fam Zheng17969262014-02-10 14:48:56 +08001005 DSOSUF=".dll"
Stefan Weil78e9d4a2015-11-26 12:13:12 +01001006 # MinGW needs -mthreads for TLS and macro _MT.
Paolo Bonzini086d5f72020-02-03 15:22:17 +01001007 CFLAGS="-mthreads $CFLAGS"
Paolo Bonzinib965e8c2019-12-11 14:41:51 +01001008 LIBS="-lwinmm -lws2_32 $LIBS"
John Snow93b25862015-03-25 18:57:37 -04001009 write_c_skeleton;
Stefan Weilf7cf5d52012-03-10 11:14:32 +01001010 if compile_prog "" "-liberty" ; then
1011 LIBS="-liberty $LIBS"
1012 fi
Stefan Weilc5ec15e2012-04-07 09:23:38 +02001013 prefix="c:/Program Files/QEMU"
Paolo Bonzini683035d2010-05-26 16:08:28 +02001014 confsuffix=""
Bishara AbuHattoum105fad62017-08-22 16:55:04 +03001015 libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga"
Juan Quintela3457a3f2009-08-03 14:46:07 +02001016fi
1017
Anthony Liguori487fefd2009-06-11 13:28:25 -05001018werror=""
bellard85aa5182007-11-11 20:17:03 +00001019
bellard7d132992003-03-06 23:23:54 +00001020for opt do
Stefan Weil89138852016-05-16 15:10:20 +02001021 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
bellard7d132992003-03-06 23:23:54 +00001022 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +00001023 --help|-h) show_help=yes
1024 ;;
Mike Frysinger99123e12011-04-07 01:12:28 -04001025 --version|-V) exec cat $source_path/VERSION
1026 ;;
pbrookb1a550a2006-04-16 13:28:56 +00001027 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +00001028 ;;
pbrookb1a550a2006-04-16 13:28:56 +00001029 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +00001030 ;;
aliguoriac0df512008-12-29 17:14:15 +00001031 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +00001032 ;;
aliguoriac0df512008-12-29 17:14:15 +00001033 --cc=*)
bellard7d132992003-03-06 23:23:54 +00001034 ;;
pbrookb1a550a2006-04-16 13:28:56 +00001035 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +00001036 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04001037 --cxx=*)
1038 ;;
Michael S. Tsirkine007dbe2013-11-24 11:38:05 +02001039 --iasl=*) iasl="$optarg"
1040 ;;
Peter Maydell3c4a4d02012-08-11 22:34:40 +01001041 --objcc=*) objcc="$optarg"
1042 ;;
pbrookb1a550a2006-04-16 13:28:56 +00001043 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +00001044 ;;
pbrook6a882642006-04-17 13:57:12 +00001045 --install=*) install="$optarg"
1046 ;;
Blue Swirlc886edf2011-07-22 21:08:09 +00001047 --python=*) python="$optarg"
1048 ;;
Peter Maydell2eb054c2020-02-13 17:56:18 +00001049 --sphinx-build=*) sphinx_build="$optarg"
1050 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +00001051 --gcov=*) gcov_tool="$optarg"
1052 ;;
Brade2d88302011-09-02 16:53:28 -04001053 --smbd=*) smbd="$optarg"
1054 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +02001055 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +00001056 ;;
Bruno Dominguez11cde1c2017-06-06 14:07:47 +01001057 --extra-cxxflags=*)
1058 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +02001059 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +00001060 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +01001061 --enable-debug-info)
1062 ;;
1063 --disable-debug-info)
1064 ;;
Alex Bennéed75402b2018-04-04 20:27:05 +01001065 --cross-cc-*)
1066 ;;
Fam Zheng17969262014-02-10 14:48:56 +08001067 --enable-modules)
1068 modules="yes"
1069 ;;
Stefan Hajnoczi3aa88b32015-11-02 14:06:23 +00001070 --disable-modules)
1071 modules="no"
1072 ;;
Christian Ehrhardtbd83c862020-03-10 15:58:06 +01001073 --disable-module-upgrades) module_upgrades="no"
1074 ;;
1075 --enable-module-upgrades) module_upgrades="yes"
1076 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +02001077 --cpu=*)
bellard7d132992003-03-06 23:23:54 +00001078 ;;
pbrookb1a550a2006-04-16 13:28:56 +00001079 --target-list=*) target_list="$optarg"
Alex Bennée447e1332019-03-19 11:59:12 +00001080 if test "$target_list_exclude"; then
1081 error_exit "Can't mix --target-list with --target-list-exclude"
1082 fi
1083 ;;
1084 --target-list-exclude=*) target_list_exclude="$optarg"
1085 if test "$target_list"; then
1086 error_exit "Can't mix --target-list-exclude with --target-list"
1087 fi
bellardde83cd02003-06-15 20:25:43 +00001088 ;;
Lluís Vilanova5b808272014-05-27 15:02:14 +02001089 --enable-trace-backends=*) trace_backends="$optarg"
1090 ;;
1091 # XXX: backwards compatibility
1092 --enable-trace-backend=*) trace_backends="$optarg"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01001093 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +01001094 --with-trace-file=*) trace_file="$optarg"
Prerna Saxena9410b562010-07-13 09:26:32 +01001095 ;;
Paolo Bonzinif3494742019-01-23 14:56:17 +08001096 --with-default-devices) default_devices="yes"
1097 ;;
1098 --without-default-devices) default_devices="no"
1099 ;;
bellard7d132992003-03-06 23:23:54 +00001100 --enable-gprof) gprof="yes"
1101 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +00001102 --enable-gcov) gcov="yes"
1103 ;;
Loïc Minier79427692010-01-31 12:23:45 +01001104 --static)
1105 static="yes"
Sergei Trofimovich17884d72012-01-31 22:03:45 +03001106 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001107 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +02001108 --mandir=*) mandir="$optarg"
1109 ;;
1110 --bindir=*) bindir="$optarg"
1111 ;;
Alon Levy3aa5d2b2011-05-15 12:08:59 +03001112 --libdir=*) libdir="$optarg"
1113 ;;
Michael Tokarev8bf188a2012-06-07 01:11:00 +04001114 --libexecdir=*) libexecdir="$optarg"
1115 ;;
Alon Levy0f94d6d2011-06-27 11:58:20 +02001116 --includedir=*) includedir="$optarg"
1117 ;;
Eduardo Habkost528ae5b2012-04-18 16:55:49 -03001118 --datadir=*) datadir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +02001119 ;;
Eduardo Habkost023d3d62012-04-18 16:55:50 -03001120 --with-confsuffix=*) confsuffix="$optarg"
1121 ;;
Eduardo Habkost850da182012-04-18 16:55:38 -03001122 --docdir=*) qemu_docdir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +02001123 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +01001124 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -06001125 ;;
Luiz Capitulino785c23a2012-10-03 18:35:57 -03001126 --localstatedir=*) local_statedir="$optarg"
1127 ;;
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +02001128 --firmwarepath=*) firmwarepath="$optarg"
1129 ;;
Olaf Hering181ce1d2018-04-18 09:50:44 +02001130 --host=*|--build=*|\
1131 --disable-dependency-tracking|\
Luiz Capitulino785c23a2012-10-03 18:35:57 -03001132 --sbindir=*|--sharedstatedir=*|\
Max Filippov023ddd72011-11-24 16:11:31 +04001133 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
1134 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
1135 # These switches are silently ignored, for compatibility with
1136 # autoconf-generated configure scripts. This allows QEMU's
1137 # configure to be used by RPM and similar macros that set
1138 # lots of directory switches by default.
1139 ;;
bellard97a847b2003-08-10 21:36:04 +00001140 --disable-sdl) sdl="no"
1141 ;;
Juan Quintelac4198152009-08-12 18:29:53 +02001142 --enable-sdl) sdl="yes"
1143 ;;
Daniel P. Berrangéa442fe22019-01-10 12:00:47 +00001144 --disable-sdl-image) sdl_image="no"
1145 ;;
1146 --enable-sdl-image) sdl_image="yes"
1147 ;;
Paolo Bonzini3556c232013-05-10 14:16:40 +02001148 --disable-qom-cast-debug) qom_cast_debug="no"
1149 ;;
1150 --enable-qom-cast-debug) qom_cast_debug="yes"
1151 ;;
Meador Inge983eef52012-02-24 14:00:42 +05301152 --disable-virtfs) virtfs="no"
1153 ;;
1154 --enable-virtfs) virtfs="yes"
1155 ;;
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02001156 --disable-mpath) mpath="no"
1157 ;;
1158 --enable-mpath) mpath="yes"
1159 ;;
Jes Sorensen821601e2011-03-16 13:33:36 +01001160 --disable-vnc) vnc="no"
1161 ;;
1162 --enable-vnc) vnc="yes"
1163 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +00001164 --oss-lib=*) oss_lib="$optarg"
1165 ;;
malc0c58ac12008-06-25 21:04:05 +00001166 --audio-drv-list=*) audio_drv_list="$optarg"
1167 ;;
Stefan Weil89138852016-05-16 15:10:20 +02001168 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
Fam Zhengb64ec4e2013-05-29 19:35:40 +08001169 ;;
Stefan Weil89138852016-05-16 15:10:20 +02001170 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
Markus Armbrustereb852012009-10-27 18:41:44 +01001171 ;;
aurel32f8393942009-04-13 18:45:38 +00001172 --enable-debug-tcg) debug_tcg="yes"
1173 ;;
1174 --disable-debug-tcg) debug_tcg="no"
1175 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +01001176 --enable-debug)
1177 # Enable debugging options that aren't excessively noisy
1178 debug_tcg="yes"
Peter Xu1fcc6d42018-04-25 10:54:59 +08001179 debug_mutex="yes"
Paul Brookf3d08ee2009-06-04 11:39:04 +01001180 debug="yes"
1181 strip_opt="no"
John Snowb553a042015-11-03 15:43:42 -05001182 fortify_source="no"
Paul Brookf3d08ee2009-06-04 11:39:04 +01001183 ;;
Marc-André Lureau247724c2018-01-16 16:11:51 +01001184 --enable-sanitizers) sanitizers="yes"
1185 ;;
1186 --disable-sanitizers) sanitizers="no"
1187 ;;
Lingfeng Yang0aebab02020-06-12 20:02:23 +01001188 --enable-tsan) tsan="yes"
1189 ;;
1190 --disable-tsan) tsan="no"
1191 ;;
aliguori03b4fe72008-10-07 19:16:17 +00001192 --enable-sparse) sparse="yes"
1193 ;;
1194 --disable-sparse) sparse="no"
1195 ;;
aliguori1625af82009-04-05 17:41:02 +00001196 --disable-strip) strip_opt="no"
1197 ;;
aliguori2f9606b2009-03-06 20:27:28 +00001198 --disable-vnc-sasl) vnc_sasl="no"
1199 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +02001200 --enable-vnc-sasl) vnc_sasl="yes"
1201 ;;
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001202 --disable-vnc-jpeg) vnc_jpeg="no"
1203 ;;
1204 --enable-vnc-jpeg) vnc_jpeg="yes"
1205 ;;
Corentin Charyefe556a2010-07-07 20:57:56 +02001206 --disable-vnc-png) vnc_png="no"
1207 ;;
1208 --enable-vnc-png) vnc_png="yes"
1209 ;;
bellard443f1372004-06-04 11:13:20 +00001210 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +00001211 ;;
Marc-André Lureau7c57bdd82019-04-24 13:00:41 +02001212 --enable-slirp=git) slirp="git"
1213 ;;
Marc-André Lureau675b9b52019-02-12 17:25:23 +01001214 --enable-slirp=system) slirp="system"
1215 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +00001216 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +00001217 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +02001218 --enable-vde) vde="yes"
1219 ;;
Vincenzo Maffione58952132013-11-06 11:44:06 +01001220 --disable-netmap) netmap="no"
1221 ;;
1222 --enable-netmap) netmap="yes"
1223 ;;
aliguorie37630c2009-04-22 15:19:10 +00001224 --disable-xen) xen="no"
1225 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +02001226 --enable-xen) xen="yes"
1227 ;;
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001228 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
1229 ;;
1230 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
1231 ;;
aurel322e4d9fb2008-04-08 06:01:02 +00001232 --disable-brlapi) brlapi="no"
1233 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001234 --enable-brlapi) brlapi="yes"
1235 ;;
aliguori7ba1e612008-11-05 16:04:33 +00001236 --disable-kvm) kvm="no"
1237 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +02001238 --enable-kvm) kvm="yes"
1239 ;;
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01001240 --disable-hax) hax="no"
zhanghailiang180fb752016-10-27 14:43:08 +08001241 ;;
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01001242 --enable-hax) hax="yes"
zhanghailiang180fb752016-10-27 14:43:08 +08001243 ;;
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05001244 --disable-hvf) hvf="no"
1245 ;;
1246 --enable-hvf) hvf="yes"
1247 ;;
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08001248 --disable-whpx) whpx="no"
1249 ;;
1250 --enable-whpx) whpx="yes"
1251 ;;
Stefan Weil9195b2c2011-10-19 07:07:18 +02001252 --disable-tcg-interpreter) tcg_interpreter="no"
1253 ;;
1254 --enable-tcg-interpreter) tcg_interpreter="yes"
1255 ;;
Corey Bryant47e98652012-01-26 09:42:26 -05001256 --disable-cap-ng) cap_ng="no"
1257 ;;
1258 --enable-cap-ng) cap_ng="yes"
1259 ;;
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +02001260 --disable-tcg) tcg="no"
1261 ;;
1262 --enable-tcg) tcg="yes"
1263 ;;
Yang Zhong5a22ab72017-12-20 21:16:46 +08001264 --disable-malloc-trim) malloc_trim="no"
1265 ;;
1266 --enable-malloc-trim) malloc_trim="yes"
1267 ;;
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01001268 --disable-spice) spice="no"
1269 ;;
1270 --enable-spice) spice="yes"
1271 ;;
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11001272 --disable-libiscsi) libiscsi="no"
1273 ;;
1274 --enable-libiscsi) libiscsi="yes"
1275 ;;
Peter Lieven6542aa92014-02-03 10:26:13 +01001276 --disable-libnfs) libnfs="no"
1277 ;;
1278 --enable-libnfs) libnfs="yes"
1279 ;;
bellard05c2a3e2006-02-08 22:39:17 +00001280 --enable-profiler) profiler="yes"
1281 ;;
Pavel Borzenkov14821032011-11-10 22:40:07 +04001282 --disable-cocoa) cocoa="no"
1283 ;;
malcc2de5c92008-06-28 19:13:06 +00001284 --enable-cocoa)
1285 cocoa="yes" ;
Stefan Weil89138852016-05-16 15:10:20 +02001286 audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
bellard1d14ffa2005-10-30 18:58:22 +00001287 ;;
pbrookcad25d62006-03-19 16:31:11 +00001288 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +00001289 ;;
pbrookcad25d62006-03-19 16:31:11 +00001290 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +00001291 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -10001292 --disable-user)
1293 linux_user="no" ;
1294 bsd_user="no" ;
Zachary Amsden0953a802009-07-30 00:14:59 -10001295 ;;
1296 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +00001297 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +00001298 ;;
ths831b7822007-01-18 20:06:33 +00001299 --enable-linux-user) linux_user="yes"
1300 ;;
blueswir184778502008-10-26 20:33:16 +00001301 --disable-bsd-user) bsd_user="no"
1302 ;;
1303 --enable-bsd-user) bsd_user="yes"
1304 ;;
Avi Kivity40d64442011-11-15 20:12:17 +02001305 --enable-pie) pie="yes"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03001306 ;;
Avi Kivity40d64442011-11-15 20:12:17 +02001307 --disable-pie) pie="no"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03001308 ;;
bellard85aa5182007-11-11 20:17:03 +00001309 --enable-werror) werror="yes"
1310 ;;
1311 --disable-werror) werror="no"
1312 ;;
Steven Noonan63678e12014-03-28 17:19:02 +01001313 --enable-stack-protector) stack_protector="yes"
1314 ;;
1315 --disable-stack-protector) stack_protector="no"
1316 ;;
Daniele Buono1e4f6062020-05-29 16:51:21 -04001317 --enable-safe-stack) safe_stack="yes"
1318 ;;
1319 --disable-safe-stack) safe_stack="no"
1320 ;;
balrog4d3b6f62008-02-10 16:33:14 +00001321 --disable-curses) curses="no"
1322 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +02001323 --enable-curses) curses="yes"
1324 ;;
Samuel Thibaulte08bb302019-03-11 14:51:26 +01001325 --disable-iconv) iconv="no"
1326 ;;
1327 --enable-iconv) iconv="yes"
1328 ;;
Alexander Graf769ce762009-05-11 17:41:42 +02001329 --disable-curl) curl="no"
1330 ;;
Juan Quintela788c8192009-08-12 18:29:47 +02001331 --enable-curl) curl="yes"
1332 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +02001333 --disable-fdt) fdt="no"
1334 ;;
1335 --enable-fdt) fdt="yes"
1336 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001337 --disable-linux-aio) linux_aio="no"
1338 ;;
1339 --enable-linux-aio) linux_aio="yes"
1340 ;;
Aarushi Mehtac10dd852020-01-20 14:18:44 +00001341 --disable-linux-io-uring) linux_io_uring="no"
1342 ;;
1343 --enable-linux-io-uring) linux_io_uring="yes"
1344 ;;
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07001345 --disable-attr) attr="no"
1346 ;;
1347 --enable-attr) attr="yes"
1348 ;;
Paolo Bonzinia40161c2018-02-16 10:05:23 +01001349 --disable-membarrier) membarrier="no"
1350 ;;
1351 --enable-membarrier) membarrier="yes"
1352 ;;
ths77755342008-11-27 15:45:16 +00001353 --disable-blobs) blobs="no"
1354 ;;
Thomas Huth7e563bf2018-02-15 12:06:47 +01001355 --with-pkgversion=*) pkgversion="$optarg"
pbrook4a19f1e2009-04-07 23:17:49 +00001356 ;;
Alex Barcelo519175a2012-02-28 12:25:50 +01001357 --with-coroutine=*) coroutine="$optarg"
1358 ;;
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02001359 --disable-coroutine-pool) coroutine_pool="no"
1360 ;;
1361 --enable-coroutine-pool) coroutine_pool="yes"
1362 ;;
Peter Lieven7d992e42016-09-27 11:58:45 +02001363 --enable-debug-stack-usage) debug_stack_usage="yes"
1364 ;;
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04001365 --enable-crypto-afalg) crypto_afalg="yes"
1366 ;;
1367 --disable-crypto-afalg) crypto_afalg="no"
1368 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +02001369 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -05001370 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +02001371 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +02001372 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +02001373 --disable-vhost-net) vhost_net="no"
1374 ;;
1375 --enable-vhost-net) vhost_net="yes"
1376 ;;
Gonglei042cea22018-03-01 21:46:28 +08001377 --disable-vhost-crypto) vhost_crypto="no"
1378 ;;
Paolo Bonzini299e6f12019-02-14 18:35:53 +01001379 --enable-vhost-crypto) vhost_crypto="yes"
Gonglei042cea22018-03-01 21:46:28 +08001380 ;;
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00001381 --disable-vhost-scsi) vhost_scsi="no"
1382 ;;
1383 --enable-vhost-scsi) vhost_scsi="yes"
1384 ;;
Stefan Hajnoczifc0b9b02016-08-16 13:27:22 +01001385 --disable-vhost-vsock) vhost_vsock="no"
1386 ;;
1387 --enable-vhost-vsock) vhost_vsock="yes"
1388 ;;
Dr. David Alan Gilbert98fc1ad2019-09-30 11:51:34 +01001389 --disable-vhost-user-fs) vhost_user_fs="no"
1390 ;;
1391 --enable-vhost-user-fs) vhost_user_fs="yes"
1392 ;;
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01001393 --disable-opengl) opengl="no"
Michael Walle20ff0752011-03-07 23:32:39 +01001394 ;;
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01001395 --enable-opengl) opengl="yes"
Michael Walle20ff0752011-03-07 23:32:39 +01001396 ;;
Christian Brunnerf27aaf42010-12-06 20:53:01 +01001397 --disable-rbd) rbd="no"
1398 ;;
1399 --enable-rbd) rbd="yes"
1400 ;;
Sergei Trofimovich8c84cf12012-01-24 20:42:40 +03001401 --disable-xfsctl) xfs="no"
1402 ;;
1403 --enable-xfsctl) xfs="yes"
1404 ;;
Marc-André Lureau7b02f542015-08-30 11:48:40 +02001405 --disable-smartcard) smartcard="no"
Robert Relyea111a38b2010-11-28 16:36:38 +02001406 ;;
Marc-André Lureau7b02f542015-08-30 11:48:40 +02001407 --enable-smartcard) smartcard="yes"
Robert Relyea111a38b2010-11-28 16:36:38 +02001408 ;;
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01001409 --disable-libusb) libusb="no"
1410 ;;
1411 --enable-libusb) libusb="yes"
1412 ;;
Hans de Goede69354a82011-07-19 11:04:10 +02001413 --disable-usb-redir) usb_redir="no"
1414 ;;
1415 --enable-usb-redir) usb_redir="yes"
1416 ;;
Alon Levy1ece9902011-07-26 12:30:40 +03001417 --disable-zlib-test) zlib="no"
1418 ;;
Stefan Weilb25c9df2014-04-29 08:21:16 +02001419 --disable-lzo) lzo="no"
1420 ;;
qiaonuohan607dacd2014-02-18 14:11:30 +08001421 --enable-lzo) lzo="yes"
1422 ;;
Stefan Weilb25c9df2014-04-29 08:21:16 +02001423 --disable-snappy) snappy="no"
1424 ;;
qiaonuohan607dacd2014-02-18 14:11:30 +08001425 --enable-snappy) snappy="yes"
1426 ;;
Peter Wu6b383c02015-01-06 18:48:14 +01001427 --disable-bzip2) bzip2="no"
1428 ;;
1429 --enable-bzip2) bzip2="yes"
1430 ;;
Julio Faracco83bc1f92018-11-05 13:08:04 -02001431 --enable-lzfse) lzfse="yes"
1432 ;;
1433 --disable-lzfse) lzfse="no"
1434 ;;
Juan Quintela3a678482019-12-17 21:15:24 +01001435 --disable-zstd) zstd="no"
1436 ;;
1437 --enable-zstd) zstd="yes"
1438 ;;
Michael Rothd138cee2011-08-01 14:52:57 -05001439 --enable-guest-agent) guest_agent="yes"
1440 ;;
1441 --disable-guest-agent) guest_agent="no"
1442 ;;
Yossi Hindin9dacf322015-05-06 14:57:40 +03001443 --enable-guest-agent-msi) guest_agent_msi="yes"
1444 ;;
1445 --disable-guest-agent-msi) guest_agent_msi="no"
1446 ;;
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04001447 --with-vss-sdk) vss_win32_sdk=""
1448 ;;
1449 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1450 ;;
1451 --without-vss-sdk) vss_win32_sdk="no"
1452 ;;
1453 --with-win-sdk) win_sdk=""
1454 ;;
1455 --with-win-sdk=*) win_sdk="$optarg"
1456 ;;
1457 --without-win-sdk) win_sdk="no"
1458 ;;
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01001459 --enable-tools) want_tools="yes"
1460 ;;
1461 --disable-tools) want_tools="no"
1462 ;;
Eduardo Otubof7945732012-08-14 18:44:05 -03001463 --enable-seccomp) seccomp="yes"
1464 ;;
1465 --disable-seccomp) seccomp="no"
1466 ;;
Bharata B Raoeb100392012-09-24 14:42:45 +05301467 --disable-glusterfs) glusterfs="no"
1468 ;;
Liam Merwick86583a02018-10-19 21:38:59 +01001469 --disable-avx2) avx2_opt="no"
1470 ;;
1471 --enable-avx2) avx2_opt="yes"
1472 ;;
Robert Hoo6b8cd442020-02-29 20:34:34 +08001473 --disable-avx512f) avx512f_opt="no"
1474 ;;
1475 --enable-avx512f) avx512f_opt="yes"
1476 ;;
1477
Bharata B Raoeb100392012-09-24 14:42:45 +05301478 --enable-glusterfs) glusterfs="yes"
1479 ;;
Fam Zheng52b53c02014-09-10 14:17:51 +08001480 --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
1481 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01001482 ;;
Fam Zhengcb6414d2016-09-21 12:27:16 +08001483 --enable-vhdx|--disable-vhdx)
1484 echo "$0: $opt is obsolete, VHDX driver is always built" >&2
1485 ;;
Fam Zheng315d3182016-09-21 12:27:21 +08001486 --enable-uuid|--disable-uuid)
1487 echo "$0: $opt is obsolete, UUID support is always built" >&2
1488 ;;
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001489 --disable-gtk) gtk="no"
1490 ;;
1491 --enable-gtk) gtk="yes"
1492 ;;
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +01001493 --tls-priority=*) tls_priority="$optarg"
1494 ;;
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01001495 --disable-gnutls) gnutls="no"
1496 ;;
1497 --enable-gnutls) gnutls="yes"
1498 ;;
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01001499 --disable-nettle) nettle="no"
1500 ;;
1501 --enable-nettle) nettle="yes"
1502 ;;
1503 --disable-gcrypt) gcrypt="no"
1504 ;;
1505 --enable-gcrypt) gcrypt="yes"
1506 ;;
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01001507 --disable-auth-pam) auth_pam="no"
1508 ;;
1509 --enable-auth-pam) auth_pam="yes"
1510 ;;
Michael R. Hines2da776d2013-07-22 10:01:54 -04001511 --enable-rdma) rdma="yes"
1512 ;;
1513 --disable-rdma) rdma="no"
1514 ;;
Marcel Apfelbaum21ab34c2018-08-16 18:16:37 +03001515 --enable-pvrdma) pvrdma="yes"
1516 ;;
1517 --disable-pvrdma) pvrdma="no"
1518 ;;
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01001519 --disable-vte) vte="no"
1520 ;;
1521 --enable-vte) vte="yes"
1522 ;;
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +02001523 --disable-virglrenderer) virglrenderer="no"
1524 ;;
1525 --enable-virglrenderer) virglrenderer="yes"
1526 ;;
Cole Robinsone91c7932014-06-16 15:32:47 -04001527 --disable-tpm) tpm="no"
1528 ;;
Stefan Bergerab214c22013-02-27 12:47:52 -05001529 --enable-tpm) tpm="yes"
1530 ;;
Pino Toscanob10d49d2019-06-20 22:08:40 +02001531 --disable-libssh) libssh="no"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01001532 ;;
Pino Toscanob10d49d2019-06-20 22:08:40 +02001533 --enable-libssh) libssh="yes"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01001534 ;;
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +01001535 --disable-live-block-migration) live_block_migration="no"
1536 ;;
1537 --enable-live-block-migration) live_block_migration="yes"
1538 ;;
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08001539 --disable-numa) numa="no"
1540 ;;
1541 --enable-numa) numa="yes"
1542 ;;
Klim Kireeved279a02018-01-12 12:01:19 +03001543 --disable-libxml2) libxml2="no"
1544 ;;
1545 --enable-libxml2) libxml2="yes"
1546 ;;
Fam Zheng2847b462015-03-26 11:03:12 +08001547 --disable-tcmalloc) tcmalloc="no"
1548 ;;
1549 --enable-tcmalloc) tcmalloc="yes"
1550 ;;
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02001551 --disable-jemalloc) jemalloc="no"
1552 ;;
1553 --enable-jemalloc) jemalloc="yes"
1554 ;;
Changlong Xiea6b1d4c2016-07-27 15:01:48 +08001555 --disable-replication) replication="no"
1556 ;;
1557 --enable-replication) replication="yes"
1558 ;;
Jeff Cody2f740132018-11-07 07:36:44 +01001559 --disable-bochs) bochs="no"
1560 ;;
1561 --enable-bochs) bochs="yes"
1562 ;;
1563 --disable-cloop) cloop="no"
1564 ;;
1565 --enable-cloop) cloop="yes"
1566 ;;
1567 --disable-dmg) dmg="no"
1568 ;;
1569 --enable-dmg) dmg="yes"
1570 ;;
1571 --disable-qcow1) qcow1="no"
1572 ;;
1573 --enable-qcow1) qcow1="yes"
1574 ;;
1575 --disable-vdi) vdi="no"
1576 ;;
1577 --enable-vdi) vdi="yes"
1578 ;;
1579 --disable-vvfat) vvfat="no"
1580 ;;
1581 --enable-vvfat) vvfat="yes"
1582 ;;
1583 --disable-qed) qed="no"
1584 ;;
1585 --enable-qed) qed="yes"
1586 ;;
1587 --disable-parallels) parallels="no"
1588 ;;
1589 --enable-parallels) parallels="yes"
1590 ;;
1591 --disable-sheepdog) sheepdog="no"
1592 ;;
1593 --enable-sheepdog) sheepdog="yes"
1594 ;;
Marc-André Lureaue6a74862017-08-03 11:07:46 +02001595 --disable-vhost-user) vhost_user="no"
1596 ;;
Paolo Bonzini299e6f12019-02-14 18:35:53 +01001597 --enable-vhost-user) vhost_user="yes"
1598 ;;
Cindy Lu108a6482020-07-01 22:55:37 +08001599 --disable-vhost-vdpa) vhost_vdpa="no"
1600 ;;
1601 --enable-vhost-vdpa) vhost_vdpa="yes"
1602 ;;
Paolo Bonzini299e6f12019-02-14 18:35:53 +01001603 --disable-vhost-kernel) vhost_kernel="no"
1604 ;;
1605 --enable-vhost-kernel) vhost_kernel="yes"
Marc-André Lureaue6a74862017-08-03 11:07:46 +02001606 ;;
Richard Henderson8ca80762017-09-14 09:41:12 -07001607 --disable-capstone) capstone="no"
1608 ;;
1609 --enable-capstone) capstone="yes"
1610 ;;
Richard Hendersone219c492017-09-28 09:01:23 -07001611 --enable-capstone=git) capstone="git"
1612 ;;
1613 --enable-capstone=system) capstone="system"
1614 ;;
Daniel P. Berrangecc84d632017-10-20 15:02:43 +01001615 --with-git=*) git="$optarg"
1616 ;;
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +01001617 --enable-git-update) git_update=yes
1618 ;;
1619 --disable-git-update) git_update=no
1620 ;;
Paolo Bonziniba59fb72018-06-13 14:23:08 +02001621 --enable-debug-mutex) debug_mutex=yes
1622 ;;
1623 --disable-debug-mutex) debug_mutex=no
1624 ;;
Junyan He17824402018-07-18 15:47:59 +08001625 --enable-libpmem) libpmem=yes
1626 ;;
1627 --disable-libpmem) libpmem=no
1628 ;;
James Le Cuirot75411912019-09-14 15:51:55 +01001629 --enable-xkbcommon) xkbcommon=yes
1630 ;;
1631 --disable-xkbcommon) xkbcommon=no
1632 ;;
Alex Bennée40e8c6f2019-06-13 14:52:25 +01001633 --enable-plugins) plugins="yes"
1634 ;;
1635 --disable-plugins) plugins="no"
1636 ;;
Alex Bennéeafc3a8f2019-11-28 16:35:24 +01001637 --enable-containers) use_containers="yes"
1638 ;;
1639 --disable-containers) use_containers="no"
1640 ;;
Alexander Bulekovadc28022020-02-19 23:11:14 -05001641 --enable-fuzzing) fuzzing=yes
1642 ;;
1643 --disable-fuzzing) fuzzing=no
1644 ;;
Alex Bennéef48e5902020-03-16 17:21:48 +00001645 --gdb=*) gdb_bin="$optarg"
1646 ;;
Marek Marczykowski-Góreckib767d252020-05-20 15:20:23 +02001647 --enable-rng-none) rng_none=yes
1648 ;;
1649 --disable-rng-none) rng_none=no
1650 ;;
Alexey Krasikov54e7aac2020-05-25 14:19:12 +03001651 --enable-keyring) secret_keyring="yes"
1652 ;;
1653 --disable-keyring) secret_keyring="no"
1654 ;;
Jingqi Liu21b2eca2020-04-29 16:50:11 +08001655 --enable-libdaxctl) libdaxctl=yes
1656 ;;
1657 --disable-libdaxctl) libdaxctl=no
1658 ;;
Fam Zheng2d2ad6d2014-04-18 14:55:36 +08001659 *)
1660 echo "ERROR: unknown option $opt"
1661 echo "Try '$0 --help' for more information"
1662 exit 1
balrog7f1559c2007-11-17 10:24:32 +00001663 ;;
bellard7d132992003-03-06 23:23:54 +00001664 esac
1665done
1666
Marc-André Lureau22a87802019-07-11 19:13:39 +04001667libdir="${libdir:-$prefix/lib}"
1668libexecdir="${libexecdir:-$prefix/libexec}"
1669includedir="${includedir:-$prefix/include}"
1670
1671if test "$mingw32" = "yes" ; then
1672 mandir="$prefix"
1673 datadir="$prefix"
1674 qemu_docdir="$prefix"
1675 bindir="$prefix"
1676 sysconfdir="$prefix"
1677 local_statedir=
1678else
1679 mandir="${mandir:-$prefix/share/man}"
1680 datadir="${datadir:-$prefix/share}"
1681 qemu_docdir="${qemu_docdir:-$prefix/share/doc/qemu}"
1682 bindir="${bindir:-$prefix/bin}"
1683 sysconfdir="${sysconfdir:-$prefix/etc}"
1684 local_statedir="${local_statedir:-$prefix/var}"
1685fi
1686
bellard40293e52008-01-31 11:32:10 +00001687case "$cpu" in
Richard Hendersone3608d62013-08-28 15:48:21 -07001688 ppc)
1689 CPU_CFLAGS="-m32"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01001690 QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS"
Richard Hendersone3608d62013-08-28 15:48:21 -07001691 ;;
1692 ppc64)
1693 CPU_CFLAGS="-m64"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01001694 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS"
Richard Hendersone3608d62013-08-28 15:48:21 -07001695 ;;
Richard Henderson9b9c37c2012-09-21 10:34:21 -07001696 sparc)
Richard Hendersonf1079bb2017-04-26 10:39:08 -07001697 CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01001698 QEMU_LDFLAGS="-m32 -mv8plus $QEMU_LDFLAGS"
blueswir131422552007-04-16 18:27:06 +00001699 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +02001700 sparc64)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001701 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01001702 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS"
blueswir131422552007-04-16 18:27:06 +00001703 ;;
ths76d83bd2007-11-18 21:22:10 +00001704 s390)
Richard Henderson061cdd82014-03-31 13:40:49 -04001705 CPU_CFLAGS="-m31"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01001706 QEMU_LDFLAGS="-m31 $QEMU_LDFLAGS"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001707 ;;
1708 s390x)
Richard Henderson061cdd82014-03-31 13:40:49 -04001709 CPU_CFLAGS="-m64"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01001710 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS"
ths76d83bd2007-11-18 21:22:10 +00001711 ;;
bellard40293e52008-01-31 11:32:10 +00001712 i386)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001713 CPU_CFLAGS="-m32"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01001714 QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS"
bellard40293e52008-01-31 11:32:10 +00001715 ;;
1716 x86_64)
Richard Henderson7ebee432016-06-29 21:10:59 -07001717 # ??? Only extremely old AMD cpus do not have cmpxchg16b.
1718 # If we truly care, we should simply detect this case at
1719 # runtime and generate the fallback to serial emulation.
1720 CPU_CFLAGS="-m64 -mcx16"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01001721 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS"
Paul Brook379f6692009-07-17 12:48:08 +01001722 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001723 x32)
1724 CPU_CFLAGS="-mx32"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01001725 QEMU_LDFLAGS="-mx32 $QEMU_LDFLAGS"
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001726 ;;
Peter Maydell30163d82012-10-09 03:16:49 +00001727 # No special flags required for other host CPUs
blueswir131422552007-04-16 18:27:06 +00001728esac
1729
Paolo Bonzini2038f8c2019-08-07 16:35:23 +02001730eval "cross_cc_${cpu}=\$host_cc"
1731cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001732QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001733
Peter Maydellaffc88c2016-06-13 11:32:24 +01001734# For user-mode emulation the host arch has to be one we explicitly
1735# support, even if we're using TCI.
1736if [ "$ARCH" = "unknown" ]; then
1737 bsd_user="no"
1738 linux_user="no"
1739fi
1740
Philippe Mathieu-Daudé1cf295b2020-05-22 19:24:59 +02001741if [ "$bsd_user" = "no" -a "$linux_user" = "no" -a "$softmmu" = "no" ] ; then
1742 tcg="no"
1743fi
1744
Peter Maydell60e0df22011-05-03 14:50:13 +01001745default_target_list=""
1746
Peter Maydell6e92f822013-05-20 16:16:15 +01001747mak_wilds=""
1748
1749if [ "$softmmu" = "yes" ]; then
1750 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001751fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001752if [ "$linux_user" = "yes" ]; then
1753 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001754fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001755if [ "$bsd_user" = "yes" ]; then
1756 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001757fi
1758
Alex Bennée447e1332019-03-19 11:59:12 +00001759if test -z "$target_list_exclude"; then
1760 for config in $mak_wilds; do
1761 default_target_list="${default_target_list} $(basename "$config" .mak)"
1762 done
1763else
1764 exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
1765 for config in $mak_wilds; do
1766 target="$(basename "$config" .mak)"
1767 exclude="no"
1768 for excl in $exclude_list; do
1769 if test "$excl" = "$target"; then
1770 exclude="yes"
1771 break;
1772 fi
1773 done
1774 if test "$exclude" = "no"; then
1775 default_target_list="${default_target_list} $target"
1776 fi
1777 done
1778fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001779
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01001780# Enumerate public trace backends for --help output
Greg Kurz64a60472017-04-26 15:36:07 +02001781trace_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 +01001782
pbrookaf5db582006-04-08 14:26:41 +00001783if test x"$show_help" = x"yes" ; then
1784cat << EOF
1785
1786Usage: configure [options]
1787Options: [defaults in brackets after descriptions]
1788
Stefan Weil08fb77e2013-12-18 22:09:39 +01001789Standard options:
1790 --help print this message
1791 --prefix=PREFIX install in PREFIX [$prefix]
1792 --interp-prefix=PREFIX where to find shared libraries, etc.
1793 use %M for cpu name [$interp_prefix]
1794 --target-list=LIST set target list (default: build everything)
1795$(echo Available targets: $default_target_list | \
1796 fold -s -w 53 | sed -e 's/^/ /')
Alex Bennée447e1332019-03-19 11:59:12 +00001797 --target-list-exclude=LIST exclude a set of targets from the default target-list
Stefan Weil08fb77e2013-12-18 22:09:39 +01001798
1799Advanced options (experts only):
Stefan Weil08fb77e2013-12-18 22:09:39 +01001800 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1801 --cc=CC use C compiler CC [$cc]
1802 --iasl=IASL use ACPI compiler IASL [$iasl]
1803 --host-cc=CC use C compiler CC [$host_cc] for code run at
1804 build time
1805 --cxx=CXX use C++ compiler CXX [$cxx]
1806 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1807 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
Bruno Dominguez11cde1c2017-06-06 14:07:47 +01001808 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS
Stefan Weil08fb77e2013-12-18 22:09:39 +01001809 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
Alex Bennéed75402b2018-04-04 20:27:05 +01001810 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases
Alex Bennéed422b2b2018-04-13 11:07:58 +01001811 --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests
Stefan Weil08fb77e2013-12-18 22:09:39 +01001812 --make=MAKE use specified make [$make]
1813 --install=INSTALL use specified install [$install]
1814 --python=PYTHON use specified python [$python]
Peter Maydell2eb054c2020-02-13 17:56:18 +00001815 --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build]
Stefan Weil08fb77e2013-12-18 22:09:39 +01001816 --smbd=SMBD use specified smbd [$smbd]
Thomas Huthdb1b5f12018-03-27 17:09:30 +02001817 --with-git=GIT use specified git [$git]
Stefan Weil08fb77e2013-12-18 22:09:39 +01001818 --static enable static build [$static]
1819 --mandir=PATH install man pages in PATH
1820 --datadir=PATH install firmware in PATH$confsuffix
1821 --docdir=PATH install documentation in PATH$confsuffix
1822 --bindir=PATH install binaries in PATH
1823 --libdir=PATH install libraries in PATH
Thomas Huthdb1b5f12018-03-27 17:09:30 +02001824 --libexecdir=PATH install helper binaries in PATH
Stefan Weil08fb77e2013-12-18 22:09:39 +01001825 --sysconfdir=PATH install config in PATH$confsuffix
1826 --localstatedir=PATH install local state in PATH (set at runtime on win32)
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +02001827 --firmwarepath=PATH search PATH for firmware files
Robert Foley13336602020-07-01 14:56:21 +01001828 --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs.
Fam Zhenge26110c2014-02-10 14:48:57 +08001829 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
Thomas Huthdb1b5f12018-03-27 17:09:30 +02001830 --with-pkgversion=VERS use specified string as sub-version of the package
Stefan Weil08fb77e2013-12-18 22:09:39 +01001831 --enable-debug enable common debug build options
Marc-André Lureau247724c2018-01-16 16:11:51 +01001832 --enable-sanitizers enable default sanitizers
Lingfeng Yang0aebab02020-06-12 20:02:23 +01001833 --enable-tsan enable thread sanitizer
Stefan Weil08fb77e2013-12-18 22:09:39 +01001834 --disable-strip disable stripping binaries
1835 --disable-werror disable compilation abort on warning
Steven Noonan63678e12014-03-28 17:19:02 +01001836 --disable-stack-protector disable compiler-provided stack protection
Stefan Weil08fb77e2013-12-18 22:09:39 +01001837 --audio-drv-list=LIST set audio drivers list:
1838 Available drivers: $audio_possible_drivers
1839 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1840 --block-drv-rw-whitelist=L
1841 set block driver read-write whitelist
1842 (affects only QEMU, not qemu-img)
1843 --block-drv-ro-whitelist=L
1844 set block driver read-only whitelist
1845 (affects only QEMU, not qemu-img)
Lluís Vilanova5b808272014-05-27 15:02:14 +02001846 --enable-trace-backends=B Set trace backend
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01001847 Available backends: $trace_backend_list
Stefan Weil08fb77e2013-12-18 22:09:39 +01001848 --with-trace-file=NAME Full PATH,NAME of file to store traces
1849 Default:trace-<pid>
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001850 --disable-slirp disable SLIRP userspace network connectivity
1851 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
Yang Zhong5a22ab72017-12-20 21:16:46 +08001852 --enable-malloc-trim enable libc malloc_trim() for memory optimization
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001853 --oss-lib path to OSS library
1854 --cpu=CPU Build for host CPU [$cpu]
Stefan Weil08fb77e2013-12-18 22:09:39 +01001855 --with-coroutine=BACKEND coroutine backend. Supported options:
Daniel P. Berrange33c53c52017-04-28 13:24:44 +01001856 ucontext, sigaltstack, windows
Stefan Weil08fb77e2013-12-18 22:09:39 +01001857 --enable-gcov enable test coverage analysis with gcov
1858 --gcov=GCOV use specified gcov [$gcov_tool]
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001859 --disable-blobs disable installing provided firmware blobs
1860 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1861 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +01001862 --tls-priority default TLS protocol/cipher priority string
Lin Mac12d66a2017-03-10 18:14:05 +08001863 --enable-gprof QEMU profiling with gprof
1864 --enable-profiler profiler support
Lin Mac12d66a2017-03-10 18:14:05 +08001865 --enable-debug-stack-usage
1866 track the maximum stack usage of stacks created by qemu_alloc_stack
Alex Bennée40e8c6f2019-06-13 14:52:25 +01001867 --enable-plugins
1868 enable plugins via shared library loading
Alex Bennéeafc3a8f2019-11-28 16:35:24 +01001869 --disable-containers don't use containers for cross-building
Alex Bennéef48e5902020-03-16 17:21:48 +00001870 --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin]
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001871
1872Optional features, enabled with --enable-FEATURE and
1873disabled with --disable-FEATURE, default is enabled if available:
1874
1875 system all system emulation targets
1876 user supported user emulation targets
1877 linux-user all linux usermode emulation targets
1878 bsd-user all BSD usermode emulation targets
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001879 docs build documentation
1880 guest-agent build the QEMU Guest Agent
1881 guest-agent-msi build guest agent Windows MSI installation package
1882 pie Position Independent Executables
Marc-André Lureau21e709a2019-07-18 16:04:13 +04001883 modules modules support (non-Windows)
Christian Ehrhardtbd83c862020-03-10 15:58:06 +01001884 module-upgrades try to load modules from alternate paths for upgrades
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001885 debug-tcg TCG debugging (default is disabled)
1886 debug-info debugging information
1887 sparse sparse checker
Daniele Buono1e4f6062020-05-29 16:51:21 -04001888 safe-stack SafeStack Stack Smash Protection. Depends on
1889 clang/llvm >= 3.7 and requires coroutine backend ucontext.
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001890
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01001891 gnutls GNUTLS cryptography support
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01001892 nettle nettle cryptography support
1893 gcrypt libgcrypt cryptography support
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01001894 auth-pam PAM access control
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001895 sdl SDL UI
Markus Armbruster04c6e162019-05-17 20:32:46 +02001896 sdl-image SDL Image support for icons
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001897 gtk gtk UI
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001898 vte vte support for the gtk UI
1899 curses curses UI
Samuel Thibaulte08bb302019-03-11 14:51:26 +01001900 iconv font glyph conversion support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001901 vnc VNC UI support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001902 vnc-sasl SASL encryption for VNC server
1903 vnc-jpeg JPEG lossy compression for VNC server
1904 vnc-png PNG compression for VNC server
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001905 cocoa Cocoa UI (Mac OS X only)
1906 virtfs VirtFS
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02001907 mpath Multipath persistent reservation passthrough
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001908 xen xen backend driver support
Anthony PERARD70c292a2018-05-04 10:17:56 +01001909 xen-pci-passthrough PCI passthrough support for Xen
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001910 brlapi BrlAPI (Braile)
1911 curl curl connectivity
Paolo Bonzinia40161c2018-02-16 10:05:23 +01001912 membarrier membarrier system call (for Linux 4.14+ or Windows)
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001913 fdt fdt device tree
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001914 kvm KVM acceleration support
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01001915 hax HAX acceleration support
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05001916 hvf Hypervisor.framework acceleration support
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08001917 whpx Windows Hypervisor Platform acceleration support
Marcel Apfelbaum21ab34c2018-08-16 18:16:37 +03001918 rdma Enable RDMA-based migration
1919 pvrdma Enable PVRDMA support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001920 vde support for vde network
1921 netmap support for netmap network
1922 linux-aio Linux AIO support
Aarushi Mehtac10dd852020-01-20 14:18:44 +00001923 linux-io-uring Linux io_uring support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001924 cap-ng libcap-ng support
1925 attr attr and xattr support
Paolo Bonzini299e6f12019-02-14 18:35:53 +01001926 vhost-net vhost-net kernel acceleration support
1927 vhost-vsock virtio sockets device support
1928 vhost-scsi vhost-scsi kernel target support
1929 vhost-crypto vhost-user-crypto backend support
1930 vhost-kernel vhost kernel backend support
1931 vhost-user vhost-user backend support
Cindy Lu108a6482020-07-01 22:55:37 +08001932 vhost-vdpa vhost-vdpa kernel backend support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001933 spice spice
1934 rbd rados block device (rbd)
1935 libiscsi iscsi support
1936 libnfs nfs support
Marc-André Lureau7b02f542015-08-30 11:48:40 +02001937 smartcard smartcard support (libcacard)
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001938 libusb libusb (for usb passthrough)
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +01001939 live-block-migration Block migration in the main migration stream
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001940 usb-redir usb network redirection support
1941 lzo support of lzo compression library
1942 snappy support of snappy compression library
1943 bzip2 support of bzip2 compression library
1944 (for reading bzip2-compressed dmg images)
Julio Faracco83bc1f92018-11-05 13:08:04 -02001945 lzfse support of lzfse compression library
1946 (for reading lzfse-compressed dmg images)
Juan Quintela3a678482019-12-17 21:15:24 +01001947 zstd support for zstd compression library
Denis Plotnikovd298ac12020-05-07 11:25:20 +03001948 (for migration compression and qcow2 cluster compression)
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001949 seccomp seccomp support
1950 coroutine-pool coroutine freelist (better performance)
1951 glusterfs GlusterFS backend
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001952 tpm TPM support
Pino Toscanob10d49d2019-06-20 22:08:40 +02001953 libssh ssh block device support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001954 numa libnuma support
Klim Kireeved279a02018-01-12 12:01:19 +03001955 libxml2 for Parallels image format
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001956 tcmalloc tcmalloc support
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02001957 jemalloc jemalloc support
Liam Merwick86583a02018-10-19 21:38:59 +01001958 avx2 AVX2 optimization support
Robert Hoo6b8cd442020-02-29 20:34:34 +08001959 avx512f AVX512F optimization support
Changlong Xiea6b1d4c2016-07-27 15:01:48 +08001960 replication replication support
Lin Mac12d66a2017-03-10 18:14:05 +08001961 opengl opengl support
1962 virglrenderer virgl rendering support
1963 xfsctl xfsctl support
1964 qom-cast-debug cast debugging support
Cleber Rosa8de73fa2019-02-07 14:36:03 -05001965 tools build qemu-io, qemu-nbd and qemu-img tools
Jeff Cody2f740132018-11-07 07:36:44 +01001966 bochs bochs image format support
1967 cloop cloop image format support
1968 dmg dmg image format support
1969 qcow1 qcow v1 image format support
1970 vdi vdi image format support
1971 vvfat vvfat image format support
1972 qed qed image format support
1973 parallels parallels image format support
1974 sheepdog sheepdog block driver support
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04001975 crypto-afalg Linux AF_ALG crypto backend driver
Richard Henderson8ca80762017-09-14 09:41:12 -07001976 capstone capstone disassembler support
Paolo Bonziniba59fb72018-06-13 14:23:08 +02001977 debug-mutex mutex debugging support
Junyan He17824402018-07-18 15:47:59 +08001978 libpmem libpmem support
James Le Cuirot75411912019-09-14 15:51:55 +01001979 xkbcommon xkbcommon support
Marek Marczykowski-Góreckib767d252020-05-20 15:20:23 +02001980 rng-none dummy RNG, avoid using /dev/(u)random and getrandom()
Jingqi Liu21b2eca2020-04-29 16:50:11 +08001981 libdaxctl libdaxctl support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001982
1983NOTE: The object files are built at the place where configure is launched
pbrookaf5db582006-04-08 14:26:41 +00001984EOF
Fam Zheng2d2ad6d2014-04-18 14:55:36 +08001985exit 0
pbrookaf5db582006-04-08 14:26:41 +00001986fi
1987
Thomas Huth9c790242019-03-11 11:20:34 +01001988# Remove old dependency files to make sure that they get properly regenerated
Thomas Huthbb768f72019-05-10 10:11:59 +02001989rm -f */config-devices.mak.d
Thomas Huth9c790242019-03-11 11:20:34 +01001990
Laurent Vivier4d6a8352020-03-10 11:33:43 +01001991# Remove syscall_nr.h to be sure they will be regenerated in the build
1992# directory, not in the source directory
Laurent Vivierbb0cdc02020-03-10 11:33:54 +01001993for arch in alpha hppa m68k xtensa sh4 microblaze arm ppc s390x sparc sparc64 \
Laurent Vivier686a0fe2020-03-10 11:33:59 +01001994 i386 x86_64 mips mips64 ; do
Laurent Vivier4d6a8352020-03-10 11:33:43 +01001995 # remove the file if it has been generated in the source directory
1996 rm -f "${source_path}/linux-user/${arch}/syscall_nr.h"
1997 # remove the dependency files
Laurent Vivier91e59982020-03-25 08:57:57 +01001998 for target in ${arch}*-linux-user ; do
1999 test -d "${target}" && find "${target}" -type f -name "*.d" \
2000 -exec grep -q "${source_path}/linux-user/${arch}/syscall_nr.h" {} \; \
2001 -print | while read file ; do rm "${file}" "${file%.d}.o" ; done
2002 done
Laurent Vivier4d6a8352020-03-10 11:33:43 +01002003done
2004
Daniel P. Berrangéfaf44142019-03-27 17:07:01 +00002005if test -z "$python"
2006then
2007 error_exit "Python not found. Use --python=/path/to/python"
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01002008fi
2009
2010# Note that if the Python conditional here evaluates True we will exit
2011# with status 1 which is a shell 'false' value.
Eduardo Habkostddf90692019-10-16 19:42:37 -03002012if ! $python -c 'import sys; sys.exit(sys.version_info < (3,5))'; then
2013 error_exit "Cannot use '$python', Python >= 3.5 is required." \
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01002014 "Use --python=/path/to/python to specify a supported Python."
2015fi
2016
Cleber Rosa755ee702018-11-09 10:07:07 -05002017# Preserve python version since some functionality is dependent on it
Cleber Rosa406ab2f2019-08-26 11:58:32 -04002018python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null)
Cleber Rosa755ee702018-11-09 10:07:07 -05002019
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01002020# Suppress writing compiled files
2021python="$python -B"
2022
Daniel Henrique Barboza9aae6e52017-11-02 07:09:06 -02002023# Check that the C compiler works. Doing this here before testing
2024# the host CPU ensures that we had a valid CC to autodetect the
2025# $cpu var (and we should bail right here if that's not the case).
2026# It also allows the help message to be printed without a CC.
2027write_c_skeleton;
2028if compile_object ; then
2029 : C compiler works ok
2030else
2031 error_exit "\"$cc\" either does not exist or does not work"
2032fi
2033if ! compile_prog ; then
2034 error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
2035fi
2036
Peter Maydell359bc952011-12-24 13:07:25 +00002037# Now we have handled --enable-tcg-interpreter and know we're not just
2038# printing the help message, bail out if the host CPU isn't supported.
2039if test "$ARCH" = "unknown"; then
2040 if test "$tcg_interpreter" = "yes" ; then
2041 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
Peter Maydell359bc952011-12-24 13:07:25 +00002042 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01002043 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
Peter Maydell359bc952011-12-24 13:07:25 +00002044 fi
2045fi
2046
Peter Maydell9c83ffd2014-02-25 18:27:49 +00002047# Consult white-list to determine whether to enable werror
2048# by default. Only enable by default for git builds
Peter Maydell9c83ffd2014-02-25 18:27:49 +00002049if test -z "$werror" ; then
Alexey Kardashevskiyfd737452019-02-28 15:35:03 +11002050 if test -e "$source_path/.git" && \
Eric Blakee633a5c2019-02-04 20:39:37 -06002051 { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then
Peter Maydell9c83ffd2014-02-25 18:27:49 +00002052 werror="yes"
2053 else
2054 werror="no"
2055 fi
2056fi
2057
Peter Maydellfb59dab2017-03-28 14:01:52 +01002058if test "$bogus_os" = "yes"; then
2059 # Now that we know that we're not printing the help and that
2060 # the compiler works (so the results of the check_defines we used
2061 # to identify the OS are reliable), if we didn't recognize the
2062 # host OS we should stop now.
Peter Maydell951fedf2017-07-13 16:15:32 +01002063 error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
Peter Maydellfb59dab2017-03-28 14:01:52 +01002064fi
2065
Thomas Huthefc6c072018-12-03 10:12:32 +01002066# Check whether the compiler matches our minimum requirements:
2067cat > $TMPC << EOF
2068#if defined(__clang_major__) && defined(__clang_minor__)
2069# ifdef __apple_build_version__
2070# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1)
2071# error You need at least XCode Clang v5.1 to compile QEMU
2072# endif
2073# else
2074# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4)
2075# error You need at least Clang v3.4 to compile QEMU
2076# endif
2077# endif
2078#elif defined(__GNUC__) && defined(__GNUC_MINOR__)
2079# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
2080# error You need at least GCC v4.8 to compile QEMU
2081# endif
2082#else
2083# error You either need GCC or Clang to compiler QEMU
2084#endif
2085int main (void) { return 0; }
2086EOF
2087if ! compile_prog "" "" ; then
2088 error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)"
2089fi
2090
Richard Henderson00849b92020-06-17 13:13:06 -07002091# Accumulate -Wfoo and -Wno-bar separately.
2092# We will list all of the enable flags first, and the disable flags second.
2093# Note that we do not add -Werror, because that would enable it for all
2094# configure tests. If a configure test failed due to -Werror this would
2095# just silently disable some features, so it's too error prone.
2096
2097warn_flags=
2098add_to warn_flags -Wold-style-declaration
2099add_to warn_flags -Wold-style-definition
2100add_to warn_flags -Wtype-limits
2101add_to warn_flags -Wformat-security
2102add_to warn_flags -Wformat-y2k
2103add_to warn_flags -Winit-self
2104add_to warn_flags -Wignored-qualifiers
2105add_to warn_flags -Wempty-body
2106add_to warn_flags -Wnested-externs
2107add_to warn_flags -Wendif-labels
2108add_to warn_flags -Wexpansion-to-defined
2109
2110nowarn_flags=
2111add_to nowarn_flags -Wno-initializer-overrides
2112add_to nowarn_flags -Wno-missing-include-dirs
2113add_to nowarn_flags -Wno-shift-negative-value
2114add_to nowarn_flags -Wno-string-plus-int
2115add_to nowarn_flags -Wno-typedef-redefinition
Richard Hendersonaabab962020-06-17 13:13:07 -07002116add_to nowarn_flags -Wno-tautological-type-limit-compare
Richard Hendersonbac8d222020-06-17 13:13:08 -07002117add_to nowarn_flags -Wno-psabi
Richard Henderson00849b92020-06-17 13:13:06 -07002118
2119gcc_flags="$warn_flags $nowarn_flags"
John Snow93b25862015-03-25 18:57:37 -04002120
2121cc_has_warning_flag() {
2122 write_c_skeleton;
2123
Peter Maydella1d29d62012-10-27 22:19:07 +01002124 # Use the positive sense of the flag when testing for -Wno-wombat
2125 # support (gcc will happily accept the -Wno- form of unknown
2126 # warning options).
John Snow93b25862015-03-25 18:57:37 -04002127 optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
2128 compile_prog "-Werror $optflag" ""
2129}
2130
2131for flag in $gcc_flags; do
2132 if cc_has_warning_flag $flag ; then
2133 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
Paolo Bonzini8d050952010-12-23 11:43:52 +01002134 fi
2135done
2136
Miroslav Rezanina3b463a32014-07-02 10:05:24 +02002137if test "$stack_protector" != "no"; then
Rodrigo Rebellofccd35a2015-11-12 12:04:28 -02002138 cat > $TMPC << EOF
2139int main(int argc, char *argv[])
2140{
2141 char arr[64], *p = arr, *c = argv[0];
2142 while (*c) {
2143 *p++ = *c++;
2144 }
2145 return 0;
2146}
2147EOF
Steven Noonan63678e12014-03-28 17:19:02 +01002148 gcc_flags="-fstack-protector-strong -fstack-protector-all"
Miroslav Rezanina3b463a32014-07-02 10:05:24 +02002149 sp_on=0
Steven Noonan63678e12014-03-28 17:19:02 +01002150 for flag in $gcc_flags; do
Peter Maydell590e5dd2014-04-11 17:13:52 +01002151 # We need to check both a compile and a link, since some compiler
2152 # setups fail only on a .c->.o compile and some only at link time
Paolo Bonzini086d5f72020-02-03 15:22:17 +01002153 if compile_object "-Werror $flag" &&
Peter Maydell590e5dd2014-04-11 17:13:52 +01002154 compile_prog "-Werror $flag" ""; then
Steven Noonan63678e12014-03-28 17:19:02 +01002155 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01002156 QEMU_LDFLAGS="$QEMU_LDFLAGS $flag"
Miroslav Rezanina3b463a32014-07-02 10:05:24 +02002157 sp_on=1
Steven Noonan63678e12014-03-28 17:19:02 +01002158 break
2159 fi
2160 done
Miroslav Rezanina3b463a32014-07-02 10:05:24 +02002161 if test "$stack_protector" = yes; then
2162 if test $sp_on = 0; then
2163 error_exit "Stack protector not supported"
2164 fi
2165 fi
Marc-André Lureau37746c52013-02-25 23:31:12 +01002166fi
2167
Paolo Bonzini20bc94a2017-10-20 12:11:32 +02002168# Disable -Wmissing-braces on older compilers that warn even for
2169# the "universal" C zero initializer {0}.
2170cat > $TMPC << EOF
2171struct {
2172 int a[2];
2173} x = {0};
2174EOF
2175if compile_object "-Werror" "" ; then
2176 :
2177else
2178 QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces"
2179fi
2180
Marc-André Lureau21e709a2019-07-18 16:04:13 +04002181# Our module code doesn't support Windows
2182if test "$modules" = "yes" && test "$mingw32" = "yes" ; then
2183 error_exit "Modules are not available for Windows"
2184fi
2185
Christian Ehrhardtbd83c862020-03-10 15:58:06 +01002186# module_upgrades is only reasonable if modules are enabled
2187if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then
2188 error_exit "Can't enable module-upgrades as Modules are not enabled"
2189fi
2190
Thomas Huthd376e9d2018-12-03 11:41:38 +01002191# Static linking is not possible with modules or PIE
Avi Kivity40d64442011-11-15 20:12:17 +02002192if test "$static" = "yes" ; then
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01002193 if test "$modules" = "yes" ; then
2194 error_exit "static and modules are mutually incompatible"
2195 fi
Avi Kivity40d64442011-11-15 20:12:17 +02002196fi
2197
Emilio G. Cota768b7852015-04-29 13:09:02 +02002198# Unconditional check for compiler __thread support
2199 cat > $TMPC << EOF
2200static __thread int tls_var;
2201int main(void) { return tls_var; }
2202EOF
2203
2204if ! compile_prog "-Werror" "" ; then
2205 error_exit "Your compiler does not support the __thread specifier for " \
2206 "Thread-Local Storage (TLS). Please upgrade to a version that does."
2207fi
2208
Richard Hendersonb2634122019-12-17 13:54:56 -10002209cat > $TMPC << EOF
Avi Kivity21d4a792011-11-23 11:24:25 +02002210
2211#ifdef __linux__
2212# define THREAD __thread
2213#else
2214# define THREAD
2215#endif
Avi Kivity21d4a792011-11-23 11:24:25 +02002216static THREAD int tls_var;
Avi Kivity21d4a792011-11-23 11:24:25 +02002217int main(void) { return tls_var; }
Avi Kivity40d64442011-11-15 20:12:17 +02002218EOF
Alex Bennée412aeac2019-08-15 19:41:51 +00002219
Richard Hendersonb2634122019-12-17 13:54:56 -10002220# Check we support --no-pie first; we will need this for building ROMs.
2221if compile_prog "-Werror -fno-pie" "-no-pie"; then
2222 CFLAGS_NOPIE="-fno-pie"
2223 LDFLAGS_NOPIE="-no-pie"
2224fi
2225
Richard Henderson12781462019-12-17 15:30:14 -10002226if test "$static" = "yes"; then
Richard Hendersoneca7a8e2020-04-03 20:11:50 +01002227 if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then
Paolo Bonzini086d5f72020-02-03 15:22:17 +01002228 CFLAGS="-fPIE -DPIE $CFLAGS"
Richard Henderson12781462019-12-17 15:30:14 -10002229 QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS"
2230 pie="yes"
2231 elif test "$pie" = "yes"; then
2232 error_exit "-static-pie not available due to missing toolchain support"
2233 else
2234 QEMU_LDFLAGS="-static $QEMU_LDFLAGS"
2235 pie="no"
2236 fi
2237elif test "$pie" = "no"; then
Paolo Bonzini086d5f72020-02-03 15:22:17 +01002238 CFLAGS="$CFLAGS_NOPIE $CFLAGS"
2239 LDFLAGS="$LDFLAGS_NOPIE $LDFLAGS"
Richard Hendersoneca7a8e2020-04-03 20:11:50 +01002240elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
Paolo Bonzini086d5f72020-02-03 15:22:17 +01002241 CFLAGS="-fPIE -DPIE $CFLAGS"
2242 LDFLAGS="-pie $LDFLAGS"
Richard Henderson2c674102019-12-17 15:15:01 -10002243 pie="yes"
2244elif test "$pie" = "yes"; then
2245 error_exit "PIE not available due to missing toolchain support"
2246else
2247 echo "Disabling PIE due to missing toolchain support"
2248 pie="no"
Avi Kivity40d64442011-11-15 20:12:17 +02002249fi
2250
Richard Hendersone6cbd752019-12-17 14:00:39 -10002251# Detect support for PT_GNU_RELRO + DT_BIND_NOW.
2252# The combination is known as "full relro", because .got.plt is read-only too.
2253if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
2254 QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS"
2255fi
2256
Paolo Bonzini09dada42013-04-17 16:26:47 +02002257##########################################
2258# __sync_fetch_and_and requires at least -march=i486. Many toolchains
2259# use i686 as default anyway, but for those that don't, an explicit
2260# specification is necessary
2261
2262if test "$cpu" = "i386"; then
2263 cat > $TMPC << EOF
2264static int sfaa(int *ptr)
2265{
2266 return __sync_fetch_and_and(ptr, 0);
2267}
2268
2269int main(void)
2270{
2271 int val = 42;
Stefan Weil1405b622013-05-11 21:46:58 +02002272 val = __sync_val_compare_and_swap(&val, 0, 1);
Paolo Bonzini09dada42013-04-17 16:26:47 +02002273 sfaa(&val);
2274 return val;
2275}
2276EOF
2277 if ! compile_prog "" "" ; then
2278 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
2279 fi
2280fi
2281
2282#########################################
bellardec530c82006-04-25 22:36:06 +00002283# Solaris specific configure tool chain decisions
Paolo Bonzini09dada42013-04-17 16:26:47 +02002284
bellardec530c82006-04-25 22:36:06 +00002285if test "$solaris" = "yes" ; then
Loïc Minier6792aa12010-01-20 11:35:54 +01002286 if has $install; then
2287 :
2288 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01002289 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
2290 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
2291 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
bellardec530c82006-04-25 22:36:06 +00002292 fi
Stefan Weil89138852016-05-16 15:10:20 +02002293 if test "$(path_of $install)" = "/usr/sbin/install" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002294 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
2295 "try ginstall from the GNU fileutils available from www.blastwave.org" \
2296 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
bellardec530c82006-04-25 22:36:06 +00002297 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01002298 if has ar; then
2299 :
2300 else
bellardec530c82006-04-25 22:36:06 +00002301 if test -f /usr/ccs/bin/ar ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002302 error_exit "No path includes ar" \
2303 "Add /usr/ccs/bin to your path and rerun configure"
bellardec530c82006-04-25 22:36:06 +00002304 fi
Peter Maydell76ad07a2013-04-08 12:11:26 +01002305 error_exit "No path includes ar"
bellardec530c82006-04-25 22:36:06 +00002306 fi
ths5fafdf22007-09-16 21:08:06 +00002307fi
bellardec530c82006-04-25 22:36:06 +00002308
Stefan Weilafb63eb2012-09-26 22:04:38 +02002309if test -z "${target_list+xxx}" ; then
Paolo Bonzinid880a3b2017-07-03 16:58:28 +02002310 for target in $default_target_list; do
2311 supported_target $target 2>/dev/null && \
2312 target_list="$target_list $target"
2313 done
2314 target_list="${target_list# }"
Anthony Liguori121afa92012-09-14 08:17:03 -05002315else
Stefan Weil89138852016-05-16 15:10:20 +02002316 target_list=$(echo "$target_list" | sed -e 's/,/ /g')
Paolo Bonzinid880a3b2017-07-03 16:58:28 +02002317 for target in $target_list; do
2318 # Check that we recognised the target name; this allows a more
2319 # friendly error message than if we let it fall through.
2320 case " $default_target_list " in
2321 *" $target "*)
2322 ;;
2323 *)
2324 error_exit "Unknown target name '$target'"
2325 ;;
2326 esac
2327 supported_target $target || exit 1
2328 done
bellard5327cf42005-01-10 23:18:50 +00002329fi
Peter Maydell25b48332013-05-20 16:16:16 +01002330
Paolo Bonzinif55fe272010-05-26 16:08:17 +02002331# see if system emulation was really requested
2332case " $target_list " in
2333 *"-softmmu "*) softmmu=yes
2334 ;;
2335 *) softmmu=no
2336 ;;
2337esac
bellard5327cf42005-01-10 23:18:50 +00002338
Philippe Mathieu-Daudé05dfa222019-11-08 12:45:30 +01002339for target in $target_list; do
2340 case "$target" in
2341 arm-softmmu | aarch64-softmmu | i386-softmmu | x86_64-softmmu)
2342 edk2_blobs="yes"
2343 ;;
2344 esac
2345done
Philippe Mathieu-Daudé623ef632019-11-08 12:45:31 +01002346# The EDK2 binaries are compressed with bzip2
2347if test "$edk2_blobs" = "yes" && ! has bzip2; then
2348 error_exit "The bzip2 program is required for building QEMU"
2349fi
Philippe Mathieu-Daudé05dfa222019-11-08 12:45:30 +01002350
Juan Quintela249247c2009-08-12 18:20:25 +02002351feature_not_found() {
2352 feature=$1
Stewart Smith21684af2014-01-24 12:39:10 +11002353 remedy=$2
Juan Quintela249247c2009-08-12 18:20:25 +02002354
Peter Maydell76ad07a2013-04-08 12:11:26 +01002355 error_exit "User requested feature $feature" \
Stewart Smith21684af2014-01-24 12:39:10 +11002356 "configure was not able to find it." \
2357 "$remedy"
Juan Quintela249247c2009-08-12 18:20:25 +02002358}
2359
bellard7d132992003-03-06 23:23:54 +00002360# ---
2361# big/little endian test
2362cat > $TMPC << EOF
Mike Frysinger61cc9192013-06-30 23:30:18 -04002363short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
2364short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
2365extern int foo(short *, short *);
2366int main(int argc, char *argv[]) {
2367 return foo(big_endian, little_endian);
bellard7d132992003-03-06 23:23:54 +00002368}
2369EOF
2370
Mike Frysinger61cc9192013-06-30 23:30:18 -04002371if compile_object ; then
Alice Frosi12f15c92018-01-30 14:38:28 +01002372 if strings -a $TMPO | grep -q BiGeNdIaN ; then
Mike Frysinger61cc9192013-06-30 23:30:18 -04002373 bigendian="yes"
Alice Frosi12f15c92018-01-30 14:38:28 +01002374 elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
Mike Frysinger61cc9192013-06-30 23:30:18 -04002375 bigendian="no"
2376 else
2377 echo big/little test failed
Peter Maydell21d89f82011-11-30 10:57:48 +01002378 fi
Mike Frysinger61cc9192013-06-30 23:30:18 -04002379else
2380 echo big/little test failed
bellard7d132992003-03-06 23:23:54 +00002381fi
2382
Juan Quintelab0a47e72009-08-12 18:29:49 +02002383##########################################
Philippe Mathieu-Daudée10ee3f2020-02-17 14:33:27 +01002384# system tools
2385if test -z "$want_tools"; then
2386 if test "$softmmu" = "no"; then
2387 want_tools=no
2388 else
2389 want_tools=yes
2390 fi
2391fi
2392
2393##########################################
Peter Maydella30878e2015-08-14 16:10:52 +01002394# cocoa implies not SDL or GTK
2395# (the cocoa UI code currently assumes it is always the active UI
2396# and doesn't interact well with other UI frontend code)
2397if test "$cocoa" = "yes"; then
2398 if test "$sdl" = "yes"; then
2399 error_exit "Cocoa and SDL UIs cannot both be enabled at once"
2400 fi
2401 if test "$gtk" = "yes"; then
2402 error_exit "Cocoa and GTK UIs cannot both be enabled at once"
2403 fi
2404 gtk=no
2405 sdl=no
2406fi
2407
Eric Blake6b39b062016-10-11 10:46:23 -05002408# Some versions of Mac OS X incorrectly define SIZE_MAX
2409cat > $TMPC << EOF
2410#include <stdint.h>
2411#include <stdio.h>
2412int main(int argc, char *argv[]) {
2413 return printf("%zu", SIZE_MAX);
2414}
2415EOF
2416have_broken_size_max=no
2417if ! compile_object -Werror ; then
2418 have_broken_size_max=yes
2419fi
2420
Peter Maydella30878e2015-08-14 16:10:52 +01002421##########################################
Gonglei015a33b2014-07-01 20:58:08 +08002422# L2TPV3 probe
2423
2424cat > $TMPC <<EOF
2425#include <sys/socket.h>
Michael Tokarevbff6cb72014-08-01 23:20:24 +04002426#include <linux/ip.h>
Gonglei015a33b2014-07-01 20:58:08 +08002427int main(void) { return sizeof(struct mmsghdr); }
2428EOF
2429if compile_prog "" "" ; then
2430 l2tpv3=yes
2431else
2432 l2tpv3=no
2433fi
2434
David CARLIERc9c8b882020-07-13 14:36:09 +01002435if check_include "pty.h" ; then
2436 pty_h=yes
2437else
2438 pty_h=no
2439fi
2440
David CARLIER195588c2020-07-13 14:36:09 +01002441cat > $TMPC <<EOF
2442#include <sys/mman.h>
2443int main(int argc, char *argv[]) {
2444 return mlockall(MCL_FUTURE);
2445}
2446EOF
2447if compile_prog "" "" ; then
2448 have_mlockall=yes
2449else
2450 have_mlockall=no
2451fi
2452
Paolo Bonzini299e6f12019-02-14 18:35:53 +01002453#########################################
2454# vhost interdependencies and host support
2455
2456# vhost backends
2457test "$vhost_user" = "" && vhost_user=yes
2458if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then
2459 error_exit "vhost-user isn't available on win32"
2460fi
Cindy Lu108a6482020-07-01 22:55:37 +08002461test "$vhost_vdpa" = "" && vhost_vdpa=$linux
2462if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then
2463 error_exit "vhost-vdpa is only available on Linux"
2464fi
Paolo Bonzini299e6f12019-02-14 18:35:53 +01002465test "$vhost_kernel" = "" && vhost_kernel=$linux
2466if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then
2467 error_exit "vhost-kernel is only available on Linux"
2468fi
2469
2470# vhost-kernel devices
2471test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel
2472if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then
2473 error_exit "--enable-vhost-scsi requires --enable-vhost-kernel"
2474fi
2475test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel
2476if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then
2477 error_exit "--enable-vhost-vsock requires --enable-vhost-kernel"
2478fi
2479
2480# vhost-user backends
2481test "$vhost_net_user" = "" && vhost_net_user=$vhost_user
2482if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then
2483 error_exit "--enable-vhost-net-user requires --enable-vhost-user"
2484fi
2485test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
2486if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
2487 error_exit "--enable-vhost-crypto requires --enable-vhost-user"
2488fi
Dr. David Alan Gilbert98fc1ad2019-09-30 11:51:34 +01002489test "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user
2490if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then
2491 error_exit "--enable-vhost-user-fs requires --enable-vhost-user"
2492fi
Cindy Lu108a6482020-07-01 22:55:37 +08002493#vhost-vdpa backends
2494test "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa
2495if test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then
2496 error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa"
2497fi
Paolo Bonzini299e6f12019-02-14 18:35:53 +01002498
2499# OR the vhost-kernel and vhost-user values for simplicity
2500if test "$vhost_net" = ""; then
2501 test "$vhost_net_user" = "yes" && vhost_net=yes
2502 test "$vhost_kernel" = "yes" && vhost_net=yes
2503fi
2504
Gonglei015a33b2014-07-01 20:58:08 +08002505##########################################
Daniel P. Berrange4d9310f2015-09-22 15:13:26 +01002506# MinGW / Mingw-w64 localtime_r/gmtime_r check
2507
2508if test "$mingw32" = "yes"; then
2509 # Some versions of MinGW / Mingw-w64 lack localtime_r
2510 # and gmtime_r entirely.
2511 #
2512 # Some versions of Mingw-w64 define a macro for
2513 # localtime_r/gmtime_r.
2514 #
2515 # Some versions of Mingw-w64 will define functions
2516 # for localtime_r/gmtime_r, but only if you have
2517 # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
2518 # though, unistd.h and pthread.h both define
2519 # that for you.
2520 #
2521 # So this #undef localtime_r and #include <unistd.h>
2522 # are not in fact redundant.
2523cat > $TMPC << EOF
2524#include <unistd.h>
2525#include <time.h>
2526#undef localtime_r
2527int main(void) { localtime_r(NULL, NULL); return 0; }
2528EOF
2529 if compile_prog "" "" ; then
2530 localtime_r="yes"
2531 else
2532 localtime_r="no"
2533 fi
2534fi
2535
2536##########################################
Stefan Weil779ab5e2012-12-16 11:29:45 +01002537# pkg-config probe
2538
2539if ! has "$pkg_config_exe"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002540 error_exit "pkg-config binary '$pkg_config_exe' not found"
Stefan Weil779ab5e2012-12-16 11:29:45 +01002541fi
2542
2543##########################################
Juan Quintelab0a47e72009-08-12 18:29:49 +02002544# NPTL probe
2545
Peter Maydell24cb36a2013-07-16 18:45:00 +01002546if test "$linux_user" = "yes"; then
Juan Quintelab0a47e72009-08-12 18:29:49 +02002547 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00002548#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00002549#include <linux/futex.h>
Stefan Weil182eacc2011-12-17 09:27:30 +01002550int main(void) {
pbrookbd0c5662008-05-29 14:34:11 +00002551#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
2552#error bork
2553#endif
Stefan Weil182eacc2011-12-17 09:27:30 +01002554 return 0;
pbrookbd0c5662008-05-29 14:34:11 +00002555}
2556EOF
Peter Maydell24cb36a2013-07-16 18:45:00 +01002557 if ! compile_object ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002558 feature_not_found "nptl" "Install glibc and linux kernel headers."
Juan Quintelab0a47e72009-08-12 18:29:49 +02002559 fi
pbrookbd0c5662008-05-29 14:34:11 +00002560fi
2561
balrogac629222008-10-11 09:56:04 +00002562##########################################
qiaonuohan607dacd2014-02-18 14:11:30 +08002563# lzo check
2564
2565if test "$lzo" != "no" ; then
2566 cat > $TMPC << EOF
2567#include <lzo/lzo1x.h>
2568int main(void) { lzo_version(); return 0; }
2569EOF
2570 if compile_prog "" "-llzo2" ; then
Stefan Weilb25c9df2014-04-29 08:21:16 +02002571 libs_softmmu="$libs_softmmu -llzo2"
2572 lzo="yes"
qiaonuohan607dacd2014-02-18 14:11:30 +08002573 else
Stefan Weilb25c9df2014-04-29 08:21:16 +02002574 if test "$lzo" = "yes"; then
2575 feature_not_found "liblzo2" "Install liblzo2 devel"
2576 fi
2577 lzo="no"
qiaonuohan607dacd2014-02-18 14:11:30 +08002578 fi
qiaonuohan607dacd2014-02-18 14:11:30 +08002579fi
2580
2581##########################################
2582# snappy check
2583
2584if test "$snappy" != "no" ; then
2585 cat > $TMPC << EOF
2586#include <snappy-c.h>
2587int main(void) { snappy_max_compressed_length(4096); return 0; }
2588EOF
2589 if compile_prog "" "-lsnappy" ; then
Stefan Weilb25c9df2014-04-29 08:21:16 +02002590 libs_softmmu="$libs_softmmu -lsnappy"
2591 snappy="yes"
qiaonuohan607dacd2014-02-18 14:11:30 +08002592 else
Stefan Weilb25c9df2014-04-29 08:21:16 +02002593 if test "$snappy" = "yes"; then
2594 feature_not_found "libsnappy" "Install libsnappy devel"
2595 fi
2596 snappy="no"
qiaonuohan607dacd2014-02-18 14:11:30 +08002597 fi
qiaonuohan607dacd2014-02-18 14:11:30 +08002598fi
2599
2600##########################################
Peter Wu6b383c02015-01-06 18:48:14 +01002601# bzip2 check
2602
2603if test "$bzip2" != "no" ; then
2604 cat > $TMPC << EOF
2605#include <bzlib.h>
2606int main(void) { BZ2_bzlibVersion(); return 0; }
2607EOF
2608 if compile_prog "" "-lbz2" ; then
2609 bzip2="yes"
2610 else
2611 if test "$bzip2" = "yes"; then
2612 feature_not_found "libbzip2" "Install libbzip2 devel"
2613 fi
2614 bzip2="no"
2615 fi
2616fi
2617
2618##########################################
Julio Faracco83bc1f92018-11-05 13:08:04 -02002619# lzfse check
2620
2621if test "$lzfse" != "no" ; then
2622 cat > $TMPC << EOF
2623#include <lzfse.h>
2624int main(void) { lzfse_decode_scratch_size(); return 0; }
2625EOF
2626 if compile_prog "" "-llzfse" ; then
2627 lzfse="yes"
2628 else
2629 if test "$lzfse" = "yes"; then
2630 feature_not_found "lzfse" "Install lzfse devel"
2631 fi
2632 lzfse="no"
2633 fi
2634fi
2635
2636##########################################
Juan Quintela3a678482019-12-17 21:15:24 +01002637# zstd check
2638
2639if test "$zstd" != "no" ; then
Juan Quintela297254c2020-03-10 12:14:31 +01002640 libzstd_minver="1.4.0"
2641 if $pkg_config --atleast-version=$libzstd_minver libzstd ; then
Juan Quintela3a678482019-12-17 21:15:24 +01002642 zstd_cflags="$($pkg_config --cflags libzstd)"
2643 zstd_libs="$($pkg_config --libs libzstd)"
2644 LIBS="$zstd_libs $LIBS"
2645 QEMU_CFLAGS="$QEMU_CFLAGS $zstd_cflags"
2646 zstd="yes"
2647 else
2648 if test "$zstd" = "yes" ; then
2649 feature_not_found "libzstd" "Install libzstd devel"
2650 fi
2651 zstd="no"
2652 fi
2653fi
2654
2655##########################################
Eduardo Otubof7945732012-08-14 18:44:05 -03002656# libseccomp check
2657
2658if test "$seccomp" != "no" ; then
Helge Deller25ed0ec2019-04-04 20:39:23 +02002659 libseccomp_minver="2.3.0"
2660 if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
Fam Zhengc3883e12017-09-07 16:53:16 +08002661 seccomp_cflags="$($pkg_config --cflags libseccomp)"
2662 seccomp_libs="$($pkg_config --libs libseccomp)"
Andrew Jones693e5912015-09-30 11:59:18 -04002663 seccomp="yes"
Eduardo Otubof7945732012-08-14 18:44:05 -03002664 else
Andrew Jones693e5912015-09-30 11:59:18 -04002665 if test "$seccomp" = "yes" ; then
Helge Deller25ed0ec2019-04-04 20:39:23 +02002666 feature_not_found "libseccomp" \
2667 "Install libseccomp devel >= $libseccomp_minver"
Andrew Jones693e5912015-09-30 11:59:18 -04002668 fi
2669 seccomp="no"
Eduardo Otubof7945732012-08-14 18:44:05 -03002670 fi
2671fi
2672##########################################
aliguorie37630c2009-04-22 15:19:10 +00002673# xen probe
2674
Juan Quintelafc321b42009-08-12 18:29:55 +02002675if test "$xen" != "no" ; then
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002676 # Check whether Xen library path is specified via --extra-ldflags to avoid
2677 # overriding this setting with pkg-config output. If not, try pkg-config
2678 # to obtain all needed flags.
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00002679
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002680 if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \
2681 $pkg_config --exists xencontrol ; then
2682 xen_ctrl_version="$(printf '%d%02d%02d' \
2683 $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
2684 xen=yes
2685 xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
2686 xen_pc="$xen_pc xenevtchn xendevicemodel"
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002687 if $pkg_config --exists xentoolcore; then
2688 xen_pc="$xen_pc xentoolcore"
2689 fi
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002690 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
2691 libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002692 else
Stefan Weil50ced5b2011-12-17 09:27:39 +01002693
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002694 xen_libs="-lxenstore -lxenctrl -lxenguest"
Anthony PERARDd9506ca2017-05-11 12:35:42 +01002695 xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002696
2697 # First we test whether Xen headers and libraries are available.
2698 # If no, we are done and there is no Xen support.
2699 # If yes, more tests are run to detect the Xen version.
2700
2701 # Xen (any)
2702 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00002703#include <xenctrl.h>
Stefan Weil50ced5b2011-12-17 09:27:39 +01002704int main(void) {
2705 return 0;
2706}
2707EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002708 if ! compile_prog "" "$xen_libs" ; then
2709 # Xen not found
2710 if test "$xen" = "yes" ; then
2711 feature_not_found "xen" "Install xen devel"
2712 fi
2713 xen=no
Stefan Weil50ced5b2011-12-17 09:27:39 +01002714
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002715 # Xen unstable
2716 elif
2717 cat > $TMPC <<EOF &&
Ross Lagerwall2cbf8902017-10-23 10:27:27 +01002718#undef XC_WANT_COMPAT_DEVICEMODEL_API
2719#define __XEN_TOOLS__
2720#include <xendevicemodel.h>
Paul Durrantd3c49eb2018-05-15 17:40:53 +01002721#include <xenforeignmemory.h>
Ross Lagerwall2cbf8902017-10-23 10:27:27 +01002722int main(void) {
2723 xendevicemodel_handle *xd;
Paul Durrantd3c49eb2018-05-15 17:40:53 +01002724 xenforeignmemory_handle *xfmem;
Ross Lagerwall2cbf8902017-10-23 10:27:27 +01002725
2726 xd = xendevicemodel_open(0, 0);
2727 xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0);
2728
Paul Durrantd3c49eb2018-05-15 17:40:53 +01002729 xfmem = xenforeignmemory_open(0, 0);
2730 xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0);
2731
Ross Lagerwall2cbf8902017-10-23 10:27:27 +01002732 return 0;
2733}
2734EOF
2735 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
2736 then
2737 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
2738 xen_ctrl_version=41100
2739 xen=yes
2740 elif
2741 cat > $TMPC <<EOF &&
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002742#undef XC_WANT_COMPAT_MAP_FOREIGN_API
2743#include <xenforeignmemory.h>
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002744#include <xentoolcore.h>
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002745int main(void) {
2746 xenforeignmemory_handle *xfmem;
2747
2748 xfmem = xenforeignmemory_open(0, 0);
2749 xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0);
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002750 xentoolcore_restrict_all(0);
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002751
2752 return 0;
2753}
2754EOF
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002755 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002756 then
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002757 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002758 xen_ctrl_version=41000
2759 xen=yes
2760 elif
2761 cat > $TMPC <<EOF &&
Paul Durrantda8090c2017-03-07 10:55:33 +00002762#undef XC_WANT_COMPAT_DEVICEMODEL_API
2763#define __XEN_TOOLS__
2764#include <xendevicemodel.h>
2765int main(void) {
2766 xendevicemodel_handle *xd;
2767
2768 xd = xendevicemodel_open(0, 0);
2769 xendevicemodel_close(xd);
2770
2771 return 0;
2772}
2773EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002774 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
2775 then
2776 xen_stable_libs="-lxendevicemodel $xen_stable_libs"
2777 xen_ctrl_version=40900
2778 xen=yes
2779 elif
2780 cat > $TMPC <<EOF &&
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002781/*
2782 * If we have stable libs the we don't want the libxc compat
2783 * layers, regardless of what CFLAGS we may have been given.
Paulina Szubarczykb6eb9b42016-09-14 21:10:03 +02002784 *
2785 * Also, check if xengnttab_grant_copy_segment_t is defined and
2786 * grant copy operation is implemented.
2787 */
2788#undef XC_WANT_COMPAT_EVTCHN_API
2789#undef XC_WANT_COMPAT_GNTTAB_API
2790#undef XC_WANT_COMPAT_MAP_FOREIGN_API
2791#include <xenctrl.h>
2792#include <xenstore.h>
2793#include <xenevtchn.h>
2794#include <xengnttab.h>
2795#include <xenforeignmemory.h>
2796#include <stdint.h>
2797#include <xen/hvm/hvm_info_table.h>
2798#if !defined(HVM_MAX_VCPUS)
2799# error HVM_MAX_VCPUS not defined
2800#endif
2801int main(void) {
2802 xc_interface *xc = NULL;
2803 xenforeignmemory_handle *xfmem;
2804 xenevtchn_handle *xe;
2805 xengnttab_handle *xg;
Paulina Szubarczykb6eb9b42016-09-14 21:10:03 +02002806 xengnttab_grant_copy_segment_t* seg = NULL;
2807
2808 xs_daemon_open();
2809
2810 xc = xc_interface_open(0, 0, 0);
2811 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2812 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2813 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2814 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
Paulina Szubarczykb6eb9b42016-09-14 21:10:03 +02002815
2816 xfmem = xenforeignmemory_open(0, 0);
2817 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2818
2819 xe = xenevtchn_open(0, 0);
2820 xenevtchn_fd(xe);
2821
2822 xg = xengnttab_open(0, 0);
2823 xengnttab_grant_copy(xg, 0, seg);
2824
2825 return 0;
2826}
2827EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002828 compile_prog "" "$xen_libs $xen_stable_libs"
2829 then
2830 xen_ctrl_version=40800
2831 xen=yes
2832 elif
2833 cat > $TMPC <<EOF &&
Paulina Szubarczykb6eb9b42016-09-14 21:10:03 +02002834/*
2835 * If we have stable libs the we don't want the libxc compat
2836 * layers, regardless of what CFLAGS we may have been given.
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002837 */
2838#undef XC_WANT_COMPAT_EVTCHN_API
2839#undef XC_WANT_COMPAT_GNTTAB_API
2840#undef XC_WANT_COMPAT_MAP_FOREIGN_API
2841#include <xenctrl.h>
2842#include <xenstore.h>
2843#include <xenevtchn.h>
2844#include <xengnttab.h>
2845#include <xenforeignmemory.h>
2846#include <stdint.h>
2847#include <xen/hvm/hvm_info_table.h>
2848#if !defined(HVM_MAX_VCPUS)
2849# error HVM_MAX_VCPUS not defined
2850#endif
2851int main(void) {
2852 xc_interface *xc = NULL;
2853 xenforeignmemory_handle *xfmem;
2854 xenevtchn_handle *xe;
2855 xengnttab_handle *xg;
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002856
2857 xs_daemon_open();
2858
2859 xc = xc_interface_open(0, 0, 0);
2860 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2861 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2862 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2863 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002864
2865 xfmem = xenforeignmemory_open(0, 0);
2866 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2867
2868 xe = xenevtchn_open(0, 0);
2869 xenevtchn_fd(xe);
2870
2871 xg = xengnttab_open(0, 0);
2872 xengnttab_map_grant_ref(xg, 0, 0, 0);
2873
2874 return 0;
2875}
2876EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002877 compile_prog "" "$xen_libs $xen_stable_libs"
2878 then
2879 xen_ctrl_version=40701
2880 xen=yes
Roger Pau Monnecdadde32015-11-13 17:38:06 +00002881
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002882 # Xen 4.6
2883 elif
2884 cat > $TMPC <<EOF &&
Roger Pau Monnecdadde32015-11-13 17:38:06 +00002885#include <xenctrl.h>
Anthony PERARDe108a3c2012-06-21 11:44:35 +00002886#include <xenstore.h>
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00002887#include <stdint.h>
2888#include <xen/hvm/hvm_info_table.h>
2889#if !defined(HVM_MAX_VCPUS)
2890# error HVM_MAX_VCPUS not defined
2891#endif
2892int main(void) {
2893 xc_interface *xc;
2894 xs_daemon_open();
2895 xc = xc_interface_open(0, 0, 0);
2896 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2897 xc_gnttab_open(NULL, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01002898 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Stefano Stabellini8688e062012-04-17 17:04:18 +00002899 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
Jan Beulichd8b441a2015-07-24 03:38:28 -06002900 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
Konrad Rzeszutek Wilk20a544c2015-06-29 12:51:05 -04002901 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
Jan Beulichd8b441a2015-07-24 03:38:28 -06002902 return 0;
2903}
2904EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002905 compile_prog "" "$xen_libs"
2906 then
2907 xen_ctrl_version=40600
2908 xen=yes
Jan Beulichd8b441a2015-07-24 03:38:28 -06002909
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002910 # Xen 4.5
2911 elif
2912 cat > $TMPC <<EOF &&
Jan Beulichd8b441a2015-07-24 03:38:28 -06002913#include <xenctrl.h>
2914#include <xenstore.h>
2915#include <stdint.h>
2916#include <xen/hvm/hvm_info_table.h>
2917#if !defined(HVM_MAX_VCPUS)
2918# error HVM_MAX_VCPUS not defined
2919#endif
2920int main(void) {
2921 xc_interface *xc;
2922 xs_daemon_open();
2923 xc = xc_interface_open(0, 0, 0);
2924 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2925 xc_gnttab_open(NULL, 0);
2926 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2927 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
Paul Durrant3996e852015-01-20 11:06:19 +00002928 xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
2929 return 0;
2930}
2931EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002932 compile_prog "" "$xen_libs"
2933 then
2934 xen_ctrl_version=40500
2935 xen=yes
Paul Durrant3996e852015-01-20 11:06:19 +00002936
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002937 elif
2938 cat > $TMPC <<EOF &&
Paul Durrant3996e852015-01-20 11:06:19 +00002939#include <xenctrl.h>
2940#include <xenstore.h>
2941#include <stdint.h>
2942#include <xen/hvm/hvm_info_table.h>
2943#if !defined(HVM_MAX_VCPUS)
2944# error HVM_MAX_VCPUS not defined
2945#endif
2946int main(void) {
2947 xc_interface *xc;
2948 xs_daemon_open();
2949 xc = xc_interface_open(0, 0, 0);
2950 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2951 xc_gnttab_open(NULL, 0);
2952 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2953 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
Stefano Stabellini8688e062012-04-17 17:04:18 +00002954 return 0;
2955}
2956EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002957 compile_prog "" "$xen_libs"
2958 then
2959 xen_ctrl_version=40200
2960 xen=yes
Stefano Stabellini8688e062012-04-17 17:04:18 +00002961
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002962 else
2963 if test "$xen" = "yes" ; then
2964 feature_not_found "xen (unsupported version)" \
2965 "Install a supported xen (xen 4.2 or newer)"
2966 fi
2967 xen=no
Juan Quintelafc321b42009-08-12 18:29:55 +02002968 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00002969
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002970 if test "$xen" = yes; then
2971 if test $xen_ctrl_version -ge 40701 ; then
2972 libs_softmmu="$xen_stable_libs $libs_softmmu"
2973 fi
2974 libs_softmmu="$xen_libs $libs_softmmu"
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002975 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00002976 fi
aliguorie37630c2009-04-22 15:19:10 +00002977fi
2978
Anthony PERARDeb6fda02012-06-21 15:32:59 +00002979if test "$xen_pci_passthrough" != "no"; then
Ian Campbelledfb07e2016-02-10 11:07:01 +00002980 if test "$xen" = "yes" && test "$linux" = "yes"; then
Anthony PERARDeb6fda02012-06-21 15:32:59 +00002981 xen_pci_passthrough=yes
2982 else
2983 if test "$xen_pci_passthrough" = "yes"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002984 error_exit "User requested feature Xen PCI Passthrough" \
2985 " but this feature requires /sys from Linux"
Anthony PERARDeb6fda02012-06-21 15:32:59 +00002986 fi
2987 xen_pci_passthrough=no
2988 fi
2989fi
2990
aliguorie37630c2009-04-22 15:19:10 +00002991##########################################
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08002992# Windows Hypervisor Platform accelerator (WHPX) check
2993if test "$whpx" != "no" ; then
Lucian Petrut327fccb2018-05-15 20:35:21 +03002994 if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08002995 whpx="yes"
2996 else
2997 if test "$whpx" = "yes"; then
Justin Terry (VM) via Qemu-devel53537bb2018-02-26 09:13:29 -08002998 feature_not_found "WinHvPlatform" "WinHvEmulation is not installed"
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08002999 fi
3000 whpx="no"
3001 fi
3002fi
3003
3004##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02003005# Sparse probe
3006if test "$sparse" != "no" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00003007 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02003008 sparse=yes
3009 else
3010 if test "$sparse" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003011 feature_not_found "sparse" "Install sparse binary"
Juan Quinteladfffc652009-08-12 18:29:57 +02003012 fi
3013 sparse=no
3014 fi
3015fi
3016
3017##########################################
Jeremy Whitef676c672015-01-09 13:08:49 -06003018# X11 probe
Jeremy Whitef676c672015-01-09 13:08:49 -06003019if $pkg_config --exists "x11"; then
Gerd Hoffmann87815952018-03-01 11:05:42 +01003020 have_x11=yes
Stefan Weil89138852016-05-16 15:10:20 +02003021 x11_cflags=$($pkg_config --cflags x11)
3022 x11_libs=$($pkg_config --libs x11)
Jeremy Whitef676c672015-01-09 13:08:49 -06003023fi
3024
3025##########################################
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06003026# GTK probe
3027
3028if test "$gtk" != "no"; then
Daniel P. Berrangé89d85cd2018-08-22 14:15:52 +01003029 gtkpackage="gtk+-3.0"
3030 gtkx11package="gtk+-x11-3.0"
Volker Rümelin7b23d122020-05-16 09:20:14 +02003031 gtkversion="3.22.0"
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01003032 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
Stefan Weil89138852016-05-16 15:10:20 +02003033 gtk_cflags=$($pkg_config --cflags $gtkpackage)
3034 gtk_libs=$($pkg_config --libs $gtkpackage)
3035 gtk_version=$($pkg_config --modversion $gtkpackage)
Gerd Hoffmann0a337ed2014-05-28 22:33:06 +02003036 if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
Gerd Hoffmann87815952018-03-01 11:05:42 +01003037 need_x11=yes
Jeremy Whitef676c672015-01-09 13:08:49 -06003038 gtk_cflags="$gtk_cflags $x11_cflags"
3039 gtk_libs="$gtk_libs $x11_libs"
Gerd Hoffmann0a337ed2014-05-28 22:33:06 +02003040 fi
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01003041 gtk="yes"
3042 elif test "$gtk" = "yes"; then
Gerd Hoffmann5fe309f2017-06-06 12:53:36 +02003043 feature_not_found "gtk" "Install gtk3-devel"
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01003044 else
3045 gtk="no"
3046 fi
3047fi
3048
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01003049
3050##########################################
3051# GNUTLS probe
3052
3053if test "$gnutls" != "no"; then
Richard Hendersona73e82e2019-05-09 18:24:35 -07003054 pass="no"
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01003055 if $pkg_config --exists "gnutls >= 3.1.18"; then
Stefan Weil89138852016-05-16 15:10:20 +02003056 gnutls_cflags=$($pkg_config --cflags gnutls)
3057 gnutls_libs=$($pkg_config --libs gnutls)
Richard Hendersona73e82e2019-05-09 18:24:35 -07003058 # Packaging for the static libraries is not always correct.
3059 # At least ubuntu 18.04 ships only shared libraries.
3060 write_c_skeleton
3061 if compile_prog "" "$gnutls_libs" ; then
Richard Henderson243dc2c2019-05-16 15:29:06 -07003062 LIBS="$gnutls_libs $LIBS"
Richard Hendersona73e82e2019-05-09 18:24:35 -07003063 QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
3064 pass="yes"
3065 fi
3066 fi
3067 if test "$pass" = "no" && test "$gnutls" = "yes"; then
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01003068 feature_not_found "gnutls" "Install gnutls devel >= 3.1.18"
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01003069 else
Richard Hendersona73e82e2019-05-09 18:24:35 -07003070 gnutls="$pass"
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01003071 fi
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01003072fi
3073
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01003074
3075# If user didn't give a --disable/enable-gcrypt flag,
3076# then mark as disabled if user requested nettle
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01003077# explicitly
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01003078if test -z "$gcrypt"
3079then
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01003080 if test "$nettle" = "yes"
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01003081 then
3082 gcrypt="no"
3083 fi
3084fi
3085
3086# If user didn't give a --disable/enable-nettle flag,
3087# then mark as disabled if user requested gcrypt
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01003088# explicitly
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01003089if test -z "$nettle"
3090then
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01003091 if test "$gcrypt" = "yes"
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01003092 then
3093 nettle="no"
3094 fi
3095fi
3096
Daniel P. Berrangédea7a642018-07-18 11:55:05 +01003097has_libgcrypt() {
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01003098 if ! has "libgcrypt-config"
3099 then
3100 return 1
3101 fi
3102
3103 if test -n "$cross_prefix"
3104 then
Stefan Weil89138852016-05-16 15:10:20 +02003105 host=$(libgcrypt-config --host)
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01003106 if test "$host-" != $cross_prefix
3107 then
3108 return 1
3109 fi
3110 fi
3111
Daniel P. Berrangédea7a642018-07-18 11:55:05 +01003112 maj=`libgcrypt-config --version | awk -F . '{print $1}'`
3113 min=`libgcrypt-config --version | awk -F . '{print $2}'`
3114
3115 if test $maj != 1 || test $min -lt 5
3116 then
3117 return 1
3118 fi
3119
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01003120 return 0
3121}
3122
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01003123
3124if test "$nettle" != "no"; then
Richard Hendersona73e82e2019-05-09 18:24:35 -07003125 pass="no"
Daniel P. Berrangé64dd2f32018-07-18 11:55:05 +01003126 if $pkg_config --exists "nettle >= 2.7.1"; then
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01003127 nettle_cflags=$($pkg_config --cflags nettle)
3128 nettle_libs=$($pkg_config --libs nettle)
3129 nettle_version=$($pkg_config --modversion nettle)
Richard Hendersona73e82e2019-05-09 18:24:35 -07003130 # Link test to make sure the given libraries work (e.g for static).
3131 write_c_skeleton
3132 if compile_prog "" "$nettle_libs" ; then
Richard Henderson243dc2c2019-05-16 15:29:06 -07003133 LIBS="$nettle_libs $LIBS"
Richard Hendersona73e82e2019-05-09 18:24:35 -07003134 QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
3135 if test -z "$gcrypt"; then
3136 gcrypt="no"
3137 fi
3138 pass="yes"
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01003139 fi
Richard Hendersona73e82e2019-05-09 18:24:35 -07003140 fi
Daniel P. Berrangédc2207a2019-10-14 17:28:27 +01003141 if test "$pass" = "yes"
3142 then
3143 cat > $TMPC << EOF
3144#include <nettle/xts.h>
3145int main(void) {
3146 return 0;
3147}
3148EOF
3149 if compile_prog "$nettle_cflags" "$nettle_libs" ; then
3150 nettle_xts=yes
3151 qemu_private_xts=no
3152 fi
3153 fi
Richard Hendersona73e82e2019-05-09 18:24:35 -07003154 if test "$pass" = "no" && test "$nettle" = "yes"; then
3155 feature_not_found "nettle" "Install nettle devel >= 2.7.1"
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01003156 else
Richard Hendersona73e82e2019-05-09 18:24:35 -07003157 nettle="$pass"
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01003158 fi
3159fi
3160
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01003161if test "$gcrypt" != "no"; then
Richard Hendersona73e82e2019-05-09 18:24:35 -07003162 pass="no"
Daniel P. Berrangédea7a642018-07-18 11:55:05 +01003163 if has_libgcrypt; then
Stefan Weil89138852016-05-16 15:10:20 +02003164 gcrypt_cflags=$(libgcrypt-config --cflags)
3165 gcrypt_libs=$(libgcrypt-config --libs)
Richard Hendersona73e82e2019-05-09 18:24:35 -07003166 # Debian has removed -lgpg-error from libgcrypt-config
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01003167 # as it "spreads unnecessary dependencies" which in
3168 # turn breaks static builds...
3169 if test "$static" = "yes"
3170 then
3171 gcrypt_libs="$gcrypt_libs -lgpg-error"
3172 fi
Longpeng(Mike)1f923c72016-12-13 18:42:55 +08003173
Richard Hendersona73e82e2019-05-09 18:24:35 -07003174 # Link test to make sure the given libraries work (e.g for static).
3175 write_c_skeleton
3176 if compile_prog "" "$gcrypt_libs" ; then
Richard Henderson243dc2c2019-05-16 15:29:06 -07003177 LIBS="$gcrypt_libs $LIBS"
Richard Hendersona73e82e2019-05-09 18:24:35 -07003178 QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
3179 pass="yes"
3180 fi
3181 fi
3182 if test "$pass" = "yes"; then
3183 gcrypt="yes"
Longpeng(Mike)1f923c72016-12-13 18:42:55 +08003184 cat > $TMPC << EOF
3185#include <gcrypt.h>
3186int main(void) {
3187 gcry_mac_hd_t handle;
3188 gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5,
3189 GCRY_MAC_FLAG_SECURE, NULL);
3190 return 0;
3191}
3192EOF
3193 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
3194 gcrypt_hmac=yes
3195 fi
Daniel P. Berrangée0576942019-10-14 17:28:27 +01003196 cat > $TMPC << EOF
3197#include <gcrypt.h>
3198int main(void) {
3199 gcry_cipher_hd_t handle;
3200 gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0);
3201 return 0;
3202}
3203EOF
3204 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
3205 gcrypt_xts=yes
3206 qemu_private_xts=no
3207 fi
Richard Hendersona73e82e2019-05-09 18:24:35 -07003208 elif test "$gcrypt" = "yes"; then
3209 feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0"
Daniel P. Berrange62893b62015-07-01 18:10:33 +01003210 else
Richard Hendersona73e82e2019-05-09 18:24:35 -07003211 gcrypt="no"
Daniel P. Berrange62893b62015-07-01 18:10:33 +01003212 fi
3213fi
3214
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01003215
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01003216if test "$gcrypt" = "yes" && test "$nettle" = "yes"
3217then
3218 error_exit "Only one of gcrypt & nettle can be enabled"
3219fi
3220
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01003221##########################################
3222# libtasn1 - only for the TLS creds/session test suite
3223
3224tasn1=yes
Daniel P. Berrange90246032015-09-21 17:25:34 +01003225tasn1_cflags=""
3226tasn1_libs=""
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01003227if $pkg_config --exists "libtasn1"; then
Stefan Weil89138852016-05-16 15:10:20 +02003228 tasn1_cflags=$($pkg_config --cflags libtasn1)
3229 tasn1_libs=$($pkg_config --libs libtasn1)
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01003230else
3231 tasn1=no
3232fi
3233
Daniel P. Berrangeed754742015-07-01 18:10:34 +01003234
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01003235##########################################
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01003236# PAM probe
3237
3238if test "$auth_pam" != "no"; then
3239 cat > $TMPC <<EOF
3240#include <security/pam_appl.h>
3241#include <stdio.h>
3242int main(void) {
3243 const char *service_name = "qemu";
3244 const char *user = "frank";
Dr. David Alan Gilbert9c9642d2019-04-04 10:17:25 +01003245 const struct pam_conv pam_conv = { 0 };
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01003246 pam_handle_t *pamh = NULL;
Dr. David Alan Gilbert9c9642d2019-04-04 10:17:25 +01003247 pam_start(service_name, user, &pam_conv, &pamh);
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01003248 return 0;
3249}
3250EOF
3251 if compile_prog "" "-lpam" ; then
3252 auth_pam=yes
3253 else
3254 if test "$auth_pam" = "yes"; then
3255 feature_not_found "PAM" "Install PAM development package"
3256 else
3257 auth_pam=no
3258 fi
3259 fi
3260fi
3261
3262##########################################
Daniel P. Berrange559607e2015-02-27 16:19:33 +00003263# getifaddrs (for tests/test-io-channel-socket )
3264
3265have_ifaddrs_h=yes
3266if ! check_include "ifaddrs.h" ; then
3267 have_ifaddrs_h=no
3268fi
3269
Chen Gange865b972020-06-05 09:32:21 +08003270#########################################
3271# libdrm check
3272have_drm_h=no
3273if check_include "libdrm/drm.h" ; then
3274 have_drm_h=yes
3275fi
3276
David CARLIER2a4b4722020-07-13 14:36:09 +01003277#########################################
3278# sys/signal.h check
3279have_sys_signal_h=no
3280if check_include "sys/signal.h" ; then
3281 have_sys_signal_h=yes
3282fi
3283
Daniel P. Berrange559607e2015-02-27 16:19:33 +00003284##########################################
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01003285# VTE probe
3286
3287if test "$vte" != "no"; then
Daniel P. Berrangé89d85cd2018-08-22 14:15:52 +01003288 vteminversion="0.32.0"
3289 if $pkg_config --exists "vte-2.91"; then
3290 vtepackage="vte-2.91"
Daniel P. Berrange528de902013-02-25 15:20:44 +00003291 else
Daniel P. Berrangé89d85cd2018-08-22 14:15:52 +01003292 vtepackage="vte-2.90"
Daniel P. Berrange528de902013-02-25 15:20:44 +00003293 fi
Cole Robinsonc6feff92016-05-06 14:03:12 -04003294 if $pkg_config --exists "$vtepackage >= $vteminversion"; then
Stefan Weil89138852016-05-16 15:10:20 +02003295 vte_cflags=$($pkg_config --cflags $vtepackage)
3296 vte_libs=$($pkg_config --libs $vtepackage)
3297 vteversion=$($pkg_config --modversion $vtepackage)
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01003298 vte="yes"
3299 elif test "$vte" = "yes"; then
Daniel P. Berrangé89d85cd2018-08-22 14:15:52 +01003300 feature_not_found "vte" "Install libvte-2.90/2.91 devel"
Peter Maydell0d185e62013-07-18 16:42:01 +01003301 else
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01003302 vte="no"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06003303 fi
3304fi
3305
3306##########################################
bellard11d9f692004-04-02 20:55:59 +00003307# SDL probe
3308
Carlo Marcelo Arenas Belónaee8a612019-07-10 15:55:28 -07003309# Look for sdl configuration program (pkg-config or sdl2-config). Try
3310# sdl2-config even without cross prefix, and favour pkg-config over sdl2-config.
Dave Airlie47c03742013-12-10 14:05:51 +10003311
Peter Xuc6093a02018-04-10 13:40:34 +08003312sdl_probe ()
3313{
Daniel P. Berrangé0015ca52018-08-22 14:15:54 +01003314 if $pkg_config sdl2 --exists; then
3315 sdlconfig="$pkg_config sdl2"
Peter Xuc6093a02018-04-10 13:40:34 +08003316 sdlversion=$($sdlconfig --modversion 2>/dev/null)
Carlo Marcelo Arenas Belónaee8a612019-07-10 15:55:28 -07003317 elif has "$sdl2_config"; then
Daniel P. Berrangé0015ca52018-08-22 14:15:54 +01003318 sdlconfig="$sdl2_config"
Peter Xuc6093a02018-04-10 13:40:34 +08003319 sdlversion=$($sdlconfig --version)
3320 else
3321 if test "$sdl" = "yes" ; then
3322 feature_not_found "sdl" "Install SDL2-devel"
3323 fi
3324 sdl=no
3325 # no need to do the rest
3326 return
3327 fi
Carlo Marcelo Arenas Belónaee8a612019-07-10 15:55:28 -07003328 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl2-config; then
Peter Xuc6093a02018-04-10 13:40:34 +08003329 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
3330 fi
3331
Juan Quintelaac119f92009-07-27 16:13:15 +02003332 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00003333#include <SDL.h>
3334#undef main /* We don't want SDL to override our main() */
3335int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
3336EOF
Stefan Weil89138852016-05-16 15:10:20 +02003337 sdl_cflags=$($sdlconfig --cflags 2>/dev/null)
Gerd Hoffmann2ca5c432018-03-07 16:42:57 +01003338 sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug
TeLeMan74f42e12010-02-08 13:56:44 +08003339 if test "$static" = "yes" ; then
Daniel P. Berrangé0015ca52018-08-22 14:15:54 +01003340 if $pkg_config sdl2 --exists; then
3341 sdl_libs=$($pkg_config sdl2 --static --libs 2>/dev/null)
Thomas Huth5f37e6d2017-06-13 20:00:44 +02003342 else
3343 sdl_libs=$($sdlconfig --static-libs 2>/dev/null)
3344 fi
TeLeMan74f42e12010-02-08 13:56:44 +08003345 else
Stefan Weil89138852016-05-16 15:10:20 +02003346 sdl_libs=$($sdlconfig --libs 2>/dev/null)
TeLeMan74f42e12010-02-08 13:56:44 +08003347 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02003348 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Daniel P. Berrangé0015ca52018-08-22 14:15:54 +01003349 sdl=yes
aliguoricd01b4a2008-08-21 19:25:45 +00003350
Paolo Bonzini67c274d2010-01-13 09:52:54 +01003351 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Eric Blakee633a5c2019-02-04 20:39:37 -06003352 if test "$sdl" = "yes" && test "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01003353 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weil89138852016-05-16 15:10:20 +02003354 sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)"
3355 sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)"
Juan Quintelaac119f92009-07-27 16:13:15 +02003356 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02003357 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02003358 :
3359 else
3360 sdl=no
3361 fi
3362 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02003363 else # sdl not found
3364 if test "$sdl" = "yes" ; then
Daniel P. Berrangé0015ca52018-08-22 14:15:54 +01003365 feature_not_found "sdl" "Install SDL2 devel"
Juan Quintelac4198152009-08-12 18:29:53 +02003366 fi
3367 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02003368 fi # sdl compile test
Peter Xuc6093a02018-04-10 13:40:34 +08003369}
3370
Daniel P. Berrangéa442fe22019-01-10 12:00:47 +00003371sdl_image_probe ()
3372{
3373 if test "$sdl_image" != "no" ; then
3374 if $pkg_config SDL2_image --exists; then
3375 if test "$static" = "yes"; then
3376 sdl_image_libs=$($pkg_config SDL2_image --libs --static 2>/dev/null)
3377 else
3378 sdl_image_libs=$($pkg_config SDL2_image --libs 2>/dev/null)
3379 fi
3380 sdl_image_cflags=$($pkg_config SDL2_image --cflags 2>/dev/null)
3381 sdl_image=yes
3382
3383 sdl_cflags="$sdl_cflags $sdl_image_cflags"
3384 sdl_libs="$sdl_libs $sdl_image_libs"
3385 else
3386 if test "$sdl_image" = "yes" ; then
3387 feature_not_found "sdl_image" "Install SDL Image devel"
3388 else
3389 sdl_image=no
3390 fi
3391 fi
3392 fi
3393}
3394
Peter Xuc6093a02018-04-10 13:40:34 +08003395if test "$sdl" != "no" ; then
3396 sdl_probe
Juan Quintelaa68551b2009-07-27 16:13:09 +02003397fi
bellard11d9f692004-04-02 20:55:59 +00003398
aliguori5368a422009-03-03 17:37:21 +00003399if test "$sdl" = "yes" ; then
Daniel P. Berrangéa442fe22019-01-10 12:00:47 +00003400 sdl_image_probe
3401else
3402 if test "$sdl_image" = "yes"; then
3403 echo "warning: SDL Image requested, but SDL is not available, disabling"
3404 fi
3405 sdl_image=no
3406fi
3407
3408if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02003409 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00003410#include <SDL.h>
3411#if defined(SDL_VIDEO_DRIVER_X11)
3412#include <X11/XKBlib.h>
3413#else
3414#error No x11 support
3415#endif
3416int main(void) { return 0; }
3417EOF
Jeremy Whitef676c672015-01-09 13:08:49 -06003418 if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then
Gerd Hoffmann87815952018-03-01 11:05:42 +01003419 need_x11=yes
Jeremy Whitef676c672015-01-09 13:08:49 -06003420 sdl_cflags="$sdl_cflags $x11_cflags"
3421 sdl_libs="$sdl_libs $x11_libs"
Juan Quintelaac119f92009-07-27 16:13:15 +02003422 fi
aliguori5368a422009-03-03 17:37:21 +00003423fi
3424
ths8f28f3f2007-01-05 21:25:54 +00003425##########################################
Michael R. Hines2da776d2013-07-22 10:01:54 -04003426# RDMA needs OpenFabrics libraries
3427if test "$rdma" != "no" ; then
3428 cat > $TMPC <<EOF
3429#include <rdma/rdma_cma.h>
3430int main(void) { return 0; }
3431EOF
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02003432 rdma_libs="-lrdmacm -libverbs -libumad"
Michael R. Hines2da776d2013-07-22 10:01:54 -04003433 if compile_prog "" "$rdma_libs" ; then
3434 rdma="yes"
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02003435 libs_softmmu="$libs_softmmu $rdma_libs"
Michael R. Hines2da776d2013-07-22 10:01:54 -04003436 else
3437 if test "$rdma" = "yes" ; then
3438 error_exit \
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02003439 " OpenFabrics librdmacm/libibverbs/libibumad not present." \
Michael R. Hines2da776d2013-07-22 10:01:54 -04003440 " Your options:" \
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02003441 " (1) Fast: Install infiniband packages (devel) from your distro." \
Michael R. Hines2da776d2013-07-22 10:01:54 -04003442 " (2) Cleanest: Install libraries from www.openfabrics.org" \
3443 " (3) Also: Install softiwarp if you don't have RDMA hardware"
3444 fi
3445 rdma="no"
3446 fi
3447fi
3448
Marcel Apfelbaum21ab34c2018-08-16 18:16:37 +03003449##########################################
3450# PVRDMA detection
3451
3452cat > $TMPC <<EOF &&
3453#include <sys/mman.h>
3454
3455int
3456main(void)
3457{
3458 char buf = 0;
3459 void *addr = &buf;
3460 addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED);
3461
3462 return 0;
3463}
3464EOF
3465
3466if test "$rdma" = "yes" ; then
3467 case "$pvrdma" in
3468 "")
3469 if compile_prog "" ""; then
3470 pvrdma="yes"
3471 else
3472 pvrdma="no"
3473 fi
3474 ;;
3475 "yes")
3476 if ! compile_prog "" ""; then
3477 error_exit "PVRDMA is not supported since mremap is not implemented"
3478 fi
3479 pvrdma="yes"
3480 ;;
3481 "no")
3482 pvrdma="no"
3483 ;;
3484 esac
3485else
3486 if test "$pvrdma" = "yes" ; then
3487 error_exit "PVRDMA requires rdma suppport"
3488 fi
3489 pvrdma="no"
3490fi
ths8d5d2d42007-08-25 01:37:51 +00003491
Yuval Shaiaee108582019-08-18 16:21:06 +03003492# Let's see if enhanced reg_mr is supported
3493if test "$pvrdma" = "yes" ; then
3494
3495cat > $TMPC <<EOF &&
3496#include <infiniband/verbs.h>
3497
3498int
3499main(void)
3500{
3501 struct ibv_mr *mr;
3502 struct ibv_pd *pd = NULL;
3503 size_t length = 10;
3504 uint64_t iova = 0;
3505 int access = 0;
3506 void *addr = NULL;
3507
3508 mr = ibv_reg_mr_iova(pd, addr, length, iova, access);
3509
3510 ibv_dereg_mr(mr);
3511
3512 return 0;
3513}
3514EOF
3515 if ! compile_prog "" "-libverbs"; then
3516 QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR"
3517 fi
3518fi
3519
ths8d5d2d42007-08-25 01:37:51 +00003520##########################################
aliguori2f9606b2009-03-06 20:27:28 +00003521# VNC SASL detection
Eric Blakee633a5c2019-02-04 20:39:37 -06003522if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02003523 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00003524#include <sasl/sasl.h>
3525#include <stdio.h>
3526int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
3527EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02003528 # Assuming Cyrus-SASL installed in /usr prefix
Philippe Mathieu-Daudébd702ff2020-03-09 13:24:53 +01003529 # QEMU defines struct iovec in "qemu/osdep.h",
3530 # we don't want libsasl to redefine it in <sasl/sasl.h>.
3531 vnc_sasl_cflags="-DSTRUCT_IOVEC_DEFINED"
Juan Quintelaea784e32009-08-12 18:20:29 +02003532 vnc_sasl_libs="-lsasl2"
3533 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
3534 vnc_sasl=yes
3535 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01003536 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
Juan Quintelaea784e32009-08-12 18:20:29 +02003537 else
3538 if test "$vnc_sasl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003539 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
aliguori2f9606b2009-03-06 20:27:28 +00003540 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02003541 vnc_sasl=no
3542 fi
aliguori2f9606b2009-03-06 20:27:28 +00003543fi
3544
3545##########################################
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003546# VNC JPEG detection
Eric Blakee633a5c2019-02-04 20:39:37 -06003547if test "$vnc" = "yes" && test "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003548cat > $TMPC <<EOF
3549#include <stdio.h>
3550#include <jpeglib.h>
3551int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
3552EOF
3553 vnc_jpeg_cflags=""
3554 vnc_jpeg_libs="-ljpeg"
3555 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
3556 vnc_jpeg=yes
3557 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01003558 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003559 else
3560 if test "$vnc_jpeg" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003561 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003562 fi
3563 vnc_jpeg=no
3564 fi
3565fi
3566
3567##########################################
Corentin Charyefe556a2010-07-07 20:57:56 +02003568# VNC PNG detection
Eric Blakee633a5c2019-02-04 20:39:37 -06003569if test "$vnc" = "yes" && test "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02003570cat > $TMPC <<EOF
3571//#include <stdio.h>
3572#include <png.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003573#include <stddef.h>
Corentin Charyefe556a2010-07-07 20:57:56 +02003574int main(void) {
3575 png_structp png_ptr;
3576 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
Peter Maydell7edc3fe2012-07-18 15:10:24 +01003577 return png_ptr != 0;
Corentin Charyefe556a2010-07-07 20:57:56 +02003578}
3579EOF
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003580 if $pkg_config libpng --exists; then
Stefan Weil89138852016-05-16 15:10:20 +02003581 vnc_png_cflags=$($pkg_config libpng --cflags)
3582 vnc_png_libs=$($pkg_config libpng --libs)
Brad9af80252011-07-30 01:45:55 -04003583 else
Corentin Charyefe556a2010-07-07 20:57:56 +02003584 vnc_png_cflags=""
3585 vnc_png_libs="-lpng"
Brad9af80252011-07-30 01:45:55 -04003586 fi
Corentin Charyefe556a2010-07-07 20:57:56 +02003587 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
3588 vnc_png=yes
3589 libs_softmmu="$vnc_png_libs $libs_softmmu"
Brad9af80252011-07-30 01:45:55 -04003590 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
Corentin Charyefe556a2010-07-07 20:57:56 +02003591 else
3592 if test "$vnc_png" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003593 feature_not_found "vnc-png" "Install libpng devel"
Corentin Charyefe556a2010-07-07 20:57:56 +02003594 fi
3595 vnc_png=no
3596 fi
3597fi
3598
3599##########################################
Gerd Hoffmann6a021532017-10-05 17:33:28 +02003600# xkbcommon probe
3601if test "$xkbcommon" != "no" ; then
3602 if $pkg_config xkbcommon --exists; then
3603 xkbcommon_cflags=$($pkg_config xkbcommon --cflags)
3604 xkbcommon_libs=$($pkg_config xkbcommon --libs)
3605 xkbcommon=yes
3606 else
3607 if test "$xkbcommon" = "yes" ; then
3608 feature_not_found "xkbcommon" "Install libxkbcommon-devel"
3609 fi
3610 xkbcommon=no
3611 fi
3612fi
3613
aliguori76655d62009-03-06 20:27:37 +00003614
3615##########################################
Eric Blakec1bb86c2016-12-02 13:48:54 -06003616# xfsctl() probe, used for file-posix.c
Christoph Hellwigdce512d2010-12-17 11:41:15 +01003617if test "$xfs" != "no" ; then
3618 cat > $TMPC << EOF
Stefan Weilffc41d12011-12-17 09:27:36 +01003619#include <stddef.h> /* NULL */
Christoph Hellwigdce512d2010-12-17 11:41:15 +01003620#include <xfs/xfs.h>
3621int main(void)
3622{
3623 xfsctl(NULL, 0, 0, NULL);
3624 return 0;
3625}
3626EOF
3627 if compile_prog "" "" ; then
3628 xfs="yes"
3629 else
3630 if test "$xfs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003631 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01003632 fi
3633 xfs=no
3634 fi
3635fi
3636
3637##########################################
ths8a16d272008-07-19 09:56:24 +00003638# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02003639if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02003640 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00003641 cat > $TMPC << EOF
3642#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00003643int main(void)
3644{
3645 struct vde_open_args a = {0, 0, 0};
Peter Maydellfea08e02012-07-18 15:10:25 +01003646 char s[] = "";
3647 vde_open(s, s, &a);
pbrook4a7f0e02008-09-07 16:42:53 +00003648 return 0;
3649}
ths8a16d272008-07-19 09:56:24 +00003650EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003651 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02003652 vde=yes
Juan Quinteladfb278b2009-08-12 18:20:27 +02003653 else
3654 if test "$vde" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003655 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
Juan Quinteladfb278b2009-08-12 18:20:27 +02003656 fi
3657 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02003658 fi
ths8a16d272008-07-19 09:56:24 +00003659fi
3660
3661##########################################
Vincenzo Maffione0a985b32014-02-20 15:40:43 +01003662# netmap support probe
3663# Apart from looking for netmap headers, we make sure that the host API version
3664# supports the netmap backend (>=11). The upper bound (15) is meant to simulate
3665# a minor/major version number. Minor new features will be marked with values up
3666# to 15, and if something happens that requires a change to the backend we will
3667# move above 15, submit the backend fixes and modify this two bounds.
Vincenzo Maffione58952132013-11-06 11:44:06 +01003668if test "$netmap" != "no" ; then
3669 cat > $TMPC << EOF
3670#include <inttypes.h>
3671#include <net/if.h>
3672#include <net/netmap.h>
3673#include <net/netmap_user.h>
Vincenzo Maffione0a985b32014-02-20 15:40:43 +01003674#if (NETMAP_API < 11) || (NETMAP_API > 15)
3675#error
3676#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01003677int main(void) { return 0; }
3678EOF
3679 if compile_prog "" "" ; then
3680 netmap=yes
3681 else
3682 if test "$netmap" = "yes" ; then
3683 feature_not_found "netmap"
3684 fi
3685 netmap=no
3686 fi
3687fi
3688
3689##########################################
Corey Bryant47e98652012-01-26 09:42:26 -05003690# libcap-ng library probe
3691if test "$cap_ng" != "no" ; then
3692 cap_libs="-lcap-ng"
3693 cat > $TMPC << EOF
3694#include <cap-ng.h>
3695int main(void)
3696{
3697 capng_capability_to_name(CAPNG_EFFECTIVE);
3698 return 0;
3699}
3700EOF
3701 if compile_prog "" "$cap_libs" ; then
3702 cap_ng=yes
3703 libs_tools="$cap_libs $libs_tools"
3704 else
3705 if test "$cap_ng" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003706 feature_not_found "cap_ng" "Install libcap-ng devel"
Corey Bryant47e98652012-01-26 09:42:26 -05003707 fi
3708 cap_ng=no
3709 fi
3710fi
3711
3712##########################################
malcc2de5c92008-06-28 19:13:06 +00003713# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00003714
Stefan Weil89138852016-05-16 15:10:20 +02003715audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g')
malcc2de5c92008-06-28 19:13:06 +00003716for drv in $audio_drv_list; do
3717 case $drv in
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003718 alsa | try-alsa)
Gerd Hoffmannc80a8672019-01-24 12:20:50 +01003719 if $pkg_config alsa --exists; then
3720 alsa_libs=$($pkg_config alsa --libs)
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003721 if test "$drv" = "try-alsa"; then
3722 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/')
3723 fi
Gerd Hoffmannc80a8672019-01-24 12:20:50 +01003724 else
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003725 if test "$drv" = "try-alsa"; then
3726 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa//')
3727 else
3728 error_exit "$drv check failed" \
3729 "Make sure to have the $drv libs and headers installed."
3730 fi
Gerd Hoffmannc80a8672019-01-24 12:20:50 +01003731 fi
malcc2de5c92008-06-28 19:13:06 +00003732 ;;
3733
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003734 pa | try-pa)
Gerd Hoffmannc80a8672019-01-24 12:20:50 +01003735 if $pkg_config libpulse --exists; then
3736 pulse_libs=$($pkg_config libpulse --libs)
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003737 if test "$drv" = "try-pa"; then
3738 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/')
3739 fi
Gerd Hoffmannc80a8672019-01-24 12:20:50 +01003740 else
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003741 if test "$drv" = "try-pa"; then
3742 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa//')
3743 else
3744 error_exit "$drv check failed" \
3745 "Make sure to have the $drv libs and headers installed."
3746 fi
Gerd Hoffmannc80a8672019-01-24 12:20:50 +01003747 fi
malcb8e59f12008-07-02 21:03:08 +00003748 ;;
3749
Gerd Hoffmann373967b2017-03-20 10:05:43 +01003750 sdl)
3751 if test "$sdl" = "no"; then
3752 error_exit "sdl not found or disabled, can not use sdl audio driver"
3753 fi
3754 ;;
3755
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003756 try-sdl)
3757 if test "$sdl" = "no"; then
3758 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl//')
3759 else
3760 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl/sdl/')
3761 fi
3762 ;;
3763
Juan Quintela997e6902009-08-03 14:46:29 +02003764 coreaudio)
Fam Zhengb1149912017-09-07 16:29:13 +08003765 coreaudio_libs="-framework CoreAudio"
Juan Quintela997e6902009-08-03 14:46:29 +02003766 ;;
3767
Juan Quintelaa4bf6782009-08-03 14:46:30 +02003768 dsound)
Fam Zhengb1149912017-09-07 16:29:13 +08003769 dsound_libs="-lole32 -ldxguid"
malcd5631632009-10-10 01:13:41 +04003770 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02003771 ;;
3772
3773 oss)
Fam Zhengb1149912017-09-07 16:29:13 +08003774 oss_libs="$oss_lib"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02003775 ;;
3776
Geoffrey McRae2e445702020-04-29 15:53:58 +10003777 jack | try-jack)
3778 if $pkg_config jack --exists; then
3779 jack_libs=$($pkg_config jack --libs)
3780 if test "$drv" = "try-jack"; then
3781 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack/jack/')
3782 fi
3783 else
3784 if test "$drv" = "try-jack"; then
3785 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack//')
3786 else
3787 error_exit "$drv check failed" \
3788 "Make sure to have the $drv libs and headers installed."
3789 fi
3790 fi
3791 ;;
3792
malce4c63a62008-07-19 16:15:16 +00003793 *)
malc1c9b2a52008-07-19 16:57:30 +00003794 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
Peter Maydell76ad07a2013-04-08 12:11:26 +01003795 error_exit "Unknown driver '$drv' selected" \
3796 "Possible drivers are: $audio_possible_drivers"
malce4c63a62008-07-19 16:15:16 +00003797 }
3798 ;;
malcc2de5c92008-06-28 19:13:06 +00003799 esac
3800done
ths8f28f3f2007-01-05 21:25:54 +00003801
balrog4d3b6f62008-02-10 16:33:14 +00003802##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00003803# BrlAPI probe
3804
Juan Quintela4ffcedb2009-08-12 18:20:26 +02003805if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02003806 brlapi_libs="-lbrlapi"
3807 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00003808#include <brlapi.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003809#include <stddef.h>
aurel322e4d9fb2008-04-08 06:01:02 +00003810int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
3811EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003812 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02003813 brlapi=yes
Juan Quintela4ffcedb2009-08-12 18:20:26 +02003814 else
3815 if test "$brlapi" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003816 feature_not_found "brlapi" "Install brlapi devel"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02003817 fi
3818 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02003819 fi
3820fi
aurel322e4d9fb2008-04-08 06:01:02 +00003821
3822##########################################
Samuel Thibaulte08bb302019-03-11 14:51:26 +01003823# iconv probe
3824if test "$iconv" != "no" ; then
3825 cat > $TMPC << EOF
3826#include <iconv.h>
3827int main(void) {
3828 iconv_t conv = iconv_open("WCHAR_T", "UCS-2");
3829 return conv != (iconv_t) -1;
3830}
3831EOF
3832 iconv_prefix_list="/usr/local:/usr"
3833 iconv_lib_list=":-liconv"
3834 IFS=:
3835 for iconv_prefix in $iconv_prefix_list; do
3836 IFS=:
3837 iconv_cflags="-I$iconv_prefix/include"
3838 iconv_ldflags="-L$iconv_prefix/lib"
3839 for iconv_link in $iconv_lib_list; do
3840 unset IFS
3841 iconv_lib="$iconv_ldflags $iconv_link"
3842 echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log
3843 if compile_prog "$iconv_cflags" "$iconv_lib" ; then
3844 iconv_found=yes
3845 break
3846 fi
3847 done
3848 if test "$iconv_found" = yes ; then
3849 break
3850 fi
3851 done
3852 if test "$iconv_found" = "yes" ; then
3853 iconv=yes
3854 else
3855 if test "$iconv" = "yes" ; then
3856 feature_not_found "iconv" "Install iconv devel"
3857 fi
3858 iconv=no
3859 fi
3860fi
3861
3862##########################################
balrog4d3b6f62008-02-10 16:33:14 +00003863# curses probe
Samuel Thibaulte08bb302019-03-11 14:51:26 +01003864if test "$iconv" = "no" ; then
3865 # curses will need iconv
3866 curses=no
3867fi
Juan Quintelac584a6d2009-08-12 18:20:30 +02003868if test "$curses" != "no" ; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04003869 if test "$mingw32" = "yes" ; then
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003870 curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
3871 curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
Michael Tokareva3605bf2013-05-25 13:17:21 +04003872 else
Samuel Thibault7c703002016-11-09 11:27:52 +01003873 curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003874 curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
Michael Tokareva3605bf2013-05-25 13:17:21 +04003875 fi
Juan Quintelac584a6d2009-08-12 18:20:30 +02003876 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00003877 cat > $TMPC << EOF
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003878#include <locale.h>
balrog4d3b6f62008-02-10 16:33:14 +00003879#include <curses.h>
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003880#include <wchar.h>
Samuel Thibault2f8b7cd2019-03-11 14:51:27 +01003881#include <langinfo.h>
Stefan Weilef9a2522011-12-17 17:46:02 +01003882int main(void) {
Samuel Thibault2f8b7cd2019-03-11 14:51:27 +01003883 const char *codeset;
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003884 wchar_t wch = L'w';
3885 setlocale(LC_ALL, "");
Stefan Weilef9a2522011-12-17 17:46:02 +01003886 resize_term(0, 0);
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003887 addwstr(L"wide chars\n");
3888 addnwstr(&wch, 1);
Samuel Thibault7c703002016-11-09 11:27:52 +01003889 add_wch(WACS_DEGREE);
Samuel Thibault2f8b7cd2019-03-11 14:51:27 +01003890 codeset = nl_langinfo(CODESET);
3891 return codeset != 0;
Stefan Weilef9a2522011-12-17 17:46:02 +01003892}
balrog4d3b6f62008-02-10 16:33:14 +00003893EOF
Vadim Evardecbe2512013-01-15 16:17:24 +04003894 IFS=:
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003895 for curses_inc in $curses_inc_list; do
Peter Maydellb01a4fd2017-06-02 15:35:38 +01003896 # Make sure we get the wide character prototypes
3897 curses_inc="-DNCURSES_WIDECHAR $curses_inc"
Samuel Thibault7c703002016-11-09 11:27:52 +01003898 IFS=:
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003899 for curses_lib in $curses_lib_list; do
3900 unset IFS
3901 if compile_prog "$curses_inc" "$curses_lib" ; then
3902 curses_found=yes
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003903 break
3904 fi
3905 done
Samuel Thibault7c703002016-11-09 11:27:52 +01003906 if test "$curses_found" = yes ; then
3907 break
3908 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02003909 done
Vadim Evardecbe2512013-01-15 16:17:24 +04003910 unset IFS
Juan Quintelac584a6d2009-08-12 18:20:30 +02003911 if test "$curses_found" = "yes" ; then
3912 curses=yes
3913 else
3914 if test "$curses" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003915 feature_not_found "curses" "Install ncurses devel"
Juan Quintelac584a6d2009-08-12 18:20:30 +02003916 fi
3917 curses=no
3918 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02003919fi
balrog4d3b6f62008-02-10 16:33:14 +00003920
blueswir1414f0da2008-08-15 18:20:52 +00003921##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02003922# curl probe
Juan Quintela788c8192009-08-12 18:29:47 +02003923if test "$curl" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003924 if $pkg_config libcurl --exists; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04003925 curlconfig="$pkg_config libcurl"
3926 else
3927 curlconfig=curl-config
3928 fi
Alexander Graf769ce762009-05-11 17:41:42 +02003929 cat > $TMPC << EOF
3930#include <curl/curl.h>
Peter Maydell0b862ce2011-06-09 22:54:29 +01003931int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
Alexander Graf769ce762009-05-11 17:41:42 +02003932EOF
Stefan Weil89138852016-05-16 15:10:20 +02003933 curl_cflags=$($curlconfig --cflags 2>/dev/null)
3934 curl_libs=$($curlconfig --libs 2>/dev/null)
Juan Quintelab1d5a272009-08-03 14:46:05 +02003935 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02003936 curl=yes
Juan Quintela788c8192009-08-12 18:29:47 +02003937 else
3938 if test "$curl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003939 feature_not_found "curl" "Install libcurl devel"
Juan Quintela788c8192009-08-12 18:29:47 +02003940 fi
3941 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02003942 fi
3943fi # test "$curl"
3944
3945##########################################
Anthony Liguorie18df142011-07-19 14:50:29 -05003946# glib support probe
Paolo Bonzinia52d28a2012-04-05 13:01:54 +02003947
Daniel P. Berrangé00f2cfb2018-05-04 15:34:46 +01003948glib_req_ver=2.48
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01003949glib_modules=gthread-2.0
3950if test "$modules" = yes; then
Gerd Hoffmanna88afc62018-03-08 09:53:00 +01003951 glib_modules="$glib_modules gmodule-export-2.0"
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01003952fi
Emilio G. Cota54cb65d2017-08-30 18:39:53 -04003953if test "$plugins" = yes; then
3954 glib_modules="$glib_modules gmodule-2.0"
3955fi
Fam Zhenge26110c2014-02-10 14:48:57 +08003956
Sameeh Jubran4eaf7202017-03-26 12:56:22 +03003957# This workaround is required due to a bug in pkg-config file for glib as it
3958# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
3959
Eric Blakee633a5c2019-02-04 20:39:37 -06003960if test "$static" = yes && test "$mingw32" = yes; then
Sameeh Jubran4eaf7202017-03-26 12:56:22 +03003961 QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS"
3962fi
3963
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01003964for i in $glib_modules; do
Fam Zhenge26110c2014-02-10 14:48:57 +08003965 if $pkg_config --atleast-version=$glib_req_ver $i; then
Stefan Weil89138852016-05-16 15:10:20 +02003966 glib_cflags=$($pkg_config --cflags $i)
3967 glib_libs=$($pkg_config --libs $i)
Marc-André Lureau4a058892016-09-26 00:57:48 +04003968 QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
Fam Zhenge26110c2014-02-10 14:48:57 +08003969 LIBS="$glib_libs $LIBS"
3970 libs_qga="$glib_libs $libs_qga"
3971 else
3972 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
3973 fi
3974done
3975
Marc-André Lureauf876b762019-02-21 12:07:00 +01003976if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
3977 gio=yes
3978 gio_cflags=$($pkg_config --cflags gio-2.0)
3979 gio_libs=$($pkg_config --libs gio-2.0)
Marc-André Lureau25a97a52019-09-27 11:34:42 +04003980 gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0)
Marc-André Lureau0dba4892020-01-10 15:27:25 +04003981 if [ ! -x "$gdbus_codegen" ]; then
3982 gdbus_codegen=
3983 fi
Marc-André Lureauf876b762019-02-21 12:07:00 +01003984else
3985 gio=no
3986fi
3987
Marc-André Lureau25a97a52019-09-27 11:34:42 +04003988if $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then
3989 gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)"
3990 gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)"
3991fi
3992
Daniel P. Berrange977a82a2016-01-27 09:00:45 +00003993# Sanity check that the current size_t matches the
3994# size that glib thinks it should be. This catches
3995# problems on multi-arch where people try to build
3996# 32-bit QEMU while pointing at 64-bit glib headers
3997cat > $TMPC <<EOF
3998#include <glib.h>
3999#include <unistd.h>
4000
4001#define QEMU_BUILD_BUG_ON(x) \
4002 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
4003
4004int main(void) {
4005 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
4006 return 0;
4007}
4008EOF
4009
Stefan Weil5919e032016-04-28 23:33:41 +02004010if ! compile_prog "$CFLAGS" "$LIBS" ; then
Daniel P. Berrange977a82a2016-01-27 09:00:45 +00004011 error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
4012 "You probably need to set PKG_CONFIG_LIBDIR"\
4013 "to point to the right pkg-config files for your"\
4014 "build target"
4015fi
4016
John Snowbbbf2e02015-03-25 18:57:38 -04004017# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage
4018cat > $TMPC << EOF
4019#include <glib.h>
4020int main(void) { return 0; }
4021EOF
4022if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
4023 if cc_has_warning_flag "-Wno-unknown-attributes"; then
4024 glib_cflags="-Wno-unknown-attributes $glib_cflags"
Paolo Bonzini086d5f72020-02-03 15:22:17 +01004025 QEMU_CFLAGS="-Wno-unknown-attributes $CFLAGS"
John Snowbbbf2e02015-03-25 18:57:38 -04004026 fi
4027fi
4028
Eric Blake9bda6002020-03-17 12:55:34 -05004029# Silence clang warnings triggered by glib < 2.57.2
4030cat > $TMPC << EOF
4031#include <glib.h>
4032typedef struct Foo {
4033 int i;
4034} Foo;
4035static void foo_free(Foo *f)
4036{
4037 g_free(f);
4038}
4039G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free);
4040int main(void) { return 0; }
4041EOF
4042if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
4043 if cc_has_warning_flag "-Wno-unused-function"; then
4044 glib_cflags="$glib_cflags -Wno-unused-function"
4045 CFLAGS="$CFLAGS -Wno-unused-function"
4046 fi
4047fi
4048
Stefan Weil6a1f42b2018-07-12 21:26:03 +02004049#########################################
4050# zlib check
4051
4052if test "$zlib" != "no" ; then
4053 if $pkg_config --exists zlib; then
4054 zlib_cflags=$($pkg_config --cflags zlib)
4055 zlib_libs=$($pkg_config --libs zlib)
4056 QEMU_CFLAGS="$zlib_cflags $QEMU_CFLAGS"
4057 LIBS="$zlib_libs $LIBS"
4058 else
4059 cat > $TMPC << EOF
4060#include <zlib.h>
4061int main(void) { zlibVersion(); return 0; }
4062EOF
4063 if compile_prog "" "-lz" ; then
4064 LIBS="$LIBS -lz"
4065 else
4066 error_exit "zlib check failed" \
4067 "Make sure to have the zlib libs and headers installed."
4068 fi
4069 fi
4070fi
4071
Fam Zhenge26110c2014-02-10 14:48:57 +08004072##########################################
4073# SHA command probe for modules
4074if test "$modules" = yes; then
4075 shacmd_probe="sha1sum sha1 shasum"
4076 for c in $shacmd_probe; do
Fam Zheng8ccefb92014-12-04 14:18:16 +08004077 if has $c; then
Fam Zhenge26110c2014-02-10 14:48:57 +08004078 shacmd="$c"
4079 break
4080 fi
4081 done
4082 if test "$shacmd" = ""; then
4083 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
4084 fi
Anthony Liguorie18df142011-07-19 14:50:29 -05004085fi
4086
4087##########################################
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02004088# pixman support probe
4089
Thomas Huth9b52b172020-07-23 16:11:23 +02004090if test "$softmmu" = "no"; then
Robert Schiele74880fe2012-12-04 16:58:08 +01004091 pixman_cflags=
4092 pixman_libs=
Gerd Hoffmann35c4e862017-09-05 16:01:16 +02004093elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
Stefan Weil89138852016-05-16 15:10:20 +02004094 pixman_cflags=$($pkg_config --cflags pixman-1)
4095 pixman_libs=$($pkg_config --libs pixman-1)
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02004096else
Gerd Hoffmannc12b6d72017-09-05 16:01:15 +02004097 error_exit "pixman >= 0.21.8 not present." \
4098 "Please install the pixman devel package."
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02004099fi
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02004100
4101##########################################
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02004102# libmpathpersist probe
4103
4104if test "$mpath" != "no" ; then
Murilo Opsfelder Araujo1b0578f2018-08-10 11:11:16 -03004105 # probe for the new API
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02004106 cat > $TMPC <<EOF
4107#include <libudev.h>
4108#include <mpath_persist.h>
4109unsigned mpath_mx_alloc_len = 1024;
4110int logsink;
Paolo Bonzinib3f1c8c2017-10-17 20:11:58 +02004111static struct config *multipath_conf;
4112extern struct udev *udev;
4113extern struct config *get_multipath_config(void);
4114extern void put_multipath_config(struct config *conf);
4115struct udev *udev;
4116struct config *get_multipath_config(void) { return multipath_conf; }
4117void put_multipath_config(struct config *conf) { }
4118
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02004119int main(void) {
Paolo Bonzinib3f1c8c2017-10-17 20:11:58 +02004120 udev = udev_new();
4121 multipath_conf = mpath_lib_init();
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02004122 return 0;
4123}
4124EOF
4125 if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then
4126 mpathpersist=yes
Murilo Opsfelder Araujo1b0578f2018-08-10 11:11:16 -03004127 mpathpersist_new_api=yes
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02004128 else
Murilo Opsfelder Araujo1b0578f2018-08-10 11:11:16 -03004129 # probe for the old API
4130 cat > $TMPC <<EOF
4131#include <libudev.h>
4132#include <mpath_persist.h>
4133unsigned mpath_mx_alloc_len = 1024;
4134int logsink;
4135int main(void) {
4136 struct udev *udev = udev_new();
4137 mpath_lib_init(udev);
4138 return 0;
4139}
4140EOF
4141 if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then
4142 mpathpersist=yes
4143 mpathpersist_new_api=no
4144 else
4145 mpathpersist=no
4146 fi
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02004147 fi
4148else
4149 mpathpersist=no
4150fi
4151
4152##########################################
aliguorie5d355d2009-04-24 18:03:15 +00004153# pthread probe
Brad4b29ec42011-08-07 20:02:11 -04004154PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00004155
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02004156pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00004157cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00004158#include <pthread.h>
Stefan Weil7a42bbe2011-12-17 09:27:32 +01004159static void *f(void *p) { return NULL; }
4160int main(void) {
4161 pthread_t thread;
4162 pthread_create(&thread, 0, f, 0);
4163 return 0;
4164}
blueswir1414f0da2008-08-15 18:20:52 +00004165EOF
Andreas Färberbd00d532010-09-20 00:50:44 +02004166if compile_prog "" "" ; then
4167 pthread=yes
4168else
4169 for pthread_lib in $PTHREADLIBS_LIST; do
4170 if compile_prog "" "$pthread_lib" ; then
4171 pthread=yes
Peter Portantee3c56762012-04-20 10:36:12 -04004172 found=no
4173 for lib_entry in $LIBS; do
4174 if test "$lib_entry" = "$pthread_lib"; then
4175 found=yes
4176 break
4177 fi
4178 done
4179 if test "$found" = "no"; then
4180 LIBS="$pthread_lib $LIBS"
Marc-André Lureau14ab3aa2018-01-04 17:05:06 +01004181 libs_qga="$pthread_lib $libs_qga"
Peter Portantee3c56762012-04-20 10:36:12 -04004182 fi
Daniel P. Berrange409437e2016-07-20 14:23:13 +01004183 PTHREAD_LIB="$pthread_lib"
Andreas Färberbd00d532010-09-20 00:50:44 +02004184 break
4185 fi
4186 done
4187fi
blueswir1414f0da2008-08-15 18:20:52 +00004188
Eric Blakee633a5c2019-02-04 20:39:37 -06004189if test "$mingw32" != yes && test "$pthread" = no; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01004190 error_exit "pthread check failed" \
4191 "Make sure to have the pthread libs and headers installed."
aliguorie5d355d2009-04-24 18:03:15 +00004192fi
4193
Roman Bolshakov479a5742018-12-17 23:26:01 +03004194# check for pthread_setname_np with thread id
4195pthread_setname_np_w_tid=no
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00004196cat > $TMPC << EOF
4197#include <pthread.h>
4198
4199static void *f(void *p) { return NULL; }
4200int main(void)
4201{
4202 pthread_t thread;
4203 pthread_create(&thread, 0, f, 0);
4204 pthread_setname_np(thread, "QEMU");
4205 return 0;
4206}
4207EOF
4208if compile_prog "" "$pthread_lib" ; then
Roman Bolshakov479a5742018-12-17 23:26:01 +03004209 pthread_setname_np_w_tid=yes
4210fi
4211
4212# check for pthread_setname_np without thread id
4213pthread_setname_np_wo_tid=no
4214cat > $TMPC << EOF
4215#include <pthread.h>
4216
Thomas Huth12a9b8d2020-07-16 07:12:22 +02004217static void *f(void *p) { pthread_setname_np("QEMU"); return NULL; }
Roman Bolshakov479a5742018-12-17 23:26:01 +03004218int main(void)
4219{
4220 pthread_t thread;
4221 pthread_create(&thread, 0, f, 0);
4222 return 0;
4223}
4224EOF
4225if compile_prog "" "$pthread_lib" ; then
4226 pthread_setname_np_wo_tid=yes
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00004227fi
4228
aliguoribf9298b2008-12-05 20:05:26 +00004229##########################################
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004230# rbd probe
4231if test "$rbd" != "no" ; then
4232 cat > $TMPC <<EOF
4233#include <stdio.h>
Josh Durginad32e9c2011-05-26 16:07:31 -07004234#include <rbd/librbd.h>
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004235int main(void) {
Josh Durginad32e9c2011-05-26 16:07:31 -07004236 rados_t cluster;
4237 rados_create(&cluster, NULL);
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004238 return 0;
4239}
4240EOF
Josh Durginad32e9c2011-05-26 16:07:31 -07004241 rbd_libs="-lrbd -lrados"
4242 if compile_prog "" "$rbd_libs" ; then
4243 rbd=yes
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004244 else
4245 if test "$rbd" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11004246 feature_not_found "rados block device" "Install librbd/ceph devel"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004247 fi
4248 rbd=no
4249 fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004250fi
4251
4252##########################################
Pino Toscanob10d49d2019-06-20 22:08:40 +02004253# libssh probe
4254if test "$libssh" != "no" ; then
4255 if $pkg_config --exists libssh; then
4256 libssh_cflags=$($pkg_config libssh --cflags)
4257 libssh_libs=$($pkg_config libssh --libs)
4258 libssh=yes
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004259 else
Pino Toscanob10d49d2019-06-20 22:08:40 +02004260 if test "$libssh" = "yes" ; then
4261 error_exit "libssh required for --enable-libssh"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004262 fi
Pino Toscanob10d49d2019-06-20 22:08:40 +02004263 libssh=no
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004264 fi
4265fi
4266
4267##########################################
Pino Toscanob10d49d2019-06-20 22:08:40 +02004268# Check for libssh 0.8
4269# This is done like this instead of using the LIBSSH_VERSION_* and
4270# SSH_VERSION_* macros because some distributions in the past shipped
4271# snapshots of the future 0.8 from Git, and those snapshots did not
4272# have updated version numbers (still referring to 0.7.0).
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01004273
Pino Toscanob10d49d2019-06-20 22:08:40 +02004274if test "$libssh" = "yes"; then
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01004275 cat > $TMPC <<EOF
Pino Toscanob10d49d2019-06-20 22:08:40 +02004276#include <libssh/libssh.h>
4277int main(void) { return ssh_get_server_publickey(NULL, NULL); }
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01004278EOF
Pino Toscanob10d49d2019-06-20 22:08:40 +02004279 if compile_prog "$libssh_cflags" "$libssh_libs"; then
4280 libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags"
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01004281 fi
4282fi
4283
4284##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004285# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004286
4287if test "$linux_aio" != "no" ; then
4288 cat > $TMPC <<EOF
4289#include <libaio.h>
4290#include <sys/eventfd.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05004291#include <stddef.h>
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004292int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
4293EOF
4294 if compile_prog "" "-laio" ; then
4295 linux_aio=yes
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004296 else
4297 if test "$linux_aio" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11004298 feature_not_found "linux AIO" "Install libaio devel"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004299 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03004300 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004301 fi
4302fi
Aarushi Mehtac10dd852020-01-20 14:18:44 +00004303##########################################
4304# linux-io-uring probe
4305
4306if test "$linux_io_uring" != "no" ; then
4307 if $pkg_config liburing; then
4308 linux_io_uring_cflags=$($pkg_config --cflags liburing)
4309 linux_io_uring_libs=$($pkg_config --libs liburing)
4310 linux_io_uring=yes
Stefan Hajnoczi73fd2822020-03-05 17:08:04 +00004311
4312 # io_uring is used in libqemuutil.a where per-file -libs variables are not
4313 # seen by programs linking the archive. It's not ideal, but just add the
4314 # library dependency globally.
4315 LIBS="$linux_io_uring_libs $LIBS"
Aarushi Mehtac10dd852020-01-20 14:18:44 +00004316 else
4317 if test "$linux_io_uring" = "yes" ; then
4318 feature_not_found "linux io_uring" "Install liburing devel"
4319 fi
4320 linux_io_uring=no
4321 fi
4322fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004323
4324##########################################
Paolo Bonzini7aaa6a12019-01-23 14:56:07 +08004325# TPM emulation is only on POSIX
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01004326
Paolo Bonzini7aaa6a12019-01-23 14:56:07 +08004327if test "$tpm" = ""; then
4328 if test "$mingw32" = "yes"; then
4329 tpm=no
4330 else
4331 tpm=yes
4332 fi
4333elif test "$tpm" = "yes"; then
4334 if test "$mingw32" = "yes" ; then
4335 error_exit "TPM emulation only available on POSIX systems"
4336 fi
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01004337fi
4338
4339##########################################
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004340# attr probe
4341
4342if test "$attr" != "no" ; then
4343 cat > $TMPC <<EOF
4344#include <stdio.h>
4345#include <sys/types.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04004346#ifdef CONFIG_LIBATTR
4347#include <attr/xattr.h>
4348#else
Avi Kivity4f26f2b2011-11-09 14:44:52 +02004349#include <sys/xattr.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04004350#endif
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004351int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
4352EOF
Avi Kivity4f26f2b2011-11-09 14:44:52 +02004353 if compile_prog "" "" ; then
4354 attr=yes
4355 # Older distros have <attr/xattr.h>, and need -lattr:
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04004356 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004357 attr=yes
4358 LIBS="-lattr $LIBS"
Avi Kivity4f26f2b2011-11-09 14:44:52 +02004359 libattr=yes
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004360 else
4361 if test "$attr" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11004362 feature_not_found "ATTR" "Install libc6 or libattr devel"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004363 fi
4364 attr=no
4365 fi
4366fi
4367
4368##########################################
aliguoribf9298b2008-12-05 20:05:26 +00004369# iovec probe
4370cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00004371#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00004372#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00004373#include <unistd.h>
Stefan Weilf91f9be2011-12-17 09:27:33 +01004374int main(void) { return sizeof(struct iovec); }
aliguoribf9298b2008-12-05 20:05:26 +00004375EOF
4376iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02004377if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00004378 iovec=yes
4379fi
4380
aurel32f652e6a2008-12-16 10:43:48 +00004381##########################################
aliguoriceb42de2009-04-07 18:43:28 +00004382# preadv probe
4383cat > $TMPC <<EOF
4384#include <sys/types.h>
4385#include <sys/uio.h>
4386#include <unistd.h>
Blue Swirlc075a722012-08-09 20:21:25 +00004387int main(void) { return preadv(0, 0, 0, 0); }
aliguoriceb42de2009-04-07 18:43:28 +00004388EOF
4389preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02004390if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00004391 preadv=yes
4392fi
4393
4394##########################################
aurel32f652e6a2008-12-16 10:43:48 +00004395# fdt probe
Peter Maydelle169e1e2013-05-24 16:26:54 +01004396# fdt support is mandatory for at least some target architectures,
4397# so insist on it if we're building those system emulators.
4398fdt_required=no
4399for target in $target_list; do
4400 case $target in
Yoshinori Satoc8c35e52019-01-21 05:18:59 -08004401 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu|rx-softmmu)
Peter Maydelle169e1e2013-05-24 16:26:54 +01004402 fdt_required=yes
4403 ;;
4404 esac
4405done
4406
4407if test "$fdt_required" = "yes"; then
4408 if test "$fdt" = "no"; then
4409 error_exit "fdt disabled but some requested targets require it." \
4410 "You can turn off fdt only if you also disable all the system emulation" \
4411 "targets which need it (by specifying a cut down --target-list)."
4412 fi
4413 fdt=yes
Philippe Mathieu-Daudé7ba4a4d2020-01-18 15:06:14 +01004414elif test "$fdt" != "yes" ; then
4415 fdt=no
Peter Maydelle169e1e2013-05-24 16:26:54 +01004416fi
4417
Laurent Vivierd5999382019-06-21 15:05:44 +02004418# fdt is only required when building softmmu targets
4419if test -z "$fdt" -a "$softmmu" != "yes" ; then
4420 fdt="no"
4421fi
4422
Juan Quintela2df87df2009-08-12 18:29:54 +02004423if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02004424 fdt_libs="-lfdt"
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10004425 # explicitly check for libfdt_env.h as it is missing in some stable installs
Paul Burton6e85fce2016-09-08 15:51:55 +01004426 # and test for required functions to make sure we are on a version >= 1.4.2
Juan Quintelab41af4b2009-07-27 16:13:20 +02004427 cat > $TMPC << EOF
Thomas Huth31ce0ad2015-05-18 12:59:49 +02004428#include <libfdt.h>
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10004429#include <libfdt_env.h>
Alexey Kardashevskiyfea35ca2018-12-21 01:34:48 +01004430int main(void) { fdt_check_full(NULL, 0); return 0; }
aurel32f652e6a2008-12-16 10:43:48 +00004431EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004432 if compile_prog "" "$fdt_libs" ; then
Peter Crosthwaitea540f152013-04-18 14:47:31 +10004433 # system DTC is good - use it
Philippe Mathieu-Daudée3971d62018-04-15 20:05:20 -03004434 fdt=system
Peter Crosthwaitea540f152013-04-18 14:47:31 +10004435 else
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01004436 # have GIT checkout, so activate dtc submodule
4437 if test -e "${source_path}/.git" ; then
4438 git_submodules="${git_submodules} dtc"
4439 fi
4440 if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
Philippe Mathieu-Daudée3971d62018-04-15 20:05:20 -03004441 fdt=git
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01004442 mkdir -p dtc
4443 if [ "$pwd_is_source_path" != "y" ] ; then
4444 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01004445 fi
Paolo Bonzini25211442019-06-10 12:03:04 +02004446 fdt_cflags="-I${source_path}/dtc/libfdt"
4447 fdt_ldflags="-L$PWD/dtc/libfdt"
Philippe Mathieu-Daudé8a99e9a2018-04-15 20:05:19 -03004448 fdt_libs="$fdt_libs"
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01004449 elif test "$fdt" = "yes" ; then
4450 # Not a git build & no libfdt found, prompt for system install
4451 error_exit "DTC (libfdt) version >= 1.4.2 not present." \
4452 "Please install the DTC (libfdt) devel package"
4453 else
4454 # don't have and don't want
4455 fdt_libs=
4456 fdt=no
4457 fi
aurel32f652e6a2008-12-16 10:43:48 +00004458 fi
4459fi
4460
Peter Crosthwaitea540f152013-04-18 14:47:31 +10004461libs_softmmu="$libs_softmmu $fdt_libs"
4462
Michael Walle20ff0752011-03-07 23:32:39 +01004463##########################################
OGAWA Hirofumifb719562015-10-27 02:45:48 +09004464# opengl probe (for sdl2, gtk, milkymist-tmu2)
Gerd Hoffmannb1546f32015-03-16 10:03:53 +01004465
Marc-André Lureaud52c4542019-05-24 15:09:42 +02004466gbm="no"
4467if $pkg_config gbm; then
4468 gbm_cflags="$($pkg_config --cflags gbm)"
4469 gbm_libs="$($pkg_config --libs gbm)"
4470 gbm="yes"
4471fi
4472
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01004473if test "$opengl" != "no" ; then
Michael Tokarev4939a1d2018-06-30 19:54:48 +03004474 opengl_pkgs="epoxy gbm"
Gerd Hoffmann5f9b1e32018-03-01 11:05:43 +01004475 if $pkg_config $opengl_pkgs; then
4476 opengl_cflags="$($pkg_config --cflags $opengl_pkgs)"
4477 opengl_libs="$($pkg_config --libs $opengl_pkgs)"
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01004478 opengl=yes
Gerd Hoffmann925a0402015-05-26 12:26:21 +02004479 if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
4480 gtk_gl="yes"
4481 fi
Gerd Hoffmanncc720a52017-03-21 08:04:48 +01004482 QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
Michael Walle20ff0752011-03-07 23:32:39 +01004483 else
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01004484 if test "$opengl" = "yes" ; then
Gerd Hoffmanndcf30022015-05-11 12:24:43 +02004485 feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
Michael Walle20ff0752011-03-07 23:32:39 +01004486 fi
Jeremy Whitef676c672015-01-09 13:08:49 -06004487 opengl_cflags=""
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01004488 opengl_libs=""
4489 opengl=no
Michael Walle20ff0752011-03-07 23:32:39 +01004490 fi
4491fi
4492
Gerd Hoffmann014cb152015-12-03 12:56:34 +01004493if test "$opengl" = "yes"; then
4494 cat > $TMPC << EOF
4495#include <epoxy/egl.h>
4496#ifndef EGL_MESA_image_dma_buf_export
4497# error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
4498#endif
4499int main(void) { return 0; }
4500EOF
4501 if compile_prog "" "" ; then
4502 opengl_dmabuf=yes
4503 fi
4504fi
Chrysostomos Nanakosc9a12e72014-08-04 17:35:32 +03004505
Eric Blakee633a5c2019-02-04 20:39:37 -06004506if test "$opengl" = "yes" && test "$have_x11" = "yes"; then
Philippe Mathieu-Daudé99e1a932019-01-30 13:00:03 +01004507 for target in $target_list; do
4508 case $target in
4509 lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL
4510 need_x11=yes
4511 ;;
4512 esac
4513 done
4514fi
4515
Klim Kireeved279a02018-01-12 12:01:19 +03004516##########################################
4517# libxml2 probe
4518if test "$libxml2" != "no" ; then
4519 if $pkg_config --exists libxml-2.0; then
4520 libxml2="yes"
4521 libxml2_cflags=$($pkg_config --cflags libxml-2.0)
4522 libxml2_libs=$($pkg_config --libs libxml-2.0)
4523 else
4524 if test "$libxml2" = "yes"; then
4525 feature_not_found "libxml2" "Install libxml2 devel"
4526 fi
4527 libxml2="no"
4528 fi
4529fi
Chrysostomos Nanakosc9a12e72014-08-04 17:35:32 +03004530
Bharata B Raoeb100392012-09-24 14:42:45 +05304531##########################################
4532# glusterfs probe
4533if test "$glusterfs" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02004534 if $pkg_config --atleast-version=3 glusterfs-api; then
Bharata B Raoe01bee02013-07-16 21:47:41 +05304535 glusterfs="yes"
Stefan Weil89138852016-05-16 15:10:20 +02004536 glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
4537 glusterfs_libs=$($pkg_config --libs glusterfs-api)
Jeff Codyd85fa9e2016-04-05 10:40:09 -04004538 if $pkg_config --atleast-version=4 glusterfs-api; then
4539 glusterfs_xlator_opt="yes"
4540 fi
Stefan Weil65d5d3f2013-08-27 21:09:13 +02004541 if $pkg_config --atleast-version=5 glusterfs-api; then
Bharata B Rao0c14fb42013-07-16 21:47:42 +05304542 glusterfs_discard="yes"
4543 fi
Bharata B Rao7c815372013-12-21 14:51:25 +05304544 if $pkg_config --atleast-version=6 glusterfs-api; then
Niels de Vosdf3a4292017-05-28 12:01:14 +05304545 glusterfs_fallocate="yes"
Bharata B Rao7c815372013-12-21 14:51:25 +05304546 glusterfs_zerofill="yes"
4547 fi
Prasanna Kumar Kalevere014dbe2019-03-05 16:46:33 +01004548 cat > $TMPC << EOF
4549#include <glusterfs/api/glfs.h>
4550
4551int
4552main(void)
4553{
4554 /* new glfs_ftruncate() passes two additional args */
4555 return glfs_ftruncate(NULL, 0, NULL, NULL);
4556}
4557EOF
4558 if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
4559 glusterfs_ftruncate_has_stat="yes"
4560 fi
Niels de Vos0e3b8912019-03-05 16:46:34 +01004561 cat > $TMPC << EOF
4562#include <glusterfs/api/glfs.h>
4563
4564/* new glfs_io_cbk() passes two additional glfs_stat structs */
4565static void
4566glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data)
4567{}
4568
4569int
4570main(void)
4571{
4572 glfs_io_cbk iocb = &glusterfs_iocb;
4573 iocb(NULL, 0 , NULL, NULL, NULL);
4574 return 0;
4575}
4576EOF
4577 if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
4578 glusterfs_iocb_has_stat="yes"
4579 fi
Bharata B Raoeb100392012-09-24 14:42:45 +05304580 else
4581 if test "$glusterfs" = "yes" ; then
Hu Tao8efc9362014-06-26 17:34:50 +08004582 feature_not_found "GlusterFS backend support" \
4583 "Install glusterfs-api devel >= 3"
Bharata B Raoeb100392012-09-24 14:42:45 +05304584 fi
Bharata B Raoe01bee02013-07-16 21:47:41 +05304585 glusterfs="no"
Bharata B Raoeb100392012-09-24 14:42:45 +05304586 fi
4587fi
4588
aurel3239386ac2009-04-15 19:48:17 +00004589# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00004590# emulator. This is done because older glibc versions don't
4591# have syscall stubs for these implemented. In that case we
4592# don't provide them even if kernel supports them.
4593#
4594inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03004595cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00004596#include <sys/inotify.h>
4597
4598int
4599main(void)
4600{
4601 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00004602 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00004603}
4604EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004605if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03004606 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00004607fi
4608
Riku Voipioc05c7a72010-03-26 15:25:11 +00004609inotify1=no
4610cat > $TMPC << EOF
4611#include <sys/inotify.h>
4612
4613int
4614main(void)
4615{
4616 /* try to start inotify */
4617 return inotify_init1(0);
4618}
4619EOF
4620if compile_prog "" "" ; then
4621 inotify1=yes
4622fi
4623
Riku Voipio099d6b02009-05-05 12:10:04 +03004624# check if pipe2 is there
4625pipe2=no
4626cat > $TMPC << EOF
Riku Voipio099d6b02009-05-05 12:10:04 +03004627#include <unistd.h>
4628#include <fcntl.h>
4629
4630int main(void)
4631{
4632 int pipefd[2];
Bruce Rogers9bca8162012-08-20 12:45:08 -06004633 return pipe2(pipefd, O_CLOEXEC);
Riku Voipio099d6b02009-05-05 12:10:04 +03004634}
4635EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004636if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03004637 pipe2=yes
4638fi
4639
Kevin Wolf40ff6d72009-12-02 12:24:42 +01004640# check if accept4 is there
4641accept4=no
4642cat > $TMPC << EOF
Kevin Wolf40ff6d72009-12-02 12:24:42 +01004643#include <sys/socket.h>
4644#include <stddef.h>
4645
4646int main(void)
4647{
4648 accept4(0, NULL, NULL, SOCK_CLOEXEC);
4649 return 0;
4650}
4651EOF
4652if compile_prog "" "" ; then
4653 accept4=yes
4654fi
4655
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304656# check if tee/splice is there. vmsplice was added same time.
4657splice=no
4658cat > $TMPC << EOF
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304659#include <unistd.h>
4660#include <fcntl.h>
4661#include <limits.h>
4662
4663int main(void)
4664{
Stefan Weil66ea0f22011-12-17 09:27:35 +01004665 int len, fd = 0;
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304666 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
4667 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
4668 return 0;
4669}
4670EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004671if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304672 splice=yes
4673fi
4674
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004675##########################################
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08004676# libnuma probe
4677
4678if test "$numa" != "no" ; then
4679 cat > $TMPC << EOF
4680#include <numa.h>
4681int main(void) { return numa_available(); }
4682EOF
4683
4684 if compile_prog "" "-lnuma" ; then
4685 numa=yes
4686 libs_softmmu="-lnuma $libs_softmmu"
4687 else
4688 if test "$numa" = "yes" ; then
4689 feature_not_found "numa" "install numactl devel"
4690 fi
4691 numa=no
4692 fi
4693fi
4694
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02004695if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
4696 echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
4697 exit 1
4698fi
4699
Yang Zhong5a22ab72017-12-20 21:16:46 +08004700# Even if malloc_trim() is available, these non-libc memory allocators
4701# do not support it.
4702if test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then
4703 if test "$malloc_trim" = "yes" ; then
4704 echo "Disabling malloc_trim with non-libc memory allocator"
4705 fi
4706 malloc_trim="no"
4707fi
4708
4709#######################################
4710# malloc_trim
4711
4712if test "$malloc_trim" != "no" ; then
4713 cat > $TMPC << EOF
4714#include <malloc.h>
4715int main(void) { malloc_trim(0); return 0; }
4716EOF
4717 if compile_prog "" "" ; then
4718 malloc_trim="yes"
4719 else
4720 malloc_trim="no"
4721 fi
4722fi
4723
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08004724##########################################
Fam Zheng2847b462015-03-26 11:03:12 +08004725# tcmalloc probe
4726
4727if test "$tcmalloc" = "yes" ; then
4728 cat > $TMPC << EOF
4729#include <stdlib.h>
Leonid Blochf2dfe542020-05-25 01:12:04 +03004730int main(void) {
4731 void *tmp = malloc(1);
4732 if (tmp != NULL) {
4733 return 0;
4734 }
4735 return 1;
4736}
Fam Zheng2847b462015-03-26 11:03:12 +08004737EOF
4738
4739 if compile_prog "" "-ltcmalloc" ; then
4740 LIBS="-ltcmalloc $LIBS"
4741 else
4742 feature_not_found "tcmalloc" "install gperftools devel"
4743 fi
4744fi
4745
4746##########################################
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02004747# jemalloc probe
4748
4749if test "$jemalloc" = "yes" ; then
4750 cat > $TMPC << EOF
4751#include <stdlib.h>
Leonid Blochf2dfe542020-05-25 01:12:04 +03004752int main(void) {
4753 void *tmp = malloc(1);
4754 if (tmp != NULL) {
4755 return 0;
4756 }
4757 return 1;
4758}
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02004759EOF
4760
4761 if compile_prog "" "-ljemalloc" ; then
4762 LIBS="-ljemalloc $LIBS"
4763 else
4764 feature_not_found "jemalloc" "install jemalloc devel"
4765 fi
4766fi
4767
4768##########################################
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004769# signalfd probe
4770signalfd="no"
4771cat > $TMPC << EOF
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004772#include <unistd.h>
4773#include <sys/syscall.h>
4774#include <signal.h>
4775int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
4776EOF
4777
4778if compile_prog "" "" ; then
4779 signalfd=yes
4780fi
4781
Richard W.M. Jonesd339d762019-01-18 10:11:14 +00004782# check if optreset global is declared by <getopt.h>
4783optreset="no"
4784cat > $TMPC << EOF
4785#include <getopt.h>
4786int main(void) { return optreset; }
4787EOF
4788
4789if compile_prog "" "" ; then
4790 optreset=yes
4791fi
4792
Riku Voipioc2882b92009-08-12 15:08:24 +03004793# check if eventfd is supported
4794eventfd=no
4795cat > $TMPC << EOF
4796#include <sys/eventfd.h>
4797
4798int main(void)
4799{
Stefan Weil55cc7f32011-12-17 09:27:37 +01004800 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
Riku Voipioc2882b92009-08-12 15:08:24 +03004801}
4802EOF
4803if compile_prog "" "" ; then
4804 eventfd=yes
4805fi
4806
Marc-André Lureau751bcc32015-10-09 17:17:16 +02004807# check if memfd is supported
4808memfd=no
4809cat > $TMPC << EOF
Paolo Bonzini75e5b702017-11-28 11:51:27 +01004810#include <sys/mman.h>
Marc-André Lureau751bcc32015-10-09 17:17:16 +02004811
4812int main(void)
4813{
4814 return memfd_create("foo", MFD_ALLOW_SEALING);
4815}
4816EOF
4817if compile_prog "" "" ; then
4818 memfd=yes
4819fi
4820
Cortland Tölva955727d2018-10-08 09:35:19 -07004821# check for usbfs
4822have_usbfs=no
4823if test "$linux_user" = "yes"; then
Thomas Petazzoni96566d02019-02-13 22:18:27 +01004824 cat > $TMPC << EOF
4825#include <linux/usbdevice_fs.h>
4826
4827#ifndef USBDEVFS_GET_CAPABILITIES
4828#error "USBDEVFS_GET_CAPABILITIES undefined"
4829#endif
4830
4831#ifndef USBDEVFS_DISCONNECT_CLAIM
4832#error "USBDEVFS_DISCONNECT_CLAIM undefined"
4833#endif
4834
4835int main(void)
4836{
4837 return 0;
4838}
4839EOF
4840 if compile_prog "" ""; then
Cortland Tölva955727d2018-10-08 09:35:19 -07004841 have_usbfs=yes
4842 fi
Cortland Tölva955727d2018-10-08 09:35:19 -07004843fi
Marc-André Lureau751bcc32015-10-09 17:17:16 +02004844
Ulrich Hechtd0927932009-09-17 20:22:14 +03004845# check for fallocate
4846fallocate=no
4847cat > $TMPC << EOF
4848#include <fcntl.h>
4849
4850int main(void)
4851{
4852 fallocate(0, 0, 0, 0);
4853 return 0;
4854}
4855EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004856if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03004857 fallocate=yes
4858fi
4859
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01004860# check for fallocate hole punching
4861fallocate_punch_hole=no
4862cat > $TMPC << EOF
4863#include <fcntl.h>
4864#include <linux/falloc.h>
4865
4866int main(void)
4867{
4868 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
4869 return 0;
4870}
4871EOF
4872if compile_prog "" "" ; then
4873 fallocate_punch_hole=yes
4874fi
4875
Denis V. Lunevb953f072015-01-30 11:42:14 +03004876# check that fallocate supports range zeroing inside the file
4877fallocate_zero_range=no
4878cat > $TMPC << EOF
4879#include <fcntl.h>
4880#include <linux/falloc.h>
4881
4882int main(void)
4883{
4884 fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0);
4885 return 0;
4886}
4887EOF
4888if compile_prog "" "" ; then
4889 fallocate_zero_range=yes
4890fi
4891
Kevin Wolfed911432014-09-29 17:12:59 +02004892# check for posix_fallocate
4893posix_fallocate=no
4894cat > $TMPC << EOF
4895#include <fcntl.h>
4896
4897int main(void)
4898{
4899 posix_fallocate(0, 0, 0);
4900 return 0;
4901}
4902EOF
4903if compile_prog "" "" ; then
4904 posix_fallocate=yes
4905fi
4906
Peter Maydellc727f472011-01-06 11:05:10 +00004907# check for sync_file_range
4908sync_file_range=no
4909cat > $TMPC << EOF
4910#include <fcntl.h>
4911
4912int main(void)
4913{
4914 sync_file_range(0, 0, 0, 0);
4915 return 0;
4916}
4917EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004918if compile_prog "" "" ; then
Peter Maydellc727f472011-01-06 11:05:10 +00004919 sync_file_range=yes
4920fi
4921
Peter Maydelldace20d2011-01-10 13:11:24 +00004922# check for linux/fiemap.h and FS_IOC_FIEMAP
4923fiemap=no
4924cat > $TMPC << EOF
4925#include <sys/ioctl.h>
4926#include <linux/fs.h>
4927#include <linux/fiemap.h>
4928
4929int main(void)
4930{
4931 ioctl(0, FS_IOC_FIEMAP, 0);
4932 return 0;
4933}
4934EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004935if compile_prog "" "" ; then
Peter Maydelldace20d2011-01-10 13:11:24 +00004936 fiemap=yes
4937fi
4938
Ulrich Hechtd0927932009-09-17 20:22:14 +03004939# check for dup3
4940dup3=no
4941cat > $TMPC << EOF
4942#include <unistd.h>
4943
4944int main(void)
4945{
4946 dup3(0, 0, 0);
4947 return 0;
4948}
4949EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01004950if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03004951 dup3=yes
4952fi
4953
Alex Bligh4e0c6522013-08-21 16:02:43 +01004954# check for ppoll support
4955ppoll=no
4956cat > $TMPC << EOF
4957#include <poll.h>
4958
4959int main(void)
4960{
4961 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
4962 ppoll(&pfd, 1, 0, 0);
4963 return 0;
4964}
4965EOF
4966if compile_prog "" "" ; then
4967 ppoll=yes
4968fi
4969
Alex Blighcd758dd2013-08-21 16:02:44 +01004970# check for prctl(PR_SET_TIMERSLACK , ... ) support
4971prctl_pr_set_timerslack=no
4972cat > $TMPC << EOF
4973#include <sys/prctl.h>
4974
4975int main(void)
4976{
4977 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
4978 return 0;
4979}
4980EOF
4981if compile_prog "" "" ; then
4982 prctl_pr_set_timerslack=yes
4983fi
4984
Peter Maydell3b6edd12011-02-15 18:35:05 +00004985# check for epoll support
4986epoll=no
4987cat > $TMPC << EOF
4988#include <sys/epoll.h>
4989
4990int main(void)
4991{
4992 epoll_create(0);
4993 return 0;
4994}
4995EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004996if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00004997 epoll=yes
4998fi
4999
Peter Maydell227f0212016-06-06 19:58:11 +01005000# epoll_create1 is a later addition
5001# so we must check separately for its presence
Peter Maydell3b6edd12011-02-15 18:35:05 +00005002epoll_create1=no
5003cat > $TMPC << EOF
5004#include <sys/epoll.h>
5005
5006int main(void)
5007{
Peter Maydell19e83f62011-04-26 16:56:40 +01005008 /* Note that we use epoll_create1 as a value, not as
5009 * a function being called. This is necessary so that on
5010 * old SPARC glibc versions where the function was present in
5011 * the library but not declared in the header file we will
5012 * fail the configure check. (Otherwise we will get a compiler
5013 * warning but not an error, and will proceed to fail the
5014 * qemu compile where we compile with -Werror.)
5015 */
Blue Swirlc075a722012-08-09 20:21:25 +00005016 return (int)(uintptr_t)&epoll_create1;
Peter Maydell3b6edd12011-02-15 18:35:05 +00005017}
5018EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01005019if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00005020 epoll_create1=yes
5021fi
5022
Peter Maydella8fd1ab2013-02-08 07:31:55 +00005023# check for sendfile support
5024sendfile=no
5025cat > $TMPC << EOF
5026#include <sys/sendfile.h>
5027
5028int main(void)
5029{
5030 return sendfile(0, 0, 0, 0);
5031}
5032EOF
5033if compile_prog "" "" ; then
5034 sendfile=yes
5035fi
5036
Riku Voipio51834342014-06-22 11:25:42 +01005037# check for timerfd support (glibc 2.8 and newer)
5038timerfd=no
5039cat > $TMPC << EOF
5040#include <sys/timerfd.h>
5041
5042int main(void)
5043{
5044 return(timerfd_create(CLOCK_REALTIME, 0));
5045}
5046EOF
5047if compile_prog "" "" ; then
5048 timerfd=yes
5049fi
5050
Riku Voipio9af5c902014-08-12 15:58:57 +03005051# check for setns and unshare support
5052setns=no
5053cat > $TMPC << EOF
5054#include <sched.h>
5055
5056int main(void)
5057{
5058 int ret;
5059 ret = setns(0, 0);
5060 ret = unshare(0);
5061 return ret;
5062}
5063EOF
5064if compile_prog "" "" ; then
5065 setns=yes
5066fi
5067
Aleksandar Markovic38860a02016-10-10 13:23:29 +02005068# clock_adjtime probe
5069clock_adjtime=no
5070cat > $TMPC <<EOF
5071#include <time.h>
5072
5073int main(void)
5074{
5075 return clock_adjtime(0, 0);
5076}
5077EOF
5078clock_adjtime=no
5079if compile_prog "" "" ; then
5080 clock_adjtime=yes
5081fi
5082
Aleksandar Markovic5a03cd02016-10-10 13:23:30 +02005083# syncfs probe
5084syncfs=no
5085cat > $TMPC <<EOF
5086#include <unistd.h>
5087
5088int main(void)
5089{
5090 return syncfs(0);
5091}
5092EOF
5093syncfs=no
5094if compile_prog "" "" ; then
5095 syncfs=yes
5096fi
5097
Aleksandar Markovicdb37dd82020-01-16 23:49:49 +01005098# check for kcov support (kernel must be 4.4+, compiled with certain options)
5099kcov=no
5100if check_include sys/kcov.h ; then
5101 kcov=yes
5102fi
5103
Peter Maydell516e8b72020-04-11 19:29:32 +01005104# If we're making warnings fatal, apply this to Sphinx runs as well
5105sphinx_werror=""
5106if test "$werror" = "yes"; then
5107 sphinx_werror="-W"
5108fi
5109
Peter Maydell5f71eac2019-03-07 14:26:46 +00005110# Check we have a new enough version of sphinx-build
5111has_sphinx_build() {
5112 # This is a bit awkward but works: create a trivial document and
5113 # try to run it with our configuration file (which enforces a
5114 # version requirement). This will fail if either
5115 # sphinx-build doesn't exist at all or if it is too old.
5116 mkdir -p "$TMPDIR1/sphinx"
5117 touch "$TMPDIR1/sphinx/index.rst"
Alex Bennée988ae6c2020-04-14 21:06:21 +01005118 "$sphinx_build" $sphinx_werror -c "$source_path/docs" \
5119 -b html "$TMPDIR1/sphinx" \
5120 "$TMPDIR1/sphinx/out" >> config.log 2>&1
Peter Maydell5f71eac2019-03-07 14:26:46 +00005121}
5122
pbrookcc8ae6d2006-04-23 17:57:59 +00005123# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02005124if test "$docs" != "no" ; then
Peter Maydell758b6172020-02-13 17:56:19 +00005125 if has_sphinx_build; then
5126 sphinx_ok=yes
5127 else
5128 sphinx_ok=no
5129 fi
5130 if has makeinfo && has pod2man && test "$sphinx_ok" = "yes"; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02005131 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02005132 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02005133 if test "$docs" = "yes" ; then
Peter Maydell758b6172020-02-13 17:56:19 +00005134 if has $sphinx_build && test "$sphinx_ok" != "yes"; then
5135 echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2
5136 fi
5137 feature_not_found "docs" "Install texinfo, Perl/perl-podlators and a Python 3 version of python-sphinx"
Juan Quintela83a3ab82009-08-12 18:29:51 +02005138 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02005139 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02005140 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00005141fi
5142
Stefan Weilf514f412009-10-11 12:44:07 +02005143# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02005144byteswap_h=no
5145cat > $TMPC << EOF
5146#include <byteswap.h>
5147int main(void) { return bswap_32(0); }
5148EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02005149if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02005150 byteswap_h=yes
5151fi
5152
Stefan Weil75f13592013-01-05 12:17:38 +01005153# Search for bswap32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02005154bswap_h=no
5155cat > $TMPC << EOF
5156#include <sys/endian.h>
5157#include <sys/types.h>
5158#include <machine/bswap.h>
5159int main(void) { return bswap32(0); }
5160EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02005161if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02005162 bswap_h=yes
5163fi
5164
aliguorida93a1f2008-12-12 20:02:52 +00005165##########################################
Peter Lievene49ab192014-06-04 14:33:26 +02005166# Do we have libiscsi >= 1.9.0
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11005167if test "$libiscsi" != "no" ; then
Peter Lievene49ab192014-06-04 14:33:26 +02005168 if $pkg_config --atleast-version=1.9.0 libiscsi; then
Paolo Bonzini3c33ea92013-02-22 18:14:28 +01005169 libiscsi="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02005170 libiscsi_cflags=$($pkg_config --cflags libiscsi)
5171 libiscsi_libs=$($pkg_config --libs libiscsi)
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11005172 else
5173 if test "$libiscsi" = "yes" ; then
Peter Lievene49ab192014-06-04 14:33:26 +02005174 feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11005175 fi
5176 libiscsi="no"
5177 fi
5178fi
5179
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11005180##########################################
Natanael Copa8bacde82012-09-12 09:06:51 +00005181# Do we need libm
5182cat > $TMPC << EOF
5183#include <math.h>
Alexey Kardashevskiyf80ea982014-07-01 17:30:27 +10005184int main(int argc, char **argv) { return isnan(sin((double)argc)); }
Natanael Copa8bacde82012-09-12 09:06:51 +00005185EOF
5186if compile_prog "" "" ; then
5187 :
5188elif compile_prog "" "-lm" ; then
5189 LIBS="-lm $LIBS"
5190 libs_qga="-lm $libs_qga"
5191else
Peter Maydell76ad07a2013-04-08 12:11:26 +01005192 error_exit "libm check failed"
Natanael Copa8bacde82012-09-12 09:06:51 +00005193fi
5194
5195##########################################
aliguorida93a1f2008-12-12 20:02:52 +00005196# Do we need librt
Natanael Copa8bacde82012-09-12 09:06:51 +00005197# uClibc provides 2 versions of clock_gettime(), one with realtime
5198# support and one without. This means that the clock_gettime() don't
5199# need -lrt. We still need it for timer_create() so we check for this
5200# function in addition.
aliguorida93a1f2008-12-12 20:02:52 +00005201cat > $TMPC <<EOF
5202#include <signal.h>
5203#include <time.h>
Natanael Copa8bacde82012-09-12 09:06:51 +00005204int main(void) {
5205 timer_create(CLOCK_REALTIME, NULL, NULL);
5206 return clock_gettime(CLOCK_REALTIME, NULL);
5207}
aliguorida93a1f2008-12-12 20:02:52 +00005208EOF
5209
Juan Quintela52166aa2009-08-03 14:46:03 +02005210if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02005211 :
Natanael Copa8bacde82012-09-12 09:06:51 +00005212# we need pthread for static linking. use previous pthread test result
Rick Liu18e588b2014-05-30 14:10:20 -07005213elif compile_prog "" "$pthread_lib -lrt" ; then
5214 LIBS="$LIBS -lrt"
5215 libs_qga="$libs_qga -lrt"
aliguorida93a1f2008-12-12 20:02:52 +00005216fi
5217
Thomas Huthd99e97e2019-01-17 18:14:08 +01005218# Check whether we need to link libutil for openpty()
5219cat > $TMPC << EOF
5220extern int openpty(int *am, int *as, char *name, void *termp, void *winp);
5221int main(void) { return openpty(0, 0, 0, 0, 0); }
5222EOF
5223
Thomas Huth9df8b202020-06-29 14:13:24 +02005224have_openpty="no"
5225if compile_prog "" "" ; then
5226 have_openpty="yes"
5227else
Thomas Huthd99e97e2019-01-17 18:14:08 +01005228 if compile_prog "" "-lutil" ; then
Juan Quintela6362a532009-08-03 14:46:32 +02005229 libs_softmmu="-lutil $libs_softmmu"
Thomas Huthd99e97e2019-01-17 18:14:08 +01005230 libs_tools="-lutil $libs_tools"
Thomas Huth9df8b202020-06-29 14:13:24 +02005231 have_openpty="yes"
Thomas Huthd99e97e2019-01-17 18:14:08 +01005232 fi
Juan Quintela6362a532009-08-03 14:46:32 +02005233fi
5234
Blue Swirlde5071c2009-09-12 09:58:46 +00005235##########################################
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01005236# spice probe
5237if test "$spice" != "no" ; then
5238 cat > $TMPC << EOF
5239#include <spice.h>
5240int main(void) { spice_server_new(); return 0; }
5241EOF
Jiri Denemark710fc4f2011-01-24 13:20:29 +01005242 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
5243 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
Marc-André Lureau1b636652018-11-28 19:59:32 +04005244 if $pkg_config --atleast-version=0.12.5 spice-server && \
Stefan Weil65d5d3f2013-08-27 21:09:13 +02005245 $pkg_config --atleast-version=0.12.3 spice-protocol && \
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01005246 compile_prog "$spice_cflags" "$spice_libs" ; then
5247 spice="yes"
5248 libs_softmmu="$libs_softmmu $spice_libs"
5249 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
Alon Levy2e0e3c32012-08-22 11:16:26 +03005250 spice_protocol_version=$($pkg_config --modversion spice-protocol)
5251 spice_server_version=$($pkg_config --modversion spice-server)
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01005252 else
5253 if test "$spice" = "yes" ; then
Hu Tao8efc9362014-06-26 17:34:50 +08005254 feature_not_found "spice" \
Marc-André Lureau1b636652018-11-28 19:59:32 +04005255 "Install spice-server(>=0.12.5) and spice-protocol(>=0.12.3) devel"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01005256 fi
5257 spice="no"
5258 fi
5259fi
5260
Marc-André Lureau7b02f542015-08-30 11:48:40 +02005261# check for smartcard support
Marc-André Lureau7b02f542015-08-30 11:48:40 +02005262if test "$smartcard" != "no"; then
Michal Privoznik0f5c6422018-04-03 12:34:37 +02005263 if $pkg_config --atleast-version=2.5.1 libcacard; then
Marc-André Lureau7b02f542015-08-30 11:48:40 +02005264 libcacard_cflags=$($pkg_config --cflags libcacard)
5265 libcacard_libs=$($pkg_config --libs libcacard)
Marc-André Lureau7b02f542015-08-30 11:48:40 +02005266 smartcard="yes"
Paolo Bonziniafd347a2012-12-20 20:39:36 +01005267 else
Marc-André Lureau7b02f542015-08-30 11:48:40 +02005268 if test "$smartcard" = "yes"; then
5269 feature_not_found "smartcard" "Install libcacard devel"
Paolo Bonziniafd347a2012-12-20 20:39:36 +01005270 fi
Marc-André Lureau7b02f542015-08-30 11:48:40 +02005271 smartcard="no"
Paolo Bonziniafd347a2012-12-20 20:39:36 +01005272 fi
Robert Relyea111a38b2010-11-28 16:36:38 +02005273fi
5274
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01005275# check for libusb
5276if test "$libusb" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02005277 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01005278 libusb="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02005279 libusb_cflags=$($pkg_config --cflags libusb-1.0)
5280 libusb_libs=$($pkg_config --libs libusb-1.0)
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01005281 else
5282 if test "$libusb" = "yes"; then
Hu Tao8efc9362014-06-26 17:34:50 +08005283 feature_not_found "libusb" "Install libusb devel >= 1.0.13"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01005284 fi
5285 libusb="no"
5286 fi
5287fi
5288
Hans de Goede69354a82011-07-19 11:04:10 +02005289# check for usbredirparser for usb network redirection support
5290if test "$usb_redir" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02005291 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
Hans de Goede69354a82011-07-19 11:04:10 +02005292 usb_redir="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02005293 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
5294 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
Hans de Goede69354a82011-07-19 11:04:10 +02005295 else
5296 if test "$usb_redir" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11005297 feature_not_found "usb-redir" "Install usbredir devel"
Hans de Goede69354a82011-07-19 11:04:10 +02005298 fi
5299 usb_redir="no"
5300 fi
5301fi
5302
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01005303##########################################
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04005304# check if we have VSS SDK headers for win
5305
Eric Blakee633a5c2019-02-04 20:39:37 -06005306if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \
5307 test "$vss_win32_sdk" != "no" ; then
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04005308 case "$vss_win32_sdk" in
Michael Roth690604f2016-06-28 17:31:49 -05005309 "") vss_win32_include="-isystem $source_path" ;;
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04005310 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
5311 # handle path with spaces. So we symlink the headers into ".sdk/vss".
Michael Roth690604f2016-06-28 17:31:49 -05005312 vss_win32_include="-isystem $source_path/.sdk/vss"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04005313 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
5314 ;;
Michael Roth690604f2016-06-28 17:31:49 -05005315 *) vss_win32_include="-isystem $vss_win32_sdk"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04005316 esac
5317 cat > $TMPC << EOF
5318#define __MIDL_user_allocate_free_DEFINED__
5319#include <inc/win2003/vss.h>
5320int main(void) { return VSS_CTX_BACKUP; }
5321EOF
5322 if compile_prog "$vss_win32_include" "" ; then
5323 guest_agent_with_vss="yes"
5324 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
Fam Zheng315d3182016-09-21 12:27:21 +08005325 libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
Michael Rothf33ca812015-08-26 16:19:41 -05005326 qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04005327 else
5328 if test "$vss_win32_sdk" != "" ; then
5329 echo "ERROR: Please download and install Microsoft VSS SDK:"
5330 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
5331 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
5332 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
5333 echo "ERROR: The headers are extracted in the directory \`inc'."
5334 feature_not_found "VSS support"
5335 fi
5336 guest_agent_with_vss="no"
5337 fi
5338fi
5339
5340##########################################
5341# lookup Windows platform SDK (if not specified)
5342# The SDK is needed only to build .tlb (type library) file of guest agent
5343# VSS provider from the source. It is usually unnecessary because the
5344# pre-compiled .tlb file is included.
5345
Eric Blakee633a5c2019-02-04 20:39:37 -06005346if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \
5347 test "$guest_agent_with_vss" = "yes" ; then
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04005348 if test -z "$win_sdk"; then
5349 programfiles="$PROGRAMFILES"
5350 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
5351 if test -n "$programfiles"; then
5352 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
5353 else
5354 feature_not_found "Windows SDK"
5355 fi
5356 elif test "$win_sdk" = "no"; then
5357 win_sdk=""
5358 fi
5359fi
5360
5361##########################################
Michael Roth50cbebb2015-07-07 18:10:09 -05005362# check if mingw environment provides a recent ntddscsi.h
Eric Blakee633a5c2019-02-04 20:39:37 -06005363if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then
Michael Roth50cbebb2015-07-07 18:10:09 -05005364 cat > $TMPC << EOF
5365#include <windows.h>
5366#include <ntddscsi.h>
5367int main(void) {
5368#if !defined(IOCTL_SCSI_GET_ADDRESS)
5369#error Missing required ioctl definitions
5370#endif
5371 SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
5372 return addr.Lun;
5373}
5374EOF
5375 if compile_prog "" "" ; then
5376 guest_agent_ntddscsi=yes
Matt Hines996b9cd2019-01-28 14:30:56 -08005377 libs_qga="-lsetupapi -lcfgmgr32 $libs_qga"
Michael Roth50cbebb2015-07-07 18:10:09 -05005378 fi
5379fi
5380
5381##########################################
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +02005382# virgl renderer probe
5383
5384if test "$virglrenderer" != "no" ; then
5385 cat > $TMPC << EOF
5386#include <virglrenderer.h>
5387int main(void) { virgl_renderer_poll(); return 0; }
5388EOF
5389 virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null)
5390 virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null)
Marc-André Lureau47479c52018-05-25 17:36:09 +02005391 virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null)
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +02005392 if $pkg_config virglrenderer >/dev/null 2>&1 && \
5393 compile_prog "$virgl_cflags" "$virgl_libs" ; then
5394 virglrenderer="yes"
5395 else
5396 if test "$virglrenderer" = "yes" ; then
5397 feature_not_found "virglrenderer"
5398 fi
5399 virglrenderer="no"
5400 fi
5401fi
5402
5403##########################################
Richard Henderson8ca80762017-09-14 09:41:12 -07005404# capstone
5405
Richard Hendersone219c492017-09-28 09:01:23 -07005406case "$capstone" in
5407 "" | yes)
5408 if $pkg_config capstone; then
5409 capstone=system
Eric Blakee633a5c2019-02-04 20:39:37 -06005410 elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
Richard Hendersone219c492017-09-28 09:01:23 -07005411 capstone=git
5412 elif test -e "${source_path}/capstone/Makefile" ; then
5413 capstone=internal
5414 elif test -z "$capstone" ; then
5415 capstone=no
5416 else
5417 feature_not_found "capstone" "Install capstone devel or git submodule"
5418 fi
5419 ;;
5420
5421 system)
5422 if ! $pkg_config capstone; then
5423 feature_not_found "capstone" "Install capstone devel"
5424 fi
5425 ;;
5426esac
5427
5428case "$capstone" in
5429 git | internal)
5430 if test "$capstone" = git; then
5431 git_submodules="${git_submodules} capstone"
5432 fi
5433 mkdir -p capstone
Paolo Bonzini25211442019-06-10 12:03:04 +02005434 QEMU_CFLAGS="$QEMU_CFLAGS -I${source_path}/capstone/include"
Richard Hendersone219c492017-09-28 09:01:23 -07005435 if test "$mingw32" = "yes"; then
5436 LIBCAPSTONE=capstone.lib
5437 else
5438 LIBCAPSTONE=libcapstone.a
5439 fi
Paolo Bonzini25211442019-06-10 12:03:04 +02005440 libs_cpu="-L$PWD/capstone -lcapstone $libs_cpu"
Richard Hendersone219c492017-09-28 09:01:23 -07005441 ;;
5442
5443 system)
Richard Henderson8ca80762017-09-14 09:41:12 -07005444 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)"
Daniel P. Berrangé02f91352019-05-16 10:51:34 +01005445 libs_cpu="$($pkg_config --libs capstone) $libs_cpu"
Richard Hendersone219c492017-09-28 09:01:23 -07005446 ;;
5447
5448 no)
5449 ;;
5450 *)
5451 error_exit "Unknown state for capstone: $capstone"
5452 ;;
5453esac
Richard Henderson8ca80762017-09-14 09:41:12 -07005454
5455##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00005456# check if we have fdatasync
5457
5458fdatasync=no
5459cat > $TMPC << EOF
5460#include <unistd.h>
Alexandre Raymondd1722a22011-05-29 18:22:48 -04005461int main(void) {
5462#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
5463return fdatasync(0);
5464#else
Stefan Weile172fe12012-04-06 21:33:20 +02005465#error Not supported
Alexandre Raymondd1722a22011-05-29 18:22:48 -04005466#endif
5467}
Blue Swirl5f6b9e82009-09-20 06:56:26 +00005468EOF
5469if compile_prog "" "" ; then
5470 fdatasync=yes
5471fi
5472
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01005473##########################################
Andreas Färbere78815a2010-09-25 11:26:05 +00005474# check if we have madvise
5475
5476madvise=no
5477cat > $TMPC << EOF
5478#include <sys/types.h>
5479#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05005480#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00005481int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
5482EOF
5483if compile_prog "" "" ; then
5484 madvise=yes
5485fi
5486
5487##########################################
5488# check if we have posix_madvise
5489
5490posix_madvise=no
5491cat > $TMPC << EOF
5492#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05005493#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00005494int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
5495EOF
5496if compile_prog "" "" ; then
5497 posix_madvise=yes
5498fi
5499
5500##########################################
Andreas Gustafsson9bc5a712018-01-04 19:39:36 +02005501# check if we have posix_memalign()
5502
5503posix_memalign=no
5504cat > $TMPC << EOF
5505#include <stdlib.h>
5506int main(void) {
5507 void *p;
5508 return posix_memalign(&p, 8, 8);
5509}
5510EOF
5511if compile_prog "" "" ; then
5512 posix_memalign=yes
5513fi
5514
5515##########################################
Paul Durrant0a852412016-08-04 14:44:14 +01005516# check if we have posix_syslog
5517
5518posix_syslog=no
5519cat > $TMPC << EOF
5520#include <syslog.h>
5521int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; }
5522EOF
5523if compile_prog "" "" ; then
5524 posix_syslog=yes
5525fi
5526
5527##########################################
Peter Maydell401bc052017-09-05 13:19:32 +01005528# check if we have sem_timedwait
5529
5530sem_timedwait=no
5531cat > $TMPC << EOF
5532#include <semaphore.h>
Daniel P. Berrangé811294b2019-06-17 12:41:14 +01005533int main(void) { sem_t s; struct timespec t = {0}; return sem_timedwait(&s, &t); }
Peter Maydell401bc052017-09-05 13:19:32 +01005534EOF
5535if compile_prog "" "" ; then
5536 sem_timedwait=yes
5537fi
5538
5539##########################################
Keno Fischer5c99fa32018-06-29 12:32:10 +02005540# check if we have strchrnul
5541
5542strchrnul=no
5543cat > $TMPC << EOF
5544#include <string.h>
5545int main(void);
5546// Use a haystack that the compiler shouldn't be able to constant fold
5547char *haystack = (char*)&main;
5548int main(void) { return strchrnul(haystack, 'x') != &haystack[6]; }
5549EOF
5550if compile_prog "" "" ; then
5551 strchrnul=yes
5552fi
5553
Jiufei Xue8a792b02019-04-17 03:08:56 +08005554#########################################
5555# check if we have st_atim
5556
5557st_atim=no
5558cat > $TMPC << EOF
5559#include <sys/stat.h>
5560#include <stddef.h>
5561int main(void) { return offsetof(struct stat, st_atim); }
5562EOF
5563if compile_prog "" "" ; then
5564 st_atim=yes
5565fi
5566
Keno Fischer5c99fa32018-06-29 12:32:10 +02005567##########################################
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01005568# check if trace backend exists
5569
Lluís Vilanova5b808272014-05-27 15:02:14 +02005570$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01005571if test "$?" -ne 0 ; then
Lluís Vilanova5b808272014-05-27 15:02:14 +02005572 error_exit "invalid trace backends" \
5573 "Please choose supported trace backends."
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01005574fi
5575
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01005576##########################################
5577# For 'ust' backend, test if ust headers are present
Lluís Vilanova5b808272014-05-27 15:02:14 +02005578if have_backend "ust"; then
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01005579 cat > $TMPC << EOF
Mohamad Gebaibf15f632014-01-29 22:47:54 -05005580#include <lttng/tracepoint.h>
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01005581int main(void) { return 0; }
5582EOF
Francis Deslauriersc79ed232016-11-28 10:52:17 -05005583 if compile_prog "" "-Wl,--no-as-needed -ldl" ; then
Mohamad Gebaibf15f632014-01-29 22:47:54 -05005584 if $pkg_config lttng-ust --exists; then
Stefan Weil89138852016-05-16 15:10:20 +02005585 lttng_ust_libs=$($pkg_config --libs lttng-ust)
Mohamad Gebaibf15f632014-01-29 22:47:54 -05005586 else
Francis Deslauriersc79ed232016-11-28 10:52:17 -05005587 lttng_ust_libs="-llttng-ust -ldl"
Mohamad Gebaibf15f632014-01-29 22:47:54 -05005588 fi
5589 if $pkg_config liburcu-bp --exists; then
Stefan Weil89138852016-05-16 15:10:20 +02005590 urcu_bp_libs=$($pkg_config --libs liburcu-bp)
Mohamad Gebaibf15f632014-01-29 22:47:54 -05005591 else
5592 urcu_bp_libs="-lurcu-bp"
5593 fi
5594
5595 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
5596 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01005597 else
Mohamad Gebaibf15f632014-01-29 22:47:54 -05005598 error_exit "Trace backend 'ust' missing lttng-ust header files"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01005599 fi
5600fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00005601
5602##########################################
5603# For 'dtrace' backend, test if 'dtrace' command is present
Lluís Vilanova5b808272014-05-27 15:02:14 +02005604if have_backend "dtrace"; then
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00005605 if ! has 'dtrace' ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01005606 error_exit "dtrace command is not found in PATH $PATH"
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00005607 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00005608 trace_backend_stap="no"
5609 if has 'stap' ; then
5610 trace_backend_stap="yes"
5611 fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00005612fi
5613
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01005614##########################################
Alex Barcelo519175a2012-02-28 12:25:50 +01005615# check and set a backend for coroutine
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05305616
Peter Maydell7c2acc72013-04-08 12:11:27 +01005617# We prefer ucontext, but it's not always possible. The fallback
Daniel P. Berrange33c53c52017-04-28 13:24:44 +01005618# is sigcontext. On Windows the only valid backend is the Windows
5619# specific one.
Peter Maydell7c2acc72013-04-08 12:11:27 +01005620
5621ucontext_works=no
5622if test "$darwin" != "yes"; then
5623 cat > $TMPC << EOF
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05305624#include <ucontext.h>
Peter Maydellcdf84802012-02-23 16:20:05 +00005625#ifdef __stub_makecontext
5626#error Ignoring glibc stub makecontext which will always fail
5627#endif
Stefan Weil75cafad2011-12-17 09:27:29 +01005628int main(void) { makecontext(0, 0, 0); return 0; }
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05305629EOF
Peter Maydell7c2acc72013-04-08 12:11:27 +01005630 if compile_prog "" "" ; then
5631 ucontext_works=yes
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05305632 fi
Peter Maydell7c2acc72013-04-08 12:11:27 +01005633fi
5634
5635if test "$coroutine" = ""; then
5636 if test "$mingw32" = "yes"; then
5637 coroutine=win32
5638 elif test "$ucontext_works" = "yes"; then
5639 coroutine=ucontext
5640 else
5641 coroutine=sigaltstack
5642 fi
Alex Barcelo519175a2012-02-28 12:25:50 +01005643else
Peter Maydell7c2acc72013-04-08 12:11:27 +01005644 case $coroutine in
5645 windows)
5646 if test "$mingw32" != "yes"; then
5647 error_exit "'windows' coroutine backend only valid for Windows"
5648 fi
5649 # Unfortunately the user visible backend name doesn't match the
5650 # coroutine-*.c filename for this case, so we have to adjust it here.
5651 coroutine=win32
5652 ;;
5653 ucontext)
5654 if test "$ucontext_works" != "yes"; then
5655 feature_not_found "ucontext"
5656 fi
5657 ;;
Daniel P. Berrange33c53c52017-04-28 13:24:44 +01005658 sigaltstack)
Peter Maydell7c2acc72013-04-08 12:11:27 +01005659 if test "$mingw32" = "yes"; then
5660 error_exit "only the 'windows' coroutine backend is valid for Windows"
5661 fi
5662 ;;
5663 *)
5664 error_exit "unknown coroutine backend $coroutine"
5665 ;;
5666 esac
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05305667fi
5668
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02005669if test "$coroutine_pool" = ""; then
Daniel P. Berrange33c53c52017-04-28 13:24:44 +01005670 coroutine_pool=yes
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02005671fi
5672
Peter Lieven7d992e42016-09-27 11:58:45 +02005673if test "$debug_stack_usage" = "yes"; then
Peter Lieven7d992e42016-09-27 11:58:45 +02005674 if test "$coroutine_pool" = "yes"; then
5675 echo "WARN: disabling coroutine pool for stack usage debugging"
5676 coroutine_pool=no
5677 fi
5678fi
5679
Daniele Buono1e4f6062020-05-29 16:51:21 -04005680##################################################
5681# SafeStack
5682
5683
5684if test "$safe_stack" = "yes"; then
5685cat > $TMPC << EOF
5686int main(int argc, char *argv[])
5687{
5688#if ! __has_feature(safe_stack)
5689#error SafeStack Disabled
5690#endif
5691 return 0;
5692}
5693EOF
5694 flag="-fsanitize=safe-stack"
5695 # Check that safe-stack is supported and enabled.
5696 if compile_prog "-Werror $flag" "$flag"; then
5697 # Flag needed both at compilation and at linking
5698 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
5699 QEMU_LDFLAGS="$QEMU_LDFLAGS $flag"
5700 else
5701 error_exit "SafeStack not supported by your compiler"
5702 fi
5703 if test "$coroutine" != "ucontext"; then
5704 error_exit "SafeStack is only supported by the coroutine backend ucontext"
5705 fi
5706else
5707cat > $TMPC << EOF
5708int main(int argc, char *argv[])
5709{
5710#if defined(__has_feature)
5711#if __has_feature(safe_stack)
5712#error SafeStack Enabled
5713#endif
5714#endif
5715 return 0;
5716}
5717EOF
5718if test "$safe_stack" = "no"; then
5719 # Make sure that safe-stack is disabled
5720 if ! compile_prog "-Werror" ""; then
5721 # SafeStack was already enabled, try to explicitly remove the feature
5722 flag="-fno-sanitize=safe-stack"
5723 if ! compile_prog "-Werror $flag" "$flag"; then
5724 error_exit "Configure cannot disable SafeStack"
5725 fi
5726 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
5727 QEMU_LDFLAGS="$QEMU_LDFLAGS $flag"
5728 fi
5729else # "$safe_stack" = ""
5730 # Set safe_stack to yes or no based on pre-existing flags
5731 if compile_prog "-Werror" ""; then
5732 safe_stack="no"
5733 else
5734 safe_stack="yes"
5735 if test "$coroutine" != "ucontext"; then
5736 error_exit "SafeStack is only supported by the coroutine backend ucontext"
5737 fi
5738 fi
5739fi
5740fi
Peter Lieven7d992e42016-09-27 11:58:45 +02005741
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05305742##########################################
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05305743# check if we have open_by_handle_at
5744
Stefan Weil4e1797f2012-06-18 22:11:06 +02005745open_by_handle_at=no
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05305746cat > $TMPC << EOF
5747#include <fcntl.h>
Stefan Weilacc55ba2012-06-06 19:35:57 +00005748#if !defined(AT_EMPTY_PATH)
5749# error missing definition
5750#else
Stefan Weil75cafad2011-12-17 09:27:29 +01005751int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
Stefan Weilacc55ba2012-06-06 19:35:57 +00005752#endif
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05305753EOF
5754if compile_prog "" "" ; then
5755 open_by_handle_at=yes
5756fi
5757
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05305758########################################
5759# check if we have linux/magic.h
5760
5761linux_magic_h=no
5762cat > $TMPC << EOF
5763#include <linux/magic.h>
5764int main(void) {
Stefan Weil75cafad2011-12-17 09:27:29 +01005765 return 0;
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05305766}
5767EOF
5768if compile_prog "" "" ; then
5769 linux_magic_h=yes
5770fi
5771
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03005772########################################
Christian Borntraeger541be922014-09-25 21:07:54 +02005773# check if we have valgrind/valgrind.h
Kevin Wolf3f4349d2012-06-29 13:40:27 +02005774
5775valgrind_h=no
5776cat > $TMPC << EOF
5777#include <valgrind/valgrind.h>
Kevin Wolf3f4349d2012-06-29 13:40:27 +02005778int main(void) {
Kevin Wolf3f4349d2012-06-29 13:40:27 +02005779 return 0;
5780}
5781EOF
5782if compile_prog "" "" ; then
5783 valgrind_h=yes
5784fi
5785
5786########################################
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03005787# check if environ is declared
5788
5789has_environ=no
5790cat > $TMPC << EOF
5791#include <unistd.h>
5792int main(void) {
Blue Swirlc075a722012-08-09 20:21:25 +00005793 environ = 0;
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03005794 return 0;
5795}
5796EOF
5797if compile_prog "" "" ; then
5798 has_environ=yes
5799fi
5800
Richard Henderson76a347e2012-12-28 14:17:02 -08005801########################################
5802# check if cpuid.h is usable.
5803
Richard Henderson76a347e2012-12-28 14:17:02 -08005804cat > $TMPC << EOF
5805#include <cpuid.h>
5806int main(void) {
Peter Maydell774d5662014-02-20 19:42:53 +00005807 unsigned a, b, c, d;
5808 int max = __get_cpuid_max(0, 0);
5809
5810 if (max >= 1) {
5811 __cpuid(1, a, b, c, d);
5812 }
5813
5814 if (max >= 7) {
5815 __cpuid_count(7, 0, a, b, c, d);
5816 }
5817
5818 return 0;
Richard Henderson76a347e2012-12-28 14:17:02 -08005819}
5820EOF
5821if compile_prog "" "" ; then
5822 cpuid_h=yes
5823fi
5824
Richard Henderson5dd89902017-07-18 18:40:18 -10005825##########################################
5826# avx2 optimization requirement check
5827#
5828# There is no point enabling this if cpuid.h is not usable,
5829# since we won't be able to select the new routines.
5830
Eric Blakee633a5c2019-02-04 20:39:37 -06005831if test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then
Richard Henderson5dd89902017-07-18 18:40:18 -10005832 cat > $TMPC << EOF
5833#pragma GCC push_options
5834#pragma GCC target("avx2")
5835#include <cpuid.h>
5836#include <immintrin.h>
5837static int bar(void *a) {
5838 __m256i x = *(__m256i *)a;
5839 return _mm256_testz_si256(x, x);
5840}
5841int main(int argc, char *argv[]) { return bar(argv[0]); }
5842EOF
5843 if compile_object "" ; then
5844 avx2_opt="yes"
Liam Merwick86583a02018-10-19 21:38:59 +01005845 else
5846 avx2_opt="no"
Richard Henderson5dd89902017-07-18 18:40:18 -10005847 fi
5848fi
5849
Robert Hoo6b8cd442020-02-29 20:34:34 +08005850##########################################
5851# avx512f optimization requirement check
5852#
5853# There is no point enabling this if cpuid.h is not usable,
5854# since we won't be able to select the new routines.
5855# by default, it is turned off.
5856# if user explicitly want to enable it, check environment
5857
5858if test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then
5859 cat > $TMPC << EOF
5860#pragma GCC push_options
5861#pragma GCC target("avx512f")
5862#include <cpuid.h>
5863#include <immintrin.h>
5864static int bar(void *a) {
5865 __m512i x = *(__m512i *)a;
5866 return _mm512_test_epi64_mask(x, x);
5867}
5868int main(int argc, char *argv[])
5869{
5870 return bar(argv[0]);
5871}
5872EOF
5873 if ! compile_object "" ; then
5874 avx512f_opt="no"
5875 fi
5876else
5877 avx512f_opt="no"
5878fi
5879
Richard Hendersonf5401662013-02-16 12:46:59 -08005880########################################
5881# check if __[u]int128_t is usable.
5882
5883int128=no
5884cat > $TMPC << EOF
5885__int128_t a;
5886__uint128_t b;
5887int main (void) {
5888 a = a + b;
5889 b = a * b;
Peter Maydell464e3672013-06-21 14:01:31 +01005890 a = a * a;
Richard Hendersonf5401662013-02-16 12:46:59 -08005891 return 0;
5892}
5893EOF
5894if compile_prog "" "" ; then
5895 int128=yes
5896fi
Richard Henderson76a347e2012-12-28 14:17:02 -08005897
Richard Henderson7ebee432016-06-29 21:10:59 -07005898#########################################
5899# See if 128-bit atomic operations are supported.
5900
5901atomic128=no
5902if test "$int128" = "yes"; then
5903 cat > $TMPC << EOF
5904int main(void)
5905{
5906 unsigned __int128 x = 0, y = 0;
5907 y = __atomic_load_16(&x, 0);
5908 __atomic_store_16(&x, y, 0);
5909 __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0);
5910 return 0;
5911}
5912EOF
5913 if compile_prog "" "" ; then
5914 atomic128=yes
5915 fi
5916fi
5917
Richard Hendersone6cd4bb2018-08-15 16:31:47 -07005918cmpxchg128=no
Eric Blakee633a5c2019-02-04 20:39:37 -06005919if test "$int128" = yes && test "$atomic128" = no; then
Richard Hendersone6cd4bb2018-08-15 16:31:47 -07005920 cat > $TMPC << EOF
5921int main(void)
5922{
5923 unsigned __int128 x = 0, y = 0;
5924 __sync_val_compare_and_swap_16(&x, y, x);
5925 return 0;
5926}
5927EOF
5928 if compile_prog "" "" ; then
5929 cmpxchg128=yes
5930 fi
5931fi
5932
Richard Hendersondf79b992016-09-02 12:23:57 -07005933#########################################
5934# See if 64-bit atomic operations are supported.
5935# Note that without __atomic builtins, we can only
5936# assume atomic loads/stores max at pointer size.
5937
5938cat > $TMPC << EOF
5939#include <stdint.h>
5940int main(void)
5941{
5942 uint64_t x = 0, y = 0;
5943#ifdef __ATOMIC_RELAXED
5944 y = __atomic_load_8(&x, 0);
5945 __atomic_store_8(&x, y, 0);
5946 __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
5947 __atomic_exchange_8(&x, y, 0);
5948 __atomic_fetch_add_8(&x, y, 0);
5949#else
5950 typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
5951 __sync_lock_test_and_set(&x, y);
5952 __sync_val_compare_and_swap(&x, y, 0);
5953 __sync_fetch_and_add(&x, y);
5954#endif
5955 return 0;
5956}
5957EOF
5958if compile_prog "" "" ; then
5959 atomic64=yes
5960fi
5961
Emilio G. Cota26fffe22018-10-21 13:56:29 -04005962#########################################
5963# See if --dynamic-list is supported by the linker
5964ld_dynamic_list="no"
5965if test "$static" = "no" ; then
5966 cat > $TMPTXT <<EOF
5967{
5968 foo;
5969};
5970EOF
5971
5972 cat > $TMPC <<EOF
5973#include <stdio.h>
5974void foo(void);
5975
5976void foo(void)
5977{
5978 printf("foo\n");
5979}
5980
5981int main(void)
5982{
5983 foo();
5984 return 0;
5985}
5986EOF
5987
5988 if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then
5989 ld_dynamic_list="yes"
5990 fi
5991fi
5992
5993#########################################
5994# See if -exported_symbols_list is supported by the linker
5995
5996ld_exported_symbols_list="no"
5997if test "$static" = "no" ; then
5998 cat > $TMPTXT <<EOF
5999 _foo
6000EOF
6001
6002 if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then
6003 ld_exported_symbols_list="yes"
6004 fi
6005fi
6006
6007if test "$plugins" = "yes" &&
6008 test "$ld_dynamic_list" = "no" &&
6009 test "$ld_exported_symbols_list" = "no" ; then
6010 error_exit \
6011 "Plugin support requires dynamic linking and specifying a set of symbols " \
6012 "that are exported to plugins. Unfortunately your linker doesn't " \
6013 "support the flag (--dynamic-list or -exported_symbols_list) used " \
6014 "for this purpose. You can't build with --static."
6015fi
6016
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08006017########################################
Richard Hendersondb8aaae2019-10-13 16:12:19 -07006018# See if __attribute__((alias)) is supported.
6019# This false for Xcode 9, but has been remedied for Xcode 10.
6020# Unfortunately, travis uses Xcode 9 by default.
6021
6022attralias=no
6023cat > $TMPC << EOF
6024int x = 1;
6025extern const int y __attribute__((alias("x")));
6026int main(void) { return 0; }
6027EOF
6028if compile_prog "" "" ; then
6029 attralias=yes
6030fi
6031
6032########################################
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08006033# check if getauxval is available.
6034
6035getauxval=no
6036cat > $TMPC << EOF
6037#include <sys/auxv.h>
6038int main(void) {
6039 return getauxval(AT_HWCAP) == 0;
6040}
6041EOF
6042if compile_prog "" "" ; then
6043 getauxval=yes
6044fi
6045
John Snowfd0e6052015-03-25 18:57:39 -04006046########################################
6047# check if ccache is interfering with
6048# semantic analysis of macros
6049
John Snow5e4dfd32015-10-28 13:56:40 -04006050unset CCACHE_CPP2
John Snowfd0e6052015-03-25 18:57:39 -04006051ccache_cpp2=no
6052cat > $TMPC << EOF
6053static const int Z = 1;
6054#define fn() ({ Z; })
6055#define TAUT(X) ((X) == Z)
6056#define PAREN(X, Y) (X == Y)
6057#define ID(X) (X)
6058int main(int argc, char *argv[])
6059{
6060 int x = 0, y = 0;
6061 x = ID(x);
6062 x = fn();
6063 fn();
6064 if (PAREN(x, y)) return 0;
6065 if (TAUT(Z)) return 0;
6066 return 0;
6067}
6068EOF
6069
6070if ! compile_object "-Werror"; then
6071 ccache_cpp2=yes
6072fi
6073
John Snowb553a042015-11-03 15:43:42 -05006074#################################################
6075# clang does not support glibc + FORTIFY_SOURCE.
6076
6077if test "$fortify_source" != "no"; then
6078 if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
6079 fortify_source="no";
Peter Maydelle1890912017-06-26 16:25:24 +01006080 elif test -n "$cxx" && has $cxx &&
John Snowcfcc7c12015-11-12 11:29:49 -05006081 echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then
John Snowb553a042015-11-03 15:43:42 -05006082 fortify_source="no";
6083 else
6084 fortify_source="yes"
6085 fi
6086fi
6087
Fam Zheng1efad062018-06-01 17:26:43 +08006088###############################################
6089# Check if copy_file_range is provided by glibc
6090have_copy_file_range=no
6091cat > $TMPC << EOF
6092#include <unistd.h>
6093int main(void) {
6094 copy_file_range(0, NULL, 0, NULL, 0, 0);
6095 return 0;
6096}
6097EOF
6098if compile_prog "" "" ; then
6099 have_copy_file_range=yes
6100fi
6101
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05306102##########################################
Jan Vesely277abf12016-04-29 13:15:23 -04006103# check if struct fsxattr is available via linux/fs.h
6104
6105have_fsxattr=no
6106cat > $TMPC << EOF
6107#include <linux/fs.h>
6108struct fsxattr foo;
6109int main(void) {
6110 return 0;
6111}
6112EOF
6113if compile_prog "" "" ; then
6114 have_fsxattr=yes
6115fi
6116
Peter Maydellb66e10e2016-06-08 18:34:32 +01006117##########################################
Paolo Bonzinia40161c2018-02-16 10:05:23 +01006118# check for usable membarrier system call
6119if test "$membarrier" = "yes"; then
6120 have_membarrier=no
6121 if test "$mingw32" = "yes" ; then
6122 have_membarrier=yes
6123 elif test "$linux" = "yes" ; then
6124 cat > $TMPC << EOF
6125 #include <linux/membarrier.h>
6126 #include <sys/syscall.h>
6127 #include <unistd.h>
6128 #include <stdlib.h>
6129 int main(void) {
6130 syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0);
6131 syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0);
6132 exit(0);
6133 }
6134EOF
6135 if compile_prog "" "" ; then
6136 have_membarrier=yes
6137 fi
6138 fi
6139 if test "$have_membarrier" = "no"; then
6140 feature_not_found "membarrier" "membarrier system call not available"
6141 fi
6142else
6143 # Do not enable it by default even for Mingw32, because it doesn't
6144 # work on Wine.
6145 membarrier=no
6146fi
6147
6148##########################################
Peter Maydellb66e10e2016-06-08 18:34:32 +01006149# check if rtnetlink.h exists and is useful
Laurent Vivier575b22b2016-06-02 22:14:15 +02006150have_rtnetlink=no
6151cat > $TMPC << EOF
6152#include <linux/rtnetlink.h>
6153int main(void) {
6154 return IFLA_PROTO_DOWN;
6155}
6156EOF
6157if compile_prog "" "" ; then
6158 have_rtnetlink=yes
6159fi
6160
Stefan Hajnoczi6a02c802016-10-14 10:00:55 +01006161##########################################
6162# check for usable AF_VSOCK environment
6163have_af_vsock=no
6164cat > $TMPC << EOF
6165#include <errno.h>
6166#include <sys/types.h>
6167#include <sys/socket.h>
6168#if !defined(AF_VSOCK)
6169# error missing AF_VSOCK flag
6170#endif
6171#include <linux/vm_sockets.h>
6172int main(void) {
6173 int sock, ret;
6174 struct sockaddr_vm svm;
6175 socklen_t len = sizeof(svm);
6176 sock = socket(AF_VSOCK, SOCK_STREAM, 0);
6177 ret = getpeername(sock, (struct sockaddr *)&svm, &len);
6178 if ((ret == -1) && (errno == ENOTCONN)) {
6179 return 0;
6180 }
6181 return -1;
6182}
6183EOF
6184if compile_prog "" "" ; then
6185 have_af_vsock=yes
6186fi
6187
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04006188##########################################
6189# check for usable AF_ALG environment
Thomas Huth4f673662020-02-03 16:55:34 +01006190have_afalg=no
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04006191cat > $TMPC << EOF
6192#include <errno.h>
6193#include <sys/types.h>
6194#include <sys/socket.h>
6195#include <linux/if_alg.h>
6196int main(void) {
6197 int sock;
6198 sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
6199 return sock;
6200}
6201EOF
6202if compile_prog "" "" ; then
6203 have_afalg=yes
6204fi
6205if test "$crypto_afalg" = "yes"
6206then
6207 if test "$have_afalg" != "yes"
6208 then
6209 error_exit "AF_ALG requested but could not be detected"
6210 fi
6211fi
6212
6213
James Clarke6969ec62016-06-06 12:02:50 +01006214#################################################
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05006215# Check to see if we have the Hypervisor framework
Peter Maydelld2d08522018-01-08 17:10:42 +00006216if [ "$darwin" = "yes" ] ; then
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05006217 cat > $TMPC << EOF
6218#include <Hypervisor/hv.h>
6219int main() { return 0;}
6220EOF
6221 if ! compile_object ""; then
6222 hvf='no'
6223 else
6224 hvf='yes'
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01006225 QEMU_LDFLAGS="-framework Hypervisor $QEMU_LDFLAGS"
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05006226 fi
6227fi
6228
6229#################################################
James Clarke6969ec62016-06-06 12:02:50 +01006230# Sparc implicitly links with --relax, which is
6231# incompatible with -r, so --no-relax should be
6232# given. It does no harm to give it on other
6233# platforms too.
6234
6235# Note: the prototype is needed since QEMU_CFLAGS
6236# contains -Wmissing-prototypes
6237cat > $TMPC << EOF
6238extern int foo(void);
6239int foo(void) { return 0; }
6240EOF
6241if ! compile_object ""; then
6242 error_exit "Failed to compile object file for LD_REL_FLAGS test"
6243fi
Paolo Bonzini7ecf44a2016-11-29 16:37:20 +01006244for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do
6245 if do_cc -nostdlib $i -o $TMPMO $TMPO; then
6246 LD_REL_FLAGS=$i
6247 break
6248 fi
6249done
6250if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then
6251 feature_not_found "modules" "Cannot find how to build relocatable objects"
James Clarke6969ec62016-06-06 12:02:50 +01006252fi
6253
Jan Vesely277abf12016-04-29 13:15:23 -04006254##########################################
Christopher Covington4d043512016-12-28 15:04:33 -05006255# check for sysmacros.h
6256
6257have_sysmacros=no
6258cat > $TMPC << EOF
6259#include <sys/sysmacros.h>
6260int main(void) {
6261 return makedev(0, 0);
6262}
6263EOF
6264if compile_prog "" "" ; then
6265 have_sysmacros=yes
6266fi
6267
6268##########################################
Andreas Grapentin49e00a12017-03-14 17:59:53 +01006269# check for _Static_assert()
6270
6271have_static_assert=no
6272cat > $TMPC << EOF
6273_Static_assert(1, "success");
6274int main(void) {
6275 return 0;
6276}
6277EOF
6278if compile_prog "" "" ; then
6279 have_static_assert=yes
6280fi
6281
6282##########################################
Tomáš Golembiovskýe6746052017-07-17 15:58:33 +02006283# check for utmpx.h, it is missing e.g. on OpenBSD
6284
6285have_utmpx=no
6286cat > $TMPC << EOF
6287#include <utmpx.h>
6288struct utmpx user_info;
6289int main(void) {
6290 return 0;
6291}
6292EOF
6293if compile_prog "" "" ; then
6294 have_utmpx=yes
6295fi
6296
6297##########################################
Richard Hendersondb1ed1a2019-03-13 20:57:28 -07006298# check for getrandom()
6299
6300have_getrandom=no
6301cat > $TMPC << EOF
6302#include <sys/random.h>
6303int main(void) {
6304 return getrandom(0, 0, GRND_NONBLOCK);
6305}
6306EOF
6307if compile_prog "" "" ; then
6308 have_getrandom=yes
6309fi
6310
6311##########################################
Marc-André Lureau247724c2018-01-16 16:11:51 +01006312# checks for sanitizers
6313
Marc-André Lureau247724c2018-01-16 16:11:51 +01006314have_asan=no
6315have_ubsan=no
Marc-André Lureaud83414e2018-01-16 16:11:52 +01006316have_asan_iface_h=no
6317have_asan_iface_fiber=no
Marc-André Lureau247724c2018-01-16 16:11:51 +01006318
6319if test "$sanitizers" = "yes" ; then
Marc-André Lureaub9f44da2018-02-15 22:25:47 +01006320 write_c_skeleton
Marc-André Lureau247724c2018-01-16 16:11:51 +01006321 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then
6322 have_asan=yes
6323 fi
Marc-André Lureaub9f44da2018-02-15 22:25:47 +01006324
6325 # we could use a simple skeleton for flags checks, but this also
6326 # detect the static linking issue of ubsan, see also:
6327 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
6328 cat > $TMPC << EOF
6329#include <stdlib.h>
6330int main(void) {
6331 void *tmp = malloc(10);
Leonid Blochf2dfe542020-05-25 01:12:04 +03006332 if (tmp != NULL) {
6333 return *(int *)(tmp + 2);
6334 }
Olaf Heringd1abf3f2020-07-07 19:13:25 +02006335 return 1;
Marc-André Lureaub9f44da2018-02-15 22:25:47 +01006336}
6337EOF
Marc-André Lureau247724c2018-01-16 16:11:51 +01006338 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
6339 have_ubsan=yes
6340 fi
Marc-André Lureaud83414e2018-01-16 16:11:52 +01006341
6342 if check_include "sanitizer/asan_interface.h" ; then
6343 have_asan_iface_h=yes
6344 fi
6345
6346 cat > $TMPC << EOF
6347#include <sanitizer/asan_interface.h>
6348int main(void) {
6349 __sanitizer_start_switch_fiber(0, 0, 0);
6350 return 0;
6351}
6352EOF
6353 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then
6354 have_asan_iface_fiber=yes
6355 fi
Marc-André Lureau247724c2018-01-16 16:11:51 +01006356fi
6357
6358##########################################
Alexander Bulekovadc28022020-02-19 23:11:14 -05006359# checks for fuzzer
6360if test "$fuzzing" = "yes" ; then
6361 write_c_fuzzer_skeleton
Alexander Bulekovdd016262020-07-06 15:55:31 -04006362 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=fuzzer" ""; then
Alexander Bulekovadc28022020-02-19 23:11:14 -05006363 have_fuzzer=yes
6364 fi
6365fi
6366
Lingfeng Yang0aebab02020-06-12 20:02:23 +01006367# Thread sanitizer is, for now, much noisier than the other sanitizers;
6368# keep it separate until that is not the case.
6369if test "$tsan" = "yes" && test "$sanitizers" = "yes"; then
6370 error_exit "TSAN is not supported with other sanitiziers."
6371fi
6372have_tsan=no
6373have_tsan_iface_fiber=no
6374if test "$tsan" = "yes" ; then
6375 write_c_skeleton
6376 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then
6377 have_tsan=yes
6378 fi
6379 cat > $TMPC << EOF
6380#include <sanitizer/tsan_interface.h>
6381int main(void) {
6382 __tsan_create_fiber(0);
6383 return 0;
6384}
6385EOF
6386 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then
6387 have_tsan_iface_fiber=yes
6388 fi
6389fi
6390
Alexander Bulekovadc28022020-02-19 23:11:14 -05006391##########################################
Junyan He17824402018-07-18 15:47:59 +08006392# check for libpmem
6393
6394if test "$libpmem" != "no"; then
6395 if $pkg_config --exists "libpmem"; then
6396 libpmem="yes"
6397 libpmem_libs=$($pkg_config --libs libpmem)
6398 libpmem_cflags=$($pkg_config --cflags libpmem)
6399 libs_softmmu="$libs_softmmu $libpmem_libs"
6400 QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags"
6401 else
6402 if test "$libpmem" = "yes" ; then
6403 feature_not_found "libpmem" "Install nvml or pmdk"
6404 fi
6405 libpmem="no"
6406 fi
6407fi
6408
6409##########################################
Jingqi Liu21b2eca2020-04-29 16:50:11 +08006410# check for libdaxctl
6411
6412if test "$libdaxctl" != "no"; then
6413 if $pkg_config --atleast-version=57 "libdaxctl"; then
6414 libdaxctl="yes"
6415 libdaxctl_libs=$($pkg_config --libs libdaxctl)
6416 libdaxctl_cflags=$($pkg_config --cflags libdaxctl)
6417 libs_softmmu="$libs_softmmu $libdaxctl_libs"
6418 QEMU_CFLAGS="$QEMU_CFLAGS $libdaxctl_cflags"
6419 else
6420 if test "$libdaxctl" = "yes" ; then
6421 feature_not_found "libdaxctl" "Install libdaxctl"
6422 fi
6423 libdaxctl="no"
6424 fi
6425fi
6426
6427##########################################
Marc-André Lureau675b9b52019-02-12 17:25:23 +01006428# check for slirp
6429
Laurent Vivierd5999382019-06-21 15:05:44 +02006430# slirp is only required when building softmmu targets
6431if test -z "$slirp" -a "$softmmu" != "yes" ; then
6432 slirp="no"
6433fi
6434
Marc-André Lureau675b9b52019-02-12 17:25:23 +01006435case "$slirp" in
6436 "" | yes)
6437 if $pkg_config slirp; then
6438 slirp=system
Marc-André Lureau7c57bdd82019-04-24 13:00:41 +02006439 elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
6440 slirp=git
Marc-André Lureau675b9b52019-02-12 17:25:23 +01006441 elif test -e "${source_path}/slirp/Makefile" ; then
6442 slirp=internal
6443 elif test -z "$slirp" ; then
6444 slirp=no
6445 else
6446 feature_not_found "slirp" "Install slirp devel or git submodule"
6447 fi
6448 ;;
6449
6450 system)
6451 if ! $pkg_config slirp; then
6452 feature_not_found "slirp" "Install slirp devel"
6453 fi
6454 ;;
6455esac
6456
6457case "$slirp" in
Marc-André Lureau7c57bdd82019-04-24 13:00:41 +02006458 git | internal)
6459 if test "$slirp" = git; then
6460 git_submodules="${git_submodules} slirp"
6461 fi
Marc-André Lureau675b9b52019-02-12 17:25:23 +01006462 mkdir -p slirp
Paolo Bonzini25211442019-06-10 12:03:04 +02006463 slirp_cflags="-I${source_path}/slirp/src -I$PWD/slirp/src"
6464 slirp_libs="-L$PWD/slirp -lslirp"
Paolo Bonzinib965e8c2019-12-11 14:41:51 +01006465 if test "$mingw32" = "yes" ; then
6466 slirp_libs="$slirp_libs -lws2_32 -liphlpapi"
6467 fi
Marc-André Lureau675b9b52019-02-12 17:25:23 +01006468 ;;
6469
6470 system)
6471 slirp_version=$($pkg_config --modversion slirp 2>/dev/null)
6472 slirp_cflags=$($pkg_config --cflags slirp 2>/dev/null)
6473 slirp_libs=$($pkg_config --libs slirp 2>/dev/null)
6474 ;;
6475
6476 no)
6477 ;;
6478 *)
6479 error_exit "Unknown state for slirp: $slirp"
6480 ;;
6481esac
6482
Alexey Krasikov54e7aac2020-05-25 14:19:12 +03006483##########################################
6484# check for usable __NR_keyctl syscall
6485
6486if test "$linux" = "yes" ; then
6487
6488 have_keyring=no
6489 cat > $TMPC << EOF
6490#include <errno.h>
6491#include <asm/unistd.h>
6492#include <linux/keyctl.h>
6493#include <unistd.h>
6494int main(void) {
6495 return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0);
6496}
6497EOF
6498 if compile_prog "" "" ; then
6499 have_keyring=yes
6500 fi
6501fi
6502if test "$secret_keyring" != "no"
6503then
David Edmondsonb418d262020-07-01 14:56:15 +01006504 if test "$have_keyring" = "yes"
Alexey Krasikov54e7aac2020-05-25 14:19:12 +03006505 then
6506 secret_keyring=yes
6507 else
6508 if test "$secret_keyring" = "yes"
6509 then
6510 error_exit "syscall __NR_keyctl requested, \
6511but not implemented on your system"
6512 else
6513 secret_keyring=no
6514 fi
6515 fi
6516fi
6517
Alexey Krasikov92500362020-05-25 14:19:13 +03006518##########################################
6519# check for usable keyutils.h
6520
6521if test "$linux" = "yes" ; then
6522
6523 have_keyutils=no
6524 cat > $TMPC << EOF
6525#include <errno.h>
6526#include <asm/unistd.h>
6527#include <unistd.h>
6528#include <sys/types.h>
6529#include <keyutils.h>
6530int main(void) {
6531 return request_key("user", NULL, NULL, 0);
6532}
6533EOF
6534 if compile_prog "" "-lkeyutils"; then
6535 have_keyutils=yes
6536 fi
6537fi
6538
Marc-André Lureau675b9b52019-02-12 17:25:23 +01006539
6540##########################################
Juan Quintelae86ecd42009-08-03 14:45:59 +02006541# End of CC checks
6542# After here, no more $cc or $ld runs
6543
Marc-André Lureaud83414e2018-01-16 16:11:52 +01006544write_c_skeleton
6545
Blue Swirl1d728c32012-05-01 18:45:39 +00006546if test "$gcov" = "yes" ; then
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01006547 QEMU_CFLAGS="-fprofile-arcs -ftest-coverage -g $QEMU_CFLAGS"
6548 QEMU_LDFLAGS="-fprofile-arcs -ftest-coverage $QEMU_LDFLAGS"
John Snowb553a042015-11-03 15:43:42 -05006549elif test "$fortify_source" = "yes" ; then
Paolo Bonzini086d5f72020-02-03 15:22:17 +01006550 QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
6551 debug=no
6552fi
6553if test "$debug" = "no"; then
Paolo Bonzini48e56d52018-03-06 11:32:44 +01006554 CFLAGS="-O2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02006555fi
Paolo Bonzini086d5f72020-02-03 15:22:17 +01006556if test "$debug_info" = "yes"; then
6557 CFLAGS="-g $CFLAGS"
6558 LDFLAGS="-g $LDFLAGS"
6559fi
6560
6561case "$ARCH" in
6562alpha)
6563 # Ensure there's only a single GP
6564 QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS"
6565;;
6566esac
6567
6568if test "$gprof" = "yes" ; then
6569 QEMU_CFLAGS="-p $QEMU_CFLAGS"
6570 QEMU_LDFLAGS="-p $QEMU_LDFLAGS"
6571fi
Juan Quintelaa316e372009-09-30 01:10:55 +02006572
Marc-André Lureau247724c2018-01-16 16:11:51 +01006573if test "$have_asan" = "yes"; then
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01006574 QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS"
6575 QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS"
Marc-André Lureaud83414e2018-01-16 16:11:52 +01006576 if test "$have_asan_iface_h" = "no" ; then
6577 echo "ASAN build enabled, but ASAN header missing." \
6578 "Without code annotation, the report may be inferior."
6579 elif test "$have_asan_iface_fiber" = "no" ; then
6580 echo "ASAN build enabled, but ASAN header is too old." \
6581 "Without code annotation, the report may be inferior."
6582 fi
Marc-André Lureau247724c2018-01-16 16:11:51 +01006583fi
Lingfeng Yang0aebab02020-06-12 20:02:23 +01006584if test "$have_tsan" = "yes" ; then
6585 if test "$have_tsan_iface_fiber" = "yes" ; then
6586 QEMU_CFLAGS="-fsanitize=thread $QEMU_CFLAGS"
6587 QEMU_LDFLAGS="-fsanitize=thread $QEMU_LDFLAGS"
6588 else
6589 error_exit "Cannot enable TSAN due to missing fiber annotation interface."
6590 fi
6591elif test "$tsan" = "yes" ; then
6592 error_exit "Cannot enable TSAN due to missing sanitize thread interface."
6593fi
Marc-André Lureau247724c2018-01-16 16:11:51 +01006594if test "$have_ubsan" = "yes"; then
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01006595 QEMU_CFLAGS="-fsanitize=undefined $QEMU_CFLAGS"
6596 QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS"
Marc-André Lureau247724c2018-01-16 16:11:51 +01006597fi
6598
Peter Lieven6542aa92014-02-03 10:26:13 +01006599##########################################
6600# Do we have libnfs
6601if test "$libnfs" != "no" ; then
Peter Lievenb7d769c2014-03-17 09:37:33 +01006602 if $pkg_config --atleast-version=1.9.3 libnfs; then
Peter Lieven6542aa92014-02-03 10:26:13 +01006603 libnfs="yes"
6604 libnfs_libs=$($pkg_config --libs libnfs)
Peter Lieven6542aa92014-02-03 10:26:13 +01006605 else
6606 if test "$libnfs" = "yes" ; then
Hu Tao8efc9362014-06-26 17:34:50 +08006607 feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
Peter Lieven6542aa92014-02-03 10:26:13 +01006608 fi
6609 libnfs="no"
6610 fi
6611fi
Blue Swirl1d728c32012-05-01 18:45:39 +00006612
Tomáš Golembiovský3efac6e2018-10-23 13:23:10 +02006613##########################################
6614# Do we have libudev
6615if test "$libudev" != "no" ; then
6616 if $pkg_config libudev && test "$static" != "yes"; then
6617 libudev="yes"
6618 libudev_libs=$($pkg_config --libs libudev)
6619 else
6620 libudev="no"
6621 fi
6622fi
6623
Peter Maydell6ca026c2012-07-18 15:10:18 +01006624# Now we've finished running tests it's OK to add -Werror to the compiler flags
6625if test "$werror" = "yes"; then
6626 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
6627fi
6628
Lingfeng Yang0aebab02020-06-12 20:02:23 +01006629# Exclude --warn-common with TSan to suppress warnings from the TSan libraries.
6630if test "$solaris" = "no" && test "$tsan" = "no"; then
Juan Quintelae86ecd42009-08-03 14:45:59 +02006631 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01006632 QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02006633 fi
6634fi
6635
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02006636# test if pod2man has --utf8 option
6637if pod2man --help | grep -q utf8; then
6638 POD2MAN="pod2man --utf8"
6639else
6640 POD2MAN="pod2man"
6641fi
6642
Blue Swirl952afb72010-09-19 08:36:34 +00006643# Use ASLR, no-SEH and DEP if available
6644if test "$mingw32" = "yes" ; then
6645 for flag in --dynamicbase --no-seh --nxcompat; do
Christian Borntraegere9a35912017-08-23 12:16:23 +02006646 if ld_has $flag ; then
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01006647 QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS"
Blue Swirl952afb72010-09-19 08:36:34 +00006648 fi
6649 done
6650fi
6651
Philippe Mathieu-Daudé7776ea62019-03-07 15:28:22 +01006652# Disable OpenBSD W^X if available
6653if test "$tcg" = "yes" && test "$targetos" = "OpenBSD"; then
6654 cat > $TMPC <<EOF
6655 int main(void) { return 0; }
6656EOF
6657 wx_ldflags="-Wl,-z,wxneeded"
6658 if compile_prog "" "$wx_ldflags"; then
6659 QEMU_LDFLAGS="$QEMU_LDFLAGS $wx_ldflags"
6660 fi
6661fi
6662
Eduardo Habkost10ea68b2012-04-18 16:55:39 -03006663qemu_confdir=$sysconfdir$confsuffix
Fam Zhenge26110c2014-02-10 14:48:57 +08006664qemu_moddir=$libdir$confsuffix
Eduardo Habkost528ae5b2012-04-18 16:55:49 -03006665qemu_datadir=$datadir$confsuffix
Anthony Liguori834574e2013-02-20 07:43:24 -06006666qemu_localedir="$datadir/locale"
Daniel P. Berrangéa8260d32019-01-10 12:00:45 +00006667qemu_icondir="$datadir/icons"
Daniel P. Berrangé67ea9542019-01-10 12:00:46 +00006668qemu_desktopdir="$datadir/applications"
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02006669
Kamil Rytarowskie0580342017-07-14 09:33:44 +01006670# We can only support ivshmem if we have eventfd
6671if [ "$eventfd" = "yes" ]; then
6672 ivshmem=yes
6673fi
6674
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01006675tools=""
6676if test "$want_tools" = "yes" ; then
Gerd Hoffmann72d277a2018-09-25 09:56:42 +02006677 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) qemu-edid\$(EXESUF) $tools"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01006678 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
Kevin Wolff3534152020-02-24 15:29:49 +01006679 tools="qemu-nbd\$(EXESUF) qemu-storage-daemon\$(EXESUF) $tools"
Kamil Rytarowskib1449ed2017-07-14 09:33:45 +01006680 fi
6681 if [ "$ivshmem" = "yes" ]; then
David Marchanda75eb032014-09-08 11:17:48 +02006682 tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01006683 fi
Viktor Prutyanov1b9d35f2018-12-20 04:24:41 +03006684 if [ "$curl" = "yes" ]; then
6685 tools="elf2dmp\$(EXESUF) $tools"
Viktor Prutyanov3fa2d382018-08-29 15:41:25 +03006686 fi
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01006687fi
6688if test "$softmmu" = yes ; then
Paolo Bonzinib855f8d2017-08-22 06:50:18 +02006689 if test "$linux" = yes; then
Paolo Bonzini7e462612019-11-29 12:16:32 +01006690 if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; then
Andreas Färberaabfd882012-05-01 01:12:02 +02006691 virtfs=yes
Philippe Mathieu-Daudéfdbff6b2020-04-23 12:43:45 +02006692 helpers="$helpers fsdev/virtfs-proxy-helper\$(EXESUF)"
Andreas Färberaabfd882012-05-01 01:12:02 +02006693 else
6694 if test "$virtfs" = yes; then
Paolo Bonzini7e462612019-11-29 12:16:32 +01006695 error_exit "VirtFS requires libcap-ng devel and libattr devel"
Meador Inge983eef52012-02-24 14:00:42 +05306696 fi
Andreas Färber17500372012-05-01 01:12:03 +02006697 virtfs=no
Andreas Färberaabfd882012-05-01 01:12:02 +02006698 fi
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02006699 if test "$mpath" != no && test "$mpathpersist" = yes ; then
6700 mpath=yes
6701 else
6702 if test "$mpath" = yes; then
6703 error_exit "Multipath requires libmpathpersist devel"
6704 fi
6705 mpath=no
6706 fi
Philippe Mathieu-Daudéfdbff6b2020-04-23 12:43:45 +02006707 helpers="$helpers scsi/qemu-pr-helper\$(EXESUF)"
Paolo Bonzinib855f8d2017-08-22 06:50:18 +02006708 else
6709 if test "$virtfs" = yes; then
6710 error_exit "VirtFS is supported only on Linux"
6711 fi
6712 virtfs=no
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02006713 if test "$mpath" = yes; then
6714 error_exit "Multipath is supported only on Linux"
6715 fi
6716 mpath=no
M. Mohan Kumar17bff522011-12-14 13:58:42 +05306717 fi
Laurent Vivierff69fd82017-10-19 21:16:06 +02006718 if test "$xkbcommon" = "yes"; then
6719 tools="qemu-keymap\$(EXESUF) $tools"
6720 fi
Gerd Hoffmann6a021532017-10-05 17:33:28 +02006721fi
Michael Roth9d6bc272015-08-26 10:49:13 -05006722
6723# Probe for guest agent support/options
6724
Michael Tokareve8ef31a2013-07-31 14:22:07 +04006725if [ "$guest_agent" != "no" ]; then
Laurent Viviera5125902019-04-01 16:12:20 +02006726 if [ "$softmmu" = no -a "$want_tools" = no ] ; then
6727 guest_agent=no
6728 elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
Paolo Bonzini08144652019-07-18 12:22:01 +02006729 tools="qemu-ga\$(EXESUF) $tools"
Michael Tokareve8ef31a2013-07-31 14:22:07 +04006730 guest_agent=yes
6731 elif [ "$guest_agent" != yes ]; then
6732 guest_agent=no
6733 else
6734 error_exit "Guest agent is not supported on this platform"
Paolo Bonzinica35f782010-05-26 16:08:29 +02006735 fi
Paolo Bonzini00c705f2012-05-29 11:40:24 +02006736fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02006737
Michael Roth9d6bc272015-08-26 10:49:13 -05006738# Guest agent Window MSI package
6739
6740if test "$guest_agent" != yes; then
6741 if test "$guest_agent_msi" = yes; then
6742 error_exit "MSI guest agent package requires guest agent enabled"
6743 fi
6744 guest_agent_msi=no
6745elif test "$mingw32" != "yes"; then
6746 if test "$guest_agent_msi" = "yes"; then
6747 error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation"
6748 fi
6749 guest_agent_msi=no
6750elif ! has wixl; then
6751 if test "$guest_agent_msi" = "yes"; then
6752 error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )"
6753 fi
6754 guest_agent_msi=no
Michael Roth1a349042015-08-26 11:14:31 -05006755else
6756 # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't
6757 # disabled explicitly
6758 if test "$guest_agent_msi" != "no"; then
6759 guest_agent_msi=yes
6760 fi
Michael Roth9d6bc272015-08-26 10:49:13 -05006761fi
6762
Michael Roth1a349042015-08-26 11:14:31 -05006763if test "$guest_agent_msi" = "yes"; then
Michael Roth9d6bc272015-08-26 10:49:13 -05006764 if test "$guest_agent_with_vss" = "yes"; then
6765 QEMU_GA_MSI_WITH_VSS="-D InstallVss"
6766 fi
6767
6768 if test "$QEMU_GA_MANUFACTURER" = ""; then
6769 QEMU_GA_MANUFACTURER=QEMU
6770 fi
6771
6772 if test "$QEMU_GA_DISTRO" = ""; then
6773 QEMU_GA_DISTRO=Linux
6774 fi
6775
6776 if test "$QEMU_GA_VERSION" = ""; then
Stefan Weil89138852016-05-16 15:10:20 +02006777 QEMU_GA_VERSION=$(cat $source_path/VERSION)
Michael Roth9d6bc272015-08-26 10:49:13 -05006778 fi
6779
Stefan Weil89138852016-05-16 15:10:20 +02006780 QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin"
Michael Roth9d6bc272015-08-26 10:49:13 -05006781
6782 case "$cpu" in
6783 x86_64)
6784 QEMU_GA_MSI_ARCH="-a x64 -D Arch=64"
6785 ;;
6786 i386)
6787 QEMU_GA_MSI_ARCH="-D Arch=32"
6788 ;;
6789 *)
6790 error_exit "CPU $cpu not supported for building installation package"
6791 ;;
6792 esac
6793fi
6794
Paolo Bonzinica35f782010-05-26 16:08:29 +02006795# Mac OS X ships with a broken assembler
6796roms=
Eric Blakee633a5c2019-02-04 20:39:37 -06006797if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \
6798 test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \
6799 test "$softmmu" = yes ; then
Peter Maydelle57218b2016-08-08 17:11:28 +01006800 # Different host OS linkers have different ideas about the name of the ELF
Brad Smithc65d5e42017-11-07 18:46:11 -05006801 # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
6802 # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
6803 for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do
Peter Maydelle57218b2016-08-08 17:11:28 +01006804 if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
6805 ld_i386_emulation="$emu"
6806 roms="optionrom"
6807 break
6808 fi
6809 done
Paolo Bonzinica35f782010-05-26 16:08:29 +02006810fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02006811
Thomas Huth2e33c3f2019-01-14 13:52:26 +01006812# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900
Christian Borntraeger9933c302013-04-23 01:23:03 +00006813if test "$cpu" = "s390x" ; then
Thomas Huth2e33c3f2019-01-14 13:52:26 +01006814 write_c_skeleton
6815 if compile_prog "-march=z900" ""; then
6816 roms="$roms s390-ccw"
Philippe Mathieu-Daudé1ef6bfc2020-06-15 09:49:19 +02006817 # SLOF is required for building the s390-ccw firmware on s390x,
6818 # since it is using the libnet code from SLOF for network booting.
6819 if test -e "${source_path}/.git" ; then
6820 git_submodules="${git_submodules} roms/SLOF"
6821 fi
Thomas Huth2e33c3f2019-01-14 13:52:26 +01006822 fi
Christian Borntraeger9933c302013-04-23 01:23:03 +00006823fi
6824
Bruno Dominguez11cde1c2017-06-06 14:07:47 +01006825# Check that the C++ compiler exists and works with the C compiler.
6826# All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
6827if has $cxx; then
6828 cat > $TMPC <<EOF
6829int c_function(void);
6830int main(void) { return c_function(); }
6831EOF
6832
6833 compile_object
6834
6835 cat > $TMPCXX <<EOF
6836extern "C" {
6837 int c_function(void);
6838}
6839int c_function(void) { return 42; }
6840EOF
6841
6842 update_cxxflags
6843
Paolo Bonzini086d5f72020-02-03 15:22:17 +01006844 if do_cxx $CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then
Bruno Dominguez11cde1c2017-06-06 14:07:47 +01006845 # C++ compiler $cxx works ok with C compiler $cc
6846 :
6847 else
6848 echo "C++ compiler $cxx does not work with C compiler $cc"
6849 echo "Disabling C++ specific optional code"
6850 cxx=
6851 fi
6852else
6853 echo "No C++ compiler available; disabling C++ specific optional code"
6854 cxx=
6855fi
6856
Cole Robinson02d34f62016-05-06 14:03:09 -04006857echo_version() {
6858 if test "$1" = "yes" ; then
6859 echo "($2)"
6860 fi
6861}
6862
Jan Kiszka50e12062014-10-02 10:03:55 +02006863# prepend pixman and ftd flags after all config tests are done
6864QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
Philippe Mathieu-Daudé8a99e9a2018-04-15 20:05:19 -03006865QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS"
Jan Kiszka50e12062014-10-02 10:03:55 +02006866libs_softmmu="$pixman_libs $libs_softmmu"
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01006867
bellard43ce4df2003-06-09 19:53:12 +00006868echo "Install prefix $prefix"
Stefan Weil89138852016-05-16 15:10:20 +02006869echo "BIOS directory $(eval echo $qemu_datadir)"
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +02006870echo "firmware path $(eval echo $firmwarepath)"
Stefan Weil89138852016-05-16 15:10:20 +02006871echo "binary directory $(eval echo $bindir)"
6872echo "library directory $(eval echo $libdir)"
6873echo "module directory $(eval echo $qemu_moddir)"
6874echo "libexec directory $(eval echo $libexecdir)"
6875echo "include directory $(eval echo $includedir)"
6876echo "config directory $(eval echo $sysconfdir)"
bellard11d9f692004-04-02 20:55:59 +00006877if test "$mingw32" = "no" ; then
Stefan Weil89138852016-05-16 15:10:20 +02006878echo "local state directory $(eval echo $local_statedir)"
6879echo "Manual directory $(eval echo $mandir)"
bellard43ce4df2003-06-09 19:53:12 +00006880echo "ELF interp prefix $interp_prefix"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02006881else
6882echo "local state directory queried at runtime"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04006883echo "Windows SDK $win_sdk"
bellard11d9f692004-04-02 20:55:59 +00006884fi
Paolo Bonzinibc4486f2019-12-11 15:33:49 +01006885echo "Build directory $(pwd)"
bellard5a671352003-10-01 00:13:48 +00006886echo "Source path $source_path"
Daniel P. Berrangecc84d632017-10-20 15:02:43 +01006887echo "GIT binary $git"
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01006888echo "GIT submodules $git_submodules"
bellard43ce4df2003-06-09 19:53:12 +00006889echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00006890echo "Host C compiler $host_cc"
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04006891echo "C++ compiler $cxx"
Peter Maydell3c4a4d02012-08-11 22:34:40 +01006892echo "Objective-C compiler $objcc"
Peter Maydell45d285a2013-10-21 21:03:06 +01006893echo "ARFLAGS $ARFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02006894echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02006895echo "QEMU_CFLAGS $QEMU_CFLAGS"
Philippe Mathieu-Daudé8a99e9a2018-04-15 20:05:19 -03006896echo "QEMU_LDFLAGS $QEMU_LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00006897echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00006898echo "install $install"
Cleber Rosa755ee702018-11-09 10:07:07 -05006899echo "python $python ($python_version)"
Peter Maydell2eb054c2020-02-13 17:56:18 +00006900if test "$docs" != "no"; then
6901 echo "sphinx-build $sphinx_build"
6902fi
Alex Bennée39d87c82020-03-03 15:06:20 +00006903echo "genisoimage $genisoimage"
Marc-André Lureau675b9b52019-02-12 17:25:23 +01006904echo "slirp support $slirp $(echo_version $slirp $slirp_version)"
6905if test "$slirp" != "no" ; then
Brade2d88302011-09-02 16:53:28 -04006906 echo "smbd $smbd"
6907fi
Fam Zheng17969262014-02-10 14:48:56 +08006908echo "module support $modules"
Christian Ehrhardtbd83c862020-03-10 15:58:06 +01006909echo "alt path mod load $module_upgrades"
bellard43ce4df2003-06-09 19:53:12 +00006910echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00006911echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00006912echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00006913echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00006914echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00006915echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00006916echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00006917echo "static build $static"
Daniele Buono1e4f6062020-05-29 16:51:21 -04006918echo "safe stack $safe_stack"
bellard5b0753e2005-03-01 21:37:28 +00006919if test "$darwin" = "yes" ; then
6920 echo "Cocoa support $cocoa"
6921fi
Stefan Weil89138852016-05-16 15:10:20 +02006922echo "SDL support $sdl $(echo_version $sdl $sdlversion)"
Daniel P. Berrangéa442fe22019-01-10 12:00:47 +00006923echo "SDL image support $sdl_image"
Stefan Weil89138852016-05-16 15:10:20 +02006924echo "GTK support $gtk $(echo_version $gtk $gtk_version)"
Gerd Hoffmann925a0402015-05-26 12:26:21 +02006925echo "GTK GL support $gtk_gl"
Stefan Weil89138852016-05-16 15:10:20 +02006926echo "VTE support $vte $(echo_version $vte $vteversion)"
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +01006927echo "TLS priority $tls_priority"
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01006928echo "GNUTLS support $gnutls"
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01006929echo "libgcrypt $gcrypt"
Daniel P. Berrangée0576942019-10-14 17:28:27 +01006930if test "$gcrypt" = "yes"
6931then
6932 echo " hmac $gcrypt_hmac"
6933 echo " XTS $gcrypt_xts"
6934fi
Stefan Weil89138852016-05-16 15:10:20 +02006935echo "nettle $nettle $(echo_version $nettle $nettle_version)"
Daniel P. Berrangédc2207a2019-10-14 17:28:27 +01006936if test "$nettle" = "yes"
6937then
6938 echo " XTS $nettle_xts"
6939fi
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01006940echo "libtasn1 $tasn1"
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01006941echo "PAM $auth_pam"
Samuel Thibaulte08bb302019-03-11 14:51:26 +01006942echo "iconv support $iconv"
balrog4d3b6f62008-02-10 16:33:14 +00006943echo "curses support $curses"
Marc-André Lureau47479c52018-05-25 17:36:09 +02006944echo "virgl support $virglrenderer $(echo_version $virglrenderer $virgl_version)"
Alexander Graf769ce762009-05-11 17:41:42 +02006945echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00006946echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00006947echo "Audio drivers $audio_drv_list"
Fam Zhengb64ec4e2013-05-29 19:35:40 +08006948echo "Block whitelist (rw) $block_drv_rw_whitelist"
6949echo "Block whitelist (ro) $block_drv_ro_whitelist"
Meador Inge983eef52012-02-24 14:00:42 +05306950echo "VirtFS support $virtfs"
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02006951echo "Multipath support $mpath"
Jes Sorensen821601e2011-03-16 13:33:36 +01006952echo "VNC support $vnc"
6953if test "$vnc" = "yes" ; then
Jes Sorensen821601e2011-03-16 13:33:36 +01006954 echo "VNC SASL support $vnc_sasl"
6955 echo "VNC JPEG support $vnc_jpeg"
6956 echo "VNC PNG support $vnc_png"
Jes Sorensen821601e2011-03-16 13:33:36 +01006957fi
aliguorie37630c2009-04-22 15:19:10 +00006958echo "xen support $xen"
Paul Durrant3996e852015-01-20 11:06:19 +00006959if test "$xen" = "yes" ; then
6960 echo "xen ctrl version $xen_ctrl_version"
6961fi
aurel322e4d9fb2008-04-08 06:01:02 +00006962echo "brlapi support $brlapi"
Juan Quintelaa25dba12009-08-12 18:29:52 +02006963echo "Documentation $docs"
Avi Kivity40d64442011-11-15 20:12:17 +02006964echo "PIE $pie"
ths8a16d272008-07-19 09:56:24 +00006965echo "vde support $vde"
Vincenzo Maffione58952132013-11-06 11:44:06 +01006966echo "netmap support $netmap"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02006967echo "Linux AIO support $linux_aio"
Aarushi Mehtac10dd852020-01-20 14:18:44 +00006968echo "Linux io_uring support $linux_io_uring"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07006969echo "ATTR/XATTR support $attr"
ths77755342008-11-27 15:45:16 +00006970echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02006971echo "KVM support $kvm"
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01006972echo "HAX support $hax"
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05006973echo "HVF support $hvf"
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08006974echo "WHPX support $whpx"
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +02006975echo "TCG support $tcg"
6976if test "$tcg" = "yes" ; then
6977 echo "TCG debug enabled $debug_tcg"
6978 echo "TCG interpreter $tcg_interpreter"
6979fi
Yang Zhong5a22ab72017-12-20 21:16:46 +08006980echo "malloc trim support $malloc_trim"
Michael R. Hines2da776d2013-07-22 10:01:54 -04006981echo "RDMA support $rdma"
Marcel Apfelbaum21ab34c2018-08-16 18:16:37 +03006982echo "PVRDMA support $pvrdma"
aurel32f652e6a2008-12-16 10:43:48 +00006983echo "fdt support $fdt"
Paolo Bonzinia40161c2018-02-16 10:05:23 +01006984echo "membarrier $membarrier"
aliguoriceb42de2009-04-07 18:43:28 +00006985echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00006986echo "fdatasync $fdatasync"
Andreas Färbere78815a2010-09-25 11:26:05 +00006987echo "madvise $madvise"
6988echo "posix_madvise $posix_madvise"
Andreas Gustafsson9bc5a712018-01-04 19:39:36 +02006989echo "posix_memalign $posix_memalign"
Corey Bryant47e98652012-01-26 09:42:26 -05006990echo "libcap-ng support $cap_ng"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02006991echo "vhost-net support $vhost_net"
Gonglei042cea22018-03-01 21:46:28 +08006992echo "vhost-crypto support $vhost_crypto"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00006993echo "vhost-scsi support $vhost_scsi"
Stefan Hajnoczifc0b9b02016-08-16 13:27:22 +01006994echo "vhost-vsock support $vhost_vsock"
Marc-André Lureaue6a74862017-08-03 11:07:46 +02006995echo "vhost-user support $vhost_user"
Dr. David Alan Gilbert98fc1ad2019-09-30 11:51:34 +01006996echo "vhost-user-fs support $vhost_user_fs"
Cindy Lu108a6482020-07-01 22:55:37 +08006997echo "vhost-vdpa support $vhost_vdpa"
Lluís Vilanova5b808272014-05-27 15:02:14 +02006998echo "Trace backends $trace_backends"
Marc-André Lureau713572a2015-12-10 01:47:46 +01006999if have_backend "simple"; then
Prerna Saxena9410b562010-07-13 09:26:32 +01007000echo "Trace output file $trace_file-<pid>"
Stefan Weile00e36f2014-03-14 21:09:10 +01007001fi
Stefan Weil89138852016-05-16 15:10:20 +02007002echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01007003echo "rbd support $rbd"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01007004echo "xfsctl support $xfs"
Marc-André Lureau7b02f542015-08-30 11:48:40 +02007005echo "smartcard support $smartcard"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01007006echo "libusb $libusb"
Hans de Goede69354a82011-07-19 11:04:10 +02007007echo "usb net redir $usb_redir"
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01007008echo "OpenGL support $opengl"
Gerd Hoffmann014cb152015-12-03 12:56:34 +01007009echo "OpenGL dmabufs $opengl_dmabuf"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11007010echo "libiscsi support $libiscsi"
Peter Lieven6542aa92014-02-03 10:26:13 +01007011echo "libnfs support $libnfs"
Michael Rothd138cee2011-08-01 14:52:57 -05007012echo "build guest agent $guest_agent"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04007013echo "QGA VSS support $guest_agent_with_vss"
Michael Roth50cbebb2015-07-07 18:10:09 -05007014echo "QGA w32 disk info $guest_agent_ntddscsi"
Michael Roth4c875d82015-08-25 15:46:18 -05007015echo "QGA MSI support $guest_agent_msi"
Eduardo Otubof7945732012-08-14 18:44:05 -03007016echo "seccomp support $seccomp"
Peter Maydell7c2acc72013-04-08 12:11:27 +01007017echo "coroutine backend $coroutine"
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02007018echo "coroutine pool $coroutine_pool"
Peter Lieven7d992e42016-09-27 11:58:45 +02007019echo "debug stack usage $debug_stack_usage"
Paolo Bonziniba59fb72018-06-13 14:23:08 +02007020echo "mutex debugging $debug_mutex"
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04007021echo "crypto afalg $crypto_afalg"
Bharata B Raoeb100392012-09-24 14:42:45 +05307022echo "GlusterFS support $glusterfs"
Blue Swirl1d728c32012-05-01 18:45:39 +00007023echo "gcov $gcov_tool"
7024echo "gcov enabled $gcov"
Stefan Bergerab214c22013-02-27 12:47:52 -05007025echo "TPM support $tpm"
Pino Toscanob10d49d2019-06-20 22:08:40 +02007026echo "libssh support $libssh"
Paolo Bonzini3556c232013-05-10 14:16:40 +02007027echo "QOM debugging $qom_cast_debug"
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +01007028echo "Live block migration $live_block_migration"
qiaonuohan607dacd2014-02-18 14:11:30 +08007029echo "lzo support $lzo"
7030echo "snappy support $snappy"
Peter Wu6b383c02015-01-06 18:48:14 +01007031echo "bzip2 support $bzip2"
Julio Faracco83bc1f92018-11-05 13:08:04 -02007032echo "lzfse support $lzfse"
Juan Quintela3a678482019-12-17 21:15:24 +01007033echo "zstd support $zstd"
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08007034echo "NUMA host support $numa"
Klim Kireeved279a02018-01-12 12:01:19 +03007035echo "libxml2 $libxml2"
Fam Zheng2847b462015-03-26 11:03:12 +08007036echo "tcmalloc support $tcmalloc"
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02007037echo "jemalloc support $jemalloc"
Liang Li99f2dbd2016-03-08 13:53:16 +08007038echo "avx2 optimization $avx2_opt"
Robert Hoo6b8cd442020-02-29 20:34:34 +08007039echo "avx512f optimization $avx512f_opt"
Changlong Xiea6b1d4c2016-07-27 15:01:48 +08007040echo "replication support $replication"
Jeff Cody2f740132018-11-07 07:36:44 +01007041echo "bochs support $bochs"
7042echo "cloop support $cloop"
7043echo "dmg support $dmg"
7044echo "qcow v1 support $qcow1"
7045echo "vdi support $vdi"
7046echo "vvfat support $vvfat"
7047echo "qed support $qed"
7048echo "parallels support $parallels"
7049echo "sheepdog support $sheepdog"
Richard Henderson8ca80762017-09-14 09:41:12 -07007050echo "capstone $capstone"
Junyan He17824402018-07-18 15:47:59 +08007051echo "libpmem support $libpmem"
Jingqi Liu21b2eca2020-04-29 16:50:11 +08007052echo "libdaxctl support $libdaxctl"
Tomáš Golembiovský3efac6e2018-10-23 13:23:10 +02007053echo "libudev $libudev"
Paolo Bonzinif3494742019-01-23 14:56:17 +08007054echo "default devices $default_devices"
Alex Bennée40e8c6f2019-06-13 14:52:25 +01007055echo "plugin support $plugins"
Alexander Bulekovadc28022020-02-19 23:11:14 -05007056echo "fuzzing support $fuzzing"
Alex Bennéef48e5902020-03-16 17:21:48 +00007057echo "gdb $gdb_bin"
Marek Marczykowski-Góreckib767d252020-05-20 15:20:23 +02007058echo "rng-none $rng_none"
Alexey Krasikov54e7aac2020-05-25 14:19:12 +03007059echo "Linux keyring $secret_keyring"
bellard67b915a2004-03-31 23:37:16 +00007060
Peter Maydell898be3e2017-03-21 14:31:57 +00007061if test "$supported_cpu" = "no"; then
7062 echo
7063 echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
7064 echo
7065 echo "CPU host architecture $cpu support is not currently maintained."
7066 echo "The QEMU project intends to remove support for this host CPU in"
7067 echo "a future release if nobody volunteers to maintain it and to"
7068 echo "provide a build host for our continuous integration setup."
7069 echo "configure has succeeded and you can continue to build, but"
7070 echo "if you care about QEMU on this platform you should contact"
7071 echo "us upstream at qemu-devel@nongnu.org."
7072fi
7073
7074if test "$supported_os" = "no"; then
7075 echo
7076 echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!"
7077 echo
Peter Maydellc50126a2017-03-21 18:08:49 +00007078 echo "Host OS $targetos support is not currently maintained."
7079 echo "The QEMU project intends to remove support for this host OS in"
Peter Maydell898be3e2017-03-21 14:31:57 +00007080 echo "a future release if nobody volunteers to maintain it and to"
7081 echo "provide a build host for our continuous integration setup."
7082 echo "configure has succeeded and you can continue to build, but"
7083 echo "if you care about QEMU on this platform you should contact"
7084 echo "us upstream at qemu-devel@nongnu.org."
7085fi
7086
Juan Quintela98ec69a2009-07-16 18:34:18 +02007087config_host_mak="config-host.mak"
bellard97a847b2003-08-10 21:36:04 +00007088
Stefan Weildbd99ae2013-01-01 18:33:44 +01007089echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
7090
Juan Quintela98ec69a2009-07-16 18:34:18 +02007091echo "# Automatically generated by configure - do not modify" > $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02007092echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02007093
Paolo Bonzinie6c3b0f2010-10-21 10:18:35 +02007094echo all: >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02007095echo "prefix=$prefix" >> $config_host_mak
7096echo "bindir=$bindir" >> $config_host_mak
Alon Levy3aa5d2b2011-05-15 12:08:59 +03007097echo "libdir=$libdir" >> $config_host_mak
Michael Tokarev8bf188a2012-06-07 01:11:00 +04007098echo "libexecdir=$libexecdir" >> $config_host_mak
Alon Levy0f94d6d2011-06-27 11:58:20 +02007099echo "includedir=$includedir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02007100echo "mandir=$mandir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02007101echo "sysconfdir=$sysconfdir" >> $config_host_mak
Eduardo Habkost22d07032012-04-18 16:55:42 -03007102echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
Eduardo Habkost9afa52c2012-04-18 16:55:46 -03007103echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +02007104echo "qemu_firmwarepath=$firmwarepath" >> $config_host_mak
Eduardo Habkost9afa52c2012-04-18 16:55:46 -03007105echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
Fam Zhenge26110c2014-02-10 14:48:57 +08007106echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02007107if test "$mingw32" = "no" ; then
7108 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
7109fi
Michael Tokarevf354b1a2012-10-21 22:52:54 +04007110echo "qemu_helperdir=$libexecdir" >> $config_host_mak
Anthony Liguori834574e2013-02-20 07:43:24 -06007111echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
Daniel P. Berrangéa8260d32019-01-10 12:00:45 +00007112echo "qemu_icondir=$qemu_icondir" >> $config_host_mak
Daniel P. Berrangé67ea9542019-01-10 12:00:46 +00007113echo "qemu_desktopdir=$qemu_desktopdir" >> $config_host_mak
Daniel P. Berrangé02f91352019-05-16 10:51:34 +01007114echo "libs_cpu=$libs_cpu" >> $config_host_mak
Paolo Bonzinif544a482013-04-17 16:26:44 +02007115echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
Daniel P. Berrangecc84d632017-10-20 15:02:43 +01007116echo "GIT=$git" >> $config_host_mak
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01007117echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +01007118echo "GIT_UPDATE=$git_update" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02007119
Juan Quintela98ec69a2009-07-16 18:34:18 +02007120echo "ARCH=$ARCH" >> $config_host_mak
Paolo Bonzini727e5282013-04-17 16:26:43 +02007121
Alex Bennée777dddc2020-07-13 21:04:09 +01007122echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
7123echo "GLIB_LDFLAGS=$glib_ldflags" >> $config_host_mak
7124
Paolo Bonzinif3494742019-01-23 14:56:17 +08007125if test "$default_devices" = "yes" ; then
7126 echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak
7127else
7128 echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak
7129fi
aurel32f8393942009-04-13 18:45:38 +00007130if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02007131 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00007132fi
aliguori1625af82009-04-05 17:41:02 +00007133if test "$strip_opt" = "yes" ; then
Hollis Blanchard52ba7842010-08-04 17:21:34 -07007134 echo "STRIP=${strip}" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00007135fi
bellard7d132992003-03-06 23:23:54 +00007136if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02007137 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00007138fi
bellard67b915a2004-03-31 23:37:16 +00007139if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02007140 echo "CONFIG_WIN32=y" >> $config_host_mak
Stefan Weil89138852016-05-16 15:10:20 +02007141 rc_version=$(cat $source_path/VERSION)
Blue Swirl9fe6de92010-09-26 16:07:57 +00007142 version_major=${rc_version%%.*}
7143 rc_version=${rc_version#*.}
7144 version_minor=${rc_version%%.*}
7145 rc_version=${rc_version#*.}
7146 version_subminor=${rc_version%%.*}
7147 version_micro=0
7148 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
7149 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04007150 if test "$guest_agent_with_vss" = "yes" ; then
7151 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
Michael Rothf33ca812015-08-26 16:19:41 -05007152 echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04007153 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
7154 fi
Michael Roth50cbebb2015-07-07 18:10:09 -05007155 if test "$guest_agent_ntddscsi" = "yes" ; then
Tomáš Golembiovský76dc75c2018-10-23 13:23:16 +02007156 echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak
Michael Roth50cbebb2015-07-07 18:10:09 -05007157 fi
Michael Roth1a349042015-08-26 11:14:31 -05007158 if test "$guest_agent_msi" = "yes"; then
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08007159 echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
Yossi Hindin9dacf322015-05-06 14:57:40 +03007160 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
7161 echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
7162 echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
7163 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
7164 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
7165 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
7166 fi
pbrook210fa552007-02-27 21:04:49 +00007167else
Juan Quintela35f4df22009-07-27 16:13:07 +02007168 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00007169fi
blueswir1128ab2f2008-08-15 18:33:42 +00007170
Mark McLoughlindffcb712009-10-22 17:49:11 +01007171if test "$linux" = "yes" ; then
7172 echo "CONFIG_LINUX=y" >> $config_host_mak
7173fi
7174
bellard83fb7ad2004-07-05 21:25:26 +00007175if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02007176 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00007177fi
malcb29fe3e2008-11-18 01:42:22 +00007178
bellardec530c82006-04-25 22:36:06 +00007179if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02007180 echo "CONFIG_SOLARIS=y" >> $config_host_mak
bellardec530c82006-04-25 22:36:06 +00007181fi
Andreas Färber179cf402010-09-20 00:50:43 +02007182if test "$haiku" = "yes" ; then
7183 echo "CONFIG_HAIKU=y" >> $config_host_mak
7184fi
bellard97a847b2003-08-10 21:36:04 +00007185if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02007186 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00007187fi
Stefan Weil1ba16962011-07-29 22:40:45 +02007188if test "$profiler" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02007189 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00007190fi
Paolo Bonzinic932ce32019-07-18 12:24:29 +02007191if test "$want_tools" = "yes" ; then
7192 echo "CONFIG_TOOLS=y" >> $config_host_mak
7193fi
Marc-André Lureau675b9b52019-02-12 17:25:23 +01007194if test "$slirp" != "no"; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02007195 echo "CONFIG_SLIRP=y" >> $config_host_mak
Brade2d88302011-09-02 16:53:28 -04007196 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
Marc-André Lureau675b9b52019-02-12 17:25:23 +01007197 echo "SLIRP_CFLAGS=$slirp_cflags" >> $config_host_mak
7198 echo "SLIRP_LIBS=$slirp_libs" >> $config_host_mak
7199fi
Marc-André Lureau7c57bdd82019-04-24 13:00:41 +02007200if [ "$slirp" = "git" -o "$slirp" = "internal" ]; then
Markus Armbruster3b8593e2019-05-28 10:23:07 +02007201 echo "config-host.h: slirp/all" >> $config_host_mak
bellardc20709a2004-04-21 23:27:19 +00007202fi
ths8a16d272008-07-19 09:56:24 +00007203if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02007204 echo "CONFIG_VDE=y" >> $config_host_mak
Fam Zhenge2ad6f12017-09-07 16:35:52 +08007205 echo "VDE_LIBS=$vde_libs" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00007206fi
Vincenzo Maffione58952132013-11-06 11:44:06 +01007207if test "$netmap" = "yes" ; then
7208 echo "CONFIG_NETMAP=y" >> $config_host_mak
7209fi
Gonglei015a33b2014-07-01 20:58:08 +08007210if test "$l2tpv3" = "yes" ; then
7211 echo "CONFIG_L2TPV3=y" >> $config_host_mak
7212fi
Paolo Bonzini4cc600d2020-02-04 17:11:04 +01007213if test "$gprof" = "yes" ; then
7214 echo "CONFIG_GPROF=y" >> $config_host_mak
7215fi
Corey Bryant47e98652012-01-26 09:42:26 -05007216if test "$cap_ng" = "yes" ; then
Paolo Bonzinia358bca2019-11-29 11:42:53 +01007217 echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak
Corey Bryant47e98652012-01-26 09:42:26 -05007218fi
Juan Quintela2358a492009-07-27 16:13:25 +02007219echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00007220for drv in $audio_drv_list; do
Gerd Hoffmann1ef1ec22018-03-01 11:05:46 +01007221 def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
Gerd Hoffmannce3dc032018-03-06 08:40:50 +01007222 case "$drv" in
Gerd Hoffmann051c7d52018-03-06 08:40:53 +01007223 alsa | oss | pa | sdl)
Gerd Hoffmannce3dc032018-03-06 08:40:50 +01007224 echo "$def=m" >> $config_host_mak ;;
7225 *)
7226 echo "$def=y" >> $config_host_mak ;;
7227 esac
malc0c58ac12008-06-25 21:04:05 +00007228done
Fam Zhengb1149912017-09-07 16:29:13 +08007229echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak
7230echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak
7231echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak
7232echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak
7233echo "OSS_LIBS=$oss_libs" >> $config_host_mak
Geoffrey McRae2e445702020-04-29 15:53:58 +10007234echo "JACK_LIBS=$jack_libs" >> $config_host_mak
malcd5631632009-10-10 01:13:41 +04007235if test "$audio_win_int" = "yes" ; then
7236 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
7237fi
Fam Zhengb64ec4e2013-05-29 19:35:40 +08007238echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
7239echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
Jes Sorensen821601e2011-03-16 13:33:36 +01007240if test "$vnc" = "yes" ; then
7241 echo "CONFIG_VNC=y" >> $config_host_mak
7242fi
aliguori2f9606b2009-03-06 20:27:28 +00007243if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02007244 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00007245fi
Jes Sorensen821601e2011-03-16 13:33:36 +01007246if test "$vnc_jpeg" = "yes" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02007247 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
Corentin Chary2f6f5c72010-07-07 20:57:49 +02007248fi
Jes Sorensen821601e2011-03-16 13:33:36 +01007249if test "$vnc_png" = "yes" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02007250 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
Corentin Charyefe556a2010-07-07 20:57:56 +02007251fi
Gerd Hoffmann6a021532017-10-05 17:33:28 +02007252if test "$xkbcommon" = "yes" ; then
7253 echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak
7254 echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak
7255fi
Christoph Hellwigdce512d2010-12-17 11:41:15 +01007256if test "$xfs" = "yes" ; then
7257 echo "CONFIG_XFS=y" >> $config_host_mak
7258fi
Stefan Weil89138852016-05-16 15:10:20 +02007259qemu_version=$(head $source_path/VERSION)
Juan Quintela98ec69a2009-07-16 18:34:18 +02007260echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02007261echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02007262echo "SRC_PATH=$source_path" >> $config_host_mak
Alex Bennée2b1f35b2018-07-04 07:30:11 +01007263echo "TARGET_DIRS=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02007264if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02007265 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00007266fi
Fam Zheng17969262014-02-10 14:48:56 +08007267if test "$modules" = "yes"; then
Fam Zhenge26110c2014-02-10 14:48:57 +08007268 # $shacmd can generate a hash started with digit, which the compiler doesn't
7269 # like as an symbol. So prefix it with an underscore
Stefan Weil89138852016-05-16 15:10:20 +02007270 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
Fam Zheng17969262014-02-10 14:48:56 +08007271 echo "CONFIG_MODULES=y" >> $config_host_mak
7272fi
Christian Ehrhardtbd83c862020-03-10 15:58:06 +01007273if test "$module_upgrades" = "yes"; then
7274 echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
7275fi
Eric Blakee633a5c2019-02-04 20:39:37 -06007276if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then
Gerd Hoffmann87815952018-03-01 11:05:42 +01007277 echo "CONFIG_X11=y" >> $config_host_mak
7278 echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak
7279 echo "X11_LIBS=$x11_libs" >> $config_host_mak
7280fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02007281if test "$sdl" = "yes" ; then
Gerd Hoffmann96400a12018-03-01 11:05:47 +01007282 echo "CONFIG_SDL=m" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02007283 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
Fam Zheng8ecc89f2017-09-07 16:29:11 +08007284 echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
Daniel P. Berrangéa442fe22019-01-10 12:00:47 +00007285 if test "$sdl_image" = "yes" ; then
7286 echo "CONFIG_SDL_IMAGE=y" >> $config_host_mak
7287 fi
bellard49ecc3f2007-11-07 19:25:15 +00007288fi
7289if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02007290 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00007291fi
Samuel Thibaulte08bb302019-03-11 14:51:26 +01007292if test "$iconv" = "yes" ; then
7293 echo "CONFIG_ICONV=y" >> $config_host_mak
7294 echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak
7295 echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak
7296fi
balrog4d3b6f62008-02-10 16:33:14 +00007297if test "$curses" = "yes" ; then
Gerd Hoffmann2373f7d2018-03-01 11:05:45 +01007298 echo "CONFIG_CURSES=m" >> $config_host_mak
7299 echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak
7300 echo "CURSES_LIBS=$curses_lib" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00007301fi
Riku Voipio099d6b02009-05-05 12:10:04 +03007302if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02007303 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03007304fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01007305if test "$accept4" = "yes" ; then
7306 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
7307fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05307308if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02007309 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05307310fi
Riku Voipioc2882b92009-08-12 15:08:24 +03007311if test "$eventfd" = "yes" ; then
7312 echo "CONFIG_EVENTFD=y" >> $config_host_mak
7313fi
Marc-André Lureau751bcc32015-10-09 17:17:16 +02007314if test "$memfd" = "yes" ; then
7315 echo "CONFIG_MEMFD=y" >> $config_host_mak
7316fi
Cortland Tölva955727d2018-10-08 09:35:19 -07007317if test "$have_usbfs" = "yes" ; then
7318 echo "CONFIG_USBFS=y" >> $config_host_mak
7319fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03007320if test "$fallocate" = "yes" ; then
7321 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
7322fi
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01007323if test "$fallocate_punch_hole" = "yes" ; then
7324 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
7325fi
Denis V. Lunevb953f072015-01-30 11:42:14 +03007326if test "$fallocate_zero_range" = "yes" ; then
7327 echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak
7328fi
Kevin Wolfed911432014-09-29 17:12:59 +02007329if test "$posix_fallocate" = "yes" ; then
7330 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
7331fi
Peter Maydellc727f472011-01-06 11:05:10 +00007332if test "$sync_file_range" = "yes" ; then
7333 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
7334fi
Peter Maydelldace20d2011-01-10 13:11:24 +00007335if test "$fiemap" = "yes" ; then
7336 echo "CONFIG_FIEMAP=y" >> $config_host_mak
7337fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03007338if test "$dup3" = "yes" ; then
7339 echo "CONFIG_DUP3=y" >> $config_host_mak
7340fi
Alex Bligh4e0c6522013-08-21 16:02:43 +01007341if test "$ppoll" = "yes" ; then
7342 echo "CONFIG_PPOLL=y" >> $config_host_mak
7343fi
Alex Blighcd758dd2013-08-21 16:02:44 +01007344if test "$prctl_pr_set_timerslack" = "yes" ; then
7345 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
7346fi
Peter Maydell3b6edd12011-02-15 18:35:05 +00007347if test "$epoll" = "yes" ; then
7348 echo "CONFIG_EPOLL=y" >> $config_host_mak
7349fi
7350if test "$epoll_create1" = "yes" ; then
7351 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
7352fi
Peter Maydella8fd1ab2013-02-08 07:31:55 +00007353if test "$sendfile" = "yes" ; then
7354 echo "CONFIG_SENDFILE=y" >> $config_host_mak
7355fi
Riku Voipio51834342014-06-22 11:25:42 +01007356if test "$timerfd" = "yes" ; then
7357 echo "CONFIG_TIMERFD=y" >> $config_host_mak
7358fi
Riku Voipio9af5c902014-08-12 15:58:57 +03007359if test "$setns" = "yes" ; then
7360 echo "CONFIG_SETNS=y" >> $config_host_mak
7361fi
Aleksandar Markovic38860a02016-10-10 13:23:29 +02007362if test "$clock_adjtime" = "yes" ; then
7363 echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak
7364fi
Aleksandar Markovic5a03cd02016-10-10 13:23:30 +02007365if test "$syncfs" = "yes" ; then
7366 echo "CONFIG_SYNCFS=y" >> $config_host_mak
7367fi
Aleksandar Markovicdb37dd82020-01-16 23:49:49 +01007368if test "$kcov" = "yes" ; then
7369 echo "CONFIG_KCOV=y" >> $config_host_mak
7370fi
aurel323b3f24a2009-04-15 16:12:13 +00007371if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02007372 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00007373fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00007374if test "$inotify1" = "yes" ; then
7375 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
7376fi
Peter Maydell401bc052017-09-05 13:19:32 +01007377if test "$sem_timedwait" = "yes" ; then
7378 echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak
7379fi
Keno Fischer5c99fa32018-06-29 12:32:10 +02007380if test "$strchrnul" = "yes" ; then
7381 echo "HAVE_STRCHRNUL=y" >> $config_host_mak
7382fi
Jiufei Xue8a792b02019-04-17 03:08:56 +08007383if test "$st_atim" = "yes" ; then
7384 echo "HAVE_STRUCT_STAT_ST_ATIM=y" >> $config_host_mak
7385fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02007386if test "$byteswap_h" = "yes" ; then
7387 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
7388fi
7389if test "$bswap_h" = "yes" ; then
7390 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
7391fi
Alexander Graf769ce762009-05-11 17:41:42 +02007392if test "$curl" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08007393 echo "CONFIG_CURL=m" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02007394 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08007395 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02007396fi
aurel322e4d9fb2008-04-08 06:01:02 +00007397if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02007398 echo "CONFIG_BRLAPI=y" >> $config_host_mak
Fam Zheng8eca2882017-09-07 16:47:00 +08007399 echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00007400fi
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06007401if test "$gtk" = "yes" ; then
Gerd Hoffmanne0fb1292018-03-01 11:05:44 +01007402 echo "CONFIG_GTK=m" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06007403 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
Gerd Hoffmann014cb152015-12-03 12:56:34 +01007404 echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
Gerd Hoffmann925a0402015-05-26 12:26:21 +02007405 if test "$gtk_gl" = "yes" ; then
7406 echo "CONFIG_GTK_GL=y" >> $config_host_mak
7407 fi
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01007408fi
Marc-André Lureauf876b762019-02-21 12:07:00 +01007409if test "$gio" = "yes" ; then
7410 echo "CONFIG_GIO=y" >> $config_host_mak
7411 echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak
7412 echo "GIO_LIBS=$gio_libs" >> $config_host_mak
Marc-André Lureau25a97a52019-09-27 11:34:42 +04007413 echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak
Marc-André Lureauf876b762019-02-21 12:07:00 +01007414fi
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +01007415echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01007416if test "$gnutls" = "yes" ; then
7417 echo "CONFIG_GNUTLS=y" >> $config_host_mak
7418fi
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01007419if test "$gcrypt" = "yes" ; then
7420 echo "CONFIG_GCRYPT=y" >> $config_host_mak
Longpeng(Mike)1f923c72016-12-13 18:42:55 +08007421 if test "$gcrypt_hmac" = "yes" ; then
7422 echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak
7423 fi
Daniel P. Berrange62893b62015-07-01 18:10:33 +01007424fi
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01007425if test "$nettle" = "yes" ; then
7426 echo "CONFIG_NETTLE=y" >> $config_host_mak
Radim Krčmářbecaeb72015-07-10 19:18:00 +02007427 echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak
Daniel P. Berrangeed754742015-07-01 18:10:34 +01007428fi
Daniel P. Berrangée0576942019-10-14 17:28:27 +01007429if test "$qemu_private_xts" = "yes" ; then
7430 echo "CONFIG_QEMU_PRIVATE_XTS=y" >> $config_host_mak
7431fi
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01007432if test "$tasn1" = "yes" ; then
7433 echo "CONFIG_TASN1=y" >> $config_host_mak
7434fi
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01007435if test "$auth_pam" = "yes" ; then
7436 echo "CONFIG_AUTH_PAM=y" >> $config_host_mak
7437fi
Daniel P. Berrange559607e2015-02-27 16:19:33 +00007438if test "$have_ifaddrs_h" = "yes" ; then
7439 echo "HAVE_IFADDRS_H=y" >> $config_host_mak
7440fi
Chen Gange865b972020-06-05 09:32:21 +08007441if test "$have_drm_h" = "yes" ; then
7442 echo "HAVE_DRM_H=y" >> $config_host_mak
7443fi
Eric Blake6b39b062016-10-11 10:46:23 -05007444if test "$have_broken_size_max" = "yes" ; then
7445 echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
7446fi
Thomas Huth9df8b202020-06-29 14:13:24 +02007447if test "$have_openpty" = "yes" ; then
7448 echo "HAVE_OPENPTY=y" >> $config_host_mak
7449fi
David CARLIER2a4b4722020-07-13 14:36:09 +01007450if test "$have_sys_signal_h" = "yes" ; then
7451 echo "HAVE_SYS_SIGNAL_H=y" >> $config_host_mak
7452fi
Jan Vesely277abf12016-04-29 13:15:23 -04007453
7454# Work around a system header bug with some kernel/XFS header
7455# versions where they both try to define 'struct fsxattr':
7456# xfs headers will not try to redefine structs from linux headers
7457# if this macro is set.
7458if test "$have_fsxattr" = "yes" ; then
7459 echo "HAVE_FSXATTR=y" >> $config_host_mak
7460fi
Fam Zheng1efad062018-06-01 17:26:43 +08007461if test "$have_copy_file_range" = "yes" ; then
7462 echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak
7463fi
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01007464if test "$vte" = "yes" ; then
7465 echo "CONFIG_VTE=y" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06007466 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
Gerd Hoffmanne0fb1292018-03-01 11:05:44 +01007467 echo "VTE_LIBS=$vte_libs" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06007468fi
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +02007469if test "$virglrenderer" = "yes" ; then
7470 echo "CONFIG_VIRGL=y" >> $config_host_mak
7471 echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak
7472 echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak
7473fi
aliguorie37630c2009-04-22 15:19:10 +00007474if test "$xen" = "yes" ; then
Jan Kiszka6dbd5882011-06-21 22:59:07 +02007475 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00007476 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00007477fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02007478if test "$linux_aio" = "yes" ; then
7479 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
7480fi
Aarushi Mehtac10dd852020-01-20 14:18:44 +00007481if test "$linux_io_uring" = "yes" ; then
7482 echo "CONFIG_LINUX_IO_URING=y" >> $config_host_mak
7483 echo "LINUX_IO_URING_CFLAGS=$linux_io_uring_cflags" >> $config_host_mak
7484 echo "LINUX_IO_URING_LIBS=$linux_io_uring_libs" >> $config_host_mak
7485fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07007486if test "$attr" = "yes" ; then
7487 echo "CONFIG_ATTR=y" >> $config_host_mak
7488fi
Avi Kivity4f26f2b2011-11-09 14:44:52 +02007489if test "$libattr" = "yes" ; then
7490 echo "CONFIG_LIBATTR=y" >> $config_host_mak
7491fi
Meador Inge983eef52012-02-24 14:00:42 +05307492if test "$virtfs" = "yes" ; then
7493 echo "CONFIG_VIRTFS=y" >> $config_host_mak
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07007494fi
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02007495if test "$mpath" = "yes" ; then
7496 echo "CONFIG_MPATH=y" >> $config_host_mak
Murilo Opsfelder Araujo1b0578f2018-08-10 11:11:16 -03007497 if test "$mpathpersist_new_api" = "yes"; then
7498 echo "CONFIG_MPATH_NEW_API=y" >> $config_host_mak
7499 fi
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02007500fi
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00007501if test "$vhost_scsi" = "yes" ; then
7502 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
7503fi
Paolo Bonziniaf3bba72019-02-14 18:35:52 +01007504if test "$vhost_net" = "yes" ; then
7505 echo "CONFIG_VHOST_NET=y" >> $config_host_mak
7506fi
7507if test "$vhost_net_user" = "yes" ; then
Paolo Bonzini56f41de2019-02-14 18:35:49 +01007508 echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +03007509fi
Cindy Lu108a6482020-07-01 22:55:37 +08007510if test "$vhost_net_vdpa" = "yes" ; then
7511 echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak
7512fi
Gonglei042cea22018-03-01 21:46:28 +08007513if test "$vhost_crypto" = "yes" ; then
7514 echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
7515fi
Stefan Hajnoczifc0b9b02016-08-16 13:27:22 +01007516if test "$vhost_vsock" = "yes" ; then
7517 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
Stefano Garzarella5fe97d82020-05-22 14:25:11 +02007518 if test "$vhost_user" = "yes" ; then
7519 echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak
7520 fi
Stefan Hajnoczifc0b9b02016-08-16 13:27:22 +01007521fi
Paolo Bonzini299e6f12019-02-14 18:35:53 +01007522if test "$vhost_kernel" = "yes" ; then
7523 echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
7524fi
Marc-André Lureaue6a74862017-08-03 11:07:46 +02007525if test "$vhost_user" = "yes" ; then
7526 echo "CONFIG_VHOST_USER=y" >> $config_host_mak
7527fi
Cindy Lu108a6482020-07-01 22:55:37 +08007528if test "$vhost_vdpa" = "yes" ; then
7529 echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak
7530fi
Dr. David Alan Gilbert98fc1ad2019-09-30 11:51:34 +01007531if test "$vhost_user_fs" = "yes" ; then
7532 echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
7533fi
ths77755342008-11-27 15:45:16 +00007534if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02007535 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00007536fi
aliguoribf9298b2008-12-05 20:05:26 +00007537if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02007538 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00007539fi
aliguoriceb42de2009-04-07 18:43:28 +00007540if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02007541 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00007542fi
Philippe Mathieu-Daudée3971d62018-04-15 20:05:20 -03007543if test "$fdt" != "no" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02007544 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00007545fi
Paolo Bonzinia40161c2018-02-16 10:05:23 +01007546if test "$membarrier" = "yes" ; then
7547 echo "CONFIG_MEMBARRIER=y" >> $config_host_mak
7548fi
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03007549if test "$signalfd" = "yes" ; then
7550 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
7551fi
Richard W.M. Jonesd339d762019-01-18 10:11:14 +00007552if test "$optreset" = "yes" ; then
7553 echo "HAVE_OPTRESET=y" >> $config_host_mak
7554fi
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +02007555if test "$tcg" = "yes"; then
7556 echo "CONFIG_TCG=y" >> $config_host_mak
7557 if test "$tcg_interpreter" = "yes" ; then
7558 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
7559 fi
Stefan Weil9195b2c2011-10-19 07:07:18 +02007560fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00007561if test "$fdatasync" = "yes" ; then
7562 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
7563fi
Andreas Färbere78815a2010-09-25 11:26:05 +00007564if test "$madvise" = "yes" ; then
7565 echo "CONFIG_MADVISE=y" >> $config_host_mak
7566fi
7567if test "$posix_madvise" = "yes" ; then
7568 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
7569fi
Andreas Gustafsson9bc5a712018-01-04 19:39:36 +02007570if test "$posix_memalign" = "yes" ; then
7571 echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak
7572fi
bellard97a847b2003-08-10 21:36:04 +00007573
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01007574if test "$spice" = "yes" ; then
7575 echo "CONFIG_SPICE=y" >> $config_host_mak
7576fi
7577
Marc-André Lureau7b02f542015-08-30 11:48:40 +02007578if test "$smartcard" = "yes" ; then
7579 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
Fam Zheng7b62bf52017-09-07 16:29:16 +08007580 echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak
7581 echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak
Robert Relyea111a38b2010-11-28 16:36:38 +02007582fi
7583
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01007584if test "$libusb" = "yes" ; then
7585 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
Fam Zhengb878b652017-09-07 16:29:17 +08007586 echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak
7587 echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01007588fi
7589
Hans de Goede69354a82011-07-19 11:04:10 +02007590if test "$usb_redir" = "yes" ; then
7591 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
Fam Zhengcc7923f2017-09-07 16:29:18 +08007592 echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak
7593 echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak
Hans de Goede69354a82011-07-19 11:04:10 +02007594fi
7595
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01007596if test "$opengl" = "yes" ; then
7597 echo "CONFIG_OPENGL=y" >> $config_host_mak
7598 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
Gerd Hoffmann014cb152015-12-03 12:56:34 +01007599 if test "$opengl_dmabuf" = "yes" ; then
7600 echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
7601 fi
Michael Walle20ff0752011-03-07 23:32:39 +01007602fi
7603
Marc-André Lureaud52c4542019-05-24 15:09:42 +02007604if test "$gbm" = "yes" ; then
7605 echo "CONFIG_GBM=y" >> $config_host_mak
7606 echo "GBM_LIBS=$gbm_libs" >> $config_host_mak
7607 echo "GBM_CFLAGS=$gbm_cflags" >> $config_host_mak
7608fi
7609
7610
Yang Zhong5a22ab72017-12-20 21:16:46 +08007611if test "$malloc_trim" = "yes" ; then
7612 echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak
7613fi
7614
Liang Li99f2dbd2016-03-08 13:53:16 +08007615if test "$avx2_opt" = "yes" ; then
7616 echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
7617fi
7618
Robert Hoo6b8cd442020-02-29 20:34:34 +08007619if test "$avx512f_opt" = "yes" ; then
7620 echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak
7621fi
7622
qiaonuohan607dacd2014-02-18 14:11:30 +08007623if test "$lzo" = "yes" ; then
7624 echo "CONFIG_LZO=y" >> $config_host_mak
7625fi
7626
7627if test "$snappy" = "yes" ; then
7628 echo "CONFIG_SNAPPY=y" >> $config_host_mak
7629fi
7630
Peter Wu6b383c02015-01-06 18:48:14 +01007631if test "$bzip2" = "yes" ; then
7632 echo "CONFIG_BZIP2=y" >> $config_host_mak
7633 echo "BZIP2_LIBS=-lbz2" >> $config_host_mak
7634fi
7635
Julio Faracco83bc1f92018-11-05 13:08:04 -02007636if test "$lzfse" = "yes" ; then
7637 echo "CONFIG_LZFSE=y" >> $config_host_mak
7638 echo "LZFSE_LIBS=-llzfse" >> $config_host_mak
7639fi
7640
Juan Quintela3a678482019-12-17 21:15:24 +01007641if test "$zstd" = "yes" ; then
7642 echo "CONFIG_ZSTD=y" >> $config_host_mak
7643fi
7644
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11007645if test "$libiscsi" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08007646 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08007647 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
7648 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11007649fi
7650
Peter Lieven6542aa92014-02-03 10:26:13 +01007651if test "$libnfs" = "yes" ; then
Colin Lord4be48792016-08-12 09:27:04 -04007652 echo "CONFIG_LIBNFS=m" >> $config_host_mak
7653 echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
Peter Lieven6542aa92014-02-03 10:26:13 +01007654fi
7655
Eduardo Otubof7945732012-08-14 18:44:05 -03007656if test "$seccomp" = "yes"; then
7657 echo "CONFIG_SECCOMP=y" >> $config_host_mak
Fam Zhengc3883e12017-09-07 16:53:16 +08007658 echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
7659 echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak
Eduardo Otubof7945732012-08-14 18:44:05 -03007660fi
7661
bellard83fb7ad2004-07-05 21:25:26 +00007662# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00007663if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02007664 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00007665fi
7666
Daniel P. Berrange4d9310f2015-09-22 15:13:26 +01007667if test "$localtime_r" = "yes" ; then
7668 echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
7669fi
Paolo Bonzini3556c232013-05-10 14:16:40 +02007670if test "$qom_cast_debug" = "yes" ; then
7671 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
7672fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01007673if test "$rbd" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08007674 echo "CONFIG_RBD=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08007675 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
7676 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
Christian Brunnerf27aaf42010-12-06 20:53:01 +01007677fi
Anthony Liguori20ff6c82009-12-09 12:59:36 -06007678
Peter Maydell7c2acc72013-04-08 12:11:27 +01007679echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02007680if test "$coroutine_pool" = "yes" ; then
7681 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
7682else
7683 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
7684fi
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05307685
Peter Lieven7d992e42016-09-27 11:58:45 +02007686if test "$debug_stack_usage" = "yes" ; then
7687 echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
7688fi
7689
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04007690if test "$crypto_afalg" = "yes" ; then
7691 echo "CONFIG_AF_ALG=y" >> $config_host_mak
7692fi
7693
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05307694if test "$open_by_handle_at" = "yes" ; then
7695 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
7696fi
7697
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05307698if test "$linux_magic_h" = "yes" ; then
7699 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
7700fi
7701
Kevin Wolf3f4349d2012-06-29 13:40:27 +02007702if test "$valgrind_h" = "yes" ; then
7703 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
7704fi
7705
Marc-André Lureaud83414e2018-01-16 16:11:52 +01007706if test "$have_asan_iface_fiber" = "yes" ; then
7707 echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak
7708fi
7709
Lingfeng Yang0aebab02020-06-12 20:02:23 +01007710if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then
7711 echo "CONFIG_TSAN=y" >> $config_host_mak
7712fi
7713
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03007714if test "$has_environ" = "yes" ; then
7715 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
7716fi
7717
Richard Henderson76a347e2012-12-28 14:17:02 -08007718if test "$cpuid_h" = "yes" ; then
7719 echo "CONFIG_CPUID_H=y" >> $config_host_mak
7720fi
7721
Richard Hendersonf5401662013-02-16 12:46:59 -08007722if test "$int128" = "yes" ; then
7723 echo "CONFIG_INT128=y" >> $config_host_mak
7724fi
7725
Richard Henderson7ebee432016-06-29 21:10:59 -07007726if test "$atomic128" = "yes" ; then
7727 echo "CONFIG_ATOMIC128=y" >> $config_host_mak
7728fi
7729
Richard Hendersone6cd4bb2018-08-15 16:31:47 -07007730if test "$cmpxchg128" = "yes" ; then
7731 echo "CONFIG_CMPXCHG128=y" >> $config_host_mak
7732fi
7733
Richard Hendersondf79b992016-09-02 12:23:57 -07007734if test "$atomic64" = "yes" ; then
7735 echo "CONFIG_ATOMIC64=y" >> $config_host_mak
7736fi
7737
Richard Hendersondb8aaae2019-10-13 16:12:19 -07007738if test "$attralias" = "yes" ; then
7739 echo "CONFIG_ATTRIBUTE_ALIAS=y" >> $config_host_mak
7740fi
7741
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08007742if test "$getauxval" = "yes" ; then
7743 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
7744fi
7745
Bharata B Raoeb100392012-09-24 14:42:45 +05307746if test "$glusterfs" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08007747 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08007748 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
7749 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
Bharata B Raoeb100392012-09-24 14:42:45 +05307750fi
7751
Jeff Codyd85fa9e2016-04-05 10:40:09 -04007752if test "$glusterfs_xlator_opt" = "yes" ; then
7753 echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
7754fi
7755
Bharata B Rao0c14fb42013-07-16 21:47:42 +05307756if test "$glusterfs_discard" = "yes" ; then
7757 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
7758fi
7759
Niels de Vosdf3a4292017-05-28 12:01:14 +05307760if test "$glusterfs_fallocate" = "yes" ; then
7761 echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
7762fi
7763
Bharata B Rao7c815372013-12-21 14:51:25 +05307764if test "$glusterfs_zerofill" = "yes" ; then
7765 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
7766fi
7767
Prasanna Kumar Kalevere014dbe2019-03-05 16:46:33 +01007768if test "$glusterfs_ftruncate_has_stat" = "yes" ; then
7769 echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak
7770fi
7771
Niels de Vos0e3b8912019-03-05 16:46:34 +01007772if test "$glusterfs_iocb_has_stat" = "yes" ; then
7773 echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak
7774fi
7775
Pino Toscanob10d49d2019-06-20 22:08:40 +02007776if test "$libssh" = "yes" ; then
7777 echo "CONFIG_LIBSSH=m" >> $config_host_mak
7778 echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak
7779 echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01007780fi
7781
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +01007782if test "$live_block_migration" = "yes" ; then
7783 echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
7784fi
7785
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01007786if test "$tpm" = "yes"; then
Paolo Bonzini3cae16d2019-07-11 19:08:36 +02007787 echo 'CONFIG_TPM=y' >> $config_host_mak
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01007788fi
7789
Lluís Vilanova5b808272014-05-27 15:02:14 +02007790echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
7791if have_backend "nop"; then
Lluís6d8a7642011-08-31 20:30:43 +02007792 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
Prerna Saxena22890ab2010-06-24 17:04:53 +05307793fi
Lluís Vilanova5b808272014-05-27 15:02:14 +02007794if have_backend "simple"; then
Lluís6d8a7642011-08-31 20:30:43 +02007795 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
7796 # Set the appropriate trace file.
Andreas Färber953ffe02011-06-02 19:58:06 +02007797 trace_file="\"$trace_file-\" FMT_pid"
Prerna Saxena9410b562010-07-13 09:26:32 +01007798fi
Paolo Bonzinied7f5f12016-01-07 16:55:30 +03007799if have_backend "log"; then
7800 echo "CONFIG_TRACE_LOG=y" >> $config_host_mak
Lluís6d8a7642011-08-31 20:30:43 +02007801fi
Lluís Vilanova5b808272014-05-27 15:02:14 +02007802if have_backend "ust"; then
Lluís6d8a7642011-08-31 20:30:43 +02007803 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
7804fi
Lluís Vilanova5b808272014-05-27 15:02:14 +02007805if have_backend "dtrace"; then
Lluís6d8a7642011-08-31 20:30:43 +02007806 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
7807 if test "$trace_backend_stap" = "yes" ; then
7808 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
7809 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00007810fi
Lluís Vilanova5b808272014-05-27 15:02:14 +02007811if have_backend "ftrace"; then
Eiichi Tsukata781e9542013-04-11 20:25:15 +09007812 if test "$linux" = "yes" ; then
7813 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
Eiichi Tsukata781e9542013-04-11 20:25:15 +09007814 else
Stewart Smith21684af2014-01-24 12:39:10 +11007815 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
Eiichi Tsukata781e9542013-04-11 20:25:15 +09007816 fi
7817fi
Paul Durrant0a852412016-08-04 14:44:14 +01007818if have_backend "syslog"; then
7819 if test "$posix_syslog" = "yes" ; then
7820 echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak
7821 else
7822 feature_not_found "syslog(trace backend)" "syslog not available"
7823 fi
7824fi
Prerna Saxena9410b562010-07-13 09:26:32 +01007825echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
7826
Michael R. Hines2da776d2013-07-22 10:01:54 -04007827if test "$rdma" = "yes" ; then
7828 echo "CONFIG_RDMA=y" >> $config_host_mak
Fam Zheng392fb642017-09-07 16:42:30 +08007829 echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
Michael R. Hines2da776d2013-07-22 10:01:54 -04007830fi
7831
Marcel Apfelbaum21ab34c2018-08-16 18:16:37 +03007832if test "$pvrdma" = "yes" ; then
7833 echo "CONFIG_PVRDMA=y" >> $config_host_mak
7834fi
7835
Laurent Vivier575b22b2016-06-02 22:14:15 +02007836if test "$have_rtnetlink" = "yes" ; then
7837 echo "CONFIG_RTNETLINK=y" >> $config_host_mak
7838fi
7839
Klim Kireeved279a02018-01-12 12:01:19 +03007840if test "$libxml2" = "yes" ; then
7841 echo "CONFIG_LIBXML2=y" >> $config_host_mak
7842 echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak
7843 echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak
7844fi
7845
Changlong Xiea6b1d4c2016-07-27 15:01:48 +08007846if test "$replication" = "yes" ; then
7847 echo "CONFIG_REPLICATION=y" >> $config_host_mak
7848fi
7849
Stefan Hajnoczi6a02c802016-10-14 10:00:55 +01007850if test "$have_af_vsock" = "yes" ; then
7851 echo "CONFIG_AF_VSOCK=y" >> $config_host_mak
7852fi
7853
Christopher Covington4d043512016-12-28 15:04:33 -05007854if test "$have_sysmacros" = "yes" ; then
7855 echo "CONFIG_SYSMACROS=y" >> $config_host_mak
7856fi
7857
Andreas Grapentin49e00a12017-03-14 17:59:53 +01007858if test "$have_static_assert" = "yes" ; then
7859 echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak
7860fi
7861
Tomáš Golembiovskýe6746052017-07-17 15:58:33 +02007862if test "$have_utmpx" = "yes" ; then
7863 echo "HAVE_UTMPX=y" >> $config_host_mak
7864fi
Richard Hendersondb1ed1a2019-03-13 20:57:28 -07007865if test "$have_getrandom" = "yes" ; then
7866 echo "CONFIG_GETRANDOM=y" >> $config_host_mak
7867fi
Kamil Rytarowskie0580342017-07-14 09:33:44 +01007868if test "$ivshmem" = "yes" ; then
7869 echo "CONFIG_IVSHMEM=y" >> $config_host_mak
7870fi
Richard Hendersone219c492017-09-28 09:01:23 -07007871if test "$capstone" != "no" ; then
Richard Henderson8ca80762017-09-14 09:41:12 -07007872 echo "CONFIG_CAPSTONE=y" >> $config_host_mak
7873fi
Paolo Bonziniba59fb72018-06-13 14:23:08 +02007874if test "$debug_mutex" = "yes" ; then
7875 echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak
7876fi
Kamil Rytarowskie0580342017-07-14 09:33:44 +01007877
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00007878# Hold two types of flag:
7879# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
7880# a thread we have a handle to
Roman Bolshakov479a5742018-12-17 23:26:01 +03007881# CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00007882# platform
Roman Bolshakov479a5742018-12-17 23:26:01 +03007883if test "$pthread_setname_np_w_tid" = "yes" ; then
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00007884 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
Roman Bolshakov479a5742018-12-17 23:26:01 +03007885 echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=y" >> $config_host_mak
7886elif test "$pthread_setname_np_wo_tid" = "yes" ; then
7887 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
7888 echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=y" >> $config_host_mak
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00007889fi
7890
Junyan He17824402018-07-18 15:47:59 +08007891if test "$libpmem" = "yes" ; then
7892 echo "CONFIG_LIBPMEM=y" >> $config_host_mak
7893fi
7894
Jingqi Liu21b2eca2020-04-29 16:50:11 +08007895if test "$libdaxctl" = "yes" ; then
7896 echo "CONFIG_LIBDAXCTL=y" >> $config_host_mak
7897fi
7898
Jeff Cody2f740132018-11-07 07:36:44 +01007899if test "$bochs" = "yes" ; then
7900 echo "CONFIG_BOCHS=y" >> $config_host_mak
7901fi
7902if test "$cloop" = "yes" ; then
7903 echo "CONFIG_CLOOP=y" >> $config_host_mak
7904fi
7905if test "$dmg" = "yes" ; then
7906 echo "CONFIG_DMG=y" >> $config_host_mak
7907fi
7908if test "$qcow1" = "yes" ; then
7909 echo "CONFIG_QCOW1=y" >> $config_host_mak
7910fi
7911if test "$vdi" = "yes" ; then
7912 echo "CONFIG_VDI=y" >> $config_host_mak
7913fi
7914if test "$vvfat" = "yes" ; then
7915 echo "CONFIG_VVFAT=y" >> $config_host_mak
7916fi
7917if test "$qed" = "yes" ; then
7918 echo "CONFIG_QED=y" >> $config_host_mak
7919fi
7920if test "$parallels" = "yes" ; then
7921 echo "CONFIG_PARALLELS=y" >> $config_host_mak
7922fi
7923if test "$sheepdog" = "yes" ; then
7924 echo "CONFIG_SHEEPDOG=y" >> $config_host_mak
7925fi
David CARLIERc9c8b882020-07-13 14:36:09 +01007926if test "$pty_h" = "yes" ; then
7927 echo "HAVE_PTY_H=y" >> $config_host_mak
7928fi
David CARLIER195588c2020-07-13 14:36:09 +01007929if test "$have_mlockall" = "yes" ; then
7930 echo "HAVE_MLOCKALL=y" >> $config_host_mak
7931fi
Alexander Bulekovadc28022020-02-19 23:11:14 -05007932if test "$fuzzing" = "yes" ; then
7933 if test "$have_fuzzer" = "yes"; then
Alexander Bulekovdd016262020-07-06 15:55:31 -04007934 FUZZ_LDFLAGS=" -fsanitize=fuzzer"
7935 FUZZ_CFLAGS=" -fsanitize=fuzzer"
Paolo Bonzini086d5f72020-02-03 15:22:17 +01007936 QEMU_CFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link"
Alexander Bulekovadc28022020-02-19 23:11:14 -05007937 else
Alexander Bulekovdd016262020-07-06 15:55:31 -04007938 error_exit "Your compiler doesn't support -fsanitize=fuzzer"
Alexander Bulekovadc28022020-02-19 23:11:14 -05007939 exit 1
7940 fi
7941fi
Jeff Cody2f740132018-11-07 07:36:44 +01007942
Alex Bennée40e8c6f2019-06-13 14:52:25 +01007943if test "$plugins" = "yes" ; then
7944 echo "CONFIG_PLUGIN=y" >> $config_host_mak
7945 LIBS="-ldl $LIBS"
Emilio G. Cota26fffe22018-10-21 13:56:29 -04007946 # Copy the export object list to the build dir
7947 if test "$ld_dynamic_list" = "yes" ; then
7948 echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak
7949 ld_symbols=qemu-plugins-ld.symbols
7950 cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols
7951 elif test "$ld_exported_symbols_list" = "yes" ; then
7952 echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak
7953 ld64_symbols=qemu-plugins-ld64.symbols
7954 echo "# Automatically generated by configure - do not modify" > $ld64_symbols
7955 grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \
7956 sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols
7957 else
7958 error_exit \
7959 "If \$plugins=yes, either \$ld_dynamic_list or " \
7960 "\$ld_exported_symbols_list should have been set to 'yes'."
7961 fi
Alex Bennée40e8c6f2019-06-13 14:52:25 +01007962fi
7963
Alex Bennéef48e5902020-03-16 17:21:48 +00007964if test -n "$gdb_bin" ; then
7965 echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
7966fi
7967
Alexey Krasikov54e7aac2020-05-25 14:19:12 +03007968if test "$secret_keyring" = "yes" ; then
7969 echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak
Alexey Krasikov92500362020-05-25 14:19:13 +03007970 if test "$have_keyutils" = "yes" ; then
7971 echo "CONFIG_TEST_SECRET_KEYRING=y" >> $config_host_mak
7972 fi
Alexey Krasikov54e7aac2020-05-25 14:19:12 +03007973fi
7974
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02007975if test "$tcg_interpreter" = "yes"; then
Paolo Bonzini25211442019-06-10 12:03:04 +02007976 QEMU_INCLUDES="-iquote ${source_path}/tcg/tci $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02007977elif test "$ARCH" = "sparc64" ; then
Paolo Bonzini25211442019-06-10 12:03:04 +02007978 QEMU_INCLUDES="-iquote ${source_path}/tcg/sparc $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02007979elif test "$ARCH" = "s390x" ; then
Paolo Bonzini25211442019-06-10 12:03:04 +02007980 QEMU_INCLUDES="-iquote ${source_path}/tcg/s390 $QEMU_INCLUDES"
Eric Blakee633a5c2019-02-04 20:39:37 -06007981elif test "$ARCH" = "x86_64" || test "$ARCH" = "x32" ; then
Paolo Bonzini25211442019-06-10 12:03:04 +02007982 QEMU_INCLUDES="-iquote ${source_path}/tcg/i386 $QEMU_INCLUDES"
Richard Henderson40d964b2014-04-30 14:07:47 -07007983elif test "$ARCH" = "ppc64" ; then
Paolo Bonzini25211442019-06-10 12:03:04 +02007984 QEMU_INCLUDES="-iquote ${source_path}/tcg/ppc $QEMU_INCLUDES"
Eric Blakee633a5c2019-02-04 20:39:37 -06007985elif test "$ARCH" = "riscv32" || test "$ARCH" = "riscv64" ; then
Paolo Bonzini25211442019-06-10 12:03:04 +02007986 QEMU_INCLUDES="-I${source_path}/tcg/riscv $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02007987else
Paolo Bonzini25211442019-06-10 12:03:04 +02007988 QEMU_INCLUDES="-iquote ${source_path}/tcg/${ARCH} $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02007989fi
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02007990
Philippe Mathieu-Daudéfdbff6b2020-04-23 12:43:45 +02007991echo "HELPERS=$helpers" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02007992echo "TOOLS=$tools" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02007993echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02007994echo "MAKE=$make" >> $config_host_mak
7995echo "INSTALL=$install" >> $config_host_mak
Brad1901cb12011-08-28 04:01:33 -04007996echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
7997echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
Michael Tokareve999ee42016-01-27 14:36:43 +03007998echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
7999echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
Blue Swirlc886edf2011-07-22 21:08:09 +00008000echo "PYTHON=$python" >> $config_host_mak
Peter Maydell2eb054c2020-02-13 17:56:18 +00008001echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
Peter Maydell516e8b72020-04-11 19:29:32 +01008002echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak
Alex Bennée39d87c82020-03-03 15:06:20 +00008003echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02008004echo "CC=$cc" >> $config_host_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03008005if $iasl -h > /dev/null 2>&1; then
8006 echo "IASL=$iasl" >> $config_host_mak
8007fi
Juan Quintela804edf22009-07-27 16:12:49 +02008008echo "HOST_CC=$host_cc" >> $config_host_mak
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04008009echo "CXX=$cxx" >> $config_host_mak
Peter Maydell3c4a4d02012-08-11 22:34:40 +01008010echo "OBJCC=$objcc" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02008011echo "AR=$ar" >> $config_host_mak
Peter Maydell45d285a2013-10-21 21:03:06 +01008012echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
Richard Hendersoncdbd7272016-07-07 21:49:36 -07008013echo "AS=$as" >> $config_host_mak
Richard Henderson5f6f0e22016-06-23 10:39:18 -07008014echo "CCAS=$ccas" >> $config_host_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00008015echo "CPP=$cpp" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02008016echo "OBJCOPY=$objcopy" >> $config_host_mak
8017echo "LD=$ld" >> $config_host_mak
Alistair Francis9f81aeb2017-11-07 17:10:46 -08008018echo "RANLIB=$ranlib" >> $config_host_mak
Stefan Weil4852ee92014-09-18 21:55:08 +02008019echo "NM=$nm" >> $config_host_mak
Alex Bennéedaa79d92019-09-19 14:07:36 +01008020echo "PKG_CONFIG=$pkg_config_exe" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00008021echo "WINDRES=$windres" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02008022echo "CFLAGS=$CFLAGS" >> $config_host_mak
Paolo Bonzini086d5f72020-02-03 15:22:17 +01008023echo "CXXFLAGS=$CXXFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05008024echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02008025echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Bruno Dominguez11cde1c2017-06-06 14:07:47 +01008026echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01008027echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01008028if test "$sparse" = "yes" ; then
8029 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
Christian Borntraeger80fd48d2015-01-22 10:53:46 +01008030 echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak
Gerd Hoffmann2944d742014-10-15 11:51:09 +02008031 echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01008032 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
8033 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
8034fi
Philippe Mathieu-Daudé8a99e9a2018-04-15 20:05:19 -03008035echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01008036echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
James Clarke6969ec62016-06-06 12:02:50 +01008037echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
Peter Maydelle57218b2016-08-08 17:11:28 +01008038echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02008039echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02008040echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Daniel P. Berrange409437e2016-07-20 14:23:13 +01008041echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02008042echo "EXESUF=$EXESUF" >> $config_host_mak
Fam Zheng17969262014-02-10 14:48:56 +08008043echo "DSOSUF=$DSOSUF" >> $config_host_mak
8044echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
Michael Roth957f1f92011-08-11 15:38:12 -05008045echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
Daniel P. Berrange90246032015-09-21 17:25:34 +01008046echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
8047echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02008048echo "POD2MAN=$POD2MAN" >> $config_host_mak
Blue Swirl1d728c32012-05-01 18:45:39 +00008049if test "$gcov" = "yes" ; then
8050 echo "CONFIG_GCOV=y" >> $config_host_mak
8051 echo "GCOV=$gcov_tool" >> $config_host_mak
8052fi
Juan Quintela804edf22009-07-27 16:12:49 +02008053
Tomáš Golembiovský3efac6e2018-10-23 13:23:10 +02008054if test "$libudev" != "no"; then
8055 echo "CONFIG_LIBUDEV=y" >> $config_host_mak
8056 echo "LIBUDEV_LIBS=$libudev_libs" >> $config_host_mak
8057fi
Alexander Bulekovadc28022020-02-19 23:11:14 -05008058if test "$fuzzing" != "no"; then
8059 echo "CONFIG_FUZZ=y" >> $config_host_mak
8060 echo "FUZZ_CFLAGS=$FUZZ_CFLAGS" >> $config_host_mak
8061 echo "FUZZ_LDFLAGS=$FUZZ_LDFLAGS" >> $config_host_mak
8062fi
Tomáš Golembiovský3efac6e2018-10-23 13:23:10 +02008063
Philippe Mathieu-Daudé05dfa222019-11-08 12:45:30 +01008064if test "$edk2_blobs" = "yes" ; then
8065 echo "DECOMPRESS_EDK2_BLOBS=y" >> $config_host_mak
8066fi
8067
Marek Marczykowski-Góreckib767d252020-05-20 15:20:23 +02008068if test "$rng_none" = "yes"; then
8069 echo "CONFIG_RNG_NONE=y" >> $config_host_mak
8070fi
8071
Peter Maydell6efd7512011-11-30 11:59:04 +00008072# use included Linux headers
8073if test "$linux" = "yes" ; then
Andreas Färbera307beb2012-06-14 15:14:33 +00008074 mkdir -p linux-headers
Peter Maydell6efd7512011-11-30 11:59:04 +00008075 case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07008076 i386|x86_64|x32)
Peter Maydell08312a62012-08-03 13:51:25 +01008077 linux_arch=x86
Peter Maydell6efd7512011-11-30 11:59:04 +00008078 ;;
Richard Hendersonf8378ac2019-05-01 15:38:18 -07008079 ppc|ppc64|ppc64le)
Peter Maydell08312a62012-08-03 13:51:25 +01008080 linux_arch=powerpc
Peter Maydell6efd7512011-11-30 11:59:04 +00008081 ;;
8082 s390x)
Peter Maydell08312a62012-08-03 13:51:25 +01008083 linux_arch=s390
8084 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +01008085 aarch64)
8086 linux_arch=arm64
8087 ;;
Sanjay Lal222e7d12014-06-17 23:10:36 +01008088 mips64)
8089 linux_arch=mips
8090 ;;
Peter Maydell08312a62012-08-03 13:51:25 +01008091 *)
8092 # For most CPUs the kernel architecture name and QEMU CPU name match.
8093 linux_arch="$cpu"
Peter Maydell6efd7512011-11-30 11:59:04 +00008094 ;;
8095 esac
Peter Maydell08312a62012-08-03 13:51:25 +01008096 # For non-KVM architectures we will not have asm headers
8097 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
8098 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
8099 fi
Peter Maydell6efd7512011-11-30 11:59:04 +00008100fi
8101
bellard1d14ffa2005-10-30 18:58:22 +00008102for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00008103target_dir="$target"
Juan Quintela25be210f2009-10-07 02:41:00 +02008104config_target_mak=$target_dir/config-target.mak
Stefan Weil89138852016-05-16 15:10:20 +02008105target_name=$(echo $target | cut -d '-' -f 1)
tony.nguyen@bt.com52bf9772019-07-18 06:01:31 +00008106target_aligned_only="no"
8107case "$target_name" in
8108 alpha|hppa|mips64el|mips64|mipsel|mips|mipsn32|mipsn32el|sh4|sh4eb|sparc|sparc64|sparc32plus|xtensa|xtensaeb)
8109 target_aligned_only="yes"
8110 ;;
8111esac
bellard97a847b2003-08-10 21:36:04 +00008112target_bigendian="no"
Paolo Bonzinic1799a82013-06-14 15:19:07 +01008113case "$target_name" in
Thomas Hutha69dc532018-08-21 13:27:48 +02008114 armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
tony.nguyen@bt.com52bf9772019-07-18 06:01:31 +00008115 target_bigendian="yes"
Juan Quintelaea2d6a32009-07-16 18:34:10 +02008116 ;;
8117esac
bellard97a847b2003-08-10 21:36:04 +00008118target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00008119target_user_only="no"
ths831b7822007-01-18 20:06:33 +00008120target_linux_user="no"
blueswir184778502008-10-26 20:33:16 +00008121target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00008122case "$target" in
Paolo Bonzinic1799a82013-06-14 15:19:07 +01008123 ${target_name}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00008124 target_softmmu="yes"
8125 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01008126 ${target_name}-linux-user)
pbrook9e407a82007-05-26 16:38:53 +00008127 target_user_only="yes"
8128 target_linux_user="yes"
8129 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01008130 ${target_name}-bsd-user)
blueswir184778502008-10-26 20:33:16 +00008131 target_user_only="yes"
8132 target_bsd_user="yes"
8133 ;;
pbrook9e407a82007-05-26 16:38:53 +00008134 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01008135 error_exit "Target '$target' not recognised"
pbrook9e407a82007-05-26 16:38:53 +00008136 exit 1
8137 ;;
8138esac
ths831b7822007-01-18 20:06:33 +00008139
bellard97a847b2003-08-10 21:36:04 +00008140mkdir -p $target_dir
Juan Quintela25be210f2009-10-07 02:41:00 +02008141echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00008142
pbrooke5fe0c52006-06-11 13:32:59 +00008143bflt="no"
Alex Bennéeca759f92017-02-23 18:29:27 +00008144mttcg="no"
Stefan Weil89138852016-05-16 15:10:20 +02008145interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g")
pbrook56aebc82008-10-11 17:55:29 +00008146gdb_xml_files=""
aliguori7ba1e612008-11-05 16:04:33 +00008147
Paolo Bonzinic1799a82013-06-14 15:19:07 +01008148TARGET_ARCH="$target_name"
Juan Quintela6acff7d2009-07-16 18:34:15 +02008149TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02008150TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02008151
Paolo Bonzinic1799a82013-06-14 15:19:07 +01008152case "$target_name" in
aurel322408a522008-04-20 20:19:44 +00008153 i386)
Emilio G. Cota0a7fa002018-08-13 20:52:26 -04008154 mttcg="yes"
Doug Gale7b0f97b2019-01-24 00:34:57 -03308155 gdb_xml_files="i386-32bit.xml"
Laurent Vivier28988112020-03-10 11:33:56 +01008156 TARGET_SYSTBL_ABI=i386
aurel322408a522008-04-20 20:19:44 +00008157 ;;
8158 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02008159 TARGET_BASE_ARCH=i386
Laurent Vivier8d62f352020-03-10 11:33:57 +01008160 TARGET_SYSTBL_ABI=common,64
Emilio G. Cota0a7fa002018-08-13 20:52:26 -04008161 mttcg="yes"
Doug Gale7b0f97b2019-01-24 00:34:57 -03308162 gdb_xml_files="i386-64bit.xml"
aurel322408a522008-04-20 20:19:44 +00008163 ;;
8164 alpha)
Richard Henderson5ee4f3c2017-02-24 09:12:43 +11008165 mttcg="yes"
Laurent Vivier6116aea2020-03-10 11:33:44 +01008166 TARGET_SYSTBL_ABI=common
aurel322408a522008-04-20 20:19:44 +00008167 ;;
8168 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02008169 TARGET_ARCH=arm
Laurent Vivier5bcb4982020-03-10 11:33:50 +01008170 TARGET_SYSTBL_ABI=common,oabi
aurel322408a522008-04-20 20:19:44 +00008171 bflt="yes"
Alex Bennéeca759f92017-02-23 18:29:27 +00008172 mttcg="yes"
Peter Maydellc888f7e2020-05-07 14:47:55 +01008173 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml arm-m-profile.xml"
aurel322408a522008-04-20 20:19:44 +00008174 ;;
Michael Weiser722dd7b2018-01-11 13:25:32 +00008175 aarch64|aarch64_be)
8176 TARGET_ARCH=aarch64
Alexander Graf6a49fa92013-09-03 20:12:22 +01008177 TARGET_BASE_ARCH=arm
8178 bflt="yes"
Alex Bennéeca759f92017-02-23 18:29:27 +00008179 mttcg="yes"
Peter Maydellc888f7e2020-05-07 14:47:55 +01008180 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml arm-m-profile.xml"
Alexander Graf6a49fa92013-09-03 20:12:22 +01008181 ;;
Michael Rolnik42f3ff02020-01-24 01:51:21 +01008182 avr)
8183 gdb_xml_files="avr-cpu.xml"
8184 target_compiler=$cross_cc_avr
8185 ;;
aurel322408a522008-04-20 20:19:44 +00008186 cris)
aurel322408a522008-04-20 20:19:44 +00008187 ;;
Richard Henderson61766fe2016-12-15 11:26:14 -08008188 hppa)
Richard Henderson7b93dab2018-01-06 16:02:27 -08008189 mttcg="yes"
Laurent Vivier9566f4c2020-03-10 11:33:45 +01008190 TARGET_SYSTBL_ABI=common,32
Richard Henderson61766fe2016-12-15 11:26:14 -08008191 ;;
Michael Walle613a22c2011-02-17 23:45:17 +01008192 lm32)
Michael Walle613a22c2011-02-17 23:45:17 +01008193 ;;
aurel322408a522008-04-20 20:19:44 +00008194 m68k)
aurel322408a522008-04-20 20:19:44 +00008195 bflt="yes"
KONRAD Frederica976ed32020-04-30 20:01:22 +01008196 gdb_xml_files="cf-core.xml cf-fp.xml m68k-core.xml m68k-fp.xml"
Laurent Vivier5b85cae2020-03-10 11:33:46 +01008197 TARGET_SYSTBL_ABI=common
aurel322408a522008-04-20 20:19:44 +00008198 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01008199 microblaze|microblazeel)
8200 TARGET_ARCH=microblaze
Laurent Vivierddf0c4c2020-03-10 11:33:49 +01008201 TARGET_SYSTBL_ABI=common
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02008202 bflt="yes"
Edgar E. Iglesiasbe73ef62018-04-13 18:10:00 +02008203 echo "TARGET_ABI32=y" >> $config_target_mak
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02008204 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02008205 mips|mipsel)
Aleksandar Markovic04547282019-02-11 17:09:29 +01008206 mttcg="yes"
Juan Quintelab498c8a2009-07-16 18:34:11 +02008207 TARGET_ARCH=mips
Juan Quintela25be210f2009-10-07 02:41:00 +02008208 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
Laurent Vivierc59716f2020-03-10 11:33:58 +01008209 TARGET_SYSTBL_ABI=o32
aurel322408a522008-04-20 20:19:44 +00008210 ;;
8211 mipsn32|mipsn32el)
Aleksandar Markovic04547282019-02-11 17:09:29 +01008212 mttcg="yes"
Richard Henderson597e2ce2013-02-10 10:30:50 -08008213 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02008214 TARGET_BASE_ARCH=mips
Juan Quintela25be210f2009-10-07 02:41:00 +02008215 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Richard Henderson597e2ce2013-02-10 10:30:50 -08008216 echo "TARGET_ABI32=y" >> $config_target_mak
Laurent Vivier686a0fe2020-03-10 11:33:59 +01008217 TARGET_SYSTBL_ABI=n32
aurel322408a522008-04-20 20:19:44 +00008218 ;;
8219 mips64|mips64el)
Alex Bennéea092a952020-03-23 16:15:09 +00008220 mttcg="no"
Juan Quintelab498c8a2009-07-16 18:34:11 +02008221 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02008222 TARGET_BASE_ARCH=mips
Juan Quintela25be210f2009-10-07 02:41:00 +02008223 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
Laurent Vivier686a0fe2020-03-10 11:33:59 +01008224 TARGET_SYSTBL_ABI=n64
aurel322408a522008-04-20 20:19:44 +00008225 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04008226 moxie)
8227 ;;
Marek Vasute6717112017-01-18 23:01:46 +01008228 nios2)
8229 ;;
Richard Henderson4a09d0b2017-02-08 15:06:54 -08008230 or1k)
Jia Liue67db062012-07-20 15:50:39 +08008231 TARGET_ARCH=openrisc
8232 TARGET_BASE_ARCH=openrisc
Jia Liue67db062012-07-20 15:50:39 +08008233 ;;
aurel322408a522008-04-20 20:19:44 +00008234 ppc)
aurel32c8b35322009-01-24 15:07:34 +00008235 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Laurent Vivier76a691f2020-03-10 11:33:51 +01008236 TARGET_SYSTBL_ABI=common,nospu,32
aurel322408a522008-04-20 20:19:44 +00008237 ;;
aurel322408a522008-04-20 20:19:44 +00008238 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02008239 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02008240 TARGET_ABI_DIR=ppc
Laurent Vivier76a691f2020-03-10 11:33:51 +01008241 TARGET_SYSTBL_ABI=common,nospu,64
Nikunj A Dadhaniaf0b06852017-04-27 10:48:23 +05308242 mttcg=yes
Anton Blanchard1438eff2016-01-15 16:00:51 +01008243 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
aurel322408a522008-04-20 20:19:44 +00008244 ;;
Doug Kwan9c351262014-05-29 09:12:21 -05008245 ppc64le)
8246 TARGET_ARCH=ppc64
8247 TARGET_BASE_ARCH=ppc
8248 TARGET_ABI_DIR=ppc
Laurent Vivier76a691f2020-03-10 11:33:51 +01008249 TARGET_SYSTBL_ABI=common,nospu,64
Nikunj A Dadhaniaf0b06852017-04-27 10:48:23 +05308250 mttcg=yes
Anton Blanchard1438eff2016-01-15 16:00:51 +01008251 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
Doug Kwan9c351262014-05-29 09:12:21 -05008252 ;;
aurel322408a522008-04-20 20:19:44 +00008253 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02008254 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02008255 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02008256 TARGET_ABI_DIR=ppc
Laurent Vivier76a691f2020-03-10 11:33:51 +01008257 TARGET_SYSTBL_ABI=common,nospu,32
Juan Quintela25be210f2009-10-07 02:41:00 +02008258 echo "TARGET_ABI32=y" >> $config_target_mak
Anton Blanchard1438eff2016-01-15 16:00:51 +01008259 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
aurel322408a522008-04-20 20:19:44 +00008260 ;;
Michael Clark25fa1942018-03-03 01:32:59 +13008261 riscv32)
8262 TARGET_BASE_ARCH=riscv
8263 TARGET_ABI_DIR=riscv
8264 mttcg=yes
Keith Packardae4a70c2020-01-28 15:32:16 -08008265 gdb_xml_files="riscv-32bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-32bit-csr.xml riscv-32bit-virtual.xml"
Michael Clark25fa1942018-03-03 01:32:59 +13008266 ;;
8267 riscv64)
8268 TARGET_BASE_ARCH=riscv
8269 TARGET_ABI_DIR=riscv
8270 mttcg=yes
Keith Packardae4a70c2020-01-28 15:32:16 -08008271 gdb_xml_files="riscv-64bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-64bit-csr.xml riscv-64bit-virtual.xml"
Michael Clark25fa1942018-03-03 01:32:59 +13008272 ;;
Yoshinori Satoc8c35e52019-01-21 05:18:59 -08008273 rx)
8274 TARGET_ARCH=rx
8275 bflt="yes"
8276 target_compiler=$cross_cc_rx
8277 gdb_xml_files="rx-core.xml"
8278 ;;
aurel322408a522008-04-20 20:19:44 +00008279 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02008280 TARGET_ARCH=sh4
Laurent Vivierd0c832f2020-03-10 11:33:48 +01008281 TARGET_SYSTBL_ABI=common
aurel322408a522008-04-20 20:19:44 +00008282 bflt="yes"
8283 ;;
8284 sparc)
Laurent Vivierbb0cdc02020-03-10 11:33:54 +01008285 TARGET_SYSTBL_ABI=common,32
aurel322408a522008-04-20 20:19:44 +00008286 ;;
8287 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02008288 TARGET_BASE_ARCH=sparc
Laurent Vivierbb0cdc02020-03-10 11:33:54 +01008289 TARGET_SYSTBL_ABI=common,64
aurel322408a522008-04-20 20:19:44 +00008290 ;;
8291 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02008292 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02008293 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02008294 TARGET_ABI_DIR=sparc
Laurent Vivierbb0cdc02020-03-10 11:33:54 +01008295 TARGET_SYSTBL_ABI=common,32
Juan Quintela25be210f2009-10-07 02:41:00 +02008296 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00008297 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01008298 s390x)
Laurent Vivier318f3712020-03-10 11:33:53 +01008299 TARGET_SYSTBL_ABI=common,64
David Hildenbrand63685bc2018-01-29 13:56:20 +01008300 mttcg=yes
Christian Borntraeger86158a22017-03-08 12:41:14 +01008301 gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml"
Alexander Graf24e804ec2009-12-05 12:44:22 +01008302 ;;
Chen Gang444e06b2015-08-21 05:43:37 +08008303 tilegx)
8304 ;;
Peter Crosthwaite5ecaa4e2015-04-26 19:14:26 -07008305 tricore)
8306 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +08008307 unicore32)
Guan Xuetaod2fbca92011-04-12 16:27:03 +08008308 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04008309 xtensa|xtensaeb)
8310 TARGET_ARCH=xtensa
Laurent Viviera4a93592020-03-10 11:33:47 +01008311 TARGET_SYSTBL_ABI=common
Max Filippov02e33e92018-10-19 18:40:20 -07008312 bflt="yes"
Max Filippov9fb40342017-03-06 17:17:43 -08008313 mttcg="yes"
Max Filippovcfa550c2011-09-06 03:55:26 +04008314 ;;
aurel322408a522008-04-20 20:19:44 +00008315 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01008316 error_exit "Unsupported target CPU"
aurel322408a522008-04-20 20:19:44 +00008317 ;;
8318esac
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02008319# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
8320if [ "$TARGET_BASE_ARCH" = "" ]; then
8321 TARGET_BASE_ARCH=$TARGET_ARCH
8322fi
8323
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02008324symlink "$source_path/Makefile.target" "$target_dir/Makefile"
8325
Daniel P. Berrange99afc912012-08-20 15:31:38 +01008326upper() {
8327 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
8328}
8329
Stefan Weil89138852016-05-16 15:10:20 +02008330target_arch_name="$(upper $TARGET_ARCH)"
Juan Quintela25be210f2009-10-07 02:41:00 +02008331echo "TARGET_$target_arch_name=y" >> $config_target_mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01008332echo "TARGET_NAME=$target_name" >> $config_target_mak
Juan Quintela25be210f2009-10-07 02:41:00 +02008333echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02008334if [ "$TARGET_ABI_DIR" = "" ]; then
8335 TARGET_ABI_DIR=$TARGET_ARCH
8336fi
Juan Quintela25be210f2009-10-07 02:41:00 +02008337echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Stacey Sonadfc3e92014-06-08 09:57:22 -07008338if [ "$HOST_VARIANT_DIR" != "" ]; then
8339 echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
8340fi
Laurent Vivier4d6a8352020-03-10 11:33:43 +01008341if [ "$TARGET_SYSTBL_ABI" != "" ]; then
8342 echo "TARGET_SYSTBL_ABI=$TARGET_SYSTBL_ABI" >> $config_target_mak
8343fi
Paolo Bonzini3b6b7552012-09-17 11:59:41 +02008344
8345if supported_xen_target $target; then
8346 echo "CONFIG_XEN=y" >> $config_target_mak
Paolo Bonzinie0e312f2019-01-23 14:56:01 +08008347 echo "$target/config-devices.mak: CONFIG_XEN=y" >> $config_host_mak
Paolo Bonzini3b6b7552012-09-17 11:59:41 +02008348 if test "$xen_pci_passthrough" = yes; then
Anthony PERARDeb6fda02012-06-21 15:32:59 +00008349 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
Juan Quintela1b0c87f2009-07-16 18:33:59 +02008350 fi
Paolo Bonzinie0e312f2019-01-23 14:56:01 +08008351else
8352 echo "$target/config-devices.mak: CONFIG_XEN=n" >> $config_host_mak
Paolo Bonzini3b6b7552012-09-17 11:59:41 +02008353fi
8354if supported_kvm_target $target; then
8355 echo "CONFIG_KVM=y" >> $config_target_mak
Paolo Bonzinie0e312f2019-01-23 14:56:01 +08008356 echo "$target/config-devices.mak: CONFIG_KVM=y" >> $config_host_mak
8357else
8358 echo "$target/config-devices.mak: CONFIG_KVM=n" >> $config_host_mak
Paolo Bonzini3b6b7552012-09-17 11:59:41 +02008359fi
8360if supported_hax_target $target; then
8361 echo "CONFIG_HAX=y" >> $config_target_mak
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01008362fi
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05008363if supported_hvf_target $target; then
8364 echo "CONFIG_HVF=y" >> $config_target_mak
8365fi
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08008366if supported_whpx_target $target; then
8367 echo "CONFIG_WHPX=y" >> $config_target_mak
8368fi
tony.nguyen@bt.com52bf9772019-07-18 06:01:31 +00008369if test "$target_aligned_only" = "yes" ; then
8370 echo "TARGET_ALIGNED_ONLY=y" >> $config_target_mak
8371fi
bellardde83cd02003-06-15 20:25:43 +00008372if test "$target_bigendian" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02008373 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00008374fi
8375if test "$target_softmmu" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02008376 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
Alex Bennéeca759f92017-02-23 18:29:27 +00008377 if test "$mttcg" = "yes" ; then
8378 echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak
8379 fi
bellardde83cd02003-06-15 20:25:43 +00008380fi
bellard997344f2003-10-27 21:10:39 +00008381if test "$target_user_only" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02008382 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
Stefan Weila2c80be2011-12-22 11:26:10 +01008383 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00008384fi
ths831b7822007-01-18 20:06:33 +00008385if test "$target_linux_user" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02008386 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00008387fi
pbrook56aebc82008-10-11 17:55:29 +00008388list=""
8389if test ! -z "$gdb_xml_files" ; then
8390 for x in $gdb_xml_files; do
8391 list="$list $source_path/gdb-xml/$x"
8392 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02008393 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00008394fi
bellardde83cd02003-06-15 20:25:43 +00008395
Eric Blakee633a5c2019-02-04 20:39:37 -06008396if test "$target_user_only" = "yes" && test "$bflt" = "yes"; then
Juan Quintela25be210f2009-10-07 02:41:00 +02008397 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00008398fi
blueswir184778502008-10-26 20:33:16 +00008399if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02008400 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00008401fi
bellard5b0753e2005-03-01 21:37:28 +00008402
Alex Bennée716a5072018-04-10 12:19:40 +01008403
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01008404# generate QEMU_CFLAGS/QEMU_LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02008405
Juan Quintela4afddb52009-08-03 14:46:45 +02008406cflags=""
Juan Quintelafa282482009-07-22 22:37:39 +02008407ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02008408
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008409disas_config() {
8410 echo "CONFIG_${1}_DIS=y" >> $config_target_mak
8411 echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak
8412}
8413
Juan Quintela64656022009-08-03 14:46:53 +02008414for i in $ARCH $TARGET_BASE_ARCH ; do
8415 case "$i" in
8416 alpha)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008417 disas_config "ALPHA"
Juan Quintela64656022009-08-03 14:46:53 +02008418 ;;
Richard Henderson82295d82014-03-03 22:53:27 -05008419 aarch64)
8420 if test -n "${cxx}"; then
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008421 disas_config "ARM_A64"
Richard Henderson82295d82014-03-03 22:53:27 -05008422 fi
8423 ;;
Juan Quintela64656022009-08-03 14:46:53 +02008424 arm)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008425 disas_config "ARM"
Claudio Fontana999b53e2014-02-05 17:27:28 +00008426 if test -n "${cxx}"; then
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008427 disas_config "ARM_A64"
Claudio Fontana999b53e2014-02-05 17:27:28 +00008428 fi
Juan Quintela64656022009-08-03 14:46:53 +02008429 ;;
Michael Rolnik42f3ff02020-01-24 01:51:21 +01008430 avr)
8431 disas_config "AVR"
8432 ;;
Juan Quintela64656022009-08-03 14:46:53 +02008433 cris)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008434 disas_config "CRIS"
Juan Quintela64656022009-08-03 14:46:53 +02008435 ;;
Richard Henderson429b31a2016-09-29 10:55:53 -07008436 hppa)
8437 disas_config "HPPA"
8438 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07008439 i386|x86_64|x32)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008440 disas_config "I386"
Juan Quintela64656022009-08-03 14:46:53 +02008441 ;;
Michael Walle79368f42012-03-31 19:54:20 +02008442 lm32)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008443 disas_config "LM32"
Michael Walle79368f42012-03-31 19:54:20 +02008444 ;;
Juan Quintela64656022009-08-03 14:46:53 +02008445 m68k)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008446 disas_config "M68K"
Juan Quintela64656022009-08-03 14:46:53 +02008447 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01008448 microblaze*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008449 disas_config "MICROBLAZE"
Juan Quintela64656022009-08-03 14:46:53 +02008450 ;;
8451 mips*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008452 disas_config "MIPS"
Aleksandar Markovic89a955e2018-10-24 17:41:49 +02008453 if test -n "${cxx}"; then
8454 disas_config "NANOMIPS"
8455 fi
Juan Quintela64656022009-08-03 14:46:53 +02008456 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04008457 moxie*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008458 disas_config "MOXIE"
Anthony Greend15a9c22013-03-18 15:49:25 -04008459 ;;
Marek Vasute6717112017-01-18 23:01:46 +01008460 nios2)
8461 disas_config "NIOS2"
8462 ;;
Richard Henderson4a09d0b2017-02-08 15:06:54 -08008463 or1k)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008464 disas_config "OPENRISC"
Jia Liue67db062012-07-20 15:50:39 +08008465 ;;
Juan Quintela64656022009-08-03 14:46:53 +02008466 ppc*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008467 disas_config "PPC"
Juan Quintela64656022009-08-03 14:46:53 +02008468 ;;
Alistair Francisc4f80542018-12-19 19:20:19 +00008469 riscv*)
Michael Clark25fa1942018-03-03 01:32:59 +13008470 disas_config "RISCV"
8471 ;;
Yoshinori Satoc8c35e52019-01-21 05:18:59 -08008472 rx)
8473 disas_config "RX"
8474 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01008475 s390*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008476 disas_config "S390"
Juan Quintela64656022009-08-03 14:46:53 +02008477 ;;
8478 sh4)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008479 disas_config "SH4"
Juan Quintela64656022009-08-03 14:46:53 +02008480 ;;
8481 sparc*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008482 disas_config "SPARC"
Juan Quintela64656022009-08-03 14:46:53 +02008483 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04008484 xtensa*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008485 disas_config "XTENSA"
Max Filippovcfa550c2011-09-06 03:55:26 +04008486 ;;
Juan Quintela64656022009-08-03 14:46:53 +02008487 esac
8488done
Stefan Weil9195b2c2011-10-19 07:07:18 +02008489if test "$tcg_interpreter" = "yes" ; then
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07008490 disas_config "TCI"
Stefan Weil9195b2c2011-10-19 07:07:18 +02008491fi
Juan Quintela64656022009-08-03 14:46:53 +02008492
Christian Borntraegere9a35912017-08-23 12:16:23 +02008493# Newer kernels on s390 check for an S390_PGSTE program header and
8494# enable the pgste page table extensions in that case. This makes
8495# the vm.allocate_pgste sysctl unnecessary. We enable this program
8496# header if
8497# - we build on s390x
8498# - we build the system emulation for s390x (qemu-system-s390x)
8499# - KVM is enabled
8500# - the linker supports --s390-pgste
Eric Blakee633a5c2019-02-04 20:39:37 -06008501if test "$TARGET_ARCH" = "s390x" && test "$target_softmmu" = "yes" && \
8502 test "$ARCH" = "s390x" && test "$kvm" = "yes"; then
Christian Borntraegere9a35912017-08-23 12:16:23 +02008503 if ld_has --s390-pgste ; then
8504 ldflags="-Wl,--s390-pgste $ldflags"
8505 fi
8506fi
8507
Paolo Bonzinidb5adea2019-12-11 15:34:27 +01008508echo "QEMU_LDFLAGS+=$ldflags" >> $config_target_mak
Juan Quintela25be210f2009-10-07 02:41:00 +02008509echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02008510
bellard97a847b2003-08-10 21:36:04 +00008511done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00008512
Marc-André Lureaud52c4542019-05-24 15:09:42 +02008513echo "PIXMAN_CFLAGS=$pixman_cflags" >> $config_host_mak
8514echo "PIXMAN_LIBS=$pixman_libs" >> $config_host_mak
8515
Philippe Mathieu-Daudée3971d62018-04-15 20:05:20 -03008516if [ "$fdt" = "git" ]; then
Markus Armbruster3b8593e2019-05-28 10:23:07 +02008517 echo "config-host.h: dtc/all" >> $config_host_mak
Peter Crosthwaitea540f152013-04-18 14:47:31 +10008518fi
Richard Hendersone219c492017-09-28 09:01:23 -07008519if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then
Markus Armbruster3b8593e2019-05-28 10:23:07 +02008520 echo "config-host.h: capstone/all" >> $config_host_mak
Richard Hendersone219c492017-09-28 09:01:23 -07008521fi
8522if test -n "$LIBCAPSTONE"; then
8523 echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak
8524fi
Peter Crosthwaitea540f152013-04-18 14:47:31 +10008525
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08008526if test "$numa" = "yes"; then
8527 echo "CONFIG_NUMA=y" >> $config_host_mak
8528fi
8529
John Snowfd0e6052015-03-25 18:57:39 -04008530if test "$ccache_cpp2" = "yes"; then
8531 echo "export CCACHE_CPP2=y" >> $config_host_mak
8532fi
8533
Daniele Buono1e4f6062020-05-29 16:51:21 -04008534if test "$safe_stack" = "yes"; then
8535 echo "CONFIG_SAFESTACK=y" >> $config_host_mak
8536fi
8537
Peter Maydelle29e5c62018-11-02 11:52:38 +00008538# If we're using a separate build tree, set it up now.
8539# DIRS are directories which we simply mkdir in the build tree;
8540# LINKS are things to symlink back into the source tree
8541# (these can be both files and directories).
8542# Caution: do not add files or directories here using wildcards. This
8543# will result in problems later if a new file matching the wildcard is
8544# added to the source tree -- nothing will cause configure to be rerun
8545# so the build tree will be missing the link back to the new file, and
8546# tests might fail. Prefer to keep the relevant files in their own
8547# directory and symlink the directory instead.
Thomas Huth1cf43232019-09-10 16:41:20 +02008548DIRS="tests tests/tcg tests/tcg/lm32 tests/qapi-schema tests/qtest/libqos"
8549DIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph"
Paolo Bonzinib855f8d2017-08-22 06:50:18 +02008550DIRS="$DIRS docs docs/interop fsdev scsi"
Alexey Kardashevskiy744a9282019-07-16 15:27:43 +10008551DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw"
Gerd Hoffmann8db2a4f2020-06-22 15:12:40 +02008552DIRS="$DIRS roms/seabios"
Paolo Bonzini2038f8c2019-08-07 16:35:23 +02008553LINKS="Makefile"
8554LINKS="$LINKS tests/tcg/lm32/Makefile po/Makefile"
8555LINKS="$LINKS tests/tcg/Makefile.target tests/fp/Makefile"
Emilio G. Cota671f7602018-10-25 12:57:04 -04008556LINKS="$LINKS tests/plugin/Makefile"
Peter Maydelle29e5c62018-11-02 11:52:38 +00008557LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps"
Peter Maydelle29e5c62018-11-02 11:52:38 +00008558LINKS="$LINKS pc-bios/s390-ccw/Makefile"
Gerd Hoffmann8db2a4f2020-06-22 15:12:40 +02008559LINKS="$LINKS roms/seabios/Makefile"
Peter Maydelle29e5c62018-11-02 11:52:38 +00008560LINKS="$LINKS pc-bios/qemu-icon.bmp"
8561LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
Peter Maydell39950352018-11-02 11:52:39 +00008562LINKS="$LINKS tests/acceptance tests/data"
8563LINKS="$LINKS tests/qemu-iotests/check"
Cleber Rosa8f8fd9e2019-02-06 11:29:01 -05008564LINKS="$LINKS python"
Richard Henderson753d11f2011-06-24 11:58:37 -07008565for bios_file in \
8566 $source_path/pc-bios/*.bin \
Alexey Kardashevskiy225a9ab2016-10-26 13:18:03 +11008567 $source_path/pc-bios/*.lid \
Richard Henderson753d11f2011-06-24 11:58:37 -07008568 $source_path/pc-bios/*.rom \
8569 $source_path/pc-bios/*.dtb \
Dominik Dingele89e33e2013-04-29 04:52:06 +00008570 $source_path/pc-bios/*.img \
Richard Henderson753d11f2011-06-24 11:58:37 -07008571 $source_path/pc-bios/openbios-* \
Alexander Graf4e73c782014-01-20 00:25:40 +01008572 $source_path/pc-bios/u-boot.* \
Laszlo Ersek26ce90f2019-03-08 01:19:35 +01008573 $source_path/pc-bios/edk2-*.fd.bz2 \
Richard Henderson753d11f2011-06-24 11:58:37 -07008574 $source_path/pc-bios/palcode-*
8575do
Peter Maydelle29e5c62018-11-02 11:52:38 +00008576 LINKS="$LINKS pc-bios/$(basename $bios_file)"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01008577done
8578mkdir -p $DIRS
Peter Maydelle29e5c62018-11-02 11:52:38 +00008579for f in $LINKS ; do
Michael S. Tsirkincab00a52014-04-28 15:09:01 +03008580 if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
Peter Maydellf9245e12011-06-03 17:10:40 +01008581 symlink "$source_path/$f" "$f"
8582 fi
Paolo Bonzinid1807a42010-12-23 11:43:59 +01008583done
Paul Brook1ad21342009-05-19 16:17:58 +01008584
Paolo Bonzini2038f8c2019-08-07 16:35:23 +02008585(for i in $cross_cc_vars; do
8586 export $i
8587done
Alex Bennéeafc3a8f2019-11-28 16:35:24 +01008588export target_list source_path use_containers
Paolo Bonzini2038f8c2019-08-07 16:35:23 +02008589$source_path/tests/tcg/configure.sh)
8590
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05008591# temporary config to build submodules
Gerd Hoffmann8db2a4f2020-06-22 15:12:40 +02008592for rom in seabios; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05008593 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01008594 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05008595 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
Richard Hendersoncdbd7272016-07-07 21:49:36 -07008596 echo "AS=$as" >> $config_mak
Richard Henderson5f6f0e22016-06-23 10:39:18 -07008597 echo "CCAS=$ccas" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05008598 echo "CC=$cc" >> $config_mak
8599 echo "BCC=bcc" >> $config_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00008600 echo "CPP=$cpp" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05008601 echo "OBJCOPY=objcopy" >> $config_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03008602 echo "IASL=$iasl" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05008603 echo "LD=$ld" >> $config_mak
Alistair Francis9f81aeb2017-11-07 17:10:46 -08008604 echo "RANLIB=$ranlib" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05008605done
8606
Max Reitz76c75602014-05-24 23:24:56 +02008607# set up qemu-iotests in this build directory
8608iotests_common_env="tests/qemu-iotests/common.env"
Max Reitz76c75602014-05-24 23:24:56 +02008609
8610echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
8611echo >> "$iotests_common_env"
8612echo "export PYTHON='$python'" >> "$iotests_common_env"
8613
Michael S. Tsirkindc655402014-03-09 17:37:49 +02008614# Save the configure command line for later reuse.
8615cat <<EOD >config.status
8616#!/bin/sh
8617# Generated by configure.
8618# Run this file to recreate the current configuration.
8619# Compiler output produced by configure, useful for debugging
8620# configure, is in config.log if it exists.
8621EOD
Daniel P. Berrangée811da72018-09-04 13:36:03 +01008622
8623preserve_env() {
8624 envname=$1
8625
8626 eval envval=\$$envname
8627
8628 if test -n "$envval"
8629 then
8630 echo "$envname='$envval'" >> config.status
8631 echo "export $envname" >> config.status
8632 else
8633 echo "unset $envname" >> config.status
8634 fi
8635}
8636
8637# Preserve various env variables that influence what
8638# features/build target configure will detect
8639preserve_env AR
8640preserve_env AS
8641preserve_env CC
8642preserve_env CPP
8643preserve_env CXX
8644preserve_env INSTALL
8645preserve_env LD
8646preserve_env LD_LIBRARY_PATH
8647preserve_env LIBTOOL
8648preserve_env MAKE
8649preserve_env NM
8650preserve_env OBJCOPY
8651preserve_env PATH
8652preserve_env PKG_CONFIG
8653preserve_env PKG_CONFIG_LIBDIR
8654preserve_env PKG_CONFIG_PATH
8655preserve_env PYTHON
Daniel P. Berrangée811da72018-09-04 13:36:03 +01008656preserve_env SDL2_CONFIG
8657preserve_env SMBD
8658preserve_env STRIP
8659preserve_env WINDRES
8660
Michael S. Tsirkindc655402014-03-09 17:37:49 +02008661printf "exec" >>config.status
8662printf " '%s'" "$0" "$@" >>config.status
Dr. David Alan Gilbertcf7cc922016-01-12 11:58:48 +00008663echo ' "$@"' >>config.status
Michael S. Tsirkindc655402014-03-09 17:37:49 +02008664chmod +x config.status
8665
Peter Maydell8cd05ab2014-05-23 17:07:24 +01008666rm -r "$TMPDIR1"