blob: 2995559ed213c935aa9c210a42595e283f07404c [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001#!/bin/sh
2#
bellard3ef693a2003-03-23 20:17:16 +00003# qemu configure script (c) 2003 Fabrice Bellard
bellard7d132992003-03-06 23:23:54 +00004#
Peter Maydell8cd05ab2014-05-23 17:07:24 +01005
Cornelia Huck99519e62014-05-28 12:39:17 +02006# Unset some variables known to interfere with behavior of common tools,
7# just as autoconf does.
8CLICOLOR_FORCE= GREP_OPTIONS=
9unset CLICOLOR_FORCE GREP_OPTIONS
10
John Snow5e4dfd32015-10-28 13:56:40 -040011# Don't allow CCACHE, if present, to use cached results of compile tests!
12export CCACHE_RECACHE=yes
13
Peter Maydell8cd05ab2014-05-23 17:07:24 +010014# Temporary directory used for files created while
15# configure runs. Since it is in the build directory
16# we can safely blow away any previous version of it
17# (and we need not jump through hoops to try to delete
18# it when configure exits.)
19TMPDIR1="config-temp"
20rm -rf "${TMPDIR1}"
21mkdir -p "${TMPDIR1}"
22if [ $? -ne 0 ]; then
23 echo "ERROR: failed to create temporary directory"
24 exit 1
bellard7d132992003-03-06 23:23:54 +000025fi
26
Peter Maydell8cd05ab2014-05-23 17:07:24 +010027TMPB="qemu-conf"
28TMPC="${TMPDIR1}/${TMPB}.c"
Don Slutz66518bf2014-01-02 21:12:46 -050029TMPO="${TMPDIR1}/${TMPB}.o"
Peter Maydell9c83ffd2014-02-25 18:27:49 +000030TMPCXX="${TMPDIR1}/${TMPB}.cxx"
Peter Maydell8cd05ab2014-05-23 17:07:24 +010031TMPE="${TMPDIR1}/${TMPB}.exe"
James Clarke6969ec62016-06-06 12:02:50 +010032TMPMO="${TMPDIR1}/${TMPB}.mo"
bellard7d132992003-03-06 23:23:54 +000033
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020034rm -f config.log
malc9ac81bb2008-11-29 20:09:56 +000035
Peter Maydellb48e3612011-11-23 17:26:44 +000036# Print a helpful header at the top of config.log
37echo "# QEMU configure log $(date)" >> config.log
Peter Maydell979ae162012-03-07 12:16:29 +000038printf "# Configured with:" >> config.log
39printf " '%s'" "$0" "$@" >> config.log
40echo >> config.log
Peter Maydellb48e3612011-11-23 17:26:44 +000041echo "#" >> config.log
42
Paolo Bonzinid880a3b2017-07-03 16:58:28 +020043print_error() {
44 (echo
Peter Maydell76ad07a2013-04-08 12:11:26 +010045 echo "ERROR: $1"
46 while test -n "$2"; do
47 echo " $2"
48 shift
49 done
Paolo Bonzinid880a3b2017-07-03 16:58:28 +020050 echo) >&2
51}
52
53error_exit() {
54 print_error "$@"
Peter Maydell76ad07a2013-04-08 12:11:26 +010055 exit 1
56}
57
Peter Maydell9c83ffd2014-02-25 18:27:49 +000058do_compiler() {
59 # Run the compiler, capturing its output to the log. First argument
60 # is compiler binary to execute.
61 local compiler="$1"
62 shift
Ian Jackson8bbe05d2017-09-25 16:41:03 +010063 if test -n "$BASH_VERSION"; then eval '
64 echo >>config.log "
65funcs: ${FUNCNAME[*]}
66lines: ${BASH_LINENO[*]}"
67 '; fi
Peter Maydell9c83ffd2014-02-25 18:27:49 +000068 echo $compiler "$@" >> config.log
69 $compiler "$@" >> config.log 2>&1 || return $?
Peter Maydell8dc38a72012-07-18 15:10:28 +010070 # Test passed. If this is an --enable-werror build, rerun
71 # the test with -Werror and bail out if it fails. This
72 # makes warning-generating-errors in configure test code
73 # obvious to developers.
74 if test "$werror" != "yes"; then
75 return 0
76 fi
77 # Don't bother rerunning the compile if we were already using -Werror
78 case "$*" in
79 *-Werror*)
80 return 0
81 ;;
82 esac
Peter Maydell9c83ffd2014-02-25 18:27:49 +000083 echo $compiler -Werror "$@" >> config.log
84 $compiler -Werror "$@" >> config.log 2>&1 && return $?
Peter Maydell76ad07a2013-04-08 12:11:26 +010085 error_exit "configure test passed without -Werror but failed with -Werror." \
86 "This is probably a bug in the configure script. The failing command" \
87 "will be at the bottom of config.log." \
88 "You can run configure with --disable-werror to bypass this check."
Peter Maydell8dc38a72012-07-18 15:10:28 +010089}
90
Peter Maydell9c83ffd2014-02-25 18:27:49 +000091do_cc() {
92 do_compiler "$cc" "$@"
93}
94
95do_cxx() {
96 do_compiler "$cxx" "$@"
97}
98
99update_cxxflags() {
100 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
101 # options which some versions of GCC's C++ compiler complain about
102 # because they only make sense for C programs.
Bruno Dominguez11cde1c2017-06-06 14:07:47 +0100103 QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS"
104
Peter Maydell9c83ffd2014-02-25 18:27:49 +0000105 for arg in $QEMU_CFLAGS; do
106 case $arg in
107 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
108 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
109 ;;
Thomas Huth7be41672019-01-07 11:25:22 +0100110 -std=gnu99)
111 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }"-std=gnu++98"
112 ;;
Peter Maydell9c83ffd2014-02-25 18:27:49 +0000113 *)
114 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
115 ;;
116 esac
117 done
118}
119
Juan Quintela52166aa2009-08-03 14:46:03 +0200120compile_object() {
John Snowfd0e6052015-03-25 18:57:39 -0400121 local_cflags="$1"
122 do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
Juan Quintela52166aa2009-08-03 14:46:03 +0200123}
124
125compile_prog() {
126 local_cflags="$1"
127 local_ldflags="$2"
Peter Maydell8dc38a72012-07-18 15:10:28 +0100128 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
Juan Quintela52166aa2009-08-03 14:46:03 +0200129}
130
Paolo Bonzini11568d62010-12-23 11:43:58 +0100131# symbolically link $1 to $2. Portable version of "ln -sf".
132symlink() {
Stefan Weil72b8b5a2012-03-19 13:20:47 +0100133 rm -rf "$2"
Anthony Liguoriec5b06d2012-06-06 16:57:00 +0800134 mkdir -p "$(dirname "$2")"
Stefan Weil72b8b5a2012-03-19 13:20:47 +0100135 ln -s "$1" "$2"
Paolo Bonzini11568d62010-12-23 11:43:58 +0100136}
137
LoĂŻc Minier0dba6192010-01-28 21:26:51 +0000138# check whether a command is available to this shell (may be either an
139# executable or a builtin)
140has() {
141 type "$1" >/dev/null 2>&1
142}
143
144# search for an executable in PATH
145path_of() {
146 local_command="$1"
147 local_ifs="$IFS"
148 local_dir=""
149
150 # pathname has a dir component?
151 if [ "${local_command#*/}" != "$local_command" ]; then
152 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
153 echo "$local_command"
154 return 0
155 fi
156 fi
157 if [ -z "$local_command" ]; then
158 return 1
159 fi
160
161 IFS=:
162 for local_dir in $PATH; do
163 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
164 echo "$local_dir/$local_command"
165 IFS="${local_ifs:-$(printf ' \t\n')}"
166 return 0
167 fi
168 done
169 # not found
170 IFS="${local_ifs:-$(printf ' \t\n')}"
171 return 1
172}
173
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +0200174have_backend () {
175 echo "$trace_backends" | grep "$1" >/dev/null
176}
177
Paolo Bonzini3b6b7552012-09-17 11:59:41 +0200178glob() {
179 eval test -z '"${1#'"$2"'}"'
180}
181
182supported_hax_target() {
183 test "$hax" = "yes" || return 1
184 glob "$1" "*-softmmu" || return 1
185 case "${1%-softmmu}" in
186 i386|x86_64)
187 return 0
188 ;;
189 esac
190 return 1
191}
192
193supported_kvm_target() {
194 test "$kvm" = "yes" || return 1
195 glob "$1" "*-softmmu" || return 1
196 case "${1%-softmmu}:$cpu" in
197 arm:arm | aarch64:aarch64 | \
198 i386:i386 | i386:x86_64 | i386:x32 | \
199 x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \
200 mips:mips | mipsel:mips | \
Richard Hendersonf8378ac2019-05-01 15:38:18 -0700201 ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | ppc64:ppc64le | \
Paolo Bonzini3b6b7552012-09-17 11:59:41 +0200202 s390x:s390x)
203 return 0
204 ;;
205 esac
206 return 1
207}
208
209supported_xen_target() {
210 test "$xen" = "yes" || return 1
211 glob "$1" "*-softmmu" || return 1
Paolo Bonzinib5ed2e12017-07-11 12:00:49 +0200212 # Only i386 and x86_64 provide the xenpv machine.
213 case "${1%-softmmu}" in
214 i386|x86_64)
Paolo Bonzini3b6b7552012-09-17 11:59:41 +0200215 return 0
216 ;;
217 esac
218 return 1
219}
220
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -0500221supported_hvf_target() {
222 test "$hvf" = "yes" || return 1
223 glob "$1" "*-softmmu" || return 1
224 case "${1%-softmmu}" in
225 x86_64)
226 return 0
227 ;;
228 esac
229 return 1
230}
231
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -0800232supported_whpx_target() {
233 test "$whpx" = "yes" || return 1
234 glob "$1" "*-softmmu" || return 1
235 case "${1%-softmmu}" in
236 i386|x86_64)
237 return 0
238 ;;
239 esac
240 return 1
241}
242
Paolo Bonzinid880a3b2017-07-03 16:58:28 +0200243supported_target() {
244 case "$1" in
245 *-softmmu)
246 ;;
247 *-linux-user)
248 if test "$linux" != "yes"; then
249 print_error "Target '$target' is only available on a Linux host"
250 return 1
251 fi
252 ;;
253 *-bsd-user)
254 if test "$bsd" != "yes"; then
255 print_error "Target '$target' is only available on a BSD host"
256 return 1
257 fi
258 ;;
259 *)
260 print_error "Invalid target name '$target'"
261 return 1
262 ;;
263 esac
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +0200264 test "$tcg" = "yes" && return 0
265 supported_kvm_target "$1" && return 0
266 supported_xen_target "$1" && return 0
267 supported_hax_target "$1" && return 0
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -0500268 supported_hvf_target "$1" && return 0
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -0800269 supported_whpx_target "$1" && return 0
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +0200270 print_error "TCG disabled, but hardware accelerator not available for '$target'"
271 return 1
Paolo Bonzinid880a3b2017-07-03 16:58:28 +0200272}
273
Christian Borntraegere9a35912017-08-23 12:16:23 +0200274
275ld_has() {
276 $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
277}
278
Peter Maydell79d77bc2019-04-29 17:35:57 +0100279# make source path absolute
Antonio Ospite14211822019-05-26 16:47:46 +0200280source_path=$(cd "$(dirname -- "$0")"; pwd)
281
Antonio Ospite4ace32e2019-05-26 16:47:47 +0200282if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]";
283then
284 error_exit "main directory cannot contain spaces nor colons"
285fi
286
Antonio Ospite14211822019-05-26 16:47:46 +0200287# default parameters
Juan Quintela2ff6b912009-08-03 14:45:55 +0200288cpu=""
Michael S. Tsirkina31a8642013-07-24 18:56:03 +0300289iasl="iasl"
bellard1e43adf2003-09-30 20:54:24 +0000290interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +0000291static="no"
bellard7d132992003-03-06 23:23:54 +0000292cross_prefix=""
malc0c58ac12008-06-25 21:04:05 +0000293audio_drv_list=""
Fam Zhengb64ec4e2013-05-29 19:35:40 +0800294block_drv_rw_whitelist=""
295block_drv_ro_whitelist=""
Peter Maydelle49d0212012-12-07 15:39:13 +0000296host_cc="cc"
Daniel P. Berrangé02f91352019-05-16 10:51:34 +0100297libs_cpu=""
Juan Quintela73da3752009-08-03 14:46:26 +0200298libs_softmmu=""
Juan Quintela3e2e0e62009-08-03 14:47:06 +0200299libs_tools=""
malcd5631632009-10-10 01:13:41 +0400300audio_win_int=""
Michael Roth957f1f92011-08-11 15:38:12 -0500301libs_qga=""
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100302debug_info="yes"
Steven Noonan63678e12014-03-28 17:19:02 +0100303stack_protector=""
aliguoriac0df512008-12-29 17:14:15 +0000304
Daniel P. Berrange92712822017-09-29 11:11:58 +0100305if test -e "$source_path/.git"
306then
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +0100307 git_update=yes
Daniel P. Berrange92712822017-09-29 11:11:58 +0100308 git_submodules="ui/keycodemapdb"
Emilio G. Cota3ac1f812018-03-08 21:09:40 -0500309 git_submodules="$git_submodules tests/fp/berkeley-testfloat-3"
310 git_submodules="$git_submodules tests/fp/berkeley-softfloat-3"
Daniel P. Berrange92712822017-09-29 11:11:58 +0100311else
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +0100312 git_update=no
Daniel P. Berrange92712822017-09-29 11:11:58 +0100313 git_submodules=""
Daniel P. Berrangé5c0ef672018-04-18 18:11:51 +0100314
315 if ! test -f "$source_path/ui/keycodemapdb/README"
316 then
317 echo
318 echo "ERROR: missing file $source_path/ui/keycodemapdb/README"
319 echo
320 echo "This is not a GIT checkout but module content appears to"
321 echo "be missing. Do not use 'git archive' or GitHub download links"
322 echo "to acquire QEMU source archives. Non-GIT builds are only"
323 echo "supported with source archives linked from:"
324 echo
Peter Maydella3e3b522019-07-22 14:07:39 +0100325 echo " https://www.qemu.org/download/#source"
Daniel P. Berrangé5c0ef672018-04-18 18:11:51 +0100326 echo
327 echo "Developers working with GIT can use scripts/archive-source.sh"
328 echo "if they need to create valid source archives."
329 echo
330 exit 1
331 fi
Daniel P. Berrange92712822017-09-29 11:11:58 +0100332fi
Daniel P. Berrangecc84d632017-10-20 15:02:43 +0100333git="git"
aliguoriac0df512008-12-29 17:14:15 +0000334
Stefan Weilafb63eb2012-09-26 22:04:38 +0200335# Don't accept a target_list environment variable.
336unset target_list
Alex Bennée447e1332019-03-19 11:59:12 +0000337unset target_list_exclude
Paolo Bonzini377529c2010-12-23 11:43:50 +0100338
339# Default value for a variable defining feature "foo".
340# * foo="no" feature will only be used if --enable-foo arg is given
341# * foo="" feature will be searched for, and if found, will be used
342# unless --disable-foo is given
343# * foo="yes" this value will only be set by --enable-foo flag.
344# feature will searched for,
345# if not found, configure exits with error
346#
347# Always add --enable-foo and --disable-foo command line args.
348# Distributions want to ensure that several features are compiled in, and it
349# is impossible without a --enable-foo that exits if a feature is not found.
350
351bluez=""
352brlapi=""
353curl=""
354curses=""
355docs=""
356fdt=""
Vincenzo Maffione58952132013-11-06 11:44:06 +0100357netmap="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100358sdl=""
Daniel P. Berrangéa442fe22019-01-10 12:00:47 +0000359sdl_image=""
Meador Inge983eef52012-02-24 14:00:42 +0530360virtfs=""
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +0200361mpath=""
Jes Sorensen821601e2011-03-16 13:33:36 +0100362vnc="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100363sparse="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100364vde=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100365vnc_sasl=""
366vnc_jpeg=""
367vnc_png=""
Gerd Hoffmann6a021532017-10-05 17:33:28 +0200368xkbcommon=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100369xen=""
Anthony PERARDd5b93dd2011-02-25 16:20:34 +0000370xen_ctrl_version=""
Anthony PERARDeb6fda02012-06-21 15:32:59 +0000371xen_pci_passthrough=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100372linux_aio=""
Corey Bryant47e98652012-01-26 09:42:26 -0500373cap_ng=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100374attr=""
Avi Kivity4f26f2b2011-11-09 14:44:52 +0200375libattr=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100376xfs=""
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +0200377tcg="yes"
Paolo Bonzinia40161c2018-02-16 10:05:23 +0100378membarrier=""
Paolo Bonzini299e6f12019-02-14 18:35:53 +0100379vhost_net=""
380vhost_crypto=""
381vhost_scsi=""
382vhost_vsock=""
Marc-André Lureaue6a74862017-08-03 11:07:46 +0200383vhost_user=""
Dr. David Alan Gilbert98fc1ad2019-09-30 11:51:34 +0100384vhost_user_fs=""
Bradd41a75a2011-07-26 23:11:26 -0400385kvm="no"
Vincent Palatinb0cb0a62017-01-10 11:59:57 +0100386hax="no"
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -0500387hvf="no"
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -0800388whpx="no"
Michael R. Hines2da776d2013-07-22 10:01:54 -0400389rdma=""
Marcel Apfelbaum21ab34c2018-08-16 18:16:37 +0300390pvrdma=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100391gprof="no"
392debug_tcg="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100393debug="no"
Marc-André Lureau247724c2018-01-16 16:11:51 +0100394sanitizers="no"
John Snowb553a042015-11-03 15:43:42 -0500395fortify_source=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100396strip_opt="yes"
Stefan Weil9195b2c2011-10-19 07:07:18 +0200397tcg_interpreter="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100398bigendian="no"
399mingw32="no"
Blue Swirl1d728c32012-05-01 18:45:39 +0000400gcov="no"
401gcov_tool="gcov"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100402EXESUF=""
Fam Zheng17969262014-02-10 14:48:56 +0800403DSOSUF=".so"
404LDFLAGS_SHARED="-shared"
405modules="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100406prefix="/usr/local"
407mandir="\${prefix}/share/man"
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300408datadir="\${prefix}/share"
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +0200409firmwarepath="\${prefix}/share/qemu-firmware"
Eduardo Habkost850da182012-04-18 16:55:38 -0300410qemu_docdir="\${prefix}/share/doc/qemu"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100411bindir="\${prefix}/bin"
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300412libdir="\${prefix}/lib"
Michael Tokarev8bf188a2012-06-07 01:11:00 +0400413libexecdir="\${prefix}/libexec"
Alon Levy0f94d6d2011-06-27 11:58:20 +0200414includedir="\${prefix}/include"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100415sysconfdir="\${prefix}/etc"
Luiz Capitulino785c23a2012-10-03 18:35:57 -0300416local_statedir="\${prefix}/var"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100417confsuffix="/qemu"
Marc-André Lureau675b9b52019-02-12 17:25:23 +0100418slirp=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100419oss_lib=""
420bsd="no"
421linux="no"
422solaris="no"
423profiler="no"
424cocoa="no"
425softmmu="yes"
426linux_user="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100427bsd_user="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100428blobs="yes"
429pkgversion=""
Avi Kivity40d64442011-11-15 20:12:17 +0200430pie=""
Paolo Bonzini3556c232013-05-10 14:16:40 +0200431qom_cast_debug="yes"
Paolo Bonzinibaf86d62016-01-07 16:55:31 +0300432trace_backends="log"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100433trace_file="trace"
434spice=""
435rbd=""
Marc-André Lureau7b02f542015-08-30 11:48:40 +0200436smartcard=""
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +0100437libusb=""
Hans de Goede69354a82011-07-19 11:04:10 +0200438usb_redir=""
Gerd Hoffmannda076ff2014-11-20 09:49:44 +0100439opengl=""
Gerd Hoffmann014cb152015-12-03 12:56:34 +0100440opengl_dmabuf="no"
Richard Henderson5dd89902017-07-18 18:40:18 -1000441cpuid_h="no"
Liam Merwick86583a02018-10-19 21:38:59 +0100442avx2_opt=""
Alon Levy1ece9902011-07-26 12:30:40 +0300443zlib="yes"
Richard Henderson8ca80762017-09-14 09:41:12 -0700444capstone=""
Stefan Weilb25c9df2014-04-29 08:21:16 +0200445lzo=""
446snappy=""
Peter Wu6b383c02015-01-06 18:48:14 +0100447bzip2=""
Julio Faracco83bc1f92018-11-05 13:08:04 -0200448lzfse=""
Michael Tokareve8ef31a2013-07-31 14:22:07 +0400449guest_agent=""
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -0400450guest_agent_with_vss="no"
Michael Roth50cbebb2015-07-07 18:10:09 -0500451guest_agent_ntddscsi="no"
Yossi Hindin9dacf322015-05-06 14:57:40 +0300452guest_agent_msi=""
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -0400453vss_win32_sdk=""
454win_sdk="no"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +0100455want_tools="yes"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100456libiscsi=""
Peter Lieven6542aa92014-02-03 10:26:13 +0100457libnfs=""
Alex Barcelo519175a2012-02-28 12:25:50 +0100458coroutine=""
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +0200459coroutine_pool=""
Peter Lieven7d992e42016-09-27 11:58:45 +0200460debug_stack_usage="no"
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -0400461crypto_afalg="no"
Eduardo Otubof7945732012-08-14 18:44:05 -0300462seccomp=""
Bharata B Raoeb100392012-09-24 14:42:45 +0530463glusterfs=""
Jeff Codyd85fa9e2016-04-05 10:40:09 -0400464glusterfs_xlator_opt="no"
Bharata B Rao0c14fb42013-07-16 21:47:42 +0530465glusterfs_discard="no"
Niels de Vosdf3a4292017-05-28 12:01:14 +0530466glusterfs_fallocate="no"
Bharata B Rao7c815372013-12-21 14:51:25 +0530467glusterfs_zerofill="no"
Prasanna Kumar Kalevere014dbe2019-03-05 16:46:33 +0100468glusterfs_ftruncate_has_stat="no"
Niels de Vos0e3b8912019-03-05 16:46:34 +0100469glusterfs_iocb_has_stat="no"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -0600470gtk=""
Gerd Hoffmann925a0402015-05-26 12:26:21 +0200471gtk_gl="no"
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +0100472tls_priority="NORMAL"
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +0100473gnutls=""
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +0100474nettle=""
475gcrypt=""
Longpeng(Mike)1f923c72016-12-13 18:42:55 +0800476gcrypt_hmac="no"
Daniel P. Berrange8953caf2016-07-27 14:13:56 +0100477auth_pam=""
Stefan Weilbbbf9bf2014-02-19 07:04:34 +0100478vte=""
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +0200479virglrenderer=""
Paolo Bonzini7aaa6a12019-01-23 14:56:07 +0800480tpm=""
Pino Toscanob10d49d2019-06-20 22:08:40 +0200481libssh=""
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +0100482live_block_migration="yes"
Wanlong Gaoa99d57b2014-05-14 17:43:28 +0800483numa=""
Fam Zheng2847b462015-03-26 11:03:12 +0800484tcmalloc="no"
Alexandre Derumier7b01cb92015-06-19 12:56:58 +0200485jemalloc="no"
Changlong Xiea6b1d4c2016-07-27 15:01:48 +0800486replication="yes"
Ashish Mittalda92c3f2017-04-03 20:48:08 -0700487vxhs=""
Jeff Cody2f740132018-11-07 07:36:44 +0100488bochs="yes"
489cloop="yes"
490dmg="yes"
491qcow1="yes"
492vdi="yes"
493vvfat="yes"
494qed="yes"
495parallels="yes"
496sheepdog="yes"
Klim Kireeved279a02018-01-12 12:01:19 +0300497libxml2=""
Paolo Bonziniba59fb72018-06-13 14:23:08 +0200498debug_mutex="no"
Junyan He17824402018-07-18 15:47:59 +0800499libpmem=""
Paolo Bonzinif3494742019-01-23 14:56:17 +0800500default_devices="yes"
Alex Bennée40e8c6f2019-06-13 14:52:25 +0100501plugins="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100502
Peter Maydell898be3e2017-03-21 14:31:57 +0000503supported_cpu="no"
504supported_os="no"
Peter Maydellfb59dab2017-03-28 14:01:52 +0100505bogus_os="no"
Yang Zhong5a22ab72017-12-20 21:16:46 +0800506malloc_trim=""
Peter Maydell898be3e2017-03-21 14:31:57 +0000507
aliguoriac0df512008-12-29 17:14:15 +0000508# parse CC options first
509for opt do
Stefan Weil89138852016-05-16 15:10:20 +0200510 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
aliguoriac0df512008-12-29 17:14:15 +0000511 case "$opt" in
512 --cross-prefix=*) cross_prefix="$optarg"
513 ;;
Paolo Bonzini3d8df642010-12-23 11:43:48 +0100514 --cc=*) CC="$optarg"
aliguoriac0df512008-12-29 17:14:15 +0000515 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400516 --cxx=*) CXX="$optarg"
517 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200518 --cpu=*) cpu="$optarg"
519 ;;
Alex Bennéede385282015-06-03 09:56:37 +0100520 --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200521 ;;
Bruno Dominguez11cde1c2017-06-06 14:07:47 +0100522 --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
Bruno Dominguez11cde1c2017-06-06 14:07:47 +0100523 ;;
Alex Bennéea4969e92015-06-03 14:22:41 +0100524 --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +0100525 EXTRA_LDFLAGS="$optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200526 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100527 --enable-debug-info) debug_info="yes"
528 ;;
529 --disable-debug-info) debug_info="no"
530 ;;
Alex Bennéed75402b2018-04-04 20:27:05 +0100531 --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option"
532 ;;
Alex Bennéed422b2b2018-04-13 11:07:58 +0100533 --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*}
534 eval "cross_cc_cflags_${cc_arch}=\$optarg"
Paolo Bonzini2038f8c2019-08-07 16:35:23 +0200535 cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}"
Alex Bennéed422b2b2018-04-13 11:07:58 +0100536 ;;
Alex Bennéed75402b2018-04-04 20:27:05 +0100537 --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
Paolo Bonzini2038f8c2019-08-07 16:35:23 +0200538 cc_archs="$cc_archs $cc_arch"
Alex Bennéed75402b2018-04-04 20:27:05 +0100539 eval "cross_cc_${cc_arch}=\$optarg"
Paolo Bonzini2038f8c2019-08-07 16:35:23 +0200540 cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}"
Alex Bennéed75402b2018-04-04 20:27:05 +0100541 ;;
aliguoriac0df512008-12-29 17:14:15 +0000542 esac
543done
aliguoriac0df512008-12-29 17:14:15 +0000544# OS specific
545# Using uname is really, really broken. Once we have the right set of checks
Stefan Weil93148aa2012-02-26 18:46:12 +0100546# we can eliminate its usage altogether.
aliguoriac0df512008-12-29 17:14:15 +0000547
Peter Maydelle49d0212012-12-07 15:39:13 +0000548# Preferred compiler:
549# ${CC} (if set)
550# ${cross_prefix}gcc (if cross-prefix specified)
551# system compiler
552if test -z "${CC}${cross_prefix}"; then
553 cc="$host_cc"
554else
555 cc="${CC-${cross_prefix}gcc}"
556fi
557
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400558if test -z "${CXX}${cross_prefix}"; then
559 cxx="c++"
560else
561 cxx="${CXX-${cross_prefix}g++}"
562fi
563
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500564ar="${AR-${cross_prefix}ar}"
Richard Hendersoncdbd7272016-07-07 21:49:36 -0700565as="${AS-${cross_prefix}as}"
Richard Henderson5f6f0e22016-06-23 10:39:18 -0700566ccas="${CCAS-$cc}"
Blue Swirl3dd46c72013-01-05 10:10:27 +0000567cpp="${CPP-$cc -E}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500568objcopy="${OBJCOPY-${cross_prefix}objcopy}"
569ld="${LD-${cross_prefix}ld}"
Alistair Francis9f81aeb2017-11-07 17:10:46 -0800570ranlib="${RANLIB-${cross_prefix}ranlib}"
Stefan Weil4852ee92014-09-18 21:55:08 +0200571nm="${NM-${cross_prefix}nm}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500572strip="${STRIP-${cross_prefix}strip}"
573windres="${WINDRES-${cross_prefix}windres}"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300574pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
575query_pkg_config() {
576 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
577}
578pkg_config=query_pkg_config
Dave Airlie47c03742013-12-10 14:05:51 +1000579sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
aliguoriac0df512008-12-29 17:14:15 +0000580
Peter Maydell45d285a2013-10-21 21:03:06 +0100581# If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
582ARFLAGS="${ARFLAGS-rv}"
583
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200584# default flags for all hosts
Peter Maydell2d315152016-09-12 14:10:08 +0100585# We use -fwrapv to tell the compiler that we require a C dialect where
586# left shift of signed integers is well defined and has the expected
587# 2s-complement style results. (Both clang and gcc agree that it
588# provides these semantics.)
Thomas Huth7be41672019-01-07 11:25:22 +0100589QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv -std=gnu99 $QEMU_CFLAGS"
Mike Frysingerf9188222011-05-17 17:08:43 -0400590QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
Kevin Wolfc95e3082013-02-22 21:08:51 +0100591QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200592QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +0200593QEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg -iquote \$(SRC_PATH)/include"
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100594if test "$debug_info" = "yes"; then
595 CFLAGS="-g $CFLAGS"
596 LDFLAGS="-g $LDFLAGS"
597fi
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200598
Michael S. Tsirkincab00a52014-04-28 15:09:01 +0300599# running configure in the source tree?
600# we know that's the case if configure is there.
601if test -f "./configure"; then
602 pwd_is_source_path="y"
603else
604 pwd_is_source_path="n"
605fi
606
aliguoriac0df512008-12-29 17:14:15 +0000607check_define() {
608cat > $TMPC <<EOF
609#if !defined($1)
Peter Maydellfd786e12011-11-23 17:26:43 +0000610#error $1 not defined
aliguoriac0df512008-12-29 17:14:15 +0000611#endif
612int main(void) { return 0; }
613EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200614 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000615}
616
Gerd Hoffmann307119e2015-06-10 09:07:35 +0200617check_include() {
618cat > $TMPC <<EOF
619#include <$1>
620int main(void) { return 0; }
621EOF
622 compile_object
623}
624
John Snow93b25862015-03-25 18:57:37 -0400625write_c_skeleton() {
626 cat > $TMPC <<EOF
627int main(void) { return 0; }
628EOF
629}
630
Peter Maydellbbea4052012-08-14 15:35:34 +0100631if check_define __linux__ ; then
632 targetos="Linux"
633elif check_define _WIN32 ; then
634 targetos='MINGW32'
635elif check_define __OpenBSD__ ; then
636 targetos='OpenBSD'
637elif check_define __sun__ ; then
638 targetos='SunOS'
639elif check_define __HAIKU__ ; then
640 targetos='Haiku'
Peter Maydell951fedf2017-07-13 16:15:32 +0100641elif check_define __FreeBSD__ ; then
642 targetos='FreeBSD'
643elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then
644 targetos='GNU/kFreeBSD'
645elif check_define __DragonFly__ ; then
646 targetos='DragonFly'
647elif check_define __NetBSD__; then
648 targetos='NetBSD'
649elif check_define __APPLE__; then
650 targetos='Darwin'
Peter Maydellbbea4052012-08-14 15:35:34 +0100651else
Peter Maydell951fedf2017-07-13 16:15:32 +0100652 # This is a fatal error, but don't report it yet, because we
653 # might be going to just print the --help text, or it might
654 # be the result of a missing compiler.
655 targetos='bogus'
656 bogus_os='yes'
Peter Maydellbbea4052012-08-14 15:35:34 +0100657fi
658
659# Some host OSes need non-standard checks for which CPU to use.
660# Note that these checks are broken for cross-compilation: if you're
661# cross-compiling to one of these OSes then you'll need to specify
662# the correct CPU with the --cpu option.
663case $targetos in
664Darwin)
665 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
666 # run 64-bit userspace code.
667 # If the user didn't specify a CPU explicitly and the kernel says this is
668 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
669 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
670 cpu="x86_64"
671 fi
672 ;;
673SunOS)
Stefan Weil89138852016-05-16 15:10:20 +0200674 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
Peter Maydellbbea4052012-08-14 15:35:34 +0100675 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
676 cpu="x86_64"
677 fi
678esac
679
Juan Quintela2ff6b912009-08-03 14:45:55 +0200680if test ! -z "$cpu" ; then
681 # command line argument
682 :
683elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000684 cpu="i386"
685elif check_define __x86_64__ ; then
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700686 if check_define __ILP32__ ; then
687 cpu="x32"
688 else
689 cpu="x86_64"
690 fi
blueswir13aa9bd62008-12-31 16:55:26 +0000691elif check_define __sparc__ ; then
blueswir13aa9bd62008-12-31 16:55:26 +0000692 if check_define __arch64__ ; then
693 cpu="sparc64"
694 else
695 cpu="sparc"
696 fi
malcfdf7ed92009-01-14 18:39:52 +0000697elif check_define _ARCH_PPC ; then
698 if check_define _ARCH_PPC64 ; then
Richard Hendersonf8378ac2019-05-01 15:38:18 -0700699 if check_define _LITTLE_ENDIAN ; then
700 cpu="ppc64le"
701 else
702 cpu="ppc64"
703 fi
malcfdf7ed92009-01-14 18:39:52 +0000704 else
705 cpu="ppc"
706 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200707elif check_define __mips__ ; then
708 cpu="mips"
Aurelien Jarnod66ed0e2010-06-13 12:28:21 +0200709elif check_define __s390__ ; then
710 if check_define __s390x__ ; then
711 cpu="s390x"
712 else
713 cpu="s390"
714 fi
Alistair Francisc4f80542018-12-19 19:20:19 +0000715elif check_define __riscv ; then
716 if check_define _LP64 ; then
717 cpu="riscv64"
718 else
719 cpu="riscv32"
720 fi
Peter Maydell21d89f82011-11-30 10:57:48 +0100721elif check_define __arm__ ; then
722 cpu="arm"
Claudio Fontana1f080312013-06-12 16:20:23 +0100723elif check_define __aarch64__ ; then
724 cpu="aarch64"
aliguoriac0df512008-12-29 17:14:15 +0000725else
Stefan Weil89138852016-05-16 15:10:20 +0200726 cpu=$(uname -m)
aliguoriac0df512008-12-29 17:14:15 +0000727fi
728
Peter Maydell359bc952011-12-24 13:07:25 +0000729ARCH=
730# Normalise host CPU name and set ARCH.
731# Note that this case should only have supported host CPUs, not guests.
bellard7d132992003-03-06 23:23:54 +0000732case "$cpu" in
Thomas Huthee35e962019-09-28 21:03:34 +0200733 ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64)
Peter Maydell898be3e2017-03-21 14:31:57 +0000734 supported_cpu="yes"
735 ;;
Richard Hendersonf8378ac2019-05-01 15:38:18 -0700736 ppc64le)
737 ARCH="ppc64"
738 supported_cpu="yes"
Richard Hendersonf8378ac2019-05-01 15:38:18 -0700739 ;;
bellard7d132992003-03-06 23:23:54 +0000740 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000741 cpu="i386"
Peter Maydell898be3e2017-03-21 14:31:57 +0000742 supported_cpu="yes"
bellard7d132992003-03-06 23:23:54 +0000743 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000744 x86_64|amd64)
745 cpu="x86_64"
Peter Maydell898be3e2017-03-21 14:31:57 +0000746 supported_cpu="yes"
aurel32aaa5fa12008-04-11 22:04:22 +0000747 ;;
Peter Maydell21d89f82011-11-30 10:57:48 +0100748 armv*b|armv*l|arm)
749 cpu="arm"
Peter Maydell898be3e2017-03-21 14:31:57 +0000750 supported_cpu="yes"
bellard7d132992003-03-06 23:23:54 +0000751 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +0100752 aarch64)
753 cpu="aarch64"
Peter Maydell898be3e2017-03-21 14:31:57 +0000754 supported_cpu="yes"
Claudio Fontana1f080312013-06-12 16:20:23 +0100755 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200756 mips*)
757 cpu="mips"
Peter Maydell898be3e2017-03-21 14:31:57 +0000758 supported_cpu="yes"
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200759 ;;
blueswir131422552007-04-16 18:27:06 +0000760 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000761 cpu="sparc"
Peter Maydell6499fd12017-03-28 11:58:38 +0100762 supported_cpu="yes"
bellardae228532003-05-13 18:59:59 +0000763 ;;
bellard7d132992003-03-06 23:23:54 +0000764 *)
Peter Maydell359bc952011-12-24 13:07:25 +0000765 # This will result in either an error or falling back to TCI later
766 ARCH=unknown
bellard7d132992003-03-06 23:23:54 +0000767 ;;
768esac
Peter Maydell359bc952011-12-24 13:07:25 +0000769if test -z "$ARCH"; then
770 ARCH="$cpu"
771fi
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200772
bellard7d132992003-03-06 23:23:54 +0000773# OS specific
Juan Quintela0dbfc672009-08-03 14:46:13 +0200774
Stacey Sonadfc3e92014-06-08 09:57:22 -0700775# host *BSD for user mode
776HOST_VARIANT_DIR=""
777
bellard7d132992003-03-06 23:23:54 +0000778case $targetos in
bellard67b915a2004-03-31 23:37:16 +0000779MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200780 mingw32="yes"
Vincent Palatinb0cb0a62017-01-10 11:59:57 +0100781 hax="yes"
Paolo Bonzini299e6f12019-02-14 18:35:53 +0100782 vhost_user="no"
Kővágó, Zoltán3cec7cc2015-06-03 23:03:46 +0200783 audio_possible_drivers="dsound sdl"
Gerd Hoffmann307119e2015-06-10 09:07:35 +0200784 if check_include dsound.h; then
785 audio_drv_list="dsound"
786 else
787 audio_drv_list=""
788 fi
Peter Maydell898be3e2017-03-21 14:31:57 +0000789 supported_os="yes"
bellard67b915a2004-03-31 23:37:16 +0000790;;
ths5c40d2b2007-06-23 16:03:36 +0000791GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100792 bsd="yes"
Gerd Hoffmann6a485412019-01-24 12:20:55 +0100793 audio_drv_list="oss try-sdl"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200794 audio_possible_drivers="oss sdl pa"
ths5c40d2b2007-06-23 16:03:36 +0000795;;
bellard7d3505c2004-05-12 19:32:15 +0000796FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200797 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100798 make="${MAKE-gmake}"
Gerd Hoffmann6a485412019-01-24 12:20:55 +0100799 audio_drv_list="oss try-sdl"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200800 audio_possible_drivers="oss sdl pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100801 # needed for kinfo_getvmmap(3) in libutil.h
802 LIBS="-lutil $LIBS"
Ed Mastea7764f12016-11-21 20:32:45 -0500803 # needed for kinfo_getproc
804 libs_qga="-lutil $libs_qga"
Vincenzo Maffione58952132013-11-06 11:44:06 +0100805 netmap="" # enable netmap autodetect
Stacey Sonadfc3e92014-06-08 09:57:22 -0700806 HOST_VARIANT_DIR="freebsd"
Peter Maydell898be3e2017-03-21 14:31:57 +0000807 supported_os="yes"
bellard7d3505c2004-05-12 19:32:15 +0000808;;
blueswir1c5e97232009-03-07 20:06:23 +0000809DragonFly)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200810 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100811 make="${MAKE-gmake}"
Gerd Hoffmann6a485412019-01-24 12:20:55 +0100812 audio_drv_list="oss try-sdl"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200813 audio_possible_drivers="oss sdl pa"
Stacey Sonadfc3e92014-06-08 09:57:22 -0700814 HOST_VARIANT_DIR="dragonfly"
blueswir1c5e97232009-03-07 20:06:23 +0000815;;
bellard7d3505c2004-05-12 19:32:15 +0000816NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200817 bsd="yes"
Kamil Rytarowski604a5b92019-02-08 00:37:04 +0100818 hax="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100819 make="${MAKE-gmake}"
Gerd Hoffmann6a485412019-01-24 12:20:55 +0100820 audio_drv_list="oss try-sdl"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200821 audio_possible_drivers="oss sdl"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200822 oss_lib="-lossaudio"
Stacey Sonadfc3e92014-06-08 09:57:22 -0700823 HOST_VARIANT_DIR="netbsd"
Kamil Rytarowski3c2bdbc2017-05-13 04:21:43 +0200824 supported_os="yes"
bellard7d3505c2004-05-12 19:32:15 +0000825;;
826OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200827 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100828 make="${MAKE-gmake}"
Gerd Hoffmannf92c7162019-01-24 12:20:52 +0100829 audio_drv_list="try-sdl"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200830 audio_possible_drivers="sdl"
Stacey Sonadfc3e92014-06-08 09:57:22 -0700831 HOST_VARIANT_DIR="openbsd"
Brad Smith0a773d52018-02-16 11:46:20 -0500832 supported_os="yes"
bellard7d3505c2004-05-12 19:32:15 +0000833;;
bellard83fb7ad2004-07-05 21:25:26 +0000834Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200835 bsd="yes"
836 darwin="yes"
Vincent Palatinb0cb0a62017-01-10 11:59:57 +0100837 hax="yes"
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -0500838 hvf="yes"
Fam Zheng17969262014-02-10 14:48:56 +0800839 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200840 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200841 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200842 LDFLAGS="-arch x86_64 $LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200843 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200844 cocoa="yes"
Gerd Hoffmann6a485412019-01-24 12:20:55 +0100845 audio_drv_list="coreaudio try-sdl"
Kővágó, Zoltán14382602015-06-03 23:03:45 +0200846 audio_possible_drivers="coreaudio sdl"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200847 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200848 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
Peter Maydella0b7cf62012-08-11 22:34:39 +0100849 # Disable attempts to use ObjectiveC features in os/object.h since they
850 # won't work when we're compiling with gcc as a C compiler.
851 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
Stacey Sonadfc3e92014-06-08 09:57:22 -0700852 HOST_VARIANT_DIR="darwin"
Peter Maydell898be3e2017-03-21 14:31:57 +0000853 supported_os="yes"
bellard83fb7ad2004-07-05 21:25:26 +0000854;;
bellardec530c82006-04-25 22:36:06 +0000855SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200856 solaris="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100857 make="${MAKE-gmake}"
858 install="${INSTALL-ginstall}"
Brade2d88302011-09-02 16:53:28 -0400859 smbd="${SMBD-/usr/sfw/sbin/smbd}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200860 if test -f /usr/include/sys/soundcard.h ; then
Gerd Hoffmann6a485412019-01-24 12:20:55 +0100861 audio_drv_list="oss try-sdl"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200862 fi
863 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000864# needed for CMSG_ macros in sys/socket.h
865 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
866# needed for TIOCWIN* defines in termios.h
867 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200868 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
Andreas Färber560d3752012-04-30 18:00:55 +0200869 solarisnetlibs="-lsocket -lnsl -lresolv"
870 LIBS="$solarisnetlibs $LIBS"
871 libs_qga="$solarisnetlibs $libs_qga"
ths86b2bd92007-02-11 00:31:33 +0000872;;
Andreas Färber179cf402010-09-20 00:50:43 +0200873Haiku)
874 haiku="yes"
875 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
876 LIBS="-lposix_error_mapper -lnetwork $LIBS"
877;;
Peter Maydell898be3e2017-03-21 14:31:57 +0000878Linux)
Gerd Hoffmann71838342019-02-19 13:42:57 +0100879 audio_drv_list="try-pa oss"
Kővágó, Zoltán0bac1112015-06-03 23:03:44 +0200880 audio_possible_drivers="oss alsa sdl pa"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200881 linux="yes"
882 linux_user="yes"
Jan Kiszkaaf2be202011-06-23 10:05:12 +0200883 kvm="yes"
Mao Zhongyie8d81a62018-11-16 14:33:03 -0600884 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$PWD/linux-headers $QEMU_INCLUDES"
Peter Maydell898be3e2017-03-21 14:31:57 +0000885 supported_os="yes"
Tomáš Golembiovský3efac6e2018-10-23 13:23:10 +0200886 libudev="yes"
Peter Maydell898be3e2017-03-21 14:31:57 +0000887;;
bellard7d132992003-03-06 23:23:54 +0000888esac
889
bellard7d3505c2004-05-12 19:32:15 +0000890if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000891 if [ "$darwin" != "yes" ] ; then
Andreas Färber08de3942012-04-26 11:57:39 +0200892 bsd_user="yes"
bellard83fb7ad2004-07-05 21:25:26 +0000893 fi
bellard7d3505c2004-05-12 19:32:15 +0000894fi
895
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100896: ${make=${MAKE-make}}
897: ${install=${INSTALL-install}}
Daniel P. Berrangéfaf44142019-03-27 17:07:01 +0000898# We prefer python 3.x. A bare 'python' is traditionally
899# python 2.x, but some distros have it as python 3.x, so
900# we check that before python2
901python=
902for binary in "${PYTHON-python3}" python python2
903do
904 if has "$binary"
905 then
906 python="$binary"
907 break
908 fi
909done
Brade2d88302011-09-02 16:53:28 -0400910: ${smbd=${SMBD-/usr/sbin/smbd}}
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100911
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100912# Default objcc to clang if available, otherwise use CC
913if has clang; then
914 objcc=clang
915else
916 objcc="$cc"
917fi
918
Juan Quintela3457a3f2009-08-03 14:46:07 +0200919if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +0200920 EXESUF=".exe"
Fam Zheng17969262014-02-10 14:48:56 +0800921 DSOSUF=".dll"
Stefan Weil78e9d4a2015-11-26 12:13:12 +0100922 # MinGW needs -mthreads for TLS and macro _MT.
923 QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
Stefan Weilf7cf5d52012-03-10 11:14:32 +0100924 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
John Snow93b25862015-03-25 18:57:37 -0400925 write_c_skeleton;
Stefan Weilf7cf5d52012-03-10 11:14:32 +0100926 if compile_prog "" "-liberty" ; then
927 LIBS="-liberty $LIBS"
928 fi
Stefan Weilc5ec15e2012-04-07 09:23:38 +0200929 prefix="c:/Program Files/QEMU"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200930 mandir="\${prefix}"
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300931 datadir="\${prefix}"
Eduardo Habkost850da182012-04-18 16:55:38 -0300932 qemu_docdir="\${prefix}"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200933 bindir="\${prefix}"
934 sysconfdir="\${prefix}"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +0200935 local_statedir=
Paolo Bonzini683035d2010-05-26 16:08:28 +0200936 confsuffix=""
Bishara AbuHattoum105fad62017-08-22 16:55:04 +0300937 libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga"
Juan Quintela3457a3f2009-08-03 14:46:07 +0200938fi
939
Anthony Liguori487fefd2009-06-11 13:28:25 -0500940werror=""
bellard85aa5182007-11-11 20:17:03 +0000941
bellard7d132992003-03-06 23:23:54 +0000942for opt do
Stefan Weil89138852016-05-16 15:10:20 +0200943 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
bellard7d132992003-03-06 23:23:54 +0000944 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000945 --help|-h) show_help=yes
946 ;;
Mike Frysinger99123e12011-04-07 01:12:28 -0400947 --version|-V) exec cat $source_path/VERSION
948 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000949 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000950 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000951 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000952 ;;
aliguoriac0df512008-12-29 17:14:15 +0000953 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000954 ;;
aliguoriac0df512008-12-29 17:14:15 +0000955 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000956 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000957 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000958 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400959 --cxx=*)
960 ;;
Michael S. Tsirkine007dbe2013-11-24 11:38:05 +0200961 --iasl=*) iasl="$optarg"
962 ;;
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100963 --objcc=*) objcc="$optarg"
964 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000965 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000966 ;;
pbrook6a882642006-04-17 13:57:12 +0000967 --install=*) install="$optarg"
968 ;;
Blue Swirlc886edf2011-07-22 21:08:09 +0000969 --python=*) python="$optarg"
970 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +0000971 --gcov=*) gcov_tool="$optarg"
972 ;;
Brade2d88302011-09-02 16:53:28 -0400973 --smbd=*) smbd="$optarg"
974 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200975 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000976 ;;
Bruno Dominguez11cde1c2017-06-06 14:07:47 +0100977 --extra-cxxflags=*)
978 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200979 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000980 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100981 --enable-debug-info)
982 ;;
983 --disable-debug-info)
984 ;;
Alex Bennéed75402b2018-04-04 20:27:05 +0100985 --cross-cc-*)
986 ;;
Fam Zheng17969262014-02-10 14:48:56 +0800987 --enable-modules)
988 modules="yes"
989 ;;
Stefan Hajnoczi3aa88b32015-11-02 14:06:23 +0000990 --disable-modules)
991 modules="no"
992 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200993 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000994 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000995 --target-list=*) target_list="$optarg"
Alex Bennée447e1332019-03-19 11:59:12 +0000996 if test "$target_list_exclude"; then
997 error_exit "Can't mix --target-list with --target-list-exclude"
998 fi
999 ;;
1000 --target-list-exclude=*) target_list_exclude="$optarg"
1001 if test "$target_list"; then
1002 error_exit "Can't mix --target-list-exclude with --target-list"
1003 fi
bellardde83cd02003-06-15 20:25:43 +00001004 ;;
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +02001005 --enable-trace-backends=*) trace_backends="$optarg"
1006 ;;
1007 # XXX: backwards compatibility
1008 --enable-trace-backend=*) trace_backends="$optarg"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01001009 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +01001010 --with-trace-file=*) trace_file="$optarg"
Prerna Saxena9410b562010-07-13 09:26:32 +01001011 ;;
Paolo Bonzinif3494742019-01-23 14:56:17 +08001012 --with-default-devices) default_devices="yes"
1013 ;;
1014 --without-default-devices) default_devices="no"
1015 ;;
bellard7d132992003-03-06 23:23:54 +00001016 --enable-gprof) gprof="yes"
1017 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +00001018 --enable-gcov) gcov="yes"
1019 ;;
LoĂŻc Minier79427692010-01-31 12:23:45 +01001020 --static)
1021 static="yes"
1022 LDFLAGS="-static $LDFLAGS"
Sergei Trofimovich17884d72012-01-31 22:03:45 +03001023 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001024 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +02001025 --mandir=*) mandir="$optarg"
1026 ;;
1027 --bindir=*) bindir="$optarg"
1028 ;;
Alon Levy3aa5d2b2011-05-15 12:08:59 +03001029 --libdir=*) libdir="$optarg"
1030 ;;
Michael Tokarev8bf188a2012-06-07 01:11:00 +04001031 --libexecdir=*) libexecdir="$optarg"
1032 ;;
Alon Levy0f94d6d2011-06-27 11:58:20 +02001033 --includedir=*) includedir="$optarg"
1034 ;;
Eduardo Habkost528ae5b2012-04-18 16:55:49 -03001035 --datadir=*) datadir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +02001036 ;;
Eduardo Habkost023d3d62012-04-18 16:55:50 -03001037 --with-confsuffix=*) confsuffix="$optarg"
1038 ;;
Eduardo Habkost850da182012-04-18 16:55:38 -03001039 --docdir=*) qemu_docdir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +02001040 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +01001041 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -06001042 ;;
Luiz Capitulino785c23a2012-10-03 18:35:57 -03001043 --localstatedir=*) local_statedir="$optarg"
1044 ;;
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +02001045 --firmwarepath=*) firmwarepath="$optarg"
1046 ;;
Olaf Hering181ce1d2018-04-18 09:50:44 +02001047 --host=*|--build=*|\
1048 --disable-dependency-tracking|\
Luiz Capitulino785c23a2012-10-03 18:35:57 -03001049 --sbindir=*|--sharedstatedir=*|\
Max Filippov023ddd72011-11-24 16:11:31 +04001050 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
1051 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
1052 # These switches are silently ignored, for compatibility with
1053 # autoconf-generated configure scripts. This allows QEMU's
1054 # configure to be used by RPM and similar macros that set
1055 # lots of directory switches by default.
1056 ;;
bellard97a847b2003-08-10 21:36:04 +00001057 --disable-sdl) sdl="no"
1058 ;;
Juan Quintelac4198152009-08-12 18:29:53 +02001059 --enable-sdl) sdl="yes"
1060 ;;
Daniel P. Berrangéa442fe22019-01-10 12:00:47 +00001061 --disable-sdl-image) sdl_image="no"
1062 ;;
1063 --enable-sdl-image) sdl_image="yes"
1064 ;;
Paolo Bonzini3556c232013-05-10 14:16:40 +02001065 --disable-qom-cast-debug) qom_cast_debug="no"
1066 ;;
1067 --enable-qom-cast-debug) qom_cast_debug="yes"
1068 ;;
Meador Inge983eef52012-02-24 14:00:42 +05301069 --disable-virtfs) virtfs="no"
1070 ;;
1071 --enable-virtfs) virtfs="yes"
1072 ;;
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02001073 --disable-mpath) mpath="no"
1074 ;;
1075 --enable-mpath) mpath="yes"
1076 ;;
Jes Sorensen821601e2011-03-16 13:33:36 +01001077 --disable-vnc) vnc="no"
1078 ;;
1079 --enable-vnc) vnc="yes"
1080 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +00001081 --oss-lib=*) oss_lib="$optarg"
1082 ;;
malc0c58ac12008-06-25 21:04:05 +00001083 --audio-drv-list=*) audio_drv_list="$optarg"
1084 ;;
Stefan Weil89138852016-05-16 15:10:20 +02001085 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
Fam Zhengb64ec4e2013-05-29 19:35:40 +08001086 ;;
Stefan Weil89138852016-05-16 15:10:20 +02001087 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
Markus Armbrustereb852012009-10-27 18:41:44 +01001088 ;;
aurel32f8393942009-04-13 18:45:38 +00001089 --enable-debug-tcg) debug_tcg="yes"
1090 ;;
1091 --disable-debug-tcg) debug_tcg="no"
1092 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +01001093 --enable-debug)
1094 # Enable debugging options that aren't excessively noisy
1095 debug_tcg="yes"
Peter Xu1fcc6d42018-04-25 10:54:59 +08001096 debug_mutex="yes"
Paul Brookf3d08ee2009-06-04 11:39:04 +01001097 debug="yes"
1098 strip_opt="no"
John Snowb553a042015-11-03 15:43:42 -05001099 fortify_source="no"
Paul Brookf3d08ee2009-06-04 11:39:04 +01001100 ;;
Marc-André Lureau247724c2018-01-16 16:11:51 +01001101 --enable-sanitizers) sanitizers="yes"
1102 ;;
1103 --disable-sanitizers) sanitizers="no"
1104 ;;
aliguori03b4fe72008-10-07 19:16:17 +00001105 --enable-sparse) sparse="yes"
1106 ;;
1107 --disable-sparse) sparse="no"
1108 ;;
aliguori1625af82009-04-05 17:41:02 +00001109 --disable-strip) strip_opt="no"
1110 ;;
aliguori2f9606b2009-03-06 20:27:28 +00001111 --disable-vnc-sasl) vnc_sasl="no"
1112 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +02001113 --enable-vnc-sasl) vnc_sasl="yes"
1114 ;;
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001115 --disable-vnc-jpeg) vnc_jpeg="no"
1116 ;;
1117 --enable-vnc-jpeg) vnc_jpeg="yes"
1118 ;;
Corentin Charyefe556a2010-07-07 20:57:56 +02001119 --disable-vnc-png) vnc_png="no"
1120 ;;
1121 --enable-vnc-png) vnc_png="yes"
1122 ;;
bellard443f1372004-06-04 11:13:20 +00001123 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +00001124 ;;
Marc-André Lureau7c57bdd2019-04-24 13:00:41 +02001125 --enable-slirp=git) slirp="git"
1126 ;;
Marc-André Lureau675b9b52019-02-12 17:25:23 +01001127 --enable-slirp=system) slirp="system"
1128 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +00001129 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +00001130 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +02001131 --enable-vde) vde="yes"
1132 ;;
Vincenzo Maffione58952132013-11-06 11:44:06 +01001133 --disable-netmap) netmap="no"
1134 ;;
1135 --enable-netmap) netmap="yes"
1136 ;;
aliguorie37630c2009-04-22 15:19:10 +00001137 --disable-xen) xen="no"
1138 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +02001139 --enable-xen) xen="yes"
1140 ;;
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001141 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
1142 ;;
1143 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
1144 ;;
aurel322e4d9fb2008-04-08 06:01:02 +00001145 --disable-brlapi) brlapi="no"
1146 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001147 --enable-brlapi) brlapi="yes"
1148 ;;
balrogfb599c92008-09-28 23:49:55 +00001149 --disable-bluez) bluez="no"
1150 ;;
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001151 --enable-bluez) bluez="yes"
1152 ;;
aliguori7ba1e612008-11-05 16:04:33 +00001153 --disable-kvm) kvm="no"
1154 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +02001155 --enable-kvm) kvm="yes"
1156 ;;
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01001157 --disable-hax) hax="no"
zhanghailiang180fb752016-10-27 14:43:08 +08001158 ;;
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01001159 --enable-hax) hax="yes"
zhanghailiang180fb752016-10-27 14:43:08 +08001160 ;;
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05001161 --disable-hvf) hvf="no"
1162 ;;
1163 --enable-hvf) hvf="yes"
1164 ;;
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08001165 --disable-whpx) whpx="no"
1166 ;;
1167 --enable-whpx) whpx="yes"
1168 ;;
Stefan Weil9195b2c2011-10-19 07:07:18 +02001169 --disable-tcg-interpreter) tcg_interpreter="no"
1170 ;;
1171 --enable-tcg-interpreter) tcg_interpreter="yes"
1172 ;;
Corey Bryant47e98652012-01-26 09:42:26 -05001173 --disable-cap-ng) cap_ng="no"
1174 ;;
1175 --enable-cap-ng) cap_ng="yes"
1176 ;;
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +02001177 --disable-tcg) tcg="no"
1178 ;;
1179 --enable-tcg) tcg="yes"
1180 ;;
Yang Zhong5a22ab72017-12-20 21:16:46 +08001181 --disable-malloc-trim) malloc_trim="no"
1182 ;;
1183 --enable-malloc-trim) malloc_trim="yes"
1184 ;;
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01001185 --disable-spice) spice="no"
1186 ;;
1187 --enable-spice) spice="yes"
1188 ;;
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11001189 --disable-libiscsi) libiscsi="no"
1190 ;;
1191 --enable-libiscsi) libiscsi="yes"
1192 ;;
Peter Lieven6542aa92014-02-03 10:26:13 +01001193 --disable-libnfs) libnfs="no"
1194 ;;
1195 --enable-libnfs) libnfs="yes"
1196 ;;
bellard05c2a3e2006-02-08 22:39:17 +00001197 --enable-profiler) profiler="yes"
1198 ;;
Pavel Borzenkov14821032011-11-10 22:40:07 +04001199 --disable-cocoa) cocoa="no"
1200 ;;
malcc2de5c92008-06-28 19:13:06 +00001201 --enable-cocoa)
1202 cocoa="yes" ;
Stefan Weil89138852016-05-16 15:10:20 +02001203 audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
bellard1d14ffa2005-10-30 18:58:22 +00001204 ;;
pbrookcad25d62006-03-19 16:31:11 +00001205 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +00001206 ;;
pbrookcad25d62006-03-19 16:31:11 +00001207 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +00001208 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -10001209 --disable-user)
1210 linux_user="no" ;
1211 bsd_user="no" ;
Zachary Amsden0953a802009-07-30 00:14:59 -10001212 ;;
1213 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +00001214 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +00001215 ;;
ths831b7822007-01-18 20:06:33 +00001216 --enable-linux-user) linux_user="yes"
1217 ;;
blueswir184778502008-10-26 20:33:16 +00001218 --disable-bsd-user) bsd_user="no"
1219 ;;
1220 --enable-bsd-user) bsd_user="yes"
1221 ;;
Avi Kivity40d64442011-11-15 20:12:17 +02001222 --enable-pie) pie="yes"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03001223 ;;
Avi Kivity40d64442011-11-15 20:12:17 +02001224 --disable-pie) pie="no"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03001225 ;;
bellard85aa5182007-11-11 20:17:03 +00001226 --enable-werror) werror="yes"
1227 ;;
1228 --disable-werror) werror="no"
1229 ;;
Steven Noonan63678e12014-03-28 17:19:02 +01001230 --enable-stack-protector) stack_protector="yes"
1231 ;;
1232 --disable-stack-protector) stack_protector="no"
1233 ;;
balrog4d3b6f62008-02-10 16:33:14 +00001234 --disable-curses) curses="no"
1235 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +02001236 --enable-curses) curses="yes"
1237 ;;
Samuel Thibaulte08bb302019-03-11 14:51:26 +01001238 --disable-iconv) iconv="no"
1239 ;;
1240 --enable-iconv) iconv="yes"
1241 ;;
Alexander Graf769ce762009-05-11 17:41:42 +02001242 --disable-curl) curl="no"
1243 ;;
Juan Quintela788c8192009-08-12 18:29:47 +02001244 --enable-curl) curl="yes"
1245 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +02001246 --disable-fdt) fdt="no"
1247 ;;
1248 --enable-fdt) fdt="yes"
1249 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001250 --disable-linux-aio) linux_aio="no"
1251 ;;
1252 --enable-linux-aio) linux_aio="yes"
1253 ;;
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07001254 --disable-attr) attr="no"
1255 ;;
1256 --enable-attr) attr="yes"
1257 ;;
Paolo Bonzinia40161c2018-02-16 10:05:23 +01001258 --disable-membarrier) membarrier="no"
1259 ;;
1260 --enable-membarrier) membarrier="yes"
1261 ;;
ths77755342008-11-27 15:45:16 +00001262 --disable-blobs) blobs="no"
1263 ;;
Thomas Huth7e563bf2018-02-15 12:06:47 +01001264 --with-pkgversion=*) pkgversion="$optarg"
pbrook4a19f1e2009-04-07 23:17:49 +00001265 ;;
Alex Barcelo519175a2012-02-28 12:25:50 +01001266 --with-coroutine=*) coroutine="$optarg"
1267 ;;
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02001268 --disable-coroutine-pool) coroutine_pool="no"
1269 ;;
1270 --enable-coroutine-pool) coroutine_pool="yes"
1271 ;;
Peter Lieven7d992e42016-09-27 11:58:45 +02001272 --enable-debug-stack-usage) debug_stack_usage="yes"
1273 ;;
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04001274 --enable-crypto-afalg) crypto_afalg="yes"
1275 ;;
1276 --disable-crypto-afalg) crypto_afalg="no"
1277 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +02001278 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -05001279 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +02001280 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +02001281 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +02001282 --disable-vhost-net) vhost_net="no"
1283 ;;
1284 --enable-vhost-net) vhost_net="yes"
1285 ;;
Gonglei042cea22018-03-01 21:46:28 +08001286 --disable-vhost-crypto) vhost_crypto="no"
1287 ;;
Paolo Bonzini299e6f12019-02-14 18:35:53 +01001288 --enable-vhost-crypto) vhost_crypto="yes"
Gonglei042cea22018-03-01 21:46:28 +08001289 ;;
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00001290 --disable-vhost-scsi) vhost_scsi="no"
1291 ;;
1292 --enable-vhost-scsi) vhost_scsi="yes"
1293 ;;
Stefan Hajnoczifc0b9b02016-08-16 13:27:22 +01001294 --disable-vhost-vsock) vhost_vsock="no"
1295 ;;
1296 --enable-vhost-vsock) vhost_vsock="yes"
1297 ;;
Dr. David Alan Gilbert98fc1ad2019-09-30 11:51:34 +01001298 --disable-vhost-user-fs) vhost_user_fs="no"
1299 ;;
1300 --enable-vhost-user-fs) vhost_user_fs="yes"
1301 ;;
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01001302 --disable-opengl) opengl="no"
Michael Walle20ff0752011-03-07 23:32:39 +01001303 ;;
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01001304 --enable-opengl) opengl="yes"
Michael Walle20ff0752011-03-07 23:32:39 +01001305 ;;
Christian Brunnerf27aaf42010-12-06 20:53:01 +01001306 --disable-rbd) rbd="no"
1307 ;;
1308 --enable-rbd) rbd="yes"
1309 ;;
Sergei Trofimovich8c84cf12012-01-24 20:42:40 +03001310 --disable-xfsctl) xfs="no"
1311 ;;
1312 --enable-xfsctl) xfs="yes"
1313 ;;
Marc-André Lureau7b02f542015-08-30 11:48:40 +02001314 --disable-smartcard) smartcard="no"
Robert Relyea111a38b2010-11-28 16:36:38 +02001315 ;;
Marc-André Lureau7b02f542015-08-30 11:48:40 +02001316 --enable-smartcard) smartcard="yes"
Robert Relyea111a38b2010-11-28 16:36:38 +02001317 ;;
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01001318 --disable-libusb) libusb="no"
1319 ;;
1320 --enable-libusb) libusb="yes"
1321 ;;
Hans de Goede69354a82011-07-19 11:04:10 +02001322 --disable-usb-redir) usb_redir="no"
1323 ;;
1324 --enable-usb-redir) usb_redir="yes"
1325 ;;
Alon Levy1ece9902011-07-26 12:30:40 +03001326 --disable-zlib-test) zlib="no"
1327 ;;
Stefan Weilb25c9df2014-04-29 08:21:16 +02001328 --disable-lzo) lzo="no"
1329 ;;
qiaonuohan607dacd2014-02-18 14:11:30 +08001330 --enable-lzo) lzo="yes"
1331 ;;
Stefan Weilb25c9df2014-04-29 08:21:16 +02001332 --disable-snappy) snappy="no"
1333 ;;
qiaonuohan607dacd2014-02-18 14:11:30 +08001334 --enable-snappy) snappy="yes"
1335 ;;
Peter Wu6b383c02015-01-06 18:48:14 +01001336 --disable-bzip2) bzip2="no"
1337 ;;
1338 --enable-bzip2) bzip2="yes"
1339 ;;
Julio Faracco83bc1f92018-11-05 13:08:04 -02001340 --enable-lzfse) lzfse="yes"
1341 ;;
1342 --disable-lzfse) lzfse="no"
1343 ;;
Michael Rothd138cee2011-08-01 14:52:57 -05001344 --enable-guest-agent) guest_agent="yes"
1345 ;;
1346 --disable-guest-agent) guest_agent="no"
1347 ;;
Yossi Hindin9dacf322015-05-06 14:57:40 +03001348 --enable-guest-agent-msi) guest_agent_msi="yes"
1349 ;;
1350 --disable-guest-agent-msi) guest_agent_msi="no"
1351 ;;
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04001352 --with-vss-sdk) vss_win32_sdk=""
1353 ;;
1354 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1355 ;;
1356 --without-vss-sdk) vss_win32_sdk="no"
1357 ;;
1358 --with-win-sdk) win_sdk=""
1359 ;;
1360 --with-win-sdk=*) win_sdk="$optarg"
1361 ;;
1362 --without-win-sdk) win_sdk="no"
1363 ;;
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01001364 --enable-tools) want_tools="yes"
1365 ;;
1366 --disable-tools) want_tools="no"
1367 ;;
Eduardo Otubof7945732012-08-14 18:44:05 -03001368 --enable-seccomp) seccomp="yes"
1369 ;;
1370 --disable-seccomp) seccomp="no"
1371 ;;
Bharata B Raoeb100392012-09-24 14:42:45 +05301372 --disable-glusterfs) glusterfs="no"
1373 ;;
Liam Merwick86583a02018-10-19 21:38:59 +01001374 --disable-avx2) avx2_opt="no"
1375 ;;
1376 --enable-avx2) avx2_opt="yes"
1377 ;;
Bharata B Raoeb100392012-09-24 14:42:45 +05301378 --enable-glusterfs) glusterfs="yes"
1379 ;;
Fam Zheng52b53c02014-09-10 14:17:51 +08001380 --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
1381 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01001382 ;;
Fam Zhengcb6414d2016-09-21 12:27:16 +08001383 --enable-vhdx|--disable-vhdx)
1384 echo "$0: $opt is obsolete, VHDX driver is always built" >&2
1385 ;;
Fam Zheng315d3182016-09-21 12:27:21 +08001386 --enable-uuid|--disable-uuid)
1387 echo "$0: $opt is obsolete, UUID support is always built" >&2
1388 ;;
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001389 --disable-gtk) gtk="no"
1390 ;;
1391 --enable-gtk) gtk="yes"
1392 ;;
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +01001393 --tls-priority=*) tls_priority="$optarg"
1394 ;;
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01001395 --disable-gnutls) gnutls="no"
1396 ;;
1397 --enable-gnutls) gnutls="yes"
1398 ;;
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01001399 --disable-nettle) nettle="no"
1400 ;;
1401 --enable-nettle) nettle="yes"
1402 ;;
1403 --disable-gcrypt) gcrypt="no"
1404 ;;
1405 --enable-gcrypt) gcrypt="yes"
1406 ;;
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01001407 --disable-auth-pam) auth_pam="no"
1408 ;;
1409 --enable-auth-pam) auth_pam="yes"
1410 ;;
Michael R. Hines2da776d2013-07-22 10:01:54 -04001411 --enable-rdma) rdma="yes"
1412 ;;
1413 --disable-rdma) rdma="no"
1414 ;;
Marcel Apfelbaum21ab34c2018-08-16 18:16:37 +03001415 --enable-pvrdma) pvrdma="yes"
1416 ;;
1417 --disable-pvrdma) pvrdma="no"
1418 ;;
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01001419 --disable-vte) vte="no"
1420 ;;
1421 --enable-vte) vte="yes"
1422 ;;
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +02001423 --disable-virglrenderer) virglrenderer="no"
1424 ;;
1425 --enable-virglrenderer) virglrenderer="yes"
1426 ;;
Cole Robinsone91c7932014-06-16 15:32:47 -04001427 --disable-tpm) tpm="no"
1428 ;;
Stefan Bergerab214c22013-02-27 12:47:52 -05001429 --enable-tpm) tpm="yes"
1430 ;;
Pino Toscanob10d49d2019-06-20 22:08:40 +02001431 --disable-libssh) libssh="no"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01001432 ;;
Pino Toscanob10d49d2019-06-20 22:08:40 +02001433 --enable-libssh) libssh="yes"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01001434 ;;
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +01001435 --disable-live-block-migration) live_block_migration="no"
1436 ;;
1437 --enable-live-block-migration) live_block_migration="yes"
1438 ;;
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08001439 --disable-numa) numa="no"
1440 ;;
1441 --enable-numa) numa="yes"
1442 ;;
Klim Kireeved279a02018-01-12 12:01:19 +03001443 --disable-libxml2) libxml2="no"
1444 ;;
1445 --enable-libxml2) libxml2="yes"
1446 ;;
Fam Zheng2847b462015-03-26 11:03:12 +08001447 --disable-tcmalloc) tcmalloc="no"
1448 ;;
1449 --enable-tcmalloc) tcmalloc="yes"
1450 ;;
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02001451 --disable-jemalloc) jemalloc="no"
1452 ;;
1453 --enable-jemalloc) jemalloc="yes"
1454 ;;
Changlong Xiea6b1d4c2016-07-27 15:01:48 +08001455 --disable-replication) replication="no"
1456 ;;
1457 --enable-replication) replication="yes"
1458 ;;
Ashish Mittalda92c3f2017-04-03 20:48:08 -07001459 --disable-vxhs) vxhs="no"
1460 ;;
1461 --enable-vxhs) vxhs="yes"
1462 ;;
Jeff Cody2f740132018-11-07 07:36:44 +01001463 --disable-bochs) bochs="no"
1464 ;;
1465 --enable-bochs) bochs="yes"
1466 ;;
1467 --disable-cloop) cloop="no"
1468 ;;
1469 --enable-cloop) cloop="yes"
1470 ;;
1471 --disable-dmg) dmg="no"
1472 ;;
1473 --enable-dmg) dmg="yes"
1474 ;;
1475 --disable-qcow1) qcow1="no"
1476 ;;
1477 --enable-qcow1) qcow1="yes"
1478 ;;
1479 --disable-vdi) vdi="no"
1480 ;;
1481 --enable-vdi) vdi="yes"
1482 ;;
1483 --disable-vvfat) vvfat="no"
1484 ;;
1485 --enable-vvfat) vvfat="yes"
1486 ;;
1487 --disable-qed) qed="no"
1488 ;;
1489 --enable-qed) qed="yes"
1490 ;;
1491 --disable-parallels) parallels="no"
1492 ;;
1493 --enable-parallels) parallels="yes"
1494 ;;
1495 --disable-sheepdog) sheepdog="no"
1496 ;;
1497 --enable-sheepdog) sheepdog="yes"
1498 ;;
Marc-André Lureaue6a74862017-08-03 11:07:46 +02001499 --disable-vhost-user) vhost_user="no"
1500 ;;
Paolo Bonzini299e6f12019-02-14 18:35:53 +01001501 --enable-vhost-user) vhost_user="yes"
1502 ;;
1503 --disable-vhost-kernel) vhost_kernel="no"
1504 ;;
1505 --enable-vhost-kernel) vhost_kernel="yes"
Marc-André Lureaue6a74862017-08-03 11:07:46 +02001506 ;;
Richard Henderson8ca80762017-09-14 09:41:12 -07001507 --disable-capstone) capstone="no"
1508 ;;
1509 --enable-capstone) capstone="yes"
1510 ;;
Richard Hendersone219c492017-09-28 09:01:23 -07001511 --enable-capstone=git) capstone="git"
1512 ;;
1513 --enable-capstone=system) capstone="system"
1514 ;;
Daniel P. Berrangecc84d632017-10-20 15:02:43 +01001515 --with-git=*) git="$optarg"
1516 ;;
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +01001517 --enable-git-update) git_update=yes
1518 ;;
1519 --disable-git-update) git_update=no
1520 ;;
Paolo Bonziniba59fb72018-06-13 14:23:08 +02001521 --enable-debug-mutex) debug_mutex=yes
1522 ;;
1523 --disable-debug-mutex) debug_mutex=no
1524 ;;
Junyan He17824402018-07-18 15:47:59 +08001525 --enable-libpmem) libpmem=yes
1526 ;;
1527 --disable-libpmem) libpmem=no
1528 ;;
James Le Cuirot75411912019-09-14 15:51:55 +01001529 --enable-xkbcommon) xkbcommon=yes
1530 ;;
1531 --disable-xkbcommon) xkbcommon=no
1532 ;;
Alex Bennée40e8c6f2019-06-13 14:52:25 +01001533 --enable-plugins) plugins="yes"
1534 ;;
1535 --disable-plugins) plugins="no"
1536 ;;
Fam Zheng2d2ad6d2014-04-18 14:55:36 +08001537 *)
1538 echo "ERROR: unknown option $opt"
1539 echo "Try '$0 --help' for more information"
1540 exit 1
balrog7f1559c2007-11-17 10:24:32 +00001541 ;;
bellard7d132992003-03-06 23:23:54 +00001542 esac
1543done
1544
bellard40293e52008-01-31 11:32:10 +00001545case "$cpu" in
Richard Hendersone3608d62013-08-28 15:48:21 -07001546 ppc)
1547 CPU_CFLAGS="-m32"
1548 LDFLAGS="-m32 $LDFLAGS"
1549 ;;
1550 ppc64)
1551 CPU_CFLAGS="-m64"
1552 LDFLAGS="-m64 $LDFLAGS"
1553 ;;
Richard Henderson9b9c37c2012-09-21 10:34:21 -07001554 sparc)
Richard Hendersonf1079bb2017-04-26 10:39:08 -07001555 CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc"
1556 LDFLAGS="-m32 -mv8plus $LDFLAGS"
blueswir131422552007-04-16 18:27:06 +00001557 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +02001558 sparc64)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001559 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
Richard Hendersonf1079bb2017-04-26 10:39:08 -07001560 LDFLAGS="-m64 $LDFLAGS"
blueswir131422552007-04-16 18:27:06 +00001561 ;;
ths76d83bd2007-11-18 21:22:10 +00001562 s390)
Richard Henderson061cdd82014-03-31 13:40:49 -04001563 CPU_CFLAGS="-m31"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001564 LDFLAGS="-m31 $LDFLAGS"
1565 ;;
1566 s390x)
Richard Henderson061cdd82014-03-31 13:40:49 -04001567 CPU_CFLAGS="-m64"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001568 LDFLAGS="-m64 $LDFLAGS"
ths76d83bd2007-11-18 21:22:10 +00001569 ;;
bellard40293e52008-01-31 11:32:10 +00001570 i386)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001571 CPU_CFLAGS="-m32"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001572 LDFLAGS="-m32 $LDFLAGS"
bellard40293e52008-01-31 11:32:10 +00001573 ;;
1574 x86_64)
Richard Henderson7ebee432016-06-29 21:10:59 -07001575 # ??? Only extremely old AMD cpus do not have cmpxchg16b.
1576 # If we truly care, we should simply detect this case at
1577 # runtime and generate the fallback to serial emulation.
1578 CPU_CFLAGS="-m64 -mcx16"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001579 LDFLAGS="-m64 $LDFLAGS"
Paul Brook379f6692009-07-17 12:48:08 +01001580 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001581 x32)
1582 CPU_CFLAGS="-mx32"
1583 LDFLAGS="-mx32 $LDFLAGS"
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001584 ;;
Peter Maydell30163d82012-10-09 03:16:49 +00001585 # No special flags required for other host CPUs
blueswir131422552007-04-16 18:27:06 +00001586esac
1587
Paolo Bonzini2038f8c2019-08-07 16:35:23 +02001588eval "cross_cc_${cpu}=\$host_cc"
1589cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001590QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001591
Peter Maydellaffc88c2016-06-13 11:32:24 +01001592# For user-mode emulation the host arch has to be one we explicitly
1593# support, even if we're using TCI.
1594if [ "$ARCH" = "unknown" ]; then
1595 bsd_user="no"
1596 linux_user="no"
1597fi
1598
Peter Maydell60e0df22011-05-03 14:50:13 +01001599default_target_list=""
1600
Peter Maydell6e92f822013-05-20 16:16:15 +01001601mak_wilds=""
1602
1603if [ "$softmmu" = "yes" ]; then
1604 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001605fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001606if [ "$linux_user" = "yes" ]; then
1607 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001608fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001609if [ "$bsd_user" = "yes" ]; then
1610 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001611fi
1612
Alex Bennée447e1332019-03-19 11:59:12 +00001613if test -z "$target_list_exclude"; then
1614 for config in $mak_wilds; do
1615 default_target_list="${default_target_list} $(basename "$config" .mak)"
1616 done
1617else
1618 exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
1619 for config in $mak_wilds; do
1620 target="$(basename "$config" .mak)"
1621 exclude="no"
1622 for excl in $exclude_list; do
1623 if test "$excl" = "$target"; then
1624 exclude="yes"
1625 break;
1626 fi
1627 done
1628 if test "$exclude" = "no"; then
1629 default_target_list="${default_target_list} $target"
1630 fi
1631 done
1632fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001633
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01001634# Enumerate public trace backends for --help output
Greg Kurz64a60472017-04-26 15:36:07 +02001635trace_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 +01001636
pbrookaf5db582006-04-08 14:26:41 +00001637if test x"$show_help" = x"yes" ; then
1638cat << EOF
1639
1640Usage: configure [options]
1641Options: [defaults in brackets after descriptions]
1642
Stefan Weil08fb77e2013-12-18 22:09:39 +01001643Standard options:
1644 --help print this message
1645 --prefix=PREFIX install in PREFIX [$prefix]
1646 --interp-prefix=PREFIX where to find shared libraries, etc.
1647 use %M for cpu name [$interp_prefix]
1648 --target-list=LIST set target list (default: build everything)
1649$(echo Available targets: $default_target_list | \
1650 fold -s -w 53 | sed -e 's/^/ /')
Alex Bennée447e1332019-03-19 11:59:12 +00001651 --target-list-exclude=LIST exclude a set of targets from the default target-list
Stefan Weil08fb77e2013-12-18 22:09:39 +01001652
1653Advanced options (experts only):
Stefan Weil08fb77e2013-12-18 22:09:39 +01001654 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1655 --cc=CC use C compiler CC [$cc]
1656 --iasl=IASL use ACPI compiler IASL [$iasl]
1657 --host-cc=CC use C compiler CC [$host_cc] for code run at
1658 build time
1659 --cxx=CXX use C++ compiler CXX [$cxx]
1660 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1661 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
Bruno Dominguez11cde1c2017-06-06 14:07:47 +01001662 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS
Stefan Weil08fb77e2013-12-18 22:09:39 +01001663 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
Alex Bennéed75402b2018-04-04 20:27:05 +01001664 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases
Alex Bennéed422b2b2018-04-13 11:07:58 +01001665 --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests
Stefan Weil08fb77e2013-12-18 22:09:39 +01001666 --make=MAKE use specified make [$make]
1667 --install=INSTALL use specified install [$install]
1668 --python=PYTHON use specified python [$python]
1669 --smbd=SMBD use specified smbd [$smbd]
Thomas Huthdb1b5f12018-03-27 17:09:30 +02001670 --with-git=GIT use specified git [$git]
Stefan Weil08fb77e2013-12-18 22:09:39 +01001671 --static enable static build [$static]
1672 --mandir=PATH install man pages in PATH
1673 --datadir=PATH install firmware in PATH$confsuffix
1674 --docdir=PATH install documentation in PATH$confsuffix
1675 --bindir=PATH install binaries in PATH
1676 --libdir=PATH install libraries in PATH
Thomas Huthdb1b5f12018-03-27 17:09:30 +02001677 --libexecdir=PATH install helper binaries in PATH
Stefan Weil08fb77e2013-12-18 22:09:39 +01001678 --sysconfdir=PATH install config in PATH$confsuffix
1679 --localstatedir=PATH install local state in PATH (set at runtime on win32)
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +02001680 --firmwarepath=PATH search PATH for firmware files
Fam Zhenge26110c2014-02-10 14:48:57 +08001681 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
Thomas Huthdb1b5f12018-03-27 17:09:30 +02001682 --with-pkgversion=VERS use specified string as sub-version of the package
Stefan Weil08fb77e2013-12-18 22:09:39 +01001683 --enable-debug enable common debug build options
Marc-André Lureau247724c2018-01-16 16:11:51 +01001684 --enable-sanitizers enable default sanitizers
Stefan Weil08fb77e2013-12-18 22:09:39 +01001685 --disable-strip disable stripping binaries
1686 --disable-werror disable compilation abort on warning
Steven Noonan63678e12014-03-28 17:19:02 +01001687 --disable-stack-protector disable compiler-provided stack protection
Stefan Weil08fb77e2013-12-18 22:09:39 +01001688 --audio-drv-list=LIST set audio drivers list:
1689 Available drivers: $audio_possible_drivers
1690 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1691 --block-drv-rw-whitelist=L
1692 set block driver read-write whitelist
1693 (affects only QEMU, not qemu-img)
1694 --block-drv-ro-whitelist=L
1695 set block driver read-only whitelist
1696 (affects only QEMU, not qemu-img)
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +02001697 --enable-trace-backends=B Set trace backend
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01001698 Available backends: $trace_backend_list
Stefan Weil08fb77e2013-12-18 22:09:39 +01001699 --with-trace-file=NAME Full PATH,NAME of file to store traces
1700 Default:trace-<pid>
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001701 --disable-slirp disable SLIRP userspace network connectivity
1702 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
Yang Zhong5a22ab72017-12-20 21:16:46 +08001703 --enable-malloc-trim enable libc malloc_trim() for memory optimization
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001704 --oss-lib path to OSS library
1705 --cpu=CPU Build for host CPU [$cpu]
Stefan Weil08fb77e2013-12-18 22:09:39 +01001706 --with-coroutine=BACKEND coroutine backend. Supported options:
Daniel P. Berrange33c53c52017-04-28 13:24:44 +01001707 ucontext, sigaltstack, windows
Stefan Weil08fb77e2013-12-18 22:09:39 +01001708 --enable-gcov enable test coverage analysis with gcov
1709 --gcov=GCOV use specified gcov [$gcov_tool]
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001710 --disable-blobs disable installing provided firmware blobs
1711 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1712 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +01001713 --tls-priority default TLS protocol/cipher priority string
Lin Mac12d66a2017-03-10 18:14:05 +08001714 --enable-gprof QEMU profiling with gprof
1715 --enable-profiler profiler support
Lin Mac12d66a2017-03-10 18:14:05 +08001716 --enable-debug-stack-usage
1717 track the maximum stack usage of stacks created by qemu_alloc_stack
Alex Bennée40e8c6f2019-06-13 14:52:25 +01001718 --enable-plugins
1719 enable plugins via shared library loading
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001720
1721Optional features, enabled with --enable-FEATURE and
1722disabled with --disable-FEATURE, default is enabled if available:
1723
1724 system all system emulation targets
1725 user supported user emulation targets
1726 linux-user all linux usermode emulation targets
1727 bsd-user all BSD usermode emulation targets
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001728 docs build documentation
1729 guest-agent build the QEMU Guest Agent
1730 guest-agent-msi build guest agent Windows MSI installation package
1731 pie Position Independent Executables
Marc-André Lureau21e709a2019-07-18 16:04:13 +04001732 modules modules support (non-Windows)
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001733 debug-tcg TCG debugging (default is disabled)
1734 debug-info debugging information
1735 sparse sparse checker
1736
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01001737 gnutls GNUTLS cryptography support
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01001738 nettle nettle cryptography support
1739 gcrypt libgcrypt cryptography support
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01001740 auth-pam PAM access control
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001741 sdl SDL UI
Markus Armbruster04c6e162019-05-17 20:32:46 +02001742 sdl-image SDL Image support for icons
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001743 gtk gtk UI
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001744 vte vte support for the gtk UI
1745 curses curses UI
Samuel Thibaulte08bb302019-03-11 14:51:26 +01001746 iconv font glyph conversion support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001747 vnc VNC UI support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001748 vnc-sasl SASL encryption for VNC server
1749 vnc-jpeg JPEG lossy compression for VNC server
1750 vnc-png PNG compression for VNC server
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001751 cocoa Cocoa UI (Mac OS X only)
1752 virtfs VirtFS
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02001753 mpath Multipath persistent reservation passthrough
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001754 xen xen backend driver support
Anthony PERARD70c292a2018-05-04 10:17:56 +01001755 xen-pci-passthrough PCI passthrough support for Xen
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001756 brlapi BrlAPI (Braile)
1757 curl curl connectivity
Paolo Bonzinia40161c2018-02-16 10:05:23 +01001758 membarrier membarrier system call (for Linux 4.14+ or Windows)
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001759 fdt fdt device tree
1760 bluez bluez stack connectivity
1761 kvm KVM acceleration support
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01001762 hax HAX acceleration support
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05001763 hvf Hypervisor.framework acceleration support
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08001764 whpx Windows Hypervisor Platform acceleration support
Marcel Apfelbaum21ab34c2018-08-16 18:16:37 +03001765 rdma Enable RDMA-based migration
1766 pvrdma Enable PVRDMA support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001767 vde support for vde network
1768 netmap support for netmap network
1769 linux-aio Linux AIO support
1770 cap-ng libcap-ng support
1771 attr attr and xattr support
Paolo Bonzini299e6f12019-02-14 18:35:53 +01001772 vhost-net vhost-net kernel acceleration support
1773 vhost-vsock virtio sockets device support
1774 vhost-scsi vhost-scsi kernel target support
1775 vhost-crypto vhost-user-crypto backend support
1776 vhost-kernel vhost kernel backend support
1777 vhost-user vhost-user backend support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001778 spice spice
1779 rbd rados block device (rbd)
1780 libiscsi iscsi support
1781 libnfs nfs support
Marc-André Lureau7b02f542015-08-30 11:48:40 +02001782 smartcard smartcard support (libcacard)
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001783 libusb libusb (for usb passthrough)
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +01001784 live-block-migration Block migration in the main migration stream
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001785 usb-redir usb network redirection support
1786 lzo support of lzo compression library
1787 snappy support of snappy compression library
1788 bzip2 support of bzip2 compression library
1789 (for reading bzip2-compressed dmg images)
Julio Faracco83bc1f92018-11-05 13:08:04 -02001790 lzfse support of lzfse compression library
1791 (for reading lzfse-compressed dmg images)
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001792 seccomp seccomp support
1793 coroutine-pool coroutine freelist (better performance)
1794 glusterfs GlusterFS backend
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001795 tpm TPM support
Pino Toscanob10d49d2019-06-20 22:08:40 +02001796 libssh ssh block device support
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001797 numa libnuma support
Klim Kireeved279a02018-01-12 12:01:19 +03001798 libxml2 for Parallels image format
Michael Tokarevc23f23b2015-06-17 22:19:26 +03001799 tcmalloc tcmalloc support
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02001800 jemalloc jemalloc support
Liam Merwick86583a02018-10-19 21:38:59 +01001801 avx2 AVX2 optimization support
Changlong Xiea6b1d4c2016-07-27 15:01:48 +08001802 replication replication support
Lin Mac12d66a2017-03-10 18:14:05 +08001803 opengl opengl support
1804 virglrenderer virgl rendering support
1805 xfsctl xfsctl support
1806 qom-cast-debug cast debugging support
Cleber Rosa8de73fa2019-02-07 14:36:03 -05001807 tools build qemu-io, qemu-nbd and qemu-img tools
Ashish Mittalda92c3f2017-04-03 20:48:08 -07001808 vxhs Veritas HyperScale vDisk backend support
Jeff Cody2f740132018-11-07 07:36:44 +01001809 bochs bochs image format support
1810 cloop cloop image format support
1811 dmg dmg image format support
1812 qcow1 qcow v1 image format support
1813 vdi vdi image format support
1814 vvfat vvfat image format support
1815 qed qed image format support
1816 parallels parallels image format support
1817 sheepdog sheepdog block driver support
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04001818 crypto-afalg Linux AF_ALG crypto backend driver
Richard Henderson8ca80762017-09-14 09:41:12 -07001819 capstone capstone disassembler support
Paolo Bonziniba59fb72018-06-13 14:23:08 +02001820 debug-mutex mutex debugging support
Junyan He17824402018-07-18 15:47:59 +08001821 libpmem libpmem support
James Le Cuirot75411912019-09-14 15:51:55 +01001822 xkbcommon xkbcommon support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001823
1824NOTE: The object files are built at the place where configure is launched
pbrookaf5db582006-04-08 14:26:41 +00001825EOF
Fam Zheng2d2ad6d2014-04-18 14:55:36 +08001826exit 0
pbrookaf5db582006-04-08 14:26:41 +00001827fi
1828
Thomas Huth9c790242019-03-11 11:20:34 +01001829# Remove old dependency files to make sure that they get properly regenerated
Thomas Huthbb768f72019-05-10 10:11:59 +02001830rm -f */config-devices.mak.d
Thomas Huth9c790242019-03-11 11:20:34 +01001831
Daniel P. Berrangéfaf44142019-03-27 17:07:01 +00001832if test -z "$python"
1833then
1834 error_exit "Python not found. Use --python=/path/to/python"
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01001835fi
1836
1837# Note that if the Python conditional here evaluates True we will exit
1838# with status 1 which is a shell 'false' value.
Eduardo Habkost7f2b5542018-06-08 11:30:26 -03001839if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then
1840 error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 is required." \
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01001841 "Use --python=/path/to/python to specify a supported Python."
1842fi
1843
Cleber Rosa755ee702018-11-09 10:07:07 -05001844# Preserve python version since some functionality is dependent on it
Cleber Rosa406ab2f2019-08-26 11:58:32 -04001845python_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 -05001846
Stefan Hajnoczic53eeaf2017-03-28 14:44:18 +01001847# Suppress writing compiled files
1848python="$python -B"
1849
Daniel Henrique Barboza9aae6e52017-11-02 07:09:06 -02001850# Check that the C compiler works. Doing this here before testing
1851# the host CPU ensures that we had a valid CC to autodetect the
1852# $cpu var (and we should bail right here if that's not the case).
1853# It also allows the help message to be printed without a CC.
1854write_c_skeleton;
1855if compile_object ; then
1856 : C compiler works ok
1857else
1858 error_exit "\"$cc\" either does not exist or does not work"
1859fi
1860if ! compile_prog ; then
1861 error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
1862fi
1863
Peter Maydell359bc952011-12-24 13:07:25 +00001864# Now we have handled --enable-tcg-interpreter and know we're not just
1865# printing the help message, bail out if the host CPU isn't supported.
1866if test "$ARCH" = "unknown"; then
1867 if test "$tcg_interpreter" = "yes" ; then
1868 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
Peter Maydell359bc952011-12-24 13:07:25 +00001869 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001870 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
Peter Maydell359bc952011-12-24 13:07:25 +00001871 fi
1872fi
1873
Peter Maydell9c83ffd2014-02-25 18:27:49 +00001874# Consult white-list to determine whether to enable werror
1875# by default. Only enable by default for git builds
Peter Maydell9c83ffd2014-02-25 18:27:49 +00001876if test -z "$werror" ; then
Alexey Kardashevskiyfd737452019-02-28 15:35:03 +11001877 if test -e "$source_path/.git" && \
Eric Blakee633a5c2019-02-04 20:39:37 -06001878 { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then
Peter Maydell9c83ffd2014-02-25 18:27:49 +00001879 werror="yes"
1880 else
1881 werror="no"
1882 fi
1883fi
1884
Peter Maydellfb59dab2017-03-28 14:01:52 +01001885if test "$bogus_os" = "yes"; then
1886 # Now that we know that we're not printing the help and that
1887 # the compiler works (so the results of the check_defines we used
1888 # to identify the OS are reliable), if we didn't recognize the
1889 # host OS we should stop now.
Peter Maydell951fedf2017-07-13 16:15:32 +01001890 error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
Peter Maydellfb59dab2017-03-28 14:01:52 +01001891fi
1892
Thomas Huthefc6c072018-12-03 10:12:32 +01001893# Check whether the compiler matches our minimum requirements:
1894cat > $TMPC << EOF
1895#if defined(__clang_major__) && defined(__clang_minor__)
1896# ifdef __apple_build_version__
1897# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1)
1898# error You need at least XCode Clang v5.1 to compile QEMU
1899# endif
1900# else
1901# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4)
1902# error You need at least Clang v3.4 to compile QEMU
1903# endif
1904# endif
1905#elif defined(__GNUC__) && defined(__GNUC_MINOR__)
1906# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
1907# error You need at least GCC v4.8 to compile QEMU
1908# endif
1909#else
1910# error You either need GCC or Clang to compiler QEMU
1911#endif
1912int main (void) { return 0; }
1913EOF
1914if ! compile_prog "" "" ; then
1915 error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)"
1916fi
1917
Paolo Bonzini8d050952010-12-23 11:43:52 +01001918gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1919gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
Daniel P. Berrangeac7568b2017-02-06 11:29:53 +00001920gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
Pranith Kumar435405a2016-08-09 15:02:26 -04001921gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
Paolo Bonzinib98fcfd2017-07-11 10:08:55 +02001922gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags"
Thomas Huthe6e90fe2019-04-24 13:05:25 +02001923gcc_flags="-Wno-string-plus-int -Wno-typedef-redefinition $gcc_flags"
Peter Maydell6ca026c2012-07-18 15:10:18 +01001924# Note that we do not add -Werror to gcc_flags here, because that would
1925# enable it for all configure tests. If a configure test failed due
1926# to -Werror this would just silently disable some features,
1927# so it's too error prone.
John Snow93b25862015-03-25 18:57:37 -04001928
1929cc_has_warning_flag() {
1930 write_c_skeleton;
1931
Peter Maydella1d29d62012-10-27 22:19:07 +01001932 # Use the positive sense of the flag when testing for -Wno-wombat
1933 # support (gcc will happily accept the -Wno- form of unknown
1934 # warning options).
John Snow93b25862015-03-25 18:57:37 -04001935 optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
1936 compile_prog "-Werror $optflag" ""
1937}
1938
1939for flag in $gcc_flags; do
1940 if cc_has_warning_flag $flag ; then
1941 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
Paolo Bonzini8d050952010-12-23 11:43:52 +01001942 fi
1943done
1944
Miroslav Rezanina3b463a32014-07-02 10:05:24 +02001945if test "$stack_protector" != "no"; then
Rodrigo Rebellofccd35a2015-11-12 12:04:28 -02001946 cat > $TMPC << EOF
1947int main(int argc, char *argv[])
1948{
1949 char arr[64], *p = arr, *c = argv[0];
1950 while (*c) {
1951 *p++ = *c++;
1952 }
1953 return 0;
1954}
1955EOF
Steven Noonan63678e12014-03-28 17:19:02 +01001956 gcc_flags="-fstack-protector-strong -fstack-protector-all"
Miroslav Rezanina3b463a32014-07-02 10:05:24 +02001957 sp_on=0
Steven Noonan63678e12014-03-28 17:19:02 +01001958 for flag in $gcc_flags; do
Peter Maydell590e5dd2014-04-11 17:13:52 +01001959 # We need to check both a compile and a link, since some compiler
1960 # setups fail only on a .c->.o compile and some only at link time
1961 if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
1962 compile_prog "-Werror $flag" ""; then
Steven Noonan63678e12014-03-28 17:19:02 +01001963 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
Miroslav Rezanina3b463a32014-07-02 10:05:24 +02001964 sp_on=1
Steven Noonan63678e12014-03-28 17:19:02 +01001965 break
1966 fi
1967 done
Miroslav Rezanina3b463a32014-07-02 10:05:24 +02001968 if test "$stack_protector" = yes; then
1969 if test $sp_on = 0; then
1970 error_exit "Stack protector not supported"
1971 fi
1972 fi
Marc-André Lureau37746c52013-02-25 23:31:12 +01001973fi
1974
Paolo Bonzini20bc94a2017-10-20 12:11:32 +02001975# Disable -Wmissing-braces on older compilers that warn even for
1976# the "universal" C zero initializer {0}.
1977cat > $TMPC << EOF
1978struct {
1979 int a[2];
1980} x = {0};
1981EOF
1982if compile_object "-Werror" "" ; then
1983 :
1984else
1985 QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces"
1986fi
1987
Marc-André Lureau21e709a2019-07-18 16:04:13 +04001988# Our module code doesn't support Windows
1989if test "$modules" = "yes" && test "$mingw32" = "yes" ; then
1990 error_exit "Modules are not available for Windows"
1991fi
1992
Thomas Huthd376e9d2018-12-03 11:41:38 +01001993# Static linking is not possible with modules or PIE
Avi Kivity40d64442011-11-15 20:12:17 +02001994if test "$static" = "yes" ; then
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01001995 if test "$modules" = "yes" ; then
1996 error_exit "static and modules are mutually incompatible"
1997 fi
Avi Kivity40d64442011-11-15 20:12:17 +02001998 if test "$pie" = "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001999 error_exit "static and pie are mutually incompatible"
Avi Kivity40d64442011-11-15 20:12:17 +02002000 else
2001 pie="no"
2002 fi
2003fi
2004
Emilio G. Cota768b7852015-04-29 13:09:02 +02002005# Unconditional check for compiler __thread support
2006 cat > $TMPC << EOF
2007static __thread int tls_var;
2008int main(void) { return tls_var; }
2009EOF
2010
2011if ! compile_prog "-Werror" "" ; then
2012 error_exit "Your compiler does not support the __thread specifier for " \
2013 "Thread-Local Storage (TLS). Please upgrade to a version that does."
2014fi
2015
Avi Kivity40d64442011-11-15 20:12:17 +02002016if test "$pie" = ""; then
2017 case "$cpu-$targetos" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07002018 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
Avi Kivity40d64442011-11-15 20:12:17 +02002019 ;;
2020 *)
2021 pie="no"
2022 ;;
2023 esac
2024fi
2025
2026if test "$pie" != "no" ; then
2027 cat > $TMPC << EOF
Avi Kivity21d4a792011-11-23 11:24:25 +02002028
2029#ifdef __linux__
2030# define THREAD __thread
2031#else
2032# define THREAD
2033#endif
2034
2035static THREAD int tls_var;
2036
2037int main(void) { return tls_var; }
2038
Avi Kivity40d64442011-11-15 20:12:17 +02002039EOF
Alex Bennée412aeac2019-08-15 19:41:51 +00002040 # check we support --no-pie first...
2041 if compile_prog "-Werror -fno-pie" "-no-pie"; then
2042 CFLAGS_NOPIE="-fno-pie"
2043 LDFLAGS_NOPIE="-nopie"
2044 fi
2045
Avi Kivity40d64442011-11-15 20:12:17 +02002046 if compile_prog "-fPIE -DPIE" "-pie"; then
2047 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
2048 LDFLAGS="-pie $LDFLAGS"
2049 pie="yes"
2050 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
2051 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
2052 fi
2053 else
2054 if test "$pie" = "yes"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002055 error_exit "PIE not available due to missing toolchain support"
Avi Kivity40d64442011-11-15 20:12:17 +02002056 else
2057 echo "Disabling PIE due to missing toolchain support"
2058 pie="no"
2059 fi
2060 fi
2061fi
2062
Paolo Bonzini09dada42013-04-17 16:26:47 +02002063##########################################
2064# __sync_fetch_and_and requires at least -march=i486. Many toolchains
2065# use i686 as default anyway, but for those that don't, an explicit
2066# specification is necessary
2067
2068if test "$cpu" = "i386"; then
2069 cat > $TMPC << EOF
2070static int sfaa(int *ptr)
2071{
2072 return __sync_fetch_and_and(ptr, 0);
2073}
2074
2075int main(void)
2076{
2077 int val = 42;
Stefan Weil1405b622013-05-11 21:46:58 +02002078 val = __sync_val_compare_and_swap(&val, 0, 1);
Paolo Bonzini09dada42013-04-17 16:26:47 +02002079 sfaa(&val);
2080 return val;
2081}
2082EOF
2083 if ! compile_prog "" "" ; then
2084 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
2085 fi
2086fi
2087
2088#########################################
bellardec530c82006-04-25 22:36:06 +00002089# Solaris specific configure tool chain decisions
Paolo Bonzini09dada42013-04-17 16:26:47 +02002090
bellardec530c82006-04-25 22:36:06 +00002091if test "$solaris" = "yes" ; then
LoĂŻc Minier6792aa12010-01-20 11:35:54 +01002092 if has $install; then
2093 :
2094 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01002095 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
2096 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
2097 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
bellardec530c82006-04-25 22:36:06 +00002098 fi
Stefan Weil89138852016-05-16 15:10:20 +02002099 if test "$(path_of $install)" = "/usr/sbin/install" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002100 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
2101 "try ginstall from the GNU fileutils available from www.blastwave.org" \
2102 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
bellardec530c82006-04-25 22:36:06 +00002103 fi
LoĂŻc Minier6792aa12010-01-20 11:35:54 +01002104 if has ar; then
2105 :
2106 else
bellardec530c82006-04-25 22:36:06 +00002107 if test -f /usr/ccs/bin/ar ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002108 error_exit "No path includes ar" \
2109 "Add /usr/ccs/bin to your path and rerun configure"
bellardec530c82006-04-25 22:36:06 +00002110 fi
Peter Maydell76ad07a2013-04-08 12:11:26 +01002111 error_exit "No path includes ar"
bellardec530c82006-04-25 22:36:06 +00002112 fi
ths5fafdf22007-09-16 21:08:06 +00002113fi
bellardec530c82006-04-25 22:36:06 +00002114
Stefan Weilafb63eb2012-09-26 22:04:38 +02002115if test -z "${target_list+xxx}" ; then
Paolo Bonzinid880a3b2017-07-03 16:58:28 +02002116 for target in $default_target_list; do
2117 supported_target $target 2>/dev/null && \
2118 target_list="$target_list $target"
2119 done
2120 target_list="${target_list# }"
Anthony Liguori121afa92012-09-14 08:17:03 -05002121else
Stefan Weil89138852016-05-16 15:10:20 +02002122 target_list=$(echo "$target_list" | sed -e 's/,/ /g')
Paolo Bonzinid880a3b2017-07-03 16:58:28 +02002123 for target in $target_list; do
2124 # Check that we recognised the target name; this allows a more
2125 # friendly error message than if we let it fall through.
2126 case " $default_target_list " in
2127 *" $target "*)
2128 ;;
2129 *)
2130 error_exit "Unknown target name '$target'"
2131 ;;
2132 esac
2133 supported_target $target || exit 1
2134 done
bellard5327cf42005-01-10 23:18:50 +00002135fi
Peter Maydell25b48332013-05-20 16:16:16 +01002136
Paolo Bonzinif55fe272010-05-26 16:08:17 +02002137# see if system emulation was really requested
2138case " $target_list " in
2139 *"-softmmu "*) softmmu=yes
2140 ;;
2141 *) softmmu=no
2142 ;;
2143esac
bellard5327cf42005-01-10 23:18:50 +00002144
Juan Quintela249247c2009-08-12 18:20:25 +02002145feature_not_found() {
2146 feature=$1
Stewart Smith21684af2014-01-24 12:39:10 +11002147 remedy=$2
Juan Quintela249247c2009-08-12 18:20:25 +02002148
Peter Maydell76ad07a2013-04-08 12:11:26 +01002149 error_exit "User requested feature $feature" \
Stewart Smith21684af2014-01-24 12:39:10 +11002150 "configure was not able to find it." \
2151 "$remedy"
Juan Quintela249247c2009-08-12 18:20:25 +02002152}
2153
bellard7d132992003-03-06 23:23:54 +00002154# ---
2155# big/little endian test
2156cat > $TMPC << EOF
Mike Frysinger61cc9192013-06-30 23:30:18 -04002157short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
2158short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
2159extern int foo(short *, short *);
2160int main(int argc, char *argv[]) {
2161 return foo(big_endian, little_endian);
bellard7d132992003-03-06 23:23:54 +00002162}
2163EOF
2164
Mike Frysinger61cc9192013-06-30 23:30:18 -04002165if compile_object ; then
Alice Frosi12f15c92018-01-30 14:38:28 +01002166 if strings -a $TMPO | grep -q BiGeNdIaN ; then
Mike Frysinger61cc9192013-06-30 23:30:18 -04002167 bigendian="yes"
Alice Frosi12f15c92018-01-30 14:38:28 +01002168 elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
Mike Frysinger61cc9192013-06-30 23:30:18 -04002169 bigendian="no"
2170 else
2171 echo big/little test failed
Peter Maydell21d89f82011-11-30 10:57:48 +01002172 fi
Mike Frysinger61cc9192013-06-30 23:30:18 -04002173else
2174 echo big/little test failed
bellard7d132992003-03-06 23:23:54 +00002175fi
2176
Juan Quintelab0a47e72009-08-12 18:29:49 +02002177##########################################
Peter Maydella30878e2015-08-14 16:10:52 +01002178# cocoa implies not SDL or GTK
2179# (the cocoa UI code currently assumes it is always the active UI
2180# and doesn't interact well with other UI frontend code)
2181if test "$cocoa" = "yes"; then
2182 if test "$sdl" = "yes"; then
2183 error_exit "Cocoa and SDL UIs cannot both be enabled at once"
2184 fi
2185 if test "$gtk" = "yes"; then
2186 error_exit "Cocoa and GTK UIs cannot both be enabled at once"
2187 fi
2188 gtk=no
2189 sdl=no
2190fi
2191
Eric Blake6b39b062016-10-11 10:46:23 -05002192# Some versions of Mac OS X incorrectly define SIZE_MAX
2193cat > $TMPC << EOF
2194#include <stdint.h>
2195#include <stdio.h>
2196int main(int argc, char *argv[]) {
2197 return printf("%zu", SIZE_MAX);
2198}
2199EOF
2200have_broken_size_max=no
2201if ! compile_object -Werror ; then
2202 have_broken_size_max=yes
2203fi
2204
Peter Maydella30878e2015-08-14 16:10:52 +01002205##########################################
Gonglei015a33b2014-07-01 20:58:08 +08002206# L2TPV3 probe
2207
2208cat > $TMPC <<EOF
2209#include <sys/socket.h>
Michael Tokarevbff6cb72014-08-01 23:20:24 +04002210#include <linux/ip.h>
Gonglei015a33b2014-07-01 20:58:08 +08002211int main(void) { return sizeof(struct mmsghdr); }
2212EOF
2213if compile_prog "" "" ; then
2214 l2tpv3=yes
2215else
2216 l2tpv3=no
2217fi
2218
Paolo Bonzini299e6f12019-02-14 18:35:53 +01002219#########################################
2220# vhost interdependencies and host support
2221
2222# vhost backends
2223test "$vhost_user" = "" && vhost_user=yes
2224if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then
2225 error_exit "vhost-user isn't available on win32"
2226fi
2227test "$vhost_kernel" = "" && vhost_kernel=$linux
2228if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then
2229 error_exit "vhost-kernel is only available on Linux"
2230fi
2231
2232# vhost-kernel devices
2233test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel
2234if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then
2235 error_exit "--enable-vhost-scsi requires --enable-vhost-kernel"
2236fi
2237test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel
2238if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then
2239 error_exit "--enable-vhost-vsock requires --enable-vhost-kernel"
2240fi
2241
2242# vhost-user backends
2243test "$vhost_net_user" = "" && vhost_net_user=$vhost_user
2244if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then
2245 error_exit "--enable-vhost-net-user requires --enable-vhost-user"
2246fi
2247test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
2248if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
2249 error_exit "--enable-vhost-crypto requires --enable-vhost-user"
2250fi
Dr. David Alan Gilbert98fc1ad2019-09-30 11:51:34 +01002251test "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user
2252if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then
2253 error_exit "--enable-vhost-user-fs requires --enable-vhost-user"
2254fi
Paolo Bonzini299e6f12019-02-14 18:35:53 +01002255
2256# OR the vhost-kernel and vhost-user values for simplicity
2257if test "$vhost_net" = ""; then
2258 test "$vhost_net_user" = "yes" && vhost_net=yes
2259 test "$vhost_kernel" = "yes" && vhost_net=yes
2260fi
2261
Gonglei015a33b2014-07-01 20:58:08 +08002262##########################################
Daniel P. Berrange4d9310f2015-09-22 15:13:26 +01002263# MinGW / Mingw-w64 localtime_r/gmtime_r check
2264
2265if test "$mingw32" = "yes"; then
2266 # Some versions of MinGW / Mingw-w64 lack localtime_r
2267 # and gmtime_r entirely.
2268 #
2269 # Some versions of Mingw-w64 define a macro for
2270 # localtime_r/gmtime_r.
2271 #
2272 # Some versions of Mingw-w64 will define functions
2273 # for localtime_r/gmtime_r, but only if you have
2274 # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
2275 # though, unistd.h and pthread.h both define
2276 # that for you.
2277 #
2278 # So this #undef localtime_r and #include <unistd.h>
2279 # are not in fact redundant.
2280cat > $TMPC << EOF
2281#include <unistd.h>
2282#include <time.h>
2283#undef localtime_r
2284int main(void) { localtime_r(NULL, NULL); return 0; }
2285EOF
2286 if compile_prog "" "" ; then
2287 localtime_r="yes"
2288 else
2289 localtime_r="no"
2290 fi
2291fi
2292
2293##########################################
Stefan Weil779ab5e2012-12-16 11:29:45 +01002294# pkg-config probe
2295
2296if ! has "$pkg_config_exe"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002297 error_exit "pkg-config binary '$pkg_config_exe' not found"
Stefan Weil779ab5e2012-12-16 11:29:45 +01002298fi
2299
2300##########################################
Juan Quintelab0a47e72009-08-12 18:29:49 +02002301# NPTL probe
2302
Peter Maydell24cb36a2013-07-16 18:45:00 +01002303if test "$linux_user" = "yes"; then
Juan Quintelab0a47e72009-08-12 18:29:49 +02002304 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00002305#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00002306#include <linux/futex.h>
Stefan Weil182eacc2011-12-17 09:27:30 +01002307int main(void) {
pbrookbd0c5662008-05-29 14:34:11 +00002308#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
2309#error bork
2310#endif
Stefan Weil182eacc2011-12-17 09:27:30 +01002311 return 0;
pbrookbd0c5662008-05-29 14:34:11 +00002312}
2313EOF
Peter Maydell24cb36a2013-07-16 18:45:00 +01002314 if ! compile_object ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002315 feature_not_found "nptl" "Install glibc and linux kernel headers."
Juan Quintelab0a47e72009-08-12 18:29:49 +02002316 fi
pbrookbd0c5662008-05-29 14:34:11 +00002317fi
2318
balrogac629222008-10-11 09:56:04 +00002319##########################################
qiaonuohan607dacd2014-02-18 14:11:30 +08002320# lzo check
2321
2322if test "$lzo" != "no" ; then
2323 cat > $TMPC << EOF
2324#include <lzo/lzo1x.h>
2325int main(void) { lzo_version(); return 0; }
2326EOF
2327 if compile_prog "" "-llzo2" ; then
Stefan Weilb25c9df2014-04-29 08:21:16 +02002328 libs_softmmu="$libs_softmmu -llzo2"
2329 lzo="yes"
qiaonuohan607dacd2014-02-18 14:11:30 +08002330 else
Stefan Weilb25c9df2014-04-29 08:21:16 +02002331 if test "$lzo" = "yes"; then
2332 feature_not_found "liblzo2" "Install liblzo2 devel"
2333 fi
2334 lzo="no"
qiaonuohan607dacd2014-02-18 14:11:30 +08002335 fi
qiaonuohan607dacd2014-02-18 14:11:30 +08002336fi
2337
2338##########################################
2339# snappy check
2340
2341if test "$snappy" != "no" ; then
2342 cat > $TMPC << EOF
2343#include <snappy-c.h>
2344int main(void) { snappy_max_compressed_length(4096); return 0; }
2345EOF
2346 if compile_prog "" "-lsnappy" ; then
Stefan Weilb25c9df2014-04-29 08:21:16 +02002347 libs_softmmu="$libs_softmmu -lsnappy"
2348 snappy="yes"
qiaonuohan607dacd2014-02-18 14:11:30 +08002349 else
Stefan Weilb25c9df2014-04-29 08:21:16 +02002350 if test "$snappy" = "yes"; then
2351 feature_not_found "libsnappy" "Install libsnappy devel"
2352 fi
2353 snappy="no"
qiaonuohan607dacd2014-02-18 14:11:30 +08002354 fi
qiaonuohan607dacd2014-02-18 14:11:30 +08002355fi
2356
2357##########################################
Peter Wu6b383c02015-01-06 18:48:14 +01002358# bzip2 check
2359
2360if test "$bzip2" != "no" ; then
2361 cat > $TMPC << EOF
2362#include <bzlib.h>
2363int main(void) { BZ2_bzlibVersion(); return 0; }
2364EOF
2365 if compile_prog "" "-lbz2" ; then
2366 bzip2="yes"
2367 else
2368 if test "$bzip2" = "yes"; then
2369 feature_not_found "libbzip2" "Install libbzip2 devel"
2370 fi
2371 bzip2="no"
2372 fi
2373fi
2374
2375##########################################
Julio Faracco83bc1f92018-11-05 13:08:04 -02002376# lzfse check
2377
2378if test "$lzfse" != "no" ; then
2379 cat > $TMPC << EOF
2380#include <lzfse.h>
2381int main(void) { lzfse_decode_scratch_size(); return 0; }
2382EOF
2383 if compile_prog "" "-llzfse" ; then
2384 lzfse="yes"
2385 else
2386 if test "$lzfse" = "yes"; then
2387 feature_not_found "lzfse" "Install lzfse devel"
2388 fi
2389 lzfse="no"
2390 fi
2391fi
2392
2393##########################################
Eduardo Otubof7945732012-08-14 18:44:05 -03002394# libseccomp check
2395
2396if test "$seccomp" != "no" ; then
Helge Deller25ed0ec2019-04-04 20:39:23 +02002397 libseccomp_minver="2.3.0"
2398 if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
Fam Zhengc3883e12017-09-07 16:53:16 +08002399 seccomp_cflags="$($pkg_config --cflags libseccomp)"
2400 seccomp_libs="$($pkg_config --libs libseccomp)"
Andrew Jones693e5912015-09-30 11:59:18 -04002401 seccomp="yes"
Eduardo Otubof7945732012-08-14 18:44:05 -03002402 else
Andrew Jones693e5912015-09-30 11:59:18 -04002403 if test "$seccomp" = "yes" ; then
Helge Deller25ed0ec2019-04-04 20:39:23 +02002404 feature_not_found "libseccomp" \
2405 "Install libseccomp devel >= $libseccomp_minver"
Andrew Jones693e5912015-09-30 11:59:18 -04002406 fi
2407 seccomp="no"
Eduardo Otubof7945732012-08-14 18:44:05 -03002408 fi
2409fi
2410##########################################
aliguorie37630c2009-04-22 15:19:10 +00002411# xen probe
2412
Juan Quintelafc321b42009-08-12 18:29:55 +02002413if test "$xen" != "no" ; then
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002414 # Check whether Xen library path is specified via --extra-ldflags to avoid
2415 # overriding this setting with pkg-config output. If not, try pkg-config
2416 # to obtain all needed flags.
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00002417
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002418 if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \
2419 $pkg_config --exists xencontrol ; then
2420 xen_ctrl_version="$(printf '%d%02d%02d' \
2421 $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
2422 xen=yes
2423 xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
2424 xen_pc="$xen_pc xenevtchn xendevicemodel"
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002425 if $pkg_config --exists xentoolcore; then
2426 xen_pc="$xen_pc xentoolcore"
2427 fi
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002428 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
2429 libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002430 else
Stefan Weil50ced5b2011-12-17 09:27:39 +01002431
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002432 xen_libs="-lxenstore -lxenctrl -lxenguest"
Anthony PERARDd9506ca2017-05-11 12:35:42 +01002433 xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002434
2435 # First we test whether Xen headers and libraries are available.
2436 # If no, we are done and there is no Xen support.
2437 # If yes, more tests are run to detect the Xen version.
2438
2439 # Xen (any)
2440 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00002441#include <xenctrl.h>
Stefan Weil50ced5b2011-12-17 09:27:39 +01002442int main(void) {
2443 return 0;
2444}
2445EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002446 if ! compile_prog "" "$xen_libs" ; then
2447 # Xen not found
2448 if test "$xen" = "yes" ; then
2449 feature_not_found "xen" "Install xen devel"
2450 fi
2451 xen=no
Stefan Weil50ced5b2011-12-17 09:27:39 +01002452
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002453 # Xen unstable
2454 elif
2455 cat > $TMPC <<EOF &&
Ross Lagerwall2cbf8902017-10-23 10:27:27 +01002456#undef XC_WANT_COMPAT_DEVICEMODEL_API
2457#define __XEN_TOOLS__
2458#include <xendevicemodel.h>
Paul Durrantd3c49eb2018-05-15 17:40:53 +01002459#include <xenforeignmemory.h>
Ross Lagerwall2cbf8902017-10-23 10:27:27 +01002460int main(void) {
2461 xendevicemodel_handle *xd;
Paul Durrantd3c49eb2018-05-15 17:40:53 +01002462 xenforeignmemory_handle *xfmem;
Ross Lagerwall2cbf8902017-10-23 10:27:27 +01002463
2464 xd = xendevicemodel_open(0, 0);
2465 xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0);
2466
Paul Durrantd3c49eb2018-05-15 17:40:53 +01002467 xfmem = xenforeignmemory_open(0, 0);
2468 xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0);
2469
Ross Lagerwall2cbf8902017-10-23 10:27:27 +01002470 return 0;
2471}
2472EOF
2473 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
2474 then
2475 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
2476 xen_ctrl_version=41100
2477 xen=yes
2478 elif
2479 cat > $TMPC <<EOF &&
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002480#undef XC_WANT_COMPAT_MAP_FOREIGN_API
2481#include <xenforeignmemory.h>
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002482#include <xentoolcore.h>
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002483int main(void) {
2484 xenforeignmemory_handle *xfmem;
2485
2486 xfmem = xenforeignmemory_open(0, 0);
2487 xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0);
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002488 xentoolcore_restrict_all(0);
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002489
2490 return 0;
2491}
2492EOF
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002493 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002494 then
Anthony PERARD58ea9a72017-09-25 16:01:48 +01002495 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
Igor Druzhinin5ba3d752017-07-10 23:40:02 +01002496 xen_ctrl_version=41000
2497 xen=yes
2498 elif
2499 cat > $TMPC <<EOF &&
Paul Durrantda8090c2017-03-07 10:55:33 +00002500#undef XC_WANT_COMPAT_DEVICEMODEL_API
2501#define __XEN_TOOLS__
2502#include <xendevicemodel.h>
2503int main(void) {
2504 xendevicemodel_handle *xd;
2505
2506 xd = xendevicemodel_open(0, 0);
2507 xendevicemodel_close(xd);
2508
2509 return 0;
2510}
2511EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002512 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
2513 then
2514 xen_stable_libs="-lxendevicemodel $xen_stable_libs"
2515 xen_ctrl_version=40900
2516 xen=yes
2517 elif
2518 cat > $TMPC <<EOF &&
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002519/*
2520 * If we have stable libs the we don't want the libxc compat
2521 * layers, regardless of what CFLAGS we may have been given.
Paulina Szubarczykb6eb9b42016-09-14 21:10:03 +02002522 *
2523 * Also, check if xengnttab_grant_copy_segment_t is defined and
2524 * grant copy operation is implemented.
2525 */
2526#undef XC_WANT_COMPAT_EVTCHN_API
2527#undef XC_WANT_COMPAT_GNTTAB_API
2528#undef XC_WANT_COMPAT_MAP_FOREIGN_API
2529#include <xenctrl.h>
2530#include <xenstore.h>
2531#include <xenevtchn.h>
2532#include <xengnttab.h>
2533#include <xenforeignmemory.h>
2534#include <stdint.h>
2535#include <xen/hvm/hvm_info_table.h>
2536#if !defined(HVM_MAX_VCPUS)
2537# error HVM_MAX_VCPUS not defined
2538#endif
2539int main(void) {
2540 xc_interface *xc = NULL;
2541 xenforeignmemory_handle *xfmem;
2542 xenevtchn_handle *xe;
2543 xengnttab_handle *xg;
Paulina Szubarczykb6eb9b42016-09-14 21:10:03 +02002544 xengnttab_grant_copy_segment_t* seg = NULL;
2545
2546 xs_daemon_open();
2547
2548 xc = xc_interface_open(0, 0, 0);
2549 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2550 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2551 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2552 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
Paulina Szubarczykb6eb9b42016-09-14 21:10:03 +02002553
2554 xfmem = xenforeignmemory_open(0, 0);
2555 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2556
2557 xe = xenevtchn_open(0, 0);
2558 xenevtchn_fd(xe);
2559
2560 xg = xengnttab_open(0, 0);
2561 xengnttab_grant_copy(xg, 0, seg);
2562
2563 return 0;
2564}
2565EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002566 compile_prog "" "$xen_libs $xen_stable_libs"
2567 then
2568 xen_ctrl_version=40800
2569 xen=yes
2570 elif
2571 cat > $TMPC <<EOF &&
Paulina Szubarczykb6eb9b42016-09-14 21:10:03 +02002572/*
2573 * If we have stable libs the we don't want the libxc compat
2574 * layers, regardless of what CFLAGS we may have been given.
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002575 */
2576#undef XC_WANT_COMPAT_EVTCHN_API
2577#undef XC_WANT_COMPAT_GNTTAB_API
2578#undef XC_WANT_COMPAT_MAP_FOREIGN_API
2579#include <xenctrl.h>
2580#include <xenstore.h>
2581#include <xenevtchn.h>
2582#include <xengnttab.h>
2583#include <xenforeignmemory.h>
2584#include <stdint.h>
2585#include <xen/hvm/hvm_info_table.h>
2586#if !defined(HVM_MAX_VCPUS)
2587# error HVM_MAX_VCPUS not defined
2588#endif
2589int main(void) {
2590 xc_interface *xc = NULL;
2591 xenforeignmemory_handle *xfmem;
2592 xenevtchn_handle *xe;
2593 xengnttab_handle *xg;
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002594
2595 xs_daemon_open();
2596
2597 xc = xc_interface_open(0, 0, 0);
2598 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2599 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2600 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2601 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002602
2603 xfmem = xenforeignmemory_open(0, 0);
2604 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2605
2606 xe = xenevtchn_open(0, 0);
2607 xenevtchn_fd(xe);
2608
2609 xg = xengnttab_open(0, 0);
2610 xengnttab_map_grant_ref(xg, 0, 0, 0);
2611
2612 return 0;
2613}
2614EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002615 compile_prog "" "$xen_libs $xen_stable_libs"
2616 then
2617 xen_ctrl_version=40701
2618 xen=yes
Roger Pau Monnecdadde32015-11-13 17:38:06 +00002619
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002620 # Xen 4.6
2621 elif
2622 cat > $TMPC <<EOF &&
Roger Pau Monnecdadde32015-11-13 17:38:06 +00002623#include <xenctrl.h>
Anthony PERARDe108a3c2012-06-21 11:44:35 +00002624#include <xenstore.h>
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00002625#include <stdint.h>
2626#include <xen/hvm/hvm_info_table.h>
2627#if !defined(HVM_MAX_VCPUS)
2628# error HVM_MAX_VCPUS not defined
2629#endif
2630int main(void) {
2631 xc_interface *xc;
2632 xs_daemon_open();
2633 xc = xc_interface_open(0, 0, 0);
2634 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2635 xc_gnttab_open(NULL, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01002636 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Stefano Stabellini8688e062012-04-17 17:04:18 +00002637 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
Jan Beulichd8b441a2015-07-24 03:38:28 -06002638 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
Konrad Rzeszutek Wilk20a544c2015-06-29 12:51:05 -04002639 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
Jan Beulichd8b441a2015-07-24 03:38:28 -06002640 return 0;
2641}
2642EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002643 compile_prog "" "$xen_libs"
2644 then
2645 xen_ctrl_version=40600
2646 xen=yes
Jan Beulichd8b441a2015-07-24 03:38:28 -06002647
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002648 # Xen 4.5
2649 elif
2650 cat > $TMPC <<EOF &&
Jan Beulichd8b441a2015-07-24 03:38:28 -06002651#include <xenctrl.h>
2652#include <xenstore.h>
2653#include <stdint.h>
2654#include <xen/hvm/hvm_info_table.h>
2655#if !defined(HVM_MAX_VCPUS)
2656# error HVM_MAX_VCPUS not defined
2657#endif
2658int main(void) {
2659 xc_interface *xc;
2660 xs_daemon_open();
2661 xc = xc_interface_open(0, 0, 0);
2662 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2663 xc_gnttab_open(NULL, 0);
2664 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2665 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
Paul Durrant3996e852015-01-20 11:06:19 +00002666 xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
2667 return 0;
2668}
2669EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002670 compile_prog "" "$xen_libs"
2671 then
2672 xen_ctrl_version=40500
2673 xen=yes
Paul Durrant3996e852015-01-20 11:06:19 +00002674
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002675 elif
2676 cat > $TMPC <<EOF &&
Paul Durrant3996e852015-01-20 11:06:19 +00002677#include <xenctrl.h>
2678#include <xenstore.h>
2679#include <stdint.h>
2680#include <xen/hvm/hvm_info_table.h>
2681#if !defined(HVM_MAX_VCPUS)
2682# error HVM_MAX_VCPUS not defined
2683#endif
2684int main(void) {
2685 xc_interface *xc;
2686 xs_daemon_open();
2687 xc = xc_interface_open(0, 0, 0);
2688 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2689 xc_gnttab_open(NULL, 0);
2690 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2691 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
Stefano Stabellini8688e062012-04-17 17:04:18 +00002692 return 0;
2693}
2694EOF
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002695 compile_prog "" "$xen_libs"
2696 then
2697 xen_ctrl_version=40200
2698 xen=yes
Stefano Stabellini8688e062012-04-17 17:04:18 +00002699
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002700 else
2701 if test "$xen" = "yes" ; then
2702 feature_not_found "xen (unsupported version)" \
2703 "Install a supported xen (xen 4.2 or newer)"
2704 fi
2705 xen=no
Juan Quintelafc321b42009-08-12 18:29:55 +02002706 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00002707
Juergen Grossc1cdd9d2017-03-27 09:42:45 +02002708 if test "$xen" = yes; then
2709 if test $xen_ctrl_version -ge 40701 ; then
2710 libs_softmmu="$xen_stable_libs $libs_softmmu"
2711 fi
2712 libs_softmmu="$xen_libs $libs_softmmu"
Ian Campbell5eeb39c2016-01-15 13:23:42 +00002713 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00002714 fi
aliguorie37630c2009-04-22 15:19:10 +00002715fi
2716
Anthony PERARDeb6fda02012-06-21 15:32:59 +00002717if test "$xen_pci_passthrough" != "no"; then
Ian Campbelledfb07e2016-02-10 11:07:01 +00002718 if test "$xen" = "yes" && test "$linux" = "yes"; then
Anthony PERARDeb6fda02012-06-21 15:32:59 +00002719 xen_pci_passthrough=yes
2720 else
2721 if test "$xen_pci_passthrough" = "yes"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002722 error_exit "User requested feature Xen PCI Passthrough" \
2723 " but this feature requires /sys from Linux"
Anthony PERARDeb6fda02012-06-21 15:32:59 +00002724 fi
2725 xen_pci_passthrough=no
2726 fi
2727fi
2728
aliguorie37630c2009-04-22 15:19:10 +00002729##########################################
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08002730# Windows Hypervisor Platform accelerator (WHPX) check
2731if test "$whpx" != "no" ; then
Lucian Petrut327fccb2018-05-15 20:35:21 +03002732 if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08002733 whpx="yes"
2734 else
2735 if test "$whpx" = "yes"; then
Justin Terry (VM) via Qemu-devel53537bb2018-02-26 09:13:29 -08002736 feature_not_found "WinHvPlatform" "WinHvEmulation is not installed"
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08002737 fi
2738 whpx="no"
2739 fi
2740fi
2741
2742##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02002743# Sparse probe
2744if test "$sparse" != "no" ; then
LoĂŻc Minier0dba6192010-01-28 21:26:51 +00002745 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02002746 sparse=yes
2747 else
2748 if test "$sparse" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002749 feature_not_found "sparse" "Install sparse binary"
Juan Quinteladfffc652009-08-12 18:29:57 +02002750 fi
2751 sparse=no
2752 fi
2753fi
2754
2755##########################################
Jeremy Whitef676c672015-01-09 13:08:49 -06002756# X11 probe
Jeremy Whitef676c672015-01-09 13:08:49 -06002757if $pkg_config --exists "x11"; then
Gerd Hoffmann87815952018-03-01 11:05:42 +01002758 have_x11=yes
Stefan Weil89138852016-05-16 15:10:20 +02002759 x11_cflags=$($pkg_config --cflags x11)
2760 x11_libs=$($pkg_config --libs x11)
Jeremy Whitef676c672015-01-09 13:08:49 -06002761fi
2762
2763##########################################
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06002764# GTK probe
2765
2766if test "$gtk" != "no"; then
Daniel P. Berrangé89d85cd2018-08-22 14:15:52 +01002767 gtkpackage="gtk+-3.0"
2768 gtkx11package="gtk+-x11-3.0"
Daniel P. Berrangé58296cb2018-08-22 14:15:53 +01002769 gtkversion="3.14.0"
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002770 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
Stefan Weil89138852016-05-16 15:10:20 +02002771 gtk_cflags=$($pkg_config --cflags $gtkpackage)
2772 gtk_libs=$($pkg_config --libs $gtkpackage)
2773 gtk_version=$($pkg_config --modversion $gtkpackage)
Gerd Hoffmann0a337ed2014-05-28 22:33:06 +02002774 if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
Gerd Hoffmann87815952018-03-01 11:05:42 +01002775 need_x11=yes
Jeremy Whitef676c672015-01-09 13:08:49 -06002776 gtk_cflags="$gtk_cflags $x11_cflags"
2777 gtk_libs="$gtk_libs $x11_libs"
Gerd Hoffmann0a337ed2014-05-28 22:33:06 +02002778 fi
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002779 gtk="yes"
2780 elif test "$gtk" = "yes"; then
Gerd Hoffmann5fe309f2017-06-06 12:53:36 +02002781 feature_not_found "gtk" "Install gtk3-devel"
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002782 else
2783 gtk="no"
2784 fi
2785fi
2786
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01002787
2788##########################################
2789# GNUTLS probe
2790
2791if test "$gnutls" != "no"; then
Richard Hendersona73e82e2019-05-09 18:24:35 -07002792 pass="no"
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01002793 if $pkg_config --exists "gnutls >= 3.1.18"; then
Stefan Weil89138852016-05-16 15:10:20 +02002794 gnutls_cflags=$($pkg_config --cflags gnutls)
2795 gnutls_libs=$($pkg_config --libs gnutls)
Richard Hendersona73e82e2019-05-09 18:24:35 -07002796 # Packaging for the static libraries is not always correct.
2797 # At least ubuntu 18.04 ships only shared libraries.
2798 write_c_skeleton
2799 if compile_prog "" "$gnutls_libs" ; then
Richard Henderson243dc2c2019-05-16 15:29:06 -07002800 LIBS="$gnutls_libs $LIBS"
Richard Hendersona73e82e2019-05-09 18:24:35 -07002801 QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
2802 pass="yes"
2803 fi
2804 fi
2805 if test "$pass" = "no" && test "$gnutls" = "yes"; then
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01002806 feature_not_found "gnutls" "Install gnutls devel >= 3.1.18"
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01002807 else
Richard Hendersona73e82e2019-05-09 18:24:35 -07002808 gnutls="$pass"
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01002809 fi
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01002810fi
2811
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002812
2813# If user didn't give a --disable/enable-gcrypt flag,
2814# then mark as disabled if user requested nettle
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01002815# explicitly
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002816if test -z "$gcrypt"
2817then
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01002818 if test "$nettle" = "yes"
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002819 then
2820 gcrypt="no"
2821 fi
2822fi
2823
2824# If user didn't give a --disable/enable-nettle flag,
2825# then mark as disabled if user requested gcrypt
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01002826# explicitly
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002827if test -z "$nettle"
2828then
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01002829 if test "$gcrypt" = "yes"
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002830 then
2831 nettle="no"
2832 fi
2833fi
2834
Daniel P. Berrangédea7a642018-07-18 11:55:05 +01002835has_libgcrypt() {
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002836 if ! has "libgcrypt-config"
2837 then
2838 return 1
2839 fi
2840
2841 if test -n "$cross_prefix"
2842 then
Stefan Weil89138852016-05-16 15:10:20 +02002843 host=$(libgcrypt-config --host)
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002844 if test "$host-" != $cross_prefix
2845 then
2846 return 1
2847 fi
2848 fi
2849
Daniel P. Berrangédea7a642018-07-18 11:55:05 +01002850 maj=`libgcrypt-config --version | awk -F . '{print $1}'`
2851 min=`libgcrypt-config --version | awk -F . '{print $2}'`
2852
2853 if test $maj != 1 || test $min -lt 5
2854 then
2855 return 1
2856 fi
2857
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002858 return 0
2859}
2860
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01002861
2862if test "$nettle" != "no"; then
Richard Hendersona73e82e2019-05-09 18:24:35 -07002863 pass="no"
Daniel P. Berrangé64dd2f32018-07-18 11:55:05 +01002864 if $pkg_config --exists "nettle >= 2.7.1"; then
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01002865 nettle_cflags=$($pkg_config --cflags nettle)
2866 nettle_libs=$($pkg_config --libs nettle)
2867 nettle_version=$($pkg_config --modversion nettle)
Richard Hendersona73e82e2019-05-09 18:24:35 -07002868 # Link test to make sure the given libraries work (e.g for static).
2869 write_c_skeleton
2870 if compile_prog "" "$nettle_libs" ; then
Richard Henderson243dc2c2019-05-16 15:29:06 -07002871 LIBS="$nettle_libs $LIBS"
Richard Hendersona73e82e2019-05-09 18:24:35 -07002872 QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
2873 if test -z "$gcrypt"; then
2874 gcrypt="no"
2875 fi
2876 pass="yes"
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01002877 fi
Richard Hendersona73e82e2019-05-09 18:24:35 -07002878 fi
2879 if test "$pass" = "no" && test "$nettle" = "yes"; then
2880 feature_not_found "nettle" "Install nettle devel >= 2.7.1"
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01002881 else
Richard Hendersona73e82e2019-05-09 18:24:35 -07002882 nettle="$pass"
Daniel P. Berrangéa0722402018-07-18 11:55:05 +01002883 fi
2884fi
2885
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002886if test "$gcrypt" != "no"; then
Richard Hendersona73e82e2019-05-09 18:24:35 -07002887 pass="no"
Daniel P. Berrangédea7a642018-07-18 11:55:05 +01002888 if has_libgcrypt; then
Stefan Weil89138852016-05-16 15:10:20 +02002889 gcrypt_cflags=$(libgcrypt-config --cflags)
2890 gcrypt_libs=$(libgcrypt-config --libs)
Richard Hendersona73e82e2019-05-09 18:24:35 -07002891 # Debian has removed -lgpg-error from libgcrypt-config
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002892 # as it "spreads unnecessary dependencies" which in
2893 # turn breaks static builds...
2894 if test "$static" = "yes"
2895 then
2896 gcrypt_libs="$gcrypt_libs -lgpg-error"
2897 fi
Longpeng(Mike)1f923c72016-12-13 18:42:55 +08002898
Richard Hendersona73e82e2019-05-09 18:24:35 -07002899 # Link test to make sure the given libraries work (e.g for static).
2900 write_c_skeleton
2901 if compile_prog "" "$gcrypt_libs" ; then
Richard Henderson243dc2c2019-05-16 15:29:06 -07002902 LIBS="$gcrypt_libs $LIBS"
Richard Hendersona73e82e2019-05-09 18:24:35 -07002903 QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
2904 pass="yes"
2905 fi
2906 fi
2907 if test "$pass" = "yes"; then
2908 gcrypt="yes"
Longpeng(Mike)1f923c72016-12-13 18:42:55 +08002909 cat > $TMPC << EOF
2910#include <gcrypt.h>
2911int main(void) {
2912 gcry_mac_hd_t handle;
2913 gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5,
2914 GCRY_MAC_FLAG_SECURE, NULL);
2915 return 0;
2916}
2917EOF
2918 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2919 gcrypt_hmac=yes
2920 fi
Richard Hendersona73e82e2019-05-09 18:24:35 -07002921 elif test "$gcrypt" = "yes"; then
2922 feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0"
Daniel P. Berrange62893b62015-07-01 18:10:33 +01002923 else
Richard Hendersona73e82e2019-05-09 18:24:35 -07002924 gcrypt="no"
Daniel P. Berrange62893b62015-07-01 18:10:33 +01002925 fi
2926fi
2927
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01002928
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01002929if test "$gcrypt" = "yes" && test "$nettle" = "yes"
2930then
2931 error_exit "Only one of gcrypt & nettle can be enabled"
2932fi
2933
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01002934##########################################
2935# libtasn1 - only for the TLS creds/session test suite
2936
2937tasn1=yes
Daniel P. Berrange90246032015-09-21 17:25:34 +01002938tasn1_cflags=""
2939tasn1_libs=""
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01002940if $pkg_config --exists "libtasn1"; then
Stefan Weil89138852016-05-16 15:10:20 +02002941 tasn1_cflags=$($pkg_config --cflags libtasn1)
2942 tasn1_libs=$($pkg_config --libs libtasn1)
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01002943else
2944 tasn1=no
2945fi
2946
Daniel P. Berrangeed754742015-07-01 18:10:34 +01002947
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002948##########################################
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01002949# PAM probe
2950
2951if test "$auth_pam" != "no"; then
2952 cat > $TMPC <<EOF
2953#include <security/pam_appl.h>
2954#include <stdio.h>
2955int main(void) {
2956 const char *service_name = "qemu";
2957 const char *user = "frank";
Dr. David Alan Gilbert9c9642d2019-04-04 10:17:25 +01002958 const struct pam_conv pam_conv = { 0 };
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01002959 pam_handle_t *pamh = NULL;
Dr. David Alan Gilbert9c9642d2019-04-04 10:17:25 +01002960 pam_start(service_name, user, &pam_conv, &pamh);
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01002961 return 0;
2962}
2963EOF
2964 if compile_prog "" "-lpam" ; then
2965 auth_pam=yes
2966 else
2967 if test "$auth_pam" = "yes"; then
2968 feature_not_found "PAM" "Install PAM development package"
2969 else
2970 auth_pam=no
2971 fi
2972 fi
2973fi
2974
2975##########################################
Daniel P. Berrange559607e2015-02-27 16:19:33 +00002976# getifaddrs (for tests/test-io-channel-socket )
2977
2978have_ifaddrs_h=yes
2979if ! check_include "ifaddrs.h" ; then
2980 have_ifaddrs_h=no
2981fi
2982
2983##########################################
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002984# VTE probe
2985
2986if test "$vte" != "no"; then
Daniel P. Berrangé89d85cd2018-08-22 14:15:52 +01002987 vteminversion="0.32.0"
2988 if $pkg_config --exists "vte-2.91"; then
2989 vtepackage="vte-2.91"
Daniel P. Berrange528de902013-02-25 15:20:44 +00002990 else
Daniel P. Berrangé89d85cd2018-08-22 14:15:52 +01002991 vtepackage="vte-2.90"
Daniel P. Berrange528de902013-02-25 15:20:44 +00002992 fi
Cole Robinsonc6feff92016-05-06 14:03:12 -04002993 if $pkg_config --exists "$vtepackage >= $vteminversion"; then
Stefan Weil89138852016-05-16 15:10:20 +02002994 vte_cflags=$($pkg_config --cflags $vtepackage)
2995 vte_libs=$($pkg_config --libs $vtepackage)
2996 vteversion=$($pkg_config --modversion $vtepackage)
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01002997 vte="yes"
2998 elif test "$vte" = "yes"; then
Daniel P. Berrangé89d85cd2018-08-22 14:15:52 +01002999 feature_not_found "vte" "Install libvte-2.90/2.91 devel"
Peter Maydell0d185e62013-07-18 16:42:01 +01003000 else
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01003001 vte="no"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06003002 fi
3003fi
3004
3005##########################################
bellard11d9f692004-04-02 20:55:59 +00003006# SDL probe
3007
Carlo Marcelo Arenas BelĂłnaee8a612019-07-10 15:55:28 -07003008# Look for sdl configuration program (pkg-config or sdl2-config). Try
3009# sdl2-config even without cross prefix, and favour pkg-config over sdl2-config.
Dave Airlie47c03742013-12-10 14:05:51 +10003010
Peter Xuc6093a02018-04-10 13:40:34 +08003011sdl_probe ()
3012{
Daniel P. Berrangé0015ca52018-08-22 14:15:54 +01003013 if $pkg_config sdl2 --exists; then
3014 sdlconfig="$pkg_config sdl2"
Peter Xuc6093a02018-04-10 13:40:34 +08003015 sdlversion=$($sdlconfig --modversion 2>/dev/null)
Carlo Marcelo Arenas BelĂłnaee8a612019-07-10 15:55:28 -07003016 elif has "$sdl2_config"; then
Daniel P. Berrangé0015ca52018-08-22 14:15:54 +01003017 sdlconfig="$sdl2_config"
Peter Xuc6093a02018-04-10 13:40:34 +08003018 sdlversion=$($sdlconfig --version)
3019 else
3020 if test "$sdl" = "yes" ; then
3021 feature_not_found "sdl" "Install SDL2-devel"
3022 fi
3023 sdl=no
3024 # no need to do the rest
3025 return
3026 fi
Carlo Marcelo Arenas BelĂłnaee8a612019-07-10 15:55:28 -07003027 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl2-config; then
Peter Xuc6093a02018-04-10 13:40:34 +08003028 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
3029 fi
3030
Juan Quintelaac119f92009-07-27 16:13:15 +02003031 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00003032#include <SDL.h>
3033#undef main /* We don't want SDL to override our main() */
3034int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
3035EOF
Stefan Weil89138852016-05-16 15:10:20 +02003036 sdl_cflags=$($sdlconfig --cflags 2>/dev/null)
Gerd Hoffmann2ca5c432018-03-07 16:42:57 +01003037 sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug
TeLeMan74f42e12010-02-08 13:56:44 +08003038 if test "$static" = "yes" ; then
Daniel P. Berrangé0015ca52018-08-22 14:15:54 +01003039 if $pkg_config sdl2 --exists; then
3040 sdl_libs=$($pkg_config sdl2 --static --libs 2>/dev/null)
Thomas Huth5f37e6d2017-06-13 20:00:44 +02003041 else
3042 sdl_libs=$($sdlconfig --static-libs 2>/dev/null)
3043 fi
TeLeMan74f42e12010-02-08 13:56:44 +08003044 else
Stefan Weil89138852016-05-16 15:10:20 +02003045 sdl_libs=$($sdlconfig --libs 2>/dev/null)
TeLeMan74f42e12010-02-08 13:56:44 +08003046 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02003047 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Daniel P. Berrangé0015ca52018-08-22 14:15:54 +01003048 sdl=yes
aliguoricd01b4a2008-08-21 19:25:45 +00003049
Paolo Bonzini67c274d2010-01-13 09:52:54 +01003050 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Eric Blakee633a5c2019-02-04 20:39:37 -06003051 if test "$sdl" = "yes" && test "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01003052 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weil89138852016-05-16 15:10:20 +02003053 sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)"
3054 sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)"
Juan Quintelaac119f92009-07-27 16:13:15 +02003055 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02003056 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02003057 :
3058 else
3059 sdl=no
3060 fi
3061 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02003062 else # sdl not found
3063 if test "$sdl" = "yes" ; then
Daniel P. Berrangé0015ca52018-08-22 14:15:54 +01003064 feature_not_found "sdl" "Install SDL2 devel"
Juan Quintelac4198152009-08-12 18:29:53 +02003065 fi
3066 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02003067 fi # sdl compile test
Peter Xuc6093a02018-04-10 13:40:34 +08003068}
3069
Daniel P. Berrangéa442fe22019-01-10 12:00:47 +00003070sdl_image_probe ()
3071{
3072 if test "$sdl_image" != "no" ; then
3073 if $pkg_config SDL2_image --exists; then
3074 if test "$static" = "yes"; then
3075 sdl_image_libs=$($pkg_config SDL2_image --libs --static 2>/dev/null)
3076 else
3077 sdl_image_libs=$($pkg_config SDL2_image --libs 2>/dev/null)
3078 fi
3079 sdl_image_cflags=$($pkg_config SDL2_image --cflags 2>/dev/null)
3080 sdl_image=yes
3081
3082 sdl_cflags="$sdl_cflags $sdl_image_cflags"
3083 sdl_libs="$sdl_libs $sdl_image_libs"
3084 else
3085 if test "$sdl_image" = "yes" ; then
3086 feature_not_found "sdl_image" "Install SDL Image devel"
3087 else
3088 sdl_image=no
3089 fi
3090 fi
3091 fi
3092}
3093
Peter Xuc6093a02018-04-10 13:40:34 +08003094if test "$sdl" != "no" ; then
3095 sdl_probe
Juan Quintelaa68551b2009-07-27 16:13:09 +02003096fi
bellard11d9f692004-04-02 20:55:59 +00003097
aliguori5368a422009-03-03 17:37:21 +00003098if test "$sdl" = "yes" ; then
Daniel P. Berrangéa442fe22019-01-10 12:00:47 +00003099 sdl_image_probe
3100else
3101 if test "$sdl_image" = "yes"; then
3102 echo "warning: SDL Image requested, but SDL is not available, disabling"
3103 fi
3104 sdl_image=no
3105fi
3106
3107if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02003108 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00003109#include <SDL.h>
3110#if defined(SDL_VIDEO_DRIVER_X11)
3111#include <X11/XKBlib.h>
3112#else
3113#error No x11 support
3114#endif
3115int main(void) { return 0; }
3116EOF
Jeremy Whitef676c672015-01-09 13:08:49 -06003117 if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then
Gerd Hoffmann87815952018-03-01 11:05:42 +01003118 need_x11=yes
Jeremy Whitef676c672015-01-09 13:08:49 -06003119 sdl_cflags="$sdl_cflags $x11_cflags"
3120 sdl_libs="$sdl_libs $x11_libs"
Juan Quintelaac119f92009-07-27 16:13:15 +02003121 fi
aliguori5368a422009-03-03 17:37:21 +00003122fi
3123
ths8f28f3f2007-01-05 21:25:54 +00003124##########################################
Michael R. Hines2da776d2013-07-22 10:01:54 -04003125# RDMA needs OpenFabrics libraries
3126if test "$rdma" != "no" ; then
3127 cat > $TMPC <<EOF
3128#include <rdma/rdma_cma.h>
3129int main(void) { return 0; }
3130EOF
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02003131 rdma_libs="-lrdmacm -libverbs -libumad"
Michael R. Hines2da776d2013-07-22 10:01:54 -04003132 if compile_prog "" "$rdma_libs" ; then
3133 rdma="yes"
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02003134 libs_softmmu="$libs_softmmu $rdma_libs"
Michael R. Hines2da776d2013-07-22 10:01:54 -04003135 else
3136 if test "$rdma" = "yes" ; then
3137 error_exit \
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02003138 " OpenFabrics librdmacm/libibverbs/libibumad not present." \
Michael R. Hines2da776d2013-07-22 10:01:54 -04003139 " Your options:" \
Yuval Shaiaef6d4cc2018-02-09 15:23:18 +02003140 " (1) Fast: Install infiniband packages (devel) from your distro." \
Michael R. Hines2da776d2013-07-22 10:01:54 -04003141 " (2) Cleanest: Install libraries from www.openfabrics.org" \
3142 " (3) Also: Install softiwarp if you don't have RDMA hardware"
3143 fi
3144 rdma="no"
3145 fi
3146fi
3147
Marcel Apfelbaum21ab34c2018-08-16 18:16:37 +03003148##########################################
3149# PVRDMA detection
3150
3151cat > $TMPC <<EOF &&
3152#include <sys/mman.h>
3153
3154int
3155main(void)
3156{
3157 char buf = 0;
3158 void *addr = &buf;
3159 addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED);
3160
3161 return 0;
3162}
3163EOF
3164
3165if test "$rdma" = "yes" ; then
3166 case "$pvrdma" in
3167 "")
3168 if compile_prog "" ""; then
3169 pvrdma="yes"
3170 else
3171 pvrdma="no"
3172 fi
3173 ;;
3174 "yes")
3175 if ! compile_prog "" ""; then
3176 error_exit "PVRDMA is not supported since mremap is not implemented"
3177 fi
3178 pvrdma="yes"
3179 ;;
3180 "no")
3181 pvrdma="no"
3182 ;;
3183 esac
3184else
3185 if test "$pvrdma" = "yes" ; then
3186 error_exit "PVRDMA requires rdma suppport"
3187 fi
3188 pvrdma="no"
3189fi
ths8d5d2d42007-08-25 01:37:51 +00003190
3191##########################################
aliguori2f9606b2009-03-06 20:27:28 +00003192# VNC SASL detection
Eric Blakee633a5c2019-02-04 20:39:37 -06003193if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02003194 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00003195#include <sasl/sasl.h>
3196#include <stdio.h>
3197int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
3198EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02003199 # Assuming Cyrus-SASL installed in /usr prefix
3200 vnc_sasl_cflags=""
3201 vnc_sasl_libs="-lsasl2"
3202 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
3203 vnc_sasl=yes
3204 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01003205 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
Juan Quintelaea784e32009-08-12 18:20:29 +02003206 else
3207 if test "$vnc_sasl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003208 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
aliguori2f9606b2009-03-06 20:27:28 +00003209 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02003210 vnc_sasl=no
3211 fi
aliguori2f9606b2009-03-06 20:27:28 +00003212fi
3213
3214##########################################
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003215# VNC JPEG detection
Eric Blakee633a5c2019-02-04 20:39:37 -06003216if test "$vnc" = "yes" && test "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003217cat > $TMPC <<EOF
3218#include <stdio.h>
3219#include <jpeglib.h>
3220int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
3221EOF
3222 vnc_jpeg_cflags=""
3223 vnc_jpeg_libs="-ljpeg"
3224 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
3225 vnc_jpeg=yes
3226 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01003227 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003228 else
3229 if test "$vnc_jpeg" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003230 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02003231 fi
3232 vnc_jpeg=no
3233 fi
3234fi
3235
3236##########################################
Corentin Charyefe556a2010-07-07 20:57:56 +02003237# VNC PNG detection
Eric Blakee633a5c2019-02-04 20:39:37 -06003238if test "$vnc" = "yes" && test "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02003239cat > $TMPC <<EOF
3240//#include <stdio.h>
3241#include <png.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003242#include <stddef.h>
Corentin Charyefe556a2010-07-07 20:57:56 +02003243int main(void) {
3244 png_structp png_ptr;
3245 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
Peter Maydell7edc3fe2012-07-18 15:10:24 +01003246 return png_ptr != 0;
Corentin Charyefe556a2010-07-07 20:57:56 +02003247}
3248EOF
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003249 if $pkg_config libpng --exists; then
Stefan Weil89138852016-05-16 15:10:20 +02003250 vnc_png_cflags=$($pkg_config libpng --cflags)
3251 vnc_png_libs=$($pkg_config libpng --libs)
Brad9af80252011-07-30 01:45:55 -04003252 else
Corentin Charyefe556a2010-07-07 20:57:56 +02003253 vnc_png_cflags=""
3254 vnc_png_libs="-lpng"
Brad9af80252011-07-30 01:45:55 -04003255 fi
Corentin Charyefe556a2010-07-07 20:57:56 +02003256 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
3257 vnc_png=yes
3258 libs_softmmu="$vnc_png_libs $libs_softmmu"
Brad9af80252011-07-30 01:45:55 -04003259 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
Corentin Charyefe556a2010-07-07 20:57:56 +02003260 else
3261 if test "$vnc_png" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003262 feature_not_found "vnc-png" "Install libpng devel"
Corentin Charyefe556a2010-07-07 20:57:56 +02003263 fi
3264 vnc_png=no
3265 fi
3266fi
3267
3268##########################################
Gerd Hoffmann6a021532017-10-05 17:33:28 +02003269# xkbcommon probe
3270if test "$xkbcommon" != "no" ; then
3271 if $pkg_config xkbcommon --exists; then
3272 xkbcommon_cflags=$($pkg_config xkbcommon --cflags)
3273 xkbcommon_libs=$($pkg_config xkbcommon --libs)
3274 xkbcommon=yes
3275 else
3276 if test "$xkbcommon" = "yes" ; then
3277 feature_not_found "xkbcommon" "Install libxkbcommon-devel"
3278 fi
3279 xkbcommon=no
3280 fi
3281fi
3282
aliguori76655d62009-03-06 20:27:37 +00003283
3284##########################################
Eric Blakec1bb86c2016-12-02 13:48:54 -06003285# xfsctl() probe, used for file-posix.c
Christoph Hellwigdce512d2010-12-17 11:41:15 +01003286if test "$xfs" != "no" ; then
3287 cat > $TMPC << EOF
Stefan Weilffc41d12011-12-17 09:27:36 +01003288#include <stddef.h> /* NULL */
Christoph Hellwigdce512d2010-12-17 11:41:15 +01003289#include <xfs/xfs.h>
3290int main(void)
3291{
3292 xfsctl(NULL, 0, 0, NULL);
3293 return 0;
3294}
3295EOF
3296 if compile_prog "" "" ; then
3297 xfs="yes"
3298 else
3299 if test "$xfs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003300 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01003301 fi
3302 xfs=no
3303 fi
3304fi
3305
3306##########################################
ths8a16d272008-07-19 09:56:24 +00003307# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02003308if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02003309 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00003310 cat > $TMPC << EOF
3311#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00003312int main(void)
3313{
3314 struct vde_open_args a = {0, 0, 0};
Peter Maydellfea08e02012-07-18 15:10:25 +01003315 char s[] = "";
3316 vde_open(s, s, &a);
pbrook4a7f0e02008-09-07 16:42:53 +00003317 return 0;
3318}
ths8a16d272008-07-19 09:56:24 +00003319EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003320 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02003321 vde=yes
Juan Quinteladfb278b2009-08-12 18:20:27 +02003322 else
3323 if test "$vde" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003324 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
Juan Quinteladfb278b2009-08-12 18:20:27 +02003325 fi
3326 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02003327 fi
ths8a16d272008-07-19 09:56:24 +00003328fi
3329
3330##########################################
Vincenzo Maffione0a985b32014-02-20 15:40:43 +01003331# netmap support probe
3332# Apart from looking for netmap headers, we make sure that the host API version
3333# supports the netmap backend (>=11). The upper bound (15) is meant to simulate
3334# a minor/major version number. Minor new features will be marked with values up
3335# to 15, and if something happens that requires a change to the backend we will
3336# move above 15, submit the backend fixes and modify this two bounds.
Vincenzo Maffione58952132013-11-06 11:44:06 +01003337if test "$netmap" != "no" ; then
3338 cat > $TMPC << EOF
3339#include <inttypes.h>
3340#include <net/if.h>
3341#include <net/netmap.h>
3342#include <net/netmap_user.h>
Vincenzo Maffione0a985b32014-02-20 15:40:43 +01003343#if (NETMAP_API < 11) || (NETMAP_API > 15)
3344#error
3345#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01003346int main(void) { return 0; }
3347EOF
3348 if compile_prog "" "" ; then
3349 netmap=yes
3350 else
3351 if test "$netmap" = "yes" ; then
3352 feature_not_found "netmap"
3353 fi
3354 netmap=no
3355 fi
3356fi
3357
3358##########################################
Corey Bryant47e98652012-01-26 09:42:26 -05003359# libcap-ng library probe
3360if test "$cap_ng" != "no" ; then
3361 cap_libs="-lcap-ng"
3362 cat > $TMPC << EOF
3363#include <cap-ng.h>
3364int main(void)
3365{
3366 capng_capability_to_name(CAPNG_EFFECTIVE);
3367 return 0;
3368}
3369EOF
3370 if compile_prog "" "$cap_libs" ; then
3371 cap_ng=yes
3372 libs_tools="$cap_libs $libs_tools"
3373 else
3374 if test "$cap_ng" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003375 feature_not_found "cap_ng" "Install libcap-ng devel"
Corey Bryant47e98652012-01-26 09:42:26 -05003376 fi
3377 cap_ng=no
3378 fi
3379fi
3380
3381##########################################
malcc2de5c92008-06-28 19:13:06 +00003382# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00003383
Stefan Weil89138852016-05-16 15:10:20 +02003384audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g')
malcc2de5c92008-06-28 19:13:06 +00003385for drv in $audio_drv_list; do
3386 case $drv in
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003387 alsa | try-alsa)
Gerd Hoffmannc80a8672019-01-24 12:20:50 +01003388 if $pkg_config alsa --exists; then
3389 alsa_libs=$($pkg_config alsa --libs)
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003390 if test "$drv" = "try-alsa"; then
3391 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/')
3392 fi
Gerd Hoffmannc80a8672019-01-24 12:20:50 +01003393 else
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003394 if test "$drv" = "try-alsa"; then
3395 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa//')
3396 else
3397 error_exit "$drv check failed" \
3398 "Make sure to have the $drv libs and headers installed."
3399 fi
Gerd Hoffmannc80a8672019-01-24 12:20:50 +01003400 fi
malcc2de5c92008-06-28 19:13:06 +00003401 ;;
3402
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003403 pa | try-pa)
Gerd Hoffmannc80a8672019-01-24 12:20:50 +01003404 if $pkg_config libpulse --exists; then
3405 pulse_libs=$($pkg_config libpulse --libs)
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003406 if test "$drv" = "try-pa"; then
3407 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/')
3408 fi
Gerd Hoffmannc80a8672019-01-24 12:20:50 +01003409 else
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003410 if test "$drv" = "try-pa"; then
3411 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa//')
3412 else
3413 error_exit "$drv check failed" \
3414 "Make sure to have the $drv libs and headers installed."
3415 fi
Gerd Hoffmannc80a8672019-01-24 12:20:50 +01003416 fi
malcb8e59f12008-07-02 21:03:08 +00003417 ;;
3418
Gerd Hoffmann373967b2017-03-20 10:05:43 +01003419 sdl)
3420 if test "$sdl" = "no"; then
3421 error_exit "sdl not found or disabled, can not use sdl audio driver"
3422 fi
3423 ;;
3424
Gerd Hoffmanne42975a2019-01-24 12:20:51 +01003425 try-sdl)
3426 if test "$sdl" = "no"; then
3427 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl//')
3428 else
3429 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl/sdl/')
3430 fi
3431 ;;
3432
Juan Quintela997e6902009-08-03 14:46:29 +02003433 coreaudio)
Fam Zhengb1149912017-09-07 16:29:13 +08003434 coreaudio_libs="-framework CoreAudio"
Juan Quintela997e6902009-08-03 14:46:29 +02003435 ;;
3436
Juan Quintelaa4bf6782009-08-03 14:46:30 +02003437 dsound)
Fam Zhengb1149912017-09-07 16:29:13 +08003438 dsound_libs="-lole32 -ldxguid"
malcd5631632009-10-10 01:13:41 +04003439 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02003440 ;;
3441
3442 oss)
Fam Zhengb1149912017-09-07 16:29:13 +08003443 oss_libs="$oss_lib"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02003444 ;;
3445
malce4c63a62008-07-19 16:15:16 +00003446 *)
malc1c9b2a52008-07-19 16:57:30 +00003447 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
Peter Maydell76ad07a2013-04-08 12:11:26 +01003448 error_exit "Unknown driver '$drv' selected" \
3449 "Possible drivers are: $audio_possible_drivers"
malce4c63a62008-07-19 16:15:16 +00003450 }
3451 ;;
malcc2de5c92008-06-28 19:13:06 +00003452 esac
3453done
ths8f28f3f2007-01-05 21:25:54 +00003454
balrog4d3b6f62008-02-10 16:33:14 +00003455##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00003456# BrlAPI probe
3457
Juan Quintela4ffcedb2009-08-12 18:20:26 +02003458if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02003459 brlapi_libs="-lbrlapi"
3460 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00003461#include <brlapi.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003462#include <stddef.h>
aurel322e4d9fb2008-04-08 06:01:02 +00003463int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
3464EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003465 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02003466 brlapi=yes
Juan Quintela4ffcedb2009-08-12 18:20:26 +02003467 else
3468 if test "$brlapi" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003469 feature_not_found "brlapi" "Install brlapi devel"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02003470 fi
3471 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02003472 fi
3473fi
aurel322e4d9fb2008-04-08 06:01:02 +00003474
3475##########################################
Samuel Thibaulte08bb302019-03-11 14:51:26 +01003476# iconv probe
3477if test "$iconv" != "no" ; then
3478 cat > $TMPC << EOF
3479#include <iconv.h>
3480int main(void) {
3481 iconv_t conv = iconv_open("WCHAR_T", "UCS-2");
3482 return conv != (iconv_t) -1;
3483}
3484EOF
3485 iconv_prefix_list="/usr/local:/usr"
3486 iconv_lib_list=":-liconv"
3487 IFS=:
3488 for iconv_prefix in $iconv_prefix_list; do
3489 IFS=:
3490 iconv_cflags="-I$iconv_prefix/include"
3491 iconv_ldflags="-L$iconv_prefix/lib"
3492 for iconv_link in $iconv_lib_list; do
3493 unset IFS
3494 iconv_lib="$iconv_ldflags $iconv_link"
3495 echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log
3496 if compile_prog "$iconv_cflags" "$iconv_lib" ; then
3497 iconv_found=yes
3498 break
3499 fi
3500 done
3501 if test "$iconv_found" = yes ; then
3502 break
3503 fi
3504 done
3505 if test "$iconv_found" = "yes" ; then
3506 iconv=yes
3507 else
3508 if test "$iconv" = "yes" ; then
3509 feature_not_found "iconv" "Install iconv devel"
3510 fi
3511 iconv=no
3512 fi
3513fi
3514
3515##########################################
balrog4d3b6f62008-02-10 16:33:14 +00003516# curses probe
Samuel Thibaulte08bb302019-03-11 14:51:26 +01003517if test "$iconv" = "no" ; then
3518 # curses will need iconv
3519 curses=no
3520fi
Juan Quintelac584a6d2009-08-12 18:20:30 +02003521if test "$curses" != "no" ; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04003522 if test "$mingw32" = "yes" ; then
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003523 curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
3524 curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
Michael Tokareva3605bf2013-05-25 13:17:21 +04003525 else
Samuel Thibault7c703002016-11-09 11:27:52 +01003526 curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003527 curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
Michael Tokareva3605bf2013-05-25 13:17:21 +04003528 fi
Juan Quintelac584a6d2009-08-12 18:20:30 +02003529 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00003530 cat > $TMPC << EOF
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003531#include <locale.h>
balrog4d3b6f62008-02-10 16:33:14 +00003532#include <curses.h>
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003533#include <wchar.h>
Samuel Thibault2f8b7cd2019-03-11 14:51:27 +01003534#include <langinfo.h>
Stefan Weilef9a2522011-12-17 17:46:02 +01003535int main(void) {
Samuel Thibault2f8b7cd2019-03-11 14:51:27 +01003536 const char *codeset;
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003537 wchar_t wch = L'w';
3538 setlocale(LC_ALL, "");
Stefan Weilef9a2522011-12-17 17:46:02 +01003539 resize_term(0, 0);
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003540 addwstr(L"wide chars\n");
3541 addnwstr(&wch, 1);
Samuel Thibault7c703002016-11-09 11:27:52 +01003542 add_wch(WACS_DEGREE);
Samuel Thibault2f8b7cd2019-03-11 14:51:27 +01003543 codeset = nl_langinfo(CODESET);
3544 return codeset != 0;
Stefan Weilef9a2522011-12-17 17:46:02 +01003545}
balrog4d3b6f62008-02-10 16:33:14 +00003546EOF
Vadim Evardecbe2512013-01-15 16:17:24 +04003547 IFS=:
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003548 for curses_inc in $curses_inc_list; do
Peter Maydellb01a4fd2017-06-02 15:35:38 +01003549 # Make sure we get the wide character prototypes
3550 curses_inc="-DNCURSES_WIDECHAR $curses_inc"
Samuel Thibault7c703002016-11-09 11:27:52 +01003551 IFS=:
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003552 for curses_lib in $curses_lib_list; do
3553 unset IFS
3554 if compile_prog "$curses_inc" "$curses_lib" ; then
3555 curses_found=yes
Samuel Thibault8ddc5bf2016-10-15 21:53:05 +02003556 break
3557 fi
3558 done
Samuel Thibault7c703002016-11-09 11:27:52 +01003559 if test "$curses_found" = yes ; then
3560 break
3561 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02003562 done
Vadim Evardecbe2512013-01-15 16:17:24 +04003563 unset IFS
Juan Quintelac584a6d2009-08-12 18:20:30 +02003564 if test "$curses_found" = "yes" ; then
3565 curses=yes
3566 else
3567 if test "$curses" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003568 feature_not_found "curses" "Install ncurses devel"
Juan Quintelac584a6d2009-08-12 18:20:30 +02003569 fi
3570 curses=no
3571 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02003572fi
balrog4d3b6f62008-02-10 16:33:14 +00003573
blueswir1414f0da2008-08-15 18:20:52 +00003574##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02003575# curl probe
Juan Quintela788c8192009-08-12 18:29:47 +02003576if test "$curl" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003577 if $pkg_config libcurl --exists; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04003578 curlconfig="$pkg_config libcurl"
3579 else
3580 curlconfig=curl-config
3581 fi
Alexander Graf769ce762009-05-11 17:41:42 +02003582 cat > $TMPC << EOF
3583#include <curl/curl.h>
Peter Maydell0b862ce2011-06-09 22:54:29 +01003584int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
Alexander Graf769ce762009-05-11 17:41:42 +02003585EOF
Stefan Weil89138852016-05-16 15:10:20 +02003586 curl_cflags=$($curlconfig --cflags 2>/dev/null)
3587 curl_libs=$($curlconfig --libs 2>/dev/null)
Juan Quintelab1d5a272009-08-03 14:46:05 +02003588 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02003589 curl=yes
Juan Quintela788c8192009-08-12 18:29:47 +02003590 else
3591 if test "$curl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003592 feature_not_found "curl" "Install libcurl devel"
Juan Quintela788c8192009-08-12 18:29:47 +02003593 fi
3594 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02003595 fi
3596fi # test "$curl"
3597
3598##########################################
balrogfb599c92008-09-28 23:49:55 +00003599# bluez support probe
Juan Quintelaa20a6f42009-08-12 18:29:50 +02003600if test "$bluez" != "no" ; then
balroge820e3f2008-09-30 02:27:44 +00003601 cat > $TMPC << EOF
3602#include <bluetooth/bluetooth.h>
3603int main(void) { return bt_error(0); }
3604EOF
Stefan Weil89138852016-05-16 15:10:20 +02003605 bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null)
3606 bluez_libs=$($pkg_config --libs bluez 2>/dev/null)
Juan Quintela52166aa2009-08-03 14:46:03 +02003607 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
Juan Quintelaa20a6f42009-08-12 18:29:50 +02003608 bluez=yes
Juan Quintelae482d562009-08-03 14:46:37 +02003609 libs_softmmu="$bluez_libs $libs_softmmu"
balroge820e3f2008-09-30 02:27:44 +00003610 else
Juan Quintelaa20a6f42009-08-12 18:29:50 +02003611 if test "$bluez" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003612 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02003613 fi
balroge820e3f2008-09-30 02:27:44 +00003614 bluez="no"
3615 fi
balrogfb599c92008-09-28 23:49:55 +00003616fi
3617
3618##########################################
Anthony Liguorie18df142011-07-19 14:50:29 -05003619# glib support probe
Paolo Bonzinia52d28a2012-04-05 13:01:54 +02003620
Daniel P. Berrangé00f2cfb2018-05-04 15:34:46 +01003621glib_req_ver=2.48
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01003622glib_modules=gthread-2.0
3623if test "$modules" = yes; then
Gerd Hoffmanna88afc62018-03-08 09:53:00 +01003624 glib_modules="$glib_modules gmodule-export-2.0"
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01003625fi
Emilio G. Cota54cb65d2017-08-30 18:39:53 -04003626if test "$plugins" = yes; then
3627 glib_modules="$glib_modules gmodule-2.0"
3628fi
Fam Zhenge26110c2014-02-10 14:48:57 +08003629
Sameeh Jubran4eaf7202017-03-26 12:56:22 +03003630# This workaround is required due to a bug in pkg-config file for glib as it
3631# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
3632
Eric Blakee633a5c2019-02-04 20:39:37 -06003633if test "$static" = yes && test "$mingw32" = yes; then
Sameeh Jubran4eaf7202017-03-26 12:56:22 +03003634 QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS"
3635fi
3636
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01003637for i in $glib_modules; do
Fam Zhenge26110c2014-02-10 14:48:57 +08003638 if $pkg_config --atleast-version=$glib_req_ver $i; then
Stefan Weil89138852016-05-16 15:10:20 +02003639 glib_cflags=$($pkg_config --cflags $i)
3640 glib_libs=$($pkg_config --libs $i)
Marc-André Lureau4a058892016-09-26 00:57:48 +04003641 QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
Fam Zhenge26110c2014-02-10 14:48:57 +08003642 LIBS="$glib_libs $LIBS"
3643 libs_qga="$glib_libs $libs_qga"
3644 else
3645 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
3646 fi
3647done
3648
Marc-André Lureauf876b762019-02-21 12:07:00 +01003649if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
3650 gio=yes
3651 gio_cflags=$($pkg_config --cflags gio-2.0)
3652 gio_libs=$($pkg_config --libs gio-2.0)
3653else
3654 gio=no
3655fi
3656
Daniel P. Berrange977a82a2016-01-27 09:00:45 +00003657# Sanity check that the current size_t matches the
3658# size that glib thinks it should be. This catches
3659# problems on multi-arch where people try to build
3660# 32-bit QEMU while pointing at 64-bit glib headers
3661cat > $TMPC <<EOF
3662#include <glib.h>
3663#include <unistd.h>
3664
3665#define QEMU_BUILD_BUG_ON(x) \
3666 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
3667
3668int main(void) {
3669 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
3670 return 0;
3671}
3672EOF
3673
Stefan Weil5919e032016-04-28 23:33:41 +02003674if ! compile_prog "$CFLAGS" "$LIBS" ; then
Daniel P. Berrange977a82a2016-01-27 09:00:45 +00003675 error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
3676 "You probably need to set PKG_CONFIG_LIBDIR"\
3677 "to point to the right pkg-config files for your"\
3678 "build target"
3679fi
3680
John Snowbbbf2e02015-03-25 18:57:38 -04003681# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage
3682cat > $TMPC << EOF
3683#include <glib.h>
3684int main(void) { return 0; }
3685EOF
3686if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
3687 if cc_has_warning_flag "-Wno-unknown-attributes"; then
3688 glib_cflags="-Wno-unknown-attributes $glib_cflags"
3689 CFLAGS="-Wno-unknown-attributes $CFLAGS"
3690 fi
3691fi
3692
Stefan Weil6a1f42b2018-07-12 21:26:03 +02003693#########################################
3694# zlib check
3695
3696if test "$zlib" != "no" ; then
3697 if $pkg_config --exists zlib; then
3698 zlib_cflags=$($pkg_config --cflags zlib)
3699 zlib_libs=$($pkg_config --libs zlib)
3700 QEMU_CFLAGS="$zlib_cflags $QEMU_CFLAGS"
3701 LIBS="$zlib_libs $LIBS"
3702 else
3703 cat > $TMPC << EOF
3704#include <zlib.h>
3705int main(void) { zlibVersion(); return 0; }
3706EOF
3707 if compile_prog "" "-lz" ; then
3708 LIBS="$LIBS -lz"
3709 else
3710 error_exit "zlib check failed" \
3711 "Make sure to have the zlib libs and headers installed."
3712 fi
3713 fi
3714fi
3715
Fam Zhenge26110c2014-02-10 14:48:57 +08003716##########################################
3717# SHA command probe for modules
3718if test "$modules" = yes; then
3719 shacmd_probe="sha1sum sha1 shasum"
3720 for c in $shacmd_probe; do
Fam Zheng8ccefb92014-12-04 14:18:16 +08003721 if has $c; then
Fam Zhenge26110c2014-02-10 14:48:57 +08003722 shacmd="$c"
3723 break
3724 fi
3725 done
3726 if test "$shacmd" = ""; then
3727 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
3728 fi
Anthony Liguorie18df142011-07-19 14:50:29 -05003729fi
3730
3731##########################################
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02003732# pixman support probe
3733
Eric Blakee633a5c2019-02-04 20:39:37 -06003734if test "$want_tools" = "no" && test "$softmmu" = "no"; then
Robert Schiele74880fe2012-12-04 16:58:08 +01003735 pixman_cflags=
3736 pixman_libs=
Gerd Hoffmann35c4e862017-09-05 16:01:16 +02003737elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
Stefan Weil89138852016-05-16 15:10:20 +02003738 pixman_cflags=$($pkg_config --cflags pixman-1)
3739 pixman_libs=$($pkg_config --libs pixman-1)
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02003740else
Gerd Hoffmannc12b6d72017-09-05 16:01:15 +02003741 error_exit "pixman >= 0.21.8 not present." \
3742 "Please install the pixman devel package."
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02003743fi
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02003744
3745##########################################
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02003746# libmpathpersist probe
3747
3748if test "$mpath" != "no" ; then
Murilo Opsfelder Araujo1b0578f2018-08-10 11:11:16 -03003749 # probe for the new API
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02003750 cat > $TMPC <<EOF
3751#include <libudev.h>
3752#include <mpath_persist.h>
3753unsigned mpath_mx_alloc_len = 1024;
3754int logsink;
Paolo Bonzinib3f1c8c2017-10-17 20:11:58 +02003755static struct config *multipath_conf;
3756extern struct udev *udev;
3757extern struct config *get_multipath_config(void);
3758extern void put_multipath_config(struct config *conf);
3759struct udev *udev;
3760struct config *get_multipath_config(void) { return multipath_conf; }
3761void put_multipath_config(struct config *conf) { }
3762
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02003763int main(void) {
Paolo Bonzinib3f1c8c2017-10-17 20:11:58 +02003764 udev = udev_new();
3765 multipath_conf = mpath_lib_init();
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02003766 return 0;
3767}
3768EOF
3769 if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then
3770 mpathpersist=yes
Murilo Opsfelder Araujo1b0578f2018-08-10 11:11:16 -03003771 mpathpersist_new_api=yes
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02003772 else
Murilo Opsfelder Araujo1b0578f2018-08-10 11:11:16 -03003773 # probe for the old API
3774 cat > $TMPC <<EOF
3775#include <libudev.h>
3776#include <mpath_persist.h>
3777unsigned mpath_mx_alloc_len = 1024;
3778int logsink;
3779int main(void) {
3780 struct udev *udev = udev_new();
3781 mpath_lib_init(udev);
3782 return 0;
3783}
3784EOF
3785 if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then
3786 mpathpersist=yes
3787 mpathpersist_new_api=no
3788 else
3789 mpathpersist=no
3790 fi
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02003791 fi
3792else
3793 mpathpersist=no
3794fi
3795
3796##########################################
M. Mohan Kumar17bff522011-12-14 13:58:42 +05303797# libcap probe
3798
3799if test "$cap" != "no" ; then
3800 cat > $TMPC <<EOF
3801#include <stdio.h>
3802#include <sys/capability.h>
Stefan Weilcc939742012-07-18 15:10:20 +01003803int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
M. Mohan Kumar17bff522011-12-14 13:58:42 +05303804EOF
3805 if compile_prog "" "-lcap" ; then
3806 cap=yes
3807 else
3808 cap=no
3809 fi
3810fi
3811
3812##########################################
aliguorie5d355d2009-04-24 18:03:15 +00003813# pthread probe
Brad4b29ec42011-08-07 20:02:11 -04003814PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00003815
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02003816pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00003817cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00003818#include <pthread.h>
Stefan Weil7a42bbe2011-12-17 09:27:32 +01003819static void *f(void *p) { return NULL; }
3820int main(void) {
3821 pthread_t thread;
3822 pthread_create(&thread, 0, f, 0);
3823 return 0;
3824}
blueswir1414f0da2008-08-15 18:20:52 +00003825EOF
Andreas Färberbd00d532010-09-20 00:50:44 +02003826if compile_prog "" "" ; then
3827 pthread=yes
3828else
3829 for pthread_lib in $PTHREADLIBS_LIST; do
3830 if compile_prog "" "$pthread_lib" ; then
3831 pthread=yes
Peter Portantee3c56762012-04-20 10:36:12 -04003832 found=no
3833 for lib_entry in $LIBS; do
3834 if test "$lib_entry" = "$pthread_lib"; then
3835 found=yes
3836 break
3837 fi
3838 done
3839 if test "$found" = "no"; then
3840 LIBS="$pthread_lib $LIBS"
Marc-André Lureau14ab3aa2018-01-04 17:05:06 +01003841 libs_qga="$pthread_lib $libs_qga"
Peter Portantee3c56762012-04-20 10:36:12 -04003842 fi
Daniel P. Berrange409437e2016-07-20 14:23:13 +01003843 PTHREAD_LIB="$pthread_lib"
Andreas Färberbd00d532010-09-20 00:50:44 +02003844 break
3845 fi
3846 done
3847fi
blueswir1414f0da2008-08-15 18:20:52 +00003848
Eric Blakee633a5c2019-02-04 20:39:37 -06003849if test "$mingw32" != yes && test "$pthread" = no; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003850 error_exit "pthread check failed" \
3851 "Make sure to have the pthread libs and headers installed."
aliguorie5d355d2009-04-24 18:03:15 +00003852fi
3853
Roman Bolshakov479a5742018-12-17 23:26:01 +03003854# check for pthread_setname_np with thread id
3855pthread_setname_np_w_tid=no
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00003856cat > $TMPC << EOF
3857#include <pthread.h>
3858
3859static void *f(void *p) { return NULL; }
3860int main(void)
3861{
3862 pthread_t thread;
3863 pthread_create(&thread, 0, f, 0);
3864 pthread_setname_np(thread, "QEMU");
3865 return 0;
3866}
3867EOF
3868if compile_prog "" "$pthread_lib" ; then
Roman Bolshakov479a5742018-12-17 23:26:01 +03003869 pthread_setname_np_w_tid=yes
3870fi
3871
3872# check for pthread_setname_np without thread id
3873pthread_setname_np_wo_tid=no
3874cat > $TMPC << EOF
3875#include <pthread.h>
3876
3877static void *f(void *p) { pthread_setname_np("QEMU"); }
3878int main(void)
3879{
3880 pthread_t thread;
3881 pthread_create(&thread, 0, f, 0);
3882 return 0;
3883}
3884EOF
3885if compile_prog "" "$pthread_lib" ; then
3886 pthread_setname_np_wo_tid=yes
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00003887fi
3888
aliguoribf9298b2008-12-05 20:05:26 +00003889##########################################
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003890# rbd probe
3891if test "$rbd" != "no" ; then
3892 cat > $TMPC <<EOF
3893#include <stdio.h>
Josh Durginad32e9c2011-05-26 16:07:31 -07003894#include <rbd/librbd.h>
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003895int main(void) {
Josh Durginad32e9c2011-05-26 16:07:31 -07003896 rados_t cluster;
3897 rados_create(&cluster, NULL);
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003898 return 0;
3899}
3900EOF
Josh Durginad32e9c2011-05-26 16:07:31 -07003901 rbd_libs="-lrbd -lrados"
3902 if compile_prog "" "$rbd_libs" ; then
3903 rbd=yes
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003904 else
3905 if test "$rbd" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003906 feature_not_found "rados block device" "Install librbd/ceph devel"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003907 fi
3908 rbd=no
3909 fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01003910fi
3911
3912##########################################
Pino Toscanob10d49d2019-06-20 22:08:40 +02003913# libssh probe
3914if test "$libssh" != "no" ; then
3915 if $pkg_config --exists libssh; then
3916 libssh_cflags=$($pkg_config libssh --cflags)
3917 libssh_libs=$($pkg_config libssh --libs)
3918 libssh=yes
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01003919 else
Pino Toscanob10d49d2019-06-20 22:08:40 +02003920 if test "$libssh" = "yes" ; then
3921 error_exit "libssh required for --enable-libssh"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01003922 fi
Pino Toscanob10d49d2019-06-20 22:08:40 +02003923 libssh=no
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01003924 fi
3925fi
3926
3927##########################################
Pino Toscanob10d49d2019-06-20 22:08:40 +02003928# Check for libssh 0.8
3929# This is done like this instead of using the LIBSSH_VERSION_* and
3930# SSH_VERSION_* macros because some distributions in the past shipped
3931# snapshots of the future 0.8 from Git, and those snapshots did not
3932# have updated version numbers (still referring to 0.7.0).
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01003933
Pino Toscanob10d49d2019-06-20 22:08:40 +02003934if test "$libssh" = "yes"; then
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01003935 cat > $TMPC <<EOF
Pino Toscanob10d49d2019-06-20 22:08:40 +02003936#include <libssh/libssh.h>
3937int main(void) { return ssh_get_server_publickey(NULL, NULL); }
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01003938EOF
Pino Toscanob10d49d2019-06-20 22:08:40 +02003939 if compile_prog "$libssh_cflags" "$libssh_libs"; then
3940 libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags"
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01003941 fi
3942fi
3943
3944##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003945# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003946
3947if test "$linux_aio" != "no" ; then
3948 cat > $TMPC <<EOF
3949#include <libaio.h>
3950#include <sys/eventfd.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003951#include <stddef.h>
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003952int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
3953EOF
3954 if compile_prog "" "-laio" ; then
3955 linux_aio=yes
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003956 else
3957 if test "$linux_aio" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003958 feature_not_found "linux AIO" "Install libaio devel"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003959 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03003960 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02003961 fi
3962fi
3963
3964##########################################
Paolo Bonzini7aaa6a12019-01-23 14:56:07 +08003965# TPM emulation is only on POSIX
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01003966
Paolo Bonzini7aaa6a12019-01-23 14:56:07 +08003967if test "$tpm" = ""; then
3968 if test "$mingw32" = "yes"; then
3969 tpm=no
3970 else
3971 tpm=yes
3972 fi
3973elif test "$tpm" = "yes"; then
3974 if test "$mingw32" = "yes" ; then
3975 error_exit "TPM emulation only available on POSIX systems"
3976 fi
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01003977fi
3978
3979##########################################
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003980# attr probe
3981
3982if test "$attr" != "no" ; then
3983 cat > $TMPC <<EOF
3984#include <stdio.h>
3985#include <sys/types.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04003986#ifdef CONFIG_LIBATTR
3987#include <attr/xattr.h>
3988#else
Avi Kivity4f26f2b2011-11-09 14:44:52 +02003989#include <sys/xattr.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04003990#endif
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003991int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
3992EOF
Avi Kivity4f26f2b2011-11-09 14:44:52 +02003993 if compile_prog "" "" ; then
3994 attr=yes
3995 # Older distros have <attr/xattr.h>, and need -lattr:
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04003996 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07003997 attr=yes
3998 LIBS="-lattr $LIBS"
Avi Kivity4f26f2b2011-11-09 14:44:52 +02003999 libattr=yes
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004000 else
4001 if test "$attr" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11004002 feature_not_found "ATTR" "Install libc6 or libattr devel"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004003 fi
4004 attr=no
4005 fi
4006fi
4007
4008##########################################
aliguoribf9298b2008-12-05 20:05:26 +00004009# iovec probe
4010cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00004011#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00004012#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00004013#include <unistd.h>
Stefan Weilf91f9be2011-12-17 09:27:33 +01004014int main(void) { return sizeof(struct iovec); }
aliguoribf9298b2008-12-05 20:05:26 +00004015EOF
4016iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02004017if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00004018 iovec=yes
4019fi
4020
aurel32f652e6a2008-12-16 10:43:48 +00004021##########################################
aliguoriceb42de2009-04-07 18:43:28 +00004022# preadv probe
4023cat > $TMPC <<EOF
4024#include <sys/types.h>
4025#include <sys/uio.h>
4026#include <unistd.h>
Blue Swirlc075a722012-08-09 20:21:25 +00004027int main(void) { return preadv(0, 0, 0, 0); }
aliguoriceb42de2009-04-07 18:43:28 +00004028EOF
4029preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02004030if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00004031 preadv=yes
4032fi
4033
4034##########################################
aurel32f652e6a2008-12-16 10:43:48 +00004035# fdt probe
Peter Maydelle169e1e2013-05-24 16:26:54 +01004036# fdt support is mandatory for at least some target architectures,
4037# so insist on it if we're building those system emulators.
4038fdt_required=no
4039for target in $target_list; do
4040 case $target in
KONRAD Frederica6664092018-05-03 17:17:16 +02004041 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu)
Peter Maydelle169e1e2013-05-24 16:26:54 +01004042 fdt_required=yes
4043 ;;
4044 esac
4045done
4046
4047if test "$fdt_required" = "yes"; then
4048 if test "$fdt" = "no"; then
4049 error_exit "fdt disabled but some requested targets require it." \
4050 "You can turn off fdt only if you also disable all the system emulation" \
4051 "targets which need it (by specifying a cut down --target-list)."
4052 fi
4053 fdt=yes
4054fi
4055
Juan Quintela2df87df2009-08-12 18:29:54 +02004056if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02004057 fdt_libs="-lfdt"
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10004058 # explicitly check for libfdt_env.h as it is missing in some stable installs
Paul Burton6e85fce2016-09-08 15:51:55 +01004059 # and test for required functions to make sure we are on a version >= 1.4.2
Juan Quintelab41af4b2009-07-27 16:13:20 +02004060 cat > $TMPC << EOF
Thomas Huth31ce0ad2015-05-18 12:59:49 +02004061#include <libfdt.h>
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10004062#include <libfdt_env.h>
Alexey Kardashevskiyfea35ca2018-12-21 01:34:48 +01004063int main(void) { fdt_check_full(NULL, 0); return 0; }
aurel32f652e6a2008-12-16 10:43:48 +00004064EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004065 if compile_prog "" "$fdt_libs" ; then
Peter Crosthwaitea540f152013-04-18 14:47:31 +10004066 # system DTC is good - use it
Philippe Mathieu-Daudée3971d62018-04-15 20:05:20 -03004067 fdt=system
Peter Crosthwaitea540f152013-04-18 14:47:31 +10004068 else
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01004069 # have GIT checkout, so activate dtc submodule
4070 if test -e "${source_path}/.git" ; then
4071 git_submodules="${git_submodules} dtc"
4072 fi
4073 if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
Philippe Mathieu-Daudée3971d62018-04-15 20:05:20 -03004074 fdt=git
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01004075 mkdir -p dtc
4076 if [ "$pwd_is_source_path" != "y" ] ; then
4077 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
4078 symlink "$source_path/dtc/scripts" "dtc/scripts"
4079 fi
4080 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
Philippe Mathieu-Daudé8a99e9a2018-04-15 20:05:19 -03004081 fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt"
4082 fdt_libs="$fdt_libs"
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01004083 elif test "$fdt" = "yes" ; then
4084 # Not a git build & no libfdt found, prompt for system install
4085 error_exit "DTC (libfdt) version >= 1.4.2 not present." \
4086 "Please install the DTC (libfdt) devel package"
4087 else
4088 # don't have and don't want
4089 fdt_libs=
4090 fdt=no
4091 fi
aurel32f652e6a2008-12-16 10:43:48 +00004092 fi
4093fi
4094
Peter Crosthwaitea540f152013-04-18 14:47:31 +10004095libs_softmmu="$libs_softmmu $fdt_libs"
4096
Michael Walle20ff0752011-03-07 23:32:39 +01004097##########################################
OGAWA Hirofumifb719562015-10-27 02:45:48 +09004098# opengl probe (for sdl2, gtk, milkymist-tmu2)
Gerd Hoffmannb1546f32015-03-16 10:03:53 +01004099
Marc-André Lureaud52c4542019-05-24 15:09:42 +02004100gbm="no"
4101if $pkg_config gbm; then
4102 gbm_cflags="$($pkg_config --cflags gbm)"
4103 gbm_libs="$($pkg_config --libs gbm)"
4104 gbm="yes"
4105fi
4106
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01004107if test "$opengl" != "no" ; then
Michael Tokarev4939a1d2018-06-30 19:54:48 +03004108 opengl_pkgs="epoxy gbm"
Gerd Hoffmann5f9b1e32018-03-01 11:05:43 +01004109 if $pkg_config $opengl_pkgs; then
4110 opengl_cflags="$($pkg_config --cflags $opengl_pkgs)"
4111 opengl_libs="$($pkg_config --libs $opengl_pkgs)"
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01004112 opengl=yes
Gerd Hoffmann925a0402015-05-26 12:26:21 +02004113 if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
4114 gtk_gl="yes"
4115 fi
Gerd Hoffmanncc720a52017-03-21 08:04:48 +01004116 QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
Michael Walle20ff0752011-03-07 23:32:39 +01004117 else
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01004118 if test "$opengl" = "yes" ; then
Gerd Hoffmanndcf30022015-05-11 12:24:43 +02004119 feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
Michael Walle20ff0752011-03-07 23:32:39 +01004120 fi
Jeremy Whitef676c672015-01-09 13:08:49 -06004121 opengl_cflags=""
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01004122 opengl_libs=""
4123 opengl=no
Michael Walle20ff0752011-03-07 23:32:39 +01004124 fi
4125fi
4126
Gerd Hoffmann014cb152015-12-03 12:56:34 +01004127if test "$opengl" = "yes"; then
4128 cat > $TMPC << EOF
4129#include <epoxy/egl.h>
4130#ifndef EGL_MESA_image_dma_buf_export
4131# error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
4132#endif
4133int main(void) { return 0; }
4134EOF
4135 if compile_prog "" "" ; then
4136 opengl_dmabuf=yes
4137 fi
4138fi
Chrysostomos Nanakosc9a12e72014-08-04 17:35:32 +03004139
Eric Blakee633a5c2019-02-04 20:39:37 -06004140if test "$opengl" = "yes" && test "$have_x11" = "yes"; then
Philippe Mathieu-Daudé99e1a932019-01-30 13:00:03 +01004141 for target in $target_list; do
4142 case $target in
4143 lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL
4144 need_x11=yes
4145 ;;
4146 esac
4147 done
4148fi
4149
Klim Kireeved279a02018-01-12 12:01:19 +03004150##########################################
4151# libxml2 probe
4152if test "$libxml2" != "no" ; then
4153 if $pkg_config --exists libxml-2.0; then
4154 libxml2="yes"
4155 libxml2_cflags=$($pkg_config --cflags libxml-2.0)
4156 libxml2_libs=$($pkg_config --libs libxml-2.0)
4157 else
4158 if test "$libxml2" = "yes"; then
4159 feature_not_found "libxml2" "Install libxml2 devel"
4160 fi
4161 libxml2="no"
4162 fi
4163fi
Chrysostomos Nanakosc9a12e72014-08-04 17:35:32 +03004164
Bharata B Raoeb100392012-09-24 14:42:45 +05304165##########################################
4166# glusterfs probe
4167if test "$glusterfs" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02004168 if $pkg_config --atleast-version=3 glusterfs-api; then
Bharata B Raoe01bee02013-07-16 21:47:41 +05304169 glusterfs="yes"
Stefan Weil89138852016-05-16 15:10:20 +02004170 glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
4171 glusterfs_libs=$($pkg_config --libs glusterfs-api)
Jeff Codyd85fa9e2016-04-05 10:40:09 -04004172 if $pkg_config --atleast-version=4 glusterfs-api; then
4173 glusterfs_xlator_opt="yes"
4174 fi
Stefan Weil65d5d3f2013-08-27 21:09:13 +02004175 if $pkg_config --atleast-version=5 glusterfs-api; then
Bharata B Rao0c14fb42013-07-16 21:47:42 +05304176 glusterfs_discard="yes"
4177 fi
Bharata B Rao7c815372013-12-21 14:51:25 +05304178 if $pkg_config --atleast-version=6 glusterfs-api; then
Niels de Vosdf3a4292017-05-28 12:01:14 +05304179 glusterfs_fallocate="yes"
Bharata B Rao7c815372013-12-21 14:51:25 +05304180 glusterfs_zerofill="yes"
4181 fi
Prasanna Kumar Kalevere014dbe2019-03-05 16:46:33 +01004182 cat > $TMPC << EOF
4183#include <glusterfs/api/glfs.h>
4184
4185int
4186main(void)
4187{
4188 /* new glfs_ftruncate() passes two additional args */
4189 return glfs_ftruncate(NULL, 0, NULL, NULL);
4190}
4191EOF
4192 if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
4193 glusterfs_ftruncate_has_stat="yes"
4194 fi
Niels de Vos0e3b8912019-03-05 16:46:34 +01004195 cat > $TMPC << EOF
4196#include <glusterfs/api/glfs.h>
4197
4198/* new glfs_io_cbk() passes two additional glfs_stat structs */
4199static void
4200glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data)
4201{}
4202
4203int
4204main(void)
4205{
4206 glfs_io_cbk iocb = &glusterfs_iocb;
4207 iocb(NULL, 0 , NULL, NULL, NULL);
4208 return 0;
4209}
4210EOF
4211 if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
4212 glusterfs_iocb_has_stat="yes"
4213 fi
Bharata B Raoeb100392012-09-24 14:42:45 +05304214 else
4215 if test "$glusterfs" = "yes" ; then
Hu Tao8efc9362014-06-26 17:34:50 +08004216 feature_not_found "GlusterFS backend support" \
4217 "Install glusterfs-api devel >= 3"
Bharata B Raoeb100392012-09-24 14:42:45 +05304218 fi
Bharata B Raoe01bee02013-07-16 21:47:41 +05304219 glusterfs="no"
Bharata B Raoeb100392012-09-24 14:42:45 +05304220 fi
4221fi
4222
aurel3239386ac2009-04-15 19:48:17 +00004223# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00004224# emulator. This is done because older glibc versions don't
4225# have syscall stubs for these implemented. In that case we
4226# don't provide them even if kernel supports them.
4227#
4228inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03004229cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00004230#include <sys/inotify.h>
4231
4232int
4233main(void)
4234{
4235 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00004236 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00004237}
4238EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004239if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03004240 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00004241fi
4242
Riku Voipioc05c7a72010-03-26 15:25:11 +00004243inotify1=no
4244cat > $TMPC << EOF
4245#include <sys/inotify.h>
4246
4247int
4248main(void)
4249{
4250 /* try to start inotify */
4251 return inotify_init1(0);
4252}
4253EOF
4254if compile_prog "" "" ; then
4255 inotify1=yes
4256fi
4257
Riku Voipio099d6b02009-05-05 12:10:04 +03004258# check if pipe2 is there
4259pipe2=no
4260cat > $TMPC << EOF
Riku Voipio099d6b02009-05-05 12:10:04 +03004261#include <unistd.h>
4262#include <fcntl.h>
4263
4264int main(void)
4265{
4266 int pipefd[2];
Bruce Rogers9bca8162012-08-20 12:45:08 -06004267 return pipe2(pipefd, O_CLOEXEC);
Riku Voipio099d6b02009-05-05 12:10:04 +03004268}
4269EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004270if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03004271 pipe2=yes
4272fi
4273
Kevin Wolf40ff6d72009-12-02 12:24:42 +01004274# check if accept4 is there
4275accept4=no
4276cat > $TMPC << EOF
Kevin Wolf40ff6d72009-12-02 12:24:42 +01004277#include <sys/socket.h>
4278#include <stddef.h>
4279
4280int main(void)
4281{
4282 accept4(0, NULL, NULL, SOCK_CLOEXEC);
4283 return 0;
4284}
4285EOF
4286if compile_prog "" "" ; then
4287 accept4=yes
4288fi
4289
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304290# check if tee/splice is there. vmsplice was added same time.
4291splice=no
4292cat > $TMPC << EOF
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304293#include <unistd.h>
4294#include <fcntl.h>
4295#include <limits.h>
4296
4297int main(void)
4298{
Stefan Weil66ea0f22011-12-17 09:27:35 +01004299 int len, fd = 0;
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304300 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
4301 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
4302 return 0;
4303}
4304EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004305if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304306 splice=yes
4307fi
4308
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004309##########################################
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08004310# libnuma probe
4311
4312if test "$numa" != "no" ; then
4313 cat > $TMPC << EOF
4314#include <numa.h>
4315int main(void) { return numa_available(); }
4316EOF
4317
4318 if compile_prog "" "-lnuma" ; then
4319 numa=yes
4320 libs_softmmu="-lnuma $libs_softmmu"
4321 else
4322 if test "$numa" = "yes" ; then
4323 feature_not_found "numa" "install numactl devel"
4324 fi
4325 numa=no
4326 fi
4327fi
4328
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02004329if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
4330 echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
4331 exit 1
4332fi
4333
Yang Zhong5a22ab72017-12-20 21:16:46 +08004334# Even if malloc_trim() is available, these non-libc memory allocators
4335# do not support it.
4336if test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then
4337 if test "$malloc_trim" = "yes" ; then
4338 echo "Disabling malloc_trim with non-libc memory allocator"
4339 fi
4340 malloc_trim="no"
4341fi
4342
4343#######################################
4344# malloc_trim
4345
4346if test "$malloc_trim" != "no" ; then
4347 cat > $TMPC << EOF
4348#include <malloc.h>
4349int main(void) { malloc_trim(0); return 0; }
4350EOF
4351 if compile_prog "" "" ; then
4352 malloc_trim="yes"
4353 else
4354 malloc_trim="no"
4355 fi
4356fi
4357
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08004358##########################################
Fam Zheng2847b462015-03-26 11:03:12 +08004359# tcmalloc probe
4360
4361if test "$tcmalloc" = "yes" ; then
4362 cat > $TMPC << EOF
4363#include <stdlib.h>
4364int main(void) { malloc(1); return 0; }
4365EOF
4366
4367 if compile_prog "" "-ltcmalloc" ; then
4368 LIBS="-ltcmalloc $LIBS"
4369 else
4370 feature_not_found "tcmalloc" "install gperftools devel"
4371 fi
4372fi
4373
4374##########################################
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02004375# jemalloc probe
4376
4377if test "$jemalloc" = "yes" ; then
4378 cat > $TMPC << EOF
4379#include <stdlib.h>
4380int main(void) { malloc(1); return 0; }
4381EOF
4382
4383 if compile_prog "" "-ljemalloc" ; then
4384 LIBS="-ljemalloc $LIBS"
4385 else
4386 feature_not_found "jemalloc" "install jemalloc devel"
4387 fi
4388fi
4389
4390##########################################
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004391# signalfd probe
4392signalfd="no"
4393cat > $TMPC << EOF
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004394#include <unistd.h>
4395#include <sys/syscall.h>
4396#include <signal.h>
4397int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
4398EOF
4399
4400if compile_prog "" "" ; then
4401 signalfd=yes
4402fi
4403
Richard W.M. Jonesd339d762019-01-18 10:11:14 +00004404# check if optreset global is declared by <getopt.h>
4405optreset="no"
4406cat > $TMPC << EOF
4407#include <getopt.h>
4408int main(void) { return optreset; }
4409EOF
4410
4411if compile_prog "" "" ; then
4412 optreset=yes
4413fi
4414
Riku Voipioc2882b92009-08-12 15:08:24 +03004415# check if eventfd is supported
4416eventfd=no
4417cat > $TMPC << EOF
4418#include <sys/eventfd.h>
4419
4420int main(void)
4421{
Stefan Weil55cc7f32011-12-17 09:27:37 +01004422 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
Riku Voipioc2882b92009-08-12 15:08:24 +03004423}
4424EOF
4425if compile_prog "" "" ; then
4426 eventfd=yes
4427fi
4428
Marc-André Lureau751bcc32015-10-09 17:17:16 +02004429# check if memfd is supported
4430memfd=no
4431cat > $TMPC << EOF
Paolo Bonzini75e5b702017-11-28 11:51:27 +01004432#include <sys/mman.h>
Marc-André Lureau751bcc32015-10-09 17:17:16 +02004433
4434int main(void)
4435{
4436 return memfd_create("foo", MFD_ALLOW_SEALING);
4437}
4438EOF
4439if compile_prog "" "" ; then
4440 memfd=yes
4441fi
4442
Cortland Tölva955727d2018-10-08 09:35:19 -07004443# check for usbfs
4444have_usbfs=no
4445if test "$linux_user" = "yes"; then
Thomas Petazzoni96566d02019-02-13 22:18:27 +01004446 cat > $TMPC << EOF
4447#include <linux/usbdevice_fs.h>
4448
4449#ifndef USBDEVFS_GET_CAPABILITIES
4450#error "USBDEVFS_GET_CAPABILITIES undefined"
4451#endif
4452
4453#ifndef USBDEVFS_DISCONNECT_CLAIM
4454#error "USBDEVFS_DISCONNECT_CLAIM undefined"
4455#endif
4456
4457int main(void)
4458{
4459 return 0;
4460}
4461EOF
4462 if compile_prog "" ""; then
Cortland Tölva955727d2018-10-08 09:35:19 -07004463 have_usbfs=yes
4464 fi
Cortland Tölva955727d2018-10-08 09:35:19 -07004465fi
Marc-André Lureau751bcc32015-10-09 17:17:16 +02004466
Ulrich Hechtd0927932009-09-17 20:22:14 +03004467# check for fallocate
4468fallocate=no
4469cat > $TMPC << EOF
4470#include <fcntl.h>
4471
4472int main(void)
4473{
4474 fallocate(0, 0, 0, 0);
4475 return 0;
4476}
4477EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004478if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03004479 fallocate=yes
4480fi
4481
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01004482# check for fallocate hole punching
4483fallocate_punch_hole=no
4484cat > $TMPC << EOF
4485#include <fcntl.h>
4486#include <linux/falloc.h>
4487
4488int main(void)
4489{
4490 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
4491 return 0;
4492}
4493EOF
4494if compile_prog "" "" ; then
4495 fallocate_punch_hole=yes
4496fi
4497
Denis V. Lunevb953f072015-01-30 11:42:14 +03004498# check that fallocate supports range zeroing inside the file
4499fallocate_zero_range=no
4500cat > $TMPC << EOF
4501#include <fcntl.h>
4502#include <linux/falloc.h>
4503
4504int main(void)
4505{
4506 fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0);
4507 return 0;
4508}
4509EOF
4510if compile_prog "" "" ; then
4511 fallocate_zero_range=yes
4512fi
4513
Kevin Wolfed911432014-09-29 17:12:59 +02004514# check for posix_fallocate
4515posix_fallocate=no
4516cat > $TMPC << EOF
4517#include <fcntl.h>
4518
4519int main(void)
4520{
4521 posix_fallocate(0, 0, 0);
4522 return 0;
4523}
4524EOF
4525if compile_prog "" "" ; then
4526 posix_fallocate=yes
4527fi
4528
Peter Maydellc727f472011-01-06 11:05:10 +00004529# check for sync_file_range
4530sync_file_range=no
4531cat > $TMPC << EOF
4532#include <fcntl.h>
4533
4534int main(void)
4535{
4536 sync_file_range(0, 0, 0, 0);
4537 return 0;
4538}
4539EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004540if compile_prog "" "" ; then
Peter Maydellc727f472011-01-06 11:05:10 +00004541 sync_file_range=yes
4542fi
4543
Peter Maydelldace20d2011-01-10 13:11:24 +00004544# check for linux/fiemap.h and FS_IOC_FIEMAP
4545fiemap=no
4546cat > $TMPC << EOF
4547#include <sys/ioctl.h>
4548#include <linux/fs.h>
4549#include <linux/fiemap.h>
4550
4551int main(void)
4552{
4553 ioctl(0, FS_IOC_FIEMAP, 0);
4554 return 0;
4555}
4556EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004557if compile_prog "" "" ; then
Peter Maydelldace20d2011-01-10 13:11:24 +00004558 fiemap=yes
4559fi
4560
Ulrich Hechtd0927932009-09-17 20:22:14 +03004561# check for dup3
4562dup3=no
4563cat > $TMPC << EOF
4564#include <unistd.h>
4565
4566int main(void)
4567{
4568 dup3(0, 0, 0);
4569 return 0;
4570}
4571EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01004572if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03004573 dup3=yes
4574fi
4575
Alex Bligh4e0c6522013-08-21 16:02:43 +01004576# check for ppoll support
4577ppoll=no
4578cat > $TMPC << EOF
4579#include <poll.h>
4580
4581int main(void)
4582{
4583 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
4584 ppoll(&pfd, 1, 0, 0);
4585 return 0;
4586}
4587EOF
4588if compile_prog "" "" ; then
4589 ppoll=yes
4590fi
4591
Alex Blighcd758dd2013-08-21 16:02:44 +01004592# check for prctl(PR_SET_TIMERSLACK , ... ) support
4593prctl_pr_set_timerslack=no
4594cat > $TMPC << EOF
4595#include <sys/prctl.h>
4596
4597int main(void)
4598{
4599 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
4600 return 0;
4601}
4602EOF
4603if compile_prog "" "" ; then
4604 prctl_pr_set_timerslack=yes
4605fi
4606
Peter Maydell3b6edd12011-02-15 18:35:05 +00004607# check for epoll support
4608epoll=no
4609cat > $TMPC << EOF
4610#include <sys/epoll.h>
4611
4612int main(void)
4613{
4614 epoll_create(0);
4615 return 0;
4616}
4617EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004618if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00004619 epoll=yes
4620fi
4621
Peter Maydell227f0212016-06-06 19:58:11 +01004622# epoll_create1 is a later addition
4623# so we must check separately for its presence
Peter Maydell3b6edd12011-02-15 18:35:05 +00004624epoll_create1=no
4625cat > $TMPC << EOF
4626#include <sys/epoll.h>
4627
4628int main(void)
4629{
Peter Maydell19e83f62011-04-26 16:56:40 +01004630 /* Note that we use epoll_create1 as a value, not as
4631 * a function being called. This is necessary so that on
4632 * old SPARC glibc versions where the function was present in
4633 * the library but not declared in the header file we will
4634 * fail the configure check. (Otherwise we will get a compiler
4635 * warning but not an error, and will proceed to fail the
4636 * qemu compile where we compile with -Werror.)
4637 */
Blue Swirlc075a722012-08-09 20:21:25 +00004638 return (int)(uintptr_t)&epoll_create1;
Peter Maydell3b6edd12011-02-15 18:35:05 +00004639}
4640EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01004641if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00004642 epoll_create1=yes
4643fi
4644
Peter Maydella8fd1ab2013-02-08 07:31:55 +00004645# check for sendfile support
4646sendfile=no
4647cat > $TMPC << EOF
4648#include <sys/sendfile.h>
4649
4650int main(void)
4651{
4652 return sendfile(0, 0, 0, 0);
4653}
4654EOF
4655if compile_prog "" "" ; then
4656 sendfile=yes
4657fi
4658
Riku Voipio51834342014-06-22 11:25:42 +01004659# check for timerfd support (glibc 2.8 and newer)
4660timerfd=no
4661cat > $TMPC << EOF
4662#include <sys/timerfd.h>
4663
4664int main(void)
4665{
4666 return(timerfd_create(CLOCK_REALTIME, 0));
4667}
4668EOF
4669if compile_prog "" "" ; then
4670 timerfd=yes
4671fi
4672
Riku Voipio9af5c902014-08-12 15:58:57 +03004673# check for setns and unshare support
4674setns=no
4675cat > $TMPC << EOF
4676#include <sched.h>
4677
4678int main(void)
4679{
4680 int ret;
4681 ret = setns(0, 0);
4682 ret = unshare(0);
4683 return ret;
4684}
4685EOF
4686if compile_prog "" "" ; then
4687 setns=yes
4688fi
4689
Aleksandar Markovic38860a02016-10-10 13:23:29 +02004690# clock_adjtime probe
4691clock_adjtime=no
4692cat > $TMPC <<EOF
4693#include <time.h>
4694
4695int main(void)
4696{
4697 return clock_adjtime(0, 0);
4698}
4699EOF
4700clock_adjtime=no
4701if compile_prog "" "" ; then
4702 clock_adjtime=yes
4703fi
4704
Aleksandar Markovic5a03cd02016-10-10 13:23:30 +02004705# syncfs probe
4706syncfs=no
4707cat > $TMPC <<EOF
4708#include <unistd.h>
4709
4710int main(void)
4711{
4712 return syncfs(0);
4713}
4714EOF
4715syncfs=no
4716if compile_prog "" "" ; then
4717 syncfs=yes
4718fi
4719
Peter Maydell5f71eac2019-03-07 14:26:46 +00004720# Check we have a new enough version of sphinx-build
4721has_sphinx_build() {
4722 # This is a bit awkward but works: create a trivial document and
4723 # try to run it with our configuration file (which enforces a
4724 # version requirement). This will fail if either
4725 # sphinx-build doesn't exist at all or if it is too old.
4726 mkdir -p "$TMPDIR1/sphinx"
4727 touch "$TMPDIR1/sphinx/index.rst"
4728 sphinx-build -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1
4729}
4730
pbrookcc8ae6d2006-04-23 17:57:59 +00004731# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02004732if test "$docs" != "no" ; then
Peter Maydell5f71eac2019-03-07 14:26:46 +00004733 if has makeinfo && has pod2man && has_sphinx_build; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02004734 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02004735 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02004736 if test "$docs" = "yes" ; then
Peter Maydell5f71eac2019-03-07 14:26:46 +00004737 feature_not_found "docs" "Install texinfo, Perl/perl-podlators and python-sphinx"
Juan Quintela83a3ab82009-08-12 18:29:51 +02004738 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02004739 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02004740 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00004741fi
4742
Stefan Weilf514f412009-10-11 12:44:07 +02004743# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02004744byteswap_h=no
4745cat > $TMPC << EOF
4746#include <byteswap.h>
4747int main(void) { return bswap_32(0); }
4748EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004749if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02004750 byteswap_h=yes
4751fi
4752
Stefan Weil75f13592013-01-05 12:17:38 +01004753# Search for bswap32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02004754bswap_h=no
4755cat > $TMPC << EOF
4756#include <sys/endian.h>
4757#include <sys/types.h>
4758#include <machine/bswap.h>
4759int main(void) { return bswap32(0); }
4760EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02004761if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02004762 bswap_h=yes
4763fi
4764
aliguorida93a1f2008-12-12 20:02:52 +00004765##########################################
Peter Lievene49ab192014-06-04 14:33:26 +02004766# Do we have libiscsi >= 1.9.0
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004767if test "$libiscsi" != "no" ; then
Peter Lievene49ab192014-06-04 14:33:26 +02004768 if $pkg_config --atleast-version=1.9.0 libiscsi; then
Paolo Bonzini3c33ea92013-02-22 18:14:28 +01004769 libiscsi="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02004770 libiscsi_cflags=$($pkg_config --cflags libiscsi)
4771 libiscsi_libs=$($pkg_config --libs libiscsi)
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004772 else
4773 if test "$libiscsi" = "yes" ; then
Peter Lievene49ab192014-06-04 14:33:26 +02004774 feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004775 fi
4776 libiscsi="no"
4777 fi
4778fi
4779
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004780##########################################
Natanael Copa8bacde82012-09-12 09:06:51 +00004781# Do we need libm
4782cat > $TMPC << EOF
4783#include <math.h>
Alexey Kardashevskiyf80ea982014-07-01 17:30:27 +10004784int main(int argc, char **argv) { return isnan(sin((double)argc)); }
Natanael Copa8bacde82012-09-12 09:06:51 +00004785EOF
4786if compile_prog "" "" ; then
4787 :
4788elif compile_prog "" "-lm" ; then
4789 LIBS="-lm $LIBS"
4790 libs_qga="-lm $libs_qga"
4791else
Peter Maydell76ad07a2013-04-08 12:11:26 +01004792 error_exit "libm check failed"
Natanael Copa8bacde82012-09-12 09:06:51 +00004793fi
4794
4795##########################################
aliguorida93a1f2008-12-12 20:02:52 +00004796# Do we need librt
Natanael Copa8bacde82012-09-12 09:06:51 +00004797# uClibc provides 2 versions of clock_gettime(), one with realtime
4798# support and one without. This means that the clock_gettime() don't
4799# need -lrt. We still need it for timer_create() so we check for this
4800# function in addition.
aliguorida93a1f2008-12-12 20:02:52 +00004801cat > $TMPC <<EOF
4802#include <signal.h>
4803#include <time.h>
Natanael Copa8bacde82012-09-12 09:06:51 +00004804int main(void) {
4805 timer_create(CLOCK_REALTIME, NULL, NULL);
4806 return clock_gettime(CLOCK_REALTIME, NULL);
4807}
aliguorida93a1f2008-12-12 20:02:52 +00004808EOF
4809
Juan Quintela52166aa2009-08-03 14:46:03 +02004810if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02004811 :
Natanael Copa8bacde82012-09-12 09:06:51 +00004812# we need pthread for static linking. use previous pthread test result
Rick Liu18e588b2014-05-30 14:10:20 -07004813elif compile_prog "" "$pthread_lib -lrt" ; then
4814 LIBS="$LIBS -lrt"
4815 libs_qga="$libs_qga -lrt"
aliguorida93a1f2008-12-12 20:02:52 +00004816fi
4817
Thomas Huthd99e97e2019-01-17 18:14:08 +01004818# Check whether we need to link libutil for openpty()
4819cat > $TMPC << EOF
4820extern int openpty(int *am, int *as, char *name, void *termp, void *winp);
4821int main(void) { return openpty(0, 0, 0, 0, 0); }
4822EOF
4823
4824if ! compile_prog "" "" ; then
4825 if compile_prog "" "-lutil" ; then
Juan Quintela6362a532009-08-03 14:46:32 +02004826 libs_softmmu="-lutil $libs_softmmu"
Thomas Huthd99e97e2019-01-17 18:14:08 +01004827 libs_tools="-lutil $libs_tools"
4828 fi
Juan Quintela6362a532009-08-03 14:46:32 +02004829fi
4830
Blue Swirlde5071c2009-09-12 09:58:46 +00004831##########################################
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004832# spice probe
4833if test "$spice" != "no" ; then
4834 cat > $TMPC << EOF
4835#include <spice.h>
4836int main(void) { spice_server_new(); return 0; }
4837EOF
Jiri Denemark710fc4f2011-01-24 13:20:29 +01004838 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
4839 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
Marc-André Lureau1b636652018-11-28 19:59:32 +04004840 if $pkg_config --atleast-version=0.12.5 spice-server && \
Stefan Weil65d5d3f2013-08-27 21:09:13 +02004841 $pkg_config --atleast-version=0.12.3 spice-protocol && \
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004842 compile_prog "$spice_cflags" "$spice_libs" ; then
4843 spice="yes"
4844 libs_softmmu="$libs_softmmu $spice_libs"
4845 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
Alon Levy2e0e3c32012-08-22 11:16:26 +03004846 spice_protocol_version=$($pkg_config --modversion spice-protocol)
4847 spice_server_version=$($pkg_config --modversion spice-server)
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004848 else
4849 if test "$spice" = "yes" ; then
Hu Tao8efc9362014-06-26 17:34:50 +08004850 feature_not_found "spice" \
Marc-André Lureau1b636652018-11-28 19:59:32 +04004851 "Install spice-server(>=0.12.5) and spice-protocol(>=0.12.3) devel"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004852 fi
4853 spice="no"
4854 fi
4855fi
4856
Marc-André Lureau7b02f542015-08-30 11:48:40 +02004857# check for smartcard support
Marc-André Lureau7b02f542015-08-30 11:48:40 +02004858if test "$smartcard" != "no"; then
Michal Privoznik0f5c6422018-04-03 12:34:37 +02004859 if $pkg_config --atleast-version=2.5.1 libcacard; then
Marc-André Lureau7b02f542015-08-30 11:48:40 +02004860 libcacard_cflags=$($pkg_config --cflags libcacard)
4861 libcacard_libs=$($pkg_config --libs libcacard)
Marc-André Lureau7b02f542015-08-30 11:48:40 +02004862 smartcard="yes"
Paolo Bonziniafd347a2012-12-20 20:39:36 +01004863 else
Marc-André Lureau7b02f542015-08-30 11:48:40 +02004864 if test "$smartcard" = "yes"; then
4865 feature_not_found "smartcard" "Install libcacard devel"
Paolo Bonziniafd347a2012-12-20 20:39:36 +01004866 fi
Marc-André Lureau7b02f542015-08-30 11:48:40 +02004867 smartcard="no"
Paolo Bonziniafd347a2012-12-20 20:39:36 +01004868 fi
Robert Relyea111a38b2010-11-28 16:36:38 +02004869fi
4870
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004871# check for libusb
4872if test "$libusb" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02004873 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004874 libusb="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02004875 libusb_cflags=$($pkg_config --cflags libusb-1.0)
4876 libusb_libs=$($pkg_config --libs libusb-1.0)
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004877 else
4878 if test "$libusb" = "yes"; then
Hu Tao8efc9362014-06-26 17:34:50 +08004879 feature_not_found "libusb" "Install libusb devel >= 1.0.13"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004880 fi
4881 libusb="no"
4882 fi
4883fi
4884
Hans de Goede69354a82011-07-19 11:04:10 +02004885# check for usbredirparser for usb network redirection support
4886if test "$usb_redir" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02004887 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
Hans de Goede69354a82011-07-19 11:04:10 +02004888 usb_redir="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02004889 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
4890 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
Hans de Goede69354a82011-07-19 11:04:10 +02004891 else
4892 if test "$usb_redir" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11004893 feature_not_found "usb-redir" "Install usbredir devel"
Hans de Goede69354a82011-07-19 11:04:10 +02004894 fi
4895 usb_redir="no"
4896 fi
4897fi
4898
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004899##########################################
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004900# check if we have VSS SDK headers for win
4901
Eric Blakee633a5c2019-02-04 20:39:37 -06004902if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \
4903 test "$vss_win32_sdk" != "no" ; then
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004904 case "$vss_win32_sdk" in
Michael Roth690604f2016-06-28 17:31:49 -05004905 "") vss_win32_include="-isystem $source_path" ;;
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004906 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
4907 # handle path with spaces. So we symlink the headers into ".sdk/vss".
Michael Roth690604f2016-06-28 17:31:49 -05004908 vss_win32_include="-isystem $source_path/.sdk/vss"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004909 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
4910 ;;
Michael Roth690604f2016-06-28 17:31:49 -05004911 *) vss_win32_include="-isystem $vss_win32_sdk"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004912 esac
4913 cat > $TMPC << EOF
4914#define __MIDL_user_allocate_free_DEFINED__
4915#include <inc/win2003/vss.h>
4916int main(void) { return VSS_CTX_BACKUP; }
4917EOF
4918 if compile_prog "$vss_win32_include" "" ; then
4919 guest_agent_with_vss="yes"
4920 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
Fam Zheng315d3182016-09-21 12:27:21 +08004921 libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
Michael Rothf33ca812015-08-26 16:19:41 -05004922 qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004923 else
4924 if test "$vss_win32_sdk" != "" ; then
4925 echo "ERROR: Please download and install Microsoft VSS SDK:"
4926 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
4927 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
4928 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
4929 echo "ERROR: The headers are extracted in the directory \`inc'."
4930 feature_not_found "VSS support"
4931 fi
4932 guest_agent_with_vss="no"
4933 fi
4934fi
4935
4936##########################################
4937# lookup Windows platform SDK (if not specified)
4938# The SDK is needed only to build .tlb (type library) file of guest agent
4939# VSS provider from the source. It is usually unnecessary because the
4940# pre-compiled .tlb file is included.
4941
Eric Blakee633a5c2019-02-04 20:39:37 -06004942if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \
4943 test "$guest_agent_with_vss" = "yes" ; then
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004944 if test -z "$win_sdk"; then
4945 programfiles="$PROGRAMFILES"
4946 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
4947 if test -n "$programfiles"; then
4948 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
4949 else
4950 feature_not_found "Windows SDK"
4951 fi
4952 elif test "$win_sdk" = "no"; then
4953 win_sdk=""
4954 fi
4955fi
4956
4957##########################################
Michael Roth50cbebb2015-07-07 18:10:09 -05004958# check if mingw environment provides a recent ntddscsi.h
Eric Blakee633a5c2019-02-04 20:39:37 -06004959if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then
Michael Roth50cbebb2015-07-07 18:10:09 -05004960 cat > $TMPC << EOF
4961#include <windows.h>
4962#include <ntddscsi.h>
4963int main(void) {
4964#if !defined(IOCTL_SCSI_GET_ADDRESS)
4965#error Missing required ioctl definitions
4966#endif
4967 SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
4968 return addr.Lun;
4969}
4970EOF
4971 if compile_prog "" "" ; then
4972 guest_agent_ntddscsi=yes
Matt Hines996b9cd2019-01-28 14:30:56 -08004973 libs_qga="-lsetupapi -lcfgmgr32 $libs_qga"
Michael Roth50cbebb2015-07-07 18:10:09 -05004974 fi
4975fi
4976
4977##########################################
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +02004978# virgl renderer probe
4979
4980if test "$virglrenderer" != "no" ; then
4981 cat > $TMPC << EOF
4982#include <virglrenderer.h>
4983int main(void) { virgl_renderer_poll(); return 0; }
4984EOF
4985 virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null)
4986 virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null)
Marc-André Lureau47479c52018-05-25 17:36:09 +02004987 virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null)
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +02004988 if $pkg_config virglrenderer >/dev/null 2>&1 && \
4989 compile_prog "$virgl_cflags" "$virgl_libs" ; then
4990 virglrenderer="yes"
4991 else
4992 if test "$virglrenderer" = "yes" ; then
4993 feature_not_found "virglrenderer"
4994 fi
4995 virglrenderer="no"
4996 fi
4997fi
4998
4999##########################################
Richard Henderson8ca80762017-09-14 09:41:12 -07005000# capstone
5001
Richard Hendersone219c492017-09-28 09:01:23 -07005002case "$capstone" in
5003 "" | yes)
5004 if $pkg_config capstone; then
5005 capstone=system
Eric Blakee633a5c2019-02-04 20:39:37 -06005006 elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
Richard Hendersone219c492017-09-28 09:01:23 -07005007 capstone=git
5008 elif test -e "${source_path}/capstone/Makefile" ; then
5009 capstone=internal
5010 elif test -z "$capstone" ; then
5011 capstone=no
5012 else
5013 feature_not_found "capstone" "Install capstone devel or git submodule"
5014 fi
5015 ;;
5016
5017 system)
5018 if ! $pkg_config capstone; then
5019 feature_not_found "capstone" "Install capstone devel"
5020 fi
5021 ;;
5022esac
5023
5024case "$capstone" in
5025 git | internal)
5026 if test "$capstone" = git; then
5027 git_submodules="${git_submodules} capstone"
5028 fi
5029 mkdir -p capstone
5030 QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include"
5031 if test "$mingw32" = "yes"; then
5032 LIBCAPSTONE=capstone.lib
5033 else
5034 LIBCAPSTONE=libcapstone.a
5035 fi
Daniel P. Berrangé02f91352019-05-16 10:51:34 +01005036 libs_cpu="-L\$(BUILD_DIR)/capstone -lcapstone $libs_cpu"
Richard Hendersone219c492017-09-28 09:01:23 -07005037 ;;
5038
5039 system)
Richard Henderson8ca80762017-09-14 09:41:12 -07005040 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)"
Daniel P. Berrangé02f91352019-05-16 10:51:34 +01005041 libs_cpu="$($pkg_config --libs capstone) $libs_cpu"
Richard Hendersone219c492017-09-28 09:01:23 -07005042 ;;
5043
5044 no)
5045 ;;
5046 *)
5047 error_exit "Unknown state for capstone: $capstone"
5048 ;;
5049esac
Richard Henderson8ca80762017-09-14 09:41:12 -07005050
5051##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00005052# check if we have fdatasync
5053
5054fdatasync=no
5055cat > $TMPC << EOF
5056#include <unistd.h>
Alexandre Raymondd1722a22011-05-29 18:22:48 -04005057int main(void) {
5058#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
5059return fdatasync(0);
5060#else
Stefan Weile172fe12012-04-06 21:33:20 +02005061#error Not supported
Alexandre Raymondd1722a22011-05-29 18:22:48 -04005062#endif
5063}
Blue Swirl5f6b9e82009-09-20 06:56:26 +00005064EOF
5065if compile_prog "" "" ; then
5066 fdatasync=yes
5067fi
5068
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01005069##########################################
Andreas Färbere78815a2010-09-25 11:26:05 +00005070# check if we have madvise
5071
5072madvise=no
5073cat > $TMPC << EOF
5074#include <sys/types.h>
5075#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05005076#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00005077int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
5078EOF
5079if compile_prog "" "" ; then
5080 madvise=yes
5081fi
5082
5083##########################################
5084# check if we have posix_madvise
5085
5086posix_madvise=no
5087cat > $TMPC << EOF
5088#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05005089#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00005090int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
5091EOF
5092if compile_prog "" "" ; then
5093 posix_madvise=yes
5094fi
5095
5096##########################################
Andreas Gustafsson9bc5a712018-01-04 19:39:36 +02005097# check if we have posix_memalign()
5098
5099posix_memalign=no
5100cat > $TMPC << EOF
5101#include <stdlib.h>
5102int main(void) {
5103 void *p;
5104 return posix_memalign(&p, 8, 8);
5105}
5106EOF
5107if compile_prog "" "" ; then
5108 posix_memalign=yes
5109fi
5110
5111##########################################
Paul Durrant0a852412016-08-04 14:44:14 +01005112# check if we have posix_syslog
5113
5114posix_syslog=no
5115cat > $TMPC << EOF
5116#include <syslog.h>
5117int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; }
5118EOF
5119if compile_prog "" "" ; then
5120 posix_syslog=yes
5121fi
5122
5123##########################################
Peter Maydell401bc052017-09-05 13:19:32 +01005124# check if we have sem_timedwait
5125
5126sem_timedwait=no
5127cat > $TMPC << EOF
5128#include <semaphore.h>
Daniel P. Berrangé811294b2019-06-17 12:41:14 +01005129int main(void) { sem_t s; struct timespec t = {0}; return sem_timedwait(&s, &t); }
Peter Maydell401bc052017-09-05 13:19:32 +01005130EOF
5131if compile_prog "" "" ; then
5132 sem_timedwait=yes
5133fi
5134
5135##########################################
Keno Fischer5c99fa32018-06-29 12:32:10 +02005136# check if we have strchrnul
5137
5138strchrnul=no
5139cat > $TMPC << EOF
5140#include <string.h>
5141int main(void);
5142// Use a haystack that the compiler shouldn't be able to constant fold
5143char *haystack = (char*)&main;
5144int main(void) { return strchrnul(haystack, 'x') != &haystack[6]; }
5145EOF
5146if compile_prog "" "" ; then
5147 strchrnul=yes
5148fi
5149
5150##########################################
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01005151# check if trace backend exists
5152
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +02005153$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01005154if test "$?" -ne 0 ; then
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +02005155 error_exit "invalid trace backends" \
5156 "Please choose supported trace backends."
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01005157fi
5158
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01005159##########################################
5160# For 'ust' backend, test if ust headers are present
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +02005161if have_backend "ust"; then
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01005162 cat > $TMPC << EOF
Mohamad Gebaibf15f632014-01-29 22:47:54 -05005163#include <lttng/tracepoint.h>
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01005164int main(void) { return 0; }
5165EOF
Francis Deslauriersc79ed232016-11-28 10:52:17 -05005166 if compile_prog "" "-Wl,--no-as-needed -ldl" ; then
Mohamad Gebaibf15f632014-01-29 22:47:54 -05005167 if $pkg_config lttng-ust --exists; then
Stefan Weil89138852016-05-16 15:10:20 +02005168 lttng_ust_libs=$($pkg_config --libs lttng-ust)
Mohamad Gebaibf15f632014-01-29 22:47:54 -05005169 else
Francis Deslauriersc79ed232016-11-28 10:52:17 -05005170 lttng_ust_libs="-llttng-ust -ldl"
Mohamad Gebaibf15f632014-01-29 22:47:54 -05005171 fi
5172 if $pkg_config liburcu-bp --exists; then
Stefan Weil89138852016-05-16 15:10:20 +02005173 urcu_bp_libs=$($pkg_config --libs liburcu-bp)
Mohamad Gebaibf15f632014-01-29 22:47:54 -05005174 else
5175 urcu_bp_libs="-lurcu-bp"
5176 fi
5177
5178 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
5179 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01005180 else
Mohamad Gebaibf15f632014-01-29 22:47:54 -05005181 error_exit "Trace backend 'ust' missing lttng-ust header files"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01005182 fi
5183fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00005184
5185##########################################
5186# For 'dtrace' backend, test if 'dtrace' command is present
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +02005187if have_backend "dtrace"; then
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00005188 if ! has 'dtrace' ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01005189 error_exit "dtrace command is not found in PATH $PATH"
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00005190 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00005191 trace_backend_stap="no"
5192 if has 'stap' ; then
5193 trace_backend_stap="yes"
5194 fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00005195fi
5196
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01005197##########################################
Alex Barcelo519175a2012-02-28 12:25:50 +01005198# check and set a backend for coroutine
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05305199
Peter Maydell7c2acc72013-04-08 12:11:27 +01005200# We prefer ucontext, but it's not always possible. The fallback
Daniel P. Berrange33c53c52017-04-28 13:24:44 +01005201# is sigcontext. On Windows the only valid backend is the Windows
5202# specific one.
Peter Maydell7c2acc72013-04-08 12:11:27 +01005203
5204ucontext_works=no
5205if test "$darwin" != "yes"; then
5206 cat > $TMPC << EOF
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05305207#include <ucontext.h>
Peter Maydellcdf84802012-02-23 16:20:05 +00005208#ifdef __stub_makecontext
5209#error Ignoring glibc stub makecontext which will always fail
5210#endif
Stefan Weil75cafad2011-12-17 09:27:29 +01005211int main(void) { makecontext(0, 0, 0); return 0; }
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05305212EOF
Peter Maydell7c2acc72013-04-08 12:11:27 +01005213 if compile_prog "" "" ; then
5214 ucontext_works=yes
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05305215 fi
Peter Maydell7c2acc72013-04-08 12:11:27 +01005216fi
5217
5218if test "$coroutine" = ""; then
5219 if test "$mingw32" = "yes"; then
5220 coroutine=win32
5221 elif test "$ucontext_works" = "yes"; then
5222 coroutine=ucontext
5223 else
5224 coroutine=sigaltstack
5225 fi
Alex Barcelo519175a2012-02-28 12:25:50 +01005226else
Peter Maydell7c2acc72013-04-08 12:11:27 +01005227 case $coroutine in
5228 windows)
5229 if test "$mingw32" != "yes"; then
5230 error_exit "'windows' coroutine backend only valid for Windows"
5231 fi
5232 # Unfortunately the user visible backend name doesn't match the
5233 # coroutine-*.c filename for this case, so we have to adjust it here.
5234 coroutine=win32
5235 ;;
5236 ucontext)
5237 if test "$ucontext_works" != "yes"; then
5238 feature_not_found "ucontext"
5239 fi
5240 ;;
Daniel P. Berrange33c53c52017-04-28 13:24:44 +01005241 sigaltstack)
Peter Maydell7c2acc72013-04-08 12:11:27 +01005242 if test "$mingw32" = "yes"; then
5243 error_exit "only the 'windows' coroutine backend is valid for Windows"
5244 fi
5245 ;;
5246 *)
5247 error_exit "unknown coroutine backend $coroutine"
5248 ;;
5249 esac
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05305250fi
5251
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02005252if test "$coroutine_pool" = ""; then
Daniel P. Berrange33c53c52017-04-28 13:24:44 +01005253 coroutine_pool=yes
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02005254fi
5255
Peter Lieven7d992e42016-09-27 11:58:45 +02005256if test "$debug_stack_usage" = "yes"; then
Peter Lieven7d992e42016-09-27 11:58:45 +02005257 if test "$coroutine_pool" = "yes"; then
5258 echo "WARN: disabling coroutine pool for stack usage debugging"
5259 coroutine_pool=no
5260 fi
5261fi
5262
5263
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05305264##########################################
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05305265# check if we have open_by_handle_at
5266
Stefan Weil4e1797f2012-06-18 22:11:06 +02005267open_by_handle_at=no
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05305268cat > $TMPC << EOF
5269#include <fcntl.h>
Stefan Weilacc55ba2012-06-06 19:35:57 +00005270#if !defined(AT_EMPTY_PATH)
5271# error missing definition
5272#else
Stefan Weil75cafad2011-12-17 09:27:29 +01005273int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
Stefan Weilacc55ba2012-06-06 19:35:57 +00005274#endif
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05305275EOF
5276if compile_prog "" "" ; then
5277 open_by_handle_at=yes
5278fi
5279
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05305280########################################
5281# check if we have linux/magic.h
5282
5283linux_magic_h=no
5284cat > $TMPC << EOF
5285#include <linux/magic.h>
5286int main(void) {
Stefan Weil75cafad2011-12-17 09:27:29 +01005287 return 0;
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05305288}
5289EOF
5290if compile_prog "" "" ; then
5291 linux_magic_h=yes
5292fi
5293
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03005294########################################
Kevin Wolfc95e3082013-02-22 21:08:51 +01005295# check whether we can disable warning option with a pragma (this is needed
5296# to silence warnings in the headers of some versions of external libraries).
5297# This test has to be compiled with -Werror as otherwise an unknown pragma is
5298# only a warning.
5299#
5300# If we can't selectively disable warning in the code, disable -Werror so that
5301# the build doesn't fail anyway.
5302
Peter Maydell06d71fa2012-07-30 16:13:07 +01005303pragma_disable_unused_but_set=no
5304cat > $TMPC << EOF
Markus Armbrustere6f53fd2013-04-16 13:51:06 +02005305#pragma GCC diagnostic push
Kevin Wolfc95e3082013-02-22 21:08:51 +01005306#pragma GCC diagnostic ignored "-Wstrict-prototypes"
Markus Armbrustere6f53fd2013-04-16 13:51:06 +02005307#pragma GCC diagnostic pop
Kevin Wolfc95e3082013-02-22 21:08:51 +01005308
Peter Maydell06d71fa2012-07-30 16:13:07 +01005309int main(void) {
5310 return 0;
5311}
5312EOF
5313if compile_prog "-Werror" "" ; then
Gerd Hoffmanncc6e3ca2013-01-09 10:17:07 +01005314 pragma_diagnostic_available=yes
Kevin Wolfc95e3082013-02-22 21:08:51 +01005315else
5316 werror=no
Peter Maydell06d71fa2012-07-30 16:13:07 +01005317fi
5318
5319########################################
Christian Borntraeger541be922014-09-25 21:07:54 +02005320# check if we have valgrind/valgrind.h
Kevin Wolf3f4349d2012-06-29 13:40:27 +02005321
5322valgrind_h=no
5323cat > $TMPC << EOF
5324#include <valgrind/valgrind.h>
Kevin Wolf3f4349d2012-06-29 13:40:27 +02005325int main(void) {
Kevin Wolf3f4349d2012-06-29 13:40:27 +02005326 return 0;
5327}
5328EOF
5329if compile_prog "" "" ; then
5330 valgrind_h=yes
5331fi
5332
5333########################################
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03005334# check if environ is declared
5335
5336has_environ=no
5337cat > $TMPC << EOF
5338#include <unistd.h>
5339int main(void) {
Blue Swirlc075a722012-08-09 20:21:25 +00005340 environ = 0;
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03005341 return 0;
5342}
5343EOF
5344if compile_prog "" "" ; then
5345 has_environ=yes
5346fi
5347
Richard Henderson76a347e2012-12-28 14:17:02 -08005348########################################
5349# check if cpuid.h is usable.
5350
Richard Henderson76a347e2012-12-28 14:17:02 -08005351cat > $TMPC << EOF
5352#include <cpuid.h>
5353int main(void) {
Peter Maydell774d5662014-02-20 19:42:53 +00005354 unsigned a, b, c, d;
5355 int max = __get_cpuid_max(0, 0);
5356
5357 if (max >= 1) {
5358 __cpuid(1, a, b, c, d);
5359 }
5360
5361 if (max >= 7) {
5362 __cpuid_count(7, 0, a, b, c, d);
5363 }
5364
5365 return 0;
Richard Henderson76a347e2012-12-28 14:17:02 -08005366}
5367EOF
5368if compile_prog "" "" ; then
5369 cpuid_h=yes
5370fi
5371
Richard Henderson5dd89902017-07-18 18:40:18 -10005372##########################################
5373# avx2 optimization requirement check
5374#
5375# There is no point enabling this if cpuid.h is not usable,
5376# since we won't be able to select the new routines.
5377
Eric Blakee633a5c2019-02-04 20:39:37 -06005378if test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then
Richard Henderson5dd89902017-07-18 18:40:18 -10005379 cat > $TMPC << EOF
5380#pragma GCC push_options
5381#pragma GCC target("avx2")
5382#include <cpuid.h>
5383#include <immintrin.h>
5384static int bar(void *a) {
5385 __m256i x = *(__m256i *)a;
5386 return _mm256_testz_si256(x, x);
5387}
5388int main(int argc, char *argv[]) { return bar(argv[0]); }
5389EOF
5390 if compile_object "" ; then
5391 avx2_opt="yes"
Liam Merwick86583a02018-10-19 21:38:59 +01005392 else
5393 avx2_opt="no"
Richard Henderson5dd89902017-07-18 18:40:18 -10005394 fi
5395fi
5396
Richard Hendersonf5401662013-02-16 12:46:59 -08005397########################################
5398# check if __[u]int128_t is usable.
5399
5400int128=no
5401cat > $TMPC << EOF
5402__int128_t a;
5403__uint128_t b;
5404int main (void) {
5405 a = a + b;
5406 b = a * b;
Peter Maydell464e3672013-06-21 14:01:31 +01005407 a = a * a;
Richard Hendersonf5401662013-02-16 12:46:59 -08005408 return 0;
5409}
5410EOF
5411if compile_prog "" "" ; then
5412 int128=yes
5413fi
Richard Henderson76a347e2012-12-28 14:17:02 -08005414
Richard Henderson7ebee432016-06-29 21:10:59 -07005415#########################################
5416# See if 128-bit atomic operations are supported.
5417
5418atomic128=no
5419if test "$int128" = "yes"; then
5420 cat > $TMPC << EOF
5421int main(void)
5422{
5423 unsigned __int128 x = 0, y = 0;
5424 y = __atomic_load_16(&x, 0);
5425 __atomic_store_16(&x, y, 0);
5426 __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0);
5427 return 0;
5428}
5429EOF
5430 if compile_prog "" "" ; then
5431 atomic128=yes
5432 fi
5433fi
5434
Richard Hendersone6cd4bb2018-08-15 16:31:47 -07005435cmpxchg128=no
Eric Blakee633a5c2019-02-04 20:39:37 -06005436if test "$int128" = yes && test "$atomic128" = no; then
Richard Hendersone6cd4bb2018-08-15 16:31:47 -07005437 cat > $TMPC << EOF
5438int main(void)
5439{
5440 unsigned __int128 x = 0, y = 0;
5441 __sync_val_compare_and_swap_16(&x, y, x);
5442 return 0;
5443}
5444EOF
5445 if compile_prog "" "" ; then
5446 cmpxchg128=yes
5447 fi
5448fi
5449
Richard Hendersondf79b992016-09-02 12:23:57 -07005450#########################################
5451# See if 64-bit atomic operations are supported.
5452# Note that without __atomic builtins, we can only
5453# assume atomic loads/stores max at pointer size.
5454
5455cat > $TMPC << EOF
5456#include <stdint.h>
5457int main(void)
5458{
5459 uint64_t x = 0, y = 0;
5460#ifdef __ATOMIC_RELAXED
5461 y = __atomic_load_8(&x, 0);
5462 __atomic_store_8(&x, y, 0);
5463 __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
5464 __atomic_exchange_8(&x, y, 0);
5465 __atomic_fetch_add_8(&x, y, 0);
5466#else
5467 typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
5468 __sync_lock_test_and_set(&x, y);
5469 __sync_val_compare_and_swap(&x, y, 0);
5470 __sync_fetch_and_add(&x, y);
5471#endif
5472 return 0;
5473}
5474EOF
5475if compile_prog "" "" ; then
5476 atomic64=yes
5477fi
5478
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08005479########################################
Richard Hendersondb432672017-09-15 14:11:45 -07005480# See if 16-byte vector operations are supported.
5481# Even without a vector unit the compiler may expand these.
5482# There is a bug in old GCC for PPC that crashes here.
5483# Unfortunately it's the system compiler for Centos 7.
5484
5485cat > $TMPC << EOF
5486typedef unsigned char U1 __attribute__((vector_size(16)));
5487typedef unsigned short U2 __attribute__((vector_size(16)));
5488typedef unsigned int U4 __attribute__((vector_size(16)));
5489typedef unsigned long long U8 __attribute__((vector_size(16)));
5490typedef signed char S1 __attribute__((vector_size(16)));
5491typedef signed short S2 __attribute__((vector_size(16)));
5492typedef signed int S4 __attribute__((vector_size(16)));
5493typedef signed long long S8 __attribute__((vector_size(16)));
5494static U1 a1, b1;
5495static U2 a2, b2;
5496static U4 a4, b4;
5497static U8 a8, b8;
5498static S1 c1;
5499static S2 c2;
5500static S4 c4;
5501static S8 c8;
5502static int i;
Laurent Vivier74912f62018-03-28 15:31:52 +02005503void helper(void *d, void *a, int shift, int i);
5504void helper(void *d, void *a, int shift, int i)
5505{
5506 *(U1 *)(d + i) = *(U1 *)(a + i) << shift;
5507 *(U2 *)(d + i) = *(U2 *)(a + i) << shift;
5508 *(U4 *)(d + i) = *(U4 *)(a + i) << shift;
5509 *(U8 *)(d + i) = *(U8 *)(a + i) << shift;
5510}
Richard Hendersondb432672017-09-15 14:11:45 -07005511int main(void)
5512{
5513 a1 += b1; a2 += b2; a4 += b4; a8 += b8;
5514 a1 -= b1; a2 -= b2; a4 -= b4; a8 -= b8;
5515 a1 *= b1; a2 *= b2; a4 *= b4; a8 *= b8;
5516 a1 &= b1; a2 &= b2; a4 &= b4; a8 &= b8;
5517 a1 |= b1; a2 |= b2; a4 |= b4; a8 |= b8;
5518 a1 ^= b1; a2 ^= b2; a4 ^= b4; a8 ^= b8;
5519 a1 <<= i; a2 <<= i; a4 <<= i; a8 <<= i;
5520 a1 >>= i; a2 >>= i; a4 >>= i; a8 >>= i;
5521 c1 >>= i; c2 >>= i; c4 >>= i; c8 >>= i;
5522 return 0;
5523}
5524EOF
5525
5526vector16=no
5527if compile_prog "" "" ; then
5528 vector16=yes
5529fi
5530
5531########################################
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08005532# check if getauxval is available.
5533
5534getauxval=no
5535cat > $TMPC << EOF
5536#include <sys/auxv.h>
5537int main(void) {
5538 return getauxval(AT_HWCAP) == 0;
5539}
5540EOF
5541if compile_prog "" "" ; then
5542 getauxval=yes
5543fi
5544
John Snowfd0e6052015-03-25 18:57:39 -04005545########################################
5546# check if ccache is interfering with
5547# semantic analysis of macros
5548
John Snow5e4dfd32015-10-28 13:56:40 -04005549unset CCACHE_CPP2
John Snowfd0e6052015-03-25 18:57:39 -04005550ccache_cpp2=no
5551cat > $TMPC << EOF
5552static const int Z = 1;
5553#define fn() ({ Z; })
5554#define TAUT(X) ((X) == Z)
5555#define PAREN(X, Y) (X == Y)
5556#define ID(X) (X)
5557int main(int argc, char *argv[])
5558{
5559 int x = 0, y = 0;
5560 x = ID(x);
5561 x = fn();
5562 fn();
5563 if (PAREN(x, y)) return 0;
5564 if (TAUT(Z)) return 0;
5565 return 0;
5566}
5567EOF
5568
5569if ! compile_object "-Werror"; then
5570 ccache_cpp2=yes
5571fi
5572
John Snowb553a042015-11-03 15:43:42 -05005573#################################################
5574# clang does not support glibc + FORTIFY_SOURCE.
5575
5576if test "$fortify_source" != "no"; then
5577 if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
5578 fortify_source="no";
Peter Maydelle1890912017-06-26 16:25:24 +01005579 elif test -n "$cxx" && has $cxx &&
John Snowcfcc7c12015-11-12 11:29:49 -05005580 echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then
John Snowb553a042015-11-03 15:43:42 -05005581 fortify_source="no";
5582 else
5583 fortify_source="yes"
5584 fi
5585fi
5586
Fam Zheng1efad062018-06-01 17:26:43 +08005587###############################################
5588# Check if copy_file_range is provided by glibc
5589have_copy_file_range=no
5590cat > $TMPC << EOF
5591#include <unistd.h>
5592int main(void) {
5593 copy_file_range(0, NULL, 0, NULL, 0, 0);
5594 return 0;
5595}
5596EOF
5597if compile_prog "" "" ; then
5598 have_copy_file_range=yes
5599fi
5600
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05305601##########################################
Jan Vesely277abf12016-04-29 13:15:23 -04005602# check if struct fsxattr is available via linux/fs.h
5603
5604have_fsxattr=no
5605cat > $TMPC << EOF
5606#include <linux/fs.h>
5607struct fsxattr foo;
5608int main(void) {
5609 return 0;
5610}
5611EOF
5612if compile_prog "" "" ; then
5613 have_fsxattr=yes
5614fi
5615
Peter Maydellb66e10e2016-06-08 18:34:32 +01005616##########################################
Paolo Bonzinia40161c2018-02-16 10:05:23 +01005617# check for usable membarrier system call
5618if test "$membarrier" = "yes"; then
5619 have_membarrier=no
5620 if test "$mingw32" = "yes" ; then
5621 have_membarrier=yes
5622 elif test "$linux" = "yes" ; then
5623 cat > $TMPC << EOF
5624 #include <linux/membarrier.h>
5625 #include <sys/syscall.h>
5626 #include <unistd.h>
5627 #include <stdlib.h>
5628 int main(void) {
5629 syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0);
5630 syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0);
5631 exit(0);
5632 }
5633EOF
5634 if compile_prog "" "" ; then
5635 have_membarrier=yes
5636 fi
5637 fi
5638 if test "$have_membarrier" = "no"; then
5639 feature_not_found "membarrier" "membarrier system call not available"
5640 fi
5641else
5642 # Do not enable it by default even for Mingw32, because it doesn't
5643 # work on Wine.
5644 membarrier=no
5645fi
5646
5647##########################################
Peter Maydellb66e10e2016-06-08 18:34:32 +01005648# check if rtnetlink.h exists and is useful
Laurent Vivier575b22b2016-06-02 22:14:15 +02005649have_rtnetlink=no
5650cat > $TMPC << EOF
5651#include <linux/rtnetlink.h>
5652int main(void) {
5653 return IFLA_PROTO_DOWN;
5654}
5655EOF
5656if compile_prog "" "" ; then
5657 have_rtnetlink=yes
5658fi
5659
Stefan Hajnoczi6a02c802016-10-14 10:00:55 +01005660##########################################
5661# check for usable AF_VSOCK environment
5662have_af_vsock=no
5663cat > $TMPC << EOF
5664#include <errno.h>
5665#include <sys/types.h>
5666#include <sys/socket.h>
5667#if !defined(AF_VSOCK)
5668# error missing AF_VSOCK flag
5669#endif
5670#include <linux/vm_sockets.h>
5671int main(void) {
5672 int sock, ret;
5673 struct sockaddr_vm svm;
5674 socklen_t len = sizeof(svm);
5675 sock = socket(AF_VSOCK, SOCK_STREAM, 0);
5676 ret = getpeername(sock, (struct sockaddr *)&svm, &len);
5677 if ((ret == -1) && (errno == ENOTCONN)) {
5678 return 0;
5679 }
5680 return -1;
5681}
5682EOF
5683if compile_prog "" "" ; then
5684 have_af_vsock=yes
5685fi
5686
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04005687##########################################
5688# check for usable AF_ALG environment
5689hava_afalg=no
5690cat > $TMPC << EOF
5691#include <errno.h>
5692#include <sys/types.h>
5693#include <sys/socket.h>
5694#include <linux/if_alg.h>
5695int main(void) {
5696 int sock;
5697 sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
5698 return sock;
5699}
5700EOF
5701if compile_prog "" "" ; then
5702 have_afalg=yes
5703fi
5704if test "$crypto_afalg" = "yes"
5705then
5706 if test "$have_afalg" != "yes"
5707 then
5708 error_exit "AF_ALG requested but could not be detected"
5709 fi
5710fi
5711
5712
James Clarke6969ec62016-06-06 12:02:50 +01005713#################################################
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05005714# Check to see if we have the Hypervisor framework
Peter Maydelld2d08522018-01-08 17:10:42 +00005715if [ "$darwin" = "yes" ] ; then
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05005716 cat > $TMPC << EOF
5717#include <Hypervisor/hv.h>
5718int main() { return 0;}
5719EOF
5720 if ! compile_object ""; then
5721 hvf='no'
5722 else
5723 hvf='yes'
5724 LDFLAGS="-framework Hypervisor $LDFLAGS"
5725 fi
5726fi
5727
5728#################################################
James Clarke6969ec62016-06-06 12:02:50 +01005729# Sparc implicitly links with --relax, which is
5730# incompatible with -r, so --no-relax should be
5731# given. It does no harm to give it on other
5732# platforms too.
5733
5734# Note: the prototype is needed since QEMU_CFLAGS
5735# contains -Wmissing-prototypes
5736cat > $TMPC << EOF
5737extern int foo(void);
5738int foo(void) { return 0; }
5739EOF
5740if ! compile_object ""; then
5741 error_exit "Failed to compile object file for LD_REL_FLAGS test"
5742fi
Paolo Bonzini7ecf44a2016-11-29 16:37:20 +01005743for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do
5744 if do_cc -nostdlib $i -o $TMPMO $TMPO; then
5745 LD_REL_FLAGS=$i
5746 break
5747 fi
5748done
5749if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then
5750 feature_not_found "modules" "Cannot find how to build relocatable objects"
James Clarke6969ec62016-06-06 12:02:50 +01005751fi
5752
Jan Vesely277abf12016-04-29 13:15:23 -04005753##########################################
Christopher Covington4d043512016-12-28 15:04:33 -05005754# check for sysmacros.h
5755
5756have_sysmacros=no
5757cat > $TMPC << EOF
5758#include <sys/sysmacros.h>
5759int main(void) {
5760 return makedev(0, 0);
5761}
5762EOF
5763if compile_prog "" "" ; then
5764 have_sysmacros=yes
5765fi
5766
5767##########################################
Ashish Mittalda92c3f2017-04-03 20:48:08 -07005768# Veritas HyperScale block driver VxHS
5769# Check if libvxhs is installed
5770
5771if test "$vxhs" != "no" ; then
5772 cat > $TMPC <<EOF
5773#include <stdint.h>
5774#include <qnio/qnio_api.h>
5775
5776void *vxhs_callback;
5777
5778int main(void) {
5779 iio_init(QNIO_VERSION, vxhs_callback);
5780 return 0;
5781}
5782EOF
5783 vxhs_libs="-lvxhs -lssl"
5784 if compile_prog "" "$vxhs_libs" ; then
5785 vxhs=yes
5786 else
5787 if test "$vxhs" = "yes" ; then
5788 feature_not_found "vxhs block device" "Install libvxhs See github"
5789 fi
5790 vxhs=no
5791 fi
5792fi
5793
5794##########################################
Andreas Grapentin49e00a12017-03-14 17:59:53 +01005795# check for _Static_assert()
5796
5797have_static_assert=no
5798cat > $TMPC << EOF
5799_Static_assert(1, "success");
5800int main(void) {
5801 return 0;
5802}
5803EOF
5804if compile_prog "" "" ; then
5805 have_static_assert=yes
5806fi
5807
5808##########################################
Tomáš Golembiovskýe6746052017-07-17 15:58:33 +02005809# check for utmpx.h, it is missing e.g. on OpenBSD
5810
5811have_utmpx=no
5812cat > $TMPC << EOF
5813#include <utmpx.h>
5814struct utmpx user_info;
5815int main(void) {
5816 return 0;
5817}
5818EOF
5819if compile_prog "" "" ; then
5820 have_utmpx=yes
5821fi
5822
5823##########################################
Richard Hendersondb1ed1a2019-03-13 20:57:28 -07005824# check for getrandom()
5825
5826have_getrandom=no
5827cat > $TMPC << EOF
5828#include <sys/random.h>
5829int main(void) {
5830 return getrandom(0, 0, GRND_NONBLOCK);
5831}
5832EOF
5833if compile_prog "" "" ; then
5834 have_getrandom=yes
5835fi
5836
5837##########################################
Marc-André Lureau247724c2018-01-16 16:11:51 +01005838# checks for sanitizers
5839
Marc-André Lureau247724c2018-01-16 16:11:51 +01005840have_asan=no
5841have_ubsan=no
Marc-André Lureaud83414e2018-01-16 16:11:52 +01005842have_asan_iface_h=no
5843have_asan_iface_fiber=no
Marc-André Lureau247724c2018-01-16 16:11:51 +01005844
5845if test "$sanitizers" = "yes" ; then
Marc-André Lureaub9f44da2018-02-15 22:25:47 +01005846 write_c_skeleton
Marc-André Lureau247724c2018-01-16 16:11:51 +01005847 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then
5848 have_asan=yes
5849 fi
Marc-André Lureaub9f44da2018-02-15 22:25:47 +01005850
5851 # we could use a simple skeleton for flags checks, but this also
5852 # detect the static linking issue of ubsan, see also:
5853 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
5854 cat > $TMPC << EOF
5855#include <stdlib.h>
5856int main(void) {
5857 void *tmp = malloc(10);
5858 return *(int *)(tmp + 2);
5859}
5860EOF
Marc-André Lureau247724c2018-01-16 16:11:51 +01005861 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
5862 have_ubsan=yes
5863 fi
Marc-André Lureaud83414e2018-01-16 16:11:52 +01005864
5865 if check_include "sanitizer/asan_interface.h" ; then
5866 have_asan_iface_h=yes
5867 fi
5868
5869 cat > $TMPC << EOF
5870#include <sanitizer/asan_interface.h>
5871int main(void) {
5872 __sanitizer_start_switch_fiber(0, 0, 0);
5873 return 0;
5874}
5875EOF
5876 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then
5877 have_asan_iface_fiber=yes
5878 fi
Marc-André Lureau247724c2018-01-16 16:11:51 +01005879fi
5880
5881##########################################
Junyan He17824402018-07-18 15:47:59 +08005882# check for libpmem
5883
5884if test "$libpmem" != "no"; then
5885 if $pkg_config --exists "libpmem"; then
5886 libpmem="yes"
5887 libpmem_libs=$($pkg_config --libs libpmem)
5888 libpmem_cflags=$($pkg_config --cflags libpmem)
5889 libs_softmmu="$libs_softmmu $libpmem_libs"
5890 QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags"
5891 else
5892 if test "$libpmem" = "yes" ; then
5893 feature_not_found "libpmem" "Install nvml or pmdk"
5894 fi
5895 libpmem="no"
5896 fi
5897fi
5898
5899##########################################
Marc-André Lureau675b9b52019-02-12 17:25:23 +01005900# check for slirp
5901
5902case "$slirp" in
5903 "" | yes)
5904 if $pkg_config slirp; then
5905 slirp=system
Marc-André Lureau7c57bdd2019-04-24 13:00:41 +02005906 elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
5907 slirp=git
Marc-André Lureau675b9b52019-02-12 17:25:23 +01005908 elif test -e "${source_path}/slirp/Makefile" ; then
5909 slirp=internal
5910 elif test -z "$slirp" ; then
5911 slirp=no
5912 else
5913 feature_not_found "slirp" "Install slirp devel or git submodule"
5914 fi
5915 ;;
5916
5917 system)
5918 if ! $pkg_config slirp; then
5919 feature_not_found "slirp" "Install slirp devel"
5920 fi
5921 ;;
5922esac
5923
5924case "$slirp" in
Marc-André Lureau7c57bdd2019-04-24 13:00:41 +02005925 git | internal)
5926 if test "$slirp" = git; then
5927 git_submodules="${git_submodules} slirp"
5928 fi
Marc-André Lureau675b9b52019-02-12 17:25:23 +01005929 mkdir -p slirp
5930 slirp_cflags="-I\$(SRC_PATH)/slirp/src -I\$(BUILD_DIR)/slirp/src"
5931 slirp_libs="-L\$(BUILD_DIR)/slirp -lslirp"
5932 ;;
5933
5934 system)
5935 slirp_version=$($pkg_config --modversion slirp 2>/dev/null)
5936 slirp_cflags=$($pkg_config --cflags slirp 2>/dev/null)
5937 slirp_libs=$($pkg_config --libs slirp 2>/dev/null)
5938 ;;
5939
5940 no)
5941 ;;
5942 *)
5943 error_exit "Unknown state for slirp: $slirp"
5944 ;;
5945esac
5946
5947
5948##########################################
Juan Quintelae86ecd42009-08-03 14:45:59 +02005949# End of CC checks
5950# After here, no more $cc or $ld runs
5951
Marc-André Lureaud83414e2018-01-16 16:11:52 +01005952write_c_skeleton
5953
Blue Swirl1d728c32012-05-01 18:45:39 +00005954if test "$gcov" = "yes" ; then
5955 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
5956 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
John Snowb553a042015-11-03 15:43:42 -05005957elif test "$fortify_source" = "yes" ; then
Michal Privoznike600cdf2013-09-05 12:54:49 +02005958 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
Paolo Bonzini48e56d52018-03-06 11:32:44 +01005959elif test "$debug" = "no"; then
5960 CFLAGS="-O2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02005961fi
Juan Quintelaa316e372009-09-30 01:10:55 +02005962
Marc-André Lureau247724c2018-01-16 16:11:51 +01005963if test "$have_asan" = "yes"; then
5964 CFLAGS="-fsanitize=address $CFLAGS"
Marc-André Lureaud83414e2018-01-16 16:11:52 +01005965 if test "$have_asan_iface_h" = "no" ; then
5966 echo "ASAN build enabled, but ASAN header missing." \
5967 "Without code annotation, the report may be inferior."
5968 elif test "$have_asan_iface_fiber" = "no" ; then
5969 echo "ASAN build enabled, but ASAN header is too old." \
5970 "Without code annotation, the report may be inferior."
5971 fi
Marc-André Lureau247724c2018-01-16 16:11:51 +01005972fi
5973if test "$have_ubsan" = "yes"; then
5974 CFLAGS="-fsanitize=undefined $CFLAGS"
5975fi
5976
Peter Lieven6542aa92014-02-03 10:26:13 +01005977##########################################
5978# Do we have libnfs
5979if test "$libnfs" != "no" ; then
Peter Lievenb7d769c2014-03-17 09:37:33 +01005980 if $pkg_config --atleast-version=1.9.3 libnfs; then
Peter Lieven6542aa92014-02-03 10:26:13 +01005981 libnfs="yes"
5982 libnfs_libs=$($pkg_config --libs libnfs)
Peter Lieven6542aa92014-02-03 10:26:13 +01005983 else
5984 if test "$libnfs" = "yes" ; then
Hu Tao8efc9362014-06-26 17:34:50 +08005985 feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
Peter Lieven6542aa92014-02-03 10:26:13 +01005986 fi
5987 libnfs="no"
5988 fi
5989fi
Blue Swirl1d728c32012-05-01 18:45:39 +00005990
Tomáš Golembiovský3efac6e2018-10-23 13:23:10 +02005991##########################################
5992# Do we have libudev
5993if test "$libudev" != "no" ; then
5994 if $pkg_config libudev && test "$static" != "yes"; then
5995 libudev="yes"
5996 libudev_libs=$($pkg_config --libs libudev)
5997 else
5998 libudev="no"
5999 fi
6000fi
6001
Peter Maydell6ca026c2012-07-18 15:10:18 +01006002# Now we've finished running tests it's OK to add -Werror to the compiler flags
6003if test "$werror" = "yes"; then
6004 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
6005fi
6006
Juan Quintelae86ecd42009-08-03 14:45:59 +02006007if test "$solaris" = "no" ; then
6008 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02006009 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02006010 fi
6011fi
6012
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02006013# test if pod2man has --utf8 option
6014if pod2man --help | grep -q utf8; then
6015 POD2MAN="pod2man --utf8"
6016else
6017 POD2MAN="pod2man"
6018fi
6019
Blue Swirl952afb72010-09-19 08:36:34 +00006020# Use ASLR, no-SEH and DEP if available
6021if test "$mingw32" = "yes" ; then
6022 for flag in --dynamicbase --no-seh --nxcompat; do
Christian Borntraegere9a35912017-08-23 12:16:23 +02006023 if ld_has $flag ; then
Blue Swirl952afb72010-09-19 08:36:34 +00006024 LDFLAGS="-Wl,$flag $LDFLAGS"
6025 fi
6026 done
6027fi
6028
Philippe Mathieu-Daudé7776ea62019-03-07 15:28:22 +01006029# Disable OpenBSD W^X if available
6030if test "$tcg" = "yes" && test "$targetos" = "OpenBSD"; then
6031 cat > $TMPC <<EOF
6032 int main(void) { return 0; }
6033EOF
6034 wx_ldflags="-Wl,-z,wxneeded"
6035 if compile_prog "" "$wx_ldflags"; then
6036 QEMU_LDFLAGS="$QEMU_LDFLAGS $wx_ldflags"
6037 fi
6038fi
6039
Eduardo Habkost10ea68b2012-04-18 16:55:39 -03006040qemu_confdir=$sysconfdir$confsuffix
Fam Zhenge26110c2014-02-10 14:48:57 +08006041qemu_moddir=$libdir$confsuffix
Eduardo Habkost528ae5b2012-04-18 16:55:49 -03006042qemu_datadir=$datadir$confsuffix
Anthony Liguori834574e2013-02-20 07:43:24 -06006043qemu_localedir="$datadir/locale"
Daniel P. Berrangéa8260d32019-01-10 12:00:45 +00006044qemu_icondir="$datadir/icons"
Daniel P. Berrangé67ea9542019-01-10 12:00:46 +00006045qemu_desktopdir="$datadir/applications"
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02006046
Kamil Rytarowskie0580342017-07-14 09:33:44 +01006047# We can only support ivshmem if we have eventfd
6048if [ "$eventfd" = "yes" ]; then
6049 ivshmem=yes
6050fi
6051
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01006052tools=""
6053if test "$want_tools" = "yes" ; then
Gerd Hoffmann72d277a2018-09-25 09:56:42 +02006054 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) qemu-edid\$(EXESUF) $tools"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01006055 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
6056 tools="qemu-nbd\$(EXESUF) $tools"
Kamil Rytarowskib1449ed2017-07-14 09:33:45 +01006057 fi
6058 if [ "$ivshmem" = "yes" ]; then
David Marchanda75eb032014-09-08 11:17:48 +02006059 tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01006060 fi
Viktor Prutyanov1b9d35f2018-12-20 04:24:41 +03006061 if [ "$curl" = "yes" ]; then
6062 tools="elf2dmp\$(EXESUF) $tools"
Viktor Prutyanov3fa2d382018-08-29 15:41:25 +03006063 fi
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01006064fi
6065if test "$softmmu" = yes ; then
Paolo Bonzinib855f8d2017-08-22 06:50:18 +02006066 if test "$linux" = yes; then
6067 if test "$virtfs" != no && test "$cap" = yes && test "$attr" = yes ; then
Andreas Färberaabfd882012-05-01 01:12:02 +02006068 virtfs=yes
6069 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
6070 else
6071 if test "$virtfs" = yes; then
Paolo Bonzinib855f8d2017-08-22 06:50:18 +02006072 error_exit "VirtFS requires libcap devel and libattr devel"
Meador Inge983eef52012-02-24 14:00:42 +05306073 fi
Andreas Färber17500372012-05-01 01:12:03 +02006074 virtfs=no
Andreas Färberaabfd882012-05-01 01:12:02 +02006075 fi
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02006076 if test "$mpath" != no && test "$mpathpersist" = yes ; then
6077 mpath=yes
6078 else
6079 if test "$mpath" = yes; then
6080 error_exit "Multipath requires libmpathpersist devel"
6081 fi
6082 mpath=no
6083 fi
Paolo Bonzinib855f8d2017-08-22 06:50:18 +02006084 tools="$tools scsi/qemu-pr-helper\$(EXESUF)"
6085 else
6086 if test "$virtfs" = yes; then
6087 error_exit "VirtFS is supported only on Linux"
6088 fi
6089 virtfs=no
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02006090 if test "$mpath" = yes; then
6091 error_exit "Multipath is supported only on Linux"
6092 fi
6093 mpath=no
M. Mohan Kumar17bff522011-12-14 13:58:42 +05306094 fi
Laurent Vivierff69fd82017-10-19 21:16:06 +02006095 if test "$xkbcommon" = "yes"; then
6096 tools="qemu-keymap\$(EXESUF) $tools"
6097 fi
Gerd Hoffmann6a021532017-10-05 17:33:28 +02006098fi
Michael Roth9d6bc272015-08-26 10:49:13 -05006099
6100# Probe for guest agent support/options
6101
Michael Tokareve8ef31a2013-07-31 14:22:07 +04006102if [ "$guest_agent" != "no" ]; then
Laurent Viviera5125902019-04-01 16:12:20 +02006103 if [ "$softmmu" = no -a "$want_tools" = no ] ; then
6104 guest_agent=no
6105 elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
Paolo Bonzini08144652019-07-18 12:22:01 +02006106 tools="qemu-ga\$(EXESUF) $tools"
Michael Tokareve8ef31a2013-07-31 14:22:07 +04006107 guest_agent=yes
6108 elif [ "$guest_agent" != yes ]; then
6109 guest_agent=no
6110 else
6111 error_exit "Guest agent is not supported on this platform"
Paolo Bonzinica35f782010-05-26 16:08:29 +02006112 fi
Paolo Bonzini00c705f2012-05-29 11:40:24 +02006113fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02006114
Michael Roth9d6bc272015-08-26 10:49:13 -05006115# Guest agent Window MSI package
6116
6117if test "$guest_agent" != yes; then
6118 if test "$guest_agent_msi" = yes; then
6119 error_exit "MSI guest agent package requires guest agent enabled"
6120 fi
6121 guest_agent_msi=no
6122elif test "$mingw32" != "yes"; then
6123 if test "$guest_agent_msi" = "yes"; then
6124 error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation"
6125 fi
6126 guest_agent_msi=no
6127elif ! has wixl; then
6128 if test "$guest_agent_msi" = "yes"; then
6129 error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )"
6130 fi
6131 guest_agent_msi=no
Michael Roth1a349042015-08-26 11:14:31 -05006132else
6133 # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't
6134 # disabled explicitly
6135 if test "$guest_agent_msi" != "no"; then
6136 guest_agent_msi=yes
6137 fi
Michael Roth9d6bc272015-08-26 10:49:13 -05006138fi
6139
Michael Roth1a349042015-08-26 11:14:31 -05006140if test "$guest_agent_msi" = "yes"; then
Michael Roth9d6bc272015-08-26 10:49:13 -05006141 if test "$guest_agent_with_vss" = "yes"; then
6142 QEMU_GA_MSI_WITH_VSS="-D InstallVss"
6143 fi
6144
6145 if test "$QEMU_GA_MANUFACTURER" = ""; then
6146 QEMU_GA_MANUFACTURER=QEMU
6147 fi
6148
6149 if test "$QEMU_GA_DISTRO" = ""; then
6150 QEMU_GA_DISTRO=Linux
6151 fi
6152
6153 if test "$QEMU_GA_VERSION" = ""; then
Stefan Weil89138852016-05-16 15:10:20 +02006154 QEMU_GA_VERSION=$(cat $source_path/VERSION)
Michael Roth9d6bc272015-08-26 10:49:13 -05006155 fi
6156
Stefan Weil89138852016-05-16 15:10:20 +02006157 QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin"
Michael Roth9d6bc272015-08-26 10:49:13 -05006158
6159 case "$cpu" in
6160 x86_64)
6161 QEMU_GA_MSI_ARCH="-a x64 -D Arch=64"
6162 ;;
6163 i386)
6164 QEMU_GA_MSI_ARCH="-D Arch=32"
6165 ;;
6166 *)
6167 error_exit "CPU $cpu not supported for building installation package"
6168 ;;
6169 esac
6170fi
6171
Paolo Bonzinica35f782010-05-26 16:08:29 +02006172# Mac OS X ships with a broken assembler
6173roms=
Eric Blakee633a5c2019-02-04 20:39:37 -06006174if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \
6175 test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \
6176 test "$softmmu" = yes ; then
Peter Maydelle57218b2016-08-08 17:11:28 +01006177 # Different host OS linkers have different ideas about the name of the ELF
Brad Smithc65d5e42017-11-07 18:46:11 -05006178 # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
6179 # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
6180 for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do
Peter Maydelle57218b2016-08-08 17:11:28 +01006181 if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
6182 ld_i386_emulation="$emu"
6183 roms="optionrom"
6184 break
6185 fi
6186 done
Paolo Bonzinica35f782010-05-26 16:08:29 +02006187fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02006188
Thomas Huth2e33c3f2019-01-14 13:52:26 +01006189# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900
Christian Borntraeger9933c302013-04-23 01:23:03 +00006190if test "$cpu" = "s390x" ; then
Thomas Huth2e33c3f2019-01-14 13:52:26 +01006191 write_c_skeleton
6192 if compile_prog "-march=z900" ""; then
6193 roms="$roms s390-ccw"
6194 fi
Christian Borntraeger9933c302013-04-23 01:23:03 +00006195fi
6196
Richard Henderson964c6fa2013-06-21 19:10:16 -07006197# Probe for the need for relocating the user-only binary.
Peter Maydell92fe2ba2016-06-18 23:05:01 +01006198if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
Richard Henderson964c6fa2013-06-21 19:10:16 -07006199 textseg_addr=
6200 case "$cpu" in
Richard Henderson479eb122014-04-24 08:25:03 -07006201 arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
6202 # ??? Rationale for choosing this address
Richard Henderson964c6fa2013-06-21 19:10:16 -07006203 textseg_addr=0x60000000
6204 ;;
6205 mips)
Richard Henderson479eb122014-04-24 08:25:03 -07006206 # A 256M aligned address, high in the address space, with enough
6207 # room for the code_gen_buffer above it before the stack.
6208 textseg_addr=0x60000000
Richard Henderson964c6fa2013-06-21 19:10:16 -07006209 ;;
6210 esac
6211 if [ -n "$textseg_addr" ]; then
6212 cat > $TMPC <<EOF
6213 int main(void) { return 0; }
6214EOF
6215 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
6216 if ! compile_prog "" "$textseg_ldflags"; then
6217 # In case ld does not support -Ttext-segment, edit the default linker
6218 # script via sed to set the .text start addr. This is needed on FreeBSD
6219 # at least.
Peter Maydell92fe2ba2016-06-18 23:05:01 +01006220 if ! $ld --verbose >/dev/null 2>&1; then
6221 error_exit \
6222 "We need to link the QEMU user mode binaries at a" \
6223 "specific text address. Unfortunately your linker" \
6224 "doesn't support either the -Ttext-segment option or" \
6225 "printing the default linker script with --verbose." \
6226 "If you don't want the user mode binaries, pass the" \
6227 "--disable-user option to configure."
6228 fi
6229
Richard Henderson964c6fa2013-06-21 19:10:16 -07006230 $ld --verbose | sed \
6231 -e '1,/==================================================/d' \
6232 -e '/==================================================/,$d' \
6233 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
6234 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
6235 textseg_ldflags="-Wl,-T../config-host.ld"
6236 fi
6237 fi
6238fi
6239
Bruno Dominguez11cde1c2017-06-06 14:07:47 +01006240# Check that the C++ compiler exists and works with the C compiler.
6241# All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
6242if has $cxx; then
6243 cat > $TMPC <<EOF
6244int c_function(void);
6245int main(void) { return c_function(); }
6246EOF
6247
6248 compile_object
6249
6250 cat > $TMPCXX <<EOF
6251extern "C" {
6252 int c_function(void);
6253}
6254int c_function(void) { return 42; }
6255EOF
6256
6257 update_cxxflags
6258
6259 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
6260 # C++ compiler $cxx works ok with C compiler $cc
6261 :
6262 else
6263 echo "C++ compiler $cxx does not work with C compiler $cc"
6264 echo "Disabling C++ specific optional code"
6265 cxx=
6266 fi
6267else
6268 echo "No C++ compiler available; disabling C++ specific optional code"
6269 cxx=
6270fi
6271
Cole Robinson02d34f62016-05-06 14:03:09 -04006272echo_version() {
6273 if test "$1" = "yes" ; then
6274 echo "($2)"
6275 fi
6276}
6277
Jan Kiszka50e12062014-10-02 10:03:55 +02006278# prepend pixman and ftd flags after all config tests are done
6279QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
Philippe Mathieu-Daudé8a99e9a2018-04-15 20:05:19 -03006280QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS"
Jan Kiszka50e12062014-10-02 10:03:55 +02006281libs_softmmu="$pixman_libs $libs_softmmu"
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01006282
bellard43ce4df2003-06-09 19:53:12 +00006283echo "Install prefix $prefix"
Stefan Weil89138852016-05-16 15:10:20 +02006284echo "BIOS directory $(eval echo $qemu_datadir)"
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +02006285echo "firmware path $(eval echo $firmwarepath)"
Stefan Weil89138852016-05-16 15:10:20 +02006286echo "binary directory $(eval echo $bindir)"
6287echo "library directory $(eval echo $libdir)"
6288echo "module directory $(eval echo $qemu_moddir)"
6289echo "libexec directory $(eval echo $libexecdir)"
6290echo "include directory $(eval echo $includedir)"
6291echo "config directory $(eval echo $sysconfdir)"
bellard11d9f692004-04-02 20:55:59 +00006292if test "$mingw32" = "no" ; then
Stefan Weil89138852016-05-16 15:10:20 +02006293echo "local state directory $(eval echo $local_statedir)"
6294echo "Manual directory $(eval echo $mandir)"
bellard43ce4df2003-06-09 19:53:12 +00006295echo "ELF interp prefix $interp_prefix"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02006296else
6297echo "local state directory queried at runtime"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04006298echo "Windows SDK $win_sdk"
bellard11d9f692004-04-02 20:55:59 +00006299fi
bellard5a671352003-10-01 00:13:48 +00006300echo "Source path $source_path"
Daniel P. Berrangecc84d632017-10-20 15:02:43 +01006301echo "GIT binary $git"
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01006302echo "GIT submodules $git_submodules"
bellard43ce4df2003-06-09 19:53:12 +00006303echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00006304echo "Host C compiler $host_cc"
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04006305echo "C++ compiler $cxx"
Peter Maydell3c4a4d02012-08-11 22:34:40 +01006306echo "Objective-C compiler $objcc"
Peter Maydell45d285a2013-10-21 21:03:06 +01006307echo "ARFLAGS $ARFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02006308echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02006309echo "QEMU_CFLAGS $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02006310echo "LDFLAGS $LDFLAGS"
Philippe Mathieu-Daudé8a99e9a2018-04-15 20:05:19 -03006311echo "QEMU_LDFLAGS $QEMU_LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00006312echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00006313echo "install $install"
Cleber Rosa755ee702018-11-09 10:07:07 -05006314echo "python $python ($python_version)"
Marc-André Lureau675b9b52019-02-12 17:25:23 +01006315echo "slirp support $slirp $(echo_version $slirp $slirp_version)"
6316if test "$slirp" != "no" ; then
Brade2d88302011-09-02 16:53:28 -04006317 echo "smbd $smbd"
6318fi
Fam Zheng17969262014-02-10 14:48:56 +08006319echo "module support $modules"
bellard43ce4df2003-06-09 19:53:12 +00006320echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00006321echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00006322echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00006323echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00006324echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00006325echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00006326echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00006327echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +00006328if test "$darwin" = "yes" ; then
6329 echo "Cocoa support $cocoa"
6330fi
Stefan Weil89138852016-05-16 15:10:20 +02006331echo "SDL support $sdl $(echo_version $sdl $sdlversion)"
Daniel P. Berrangéa442fe22019-01-10 12:00:47 +00006332echo "SDL image support $sdl_image"
Stefan Weil89138852016-05-16 15:10:20 +02006333echo "GTK support $gtk $(echo_version $gtk $gtk_version)"
Gerd Hoffmann925a0402015-05-26 12:26:21 +02006334echo "GTK GL support $gtk_gl"
Stefan Weil89138852016-05-16 15:10:20 +02006335echo "VTE support $vte $(echo_version $vte $vteversion)"
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +01006336echo "TLS priority $tls_priority"
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01006337echo "GNUTLS support $gnutls"
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01006338echo "libgcrypt $gcrypt"
Stefan Weil89138852016-05-16 15:10:20 +02006339echo "nettle $nettle $(echo_version $nettle $nettle_version)"
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01006340echo "libtasn1 $tasn1"
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01006341echo "PAM $auth_pam"
Samuel Thibaulte08bb302019-03-11 14:51:26 +01006342echo "iconv support $iconv"
balrog4d3b6f62008-02-10 16:33:14 +00006343echo "curses support $curses"
Marc-André Lureau47479c52018-05-25 17:36:09 +02006344echo "virgl support $virglrenderer $(echo_version $virglrenderer $virgl_version)"
Alexander Graf769ce762009-05-11 17:41:42 +02006345echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00006346echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00006347echo "Audio drivers $audio_drv_list"
Fam Zhengb64ec4e2013-05-29 19:35:40 +08006348echo "Block whitelist (rw) $block_drv_rw_whitelist"
6349echo "Block whitelist (ro) $block_drv_ro_whitelist"
Meador Inge983eef52012-02-24 14:00:42 +05306350echo "VirtFS support $virtfs"
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02006351echo "Multipath support $mpath"
Jes Sorensen821601e2011-03-16 13:33:36 +01006352echo "VNC support $vnc"
6353if test "$vnc" = "yes" ; then
Jes Sorensen821601e2011-03-16 13:33:36 +01006354 echo "VNC SASL support $vnc_sasl"
6355 echo "VNC JPEG support $vnc_jpeg"
6356 echo "VNC PNG support $vnc_png"
Jes Sorensen821601e2011-03-16 13:33:36 +01006357fi
aliguorie37630c2009-04-22 15:19:10 +00006358echo "xen support $xen"
Paul Durrant3996e852015-01-20 11:06:19 +00006359if test "$xen" = "yes" ; then
6360 echo "xen ctrl version $xen_ctrl_version"
6361fi
aurel322e4d9fb2008-04-08 06:01:02 +00006362echo "brlapi support $brlapi"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02006363echo "bluez support $bluez"
Juan Quintelaa25dba12009-08-12 18:29:52 +02006364echo "Documentation $docs"
Avi Kivity40d64442011-11-15 20:12:17 +02006365echo "PIE $pie"
ths8a16d272008-07-19 09:56:24 +00006366echo "vde support $vde"
Vincenzo Maffione58952132013-11-06 11:44:06 +01006367echo "netmap support $netmap"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02006368echo "Linux AIO support $linux_aio"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07006369echo "ATTR/XATTR support $attr"
ths77755342008-11-27 15:45:16 +00006370echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02006371echo "KVM support $kvm"
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01006372echo "HAX support $hax"
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05006373echo "HVF support $hvf"
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08006374echo "WHPX support $whpx"
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +02006375echo "TCG support $tcg"
6376if test "$tcg" = "yes" ; then
6377 echo "TCG debug enabled $debug_tcg"
6378 echo "TCG interpreter $tcg_interpreter"
6379fi
Yang Zhong5a22ab72017-12-20 21:16:46 +08006380echo "malloc trim support $malloc_trim"
Michael R. Hines2da776d2013-07-22 10:01:54 -04006381echo "RDMA support $rdma"
Marcel Apfelbaum21ab34c2018-08-16 18:16:37 +03006382echo "PVRDMA support $pvrdma"
aurel32f652e6a2008-12-16 10:43:48 +00006383echo "fdt support $fdt"
Paolo Bonzinia40161c2018-02-16 10:05:23 +01006384echo "membarrier $membarrier"
aliguoriceb42de2009-04-07 18:43:28 +00006385echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00006386echo "fdatasync $fdatasync"
Andreas Färbere78815a2010-09-25 11:26:05 +00006387echo "madvise $madvise"
6388echo "posix_madvise $posix_madvise"
Andreas Gustafsson9bc5a712018-01-04 19:39:36 +02006389echo "posix_memalign $posix_memalign"
Corey Bryant47e98652012-01-26 09:42:26 -05006390echo "libcap-ng support $cap_ng"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02006391echo "vhost-net support $vhost_net"
Gonglei042cea22018-03-01 21:46:28 +08006392echo "vhost-crypto support $vhost_crypto"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00006393echo "vhost-scsi support $vhost_scsi"
Stefan Hajnoczifc0b9b02016-08-16 13:27:22 +01006394echo "vhost-vsock support $vhost_vsock"
Marc-André Lureaue6a74862017-08-03 11:07:46 +02006395echo "vhost-user support $vhost_user"
Dr. David Alan Gilbert98fc1ad2019-09-30 11:51:34 +01006396echo "vhost-user-fs support $vhost_user_fs"
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +02006397echo "Trace backends $trace_backends"
Marc-André Lureau713572a2015-12-10 01:47:46 +01006398if have_backend "simple"; then
Prerna Saxena9410b562010-07-13 09:26:32 +01006399echo "Trace output file $trace_file-<pid>"
Stefan Weile00e36f2014-03-14 21:09:10 +01006400fi
Stefan Weil89138852016-05-16 15:10:20 +02006401echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01006402echo "rbd support $rbd"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01006403echo "xfsctl support $xfs"
Marc-André Lureau7b02f542015-08-30 11:48:40 +02006404echo "smartcard support $smartcard"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01006405echo "libusb $libusb"
Hans de Goede69354a82011-07-19 11:04:10 +02006406echo "usb net redir $usb_redir"
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01006407echo "OpenGL support $opengl"
Gerd Hoffmann014cb152015-12-03 12:56:34 +01006408echo "OpenGL dmabufs $opengl_dmabuf"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11006409echo "libiscsi support $libiscsi"
Peter Lieven6542aa92014-02-03 10:26:13 +01006410echo "libnfs support $libnfs"
Michael Rothd138cee2011-08-01 14:52:57 -05006411echo "build guest agent $guest_agent"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04006412echo "QGA VSS support $guest_agent_with_vss"
Michael Roth50cbebb2015-07-07 18:10:09 -05006413echo "QGA w32 disk info $guest_agent_ntddscsi"
Michael Roth4c875d82015-08-25 15:46:18 -05006414echo "QGA MSI support $guest_agent_msi"
Eduardo Otubof7945732012-08-14 18:44:05 -03006415echo "seccomp support $seccomp"
Peter Maydell7c2acc72013-04-08 12:11:27 +01006416echo "coroutine backend $coroutine"
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02006417echo "coroutine pool $coroutine_pool"
Peter Lieven7d992e42016-09-27 11:58:45 +02006418echo "debug stack usage $debug_stack_usage"
Paolo Bonziniba59fb72018-06-13 14:23:08 +02006419echo "mutex debugging $debug_mutex"
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04006420echo "crypto afalg $crypto_afalg"
Bharata B Raoeb100392012-09-24 14:42:45 +05306421echo "GlusterFS support $glusterfs"
Blue Swirl1d728c32012-05-01 18:45:39 +00006422echo "gcov $gcov_tool"
6423echo "gcov enabled $gcov"
Stefan Bergerab214c22013-02-27 12:47:52 -05006424echo "TPM support $tpm"
Pino Toscanob10d49d2019-06-20 22:08:40 +02006425echo "libssh support $libssh"
Paolo Bonzini3556c232013-05-10 14:16:40 +02006426echo "QOM debugging $qom_cast_debug"
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +01006427echo "Live block migration $live_block_migration"
qiaonuohan607dacd2014-02-18 14:11:30 +08006428echo "lzo support $lzo"
6429echo "snappy support $snappy"
Peter Wu6b383c02015-01-06 18:48:14 +01006430echo "bzip2 support $bzip2"
Julio Faracco83bc1f92018-11-05 13:08:04 -02006431echo "lzfse support $lzfse"
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08006432echo "NUMA host support $numa"
Klim Kireeved279a02018-01-12 12:01:19 +03006433echo "libxml2 $libxml2"
Fam Zheng2847b462015-03-26 11:03:12 +08006434echo "tcmalloc support $tcmalloc"
Alexandre Derumier7b01cb92015-06-19 12:56:58 +02006435echo "jemalloc support $jemalloc"
Liang Li99f2dbd2016-03-08 13:53:16 +08006436echo "avx2 optimization $avx2_opt"
Changlong Xiea6b1d4c2016-07-27 15:01:48 +08006437echo "replication support $replication"
Ashish Mittalda92c3f2017-04-03 20:48:08 -07006438echo "VxHS block device $vxhs"
Jeff Cody2f740132018-11-07 07:36:44 +01006439echo "bochs support $bochs"
6440echo "cloop support $cloop"
6441echo "dmg support $dmg"
6442echo "qcow v1 support $qcow1"
6443echo "vdi support $vdi"
6444echo "vvfat support $vvfat"
6445echo "qed support $qed"
6446echo "parallels support $parallels"
6447echo "sheepdog support $sheepdog"
Richard Henderson8ca80762017-09-14 09:41:12 -07006448echo "capstone $capstone"
Junyan He17824402018-07-18 15:47:59 +08006449echo "libpmem support $libpmem"
Tomáš Golembiovský3efac6e2018-10-23 13:23:10 +02006450echo "libudev $libudev"
Paolo Bonzinif3494742019-01-23 14:56:17 +08006451echo "default devices $default_devices"
Alex Bennée40e8c6f2019-06-13 14:52:25 +01006452echo "plugin support $plugins"
bellard67b915a2004-03-31 23:37:16 +00006453
Peter Maydell898be3e2017-03-21 14:31:57 +00006454if test "$supported_cpu" = "no"; then
6455 echo
6456 echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
6457 echo
6458 echo "CPU host architecture $cpu support is not currently maintained."
6459 echo "The QEMU project intends to remove support for this host CPU in"
6460 echo "a future release if nobody volunteers to maintain it and to"
6461 echo "provide a build host for our continuous integration setup."
6462 echo "configure has succeeded and you can continue to build, but"
6463 echo "if you care about QEMU on this platform you should contact"
6464 echo "us upstream at qemu-devel@nongnu.org."
6465fi
6466
6467if test "$supported_os" = "no"; then
6468 echo
6469 echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!"
6470 echo
Peter Maydellc50126a2017-03-21 18:08:49 +00006471 echo "Host OS $targetos support is not currently maintained."
6472 echo "The QEMU project intends to remove support for this host OS in"
Peter Maydell898be3e2017-03-21 14:31:57 +00006473 echo "a future release if nobody volunteers to maintain it and to"
6474 echo "provide a build host for our continuous integration setup."
6475 echo "configure has succeeded and you can continue to build, but"
6476 echo "if you care about QEMU on this platform you should contact"
6477 echo "us upstream at qemu-devel@nongnu.org."
6478fi
6479
Eduardo Habkoste5abf592019-05-03 16:37:21 -03006480# Note that if the Python conditional here evaluates True we will exit
6481# with status 1 which is a shell 'false' value.
6482if ! $python -c 'import sys; sys.exit(sys.version_info < (3,0))'; then
6483 echo
6484 echo "warning: Python 2 support is deprecated" >&2
6485 echo "warning: Python 3 will be required for building future versions of QEMU" >&2
Cleber Rosa406ab2f2019-08-26 11:58:32 -04006486 python2="y"
Eduardo Habkoste5abf592019-05-03 16:37:21 -03006487fi
6488
Juan Quintela98ec69a2009-07-16 18:34:18 +02006489config_host_mak="config-host.mak"
bellard97a847b2003-08-10 21:36:04 +00006490
Stefan Weildbd99ae2013-01-01 18:33:44 +01006491echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
6492
Juan Quintela98ec69a2009-07-16 18:34:18 +02006493echo "# Automatically generated by configure - do not modify" > $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02006494echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02006495
Paolo Bonzinie6c3b0f2010-10-21 10:18:35 +02006496echo all: >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02006497echo "prefix=$prefix" >> $config_host_mak
6498echo "bindir=$bindir" >> $config_host_mak
Alon Levy3aa5d2b2011-05-15 12:08:59 +03006499echo "libdir=$libdir" >> $config_host_mak
Michael Tokarev8bf188a2012-06-07 01:11:00 +04006500echo "libexecdir=$libexecdir" >> $config_host_mak
Alon Levy0f94d6d2011-06-27 11:58:20 +02006501echo "includedir=$includedir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02006502echo "mandir=$mandir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02006503echo "sysconfdir=$sysconfdir" >> $config_host_mak
Eduardo Habkost22d07032012-04-18 16:55:42 -03006504echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
Eduardo Habkost9afa52c2012-04-18 16:55:46 -03006505echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
Gerd Hoffmann3d5eeca2017-09-14 13:42:36 +02006506echo "qemu_firmwarepath=$firmwarepath" >> $config_host_mak
Eduardo Habkost9afa52c2012-04-18 16:55:46 -03006507echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
Fam Zhenge26110c2014-02-10 14:48:57 +08006508echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02006509if test "$mingw32" = "no" ; then
6510 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
6511fi
Michael Tokarevf354b1a2012-10-21 22:52:54 +04006512echo "qemu_helperdir=$libexecdir" >> $config_host_mak
Anthony Liguori834574e2013-02-20 07:43:24 -06006513echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
Daniel P. Berrangéa8260d32019-01-10 12:00:45 +00006514echo "qemu_icondir=$qemu_icondir" >> $config_host_mak
Daniel P. Berrangé67ea9542019-01-10 12:00:46 +00006515echo "qemu_desktopdir=$qemu_desktopdir" >> $config_host_mak
Daniel P. Berrangé02f91352019-05-16 10:51:34 +01006516echo "libs_cpu=$libs_cpu" >> $config_host_mak
Paolo Bonzinif544a482013-04-17 16:26:44 +02006517echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
Daniel P. Berrangecc84d632017-10-20 15:02:43 +01006518echo "GIT=$git" >> $config_host_mak
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +01006519echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +01006520echo "GIT_UPDATE=$git_update" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02006521
Juan Quintela98ec69a2009-07-16 18:34:18 +02006522echo "ARCH=$ARCH" >> $config_host_mak
Paolo Bonzini727e5282013-04-17 16:26:43 +02006523
Paolo Bonzinif3494742019-01-23 14:56:17 +08006524if test "$default_devices" = "yes" ; then
6525 echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak
6526else
6527 echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak
6528fi
aurel32f8393942009-04-13 18:45:38 +00006529if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006530 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00006531fi
aliguori1625af82009-04-05 17:41:02 +00006532if test "$strip_opt" = "yes" ; then
Hollis Blanchard52ba7842010-08-04 17:21:34 -07006533 echo "STRIP=${strip}" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00006534fi
bellard7d132992003-03-06 23:23:54 +00006535if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02006536 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00006537fi
bellard67b915a2004-03-31 23:37:16 +00006538if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006539 echo "CONFIG_WIN32=y" >> $config_host_mak
Stefan Weil89138852016-05-16 15:10:20 +02006540 rc_version=$(cat $source_path/VERSION)
Blue Swirl9fe6de92010-09-26 16:07:57 +00006541 version_major=${rc_version%%.*}
6542 rc_version=${rc_version#*.}
6543 version_minor=${rc_version%%.*}
6544 rc_version=${rc_version#*.}
6545 version_subminor=${rc_version%%.*}
6546 version_micro=0
6547 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
6548 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04006549 if test "$guest_agent_with_vss" = "yes" ; then
6550 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
Michael Rothf33ca812015-08-26 16:19:41 -05006551 echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04006552 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
6553 fi
Michael Roth50cbebb2015-07-07 18:10:09 -05006554 if test "$guest_agent_ntddscsi" = "yes" ; then
Tomáš Golembiovský76dc75c2018-10-23 13:23:16 +02006555 echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak
Michael Roth50cbebb2015-07-07 18:10:09 -05006556 fi
Michael Roth1a349042015-08-26 11:14:31 -05006557 if test "$guest_agent_msi" = "yes"; then
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08006558 echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
Yossi Hindin9dacf322015-05-06 14:57:40 +03006559 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
6560 echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
6561 echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
6562 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
6563 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
6564 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
6565 fi
pbrook210fa552007-02-27 21:04:49 +00006566else
Juan Quintela35f4df22009-07-27 16:13:07 +02006567 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00006568fi
blueswir1128ab2f2008-08-15 18:33:42 +00006569
Mark McLoughlindffcb712009-10-22 17:49:11 +01006570if test "$linux" = "yes" ; then
6571 echo "CONFIG_LINUX=y" >> $config_host_mak
6572fi
6573
bellard83fb7ad2004-07-05 21:25:26 +00006574if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006575 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00006576fi
malcb29fe3e2008-11-18 01:42:22 +00006577
bellardec530c82006-04-25 22:36:06 +00006578if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006579 echo "CONFIG_SOLARIS=y" >> $config_host_mak
bellardec530c82006-04-25 22:36:06 +00006580fi
Andreas Färber179cf402010-09-20 00:50:43 +02006581if test "$haiku" = "yes" ; then
6582 echo "CONFIG_HAIKU=y" >> $config_host_mak
6583fi
bellard97a847b2003-08-10 21:36:04 +00006584if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006585 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00006586fi
Stefan Weil1ba16962011-07-29 22:40:45 +02006587if test "$profiler" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006588 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00006589fi
Paolo Bonzinic932ce32019-07-18 12:24:29 +02006590if test "$want_tools" = "yes" ; then
6591 echo "CONFIG_TOOLS=y" >> $config_host_mak
6592fi
Marc-André Lureau675b9b52019-02-12 17:25:23 +01006593if test "$slirp" != "no"; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006594 echo "CONFIG_SLIRP=y" >> $config_host_mak
Brade2d88302011-09-02 16:53:28 -04006595 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
Marc-André Lureau675b9b52019-02-12 17:25:23 +01006596 echo "SLIRP_CFLAGS=$slirp_cflags" >> $config_host_mak
6597 echo "SLIRP_LIBS=$slirp_libs" >> $config_host_mak
6598fi
Marc-André Lureau7c57bdd2019-04-24 13:00:41 +02006599if [ "$slirp" = "git" -o "$slirp" = "internal" ]; then
Markus Armbruster3b8593e2019-05-28 10:23:07 +02006600 echo "config-host.h: slirp/all" >> $config_host_mak
bellardc20709a2004-04-21 23:27:19 +00006601fi
ths8a16d272008-07-19 09:56:24 +00006602if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006603 echo "CONFIG_VDE=y" >> $config_host_mak
Fam Zhenge2ad6f12017-09-07 16:35:52 +08006604 echo "VDE_LIBS=$vde_libs" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00006605fi
Vincenzo Maffione58952132013-11-06 11:44:06 +01006606if test "$netmap" = "yes" ; then
6607 echo "CONFIG_NETMAP=y" >> $config_host_mak
6608fi
Gonglei015a33b2014-07-01 20:58:08 +08006609if test "$l2tpv3" = "yes" ; then
6610 echo "CONFIG_L2TPV3=y" >> $config_host_mak
6611fi
Corey Bryant47e98652012-01-26 09:42:26 -05006612if test "$cap_ng" = "yes" ; then
6613 echo "CONFIG_LIBCAP=y" >> $config_host_mak
6614fi
Juan Quintela2358a492009-07-27 16:13:25 +02006615echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00006616for drv in $audio_drv_list; do
Gerd Hoffmann1ef1ec22018-03-01 11:05:46 +01006617 def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
Gerd Hoffmannce3dc032018-03-06 08:40:50 +01006618 case "$drv" in
Gerd Hoffmann051c7d52018-03-06 08:40:53 +01006619 alsa | oss | pa | sdl)
Gerd Hoffmannce3dc032018-03-06 08:40:50 +01006620 echo "$def=m" >> $config_host_mak ;;
6621 *)
6622 echo "$def=y" >> $config_host_mak ;;
6623 esac
malc0c58ac12008-06-25 21:04:05 +00006624done
Fam Zhengb1149912017-09-07 16:29:13 +08006625echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak
6626echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak
6627echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak
6628echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak
6629echo "OSS_LIBS=$oss_libs" >> $config_host_mak
malcd5631632009-10-10 01:13:41 +04006630if test "$audio_win_int" = "yes" ; then
6631 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
6632fi
Fam Zhengb64ec4e2013-05-29 19:35:40 +08006633echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
6634echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
Jes Sorensen821601e2011-03-16 13:33:36 +01006635if test "$vnc" = "yes" ; then
6636 echo "CONFIG_VNC=y" >> $config_host_mak
6637fi
aliguori2f9606b2009-03-06 20:27:28 +00006638if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006639 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00006640fi
Jes Sorensen821601e2011-03-16 13:33:36 +01006641if test "$vnc_jpeg" = "yes" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02006642 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
Corentin Chary2f6f5c72010-07-07 20:57:49 +02006643fi
Jes Sorensen821601e2011-03-16 13:33:36 +01006644if test "$vnc_png" = "yes" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02006645 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
Corentin Charyefe556a2010-07-07 20:57:56 +02006646fi
Gerd Hoffmann6a021532017-10-05 17:33:28 +02006647if test "$xkbcommon" = "yes" ; then
6648 echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak
6649 echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak
6650fi
Christoph Hellwigdce512d2010-12-17 11:41:15 +01006651if test "$xfs" = "yes" ; then
6652 echo "CONFIG_XFS=y" >> $config_host_mak
6653fi
Stefan Weil89138852016-05-16 15:10:20 +02006654qemu_version=$(head $source_path/VERSION)
Juan Quintela98ec69a2009-07-16 18:34:18 +02006655echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02006656echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02006657echo "SRC_PATH=$source_path" >> $config_host_mak
Alex Bennée2b1f35b2018-07-04 07:30:11 +01006658echo "TARGET_DIRS=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02006659if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006660 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00006661fi
Fam Zheng17969262014-02-10 14:48:56 +08006662if test "$modules" = "yes"; then
Fam Zhenge26110c2014-02-10 14:48:57 +08006663 # $shacmd can generate a hash started with digit, which the compiler doesn't
6664 # like as an symbol. So prefix it with an underscore
Stefan Weil89138852016-05-16 15:10:20 +02006665 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
Fam Zheng17969262014-02-10 14:48:56 +08006666 echo "CONFIG_MODULES=y" >> $config_host_mak
6667fi
Eric Blakee633a5c2019-02-04 20:39:37 -06006668if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then
Gerd Hoffmann87815952018-03-01 11:05:42 +01006669 echo "CONFIG_X11=y" >> $config_host_mak
6670 echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak
6671 echo "X11_LIBS=$x11_libs" >> $config_host_mak
6672fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02006673if test "$sdl" = "yes" ; then
Gerd Hoffmann96400a12018-03-01 11:05:47 +01006674 echo "CONFIG_SDL=m" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02006675 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
Fam Zheng8ecc89f2017-09-07 16:29:11 +08006676 echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
Daniel P. Berrangéa442fe22019-01-10 12:00:47 +00006677 if test "$sdl_image" = "yes" ; then
6678 echo "CONFIG_SDL_IMAGE=y" >> $config_host_mak
6679 fi
bellard49ecc3f2007-11-07 19:25:15 +00006680fi
6681if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006682 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00006683fi
Samuel Thibaulte08bb302019-03-11 14:51:26 +01006684if test "$iconv" = "yes" ; then
6685 echo "CONFIG_ICONV=y" >> $config_host_mak
6686 echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak
6687 echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak
6688fi
balrog4d3b6f62008-02-10 16:33:14 +00006689if test "$curses" = "yes" ; then
Gerd Hoffmann2373f7d2018-03-01 11:05:45 +01006690 echo "CONFIG_CURSES=m" >> $config_host_mak
6691 echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak
6692 echo "CURSES_LIBS=$curses_lib" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00006693fi
Riku Voipio099d6b02009-05-05 12:10:04 +03006694if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006695 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03006696fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01006697if test "$accept4" = "yes" ; then
6698 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
6699fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05306700if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006701 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05306702fi
Riku Voipioc2882b92009-08-12 15:08:24 +03006703if test "$eventfd" = "yes" ; then
6704 echo "CONFIG_EVENTFD=y" >> $config_host_mak
6705fi
Marc-André Lureau751bcc32015-10-09 17:17:16 +02006706if test "$memfd" = "yes" ; then
6707 echo "CONFIG_MEMFD=y" >> $config_host_mak
6708fi
Cortland Tölva955727d2018-10-08 09:35:19 -07006709if test "$have_usbfs" = "yes" ; then
6710 echo "CONFIG_USBFS=y" >> $config_host_mak
6711fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03006712if test "$fallocate" = "yes" ; then
6713 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
6714fi
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01006715if test "$fallocate_punch_hole" = "yes" ; then
6716 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
6717fi
Denis V. Lunevb953f072015-01-30 11:42:14 +03006718if test "$fallocate_zero_range" = "yes" ; then
6719 echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak
6720fi
Kevin Wolfed911432014-09-29 17:12:59 +02006721if test "$posix_fallocate" = "yes" ; then
6722 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
6723fi
Peter Maydellc727f472011-01-06 11:05:10 +00006724if test "$sync_file_range" = "yes" ; then
6725 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
6726fi
Peter Maydelldace20d2011-01-10 13:11:24 +00006727if test "$fiemap" = "yes" ; then
6728 echo "CONFIG_FIEMAP=y" >> $config_host_mak
6729fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03006730if test "$dup3" = "yes" ; then
6731 echo "CONFIG_DUP3=y" >> $config_host_mak
6732fi
Alex Bligh4e0c6522013-08-21 16:02:43 +01006733if test "$ppoll" = "yes" ; then
6734 echo "CONFIG_PPOLL=y" >> $config_host_mak
6735fi
Alex Blighcd758dd2013-08-21 16:02:44 +01006736if test "$prctl_pr_set_timerslack" = "yes" ; then
6737 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
6738fi
Peter Maydell3b6edd12011-02-15 18:35:05 +00006739if test "$epoll" = "yes" ; then
6740 echo "CONFIG_EPOLL=y" >> $config_host_mak
6741fi
6742if test "$epoll_create1" = "yes" ; then
6743 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
6744fi
Peter Maydella8fd1ab2013-02-08 07:31:55 +00006745if test "$sendfile" = "yes" ; then
6746 echo "CONFIG_SENDFILE=y" >> $config_host_mak
6747fi
Riku Voipio51834342014-06-22 11:25:42 +01006748if test "$timerfd" = "yes" ; then
6749 echo "CONFIG_TIMERFD=y" >> $config_host_mak
6750fi
Riku Voipio9af5c902014-08-12 15:58:57 +03006751if test "$setns" = "yes" ; then
6752 echo "CONFIG_SETNS=y" >> $config_host_mak
6753fi
Aleksandar Markovic38860a02016-10-10 13:23:29 +02006754if test "$clock_adjtime" = "yes" ; then
6755 echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak
6756fi
Aleksandar Markovic5a03cd02016-10-10 13:23:30 +02006757if test "$syncfs" = "yes" ; then
6758 echo "CONFIG_SYNCFS=y" >> $config_host_mak
6759fi
aurel323b3f24a2009-04-15 16:12:13 +00006760if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006761 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00006762fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00006763if test "$inotify1" = "yes" ; then
6764 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
6765fi
Peter Maydell401bc052017-09-05 13:19:32 +01006766if test "$sem_timedwait" = "yes" ; then
6767 echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak
6768fi
Keno Fischer5c99fa32018-06-29 12:32:10 +02006769if test "$strchrnul" = "yes" ; then
6770 echo "HAVE_STRCHRNUL=y" >> $config_host_mak
6771fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02006772if test "$byteswap_h" = "yes" ; then
6773 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
6774fi
6775if test "$bswap_h" = "yes" ; then
6776 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
6777fi
Alexander Graf769ce762009-05-11 17:41:42 +02006778if test "$curl" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08006779 echo "CONFIG_CURL=m" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02006780 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08006781 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02006782fi
aurel322e4d9fb2008-04-08 06:01:02 +00006783if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006784 echo "CONFIG_BRLAPI=y" >> $config_host_mak
Fam Zheng8eca2882017-09-07 16:47:00 +08006785 echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00006786fi
balrogfb599c92008-09-28 23:49:55 +00006787if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006788 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02006789 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00006790fi
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06006791if test "$gtk" = "yes" ; then
Gerd Hoffmanne0fb1292018-03-01 11:05:44 +01006792 echo "CONFIG_GTK=m" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06006793 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
Gerd Hoffmann014cb152015-12-03 12:56:34 +01006794 echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
Gerd Hoffmann925a0402015-05-26 12:26:21 +02006795 if test "$gtk_gl" = "yes" ; then
6796 echo "CONFIG_GTK_GL=y" >> $config_host_mak
6797 fi
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01006798fi
Marc-André Lureauf876b762019-02-21 12:07:00 +01006799if test "$gio" = "yes" ; then
6800 echo "CONFIG_GIO=y" >> $config_host_mak
6801 echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak
6802 echo "GIO_LIBS=$gio_libs" >> $config_host_mak
6803fi
Daniel P. Berrangea1c5e942016-06-06 10:05:06 +01006804echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
Daniel P. Berrangeddbb0d02015-07-01 18:10:29 +01006805if test "$gnutls" = "yes" ; then
6806 echo "CONFIG_GNUTLS=y" >> $config_host_mak
6807fi
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01006808if test "$gcrypt" = "yes" ; then
6809 echo "CONFIG_GCRYPT=y" >> $config_host_mak
Longpeng(Mike)1f923c72016-12-13 18:42:55 +08006810 if test "$gcrypt_hmac" = "yes" ; then
6811 echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak
6812 fi
Daniel P. Berrange62893b62015-07-01 18:10:33 +01006813fi
Daniel P. Berrange91bfcdb2015-10-16 16:36:53 +01006814if test "$nettle" = "yes" ; then
6815 echo "CONFIG_NETTLE=y" >> $config_host_mak
Radim Krčmářbecaeb72015-07-10 19:18:00 +02006816 echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak
Daniel P. Berrangeed754742015-07-01 18:10:34 +01006817fi
Daniel P. Berrange9a2fd432015-04-13 14:01:39 +01006818if test "$tasn1" = "yes" ; then
6819 echo "CONFIG_TASN1=y" >> $config_host_mak
6820fi
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01006821if test "$auth_pam" = "yes" ; then
6822 echo "CONFIG_AUTH_PAM=y" >> $config_host_mak
6823fi
Daniel P. Berrange559607e2015-02-27 16:19:33 +00006824if test "$have_ifaddrs_h" = "yes" ; then
6825 echo "HAVE_IFADDRS_H=y" >> $config_host_mak
6826fi
Eric Blake6b39b062016-10-11 10:46:23 -05006827if test "$have_broken_size_max" = "yes" ; then
6828 echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
6829fi
Jan Vesely277abf12016-04-29 13:15:23 -04006830
6831# Work around a system header bug with some kernel/XFS header
6832# versions where they both try to define 'struct fsxattr':
6833# xfs headers will not try to redefine structs from linux headers
6834# if this macro is set.
6835if test "$have_fsxattr" = "yes" ; then
6836 echo "HAVE_FSXATTR=y" >> $config_host_mak
6837fi
Fam Zheng1efad062018-06-01 17:26:43 +08006838if test "$have_copy_file_range" = "yes" ; then
6839 echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak
6840fi
Stefan Weilbbbf9bf2014-02-19 07:04:34 +01006841if test "$vte" = "yes" ; then
6842 echo "CONFIG_VTE=y" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06006843 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
Gerd Hoffmanne0fb1292018-03-01 11:05:44 +01006844 echo "VTE_LIBS=$vte_libs" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06006845fi
Gerd Hoffmann9d9e1522014-07-11 12:51:43 +02006846if test "$virglrenderer" = "yes" ; then
6847 echo "CONFIG_VIRGL=y" >> $config_host_mak
6848 echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak
6849 echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak
6850fi
aliguorie37630c2009-04-22 15:19:10 +00006851if test "$xen" = "yes" ; then
Jan Kiszka6dbd5882011-06-21 22:59:07 +02006852 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00006853 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00006854fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02006855if test "$linux_aio" = "yes" ; then
6856 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
6857fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07006858if test "$attr" = "yes" ; then
6859 echo "CONFIG_ATTR=y" >> $config_host_mak
6860fi
Avi Kivity4f26f2b2011-11-09 14:44:52 +02006861if test "$libattr" = "yes" ; then
6862 echo "CONFIG_LIBATTR=y" >> $config_host_mak
6863fi
Meador Inge983eef52012-02-24 14:00:42 +05306864if test "$virtfs" = "yes" ; then
6865 echo "CONFIG_VIRTFS=y" >> $config_host_mak
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07006866fi
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02006867if test "$mpath" = "yes" ; then
6868 echo "CONFIG_MPATH=y" >> $config_host_mak
Murilo Opsfelder Araujo1b0578f2018-08-10 11:11:16 -03006869 if test "$mpathpersist_new_api" = "yes"; then
6870 echo "CONFIG_MPATH_NEW_API=y" >> $config_host_mak
6871 fi
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +02006872fi
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00006873if test "$vhost_scsi" = "yes" ; then
6874 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
6875fi
Paolo Bonziniaf3bba72019-02-14 18:35:52 +01006876if test "$vhost_net" = "yes" ; then
6877 echo "CONFIG_VHOST_NET=y" >> $config_host_mak
6878fi
6879if test "$vhost_net_user" = "yes" ; then
Paolo Bonzini56f41de2019-02-14 18:35:49 +01006880 echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +03006881fi
Gonglei042cea22018-03-01 21:46:28 +08006882if test "$vhost_crypto" = "yes" ; then
6883 echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
6884fi
Stefan Hajnoczifc0b9b02016-08-16 13:27:22 +01006885if test "$vhost_vsock" = "yes" ; then
6886 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
6887fi
Paolo Bonzini299e6f12019-02-14 18:35:53 +01006888if test "$vhost_kernel" = "yes" ; then
6889 echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
6890fi
Marc-André Lureaue6a74862017-08-03 11:07:46 +02006891if test "$vhost_user" = "yes" ; then
6892 echo "CONFIG_VHOST_USER=y" >> $config_host_mak
6893fi
Dr. David Alan Gilbert98fc1ad2019-09-30 11:51:34 +01006894if test "$vhost_user_fs" = "yes" ; then
6895 echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
6896fi
ths77755342008-11-27 15:45:16 +00006897if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02006898 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00006899fi
aliguoribf9298b2008-12-05 20:05:26 +00006900if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006901 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00006902fi
aliguoriceb42de2009-04-07 18:43:28 +00006903if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02006904 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00006905fi
Philippe Mathieu-Daudée3971d62018-04-15 20:05:20 -03006906if test "$fdt" != "no" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02006907 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00006908fi
Paolo Bonzinia40161c2018-02-16 10:05:23 +01006909if test "$membarrier" = "yes" ; then
6910 echo "CONFIG_MEMBARRIER=y" >> $config_host_mak
6911fi
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03006912if test "$signalfd" = "yes" ; then
6913 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
6914fi
Richard W.M. Jonesd339d762019-01-18 10:11:14 +00006915if test "$optreset" = "yes" ; then
6916 echo "HAVE_OPTRESET=y" >> $config_host_mak
6917fi
Paolo Bonzinib3f6ea72017-07-03 16:59:07 +02006918if test "$tcg" = "yes"; then
6919 echo "CONFIG_TCG=y" >> $config_host_mak
6920 if test "$tcg_interpreter" = "yes" ; then
6921 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
6922 fi
Stefan Weil9195b2c2011-10-19 07:07:18 +02006923fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00006924if test "$fdatasync" = "yes" ; then
6925 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
6926fi
Andreas Färbere78815a2010-09-25 11:26:05 +00006927if test "$madvise" = "yes" ; then
6928 echo "CONFIG_MADVISE=y" >> $config_host_mak
6929fi
6930if test "$posix_madvise" = "yes" ; then
6931 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
6932fi
Andreas Gustafsson9bc5a712018-01-04 19:39:36 +02006933if test "$posix_memalign" = "yes" ; then
6934 echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak
6935fi
bellard97a847b2003-08-10 21:36:04 +00006936
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01006937if test "$spice" = "yes" ; then
6938 echo "CONFIG_SPICE=y" >> $config_host_mak
6939fi
6940
Marc-André Lureau7b02f542015-08-30 11:48:40 +02006941if test "$smartcard" = "yes" ; then
6942 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
Fam Zheng7b62bf52017-09-07 16:29:16 +08006943 echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak
6944 echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak
Robert Relyea111a38b2010-11-28 16:36:38 +02006945fi
6946
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01006947if test "$libusb" = "yes" ; then
6948 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
Fam Zhengb878b652017-09-07 16:29:17 +08006949 echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak
6950 echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01006951fi
6952
Hans de Goede69354a82011-07-19 11:04:10 +02006953if test "$usb_redir" = "yes" ; then
6954 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
Fam Zhengcc7923f2017-09-07 16:29:18 +08006955 echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak
6956 echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak
Hans de Goede69354a82011-07-19 11:04:10 +02006957fi
6958
Gerd Hoffmannda076ff2014-11-20 09:49:44 +01006959if test "$opengl" = "yes" ; then
6960 echo "CONFIG_OPENGL=y" >> $config_host_mak
6961 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
Gerd Hoffmann014cb152015-12-03 12:56:34 +01006962 if test "$opengl_dmabuf" = "yes" ; then
6963 echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
6964 fi
Michael Walle20ff0752011-03-07 23:32:39 +01006965fi
6966
Marc-André Lureaud52c4542019-05-24 15:09:42 +02006967if test "$gbm" = "yes" ; then
6968 echo "CONFIG_GBM=y" >> $config_host_mak
6969 echo "GBM_LIBS=$gbm_libs" >> $config_host_mak
6970 echo "GBM_CFLAGS=$gbm_cflags" >> $config_host_mak
6971fi
6972
6973
Yang Zhong5a22ab72017-12-20 21:16:46 +08006974if test "$malloc_trim" = "yes" ; then
6975 echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak
6976fi
6977
Liang Li99f2dbd2016-03-08 13:53:16 +08006978if test "$avx2_opt" = "yes" ; then
6979 echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
6980fi
6981
qiaonuohan607dacd2014-02-18 14:11:30 +08006982if test "$lzo" = "yes" ; then
6983 echo "CONFIG_LZO=y" >> $config_host_mak
6984fi
6985
6986if test "$snappy" = "yes" ; then
6987 echo "CONFIG_SNAPPY=y" >> $config_host_mak
6988fi
6989
Peter Wu6b383c02015-01-06 18:48:14 +01006990if test "$bzip2" = "yes" ; then
6991 echo "CONFIG_BZIP2=y" >> $config_host_mak
6992 echo "BZIP2_LIBS=-lbz2" >> $config_host_mak
6993fi
6994
Julio Faracco83bc1f92018-11-05 13:08:04 -02006995if test "$lzfse" = "yes" ; then
6996 echo "CONFIG_LZFSE=y" >> $config_host_mak
6997 echo "LZFSE_LIBS=-llzfse" >> $config_host_mak
6998fi
6999
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11007000if test "$libiscsi" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08007001 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08007002 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
7003 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11007004fi
7005
Peter Lieven6542aa92014-02-03 10:26:13 +01007006if test "$libnfs" = "yes" ; then
Colin Lord4be48792016-08-12 09:27:04 -04007007 echo "CONFIG_LIBNFS=m" >> $config_host_mak
7008 echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
Peter Lieven6542aa92014-02-03 10:26:13 +01007009fi
7010
Eduardo Otubof7945732012-08-14 18:44:05 -03007011if test "$seccomp" = "yes"; then
7012 echo "CONFIG_SECCOMP=y" >> $config_host_mak
Fam Zhengc3883e12017-09-07 16:53:16 +08007013 echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
7014 echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak
Eduardo Otubof7945732012-08-14 18:44:05 -03007015fi
7016
bellard83fb7ad2004-07-05 21:25:26 +00007017# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00007018if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02007019 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00007020fi
7021
Daniel P. Berrange4d9310f2015-09-22 15:13:26 +01007022if test "$localtime_r" = "yes" ; then
7023 echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
7024fi
Paolo Bonzini3556c232013-05-10 14:16:40 +02007025if test "$qom_cast_debug" = "yes" ; then
7026 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
7027fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01007028if test "$rbd" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08007029 echo "CONFIG_RBD=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08007030 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
7031 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
Christian Brunnerf27aaf42010-12-06 20:53:01 +01007032fi
Anthony Liguori20ff6c82009-12-09 12:59:36 -06007033
Peter Maydell7c2acc72013-04-08 12:11:27 +01007034echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02007035if test "$coroutine_pool" = "yes" ; then
7036 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
7037else
7038 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
7039fi
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05307040
Peter Lieven7d992e42016-09-27 11:58:45 +02007041if test "$debug_stack_usage" = "yes" ; then
7042 echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
7043fi
7044
Longpeng(Mike)f0d92b52017-07-14 14:04:05 -04007045if test "$crypto_afalg" = "yes" ; then
7046 echo "CONFIG_AF_ALG=y" >> $config_host_mak
7047fi
7048
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05307049if test "$open_by_handle_at" = "yes" ; then
7050 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
7051fi
7052
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05307053if test "$linux_magic_h" = "yes" ; then
7054 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
7055fi
7056
Gerd Hoffmanncc6e3ca2013-01-09 10:17:07 +01007057if test "$pragma_diagnostic_available" = "yes" ; then
7058 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
Peter Maydell06d71fa2012-07-30 16:13:07 +01007059fi
7060
Kevin Wolf3f4349d2012-06-29 13:40:27 +02007061if test "$valgrind_h" = "yes" ; then
7062 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
7063fi
7064
Marc-André Lureaud83414e2018-01-16 16:11:52 +01007065if test "$have_asan_iface_fiber" = "yes" ; then
7066 echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak
7067fi
7068
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03007069if test "$has_environ" = "yes" ; then
7070 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
7071fi
7072
Richard Henderson76a347e2012-12-28 14:17:02 -08007073if test "$cpuid_h" = "yes" ; then
7074 echo "CONFIG_CPUID_H=y" >> $config_host_mak
7075fi
7076
Richard Hendersonf5401662013-02-16 12:46:59 -08007077if test "$int128" = "yes" ; then
7078 echo "CONFIG_INT128=y" >> $config_host_mak
7079fi
7080
Richard Henderson7ebee432016-06-29 21:10:59 -07007081if test "$atomic128" = "yes" ; then
7082 echo "CONFIG_ATOMIC128=y" >> $config_host_mak
7083fi
7084
Richard Hendersone6cd4bb2018-08-15 16:31:47 -07007085if test "$cmpxchg128" = "yes" ; then
7086 echo "CONFIG_CMPXCHG128=y" >> $config_host_mak
7087fi
7088
Richard Hendersondf79b992016-09-02 12:23:57 -07007089if test "$atomic64" = "yes" ; then
7090 echo "CONFIG_ATOMIC64=y" >> $config_host_mak
7091fi
7092
Richard Hendersondb432672017-09-15 14:11:45 -07007093if test "$vector16" = "yes" ; then
7094 echo "CONFIG_VECTOR16=y" >> $config_host_mak
7095fi
7096
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08007097if test "$getauxval" = "yes" ; then
7098 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
7099fi
7100
Bharata B Raoeb100392012-09-24 14:42:45 +05307101if test "$glusterfs" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08007102 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08007103 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
7104 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
Bharata B Raoeb100392012-09-24 14:42:45 +05307105fi
7106
Jeff Codyd85fa9e2016-04-05 10:40:09 -04007107if test "$glusterfs_xlator_opt" = "yes" ; then
7108 echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
7109fi
7110
Bharata B Rao0c14fb42013-07-16 21:47:42 +05307111if test "$glusterfs_discard" = "yes" ; then
7112 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
7113fi
7114
Niels de Vosdf3a4292017-05-28 12:01:14 +05307115if test "$glusterfs_fallocate" = "yes" ; then
7116 echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
7117fi
7118
Bharata B Rao7c815372013-12-21 14:51:25 +05307119if test "$glusterfs_zerofill" = "yes" ; then
7120 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
7121fi
7122
Prasanna Kumar Kalevere014dbe2019-03-05 16:46:33 +01007123if test "$glusterfs_ftruncate_has_stat" = "yes" ; then
7124 echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak
7125fi
7126
Niels de Vos0e3b8912019-03-05 16:46:34 +01007127if test "$glusterfs_iocb_has_stat" = "yes" ; then
7128 echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak
7129fi
7130
Pino Toscanob10d49d2019-06-20 22:08:40 +02007131if test "$libssh" = "yes" ; then
7132 echo "CONFIG_LIBSSH=m" >> $config_host_mak
7133 echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak
7134 echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01007135fi
7136
Dr. David Alan Gilberted1701c2017-05-15 15:05:29 +01007137if test "$live_block_migration" = "yes" ; then
7138 echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
7139fi
7140
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01007141if test "$tpm" = "yes"; then
Paolo Bonzini3cae16d2019-07-11 19:08:36 +02007142 echo 'CONFIG_TPM=y' >> $config_host_mak
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01007143fi
7144
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +02007145echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
7146if have_backend "nop"; then
LluĂ­s6d8a7642011-08-31 20:30:43 +02007147 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
Prerna Saxena22890ab2010-06-24 17:04:53 +05307148fi
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +02007149if have_backend "simple"; then
LluĂ­s6d8a7642011-08-31 20:30:43 +02007150 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
7151 # Set the appropriate trace file.
Andreas Färber953ffe02011-06-02 19:58:06 +02007152 trace_file="\"$trace_file-\" FMT_pid"
Prerna Saxena9410b562010-07-13 09:26:32 +01007153fi
Paolo Bonzinied7f5f12016-01-07 16:55:30 +03007154if have_backend "log"; then
7155 echo "CONFIG_TRACE_LOG=y" >> $config_host_mak
LluĂ­s6d8a7642011-08-31 20:30:43 +02007156fi
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +02007157if have_backend "ust"; then
LluĂ­s6d8a7642011-08-31 20:30:43 +02007158 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
7159fi
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +02007160if have_backend "dtrace"; then
LluĂ­s6d8a7642011-08-31 20:30:43 +02007161 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
7162 if test "$trace_backend_stap" = "yes" ; then
7163 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
7164 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00007165fi
LluĂ­s Vilanova5b808272014-05-27 15:02:14 +02007166if have_backend "ftrace"; then
Eiichi Tsukata781e9542013-04-11 20:25:15 +09007167 if test "$linux" = "yes" ; then
7168 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
Eiichi Tsukata781e9542013-04-11 20:25:15 +09007169 else
Stewart Smith21684af2014-01-24 12:39:10 +11007170 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
Eiichi Tsukata781e9542013-04-11 20:25:15 +09007171 fi
7172fi
Paul Durrant0a852412016-08-04 14:44:14 +01007173if have_backend "syslog"; then
7174 if test "$posix_syslog" = "yes" ; then
7175 echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak
7176 else
7177 feature_not_found "syslog(trace backend)" "syslog not available"
7178 fi
7179fi
Prerna Saxena9410b562010-07-13 09:26:32 +01007180echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
7181
Michael R. Hines2da776d2013-07-22 10:01:54 -04007182if test "$rdma" = "yes" ; then
7183 echo "CONFIG_RDMA=y" >> $config_host_mak
Fam Zheng392fb642017-09-07 16:42:30 +08007184 echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
Michael R. Hines2da776d2013-07-22 10:01:54 -04007185fi
7186
Marcel Apfelbaum21ab34c2018-08-16 18:16:37 +03007187if test "$pvrdma" = "yes" ; then
7188 echo "CONFIG_PVRDMA=y" >> $config_host_mak
7189fi
7190
Laurent Vivier575b22b2016-06-02 22:14:15 +02007191if test "$have_rtnetlink" = "yes" ; then
7192 echo "CONFIG_RTNETLINK=y" >> $config_host_mak
7193fi
7194
Klim Kireeved279a02018-01-12 12:01:19 +03007195if test "$libxml2" = "yes" ; then
7196 echo "CONFIG_LIBXML2=y" >> $config_host_mak
7197 echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak
7198 echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak
7199fi
7200
Changlong Xiea6b1d4c2016-07-27 15:01:48 +08007201if test "$replication" = "yes" ; then
7202 echo "CONFIG_REPLICATION=y" >> $config_host_mak
7203fi
7204
Stefan Hajnoczi6a02c802016-10-14 10:00:55 +01007205if test "$have_af_vsock" = "yes" ; then
7206 echo "CONFIG_AF_VSOCK=y" >> $config_host_mak
7207fi
7208
Christopher Covington4d043512016-12-28 15:04:33 -05007209if test "$have_sysmacros" = "yes" ; then
7210 echo "CONFIG_SYSMACROS=y" >> $config_host_mak
7211fi
7212
Andreas Grapentin49e00a12017-03-14 17:59:53 +01007213if test "$have_static_assert" = "yes" ; then
7214 echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak
7215fi
7216
Tomáš Golembiovskýe6746052017-07-17 15:58:33 +02007217if test "$have_utmpx" = "yes" ; then
7218 echo "HAVE_UTMPX=y" >> $config_host_mak
7219fi
Richard Hendersondb1ed1a2019-03-13 20:57:28 -07007220if test "$have_getrandom" = "yes" ; then
7221 echo "CONFIG_GETRANDOM=y" >> $config_host_mak
7222fi
Kamil Rytarowskie0580342017-07-14 09:33:44 +01007223if test "$ivshmem" = "yes" ; then
7224 echo "CONFIG_IVSHMEM=y" >> $config_host_mak
7225fi
Richard Hendersone219c492017-09-28 09:01:23 -07007226if test "$capstone" != "no" ; then
Richard Henderson8ca80762017-09-14 09:41:12 -07007227 echo "CONFIG_CAPSTONE=y" >> $config_host_mak
7228fi
Paolo Bonziniba59fb72018-06-13 14:23:08 +02007229if test "$debug_mutex" = "yes" ; then
7230 echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak
7231fi
Kamil Rytarowskie0580342017-07-14 09:33:44 +01007232
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00007233# Hold two types of flag:
7234# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
7235# a thread we have a handle to
Roman Bolshakov479a5742018-12-17 23:26:01 +03007236# CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00007237# platform
Roman Bolshakov479a5742018-12-17 23:26:01 +03007238if test "$pthread_setname_np_w_tid" = "yes" ; then
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00007239 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
Roman Bolshakov479a5742018-12-17 23:26:01 +03007240 echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=y" >> $config_host_mak
7241elif test "$pthread_setname_np_wo_tid" = "yes" ; then
7242 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
7243 echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=y" >> $config_host_mak
Dr. David Alan Gilbert5c312072014-03-12 11:48:18 +00007244fi
7245
Ashish Mittalda92c3f2017-04-03 20:48:08 -07007246if test "$vxhs" = "yes" ; then
7247 echo "CONFIG_VXHS=y" >> $config_host_mak
7248 echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
7249fi
7250
Junyan He17824402018-07-18 15:47:59 +08007251if test "$libpmem" = "yes" ; then
7252 echo "CONFIG_LIBPMEM=y" >> $config_host_mak
7253fi
7254
Jeff Cody2f740132018-11-07 07:36:44 +01007255if test "$bochs" = "yes" ; then
7256 echo "CONFIG_BOCHS=y" >> $config_host_mak
7257fi
7258if test "$cloop" = "yes" ; then
7259 echo "CONFIG_CLOOP=y" >> $config_host_mak
7260fi
7261if test "$dmg" = "yes" ; then
7262 echo "CONFIG_DMG=y" >> $config_host_mak
7263fi
7264if test "$qcow1" = "yes" ; then
7265 echo "CONFIG_QCOW1=y" >> $config_host_mak
7266fi
7267if test "$vdi" = "yes" ; then
7268 echo "CONFIG_VDI=y" >> $config_host_mak
7269fi
7270if test "$vvfat" = "yes" ; then
7271 echo "CONFIG_VVFAT=y" >> $config_host_mak
7272fi
7273if test "$qed" = "yes" ; then
7274 echo "CONFIG_QED=y" >> $config_host_mak
7275fi
7276if test "$parallels" = "yes" ; then
7277 echo "CONFIG_PARALLELS=y" >> $config_host_mak
7278fi
7279if test "$sheepdog" = "yes" ; then
7280 echo "CONFIG_SHEEPDOG=y" >> $config_host_mak
7281fi
7282
Alex Bennée40e8c6f2019-06-13 14:52:25 +01007283if test "$plugins" = "yes" ; then
7284 echo "CONFIG_PLUGIN=y" >> $config_host_mak
7285 LIBS="-ldl $LIBS"
7286fi
7287
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02007288if test "$tcg_interpreter" = "yes"; then
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02007289 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02007290elif test "$ARCH" = "sparc64" ; then
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02007291 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02007292elif test "$ARCH" = "s390x" ; then
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02007293 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
Eric Blakee633a5c2019-02-04 20:39:37 -06007294elif test "$ARCH" = "x86_64" || test "$ARCH" = "x32" ; then
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02007295 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
Richard Henderson40d964b2014-04-30 14:07:47 -07007296elif test "$ARCH" = "ppc64" ; then
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02007297 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
Eric Blakee633a5c2019-02-04 20:39:37 -06007298elif test "$ARCH" = "riscv32" || test "$ARCH" = "riscv64" ; then
Alistair Francisc4f80542018-12-19 19:20:19 +00007299 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/riscv $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02007300else
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02007301 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02007302fi
Michael S. Tsirkin9edc19c2018-03-21 17:22:07 +02007303QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg $QEMU_INCLUDES"
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02007304
Juan Quintela98ec69a2009-07-16 18:34:18 +02007305echo "TOOLS=$tools" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02007306echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02007307echo "MAKE=$make" >> $config_host_mak
7308echo "INSTALL=$install" >> $config_host_mak
Brad1901cb12011-08-28 04:01:33 -04007309echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
7310echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
Michael Tokareve999ee42016-01-27 14:36:43 +03007311echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
7312echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
Blue Swirlc886edf2011-07-22 21:08:09 +00007313echo "PYTHON=$python" >> $config_host_mak
Cleber Rosa406ab2f2019-08-26 11:58:32 -04007314echo "PYTHON2=$python2" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02007315echo "CC=$cc" >> $config_host_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03007316if $iasl -h > /dev/null 2>&1; then
7317 echo "IASL=$iasl" >> $config_host_mak
7318fi
Juan Quintela804edf22009-07-27 16:12:49 +02007319echo "HOST_CC=$host_cc" >> $config_host_mak
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04007320echo "CXX=$cxx" >> $config_host_mak
Peter Maydell3c4a4d02012-08-11 22:34:40 +01007321echo "OBJCC=$objcc" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02007322echo "AR=$ar" >> $config_host_mak
Peter Maydell45d285a2013-10-21 21:03:06 +01007323echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
Richard Hendersoncdbd7272016-07-07 21:49:36 -07007324echo "AS=$as" >> $config_host_mak
Richard Henderson5f6f0e22016-06-23 10:39:18 -07007325echo "CCAS=$ccas" >> $config_host_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00007326echo "CPP=$cpp" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02007327echo "OBJCOPY=$objcopy" >> $config_host_mak
7328echo "LD=$ld" >> $config_host_mak
Alistair Francis9f81aeb2017-11-07 17:10:46 -08007329echo "RANLIB=$ranlib" >> $config_host_mak
Stefan Weil4852ee92014-09-18 21:55:08 +02007330echo "NM=$nm" >> $config_host_mak
Alex Bennéedaa79d92019-09-19 14:07:36 +01007331echo "PKG_CONFIG=$pkg_config_exe" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00007332echo "WINDRES=$windres" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02007333echo "CFLAGS=$CFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05007334echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02007335echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Bruno Dominguez11cde1c2017-06-06 14:07:47 +01007336echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01007337echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01007338if test "$sparse" = "yes" ; then
7339 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
Christian Borntraeger80fd48d2015-01-22 10:53:46 +01007340 echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak
Gerd Hoffmann2944d742014-10-15 11:51:09 +02007341 echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01007342 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
7343 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
7344fi
Juan Quintelae2a2ed02009-08-03 14:46:02 +02007345echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05007346echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
Philippe Mathieu-Daudé8a99e9a2018-04-15 20:05:19 -03007347echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
James Clarke6969ec62016-06-06 12:02:50 +01007348echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
Peter Maydelle57218b2016-08-08 17:11:28 +01007349echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02007350echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02007351echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Daniel P. Berrange409437e2016-07-20 14:23:13 +01007352echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02007353echo "EXESUF=$EXESUF" >> $config_host_mak
Fam Zheng17969262014-02-10 14:48:56 +08007354echo "DSOSUF=$DSOSUF" >> $config_host_mak
7355echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
Michael Roth957f1f92011-08-11 15:38:12 -05007356echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
Daniel P. Berrange90246032015-09-21 17:25:34 +01007357echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
7358echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02007359echo "POD2MAN=$POD2MAN" >> $config_host_mak
Blue Swirl1d728c32012-05-01 18:45:39 +00007360if test "$gcov" = "yes" ; then
7361 echo "CONFIG_GCOV=y" >> $config_host_mak
7362 echo "GCOV=$gcov_tool" >> $config_host_mak
7363fi
Juan Quintela804edf22009-07-27 16:12:49 +02007364
Tomáš Golembiovský3efac6e2018-10-23 13:23:10 +02007365if test "$libudev" != "no"; then
7366 echo "CONFIG_LIBUDEV=y" >> $config_host_mak
7367 echo "LIBUDEV_LIBS=$libudev_libs" >> $config_host_mak
7368fi
7369
Peter Maydell6efd7512011-11-30 11:59:04 +00007370# use included Linux headers
7371if test "$linux" = "yes" ; then
Andreas Färbera307beb2012-06-14 15:14:33 +00007372 mkdir -p linux-headers
Peter Maydell6efd7512011-11-30 11:59:04 +00007373 case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07007374 i386|x86_64|x32)
Peter Maydell08312a62012-08-03 13:51:25 +01007375 linux_arch=x86
Peter Maydell6efd7512011-11-30 11:59:04 +00007376 ;;
Richard Hendersonf8378ac2019-05-01 15:38:18 -07007377 ppc|ppc64|ppc64le)
Peter Maydell08312a62012-08-03 13:51:25 +01007378 linux_arch=powerpc
Peter Maydell6efd7512011-11-30 11:59:04 +00007379 ;;
7380 s390x)
Peter Maydell08312a62012-08-03 13:51:25 +01007381 linux_arch=s390
7382 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +01007383 aarch64)
7384 linux_arch=arm64
7385 ;;
Sanjay Lal222e7d12014-06-17 23:10:36 +01007386 mips64)
7387 linux_arch=mips
7388 ;;
Peter Maydell08312a62012-08-03 13:51:25 +01007389 *)
7390 # For most CPUs the kernel architecture name and QEMU CPU name match.
7391 linux_arch="$cpu"
Peter Maydell6efd7512011-11-30 11:59:04 +00007392 ;;
7393 esac
Peter Maydell08312a62012-08-03 13:51:25 +01007394 # For non-KVM architectures we will not have asm headers
7395 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
7396 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
7397 fi
Peter Maydell6efd7512011-11-30 11:59:04 +00007398fi
7399
bellard1d14ffa2005-10-30 18:58:22 +00007400for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00007401target_dir="$target"
Juan Quintela25be2102009-10-07 02:41:00 +02007402config_target_mak=$target_dir/config-target.mak
Stefan Weil89138852016-05-16 15:10:20 +02007403target_name=$(echo $target | cut -d '-' -f 1)
tony.nguyen@bt.com52bf9772019-07-18 06:01:31 +00007404target_aligned_only="no"
7405case "$target_name" in
7406 alpha|hppa|mips64el|mips64|mipsel|mips|mipsn32|mipsn32el|sh4|sh4eb|sparc|sparc64|sparc32plus|xtensa|xtensaeb)
7407 target_aligned_only="yes"
7408 ;;
7409esac
bellard97a847b2003-08-10 21:36:04 +00007410target_bigendian="no"
Paolo Bonzinic1799a82013-06-14 15:19:07 +01007411case "$target_name" in
Thomas Hutha69dc532018-08-21 13:27:48 +02007412 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 +00007413 target_bigendian="yes"
Juan Quintelaea2d6a32009-07-16 18:34:10 +02007414 ;;
7415esac
bellard97a847b2003-08-10 21:36:04 +00007416target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00007417target_user_only="no"
ths831b7822007-01-18 20:06:33 +00007418target_linux_user="no"
blueswir184778502008-10-26 20:33:16 +00007419target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00007420case "$target" in
Paolo Bonzinic1799a82013-06-14 15:19:07 +01007421 ${target_name}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00007422 target_softmmu="yes"
7423 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01007424 ${target_name}-linux-user)
pbrook9e407a82007-05-26 16:38:53 +00007425 target_user_only="yes"
7426 target_linux_user="yes"
7427 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01007428 ${target_name}-bsd-user)
blueswir184778502008-10-26 20:33:16 +00007429 target_user_only="yes"
7430 target_bsd_user="yes"
7431 ;;
pbrook9e407a82007-05-26 16:38:53 +00007432 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01007433 error_exit "Target '$target' not recognised"
pbrook9e407a82007-05-26 16:38:53 +00007434 exit 1
7435 ;;
7436esac
ths831b7822007-01-18 20:06:33 +00007437
bellard97a847b2003-08-10 21:36:04 +00007438mkdir -p $target_dir
Juan Quintela25be2102009-10-07 02:41:00 +02007439echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00007440
pbrooke5fe0c52006-06-11 13:32:59 +00007441bflt="no"
Alex Bennéeca759f92017-02-23 18:29:27 +00007442mttcg="no"
Stefan Weil89138852016-05-16 15:10:20 +02007443interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g")
pbrook56aebc82008-10-11 17:55:29 +00007444gdb_xml_files=""
aliguori7ba1e612008-11-05 16:04:33 +00007445
Paolo Bonzinic1799a82013-06-14 15:19:07 +01007446TARGET_ARCH="$target_name"
Juan Quintela6acff7d2009-07-16 18:34:15 +02007447TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02007448TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02007449
Paolo Bonzinic1799a82013-06-14 15:19:07 +01007450case "$target_name" in
aurel322408a522008-04-20 20:19:44 +00007451 i386)
Emilio G. Cota0a7fa002018-08-13 20:52:26 -04007452 mttcg="yes"
Doug Gale7b0f97b2019-01-24 00:34:57 -03307453 gdb_xml_files="i386-32bit.xml"
aurel322408a522008-04-20 20:19:44 +00007454 ;;
7455 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02007456 TARGET_BASE_ARCH=i386
Emilio G. Cota0a7fa002018-08-13 20:52:26 -04007457 mttcg="yes"
Doug Gale7b0f97b2019-01-24 00:34:57 -03307458 gdb_xml_files="i386-64bit.xml"
aurel322408a522008-04-20 20:19:44 +00007459 ;;
7460 alpha)
Richard Henderson5ee4f3c2017-02-24 09:12:43 +11007461 mttcg="yes"
aurel322408a522008-04-20 20:19:44 +00007462 ;;
7463 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02007464 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00007465 bflt="yes"
Alex Bennéeca759f92017-02-23 18:29:27 +00007466 mttcg="yes"
pbrook56aebc82008-10-11 17:55:29 +00007467 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00007468 ;;
Michael Weiser722dd7b2018-01-11 13:25:32 +00007469 aarch64|aarch64_be)
7470 TARGET_ARCH=aarch64
Alexander Graf6a49fa92013-09-03 20:12:22 +01007471 TARGET_BASE_ARCH=arm
7472 bflt="yes"
Alex Bennéeca759f92017-02-23 18:29:27 +00007473 mttcg="yes"
Peter Maydell8f95ce22014-09-29 18:48:47 +01007474 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Alexander Graf6a49fa92013-09-03 20:12:22 +01007475 ;;
aurel322408a522008-04-20 20:19:44 +00007476 cris)
aurel322408a522008-04-20 20:19:44 +00007477 ;;
Richard Henderson61766fe2016-12-15 11:26:14 -08007478 hppa)
Richard Henderson7b93dab2018-01-06 16:02:27 -08007479 mttcg="yes"
Richard Henderson61766fe2016-12-15 11:26:14 -08007480 ;;
Michael Walle613a22c2011-02-17 23:45:17 +01007481 lm32)
Michael Walle613a22c2011-02-17 23:45:17 +01007482 ;;
aurel322408a522008-04-20 20:19:44 +00007483 m68k)
aurel322408a522008-04-20 20:19:44 +00007484 bflt="yes"
Laurent Vivier5a4526b2017-06-20 22:51:19 +02007485 gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml"
aurel322408a522008-04-20 20:19:44 +00007486 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01007487 microblaze|microblazeel)
7488 TARGET_ARCH=microblaze
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02007489 bflt="yes"
Edgar E. Iglesiasbe73ef62018-04-13 18:10:00 +02007490 echo "TARGET_ABI32=y" >> $config_target_mak
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02007491 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02007492 mips|mipsel)
Aleksandar Markovic04547282019-02-11 17:09:29 +01007493 mttcg="yes"
Juan Quintelab498c8a2009-07-16 18:34:11 +02007494 TARGET_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02007495 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00007496 ;;
7497 mipsn32|mipsn32el)
Aleksandar Markovic04547282019-02-11 17:09:29 +01007498 mttcg="yes"
Richard Henderson597e2ce2013-02-10 10:30:50 -08007499 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02007500 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02007501 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Richard Henderson597e2ce2013-02-10 10:30:50 -08007502 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00007503 ;;
7504 mips64|mips64el)
Aleksandar Markovic04547282019-02-11 17:09:29 +01007505 mttcg="yes"
Juan Quintelab498c8a2009-07-16 18:34:11 +02007506 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02007507 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02007508 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00007509 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04007510 moxie)
7511 ;;
Marek Vasute6717112017-01-18 23:01:46 +01007512 nios2)
7513 ;;
Richard Henderson4a09d0b2017-02-08 15:06:54 -08007514 or1k)
Jia Liue67db062012-07-20 15:50:39 +08007515 TARGET_ARCH=openrisc
7516 TARGET_BASE_ARCH=openrisc
Jia Liue67db062012-07-20 15:50:39 +08007517 ;;
aurel322408a522008-04-20 20:19:44 +00007518 ppc)
aurel32c8b35322009-01-24 15:07:34 +00007519 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00007520 ;;
aurel322408a522008-04-20 20:19:44 +00007521 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02007522 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02007523 TARGET_ABI_DIR=ppc
Nikunj A Dadhaniaf0b06852017-04-27 10:48:23 +05307524 mttcg=yes
Anton Blanchard1438eff2016-01-15 16:00:51 +01007525 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
aurel322408a522008-04-20 20:19:44 +00007526 ;;
Doug Kwan9c351262014-05-29 09:12:21 -05007527 ppc64le)
7528 TARGET_ARCH=ppc64
7529 TARGET_BASE_ARCH=ppc
7530 TARGET_ABI_DIR=ppc
Nikunj A Dadhaniaf0b06852017-04-27 10:48:23 +05307531 mttcg=yes
Anton Blanchard1438eff2016-01-15 16:00:51 +01007532 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 -05007533 ;;
aurel322408a522008-04-20 20:19:44 +00007534 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02007535 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02007536 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02007537 TARGET_ABI_DIR=ppc
Juan Quintela25be2102009-10-07 02:41:00 +02007538 echo "TARGET_ABI32=y" >> $config_target_mak
Anton Blanchard1438eff2016-01-15 16:00:51 +01007539 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
aurel322408a522008-04-20 20:19:44 +00007540 ;;
Michael Clark25fa1942018-03-03 01:32:59 +13007541 riscv32)
7542 TARGET_BASE_ARCH=riscv
7543 TARGET_ABI_DIR=riscv
7544 mttcg=yes
Jim Wilson1a987a12019-03-15 03:26:55 -07007545 gdb_xml_files="riscv-32bit-cpu.xml riscv-32bit-fpu.xml riscv-32bit-csr.xml"
Michael Clark25fa1942018-03-03 01:32:59 +13007546 ;;
7547 riscv64)
7548 TARGET_BASE_ARCH=riscv
7549 TARGET_ABI_DIR=riscv
7550 mttcg=yes
Jim Wilsonc6709702019-03-15 03:26:56 -07007551 gdb_xml_files="riscv-64bit-cpu.xml riscv-64bit-fpu.xml riscv-64bit-csr.xml"
Michael Clark25fa1942018-03-03 01:32:59 +13007552 ;;
aurel322408a522008-04-20 20:19:44 +00007553 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02007554 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00007555 bflt="yes"
7556 ;;
7557 sparc)
aurel322408a522008-04-20 20:19:44 +00007558 ;;
7559 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02007560 TARGET_BASE_ARCH=sparc
aurel322408a522008-04-20 20:19:44 +00007561 ;;
7562 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02007563 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02007564 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02007565 TARGET_ABI_DIR=sparc
Juan Quintela25be2102009-10-07 02:41:00 +02007566 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00007567 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01007568 s390x)
David Hildenbrand63685bc2018-01-29 13:56:20 +01007569 mttcg=yes
Christian Borntraeger86158a22017-03-08 12:41:14 +01007570 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 +01007571 ;;
Chen Gang444e06b2015-08-21 05:43:37 +08007572 tilegx)
7573 ;;
Peter Crosthwaite5ecaa4e2015-04-26 19:14:26 -07007574 tricore)
7575 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +08007576 unicore32)
Guan Xuetaod2fbca92011-04-12 16:27:03 +08007577 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04007578 xtensa|xtensaeb)
7579 TARGET_ARCH=xtensa
Max Filippov02e33e92018-10-19 18:40:20 -07007580 bflt="yes"
Max Filippov9fb40342017-03-06 17:17:43 -08007581 mttcg="yes"
Max Filippovcfa550c2011-09-06 03:55:26 +04007582 ;;
aurel322408a522008-04-20 20:19:44 +00007583 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01007584 error_exit "Unsupported target CPU"
aurel322408a522008-04-20 20:19:44 +00007585 ;;
7586esac
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02007587# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
7588if [ "$TARGET_BASE_ARCH" = "" ]; then
7589 TARGET_BASE_ARCH=$TARGET_ARCH
7590fi
7591
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02007592symlink "$source_path/Makefile.target" "$target_dir/Makefile"
7593
Daniel P. Berrange99afc912012-08-20 15:31:38 +01007594upper() {
7595 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
7596}
7597
Stefan Weil89138852016-05-16 15:10:20 +02007598target_arch_name="$(upper $TARGET_ARCH)"
Juan Quintela25be2102009-10-07 02:41:00 +02007599echo "TARGET_$target_arch_name=y" >> $config_target_mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01007600echo "TARGET_NAME=$target_name" >> $config_target_mak
Juan Quintela25be2102009-10-07 02:41:00 +02007601echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02007602if [ "$TARGET_ABI_DIR" = "" ]; then
7603 TARGET_ABI_DIR=$TARGET_ARCH
7604fi
Juan Quintela25be2102009-10-07 02:41:00 +02007605echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Stacey Sonadfc3e92014-06-08 09:57:22 -07007606if [ "$HOST_VARIANT_DIR" != "" ]; then
7607 echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
7608fi
Paolo Bonzini3b6b7552012-09-17 11:59:41 +02007609
7610if supported_xen_target $target; then
7611 echo "CONFIG_XEN=y" >> $config_target_mak
Paolo Bonzinie0e312f2019-01-23 14:56:01 +08007612 echo "$target/config-devices.mak: CONFIG_XEN=y" >> $config_host_mak
Paolo Bonzini3b6b7552012-09-17 11:59:41 +02007613 if test "$xen_pci_passthrough" = yes; then
Anthony PERARDeb6fda02012-06-21 15:32:59 +00007614 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
Juan Quintela1b0c87f2009-07-16 18:33:59 +02007615 fi
Paolo Bonzinie0e312f2019-01-23 14:56:01 +08007616else
7617 echo "$target/config-devices.mak: CONFIG_XEN=n" >> $config_host_mak
Paolo Bonzini3b6b7552012-09-17 11:59:41 +02007618fi
7619if supported_kvm_target $target; then
7620 echo "CONFIG_KVM=y" >> $config_target_mak
Paolo Bonzinie0e312f2019-01-23 14:56:01 +08007621 echo "$target/config-devices.mak: CONFIG_KVM=y" >> $config_host_mak
7622else
7623 echo "$target/config-devices.mak: CONFIG_KVM=n" >> $config_host_mak
Paolo Bonzini3b6b7552012-09-17 11:59:41 +02007624fi
7625if supported_hax_target $target; then
7626 echo "CONFIG_HAX=y" >> $config_target_mak
Vincent Palatinb0cb0a62017-01-10 11:59:57 +01007627fi
Sergio Andres Gomez Del Realc97d6d22017-09-13 04:05:09 -05007628if supported_hvf_target $target; then
7629 echo "CONFIG_HVF=y" >> $config_target_mak
7630fi
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -08007631if supported_whpx_target $target; then
7632 echo "CONFIG_WHPX=y" >> $config_target_mak
7633fi
tony.nguyen@bt.com52bf9772019-07-18 06:01:31 +00007634if test "$target_aligned_only" = "yes" ; then
7635 echo "TARGET_ALIGNED_ONLY=y" >> $config_target_mak
7636fi
bellardde83cd02003-06-15 20:25:43 +00007637if test "$target_bigendian" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02007638 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00007639fi
7640if test "$target_softmmu" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02007641 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
Alex Bennéeca759f92017-02-23 18:29:27 +00007642 if test "$mttcg" = "yes" ; then
7643 echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak
7644 fi
bellardde83cd02003-06-15 20:25:43 +00007645fi
bellard997344f2003-10-27 21:10:39 +00007646if test "$target_user_only" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02007647 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
Stefan Weila2c80be2011-12-22 11:26:10 +01007648 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00007649fi
ths831b7822007-01-18 20:06:33 +00007650if test "$target_linux_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02007651 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00007652fi
pbrook56aebc82008-10-11 17:55:29 +00007653list=""
7654if test ! -z "$gdb_xml_files" ; then
7655 for x in $gdb_xml_files; do
7656 list="$list $source_path/gdb-xml/$x"
7657 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02007658 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00007659fi
bellardde83cd02003-06-15 20:25:43 +00007660
Eric Blakee633a5c2019-02-04 20:39:37 -06007661if test "$target_user_only" = "yes" && test "$bflt" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02007662 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00007663fi
blueswir184778502008-10-26 20:33:16 +00007664if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02007665 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00007666fi
bellard5b0753e2005-03-01 21:37:28 +00007667
Alex Bennée716a5072018-04-10 12:19:40 +01007668
Juan Quintela4afddb52009-08-03 14:46:45 +02007669# generate QEMU_CFLAGS/LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02007670
Juan Quintela4afddb52009-08-03 14:46:45 +02007671cflags=""
Juan Quintelafa282482009-07-22 22:37:39 +02007672ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02007673
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007674disas_config() {
7675 echo "CONFIG_${1}_DIS=y" >> $config_target_mak
7676 echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak
7677}
7678
Juan Quintela64656022009-08-03 14:46:53 +02007679for i in $ARCH $TARGET_BASE_ARCH ; do
7680 case "$i" in
7681 alpha)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007682 disas_config "ALPHA"
Juan Quintela64656022009-08-03 14:46:53 +02007683 ;;
Richard Henderson82295d82014-03-03 22:53:27 -05007684 aarch64)
7685 if test -n "${cxx}"; then
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007686 disas_config "ARM_A64"
Richard Henderson82295d82014-03-03 22:53:27 -05007687 fi
7688 ;;
Juan Quintela64656022009-08-03 14:46:53 +02007689 arm)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007690 disas_config "ARM"
Claudio Fontana999b53e2014-02-05 17:27:28 +00007691 if test -n "${cxx}"; then
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007692 disas_config "ARM_A64"
Claudio Fontana999b53e2014-02-05 17:27:28 +00007693 fi
Juan Quintela64656022009-08-03 14:46:53 +02007694 ;;
7695 cris)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007696 disas_config "CRIS"
Juan Quintela64656022009-08-03 14:46:53 +02007697 ;;
Richard Henderson429b31a2016-09-29 10:55:53 -07007698 hppa)
7699 disas_config "HPPA"
7700 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07007701 i386|x86_64|x32)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007702 disas_config "I386"
Juan Quintela64656022009-08-03 14:46:53 +02007703 ;;
Michael Walle79368f42012-03-31 19:54:20 +02007704 lm32)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007705 disas_config "LM32"
Michael Walle79368f42012-03-31 19:54:20 +02007706 ;;
Juan Quintela64656022009-08-03 14:46:53 +02007707 m68k)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007708 disas_config "M68K"
Juan Quintela64656022009-08-03 14:46:53 +02007709 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01007710 microblaze*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007711 disas_config "MICROBLAZE"
Juan Quintela64656022009-08-03 14:46:53 +02007712 ;;
7713 mips*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007714 disas_config "MIPS"
Aleksandar Markovic89a955e2018-10-24 17:41:49 +02007715 if test -n "${cxx}"; then
7716 disas_config "NANOMIPS"
7717 fi
Juan Quintela64656022009-08-03 14:46:53 +02007718 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04007719 moxie*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007720 disas_config "MOXIE"
Anthony Greend15a9c22013-03-18 15:49:25 -04007721 ;;
Marek Vasute6717112017-01-18 23:01:46 +01007722 nios2)
7723 disas_config "NIOS2"
7724 ;;
Richard Henderson4a09d0b2017-02-08 15:06:54 -08007725 or1k)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007726 disas_config "OPENRISC"
Jia Liue67db062012-07-20 15:50:39 +08007727 ;;
Juan Quintela64656022009-08-03 14:46:53 +02007728 ppc*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007729 disas_config "PPC"
Juan Quintela64656022009-08-03 14:46:53 +02007730 ;;
Alistair Francisc4f80542018-12-19 19:20:19 +00007731 riscv*)
Michael Clark25fa1942018-03-03 01:32:59 +13007732 disas_config "RISCV"
7733 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01007734 s390*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007735 disas_config "S390"
Juan Quintela64656022009-08-03 14:46:53 +02007736 ;;
7737 sh4)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007738 disas_config "SH4"
Juan Quintela64656022009-08-03 14:46:53 +02007739 ;;
7740 sparc*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007741 disas_config "SPARC"
Juan Quintela64656022009-08-03 14:46:53 +02007742 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04007743 xtensa*)
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007744 disas_config "XTENSA"
Max Filippovcfa550c2011-09-06 03:55:26 +04007745 ;;
Juan Quintela64656022009-08-03 14:46:53 +02007746 esac
7747done
Stefan Weil9195b2c2011-10-19 07:07:18 +02007748if test "$tcg_interpreter" = "yes" ; then
Peter Crosthwaitec765fca2015-08-29 03:33:59 -07007749 disas_config "TCI"
Stefan Weil9195b2c2011-10-19 07:07:18 +02007750fi
Juan Quintela64656022009-08-03 14:46:53 +02007751
Juan Quintela6ee71262009-08-03 14:46:47 +02007752case "$ARCH" in
7753alpha)
7754 # Ensure there's only a single GP
7755 cflags="-msmall-data $cflags"
7756;;
7757esac
7758
Juan Quintelad02c1db2009-08-03 14:46:50 +02007759if test "$gprof" = "yes" ; then
Philippe Mathieu-Daudé0acf7de2019-01-03 16:09:50 +01007760 echo "TARGET_GPROF=y" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02007761 if test "$target_linux_user" = "yes" ; then
7762 cflags="-p $cflags"
7763 ldflags="-p $ldflags"
7764 fi
7765 if test "$target_softmmu" = "yes" ; then
7766 ldflags="-p $ldflags"
Juan Quintela25be2102009-10-07 02:41:00 +02007767 echo "GPROF_CFLAGS=-p" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02007768 fi
7769fi
7770
Eric Blakee633a5c2019-02-04 20:39:37 -06007771if test "$target_linux_user" = "yes" || test "$target_bsd_user" = "yes" ; then
Richard Henderson964c6fa2013-06-21 19:10:16 -07007772 ldflags="$ldflags $textseg_ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02007773fi
Juan Quintelafa282482009-07-22 22:37:39 +02007774
Christian Borntraegere9a35912017-08-23 12:16:23 +02007775# Newer kernels on s390 check for an S390_PGSTE program header and
7776# enable the pgste page table extensions in that case. This makes
7777# the vm.allocate_pgste sysctl unnecessary. We enable this program
7778# header if
7779# - we build on s390x
7780# - we build the system emulation for s390x (qemu-system-s390x)
7781# - KVM is enabled
7782# - the linker supports --s390-pgste
Eric Blakee633a5c2019-02-04 20:39:37 -06007783if test "$TARGET_ARCH" = "s390x" && test "$target_softmmu" = "yes" && \
7784 test "$ARCH" = "s390x" && test "$kvm" = "yes"; then
Christian Borntraegere9a35912017-08-23 12:16:23 +02007785 if ld_has --s390-pgste ; then
7786 ldflags="-Wl,--s390-pgste $ldflags"
7787 fi
7788fi
7789
Juan Quintela25be2102009-10-07 02:41:00 +02007790echo "LDFLAGS+=$ldflags" >> $config_target_mak
7791echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02007792
bellard97a847b2003-08-10 21:36:04 +00007793done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00007794
Marc-André Lureaud52c4542019-05-24 15:09:42 +02007795echo "PIXMAN_CFLAGS=$pixman_cflags" >> $config_host_mak
7796echo "PIXMAN_LIBS=$pixman_libs" >> $config_host_mak
7797
Philippe Mathieu-Daudée3971d62018-04-15 20:05:20 -03007798if [ "$fdt" = "git" ]; then
Markus Armbruster3b8593e2019-05-28 10:23:07 +02007799 echo "config-host.h: dtc/all" >> $config_host_mak
Peter Crosthwaitea540f152013-04-18 14:47:31 +10007800fi
Richard Hendersone219c492017-09-28 09:01:23 -07007801if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then
Markus Armbruster3b8593e2019-05-28 10:23:07 +02007802 echo "config-host.h: capstone/all" >> $config_host_mak
Richard Hendersone219c492017-09-28 09:01:23 -07007803fi
7804if test -n "$LIBCAPSTONE"; then
7805 echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak
7806fi
Peter Crosthwaitea540f152013-04-18 14:47:31 +10007807
Wanlong Gaoa99d57b2014-05-14 17:43:28 +08007808if test "$numa" = "yes"; then
7809 echo "CONFIG_NUMA=y" >> $config_host_mak
7810fi
7811
John Snowfd0e6052015-03-25 18:57:39 -04007812if test "$ccache_cpp2" = "yes"; then
7813 echo "export CCACHE_CPP2=y" >> $config_host_mak
7814fi
7815
Peter Maydelle29e5c62018-11-02 11:52:38 +00007816# If we're using a separate build tree, set it up now.
7817# DIRS are directories which we simply mkdir in the build tree;
7818# LINKS are things to symlink back into the source tree
7819# (these can be both files and directories).
7820# Caution: do not add files or directories here using wildcards. This
7821# will result in problems later if a new file matching the wildcard is
7822# added to the source tree -- nothing will cause configure to be rerun
7823# so the build tree will be missing the link back to the new file, and
7824# tests might fail. Prefer to keep the relevant files in their own
7825# directory and symlink the directory instead.
Paolo Bonzini2038f8c2019-08-07 16:35:23 +02007826DIRS="tests tests/tcg tests/tcg/lm32 tests/libqos tests/qapi-schema tests/qemu-iotests tests/vm"
Emanuele Giuseppe Espositofc281c82018-06-13 17:07:21 +02007827DIRS="$DIRS tests/fp tests/qgraph"
Paolo Bonzinib855f8d2017-08-22 06:50:18 +02007828DIRS="$DIRS docs docs/interop fsdev scsi"
Alexey Kardashevskiy744a9282019-07-16 15:27:43 +10007829DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01007830DIRS="$DIRS roms/seabios roms/vgabios"
Paolo Bonzini2038f8c2019-08-07 16:35:23 +02007831LINKS="Makefile"
7832LINKS="$LINKS tests/tcg/lm32/Makefile po/Makefile"
7833LINKS="$LINKS tests/tcg/Makefile.target tests/fp/Makefile"
Peter Maydelle29e5c62018-11-02 11:52:38 +00007834LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps"
Peter Maydelle29e5c62018-11-02 11:52:38 +00007835LINKS="$LINKS pc-bios/s390-ccw/Makefile"
7836LINKS="$LINKS roms/seabios/Makefile roms/vgabios/Makefile"
7837LINKS="$LINKS pc-bios/qemu-icon.bmp"
7838LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
Peter Maydell39950352018-11-02 11:52:39 +00007839LINKS="$LINKS tests/acceptance tests/data"
7840LINKS="$LINKS tests/qemu-iotests/check"
Cleber Rosa8f8fd9e2019-02-06 11:29:01 -05007841LINKS="$LINKS python"
Richard Henderson753d11f2011-06-24 11:58:37 -07007842for bios_file in \
7843 $source_path/pc-bios/*.bin \
Alexey Kardashevskiy225a9ab2016-10-26 13:18:03 +11007844 $source_path/pc-bios/*.lid \
Richard Henderson753d11f2011-06-24 11:58:37 -07007845 $source_path/pc-bios/*.rom \
7846 $source_path/pc-bios/*.dtb \
Dominik Dingele89e33e2013-04-29 04:52:06 +00007847 $source_path/pc-bios/*.img \
Richard Henderson753d11f2011-06-24 11:58:37 -07007848 $source_path/pc-bios/openbios-* \
Alexander Graf4e73c782014-01-20 00:25:40 +01007849 $source_path/pc-bios/u-boot.* \
Laszlo Ersek26ce90f2019-03-08 01:19:35 +01007850 $source_path/pc-bios/edk2-*.fd.bz2 \
Richard Henderson753d11f2011-06-24 11:58:37 -07007851 $source_path/pc-bios/palcode-*
7852do
Peter Maydelle29e5c62018-11-02 11:52:38 +00007853 LINKS="$LINKS pc-bios/$(basename $bios_file)"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01007854done
7855mkdir -p $DIRS
Peter Maydelle29e5c62018-11-02 11:52:38 +00007856for f in $LINKS ; do
Michael S. Tsirkincab00a52014-04-28 15:09:01 +03007857 if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
Peter Maydellf9245e12011-06-03 17:10:40 +01007858 symlink "$source_path/$f" "$f"
7859 fi
Paolo Bonzinid1807a42010-12-23 11:43:59 +01007860done
Paul Brook1ad21342009-05-19 16:17:58 +01007861
Paolo Bonzini2038f8c2019-08-07 16:35:23 +02007862(for i in $cross_cc_vars; do
7863 export $i
7864done
7865export target_list source_path
7866$source_path/tests/tcg/configure.sh)
7867
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007868# temporary config to build submodules
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06007869for rom in seabios vgabios ; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007870 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01007871 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007872 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
Richard Hendersoncdbd7272016-07-07 21:49:36 -07007873 echo "AS=$as" >> $config_mak
Richard Henderson5f6f0e22016-06-23 10:39:18 -07007874 echo "CCAS=$ccas" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007875 echo "CC=$cc" >> $config_mak
7876 echo "BCC=bcc" >> $config_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00007877 echo "CPP=$cpp" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007878 echo "OBJCOPY=objcopy" >> $config_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03007879 echo "IASL=$iasl" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007880 echo "LD=$ld" >> $config_mak
Alistair Francis9f81aeb2017-11-07 17:10:46 -08007881 echo "RANLIB=$ranlib" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05007882done
7883
Max Reitz76c75602014-05-24 23:24:56 +02007884# set up qemu-iotests in this build directory
7885iotests_common_env="tests/qemu-iotests/common.env"
Max Reitz76c75602014-05-24 23:24:56 +02007886
7887echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
7888echo >> "$iotests_common_env"
7889echo "export PYTHON='$python'" >> "$iotests_common_env"
7890
Michael S. Tsirkindc655402014-03-09 17:37:49 +02007891# Save the configure command line for later reuse.
7892cat <<EOD >config.status
7893#!/bin/sh
7894# Generated by configure.
7895# Run this file to recreate the current configuration.
7896# Compiler output produced by configure, useful for debugging
7897# configure, is in config.log if it exists.
7898EOD
Daniel P. Berrangée811da72018-09-04 13:36:03 +01007899
7900preserve_env() {
7901 envname=$1
7902
7903 eval envval=\$$envname
7904
7905 if test -n "$envval"
7906 then
7907 echo "$envname='$envval'" >> config.status
7908 echo "export $envname" >> config.status
7909 else
7910 echo "unset $envname" >> config.status
7911 fi
7912}
7913
7914# Preserve various env variables that influence what
7915# features/build target configure will detect
7916preserve_env AR
7917preserve_env AS
7918preserve_env CC
7919preserve_env CPP
7920preserve_env CXX
7921preserve_env INSTALL
7922preserve_env LD
7923preserve_env LD_LIBRARY_PATH
7924preserve_env LIBTOOL
7925preserve_env MAKE
7926preserve_env NM
7927preserve_env OBJCOPY
7928preserve_env PATH
7929preserve_env PKG_CONFIG
7930preserve_env PKG_CONFIG_LIBDIR
7931preserve_env PKG_CONFIG_PATH
7932preserve_env PYTHON
Daniel P. Berrangée811da72018-09-04 13:36:03 +01007933preserve_env SDL2_CONFIG
7934preserve_env SMBD
7935preserve_env STRIP
7936preserve_env WINDRES
7937
Michael S. Tsirkindc655402014-03-09 17:37:49 +02007938printf "exec" >>config.status
7939printf " '%s'" "$0" "$@" >>config.status
Dr. David Alan Gilbertcf7cc922016-01-12 11:58:48 +00007940echo ' "$@"' >>config.status
Michael S. Tsirkindc655402014-03-09 17:37:49 +02007941chmod +x config.status
7942
Peter Maydell8cd05ab2014-05-23 17:07:24 +01007943rm -r "$TMPDIR1"