]>
Commit | Line | Data |
---|---|---|
7d13299d FB |
1 | #!/bin/sh |
2 | # | |
3ef693a0 | 3 | # qemu configure script (c) 2003 Fabrice Bellard |
7d13299d | 4 | # |
8cd05ab6 | 5 | |
99519e67 CH |
6 | # Unset some variables known to interfere with behavior of common tools, |
7 | # just as autoconf does. | |
8 | CLICOLOR_FORCE= GREP_OPTIONS= | |
9 | unset CLICOLOR_FORCE GREP_OPTIONS | |
10 | ||
5e4dfd3d JS |
11 | # Don't allow CCACHE, if present, to use cached results of compile tests! |
12 | export CCACHE_RECACHE=yes | |
13 | ||
8cd05ab6 PM |
14 | # 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.) | |
19 | TMPDIR1="config-temp" | |
20 | rm -rf "${TMPDIR1}" | |
21 | mkdir -p "${TMPDIR1}" | |
22 | if [ $? -ne 0 ]; then | |
23 | echo "ERROR: failed to create temporary directory" | |
24 | exit 1 | |
7d13299d FB |
25 | fi |
26 | ||
8cd05ab6 PM |
27 | TMPB="qemu-conf" |
28 | TMPC="${TMPDIR1}/${TMPB}.c" | |
66518bf6 | 29 | TMPO="${TMPDIR1}/${TMPB}.o" |
9c83ffd8 | 30 | TMPCXX="${TMPDIR1}/${TMPB}.cxx" |
8cd05ab6 | 31 | TMPE="${TMPDIR1}/${TMPB}.exe" |
6969ec6c | 32 | TMPMO="${TMPDIR1}/${TMPB}.mo" |
26fffe29 | 33 | TMPTXT="${TMPDIR1}/${TMPB}.txt" |
7d13299d | 34 | |
da1d85e3 | 35 | rm -f config.log |
9ac81bbb | 36 | |
b48e3611 PM |
37 | # Print a helpful header at the top of config.log |
38 | echo "# QEMU configure log $(date)" >> config.log | |
979ae168 PM |
39 | printf "# Configured with:" >> config.log |
40 | printf " '%s'" "$0" "$@" >> config.log | |
41 | echo >> config.log | |
b48e3611 PM |
42 | echo "#" >> config.log |
43 | ||
d880a3ba PB |
44 | print_error() { |
45 | (echo | |
76ad07a4 PM |
46 | echo "ERROR: $1" |
47 | while test -n "$2"; do | |
48 | echo " $2" | |
49 | shift | |
50 | done | |
d880a3ba PB |
51 | echo) >&2 |
52 | } | |
53 | ||
54 | error_exit() { | |
55 | print_error "$@" | |
76ad07a4 PM |
56 | exit 1 |
57 | } | |
58 | ||
9c83ffd8 PM |
59 | do_compiler() { |
60 | # Run the compiler, capturing its output to the log. First argument | |
61 | # is compiler binary to execute. | |
62 | local compiler="$1" | |
63 | shift | |
8bbe05d7 IJ |
64 | if test -n "$BASH_VERSION"; then eval ' |
65 | echo >>config.log " | |
66 | funcs: ${FUNCNAME[*]} | |
67 | lines: ${BASH_LINENO[*]}" | |
68 | '; fi | |
9c83ffd8 PM |
69 | echo $compiler "$@" >> config.log |
70 | $compiler "$@" >> config.log 2>&1 || return $? | |
8dc38a78 PM |
71 | # Test passed. If this is an --enable-werror build, rerun |
72 | # the test with -Werror and bail out if it fails. This | |
73 | # makes warning-generating-errors in configure test code | |
74 | # obvious to developers. | |
75 | if test "$werror" != "yes"; then | |
76 | return 0 | |
77 | fi | |
78 | # Don't bother rerunning the compile if we were already using -Werror | |
79 | case "$*" in | |
80 | *-Werror*) | |
81 | return 0 | |
82 | ;; | |
83 | esac | |
9c83ffd8 PM |
84 | echo $compiler -Werror "$@" >> config.log |
85 | $compiler -Werror "$@" >> config.log 2>&1 && return $? | |
76ad07a4 PM |
86 | error_exit "configure test passed without -Werror but failed with -Werror." \ |
87 | "This is probably a bug in the configure script. The failing command" \ | |
88 | "will be at the bottom of config.log." \ | |
89 | "You can run configure with --disable-werror to bypass this check." | |
8dc38a78 PM |
90 | } |
91 | ||
9c83ffd8 PM |
92 | do_cc() { |
93 | do_compiler "$cc" "$@" | |
94 | } | |
95 | ||
96 | do_cxx() { | |
97 | do_compiler "$cxx" "$@" | |
98 | } | |
99 | ||
100 | update_cxxflags() { | |
101 | # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those | |
102 | # options which some versions of GCC's C++ compiler complain about | |
103 | # because they only make sense for C programs. | |
53422040 | 104 | QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" |
11cde1c8 | 105 | |
9c83ffd8 PM |
106 | for arg in $QEMU_CFLAGS; do |
107 | case $arg in | |
108 | -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ | |
109 | -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls) | |
110 | ;; | |
7be41675 TH |
111 | -std=gnu99) |
112 | QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }"-std=gnu++98" | |
113 | ;; | |
9c83ffd8 PM |
114 | *) |
115 | QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg | |
116 | ;; | |
117 | esac | |
118 | done | |
119 | } | |
120 | ||
52166aa0 | 121 | compile_object() { |
fd0e6053 JS |
122 | local_cflags="$1" |
123 | do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC | |
52166aa0 JQ |
124 | } |
125 | ||
126 | compile_prog() { | |
127 | local_cflags="$1" | |
128 | local_ldflags="$2" | |
db5adeaa | 129 | do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $QEMU_LDFLAGS $local_ldflags |
52166aa0 JQ |
130 | } |
131 | ||
11568d6d PB |
132 | # symbolically link $1 to $2. Portable version of "ln -sf". |
133 | symlink() { | |
72b8b5a1 | 134 | rm -rf "$2" |
ec5b06d7 | 135 | mkdir -p "$(dirname "$2")" |
72b8b5a1 | 136 | ln -s "$1" "$2" |
11568d6d PB |
137 | } |
138 | ||
0dba6195 LM |
139 | # check whether a command is available to this shell (may be either an |
140 | # executable or a builtin) | |
141 | has() { | |
142 | type "$1" >/dev/null 2>&1 | |
143 | } | |
144 | ||
145 | # search for an executable in PATH | |
146 | path_of() { | |
147 | local_command="$1" | |
148 | local_ifs="$IFS" | |
149 | local_dir="" | |
150 | ||
151 | # pathname has a dir component? | |
152 | if [ "${local_command#*/}" != "$local_command" ]; then | |
153 | if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then | |
154 | echo "$local_command" | |
155 | return 0 | |
156 | fi | |
157 | fi | |
158 | if [ -z "$local_command" ]; then | |
159 | return 1 | |
160 | fi | |
161 | ||
162 | IFS=: | |
163 | for local_dir in $PATH; do | |
164 | if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then | |
165 | echo "$local_dir/$local_command" | |
166 | IFS="${local_ifs:-$(printf ' \t\n')}" | |
167 | return 0 | |
168 | fi | |
169 | done | |
170 | # not found | |
171 | IFS="${local_ifs:-$(printf ' \t\n')}" | |
172 | return 1 | |
173 | } | |
174 | ||
5b808275 LV |
175 | have_backend () { |
176 | echo "$trace_backends" | grep "$1" >/dev/null | |
177 | } | |
178 | ||
3b6b7550 PB |
179 | glob() { |
180 | eval test -z '"${1#'"$2"'}"' | |
181 | } | |
182 | ||
183 | supported_hax_target() { | |
184 | test "$hax" = "yes" || return 1 | |
185 | glob "$1" "*-softmmu" || return 1 | |
186 | case "${1%-softmmu}" in | |
187 | i386|x86_64) | |
188 | return 0 | |
189 | ;; | |
190 | esac | |
191 | return 1 | |
192 | } | |
193 | ||
194 | supported_kvm_target() { | |
195 | test "$kvm" = "yes" || return 1 | |
196 | glob "$1" "*-softmmu" || return 1 | |
197 | case "${1%-softmmu}:$cpu" in | |
198 | arm:arm | aarch64:aarch64 | \ | |
199 | i386:i386 | i386:x86_64 | i386:x32 | \ | |
200 | x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \ | |
aa2953fd | 201 | mips:mips | mipsel:mips | mips64:mips | mips64el:mips | \ |
f8378acc | 202 | ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | ppc64:ppc64le | \ |
3b6b7550 PB |
203 | s390x:s390x) |
204 | return 0 | |
205 | ;; | |
206 | esac | |
207 | return 1 | |
208 | } | |
209 | ||
210 | supported_xen_target() { | |
211 | test "$xen" = "yes" || return 1 | |
212 | glob "$1" "*-softmmu" || return 1 | |
b5ed2e11 PB |
213 | # Only i386 and x86_64 provide the xenpv machine. |
214 | case "${1%-softmmu}" in | |
215 | i386|x86_64) | |
3b6b7550 PB |
216 | return 0 |
217 | ;; | |
218 | esac | |
219 | return 1 | |
220 | } | |
221 | ||
c97d6d2c SAGDR |
222 | supported_hvf_target() { |
223 | test "$hvf" = "yes" || return 1 | |
224 | glob "$1" "*-softmmu" || return 1 | |
225 | case "${1%-softmmu}" in | |
226 | x86_64) | |
227 | return 0 | |
228 | ;; | |
229 | esac | |
230 | return 1 | |
231 | } | |
232 | ||
d661d9a4 JTV |
233 | supported_whpx_target() { |
234 | test "$whpx" = "yes" || return 1 | |
235 | glob "$1" "*-softmmu" || return 1 | |
236 | case "${1%-softmmu}" in | |
237 | i386|x86_64) | |
238 | return 0 | |
239 | ;; | |
240 | esac | |
241 | return 1 | |
242 | } | |
243 | ||
d880a3ba PB |
244 | supported_target() { |
245 | case "$1" in | |
246 | *-softmmu) | |
247 | ;; | |
248 | *-linux-user) | |
249 | if test "$linux" != "yes"; then | |
250 | print_error "Target '$target' is only available on a Linux host" | |
251 | return 1 | |
252 | fi | |
253 | ;; | |
254 | *-bsd-user) | |
255 | if test "$bsd" != "yes"; then | |
256 | print_error "Target '$target' is only available on a BSD host" | |
257 | return 1 | |
258 | fi | |
259 | ;; | |
260 | *) | |
261 | print_error "Invalid target name '$target'" | |
262 | return 1 | |
263 | ;; | |
264 | esac | |
b3f6ea7e PB |
265 | test "$tcg" = "yes" && return 0 |
266 | supported_kvm_target "$1" && return 0 | |
267 | supported_xen_target "$1" && return 0 | |
268 | supported_hax_target "$1" && return 0 | |
c97d6d2c | 269 | supported_hvf_target "$1" && return 0 |
d661d9a4 | 270 | supported_whpx_target "$1" && return 0 |
b3f6ea7e PB |
271 | print_error "TCG disabled, but hardware accelerator not available for '$target'" |
272 | return 1 | |
d880a3ba PB |
273 | } |
274 | ||
e9a3591f CB |
275 | |
276 | ld_has() { | |
277 | $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1 | |
278 | } | |
279 | ||
79d77bcd | 280 | # make source path absolute |
14211825 AO |
281 | source_path=$(cd "$(dirname -- "$0")"; pwd) |
282 | ||
4ace32e2 AO |
283 | if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]"; |
284 | then | |
285 | error_exit "main directory cannot contain spaces nor colons" | |
286 | fi | |
287 | ||
14211825 | 288 | # default parameters |
2ff6b91e | 289 | cpu="" |
a31a8642 | 290 | iasl="iasl" |
1e43adfc | 291 | interp_prefix="/usr/gnemul/qemu-%M" |
43ce4dfe | 292 | static="no" |
7d13299d | 293 | cross_prefix="" |
0c58ac1c | 294 | audio_drv_list="" |
b64ec4e4 FZ |
295 | block_drv_rw_whitelist="" |
296 | block_drv_ro_whitelist="" | |
e49d021e | 297 | host_cc="cc" |
02f9135b | 298 | libs_cpu="" |
73da375e | 299 | libs_softmmu="" |
3e2e0e6b | 300 | libs_tools="" |
d5631638 | 301 | audio_win_int="" |
957f1f99 | 302 | libs_qga="" |
5bc62e01 | 303 | debug_info="yes" |
63678e17 | 304 | stack_protector="" |
afc3a8f9 | 305 | use_containers="yes" |
f2385398 | 306 | gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb") |
ac0df51d | 307 | |
92712822 DB |
308 | if test -e "$source_path/.git" |
309 | then | |
f62bbee5 | 310 | git_update=yes |
92712822 | 311 | git_submodules="ui/keycodemapdb" |
3ac1f813 EC |
312 | git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" |
313 | git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" | |
92712822 | 314 | else |
f62bbee5 | 315 | git_update=no |
92712822 | 316 | git_submodules="" |
5c0ef67a DB |
317 | |
318 | if ! test -f "$source_path/ui/keycodemapdb/README" | |
319 | then | |
320 | echo | |
321 | echo "ERROR: missing file $source_path/ui/keycodemapdb/README" | |
322 | echo | |
323 | echo "This is not a GIT checkout but module content appears to" | |
324 | echo "be missing. Do not use 'git archive' or GitHub download links" | |
325 | echo "to acquire QEMU source archives. Non-GIT builds are only" | |
326 | echo "supported with source archives linked from:" | |
327 | echo | |
a3e3b521 | 328 | echo " https://www.qemu.org/download/#source" |
5c0ef67a DB |
329 | echo |
330 | echo "Developers working with GIT can use scripts/archive-source.sh" | |
331 | echo "if they need to create valid source archives." | |
332 | echo | |
333 | exit 1 | |
334 | fi | |
92712822 | 335 | fi |
cc84d63a | 336 | git="git" |
ac0df51d | 337 | |
afb63ebd SW |
338 | # Don't accept a target_list environment variable. |
339 | unset target_list | |
447e133f | 340 | unset target_list_exclude |
377529c0 PB |
341 | |
342 | # Default value for a variable defining feature "foo". | |
343 | # * foo="no" feature will only be used if --enable-foo arg is given | |
344 | # * foo="" feature will be searched for, and if found, will be used | |
345 | # unless --disable-foo is given | |
346 | # * foo="yes" this value will only be set by --enable-foo flag. | |
347 | # feature will searched for, | |
348 | # if not found, configure exits with error | |
349 | # | |
350 | # Always add --enable-foo and --disable-foo command line args. | |
351 | # Distributions want to ensure that several features are compiled in, and it | |
352 | # is impossible without a --enable-foo that exits if a feature is not found. | |
353 | ||
377529c0 PB |
354 | brlapi="" |
355 | curl="" | |
356 | curses="" | |
357 | docs="" | |
358 | fdt="" | |
58952137 | 359 | netmap="no" |
377529c0 | 360 | sdl="" |
a442fe2f | 361 | sdl_image="" |
983eef5a | 362 | virtfs="" |
fe8fc5ae | 363 | mpath="" |
821601ea | 364 | vnc="yes" |
377529c0 | 365 | sparse="no" |
377529c0 | 366 | vde="" |
377529c0 PB |
367 | vnc_sasl="" |
368 | vnc_jpeg="" | |
369 | vnc_png="" | |
6a021536 | 370 | xkbcommon="" |
377529c0 | 371 | xen="" |
d5b93ddf | 372 | xen_ctrl_version="" |
eb6fda0f | 373 | xen_pci_passthrough="" |
377529c0 | 374 | linux_aio="" |
c10dd856 | 375 | linux_io_uring="" |
47e98658 | 376 | cap_ng="" |
377529c0 | 377 | attr="" |
4f26f2b6 | 378 | libattr="" |
377529c0 | 379 | xfs="" |
b3f6ea7e | 380 | tcg="yes" |
a40161cb | 381 | membarrier="" |
299e6f19 PB |
382 | vhost_net="" |
383 | vhost_crypto="" | |
384 | vhost_scsi="" | |
385 | vhost_vsock="" | |
e6a74868 | 386 | vhost_user="" |
98fc1ada | 387 | vhost_user_fs="" |
d41a75a2 | 388 | kvm="no" |
b0cb0a66 | 389 | hax="no" |
c97d6d2c | 390 | hvf="no" |
d661d9a4 | 391 | whpx="no" |
2da776db | 392 | rdma="" |
21ab34c9 | 393 | pvrdma="" |
377529c0 PB |
394 | gprof="no" |
395 | debug_tcg="no" | |
377529c0 | 396 | debug="no" |
247724cb | 397 | sanitizers="no" |
0aebab04 | 398 | tsan="no" |
b553a042 | 399 | fortify_source="" |
377529c0 | 400 | strip_opt="yes" |
9195b2c2 | 401 | tcg_interpreter="no" |
377529c0 PB |
402 | bigendian="no" |
403 | mingw32="no" | |
1d728c39 BS |
404 | gcov="no" |
405 | gcov_tool="gcov" | |
377529c0 | 406 | EXESUF="" |
17969268 FZ |
407 | DSOSUF=".so" |
408 | LDFLAGS_SHARED="-shared" | |
409 | modules="no" | |
bd83c861 | 410 | module_upgrades="no" |
377529c0 PB |
411 | prefix="/usr/local" |
412 | mandir="\${prefix}/share/man" | |
528ae5b8 | 413 | datadir="\${prefix}/share" |
3d5eecab | 414 | firmwarepath="\${prefix}/share/qemu-firmware" |
850da188 | 415 | qemu_docdir="\${prefix}/share/doc/qemu" |
377529c0 | 416 | bindir="\${prefix}/bin" |
3aa5d2be | 417 | libdir="\${prefix}/lib" |
8bf188aa | 418 | libexecdir="\${prefix}/libexec" |
0f94d6da | 419 | includedir="\${prefix}/include" |
377529c0 | 420 | sysconfdir="\${prefix}/etc" |
785c23ae | 421 | local_statedir="\${prefix}/var" |
377529c0 | 422 | confsuffix="/qemu" |
675b9b53 | 423 | slirp="" |
377529c0 PB |
424 | oss_lib="" |
425 | bsd="no" | |
426 | linux="no" | |
427 | solaris="no" | |
428 | profiler="no" | |
429 | cocoa="no" | |
430 | softmmu="yes" | |
431 | linux_user="no" | |
377529c0 | 432 | bsd_user="no" |
377529c0 | 433 | blobs="yes" |
05dfa22b | 434 | edk2_blobs="no" |
377529c0 | 435 | pkgversion="" |
40d6444e | 436 | pie="" |
3556c233 | 437 | qom_cast_debug="yes" |
baf86d6b | 438 | trace_backends="log" |
377529c0 PB |
439 | trace_file="trace" |
440 | spice="" | |
441 | rbd="" | |
7b02f544 | 442 | smartcard="" |
2b2325ff | 443 | libusb="" |
69354a83 | 444 | usb_redir="" |
da076ffe | 445 | opengl="" |
014cb152 | 446 | opengl_dmabuf="no" |
5dd89908 | 447 | cpuid_h="no" |
86583a07 | 448 | avx2_opt="" |
1ece9905 | 449 | zlib="yes" |
8ca80760 | 450 | capstone="" |
b25c9dff SW |
451 | lzo="" |
452 | snappy="" | |
6b383c08 | 453 | bzip2="" |
83bc1f97 | 454 | lzfse="" |
3a678481 | 455 | zstd="" |
e8ef31a3 | 456 | guest_agent="" |
d9840e25 | 457 | guest_agent_with_vss="no" |
50cbebb9 | 458 | guest_agent_ntddscsi="no" |
9dacf32d | 459 | guest_agent_msi="" |
d9840e25 TS |
460 | vss_win32_sdk="" |
461 | win_sdk="no" | |
e10ee3f5 | 462 | want_tools="" |
c589b249 | 463 | libiscsi="" |
6542aa9c | 464 | libnfs="" |
519175a2 | 465 | coroutine="" |
70c60c08 | 466 | coroutine_pool="" |
7d992e4d | 467 | debug_stack_usage="no" |
f0d92b56 | 468 | crypto_afalg="no" |
f794573e | 469 | seccomp="" |
eb100396 | 470 | glusterfs="" |
d85fa9eb | 471 | glusterfs_xlator_opt="no" |
0c14fb47 | 472 | glusterfs_discard="no" |
df3a429a | 473 | glusterfs_fallocate="no" |
7c815372 | 474 | glusterfs_zerofill="no" |
e014dbe7 | 475 | glusterfs_ftruncate_has_stat="no" |
0e3b891f | 476 | glusterfs_iocb_has_stat="no" |
a4ccabcf | 477 | gtk="" |
925a0400 | 478 | gtk_gl="no" |
a1c5e949 | 479 | tls_priority="NORMAL" |
ddbb0d09 | 480 | gnutls="" |
91bfcdb0 | 481 | nettle="" |
dc2207af | 482 | nettle_xts="no" |
91bfcdb0 | 483 | gcrypt="" |
1f923c70 | 484 | gcrypt_hmac="no" |
e0576942 DB |
485 | gcrypt_xts="no" |
486 | qemu_private_xts="yes" | |
8953caf3 | 487 | auth_pam="" |
bbbf9bfb | 488 | vte="" |
9d9e1521 | 489 | virglrenderer="" |
7aaa6a16 | 490 | tpm="" |
b10d49d7 | 491 | libssh="" |
ed1701c6 | 492 | live_block_migration="yes" |
a99d57bb | 493 | numa="" |
2847b469 | 494 | tcmalloc="no" |
7b01cb97 | 495 | jemalloc="no" |
a6b1d4c0 | 496 | replication="yes" |
da92c3ff | 497 | vxhs="" |
2f740136 JC |
498 | bochs="yes" |
499 | cloop="yes" | |
500 | dmg="yes" | |
501 | qcow1="yes" | |
502 | vdi="yes" | |
503 | vvfat="yes" | |
504 | qed="yes" | |
505 | parallels="yes" | |
506 | sheepdog="yes" | |
ed279a06 | 507 | libxml2="" |
ba59fb77 | 508 | debug_mutex="no" |
17824406 | 509 | libpmem="" |
f3494749 | 510 | default_devices="yes" |
40e8c6f4 | 511 | plugins="no" |
adc28027 | 512 | fuzzing="no" |
b767d257 | 513 | rng_none="no" |
54e7aac0 | 514 | secret_keyring="" |
377529c0 | 515 | |
898be3e0 PM |
516 | supported_cpu="no" |
517 | supported_os="no" | |
fb59dabd | 518 | bogus_os="no" |
5a22ab71 | 519 | malloc_trim="" |
898be3e0 | 520 | |
ac0df51d AL |
521 | # parse CC options first |
522 | for opt do | |
89138857 | 523 | optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') |
ac0df51d AL |
524 | case "$opt" in |
525 | --cross-prefix=*) cross_prefix="$optarg" | |
526 | ;; | |
3d8df640 | 527 | --cc=*) CC="$optarg" |
ac0df51d | 528 | ;; |
83f73fce TS |
529 | --cxx=*) CXX="$optarg" |
530 | ;; | |
2ff6b91e JQ |
531 | --cpu=*) cpu="$optarg" |
532 | ;; | |
de385287 | 533 | --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" |
db5adeaa | 534 | QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" |
e2a2ed06 | 535 | ;; |
11cde1c8 | 536 | --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" |
11cde1c8 | 537 | ;; |
db5adeaa | 538 | --extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" |
f9943cd5 | 539 | EXTRA_LDFLAGS="$optarg" |
e2a2ed06 | 540 | ;; |
5bc62e01 GH |
541 | --enable-debug-info) debug_info="yes" |
542 | ;; | |
543 | --disable-debug-info) debug_info="no" | |
544 | ;; | |
d75402b5 AB |
545 | --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" |
546 | ;; | |
d422b2bc AB |
547 | --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} |
548 | eval "cross_cc_cflags_${cc_arch}=\$optarg" | |
2038f8c8 | 549 | cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" |
d422b2bc | 550 | ;; |
d75402b5 | 551 | --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} |
2038f8c8 | 552 | cc_archs="$cc_archs $cc_arch" |
d75402b5 | 553 | eval "cross_cc_${cc_arch}=\$optarg" |
2038f8c8 | 554 | cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}" |
d75402b5 | 555 | ;; |
ac0df51d AL |
556 | esac |
557 | done | |
ac0df51d AL |
558 | # OS specific |
559 | # Using uname is really, really broken. Once we have the right set of checks | |
93148aa5 | 560 | # we can eliminate its usage altogether. |
ac0df51d | 561 | |
e49d021e PM |
562 | # Preferred compiler: |
563 | # ${CC} (if set) | |
564 | # ${cross_prefix}gcc (if cross-prefix specified) | |
565 | # system compiler | |
566 | if test -z "${CC}${cross_prefix}"; then | |
567 | cc="$host_cc" | |
568 | else | |
569 | cc="${CC-${cross_prefix}gcc}" | |
570 | fi | |
571 | ||
83f73fce TS |
572 | if test -z "${CXX}${cross_prefix}"; then |
573 | cxx="c++" | |
574 | else | |
575 | cxx="${CXX-${cross_prefix}g++}" | |
576 | fi | |
577 | ||
b3198cc2 | 578 | ar="${AR-${cross_prefix}ar}" |
cdbd727c | 579 | as="${AS-${cross_prefix}as}" |
5f6f0e27 | 580 | ccas="${CCAS-$cc}" |
3dd46c78 | 581 | cpp="${CPP-$cc -E}" |
b3198cc2 SY |
582 | objcopy="${OBJCOPY-${cross_prefix}objcopy}" |
583 | ld="${LD-${cross_prefix}ld}" | |
9f81aeb5 | 584 | ranlib="${RANLIB-${cross_prefix}ranlib}" |
4852ee95 | 585 | nm="${NM-${cross_prefix}nm}" |
b3198cc2 SY |
586 | strip="${STRIP-${cross_prefix}strip}" |
587 | windres="${WINDRES-${cross_prefix}windres}" | |
17884d7b ST |
588 | pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" |
589 | query_pkg_config() { | |
590 | "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" | |
591 | } | |
592 | pkg_config=query_pkg_config | |
47c03744 | 593 | sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" |
ac0df51d | 594 | |
45d285ab PM |
595 | # If the user hasn't specified ARFLAGS, default to 'rv', just as make does. |
596 | ARFLAGS="${ARFLAGS-rv}" | |
597 | ||
be17dc90 | 598 | # default flags for all hosts |
2d31515b PM |
599 | # We use -fwrapv to tell the compiler that we require a C dialect where |
600 | # left shift of signed integers is well defined and has the expected | |
601 | # 2s-complement style results. (Both clang and gcc agree that it | |
602 | # provides these semantics.) | |
7be41675 | 603 | QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv -std=gnu99 $QEMU_CFLAGS" |
f9188227 | 604 | QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" |
c95e3080 | 605 | QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" |
be17dc90 | 606 | QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" |
9edc19c9 | 607 | QEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg -iquote \$(SRC_PATH)/include" |
53422040 | 608 | QEMU_INCLUDES="$QEMU_INCLUDES -iquote \$(SRC_PATH)/disas/libvixl" |
5bc62e01 GH |
609 | if test "$debug_info" = "yes"; then |
610 | CFLAGS="-g $CFLAGS" | |
5bc62e01 | 611 | fi |
be17dc90 | 612 | |
cab00a5a MT |
613 | # running configure in the source tree? |
614 | # we know that's the case if configure is there. | |
615 | if test -f "./configure"; then | |
616 | pwd_is_source_path="y" | |
617 | else | |
618 | pwd_is_source_path="n" | |
619 | fi | |
620 | ||
ac0df51d AL |
621 | check_define() { |
622 | cat > $TMPC <<EOF | |
623 | #if !defined($1) | |
fd786e1a | 624 | #error $1 not defined |
ac0df51d AL |
625 | #endif |
626 | int main(void) { return 0; } | |
627 | EOF | |
52166aa0 | 628 | compile_object |
ac0df51d AL |
629 | } |
630 | ||
307119e7 GH |
631 | check_include() { |
632 | cat > $TMPC <<EOF | |
633 | #include <$1> | |
634 | int main(void) { return 0; } | |
635 | EOF | |
636 | compile_object | |
637 | } | |
638 | ||
93b25869 JS |
639 | write_c_skeleton() { |
640 | cat > $TMPC <<EOF | |
641 | int main(void) { return 0; } | |
642 | EOF | |
643 | } | |
644 | ||
adc28027 AB |
645 | write_c_fuzzer_skeleton() { |
646 | cat > $TMPC <<EOF | |
647 | #include <stdint.h> | |
648 | #include <sys/types.h> | |
649 | int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); | |
650 | int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } | |
651 | EOF | |
652 | } | |
653 | ||
bbea4050 PM |
654 | if check_define __linux__ ; then |
655 | targetos="Linux" | |
656 | elif check_define _WIN32 ; then | |
657 | targetos='MINGW32' | |
658 | elif check_define __OpenBSD__ ; then | |
659 | targetos='OpenBSD' | |
660 | elif check_define __sun__ ; then | |
661 | targetos='SunOS' | |
662 | elif check_define __HAIKU__ ; then | |
663 | targetos='Haiku' | |
951fedfc PM |
664 | elif check_define __FreeBSD__ ; then |
665 | targetos='FreeBSD' | |
666 | elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then | |
667 | targetos='GNU/kFreeBSD' | |
668 | elif check_define __DragonFly__ ; then | |
669 | targetos='DragonFly' | |
670 | elif check_define __NetBSD__; then | |
671 | targetos='NetBSD' | |
672 | elif check_define __APPLE__; then | |
673 | targetos='Darwin' | |
bbea4050 | 674 | else |
951fedfc PM |
675 | # This is a fatal error, but don't report it yet, because we |
676 | # might be going to just print the --help text, or it might | |
677 | # be the result of a missing compiler. | |
678 | targetos='bogus' | |
679 | bogus_os='yes' | |
bbea4050 PM |
680 | fi |
681 | ||
682 | # Some host OSes need non-standard checks for which CPU to use. | |
683 | # Note that these checks are broken for cross-compilation: if you're | |
684 | # cross-compiling to one of these OSes then you'll need to specify | |
685 | # the correct CPU with the --cpu option. | |
686 | case $targetos in | |
687 | Darwin) | |
688 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can | |
689 | # run 64-bit userspace code. | |
690 | # If the user didn't specify a CPU explicitly and the kernel says this is | |
691 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. | |
692 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | |
693 | cpu="x86_64" | |
694 | fi | |
695 | ;; | |
696 | SunOS) | |
89138857 | 697 | # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo |
bbea4050 PM |
698 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then |
699 | cpu="x86_64" | |
700 | fi | |
701 | esac | |
702 | ||
2ff6b91e JQ |
703 | if test ! -z "$cpu" ; then |
704 | # command line argument | |
705 | : | |
706 | elif check_define __i386__ ; then | |
ac0df51d AL |
707 | cpu="i386" |
708 | elif check_define __x86_64__ ; then | |
c72b26ec RH |
709 | if check_define __ILP32__ ; then |
710 | cpu="x32" | |
711 | else | |
712 | cpu="x86_64" | |
713 | fi | |
3aa9bd6c | 714 | elif check_define __sparc__ ; then |
3aa9bd6c BS |
715 | if check_define __arch64__ ; then |
716 | cpu="sparc64" | |
717 | else | |
718 | cpu="sparc" | |
719 | fi | |
fdf7ed96 | 720 | elif check_define _ARCH_PPC ; then |
721 | if check_define _ARCH_PPC64 ; then | |
f8378acc RH |
722 | if check_define _LITTLE_ENDIAN ; then |
723 | cpu="ppc64le" | |
724 | else | |
725 | cpu="ppc64" | |
726 | fi | |
fdf7ed96 | 727 | else |
728 | cpu="ppc" | |
729 | fi | |
afa05235 AJ |
730 | elif check_define __mips__ ; then |
731 | cpu="mips" | |
d66ed0ea AJ |
732 | elif check_define __s390__ ; then |
733 | if check_define __s390x__ ; then | |
734 | cpu="s390x" | |
735 | else | |
736 | cpu="s390" | |
737 | fi | |
c4f80543 AF |
738 | elif check_define __riscv ; then |
739 | if check_define _LP64 ; then | |
740 | cpu="riscv64" | |
741 | else | |
742 | cpu="riscv32" | |
743 | fi | |
21d89f84 PM |
744 | elif check_define __arm__ ; then |
745 | cpu="arm" | |
1f080313 CF |
746 | elif check_define __aarch64__ ; then |
747 | cpu="aarch64" | |
ac0df51d | 748 | else |
89138857 | 749 | cpu=$(uname -m) |
ac0df51d AL |
750 | fi |
751 | ||
359bc95d PM |
752 | ARCH= |
753 | # Normalise host CPU name and set ARCH. | |
754 | # Note that this case should only have supported host CPUs, not guests. | |
7d13299d | 755 | case "$cpu" in |
ee35e968 | 756 | ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64) |
898be3e0 PM |
757 | supported_cpu="yes" |
758 | ;; | |
f8378acc RH |
759 | ppc64le) |
760 | ARCH="ppc64" | |
761 | supported_cpu="yes" | |
f8378acc | 762 | ;; |
7d13299d | 763 | i386|i486|i586|i686|i86pc|BePC) |
97a847bc | 764 | cpu="i386" |
898be3e0 | 765 | supported_cpu="yes" |
7d13299d | 766 | ;; |
aaa5fa14 AJ |
767 | x86_64|amd64) |
768 | cpu="x86_64" | |
898be3e0 | 769 | supported_cpu="yes" |
aaa5fa14 | 770 | ;; |
21d89f84 PM |
771 | armv*b|armv*l|arm) |
772 | cpu="arm" | |
898be3e0 | 773 | supported_cpu="yes" |
7d13299d | 774 | ;; |
1f080313 CF |
775 | aarch64) |
776 | cpu="aarch64" | |
898be3e0 | 777 | supported_cpu="yes" |
1f080313 | 778 | ;; |
afa05235 AJ |
779 | mips*) |
780 | cpu="mips" | |
898be3e0 | 781 | supported_cpu="yes" |
afa05235 | 782 | ;; |
3142255c | 783 | sparc|sun4[cdmuv]) |
ae228531 | 784 | cpu="sparc" |
6499fd15 | 785 | supported_cpu="yes" |
ae228531 | 786 | ;; |
7d13299d | 787 | *) |
359bc95d PM |
788 | # This will result in either an error or falling back to TCI later |
789 | ARCH=unknown | |
7d13299d FB |
790 | ;; |
791 | esac | |
359bc95d PM |
792 | if test -z "$ARCH"; then |
793 | ARCH="$cpu" | |
794 | fi | |
e2d52ad3 | 795 | |
7d13299d | 796 | # OS specific |
0dbfc675 | 797 | |
adfc3e91 SS |
798 | # host *BSD for user mode |
799 | HOST_VARIANT_DIR="" | |
800 | ||
7d13299d | 801 | case $targetos in |
67b915a5 | 802 | MINGW32*) |
0dbfc675 | 803 | mingw32="yes" |
b0cb0a66 | 804 | hax="yes" |
299e6f19 | 805 | vhost_user="no" |
3cec7cc2 | 806 | audio_possible_drivers="dsound sdl" |
307119e7 GH |
807 | if check_include dsound.h; then |
808 | audio_drv_list="dsound" | |
809 | else | |
810 | audio_drv_list="" | |
811 | fi | |
898be3e0 | 812 | supported_os="yes" |
469a788c | 813 | pie="no" |
67b915a5 | 814 | ;; |
5c40d2bd | 815 | GNU/kFreeBSD) |
a167ba50 | 816 | bsd="yes" |
6a485418 | 817 | audio_drv_list="oss try-sdl" |
0bac1111 | 818 | audio_possible_drivers="oss sdl pa" |
5c40d2bd | 819 | ;; |
7d3505c5 | 820 | FreeBSD) |
0dbfc675 | 821 | bsd="yes" |
0db4a067 | 822 | make="${MAKE-gmake}" |
6a485418 | 823 | audio_drv_list="oss try-sdl" |
0bac1111 | 824 | audio_possible_drivers="oss sdl pa" |
f01576f1 JL |
825 | # needed for kinfo_getvmmap(3) in libutil.h |
826 | LIBS="-lutil $LIBS" | |
a7764f15 EM |
827 | # needed for kinfo_getproc |
828 | libs_qga="-lutil $libs_qga" | |
58952137 | 829 | netmap="" # enable netmap autodetect |
adfc3e91 | 830 | HOST_VARIANT_DIR="freebsd" |
898be3e0 | 831 | supported_os="yes" |
7d3505c5 | 832 | ;; |
c5e97233 | 833 | DragonFly) |
0dbfc675 | 834 | bsd="yes" |
0db4a067 | 835 | make="${MAKE-gmake}" |
6a485418 | 836 | audio_drv_list="oss try-sdl" |
0bac1111 | 837 | audio_possible_drivers="oss sdl pa" |
adfc3e91 | 838 | HOST_VARIANT_DIR="dragonfly" |
c5e97233 | 839 | ;; |
7d3505c5 | 840 | NetBSD) |
0dbfc675 | 841 | bsd="yes" |
604a5b99 | 842 | hax="yes" |
0db4a067 | 843 | make="${MAKE-gmake}" |
6a485418 | 844 | audio_drv_list="oss try-sdl" |
0bac1111 | 845 | audio_possible_drivers="oss sdl" |
0dbfc675 | 846 | oss_lib="-lossaudio" |
adfc3e91 | 847 | HOST_VARIANT_DIR="netbsd" |
3c2bdbc1 | 848 | supported_os="yes" |
7d3505c5 FB |
849 | ;; |
850 | OpenBSD) | |
0dbfc675 | 851 | bsd="yes" |
0db4a067 | 852 | make="${MAKE-gmake}" |
f92c7168 | 853 | audio_drv_list="try-sdl" |
0bac1111 | 854 | audio_possible_drivers="sdl" |
adfc3e91 | 855 | HOST_VARIANT_DIR="openbsd" |
0a773d55 | 856 | supported_os="yes" |
7d3505c5 | 857 | ;; |
83fb7adf | 858 | Darwin) |
0dbfc675 JQ |
859 | bsd="yes" |
860 | darwin="yes" | |
b0cb0a66 | 861 | hax="yes" |
c97d6d2c | 862 | hvf="yes" |
17969268 | 863 | LDFLAGS_SHARED="-bundle -undefined dynamic_lookup" |
0dbfc675 | 864 | if [ "$cpu" = "x86_64" ] ; then |
a558ee17 | 865 | QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" |
db5adeaa | 866 | QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" |
0dbfc675 | 867 | fi |
0dbfc675 | 868 | cocoa="yes" |
6a485418 | 869 | audio_drv_list="coreaudio try-sdl" |
14382605 | 870 | audio_possible_drivers="coreaudio sdl" |
db5adeaa | 871 | QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" |
7973f21c | 872 | libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" |
a0b7cf6b PM |
873 | # Disable attempts to use ObjectiveC features in os/object.h since they |
874 | # won't work when we're compiling with gcc as a C compiler. | |
875 | QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" | |
adfc3e91 | 876 | HOST_VARIANT_DIR="darwin" |
898be3e0 | 877 | supported_os="yes" |
83fb7adf | 878 | ;; |
ec530c81 | 879 | SunOS) |
0dbfc675 | 880 | solaris="yes" |
0db4a067 PB |
881 | make="${MAKE-gmake}" |
882 | install="${INSTALL-ginstall}" | |
e2d8830e | 883 | smbd="${SMBD-/usr/sfw/sbin/smbd}" |
0dbfc675 | 884 | if test -f /usr/include/sys/soundcard.h ; then |
6a485418 | 885 | audio_drv_list="oss try-sdl" |
0dbfc675 JQ |
886 | fi |
887 | audio_possible_drivers="oss sdl" | |
d741429a BS |
888 | # needed for CMSG_ macros in sys/socket.h |
889 | QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" | |
890 | # needed for TIOCWIN* defines in termios.h | |
891 | QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" | |
a558ee17 | 892 | QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" |
560d375f AF |
893 | solarisnetlibs="-lsocket -lnsl -lresolv" |
894 | LIBS="$solarisnetlibs $LIBS" | |
895 | libs_qga="$solarisnetlibs $libs_qga" | |
86b2bd93 | 896 | ;; |
179cf400 AF |
897 | Haiku) |
898 | haiku="yes" | |
899 | QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" | |
900 | LIBS="-lposix_error_mapper -lnetwork $LIBS" | |
901 | ;; | |
898be3e0 | 902 | Linux) |
7183834a | 903 | audio_drv_list="try-pa oss" |
0bac1111 | 904 | audio_possible_drivers="oss alsa sdl pa" |
0dbfc675 JQ |
905 | linux="yes" |
906 | linux_user="yes" | |
af2be207 | 907 | kvm="yes" |
67cf3f5c | 908 | QEMU_INCLUDES="-isystem \$(SRC_PATH)/linux-headers -isystem $PWD/linux-headers $QEMU_INCLUDES" |
898be3e0 | 909 | supported_os="yes" |
3efac6eb | 910 | libudev="yes" |
898be3e0 | 911 | ;; |
7d13299d FB |
912 | esac |
913 | ||
7d3505c5 | 914 | if [ "$bsd" = "yes" ] ; then |
b1a550a0 | 915 | if [ "$darwin" != "yes" ] ; then |
08de3949 | 916 | bsd_user="yes" |
83fb7adf | 917 | fi |
7d3505c5 FB |
918 | fi |
919 | ||
0db4a067 PB |
920 | : ${make=${MAKE-make}} |
921 | : ${install=${INSTALL-install}} | |
faf44142 DB |
922 | # We prefer python 3.x. A bare 'python' is traditionally |
923 | # python 2.x, but some distros have it as python 3.x, so | |
ddf90699 | 924 | # we check that too |
faf44142 | 925 | python= |
ddf90699 | 926 | for binary in "${PYTHON-python3}" python |
faf44142 DB |
927 | do |
928 | if has "$binary" | |
929 | then | |
95c5f2de | 930 | python=$(command -v "$binary") |
faf44142 DB |
931 | break |
932 | fi | |
933 | done | |
903458c8 MA |
934 | |
935 | sphinx_build= | |
936 | for binary in sphinx-build-3 sphinx-build | |
937 | do | |
938 | if has "$binary" | |
939 | then | |
940 | sphinx_build=$(command -v "$binary") | |
941 | break | |
942 | fi | |
943 | done | |
944 | ||
39d87c8c AB |
945 | # Check for ancillary tools used in testing |
946 | genisoimage= | |
3df437c7 | 947 | for binary in genisoimage mkisofs |
39d87c8c AB |
948 | do |
949 | if has $binary | |
950 | then | |
951 | genisoimage=$(command -v "$binary") | |
952 | break | |
953 | fi | |
954 | done | |
955 | ||
e2d8830e | 956 | : ${smbd=${SMBD-/usr/sbin/smbd}} |
0db4a067 | 957 | |
3c4a4d0d PM |
958 | # Default objcc to clang if available, otherwise use CC |
959 | if has clang; then | |
960 | objcc=clang | |
961 | else | |
962 | objcc="$cc" | |
963 | fi | |
964 | ||
3457a3f8 | 965 | if test "$mingw32" = "yes" ; then |
3457a3f8 | 966 | EXESUF=".exe" |
17969268 | 967 | DSOSUF=".dll" |
78e9d4ad SW |
968 | # MinGW needs -mthreads for TLS and macro _MT. |
969 | QEMU_CFLAGS="-mthreads $QEMU_CFLAGS" | |
b965e8c5 | 970 | LIBS="-lwinmm -lws2_32 $LIBS" |
93b25869 | 971 | write_c_skeleton; |
f7cf5d5b SW |
972 | if compile_prog "" "-liberty" ; then |
973 | LIBS="-liberty $LIBS" | |
974 | fi | |
c5ec15ea | 975 | prefix="c:/Program Files/QEMU" |
683035de | 976 | mandir="\${prefix}" |
528ae5b8 | 977 | datadir="\${prefix}" |
850da188 | 978 | qemu_docdir="\${prefix}" |
683035de PB |
979 | bindir="\${prefix}" |
980 | sysconfdir="\${prefix}" | |
5a699bbb | 981 | local_statedir= |
683035de | 982 | confsuffix="" |
105fad6b | 983 | libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" |
3457a3f8 JQ |
984 | fi |
985 | ||
487fefdb | 986 | werror="" |
85aa5189 | 987 | |
7d13299d | 988 | for opt do |
89138857 | 989 | optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') |
7d13299d | 990 | case "$opt" in |
2efc3265 FB |
991 | --help|-h) show_help=yes |
992 | ;; | |
99123e13 MF |
993 | --version|-V) exec cat $source_path/VERSION |
994 | ;; | |
b1a550a0 | 995 | --prefix=*) prefix="$optarg" |
7d13299d | 996 | ;; |
b1a550a0 | 997 | --interp-prefix=*) interp_prefix="$optarg" |
32ce6337 | 998 | ;; |
ac0df51d | 999 | --cross-prefix=*) |
7d13299d | 1000 | ;; |
ac0df51d | 1001 | --cc=*) |
7d13299d | 1002 | ;; |
b1a550a0 | 1003 | --host-cc=*) host_cc="$optarg" |
83469015 | 1004 | ;; |
83f73fce TS |
1005 | --cxx=*) |
1006 | ;; | |
e007dbec MT |
1007 | --iasl=*) iasl="$optarg" |
1008 | ;; | |
3c4a4d0d PM |
1009 | --objcc=*) objcc="$optarg" |
1010 | ;; | |
b1a550a0 | 1011 | --make=*) make="$optarg" |
7d13299d | 1012 | ;; |
6a882643 PB |
1013 | --install=*) install="$optarg" |
1014 | ;; | |
c886edfb BS |
1015 | --python=*) python="$optarg" |
1016 | ;; | |
2eb054c2 PM |
1017 | --sphinx-build=*) sphinx_build="$optarg" |
1018 | ;; | |
1d728c39 BS |
1019 | --gcov=*) gcov_tool="$optarg" |
1020 | ;; | |
e2d8830e BS |
1021 | --smbd=*) smbd="$optarg" |
1022 | ;; | |
e2a2ed06 | 1023 | --extra-cflags=*) |
7d13299d | 1024 | ;; |
11cde1c8 BD |
1025 | --extra-cxxflags=*) |
1026 | ;; | |
e2a2ed06 | 1027 | --extra-ldflags=*) |
7d13299d | 1028 | ;; |
5bc62e01 GH |
1029 | --enable-debug-info) |
1030 | ;; | |
1031 | --disable-debug-info) | |
1032 | ;; | |
d75402b5 AB |
1033 | --cross-cc-*) |
1034 | ;; | |
17969268 FZ |
1035 | --enable-modules) |
1036 | modules="yes" | |
3aa88b31 SH |
1037 | ;; |
1038 | --disable-modules) | |
1039 | modules="no" | |
17969268 | 1040 | ;; |
bd83c861 CE |
1041 | --disable-module-upgrades) module_upgrades="no" |
1042 | ;; | |
1043 | --enable-module-upgrades) module_upgrades="yes" | |
1044 | ;; | |
2ff6b91e | 1045 | --cpu=*) |
7d13299d | 1046 | ;; |
b1a550a0 | 1047 | --target-list=*) target_list="$optarg" |
447e133f AB |
1048 | if test "$target_list_exclude"; then |
1049 | error_exit "Can't mix --target-list with --target-list-exclude" | |
1050 | fi | |
1051 | ;; | |
1052 | --target-list-exclude=*) target_list_exclude="$optarg" | |
1053 | if test "$target_list"; then | |
1054 | error_exit "Can't mix --target-list-exclude with --target-list" | |
1055 | fi | |
de83cd02 | 1056 | ;; |
5b808275 LV |
1057 | --enable-trace-backends=*) trace_backends="$optarg" |
1058 | ;; | |
1059 | # XXX: backwards compatibility | |
1060 | --enable-trace-backend=*) trace_backends="$optarg" | |
94a420b1 | 1061 | ;; |
74242e0f | 1062 | --with-trace-file=*) trace_file="$optarg" |
9410b56c | 1063 | ;; |
f3494749 PB |
1064 | --with-default-devices) default_devices="yes" |
1065 | ;; | |
1066 | --without-default-devices) default_devices="no" | |
1067 | ;; | |
7d13299d FB |
1068 | --enable-gprof) gprof="yes" |
1069 | ;; | |
1d728c39 BS |
1070 | --enable-gcov) gcov="yes" |
1071 | ;; | |
79427693 LM |
1072 | --static) |
1073 | static="yes" | |
17884d7b | 1074 | QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" |
43ce4dfe | 1075 | ;; |
0b24e75f PB |
1076 | --mandir=*) mandir="$optarg" |
1077 | ;; | |
1078 | --bindir=*) bindir="$optarg" | |
1079 | ;; | |
3aa5d2be AL |
1080 | --libdir=*) libdir="$optarg" |
1081 | ;; | |
8bf188aa MT |
1082 | --libexecdir=*) libexecdir="$optarg" |
1083 | ;; | |
0f94d6da AL |
1084 | --includedir=*) includedir="$optarg" |
1085 | ;; | |
528ae5b8 | 1086 | --datadir=*) datadir="$optarg" |
0b24e75f | 1087 | ;; |
023d3d67 EH |
1088 | --with-confsuffix=*) confsuffix="$optarg" |
1089 | ;; | |
850da188 | 1090 | --docdir=*) qemu_docdir="$optarg" |
0b24e75f | 1091 | ;; |
ca2fb938 | 1092 | --sysconfdir=*) sysconfdir="$optarg" |
07381cc1 | 1093 | ;; |
785c23ae LC |
1094 | --localstatedir=*) local_statedir="$optarg" |
1095 | ;; | |
3d5eecab GH |
1096 | --firmwarepath=*) firmwarepath="$optarg" |
1097 | ;; | |
181ce1d0 OH |
1098 | --host=*|--build=*|\ |
1099 | --disable-dependency-tracking|\ | |
785c23ae | 1100 | --sbindir=*|--sharedstatedir=*|\ |
023ddd74 MF |
1101 | --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ |
1102 | --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) | |
1103 | # These switches are silently ignored, for compatibility with | |
1104 | # autoconf-generated configure scripts. This allows QEMU's | |
1105 | # configure to be used by RPM and similar macros that set | |
1106 | # lots of directory switches by default. | |
1107 | ;; | |
97a847bc FB |
1108 | --disable-sdl) sdl="no" |
1109 | ;; | |
c4198157 JQ |
1110 | --enable-sdl) sdl="yes" |
1111 | ;; | |
a442fe2f DB |
1112 | --disable-sdl-image) sdl_image="no" |
1113 | ;; | |
1114 | --enable-sdl-image) sdl_image="yes" | |
1115 | ;; | |
3556c233 PB |
1116 | --disable-qom-cast-debug) qom_cast_debug="no" |
1117 | ;; | |
1118 | --enable-qom-cast-debug) qom_cast_debug="yes" | |
1119 | ;; | |
983eef5a MI |
1120 | --disable-virtfs) virtfs="no" |
1121 | ;; | |
1122 | --enable-virtfs) virtfs="yes" | |
1123 | ;; | |
fe8fc5ae PB |
1124 | --disable-mpath) mpath="no" |
1125 | ;; | |
1126 | --enable-mpath) mpath="yes" | |
1127 | ;; | |
821601ea JS |
1128 | --disable-vnc) vnc="no" |
1129 | ;; | |
1130 | --enable-vnc) vnc="yes" | |
1131 | ;; | |
2f6a1ab0 BS |
1132 | --oss-lib=*) oss_lib="$optarg" |
1133 | ;; | |
0c58ac1c | 1134 | --audio-drv-list=*) audio_drv_list="$optarg" |
102a52e4 | 1135 | ;; |
89138857 | 1136 | --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') |
b64ec4e4 | 1137 | ;; |
89138857 | 1138 | --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') |
eb852011 | 1139 | ;; |
f8393946 AJ |
1140 | --enable-debug-tcg) debug_tcg="yes" |
1141 | ;; | |
1142 | --disable-debug-tcg) debug_tcg="no" | |
1143 | ;; | |
f3d08ee6 PB |
1144 | --enable-debug) |
1145 | # Enable debugging options that aren't excessively noisy | |
1146 | debug_tcg="yes" | |
1fcc6d42 | 1147 | debug_mutex="yes" |
f3d08ee6 PB |
1148 | debug="yes" |
1149 | strip_opt="no" | |
b553a042 | 1150 | fortify_source="no" |
f3d08ee6 | 1151 | ;; |
247724cb MAL |
1152 | --enable-sanitizers) sanitizers="yes" |
1153 | ;; | |
1154 | --disable-sanitizers) sanitizers="no" | |
1155 | ;; | |
0aebab04 LY |
1156 | --enable-tsan) tsan="yes" |
1157 | ;; | |
1158 | --disable-tsan) tsan="no" | |
1159 | ;; | |
03b4fe7d AL |
1160 | --enable-sparse) sparse="yes" |
1161 | ;; | |
1162 | --disable-sparse) sparse="no" | |
1163 | ;; | |
1625af87 AL |
1164 | --disable-strip) strip_opt="no" |
1165 | ;; | |
2f9606b3 AL |
1166 | --disable-vnc-sasl) vnc_sasl="no" |
1167 | ;; | |
ea784e3b JQ |
1168 | --enable-vnc-sasl) vnc_sasl="yes" |
1169 | ;; | |
2f6f5c7a CC |
1170 | --disable-vnc-jpeg) vnc_jpeg="no" |
1171 | ;; | |
1172 | --enable-vnc-jpeg) vnc_jpeg="yes" | |
1173 | ;; | |
efe556ad CC |
1174 | --disable-vnc-png) vnc_png="no" |
1175 | ;; | |
1176 | --enable-vnc-png) vnc_png="yes" | |
1177 | ;; | |
443f1376 | 1178 | --disable-slirp) slirp="no" |
1d14ffa9 | 1179 | ;; |
7c57bdd8 MAL |
1180 | --enable-slirp=git) slirp="git" |
1181 | ;; | |
675b9b53 MAL |
1182 | --enable-slirp=system) slirp="system" |
1183 | ;; | |
e0e6c8c0 | 1184 | --disable-vde) vde="no" |
8a16d273 | 1185 | ;; |
dfb278bd JQ |
1186 | --enable-vde) vde="yes" |
1187 | ;; | |
58952137 VM |
1188 | --disable-netmap) netmap="no" |
1189 | ;; | |
1190 | --enable-netmap) netmap="yes" | |
1191 | ;; | |
e37630ca AL |
1192 | --disable-xen) xen="no" |
1193 | ;; | |
fc321b4b JQ |
1194 | --enable-xen) xen="yes" |
1195 | ;; | |
eb6fda0f AP |
1196 | --disable-xen-pci-passthrough) xen_pci_passthrough="no" |
1197 | ;; | |
1198 | --enable-xen-pci-passthrough) xen_pci_passthrough="yes" | |
1199 | ;; | |
2e4d9fb1 AJ |
1200 | --disable-brlapi) brlapi="no" |
1201 | ;; | |
4ffcedb6 JQ |
1202 | --enable-brlapi) brlapi="yes" |
1203 | ;; | |
7ba1e619 AL |
1204 | --disable-kvm) kvm="no" |
1205 | ;; | |
b31a0277 JQ |
1206 | --enable-kvm) kvm="yes" |
1207 | ;; | |
b0cb0a66 | 1208 | --disable-hax) hax="no" |
180fb750 | 1209 | ;; |
b0cb0a66 | 1210 | --enable-hax) hax="yes" |
180fb750 | 1211 | ;; |
c97d6d2c SAGDR |
1212 | --disable-hvf) hvf="no" |
1213 | ;; | |
1214 | --enable-hvf) hvf="yes" | |
1215 | ;; | |
d661d9a4 JTV |
1216 | --disable-whpx) whpx="no" |
1217 | ;; | |
1218 | --enable-whpx) whpx="yes" | |
1219 | ;; | |
9195b2c2 SW |
1220 | --disable-tcg-interpreter) tcg_interpreter="no" |
1221 | ;; | |
1222 | --enable-tcg-interpreter) tcg_interpreter="yes" | |
1223 | ;; | |
47e98658 CB |
1224 | --disable-cap-ng) cap_ng="no" |
1225 | ;; | |
1226 | --enable-cap-ng) cap_ng="yes" | |
1227 | ;; | |
b3f6ea7e PB |
1228 | --disable-tcg) tcg="no" |
1229 | ;; | |
1230 | --enable-tcg) tcg="yes" | |
1231 | ;; | |
5a22ab71 YZ |
1232 | --disable-malloc-trim) malloc_trim="no" |
1233 | ;; | |
1234 | --enable-malloc-trim) malloc_trim="yes" | |
1235 | ;; | |
cd4ec0b4 GH |
1236 | --disable-spice) spice="no" |
1237 | ;; | |
1238 | --enable-spice) spice="yes" | |
1239 | ;; | |
c589b249 RS |
1240 | --disable-libiscsi) libiscsi="no" |
1241 | ;; | |
1242 | --enable-libiscsi) libiscsi="yes" | |
1243 | ;; | |
6542aa9c PL |
1244 | --disable-libnfs) libnfs="no" |
1245 | ;; | |
1246 | --enable-libnfs) libnfs="yes" | |
1247 | ;; | |
05c2a3e7 FB |
1248 | --enable-profiler) profiler="yes" |
1249 | ;; | |
14821030 PB |
1250 | --disable-cocoa) cocoa="no" |
1251 | ;; | |
c2de5c91 | 1252 | --enable-cocoa) |
1253 | cocoa="yes" ; | |
89138857 | 1254 | audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" |
1d14ffa9 | 1255 | ;; |
cad25d69 | 1256 | --disable-system) softmmu="no" |
0a8e90f4 | 1257 | ;; |
cad25d69 | 1258 | --enable-system) softmmu="yes" |
0a8e90f4 | 1259 | ;; |
0953a80f ZA |
1260 | --disable-user) |
1261 | linux_user="no" ; | |
1262 | bsd_user="no" ; | |
0953a80f ZA |
1263 | ;; |
1264 | --enable-user) ;; | |
831b7825 | 1265 | --disable-linux-user) linux_user="no" |
0a8e90f4 | 1266 | ;; |
831b7825 TS |
1267 | --enable-linux-user) linux_user="yes" |
1268 | ;; | |
84778508 BS |
1269 | --disable-bsd-user) bsd_user="no" |
1270 | ;; | |
1271 | --enable-bsd-user) bsd_user="yes" | |
1272 | ;; | |
40d6444e | 1273 | --enable-pie) pie="yes" |
34005a00 | 1274 | ;; |
40d6444e | 1275 | --disable-pie) pie="no" |
34005a00 | 1276 | ;; |
85aa5189 FB |
1277 | --enable-werror) werror="yes" |
1278 | ;; | |
1279 | --disable-werror) werror="no" | |
1280 | ;; | |
63678e17 SN |
1281 | --enable-stack-protector) stack_protector="yes" |
1282 | ;; | |
1283 | --disable-stack-protector) stack_protector="no" | |
1284 | ;; | |
4d3b6f6e AZ |
1285 | --disable-curses) curses="no" |
1286 | ;; | |
c584a6d0 JQ |
1287 | --enable-curses) curses="yes" |
1288 | ;; | |
e08bb301 ST |
1289 | --disable-iconv) iconv="no" |
1290 | ;; | |
1291 | --enable-iconv) iconv="yes" | |
1292 | ;; | |
769ce76d AG |
1293 | --disable-curl) curl="no" |
1294 | ;; | |
788c8196 JQ |
1295 | --enable-curl) curl="yes" |
1296 | ;; | |
2df87df7 JQ |
1297 | --disable-fdt) fdt="no" |
1298 | ;; | |
1299 | --enable-fdt) fdt="yes" | |
1300 | ;; | |
5c6c3a6c CH |
1301 | --disable-linux-aio) linux_aio="no" |
1302 | ;; | |
1303 | --enable-linux-aio) linux_aio="yes" | |
1304 | ;; | |
c10dd856 AM |
1305 | --disable-linux-io-uring) linux_io_uring="no" |
1306 | ;; | |
1307 | --enable-linux-io-uring) linux_io_uring="yes" | |
1308 | ;; | |
758e8e38 VJ |
1309 | --disable-attr) attr="no" |
1310 | ;; | |
1311 | --enable-attr) attr="yes" | |
1312 | ;; | |
a40161cb PB |
1313 | --disable-membarrier) membarrier="no" |
1314 | ;; | |
1315 | --enable-membarrier) membarrier="yes" | |
1316 | ;; | |
77755340 TS |
1317 | --disable-blobs) blobs="no" |
1318 | ;; | |
7e563bfb | 1319 | --with-pkgversion=*) pkgversion="$optarg" |
4a19f1ec | 1320 | ;; |
519175a2 AB |
1321 | --with-coroutine=*) coroutine="$optarg" |
1322 | ;; | |
70c60c08 SH |
1323 | --disable-coroutine-pool) coroutine_pool="no" |
1324 | ;; | |
1325 | --enable-coroutine-pool) coroutine_pool="yes" | |
1326 | ;; | |
7d992e4d PL |
1327 | --enable-debug-stack-usage) debug_stack_usage="yes" |
1328 | ;; | |
f0d92b56 LM |
1329 | --enable-crypto-afalg) crypto_afalg="yes" |
1330 | ;; | |
1331 | --disable-crypto-afalg) crypto_afalg="no" | |
1332 | ;; | |
a25dba17 | 1333 | --disable-docs) docs="no" |
70ec5dc0 | 1334 | ;; |
a25dba17 | 1335 | --enable-docs) docs="yes" |
83a3ab8b | 1336 | ;; |
d5970055 MT |
1337 | --disable-vhost-net) vhost_net="no" |
1338 | ;; | |
1339 | --enable-vhost-net) vhost_net="yes" | |
1340 | ;; | |
042cea27 GA |
1341 | --disable-vhost-crypto) vhost_crypto="no" |
1342 | ;; | |
299e6f19 | 1343 | --enable-vhost-crypto) vhost_crypto="yes" |
042cea27 | 1344 | ;; |
5e9be92d NB |
1345 | --disable-vhost-scsi) vhost_scsi="no" |
1346 | ;; | |
1347 | --enable-vhost-scsi) vhost_scsi="yes" | |
1348 | ;; | |
fc0b9b0e SH |
1349 | --disable-vhost-vsock) vhost_vsock="no" |
1350 | ;; | |
1351 | --enable-vhost-vsock) vhost_vsock="yes" | |
1352 | ;; | |
98fc1ada DDAG |
1353 | --disable-vhost-user-fs) vhost_user_fs="no" |
1354 | ;; | |
1355 | --enable-vhost-user-fs) vhost_user_fs="yes" | |
1356 | ;; | |
da076ffe | 1357 | --disable-opengl) opengl="no" |
20ff075b | 1358 | ;; |
da076ffe | 1359 | --enable-opengl) opengl="yes" |
20ff075b | 1360 | ;; |
f27aaf4b CB |
1361 | --disable-rbd) rbd="no" |
1362 | ;; | |
1363 | --enable-rbd) rbd="yes" | |
1364 | ;; | |
8c84cf11 ST |
1365 | --disable-xfsctl) xfs="no" |
1366 | ;; | |
1367 | --enable-xfsctl) xfs="yes" | |
1368 | ;; | |
7b02f544 | 1369 | --disable-smartcard) smartcard="no" |
111a38b0 | 1370 | ;; |
7b02f544 | 1371 | --enable-smartcard) smartcard="yes" |
111a38b0 | 1372 | ;; |
2b2325ff GH |
1373 | --disable-libusb) libusb="no" |
1374 | ;; | |
1375 | --enable-libusb) libusb="yes" | |
1376 | ;; | |
69354a83 HG |
1377 | --disable-usb-redir) usb_redir="no" |
1378 | ;; | |
1379 | --enable-usb-redir) usb_redir="yes" | |
1380 | ;; | |
1ece9905 AL |
1381 | --disable-zlib-test) zlib="no" |
1382 | ;; | |
b25c9dff SW |
1383 | --disable-lzo) lzo="no" |
1384 | ;; | |
607dacd0 QN |
1385 | --enable-lzo) lzo="yes" |
1386 | ;; | |
b25c9dff SW |
1387 | --disable-snappy) snappy="no" |
1388 | ;; | |
607dacd0 QN |
1389 | --enable-snappy) snappy="yes" |
1390 | ;; | |
6b383c08 PW |
1391 | --disable-bzip2) bzip2="no" |
1392 | ;; | |
1393 | --enable-bzip2) bzip2="yes" | |
1394 | ;; | |
83bc1f97 JF |
1395 | --enable-lzfse) lzfse="yes" |
1396 | ;; | |
1397 | --disable-lzfse) lzfse="no" | |
1398 | ;; | |
3a678481 JQ |
1399 | --disable-zstd) zstd="no" |
1400 | ;; | |
1401 | --enable-zstd) zstd="yes" | |
1402 | ;; | |
d138cee9 MR |
1403 | --enable-guest-agent) guest_agent="yes" |
1404 | ;; | |
1405 | --disable-guest-agent) guest_agent="no" | |
1406 | ;; | |
9dacf32d YH |
1407 | --enable-guest-agent-msi) guest_agent_msi="yes" |
1408 | ;; | |
1409 | --disable-guest-agent-msi) guest_agent_msi="no" | |
1410 | ;; | |
d9840e25 TS |
1411 | --with-vss-sdk) vss_win32_sdk="" |
1412 | ;; | |
1413 | --with-vss-sdk=*) vss_win32_sdk="$optarg" | |
1414 | ;; | |
1415 | --without-vss-sdk) vss_win32_sdk="no" | |
1416 | ;; | |
1417 | --with-win-sdk) win_sdk="" | |
1418 | ;; | |
1419 | --with-win-sdk=*) win_sdk="$optarg" | |
1420 | ;; | |
1421 | --without-win-sdk) win_sdk="no" | |
1422 | ;; | |
4b1c11fd DB |
1423 | --enable-tools) want_tools="yes" |
1424 | ;; | |
1425 | --disable-tools) want_tools="no" | |
1426 | ;; | |
f794573e EO |
1427 | --enable-seccomp) seccomp="yes" |
1428 | ;; | |
1429 | --disable-seccomp) seccomp="no" | |
1430 | ;; | |
eb100396 BR |
1431 | --disable-glusterfs) glusterfs="no" |
1432 | ;; | |
86583a07 LM |
1433 | --disable-avx2) avx2_opt="no" |
1434 | ;; | |
1435 | --enable-avx2) avx2_opt="yes" | |
1436 | ;; | |
6b8cd447 RH |
1437 | --disable-avx512f) avx512f_opt="no" |
1438 | ;; | |
1439 | --enable-avx512f) avx512f_opt="yes" | |
1440 | ;; | |
1441 | ||
eb100396 BR |
1442 | --enable-glusterfs) glusterfs="yes" |
1443 | ;; | |
52b53c04 FZ |
1444 | --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) |
1445 | echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 | |
583f6e7b | 1446 | ;; |
cb6414df FZ |
1447 | --enable-vhdx|--disable-vhdx) |
1448 | echo "$0: $opt is obsolete, VHDX driver is always built" >&2 | |
1449 | ;; | |
315d3184 FZ |
1450 | --enable-uuid|--disable-uuid) |
1451 | echo "$0: $opt is obsolete, UUID support is always built" >&2 | |
1452 | ;; | |
a4ccabcf AL |
1453 | --disable-gtk) gtk="no" |
1454 | ;; | |
1455 | --enable-gtk) gtk="yes" | |
1456 | ;; | |
a1c5e949 DB |
1457 | --tls-priority=*) tls_priority="$optarg" |
1458 | ;; | |
ddbb0d09 DB |
1459 | --disable-gnutls) gnutls="no" |
1460 | ;; | |
1461 | --enable-gnutls) gnutls="yes" | |
1462 | ;; | |
91bfcdb0 DB |
1463 | --disable-nettle) nettle="no" |
1464 | ;; | |
1465 | --enable-nettle) nettle="yes" | |
1466 | ;; | |
1467 | --disable-gcrypt) gcrypt="no" | |
1468 | ;; | |
1469 | --enable-gcrypt) gcrypt="yes" | |
1470 | ;; | |
8953caf3 DB |
1471 | --disable-auth-pam) auth_pam="no" |
1472 | ;; | |
1473 | --enable-auth-pam) auth_pam="yes" | |
1474 | ;; | |
2da776db MH |
1475 | --enable-rdma) rdma="yes" |
1476 | ;; | |
1477 | --disable-rdma) rdma="no" | |
1478 | ;; | |
21ab34c9 MA |
1479 | --enable-pvrdma) pvrdma="yes" |
1480 | ;; | |
1481 | --disable-pvrdma) pvrdma="no" | |
1482 | ;; | |
bbbf9bfb SW |
1483 | --disable-vte) vte="no" |
1484 | ;; | |
1485 | --enable-vte) vte="yes" | |
1486 | ;; | |
9d9e1521 GH |
1487 | --disable-virglrenderer) virglrenderer="no" |
1488 | ;; | |
1489 | --enable-virglrenderer) virglrenderer="yes" | |
1490 | ;; | |
e91c793c CR |
1491 | --disable-tpm) tpm="no" |
1492 | ;; | |
ab214c29 SB |
1493 | --enable-tpm) tpm="yes" |
1494 | ;; | |
b10d49d7 | 1495 | --disable-libssh) libssh="no" |
0a12ec87 | 1496 | ;; |
b10d49d7 | 1497 | --enable-libssh) libssh="yes" |
0a12ec87 | 1498 | ;; |
ed1701c6 DDAG |
1499 | --disable-live-block-migration) live_block_migration="no" |
1500 | ;; | |
1501 | --enable-live-block-migration) live_block_migration="yes" | |
1502 | ;; | |
a99d57bb WG |
1503 | --disable-numa) numa="no" |
1504 | ;; | |
1505 | --enable-numa) numa="yes" | |
1506 | ;; | |
ed279a06 KK |
1507 | --disable-libxml2) libxml2="no" |
1508 | ;; | |
1509 | --enable-libxml2) libxml2="yes" | |
1510 | ;; | |
2847b469 FZ |
1511 | --disable-tcmalloc) tcmalloc="no" |
1512 | ;; | |
1513 | --enable-tcmalloc) tcmalloc="yes" | |
1514 | ;; | |
7b01cb97 AD |
1515 | --disable-jemalloc) jemalloc="no" |
1516 | ;; | |
1517 | --enable-jemalloc) jemalloc="yes" | |
1518 | ;; | |
a6b1d4c0 CX |
1519 | --disable-replication) replication="no" |
1520 | ;; | |
1521 | --enable-replication) replication="yes" | |
1522 | ;; | |
da92c3ff AM |
1523 | --disable-vxhs) vxhs="no" |
1524 | ;; | |
1525 | --enable-vxhs) vxhs="yes" | |
1526 | ;; | |
2f740136 JC |
1527 | --disable-bochs) bochs="no" |
1528 | ;; | |
1529 | --enable-bochs) bochs="yes" | |
1530 | ;; | |
1531 | --disable-cloop) cloop="no" | |
1532 | ;; | |
1533 | --enable-cloop) cloop="yes" | |
1534 | ;; | |
1535 | --disable-dmg) dmg="no" | |
1536 | ;; | |
1537 | --enable-dmg) dmg="yes" | |
1538 | ;; | |
1539 | --disable-qcow1) qcow1="no" | |
1540 | ;; | |
1541 | --enable-qcow1) qcow1="yes" | |
1542 | ;; | |
1543 | --disable-vdi) vdi="no" | |
1544 | ;; | |
1545 | --enable-vdi) vdi="yes" | |
1546 | ;; | |
1547 | --disable-vvfat) vvfat="no" | |
1548 | ;; | |
1549 | --enable-vvfat) vvfat="yes" | |
1550 | ;; | |
1551 | --disable-qed) qed="no" | |
1552 | ;; | |
1553 | --enable-qed) qed="yes" | |
1554 | ;; | |
1555 | --disable-parallels) parallels="no" | |
1556 | ;; | |
1557 | --enable-parallels) parallels="yes" | |
1558 | ;; | |
1559 | --disable-sheepdog) sheepdog="no" | |
1560 | ;; | |
1561 | --enable-sheepdog) sheepdog="yes" | |
1562 | ;; | |
e6a74868 MAL |
1563 | --disable-vhost-user) vhost_user="no" |
1564 | ;; | |
299e6f19 PB |
1565 | --enable-vhost-user) vhost_user="yes" |
1566 | ;; | |
1567 | --disable-vhost-kernel) vhost_kernel="no" | |
1568 | ;; | |
1569 | --enable-vhost-kernel) vhost_kernel="yes" | |
e6a74868 | 1570 | ;; |
8ca80760 RH |
1571 | --disable-capstone) capstone="no" |
1572 | ;; | |
1573 | --enable-capstone) capstone="yes" | |
1574 | ;; | |
e219c499 RH |
1575 | --enable-capstone=git) capstone="git" |
1576 | ;; | |
1577 | --enable-capstone=system) capstone="system" | |
1578 | ;; | |
cc84d63a DB |
1579 | --with-git=*) git="$optarg" |
1580 | ;; | |
f62bbee5 DB |
1581 | --enable-git-update) git_update=yes |
1582 | ;; | |
1583 | --disable-git-update) git_update=no | |
1584 | ;; | |
ba59fb77 PB |
1585 | --enable-debug-mutex) debug_mutex=yes |
1586 | ;; | |
1587 | --disable-debug-mutex) debug_mutex=no | |
1588 | ;; | |
17824406 JH |
1589 | --enable-libpmem) libpmem=yes |
1590 | ;; | |
1591 | --disable-libpmem) libpmem=no | |
1592 | ;; | |
75411919 JLC |
1593 | --enable-xkbcommon) xkbcommon=yes |
1594 | ;; | |
1595 | --disable-xkbcommon) xkbcommon=no | |
1596 | ;; | |
40e8c6f4 AB |
1597 | --enable-plugins) plugins="yes" |
1598 | ;; | |
1599 | --disable-plugins) plugins="no" | |
1600 | ;; | |
afc3a8f9 AB |
1601 | --enable-containers) use_containers="yes" |
1602 | ;; | |
1603 | --disable-containers) use_containers="no" | |
1604 | ;; | |
adc28027 AB |
1605 | --enable-fuzzing) fuzzing=yes |
1606 | ;; | |
1607 | --disable-fuzzing) fuzzing=no | |
1608 | ;; | |
f48e590a AB |
1609 | --gdb=*) gdb_bin="$optarg" |
1610 | ;; | |
b767d257 MMG |
1611 | --enable-rng-none) rng_none=yes |
1612 | ;; | |
1613 | --disable-rng-none) rng_none=no | |
1614 | ;; | |
54e7aac0 AK |
1615 | --enable-keyring) secret_keyring="yes" |
1616 | ;; | |
1617 | --disable-keyring) secret_keyring="no" | |
1618 | ;; | |
2d2ad6d0 FZ |
1619 | *) |
1620 | echo "ERROR: unknown option $opt" | |
1621 | echo "Try '$0 --help' for more information" | |
1622 | exit 1 | |
7f1559c6 | 1623 | ;; |
7d13299d FB |
1624 | esac |
1625 | done | |
1626 | ||
40293e58 | 1627 | case "$cpu" in |
e3608d66 RH |
1628 | ppc) |
1629 | CPU_CFLAGS="-m32" | |
db5adeaa | 1630 | QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" |
e3608d66 RH |
1631 | ;; |
1632 | ppc64) | |
1633 | CPU_CFLAGS="-m64" | |
db5adeaa | 1634 | QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" |
e3608d66 | 1635 | ;; |
9b9c37c3 | 1636 | sparc) |
f1079bb8 | 1637 | CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" |
db5adeaa | 1638 | QEMU_LDFLAGS="-m32 -mv8plus $QEMU_LDFLAGS" |
3142255c | 1639 | ;; |
ed968ff1 | 1640 | sparc64) |
79f3b12f | 1641 | CPU_CFLAGS="-m64 -mcpu=ultrasparc" |
db5adeaa | 1642 | QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" |
3142255c | 1643 | ;; |
76d83bde | 1644 | s390) |
061cdd81 | 1645 | CPU_CFLAGS="-m31" |
db5adeaa | 1646 | QEMU_LDFLAGS="-m31 $QEMU_LDFLAGS" |
28d7cc49 RH |
1647 | ;; |
1648 | s390x) | |
061cdd81 | 1649 | CPU_CFLAGS="-m64" |
db5adeaa | 1650 | QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" |
76d83bde | 1651 | ;; |
40293e58 | 1652 | i386) |
79f3b12f | 1653 | CPU_CFLAGS="-m32" |
db5adeaa | 1654 | QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" |
40293e58 FB |
1655 | ;; |
1656 | x86_64) | |
7ebee43e RH |
1657 | # ??? Only extremely old AMD cpus do not have cmpxchg16b. |
1658 | # If we truly care, we should simply detect this case at | |
1659 | # runtime and generate the fallback to serial emulation. | |
1660 | CPU_CFLAGS="-m64 -mcx16" | |
db5adeaa | 1661 | QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" |
d2fbca94 | 1662 | ;; |
c72b26ec RH |
1663 | x32) |
1664 | CPU_CFLAGS="-mx32" | |
db5adeaa | 1665 | QEMU_LDFLAGS="-mx32 $QEMU_LDFLAGS" |
c72b26ec | 1666 | ;; |
30163d89 | 1667 | # No special flags required for other host CPUs |
3142255c BS |
1668 | esac |
1669 | ||
2038f8c8 PB |
1670 | eval "cross_cc_${cpu}=\$host_cc" |
1671 | cross_cc_vars="$cross_cc_vars cross_cc_${cpu}" | |
79f3b12f | 1672 | QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" |
79f3b12f | 1673 | |
affc88cc PM |
1674 | # For user-mode emulation the host arch has to be one we explicitly |
1675 | # support, even if we're using TCI. | |
1676 | if [ "$ARCH" = "unknown" ]; then | |
1677 | bsd_user="no" | |
1678 | linux_user="no" | |
1679 | fi | |
1680 | ||
1cf295be PMD |
1681 | if [ "$bsd_user" = "no" -a "$linux_user" = "no" -a "$softmmu" = "no" ] ; then |
1682 | tcg="no" | |
1683 | fi | |
1684 | ||
60e0df25 PM |
1685 | default_target_list="" |
1686 | ||
6e92f823 PM |
1687 | mak_wilds="" |
1688 | ||
1689 | if [ "$softmmu" = "yes" ]; then | |
1690 | mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak" | |
60e0df25 | 1691 | fi |
6e92f823 PM |
1692 | if [ "$linux_user" = "yes" ]; then |
1693 | mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak" | |
60e0df25 | 1694 | fi |
6e92f823 PM |
1695 | if [ "$bsd_user" = "yes" ]; then |
1696 | mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" | |
60e0df25 PM |
1697 | fi |
1698 | ||
447e133f AB |
1699 | if test -z "$target_list_exclude"; then |
1700 | for config in $mak_wilds; do | |
1701 | default_target_list="${default_target_list} $(basename "$config" .mak)" | |
1702 | done | |
1703 | else | |
1704 | exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g') | |
1705 | for config in $mak_wilds; do | |
1706 | target="$(basename "$config" .mak)" | |
1707 | exclude="no" | |
1708 | for excl in $exclude_list; do | |
1709 | if test "$excl" = "$target"; then | |
1710 | exclude="yes" | |
1711 | break; | |
1712 | fi | |
1713 | done | |
1714 | if test "$exclude" = "no"; then | |
1715 | default_target_list="${default_target_list} $target" | |
1716 | fi | |
1717 | done | |
1718 | fi | |
6e92f823 | 1719 | |
c53eeaf7 | 1720 | # Enumerate public trace backends for --help output |
64a6047d | 1721 | trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) |
c53eeaf7 | 1722 | |
af5db58e PB |
1723 | if test x"$show_help" = x"yes" ; then |
1724 | cat << EOF | |
1725 | ||
1726 | Usage: configure [options] | |
1727 | Options: [defaults in brackets after descriptions] | |
1728 | ||
08fb77ed SW |
1729 | Standard options: |
1730 | --help print this message | |
1731 | --prefix=PREFIX install in PREFIX [$prefix] | |
1732 | --interp-prefix=PREFIX where to find shared libraries, etc. | |
1733 | use %M for cpu name [$interp_prefix] | |
1734 | --target-list=LIST set target list (default: build everything) | |
1735 | $(echo Available targets: $default_target_list | \ | |
1736 | fold -s -w 53 | sed -e 's/^/ /') | |
447e133f | 1737 | --target-list-exclude=LIST exclude a set of targets from the default target-list |
08fb77ed SW |
1738 | |
1739 | Advanced options (experts only): | |
08fb77ed SW |
1740 | --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] |
1741 | --cc=CC use C compiler CC [$cc] | |
1742 | --iasl=IASL use ACPI compiler IASL [$iasl] | |
1743 | --host-cc=CC use C compiler CC [$host_cc] for code run at | |
1744 | build time | |
1745 | --cxx=CXX use C++ compiler CXX [$cxx] | |
1746 | --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] | |
1747 | --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS | |
11cde1c8 | 1748 | --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS |
08fb77ed | 1749 | --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS |
d75402b5 | 1750 | --cross-cc-ARCH=CC use compiler when building ARCH guest test cases |
d422b2bc | 1751 | --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests |
08fb77ed SW |
1752 | --make=MAKE use specified make [$make] |
1753 | --install=INSTALL use specified install [$install] | |
1754 | --python=PYTHON use specified python [$python] | |
2eb054c2 | 1755 | --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build] |
08fb77ed | 1756 | --smbd=SMBD use specified smbd [$smbd] |
db1b5f13 | 1757 | --with-git=GIT use specified git [$git] |
08fb77ed SW |
1758 | --static enable static build [$static] |
1759 | --mandir=PATH install man pages in PATH | |
1760 | --datadir=PATH install firmware in PATH$confsuffix | |
1761 | --docdir=PATH install documentation in PATH$confsuffix | |
1762 | --bindir=PATH install binaries in PATH | |
1763 | --libdir=PATH install libraries in PATH | |
db1b5f13 | 1764 | --libexecdir=PATH install helper binaries in PATH |
08fb77ed SW |
1765 | --sysconfdir=PATH install config in PATH$confsuffix |
1766 | --localstatedir=PATH install local state in PATH (set at runtime on win32) | |
3d5eecab | 1767 | --firmwarepath=PATH search PATH for firmware files |
e26110cf | 1768 | --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] |
db1b5f13 | 1769 | --with-pkgversion=VERS use specified string as sub-version of the package |
08fb77ed | 1770 | --enable-debug enable common debug build options |
247724cb | 1771 | --enable-sanitizers enable default sanitizers |
0aebab04 | 1772 | --enable-tsan enable thread sanitizer |
08fb77ed SW |
1773 | --disable-strip disable stripping binaries |
1774 | --disable-werror disable compilation abort on warning | |
63678e17 | 1775 | --disable-stack-protector disable compiler-provided stack protection |
08fb77ed SW |
1776 | --audio-drv-list=LIST set audio drivers list: |
1777 | Available drivers: $audio_possible_drivers | |
1778 | --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L | |
1779 | --block-drv-rw-whitelist=L | |
1780 | set block driver read-write whitelist | |
1781 | (affects only QEMU, not qemu-img) | |
1782 | --block-drv-ro-whitelist=L | |
1783 | set block driver read-only whitelist | |
1784 | (affects only QEMU, not qemu-img) | |
5b808275 | 1785 | --enable-trace-backends=B Set trace backend |
c53eeaf7 | 1786 | Available backends: $trace_backend_list |
08fb77ed SW |
1787 | --with-trace-file=NAME Full PATH,NAME of file to store traces |
1788 | Default:trace-<pid> | |
c23f23b9 MT |
1789 | --disable-slirp disable SLIRP userspace network connectivity |
1790 | --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) | |
5a22ab71 | 1791 | --enable-malloc-trim enable libc malloc_trim() for memory optimization |
c23f23b9 MT |
1792 | --oss-lib path to OSS library |
1793 | --cpu=CPU Build for host CPU [$cpu] | |
08fb77ed | 1794 | --with-coroutine=BACKEND coroutine backend. Supported options: |
33c53c54 | 1795 | ucontext, sigaltstack, windows |
08fb77ed SW |
1796 | --enable-gcov enable test coverage analysis with gcov |
1797 | --gcov=GCOV use specified gcov [$gcov_tool] | |
c23f23b9 MT |
1798 | --disable-blobs disable installing provided firmware blobs |
1799 | --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent | |
1800 | --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) | |
a1c5e949 | 1801 | --tls-priority default TLS protocol/cipher priority string |
c12d66aa LM |
1802 | --enable-gprof QEMU profiling with gprof |
1803 | --enable-profiler profiler support | |
c12d66aa LM |
1804 | --enable-debug-stack-usage |
1805 | track the maximum stack usage of stacks created by qemu_alloc_stack | |
40e8c6f4 AB |
1806 | --enable-plugins |
1807 | enable plugins via shared library loading | |
afc3a8f9 | 1808 | --disable-containers don't use containers for cross-building |
f48e590a | 1809 | --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] |
c23f23b9 MT |
1810 | |
1811 | Optional features, enabled with --enable-FEATURE and | |
1812 | disabled with --disable-FEATURE, default is enabled if available: | |
1813 | ||
1814 | system all system emulation targets | |
1815 | user supported user emulation targets | |
1816 | linux-user all linux usermode emulation targets | |
1817 | bsd-user all BSD usermode emulation targets | |
c23f23b9 MT |
1818 | docs build documentation |
1819 | guest-agent build the QEMU Guest Agent | |
1820 | guest-agent-msi build guest agent Windows MSI installation package | |
1821 | pie Position Independent Executables | |
21e709aa | 1822 | modules modules support (non-Windows) |
bd83c861 | 1823 | module-upgrades try to load modules from alternate paths for upgrades |
c23f23b9 MT |
1824 | debug-tcg TCG debugging (default is disabled) |
1825 | debug-info debugging information | |
1826 | sparse sparse checker | |
1827 | ||
ddbb0d09 | 1828 | gnutls GNUTLS cryptography support |
91bfcdb0 DB |
1829 | nettle nettle cryptography support |
1830 | gcrypt libgcrypt cryptography support | |
8953caf3 | 1831 | auth-pam PAM access control |
c23f23b9 | 1832 | sdl SDL UI |
04c6e16f | 1833 | sdl-image SDL Image support for icons |
c23f23b9 | 1834 | gtk gtk UI |
c23f23b9 MT |
1835 | vte vte support for the gtk UI |
1836 | curses curses UI | |
e08bb301 | 1837 | iconv font glyph conversion support |
c23f23b9 | 1838 | vnc VNC UI support |
c23f23b9 MT |
1839 | vnc-sasl SASL encryption for VNC server |
1840 | vnc-jpeg JPEG lossy compression for VNC server | |
1841 | vnc-png PNG compression for VNC server | |
c23f23b9 MT |
1842 | cocoa Cocoa UI (Mac OS X only) |
1843 | virtfs VirtFS | |
fe8fc5ae | 1844 | mpath Multipath persistent reservation passthrough |
c23f23b9 | 1845 | xen xen backend driver support |
70c292af | 1846 | xen-pci-passthrough PCI passthrough support for Xen |
c23f23b9 MT |
1847 | brlapi BrlAPI (Braile) |
1848 | curl curl connectivity | |
a40161cb | 1849 | membarrier membarrier system call (for Linux 4.14+ or Windows) |
c23f23b9 | 1850 | fdt fdt device tree |
c23f23b9 | 1851 | kvm KVM acceleration support |
b0cb0a66 | 1852 | hax HAX acceleration support |
c97d6d2c | 1853 | hvf Hypervisor.framework acceleration support |
d661d9a4 | 1854 | whpx Windows Hypervisor Platform acceleration support |
21ab34c9 MA |
1855 | rdma Enable RDMA-based migration |
1856 | pvrdma Enable PVRDMA support | |
c23f23b9 MT |
1857 | vde support for vde network |
1858 | netmap support for netmap network | |
1859 | linux-aio Linux AIO support | |
c10dd856 | 1860 | linux-io-uring Linux io_uring support |
c23f23b9 MT |
1861 | cap-ng libcap-ng support |
1862 | attr attr and xattr support | |
299e6f19 PB |
1863 | vhost-net vhost-net kernel acceleration support |
1864 | vhost-vsock virtio sockets device support | |
1865 | vhost-scsi vhost-scsi kernel target support | |
1866 | vhost-crypto vhost-user-crypto backend support | |
1867 | vhost-kernel vhost kernel backend support | |
1868 | vhost-user vhost-user backend support | |
c23f23b9 MT |
1869 | spice spice |
1870 | rbd rados block device (rbd) | |
1871 | libiscsi iscsi support | |
1872 | libnfs nfs support | |
7b02f544 | 1873 | smartcard smartcard support (libcacard) |
c23f23b9 | 1874 | libusb libusb (for usb passthrough) |
ed1701c6 | 1875 | live-block-migration Block migration in the main migration stream |
c23f23b9 MT |
1876 | usb-redir usb network redirection support |
1877 | lzo support of lzo compression library | |
1878 | snappy support of snappy compression library | |
1879 | bzip2 support of bzip2 compression library | |
1880 | (for reading bzip2-compressed dmg images) | |
83bc1f97 JF |
1881 | lzfse support of lzfse compression library |
1882 | (for reading lzfse-compressed dmg images) | |
3a678481 | 1883 | zstd support for zstd compression library |
d298ac10 | 1884 | (for migration compression and qcow2 cluster compression) |
c23f23b9 MT |
1885 | seccomp seccomp support |
1886 | coroutine-pool coroutine freelist (better performance) | |
1887 | glusterfs GlusterFS backend | |
c23f23b9 | 1888 | tpm TPM support |
b10d49d7 | 1889 | libssh ssh block device support |
c23f23b9 | 1890 | numa libnuma support |
ed279a06 | 1891 | libxml2 for Parallels image format |
c23f23b9 | 1892 | tcmalloc tcmalloc support |
7b01cb97 | 1893 | jemalloc jemalloc support |
86583a07 | 1894 | avx2 AVX2 optimization support |
6b8cd447 | 1895 | avx512f AVX512F optimization support |
a6b1d4c0 | 1896 | replication replication support |
c12d66aa LM |
1897 | opengl opengl support |
1898 | virglrenderer virgl rendering support | |
1899 | xfsctl xfsctl support | |
1900 | qom-cast-debug cast debugging support | |
8de73fa8 | 1901 | tools build qemu-io, qemu-nbd and qemu-img tools |
da92c3ff | 1902 | vxhs Veritas HyperScale vDisk backend support |
2f740136 JC |
1903 | bochs bochs image format support |
1904 | cloop cloop image format support | |
1905 | dmg dmg image format support | |
1906 | qcow1 qcow v1 image format support | |
1907 | vdi vdi image format support | |
1908 | vvfat vvfat image format support | |
1909 | qed qed image format support | |
1910 | parallels parallels image format support | |
1911 | sheepdog sheepdog block driver support | |
f0d92b56 | 1912 | crypto-afalg Linux AF_ALG crypto backend driver |
8ca80760 | 1913 | capstone capstone disassembler support |
ba59fb77 | 1914 | debug-mutex mutex debugging support |
17824406 | 1915 | libpmem libpmem support |
75411919 | 1916 | xkbcommon xkbcommon support |
b767d257 | 1917 | rng-none dummy RNG, avoid using /dev/(u)random and getrandom() |
08fb77ed SW |
1918 | |
1919 | NOTE: The object files are built at the place where configure is launched | |
af5db58e | 1920 | EOF |
2d2ad6d0 | 1921 | exit 0 |
af5db58e PB |
1922 | fi |
1923 | ||
9c790242 | 1924 | # Remove old dependency files to make sure that they get properly regenerated |
bb768f71 | 1925 | rm -f */config-devices.mak.d |
9c790242 | 1926 | |
4d6a835d LV |
1927 | # Remove syscall_nr.h to be sure they will be regenerated in the build |
1928 | # directory, not in the source directory | |
bb0cdc03 | 1929 | for arch in alpha hppa m68k xtensa sh4 microblaze arm ppc s390x sparc sparc64 \ |
686a0fe4 | 1930 | i386 x86_64 mips mips64 ; do |
4d6a835d LV |
1931 | # remove the file if it has been generated in the source directory |
1932 | rm -f "${source_path}/linux-user/${arch}/syscall_nr.h" | |
1933 | # remove the dependency files | |
91e5998f LV |
1934 | for target in ${arch}*-linux-user ; do |
1935 | test -d "${target}" && find "${target}" -type f -name "*.d" \ | |
1936 | -exec grep -q "${source_path}/linux-user/${arch}/syscall_nr.h" {} \; \ | |
1937 | -print | while read file ; do rm "${file}" "${file%.d}.o" ; done | |
1938 | done | |
4d6a835d LV |
1939 | done |
1940 | ||
faf44142 DB |
1941 | if test -z "$python" |
1942 | then | |
1943 | error_exit "Python not found. Use --python=/path/to/python" | |
c53eeaf7 SH |
1944 | fi |
1945 | ||
1946 | # Note that if the Python conditional here evaluates True we will exit | |
1947 | # with status 1 which is a shell 'false' value. | |
ddf90699 EH |
1948 | if ! $python -c 'import sys; sys.exit(sys.version_info < (3,5))'; then |
1949 | error_exit "Cannot use '$python', Python >= 3.5 is required." \ | |
c53eeaf7 SH |
1950 | "Use --python=/path/to/python to specify a supported Python." |
1951 | fi | |
1952 | ||
755ee70f | 1953 | # Preserve python version since some functionality is dependent on it |
406ab2f3 | 1954 | python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null) |
755ee70f | 1955 | |
c53eeaf7 SH |
1956 | # Suppress writing compiled files |
1957 | python="$python -B" | |
1958 | ||
9aae6e54 DHB |
1959 | # Check that the C compiler works. Doing this here before testing |
1960 | # the host CPU ensures that we had a valid CC to autodetect the | |
1961 | # $cpu var (and we should bail right here if that's not the case). | |
1962 | # It also allows the help message to be printed without a CC. | |
1963 | write_c_skeleton; | |
1964 | if compile_object ; then | |
1965 | : C compiler works ok | |
1966 | else | |
1967 | error_exit "\"$cc\" either does not exist or does not work" | |
1968 | fi | |
1969 | if ! compile_prog ; then | |
1970 | error_exit "\"$cc\" cannot build an executable (is your linker broken?)" | |
1971 | fi | |
1972 | ||
359bc95d PM |
1973 | # Now we have handled --enable-tcg-interpreter and know we're not just |
1974 | # printing the help message, bail out if the host CPU isn't supported. | |
1975 | if test "$ARCH" = "unknown"; then | |
1976 | if test "$tcg_interpreter" = "yes" ; then | |
1977 | echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" | |
359bc95d | 1978 | else |
76ad07a4 | 1979 | error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter" |
359bc95d PM |
1980 | fi |
1981 | fi | |
1982 | ||
9c83ffd8 PM |
1983 | # Consult white-list to determine whether to enable werror |
1984 | # by default. Only enable by default for git builds | |
9c83ffd8 | 1985 | if test -z "$werror" ; then |
fd73745d | 1986 | if test -e "$source_path/.git" && \ |
e633a5c6 | 1987 | { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then |
9c83ffd8 PM |
1988 | werror="yes" |
1989 | else | |
1990 | werror="no" | |
1991 | fi | |
1992 | fi | |
1993 | ||
fb59dabd PM |
1994 | if test "$bogus_os" = "yes"; then |
1995 | # Now that we know that we're not printing the help and that | |
1996 | # the compiler works (so the results of the check_defines we used | |
1997 | # to identify the OS are reliable), if we didn't recognize the | |
1998 | # host OS we should stop now. | |
951fedfc | 1999 | error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" |
fb59dabd PM |
2000 | fi |
2001 | ||
efc6c070 TH |
2002 | # Check whether the compiler matches our minimum requirements: |
2003 | cat > $TMPC << EOF | |
2004 | #if defined(__clang_major__) && defined(__clang_minor__) | |
2005 | # ifdef __apple_build_version__ | |
2006 | # if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1) | |
2007 | # error You need at least XCode Clang v5.1 to compile QEMU | |
2008 | # endif | |
2009 | # else | |
2010 | # if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4) | |
2011 | # error You need at least Clang v3.4 to compile QEMU | |
2012 | # endif | |
2013 | # endif | |
2014 | #elif defined(__GNUC__) && defined(__GNUC_MINOR__) | |
2015 | # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) | |
2016 | # error You need at least GCC v4.8 to compile QEMU | |
2017 | # endif | |
2018 | #else | |
2019 | # error You either need GCC or Clang to compiler QEMU | |
2020 | #endif | |
2021 | int main (void) { return 0; } | |
2022 | EOF | |
2023 | if ! compile_prog "" "" ; then | |
2024 | error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)" | |
2025 | fi | |
2026 | ||
8d05095c PB |
2027 | gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" |
2028 | gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" | |
ac7568bd | 2029 | gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" |
435405ac | 2030 | gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags" |
b98fcfd8 | 2031 | gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags" |
e6e90fee | 2032 | gcc_flags="-Wno-string-plus-int -Wno-typedef-redefinition $gcc_flags" |
6ca026cb PM |
2033 | # Note that we do not add -Werror to gcc_flags here, because that would |
2034 | # enable it for all configure tests. If a configure test failed due | |
2035 | # to -Werror this would just silently disable some features, | |
2036 | # so it's too error prone. | |
93b25869 JS |
2037 | |
2038 | cc_has_warning_flag() { | |
2039 | write_c_skeleton; | |
2040 | ||
a1d29d6c PM |
2041 | # Use the positive sense of the flag when testing for -Wno-wombat |
2042 | # support (gcc will happily accept the -Wno- form of unknown | |
2043 | # warning options). | |
93b25869 JS |
2044 | optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" |
2045 | compile_prog "-Werror $optflag" "" | |
2046 | } | |
2047 | ||
2048 | for flag in $gcc_flags; do | |
2049 | if cc_has_warning_flag $flag ; then | |
2050 | QEMU_CFLAGS="$QEMU_CFLAGS $flag" | |
8d05095c PB |
2051 | fi |
2052 | done | |
2053 | ||
3b463a3f | 2054 | if test "$stack_protector" != "no"; then |
fccd35a0 RR |
2055 | cat > $TMPC << EOF |
2056 | int main(int argc, char *argv[]) | |
2057 | { | |
2058 | char arr[64], *p = arr, *c = argv[0]; | |
2059 | while (*c) { | |
2060 | *p++ = *c++; | |
2061 | } | |
2062 | return 0; | |
2063 | } | |
2064 | EOF | |
63678e17 | 2065 | gcc_flags="-fstack-protector-strong -fstack-protector-all" |
3b463a3f | 2066 | sp_on=0 |
63678e17 | 2067 | for flag in $gcc_flags; do |
590e5dd9 PM |
2068 | # We need to check both a compile and a link, since some compiler |
2069 | # setups fail only on a .c->.o compile and some only at link time | |
2070 | if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC && | |
2071 | compile_prog "-Werror $flag" ""; then | |
63678e17 | 2072 | QEMU_CFLAGS="$QEMU_CFLAGS $flag" |
db5adeaa | 2073 | QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" |
3b463a3f | 2074 | sp_on=1 |
63678e17 SN |
2075 | break |
2076 | fi | |
2077 | done | |
3b463a3f MR |
2078 | if test "$stack_protector" = yes; then |
2079 | if test $sp_on = 0; then | |
2080 | error_exit "Stack protector not supported" | |
2081 | fi | |
2082 | fi | |
37746c5e MAL |
2083 | fi |
2084 | ||
20bc94a2 PB |
2085 | # Disable -Wmissing-braces on older compilers that warn even for |
2086 | # the "universal" C zero initializer {0}. | |
2087 | cat > $TMPC << EOF | |
2088 | struct { | |
2089 | int a[2]; | |
2090 | } x = {0}; | |
2091 | EOF | |
2092 | if compile_object "-Werror" "" ; then | |
2093 | : | |
2094 | else | |
2095 | QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" | |
2096 | fi | |
2097 | ||
21e709aa MAL |
2098 | # Our module code doesn't support Windows |
2099 | if test "$modules" = "yes" && test "$mingw32" = "yes" ; then | |
2100 | error_exit "Modules are not available for Windows" | |
2101 | fi | |
2102 | ||
bd83c861 CE |
2103 | # module_upgrades is only reasonable if modules are enabled |
2104 | if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then | |
2105 | error_exit "Can't enable module-upgrades as Modules are not enabled" | |
2106 | fi | |
2107 | ||
d376e9de | 2108 | # Static linking is not possible with modules or PIE |
40d6444e | 2109 | if test "$static" = "yes" ; then |
aa0d1f44 PB |
2110 | if test "$modules" = "yes" ; then |
2111 | error_exit "static and modules are mutually incompatible" | |
2112 | fi | |
40d6444e AK |
2113 | fi |
2114 | ||
768b7855 EC |
2115 | # Unconditional check for compiler __thread support |
2116 | cat > $TMPC << EOF | |
2117 | static __thread int tls_var; | |
2118 | int main(void) { return tls_var; } | |
2119 | EOF | |
2120 | ||
2121 | if ! compile_prog "-Werror" "" ; then | |
2122 | error_exit "Your compiler does not support the __thread specifier for " \ | |
2123 | "Thread-Local Storage (TLS). Please upgrade to a version that does." | |
2124 | fi | |
2125 | ||
b2634124 | 2126 | cat > $TMPC << EOF |
21d4a791 AK |
2127 | |
2128 | #ifdef __linux__ | |
2129 | # define THREAD __thread | |
2130 | #else | |
2131 | # define THREAD | |
2132 | #endif | |
21d4a791 | 2133 | static THREAD int tls_var; |
21d4a791 | 2134 | int main(void) { return tls_var; } |
40d6444e | 2135 | EOF |
412aeacd | 2136 | |
b2634124 RH |
2137 | # Check we support --no-pie first; we will need this for building ROMs. |
2138 | if compile_prog "-Werror -fno-pie" "-no-pie"; then | |
2139 | CFLAGS_NOPIE="-fno-pie" | |
2140 | LDFLAGS_NOPIE="-no-pie" | |
2141 | fi | |
2142 | ||
12781462 | 2143 | if test "$static" = "yes"; then |
eca7a8e6 | 2144 | if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then |
12781462 RH |
2145 | QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" |
2146 | QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" | |
2147 | pie="yes" | |
2148 | elif test "$pie" = "yes"; then | |
2149 | error_exit "-static-pie not available due to missing toolchain support" | |
2150 | else | |
2151 | QEMU_LDFLAGS="-static $QEMU_LDFLAGS" | |
2152 | pie="no" | |
2153 | fi | |
2154 | elif test "$pie" = "no"; then | |
2c674109 RH |
2155 | QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS" |
2156 | QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS" | |
eca7a8e6 | 2157 | elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then |
2c674109 RH |
2158 | QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" |
2159 | QEMU_LDFLAGS="-pie $QEMU_LDFLAGS" | |
2160 | pie="yes" | |
2161 | elif test "$pie" = "yes"; then | |
2162 | error_exit "PIE not available due to missing toolchain support" | |
2163 | else | |
2164 | echo "Disabling PIE due to missing toolchain support" | |
2165 | pie="no" | |
40d6444e AK |
2166 | fi |
2167 | ||
e6cbd751 RH |
2168 | # Detect support for PT_GNU_RELRO + DT_BIND_NOW. |
2169 | # The combination is known as "full relro", because .got.plt is read-only too. | |
2170 | if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then | |
2171 | QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS" | |
2172 | fi | |
2173 | ||
09dada40 PB |
2174 | ########################################## |
2175 | # __sync_fetch_and_and requires at least -march=i486. Many toolchains | |
2176 | # use i686 as default anyway, but for those that don't, an explicit | |
2177 | # specification is necessary | |
2178 | ||
2179 | if test "$cpu" = "i386"; then | |
2180 | cat > $TMPC << EOF | |
2181 | static int sfaa(int *ptr) | |
2182 | { | |
2183 | return __sync_fetch_and_and(ptr, 0); | |
2184 | } | |
2185 | ||
2186 | int main(void) | |
2187 | { | |
2188 | int val = 42; | |
1405b629 | 2189 | val = __sync_val_compare_and_swap(&val, 0, 1); |
09dada40 PB |
2190 | sfaa(&val); |
2191 | return val; | |
2192 | } | |
2193 | EOF | |
2194 | if ! compile_prog "" "" ; then | |
2195 | QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" | |
2196 | fi | |
2197 | fi | |
2198 | ||
2199 | ######################################### | |
ec530c81 | 2200 | # Solaris specific configure tool chain decisions |
09dada40 | 2201 | |
ec530c81 | 2202 | if test "$solaris" = "yes" ; then |
6792aa11 LM |
2203 | if has $install; then |
2204 | : | |
2205 | else | |
76ad07a4 PM |
2206 | error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \ |
2207 | "install fileutils from www.blastwave.org using pkg-get -i fileutils" \ | |
2208 | "to get ginstall which is used by default (which lives in /opt/csw/bin)" | |
ec530c81 | 2209 | fi |
89138857 | 2210 | if test "$(path_of $install)" = "/usr/sbin/install" ; then |
76ad07a4 PM |
2211 | error_exit "Solaris /usr/sbin/install is not an appropriate install program." \ |
2212 | "try ginstall from the GNU fileutils available from www.blastwave.org" \ | |
2213 | "using pkg-get -i fileutils, or use --install=/usr/ucb/install" | |
ec530c81 | 2214 | fi |
6792aa11 LM |
2215 | if has ar; then |
2216 | : | |
2217 | else | |
ec530c81 | 2218 | if test -f /usr/ccs/bin/ar ; then |
76ad07a4 PM |
2219 | error_exit "No path includes ar" \ |
2220 | "Add /usr/ccs/bin to your path and rerun configure" | |
ec530c81 | 2221 | fi |
76ad07a4 | 2222 | error_exit "No path includes ar" |
ec530c81 | 2223 | fi |
5fafdf24 | 2224 | fi |
ec530c81 | 2225 | |
afb63ebd | 2226 | if test -z "${target_list+xxx}" ; then |
d880a3ba PB |
2227 | for target in $default_target_list; do |
2228 | supported_target $target 2>/dev/null && \ | |
2229 | target_list="$target_list $target" | |
2230 | done | |
2231 | target_list="${target_list# }" | |
121afa9e | 2232 | else |
89138857 | 2233 | target_list=$(echo "$target_list" | sed -e 's/,/ /g') |
d880a3ba PB |
2234 | for target in $target_list; do |
2235 | # Check that we recognised the target name; this allows a more | |
2236 | # friendly error message than if we let it fall through. | |
2237 | case " $default_target_list " in | |
2238 | *" $target "*) | |
2239 | ;; | |
2240 | *) | |
2241 | error_exit "Unknown target name '$target'" | |
2242 | ;; | |
2243 | esac | |
2244 | supported_target $target || exit 1 | |
2245 | done | |
121afa9e | 2246 | fi |
25b48338 | 2247 | |
f55fe278 PB |
2248 | # see if system emulation was really requested |
2249 | case " $target_list " in | |
2250 | *"-softmmu "*) softmmu=yes | |
2251 | ;; | |
2252 | *) softmmu=no | |
2253 | ;; | |
2254 | esac | |
5327cf48 | 2255 | |
05dfa22b PMD |
2256 | for target in $target_list; do |
2257 | case "$target" in | |
2258 | arm-softmmu | aarch64-softmmu | i386-softmmu | x86_64-softmmu) | |
2259 | edk2_blobs="yes" | |
2260 | ;; | |
2261 | esac | |
2262 | done | |
623ef637 PMD |
2263 | # The EDK2 binaries are compressed with bzip2 |
2264 | if test "$edk2_blobs" = "yes" && ! has bzip2; then | |
2265 | error_exit "The bzip2 program is required for building QEMU" | |
2266 | fi | |
05dfa22b | 2267 | |
249247c9 JQ |
2268 | feature_not_found() { |
2269 | feature=$1 | |
21684af0 | 2270 | remedy=$2 |
249247c9 | 2271 | |
76ad07a4 | 2272 | error_exit "User requested feature $feature" \ |
21684af0 SS |
2273 | "configure was not able to find it." \ |
2274 | "$remedy" | |
249247c9 JQ |
2275 | } |
2276 | ||
7d13299d FB |
2277 | # --- |
2278 | # big/little endian test | |
2279 | cat > $TMPC << EOF | |
61cc919f MF |
2280 | short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; |
2281 | short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; | |
2282 | extern int foo(short *, short *); | |
2283 | int main(int argc, char *argv[]) { | |
2284 | return foo(big_endian, little_endian); | |
7d13299d FB |
2285 | } |
2286 | EOF | |
2287 | ||
61cc919f | 2288 | if compile_object ; then |
12f15c91 | 2289 | if strings -a $TMPO | grep -q BiGeNdIaN ; then |
61cc919f | 2290 | bigendian="yes" |
12f15c91 | 2291 | elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then |
61cc919f MF |
2292 | bigendian="no" |
2293 | else | |
2294 | echo big/little test failed | |
21d89f84 | 2295 | fi |
61cc919f MF |
2296 | else |
2297 | echo big/little test failed | |
7d13299d FB |
2298 | fi |
2299 | ||
e10ee3f5 PMD |
2300 | ########################################## |
2301 | # system tools | |
2302 | if test -z "$want_tools"; then | |
2303 | if test "$softmmu" = "no"; then | |
2304 | want_tools=no | |
2305 | else | |
2306 | want_tools=yes | |
2307 | fi | |
2308 | fi | |
2309 | ||
a30878e7 PM |
2310 | ########################################## |
2311 | # cocoa implies not SDL or GTK | |
2312 | # (the cocoa UI code currently assumes it is always the active UI | |
2313 | # and doesn't interact well with other UI frontend code) | |
2314 | if test "$cocoa" = "yes"; then | |
2315 | if test "$sdl" = "yes"; then | |
2316 | error_exit "Cocoa and SDL UIs cannot both be enabled at once" | |
2317 | fi | |
2318 | if test "$gtk" = "yes"; then | |
2319 | error_exit "Cocoa and GTK UIs cannot both be enabled at once" | |
2320 | fi | |
2321 | gtk=no | |
2322 | sdl=no | |
2323 | fi | |
2324 | ||
6b39b063 EB |
2325 | # Some versions of Mac OS X incorrectly define SIZE_MAX |
2326 | cat > $TMPC << EOF | |
2327 | #include <stdint.h> | |
2328 | #include <stdio.h> | |
2329 | int main(int argc, char *argv[]) { | |
2330 | return printf("%zu", SIZE_MAX); | |
2331 | } | |
2332 | EOF | |
2333 | have_broken_size_max=no | |
2334 | if ! compile_object -Werror ; then | |
2335 | have_broken_size_max=yes | |
2336 | fi | |
2337 | ||
015a33bd GA |
2338 | ########################################## |
2339 | # L2TPV3 probe | |
2340 | ||
2341 | cat > $TMPC <<EOF | |
2342 | #include <sys/socket.h> | |
bff6cb72 | 2343 | #include <linux/ip.h> |
015a33bd GA |
2344 | int main(void) { return sizeof(struct mmsghdr); } |
2345 | EOF | |
2346 | if compile_prog "" "" ; then | |
2347 | l2tpv3=yes | |
2348 | else | |
2349 | l2tpv3=no | |
2350 | fi | |
2351 | ||
299e6f19 PB |
2352 | ######################################### |
2353 | # vhost interdependencies and host support | |
2354 | ||
2355 | # vhost backends | |
2356 | test "$vhost_user" = "" && vhost_user=yes | |
2357 | if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then | |
2358 | error_exit "vhost-user isn't available on win32" | |
2359 | fi | |
2360 | test "$vhost_kernel" = "" && vhost_kernel=$linux | |
2361 | if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then | |
2362 | error_exit "vhost-kernel is only available on Linux" | |
2363 | fi | |
2364 | ||
2365 | # vhost-kernel devices | |
2366 | test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel | |
2367 | if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then | |
2368 | error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" | |
2369 | fi | |
2370 | test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel | |
2371 | if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then | |
2372 | error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" | |
2373 | fi | |
2374 | ||
2375 | # vhost-user backends | |
2376 | test "$vhost_net_user" = "" && vhost_net_user=$vhost_user | |
2377 | if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then | |
2378 | error_exit "--enable-vhost-net-user requires --enable-vhost-user" | |
2379 | fi | |
2380 | test "$vhost_crypto" = "" && vhost_crypto=$vhost_user | |
2381 | if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then | |
2382 | error_exit "--enable-vhost-crypto requires --enable-vhost-user" | |
2383 | fi | |
98fc1ada DDAG |
2384 | test "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user |
2385 | if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then | |
2386 | error_exit "--enable-vhost-user-fs requires --enable-vhost-user" | |
2387 | fi | |
299e6f19 PB |
2388 | |
2389 | # OR the vhost-kernel and vhost-user values for simplicity | |
2390 | if test "$vhost_net" = ""; then | |
2391 | test "$vhost_net_user" = "yes" && vhost_net=yes | |
2392 | test "$vhost_kernel" = "yes" && vhost_net=yes | |
2393 | fi | |
2394 | ||
4d9310f4 DB |
2395 | ########################################## |
2396 | # MinGW / Mingw-w64 localtime_r/gmtime_r check | |
2397 | ||
2398 | if test "$mingw32" = "yes"; then | |
2399 | # Some versions of MinGW / Mingw-w64 lack localtime_r | |
2400 | # and gmtime_r entirely. | |
2401 | # | |
2402 | # Some versions of Mingw-w64 define a macro for | |
2403 | # localtime_r/gmtime_r. | |
2404 | # | |
2405 | # Some versions of Mingw-w64 will define functions | |
2406 | # for localtime_r/gmtime_r, but only if you have | |
2407 | # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun | |
2408 | # though, unistd.h and pthread.h both define | |
2409 | # that for you. | |
2410 | # | |
2411 | # So this #undef localtime_r and #include <unistd.h> | |
2412 | # are not in fact redundant. | |
2413 | cat > $TMPC << EOF | |
2414 | #include <unistd.h> | |
2415 | #include <time.h> | |
2416 | #undef localtime_r | |
2417 | int main(void) { localtime_r(NULL, NULL); return 0; } | |
2418 | EOF | |
2419 | if compile_prog "" "" ; then | |
2420 | localtime_r="yes" | |
2421 | else | |
2422 | localtime_r="no" | |
2423 | fi | |
2424 | fi | |
2425 | ||
779ab5e3 SW |
2426 | ########################################## |
2427 | # pkg-config probe | |
2428 | ||
2429 | if ! has "$pkg_config_exe"; then | |
76ad07a4 | 2430 | error_exit "pkg-config binary '$pkg_config_exe' not found" |
779ab5e3 SW |
2431 | fi |
2432 | ||
b0a47e79 JQ |
2433 | ########################################## |
2434 | # NPTL probe | |
2435 | ||
24cb36a6 | 2436 | if test "$linux_user" = "yes"; then |
b0a47e79 | 2437 | cat > $TMPC <<EOF |
bd0c5661 | 2438 | #include <sched.h> |
30813cea | 2439 | #include <linux/futex.h> |
182eacc0 | 2440 | int main(void) { |
bd0c5661 PB |
2441 | #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) |
2442 | #error bork | |
2443 | #endif | |
182eacc0 | 2444 | return 0; |
bd0c5661 PB |
2445 | } |
2446 | EOF | |
24cb36a6 | 2447 | if ! compile_object ; then |
21684af0 | 2448 | feature_not_found "nptl" "Install glibc and linux kernel headers." |
b0a47e79 | 2449 | fi |
bd0c5661 PB |
2450 | fi |
2451 | ||
607dacd0 QN |
2452 | ########################################## |
2453 | # lzo check | |
2454 | ||
2455 | if test "$lzo" != "no" ; then | |
2456 | cat > $TMPC << EOF | |
2457 | #include <lzo/lzo1x.h> | |
2458 | int main(void) { lzo_version(); return 0; } | |
2459 | EOF | |
2460 | if compile_prog "" "-llzo2" ; then | |
b25c9dff SW |
2461 | libs_softmmu="$libs_softmmu -llzo2" |
2462 | lzo="yes" | |
607dacd0 | 2463 | else |
b25c9dff SW |
2464 | if test "$lzo" = "yes"; then |
2465 | feature_not_found "liblzo2" "Install liblzo2 devel" | |
2466 | fi | |
2467 | lzo="no" | |
607dacd0 | 2468 | fi |
607dacd0 QN |
2469 | fi |
2470 | ||
2471 | ########################################## | |
2472 | # snappy check | |
2473 | ||
2474 | if test "$snappy" != "no" ; then | |
2475 | cat > $TMPC << EOF | |
2476 | #include <snappy-c.h> | |
2477 | int main(void) { snappy_max_compressed_length(4096); return 0; } | |
2478 | EOF | |
2479 | if compile_prog "" "-lsnappy" ; then | |
b25c9dff SW |
2480 | libs_softmmu="$libs_softmmu -lsnappy" |
2481 | snappy="yes" | |
607dacd0 | 2482 | else |
b25c9dff SW |
2483 | if test "$snappy" = "yes"; then |
2484 | feature_not_found "libsnappy" "Install libsnappy devel" | |
2485 | fi | |
2486 | snappy="no" | |
607dacd0 | 2487 | fi |
607dacd0 QN |
2488 | fi |
2489 | ||
6b383c08 PW |
2490 | ########################################## |
2491 | # bzip2 check | |
2492 | ||
2493 | if test "$bzip2" != "no" ; then | |
2494 | cat > $TMPC << EOF | |
2495 | #include <bzlib.h> | |
2496 | int main(void) { BZ2_bzlibVersion(); return 0; } | |
2497 | EOF | |
2498 | if compile_prog "" "-lbz2" ; then | |
2499 | bzip2="yes" | |
2500 | else | |
2501 | if test "$bzip2" = "yes"; then | |
2502 | feature_not_found "libbzip2" "Install libbzip2 devel" | |
2503 | fi | |
2504 | bzip2="no" | |
2505 | fi | |
2506 | fi | |
2507 | ||
83bc1f97 JF |
2508 | ########################################## |
2509 | # lzfse check | |
2510 | ||
2511 | if test "$lzfse" != "no" ; then | |
2512 | cat > $TMPC << EOF | |
2513 | #include <lzfse.h> | |
2514 | int main(void) { lzfse_decode_scratch_size(); return 0; } | |
2515 | EOF | |
2516 | if compile_prog "" "-llzfse" ; then | |
2517 | lzfse="yes" | |
2518 | else | |
2519 | if test "$lzfse" = "yes"; then | |
2520 | feature_not_found "lzfse" "Install lzfse devel" | |
2521 | fi | |
2522 | lzfse="no" | |
2523 | fi | |
2524 | fi | |
2525 | ||
3a678481 JQ |
2526 | ########################################## |
2527 | # zstd check | |
2528 | ||
2529 | if test "$zstd" != "no" ; then | |
297254c7 JQ |
2530 | libzstd_minver="1.4.0" |
2531 | if $pkg_config --atleast-version=$libzstd_minver libzstd ; then | |
3a678481 JQ |
2532 | zstd_cflags="$($pkg_config --cflags libzstd)" |
2533 | zstd_libs="$($pkg_config --libs libzstd)" | |
2534 | LIBS="$zstd_libs $LIBS" | |
2535 | QEMU_CFLAGS="$QEMU_CFLAGS $zstd_cflags" | |
2536 | zstd="yes" | |
2537 | else | |
2538 | if test "$zstd" = "yes" ; then | |
2539 | feature_not_found "libzstd" "Install libzstd devel" | |
2540 | fi | |
2541 | zstd="no" | |
2542 | fi | |
2543 | fi | |
2544 | ||
f794573e EO |
2545 | ########################################## |
2546 | # libseccomp check | |
2547 | ||
2548 | if test "$seccomp" != "no" ; then | |
25ed0ecc HD |
2549 | libseccomp_minver="2.3.0" |
2550 | if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then | |
c3883e1f FZ |
2551 | seccomp_cflags="$($pkg_config --cflags libseccomp)" |
2552 | seccomp_libs="$($pkg_config --libs libseccomp)" | |
693e5910 | 2553 | seccomp="yes" |
f794573e | 2554 | else |
693e5910 | 2555 | if test "$seccomp" = "yes" ; then |
25ed0ecc HD |
2556 | feature_not_found "libseccomp" \ |
2557 | "Install libseccomp devel >= $libseccomp_minver" | |
693e5910 AJ |
2558 | fi |
2559 | seccomp="no" | |
f794573e EO |
2560 | fi |
2561 | fi | |
e37630ca AL |
2562 | ########################################## |
2563 | # xen probe | |
2564 | ||
fc321b4b | 2565 | if test "$xen" != "no" ; then |
c1cdd9d5 JG |
2566 | # Check whether Xen library path is specified via --extra-ldflags to avoid |
2567 | # overriding this setting with pkg-config output. If not, try pkg-config | |
2568 | # to obtain all needed flags. | |
2569 | ||
2570 | if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ | |
2571 | $pkg_config --exists xencontrol ; then | |
2572 | xen_ctrl_version="$(printf '%d%02d%02d' \ | |
2573 | $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" | |
2574 | xen=yes | |
2575 | xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab" | |
2576 | xen_pc="$xen_pc xenevtchn xendevicemodel" | |
58ea9a7a AP |
2577 | if $pkg_config --exists xentoolcore; then |
2578 | xen_pc="$xen_pc xentoolcore" | |
2579 | fi | |
c1cdd9d5 JG |
2580 | QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)" |
2581 | libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu" | |
c1cdd9d5 | 2582 | else |
d5b93ddf | 2583 | |
c1cdd9d5 | 2584 | xen_libs="-lxenstore -lxenctrl -lxenguest" |
d9506cab | 2585 | xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" |
50ced5b3 | 2586 | |
c1cdd9d5 JG |
2587 | # First we test whether Xen headers and libraries are available. |
2588 | # If no, we are done and there is no Xen support. | |
2589 | # If yes, more tests are run to detect the Xen version. | |
2590 | ||
2591 | # Xen (any) | |
2592 | cat > $TMPC <<EOF | |
e37630ca | 2593 | #include <xenctrl.h> |
50ced5b3 SW |
2594 | int main(void) { |
2595 | return 0; | |
2596 | } | |
2597 | EOF | |
c1cdd9d5 JG |
2598 | if ! compile_prog "" "$xen_libs" ; then |
2599 | # Xen not found | |
2600 | if test "$xen" = "yes" ; then | |
2601 | feature_not_found "xen" "Install xen devel" | |
2602 | fi | |
2603 | xen=no | |
50ced5b3 | 2604 | |
c1cdd9d5 JG |
2605 | # Xen unstable |
2606 | elif | |
2607 | cat > $TMPC <<EOF && | |
2cbf8903 RL |
2608 | #undef XC_WANT_COMPAT_DEVICEMODEL_API |
2609 | #define __XEN_TOOLS__ | |
2610 | #include <xendevicemodel.h> | |
d3c49ebb | 2611 | #include <xenforeignmemory.h> |
2cbf8903 RL |
2612 | int main(void) { |
2613 | xendevicemodel_handle *xd; | |
d3c49ebb | 2614 | xenforeignmemory_handle *xfmem; |
2cbf8903 RL |
2615 | |
2616 | xd = xendevicemodel_open(0, 0); | |
2617 | xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); | |
2618 | ||
d3c49ebb PD |
2619 | xfmem = xenforeignmemory_open(0, 0); |
2620 | xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); | |
2621 | ||
2cbf8903 RL |
2622 | return 0; |
2623 | } | |
2624 | EOF | |
2625 | compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" | |
2626 | then | |
2627 | xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" | |
2628 | xen_ctrl_version=41100 | |
2629 | xen=yes | |
2630 | elif | |
2631 | cat > $TMPC <<EOF && | |
5ba3d756 ID |
2632 | #undef XC_WANT_COMPAT_MAP_FOREIGN_API |
2633 | #include <xenforeignmemory.h> | |
58ea9a7a | 2634 | #include <xentoolcore.h> |
5ba3d756 ID |
2635 | int main(void) { |
2636 | xenforeignmemory_handle *xfmem; | |
2637 | ||
2638 | xfmem = xenforeignmemory_open(0, 0); | |
2639 | xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); | |
58ea9a7a | 2640 | xentoolcore_restrict_all(0); |
5ba3d756 ID |
2641 | |
2642 | return 0; | |
2643 | } | |
2644 | EOF | |
58ea9a7a | 2645 | compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" |
5ba3d756 | 2646 | then |
58ea9a7a | 2647 | xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" |
5ba3d756 ID |
2648 | xen_ctrl_version=41000 |
2649 | xen=yes | |
2650 | elif | |
2651 | cat > $TMPC <<EOF && | |
da8090cc PD |
2652 | #undef XC_WANT_COMPAT_DEVICEMODEL_API |
2653 | #define __XEN_TOOLS__ | |
2654 | #include <xendevicemodel.h> | |
2655 | int main(void) { | |
2656 | xendevicemodel_handle *xd; | |
2657 | ||
2658 | xd = xendevicemodel_open(0, 0); | |
2659 | xendevicemodel_close(xd); | |
50ced5b3 | 2660 | |
da8090cc PD |
2661 | return 0; |
2662 | } | |
2663 | EOF | |
c1cdd9d5 JG |
2664 | compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" |
2665 | then | |
2666 | xen_stable_libs="-lxendevicemodel $xen_stable_libs" | |
2667 | xen_ctrl_version=40900 | |
2668 | xen=yes | |
2669 | elif | |
2670 | cat > $TMPC <<EOF && | |
b6eb9b45 PS |
2671 | /* |
2672 | * If we have stable libs the we don't want the libxc compat | |
2673 | * layers, regardless of what CFLAGS we may have been given. | |
2674 | * | |
2675 | * Also, check if xengnttab_grant_copy_segment_t is defined and | |
2676 | * grant copy operation is implemented. | |
2677 | */ | |
2678 | #undef XC_WANT_COMPAT_EVTCHN_API | |
2679 | #undef XC_WANT_COMPAT_GNTTAB_API | |
2680 | #undef XC_WANT_COMPAT_MAP_FOREIGN_API | |
2681 | #include <xenctrl.h> | |
2682 | #include <xenstore.h> | |
2683 | #include <xenevtchn.h> | |
2684 | #include <xengnttab.h> | |
2685 | #include <xenforeignmemory.h> | |
2686 | #include <stdint.h> | |
2687 | #include <xen/hvm/hvm_info_table.h> | |
2688 | #if !defined(HVM_MAX_VCPUS) | |
2689 | # error HVM_MAX_VCPUS not defined | |
2690 | #endif | |
2691 | int main(void) { | |
2692 | xc_interface *xc = NULL; | |
2693 | xenforeignmemory_handle *xfmem; | |
2694 | xenevtchn_handle *xe; | |
2695 | xengnttab_handle *xg; | |
b6eb9b45 PS |
2696 | xengnttab_grant_copy_segment_t* seg = NULL; |
2697 | ||
2698 | xs_daemon_open(); | |
2699 | ||
2700 | xc = xc_interface_open(0, 0, 0); | |
2701 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2702 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2703 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2704 | xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); | |
b6eb9b45 PS |
2705 | |
2706 | xfmem = xenforeignmemory_open(0, 0); | |
2707 | xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); | |
2708 | ||
2709 | xe = xenevtchn_open(0, 0); | |
2710 | xenevtchn_fd(xe); | |
2711 | ||
2712 | xg = xengnttab_open(0, 0); | |
2713 | xengnttab_grant_copy(xg, 0, seg); | |
2714 | ||
2715 | return 0; | |
2716 | } | |
2717 | EOF | |
c1cdd9d5 JG |
2718 | compile_prog "" "$xen_libs $xen_stable_libs" |
2719 | then | |
2720 | xen_ctrl_version=40800 | |
2721 | xen=yes | |
2722 | elif | |
2723 | cat > $TMPC <<EOF && | |
5eeb39c2 IC |
2724 | /* |
2725 | * If we have stable libs the we don't want the libxc compat | |
2726 | * layers, regardless of what CFLAGS we may have been given. | |
2727 | */ | |
2728 | #undef XC_WANT_COMPAT_EVTCHN_API | |
2729 | #undef XC_WANT_COMPAT_GNTTAB_API | |
2730 | #undef XC_WANT_COMPAT_MAP_FOREIGN_API | |
2731 | #include <xenctrl.h> | |
2732 | #include <xenstore.h> | |
2733 | #include <xenevtchn.h> | |
2734 | #include <xengnttab.h> | |
2735 | #include <xenforeignmemory.h> | |
2736 | #include <stdint.h> | |
2737 | #include <xen/hvm/hvm_info_table.h> | |
2738 | #if !defined(HVM_MAX_VCPUS) | |
2739 | # error HVM_MAX_VCPUS not defined | |
2740 | #endif | |
2741 | int main(void) { | |
2742 | xc_interface *xc = NULL; | |
2743 | xenforeignmemory_handle *xfmem; | |
2744 | xenevtchn_handle *xe; | |
2745 | xengnttab_handle *xg; | |
5eeb39c2 IC |
2746 | |
2747 | xs_daemon_open(); | |
2748 | ||
2749 | xc = xc_interface_open(0, 0, 0); | |
2750 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2751 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2752 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2753 | xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); | |
5eeb39c2 IC |
2754 | |
2755 | xfmem = xenforeignmemory_open(0, 0); | |
2756 | xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); | |
2757 | ||
2758 | xe = xenevtchn_open(0, 0); | |
2759 | xenevtchn_fd(xe); | |
2760 | ||
2761 | xg = xengnttab_open(0, 0); | |
2762 | xengnttab_map_grant_ref(xg, 0, 0, 0); | |
2763 | ||
2764 | return 0; | |
2765 | } | |
2766 | EOF | |
c1cdd9d5 JG |
2767 | compile_prog "" "$xen_libs $xen_stable_libs" |
2768 | then | |
2769 | xen_ctrl_version=40701 | |
2770 | xen=yes | |
c1cdd9d5 JG |
2771 | |
2772 | # Xen 4.6 | |
2773 | elif | |
2774 | cat > $TMPC <<EOF && | |
cdadde39 | 2775 | #include <xenctrl.h> |
e108a3c1 | 2776 | #include <xenstore.h> |
d5b93ddf AP |
2777 | #include <stdint.h> |
2778 | #include <xen/hvm/hvm_info_table.h> | |
2779 | #if !defined(HVM_MAX_VCPUS) | |
2780 | # error HVM_MAX_VCPUS not defined | |
2781 | #endif | |
d8b441a3 JB |
2782 | int main(void) { |
2783 | xc_interface *xc; | |
2784 | xs_daemon_open(); | |
2785 | xc = xc_interface_open(0, 0, 0); | |
2786 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2787 | xc_gnttab_open(NULL, 0); | |
2788 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2789 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2790 | xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); | |
20a544c7 | 2791 | xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); |
d8b441a3 JB |
2792 | return 0; |
2793 | } | |
2794 | EOF | |
c1cdd9d5 JG |
2795 | compile_prog "" "$xen_libs" |
2796 | then | |
2797 | xen_ctrl_version=40600 | |
2798 | xen=yes | |
2799 | ||
2800 | # Xen 4.5 | |
2801 | elif | |
2802 | cat > $TMPC <<EOF && | |
d8b441a3 JB |
2803 | #include <xenctrl.h> |
2804 | #include <xenstore.h> | |
2805 | #include <stdint.h> | |
2806 | #include <xen/hvm/hvm_info_table.h> | |
2807 | #if !defined(HVM_MAX_VCPUS) | |
2808 | # error HVM_MAX_VCPUS not defined | |
2809 | #endif | |
3996e85c PD |
2810 | int main(void) { |
2811 | xc_interface *xc; | |
2812 | xs_daemon_open(); | |
2813 | xc = xc_interface_open(0, 0, 0); | |
2814 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2815 | xc_gnttab_open(NULL, 0); | |
2816 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2817 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2818 | xc_hvm_create_ioreq_server(xc, 0, 0, NULL); | |
2819 | return 0; | |
2820 | } | |
2821 | EOF | |
c1cdd9d5 JG |
2822 | compile_prog "" "$xen_libs" |
2823 | then | |
2824 | xen_ctrl_version=40500 | |
2825 | xen=yes | |
3996e85c | 2826 | |
c1cdd9d5 JG |
2827 | elif |
2828 | cat > $TMPC <<EOF && | |
3996e85c PD |
2829 | #include <xenctrl.h> |
2830 | #include <xenstore.h> | |
2831 | #include <stdint.h> | |
2832 | #include <xen/hvm/hvm_info_table.h> | |
2833 | #if !defined(HVM_MAX_VCPUS) | |
2834 | # error HVM_MAX_VCPUS not defined | |
2835 | #endif | |
8688e065 SS |
2836 | int main(void) { |
2837 | xc_interface *xc; | |
2838 | xs_daemon_open(); | |
2839 | xc = xc_interface_open(0, 0, 0); | |
2840 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2841 | xc_gnttab_open(NULL, 0); | |
2842 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2843 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2844 | return 0; | |
2845 | } | |
2846 | EOF | |
c1cdd9d5 JG |
2847 | compile_prog "" "$xen_libs" |
2848 | then | |
2849 | xen_ctrl_version=40200 | |
2850 | xen=yes | |
8688e065 | 2851 | |
c1cdd9d5 JG |
2852 | else |
2853 | if test "$xen" = "yes" ; then | |
2854 | feature_not_found "xen (unsupported version)" \ | |
2855 | "Install a supported xen (xen 4.2 or newer)" | |
2856 | fi | |
2857 | xen=no | |
fc321b4b | 2858 | fi |
d5b93ddf | 2859 | |
c1cdd9d5 JG |
2860 | if test "$xen" = yes; then |
2861 | if test $xen_ctrl_version -ge 40701 ; then | |
2862 | libs_softmmu="$xen_stable_libs $libs_softmmu" | |
2863 | fi | |
2864 | libs_softmmu="$xen_libs $libs_softmmu" | |
5eeb39c2 | 2865 | fi |
d5b93ddf | 2866 | fi |
e37630ca AL |
2867 | fi |
2868 | ||
eb6fda0f | 2869 | if test "$xen_pci_passthrough" != "no"; then |
edfb07ed | 2870 | if test "$xen" = "yes" && test "$linux" = "yes"; then |
eb6fda0f AP |
2871 | xen_pci_passthrough=yes |
2872 | else | |
2873 | if test "$xen_pci_passthrough" = "yes"; then | |
76ad07a4 PM |
2874 | error_exit "User requested feature Xen PCI Passthrough" \ |
2875 | " but this feature requires /sys from Linux" | |
eb6fda0f AP |
2876 | fi |
2877 | xen_pci_passthrough=no | |
2878 | fi | |
2879 | fi | |
2880 | ||
d661d9a4 JTV |
2881 | ########################################## |
2882 | # Windows Hypervisor Platform accelerator (WHPX) check | |
2883 | if test "$whpx" != "no" ; then | |
327fccb2 | 2884 | if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then |
d661d9a4 JTV |
2885 | whpx="yes" |
2886 | else | |
2887 | if test "$whpx" = "yes"; then | |
53537bb1 | 2888 | feature_not_found "WinHvPlatform" "WinHvEmulation is not installed" |
d661d9a4 JTV |
2889 | fi |
2890 | whpx="no" | |
2891 | fi | |
2892 | fi | |
2893 | ||
dfffc653 JQ |
2894 | ########################################## |
2895 | # Sparse probe | |
2896 | if test "$sparse" != "no" ; then | |
0dba6195 | 2897 | if has cgcc; then |
dfffc653 JQ |
2898 | sparse=yes |
2899 | else | |
2900 | if test "$sparse" = "yes" ; then | |
21684af0 | 2901 | feature_not_found "sparse" "Install sparse binary" |
dfffc653 JQ |
2902 | fi |
2903 | sparse=no | |
2904 | fi | |
2905 | fi | |
2906 | ||
f676c67e JW |
2907 | ########################################## |
2908 | # X11 probe | |
f676c67e | 2909 | if $pkg_config --exists "x11"; then |
8781595b | 2910 | have_x11=yes |
89138857 SW |
2911 | x11_cflags=$($pkg_config --cflags x11) |
2912 | x11_libs=$($pkg_config --libs x11) | |
f676c67e JW |
2913 | fi |
2914 | ||
a4ccabcf AL |
2915 | ########################################## |
2916 | # GTK probe | |
2917 | ||
2918 | if test "$gtk" != "no"; then | |
89d85cde DB |
2919 | gtkpackage="gtk+-3.0" |
2920 | gtkx11package="gtk+-x11-3.0" | |
7b23d121 | 2921 | gtkversion="3.22.0" |
bbbf9bfb | 2922 | if $pkg_config --exists "$gtkpackage >= $gtkversion"; then |
89138857 SW |
2923 | gtk_cflags=$($pkg_config --cflags $gtkpackage) |
2924 | gtk_libs=$($pkg_config --libs $gtkpackage) | |
2925 | gtk_version=$($pkg_config --modversion $gtkpackage) | |
0a337ed0 | 2926 | if $pkg_config --exists "$gtkx11package >= $gtkversion"; then |
8781595b | 2927 | need_x11=yes |
f676c67e JW |
2928 | gtk_cflags="$gtk_cflags $x11_cflags" |
2929 | gtk_libs="$gtk_libs $x11_libs" | |
0a337ed0 | 2930 | fi |
bbbf9bfb SW |
2931 | gtk="yes" |
2932 | elif test "$gtk" = "yes"; then | |
5fe309ff | 2933 | feature_not_found "gtk" "Install gtk3-devel" |
bbbf9bfb SW |
2934 | else |
2935 | gtk="no" | |
2936 | fi | |
2937 | fi | |
2938 | ||
ddbb0d09 DB |
2939 | |
2940 | ########################################## | |
2941 | # GNUTLS probe | |
2942 | ||
2943 | if test "$gnutls" != "no"; then | |
a73e82ef | 2944 | pass="no" |
a0722409 | 2945 | if $pkg_config --exists "gnutls >= 3.1.18"; then |
89138857 SW |
2946 | gnutls_cflags=$($pkg_config --cflags gnutls) |
2947 | gnutls_libs=$($pkg_config --libs gnutls) | |
a73e82ef RH |
2948 | # Packaging for the static libraries is not always correct. |
2949 | # At least ubuntu 18.04 ships only shared libraries. | |
2950 | write_c_skeleton | |
2951 | if compile_prog "" "$gnutls_libs" ; then | |
243dc2cf | 2952 | LIBS="$gnutls_libs $LIBS" |
a73e82ef RH |
2953 | QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" |
2954 | pass="yes" | |
2955 | fi | |
2956 | fi | |
2957 | if test "$pass" = "no" && test "$gnutls" = "yes"; then | |
a0722409 | 2958 | feature_not_found "gnutls" "Install gnutls devel >= 3.1.18" |
ddbb0d09 | 2959 | else |
a73e82ef | 2960 | gnutls="$pass" |
ddbb0d09 | 2961 | fi |
ddbb0d09 DB |
2962 | fi |
2963 | ||
91bfcdb0 DB |
2964 | |
2965 | # If user didn't give a --disable/enable-gcrypt flag, | |
2966 | # then mark as disabled if user requested nettle | |
a0722409 | 2967 | # explicitly |
91bfcdb0 DB |
2968 | if test -z "$gcrypt" |
2969 | then | |
a0722409 | 2970 | if test "$nettle" = "yes" |
91bfcdb0 DB |
2971 | then |
2972 | gcrypt="no" | |
2973 | fi | |
2974 | fi | |
2975 | ||
2976 | # If user didn't give a --disable/enable-nettle flag, | |
2977 | # then mark as disabled if user requested gcrypt | |
a0722409 | 2978 | # explicitly |
91bfcdb0 DB |
2979 | if test -z "$nettle" |
2980 | then | |
a0722409 | 2981 | if test "$gcrypt" = "yes" |
91bfcdb0 DB |
2982 | then |
2983 | nettle="no" | |
2984 | fi | |
2985 | fi | |
2986 | ||
dea7a64e | 2987 | has_libgcrypt() { |
91bfcdb0 DB |
2988 | if ! has "libgcrypt-config" |
2989 | then | |
2990 | return 1 | |
2991 | fi | |
2992 | ||
2993 | if test -n "$cross_prefix" | |
2994 | then | |
89138857 | 2995 | host=$(libgcrypt-config --host) |
91bfcdb0 DB |
2996 | if test "$host-" != $cross_prefix |
2997 | then | |
2998 | return 1 | |
2999 | fi | |
3000 | fi | |
3001 | ||
dea7a64e DB |
3002 | maj=`libgcrypt-config --version | awk -F . '{print $1}'` |
3003 | min=`libgcrypt-config --version | awk -F . '{print $2}'` | |
3004 | ||
3005 | if test $maj != 1 || test $min -lt 5 | |
3006 | then | |
3007 | return 1 | |
3008 | fi | |
3009 | ||
91bfcdb0 DB |
3010 | return 0 |
3011 | } | |
3012 | ||
a0722409 DB |
3013 | |
3014 | if test "$nettle" != "no"; then | |
a73e82ef | 3015 | pass="no" |
64dd2f3b | 3016 | if $pkg_config --exists "nettle >= 2.7.1"; then |
a0722409 DB |
3017 | nettle_cflags=$($pkg_config --cflags nettle) |
3018 | nettle_libs=$($pkg_config --libs nettle) | |
3019 | nettle_version=$($pkg_config --modversion nettle) | |
a73e82ef RH |
3020 | # Link test to make sure the given libraries work (e.g for static). |
3021 | write_c_skeleton | |
3022 | if compile_prog "" "$nettle_libs" ; then | |
243dc2cf | 3023 | LIBS="$nettle_libs $LIBS" |
a73e82ef RH |
3024 | QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" |
3025 | if test -z "$gcrypt"; then | |
3026 | gcrypt="no" | |
3027 | fi | |
3028 | pass="yes" | |
a0722409 | 3029 | fi |
a73e82ef | 3030 | fi |
dc2207af DB |
3031 | if test "$pass" = "yes" |
3032 | then | |
3033 | cat > $TMPC << EOF | |
3034 | #include <nettle/xts.h> | |
3035 | int main(void) { | |
3036 | return 0; | |
3037 | } | |
3038 | EOF | |
3039 | if compile_prog "$nettle_cflags" "$nettle_libs" ; then | |
3040 | nettle_xts=yes | |
3041 | qemu_private_xts=no | |
3042 | fi | |
3043 | fi | |
a73e82ef RH |
3044 | if test "$pass" = "no" && test "$nettle" = "yes"; then |
3045 | feature_not_found "nettle" "Install nettle devel >= 2.7.1" | |
a0722409 | 3046 | else |
a73e82ef | 3047 | nettle="$pass" |
a0722409 DB |
3048 | fi |
3049 | fi | |
3050 | ||
91bfcdb0 | 3051 | if test "$gcrypt" != "no"; then |
a73e82ef | 3052 | pass="no" |
dea7a64e | 3053 | if has_libgcrypt; then |
89138857 SW |
3054 | gcrypt_cflags=$(libgcrypt-config --cflags) |
3055 | gcrypt_libs=$(libgcrypt-config --libs) | |
a73e82ef | 3056 | # Debian has removed -lgpg-error from libgcrypt-config |
91bfcdb0 DB |
3057 | # as it "spreads unnecessary dependencies" which in |
3058 | # turn breaks static builds... | |
3059 | if test "$static" = "yes" | |
3060 | then | |
3061 | gcrypt_libs="$gcrypt_libs -lgpg-error" | |
3062 | fi | |
1f923c70 | 3063 | |
a73e82ef RH |
3064 | # Link test to make sure the given libraries work (e.g for static). |
3065 | write_c_skeleton | |
3066 | if compile_prog "" "$gcrypt_libs" ; then | |
243dc2cf | 3067 | LIBS="$gcrypt_libs $LIBS" |
a73e82ef RH |
3068 | QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" |
3069 | pass="yes" | |
3070 | fi | |
3071 | fi | |
3072 | if test "$pass" = "yes"; then | |
3073 | gcrypt="yes" | |
1f923c70 LM |
3074 | cat > $TMPC << EOF |
3075 | #include <gcrypt.h> | |
3076 | int main(void) { | |
3077 | gcry_mac_hd_t handle; | |
3078 | gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5, | |
3079 | GCRY_MAC_FLAG_SECURE, NULL); | |
3080 | return 0; | |
3081 | } | |
3082 | EOF | |
3083 | if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then | |
3084 | gcrypt_hmac=yes | |
3085 | fi | |
e0576942 DB |
3086 | cat > $TMPC << EOF |
3087 | #include <gcrypt.h> | |
3088 | int main(void) { | |
3089 | gcry_cipher_hd_t handle; | |
3090 | gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0); | |
3091 | return 0; | |
3092 | } | |
3093 | EOF | |
3094 | if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then | |
3095 | gcrypt_xts=yes | |
3096 | qemu_private_xts=no | |
3097 | fi | |
a73e82ef RH |
3098 | elif test "$gcrypt" = "yes"; then |
3099 | feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0" | |
62893b67 | 3100 | else |
a73e82ef | 3101 | gcrypt="no" |
62893b67 DB |
3102 | fi |
3103 | fi | |
3104 | ||
ddbb0d09 | 3105 | |
91bfcdb0 DB |
3106 | if test "$gcrypt" = "yes" && test "$nettle" = "yes" |
3107 | then | |
3108 | error_exit "Only one of gcrypt & nettle can be enabled" | |
3109 | fi | |
3110 | ||
9a2fd434 DB |
3111 | ########################################## |
3112 | # libtasn1 - only for the TLS creds/session test suite | |
3113 | ||
3114 | tasn1=yes | |
90246037 DB |
3115 | tasn1_cflags="" |
3116 | tasn1_libs="" | |
9a2fd434 | 3117 | if $pkg_config --exists "libtasn1"; then |
89138857 SW |
3118 | tasn1_cflags=$($pkg_config --cflags libtasn1) |
3119 | tasn1_libs=$($pkg_config --libs libtasn1) | |
9a2fd434 DB |
3120 | else |
3121 | tasn1=no | |
3122 | fi | |
3123 | ||
ed754746 | 3124 | |
8953caf3 DB |
3125 | ########################################## |
3126 | # PAM probe | |
3127 | ||
3128 | if test "$auth_pam" != "no"; then | |
3129 | cat > $TMPC <<EOF | |
3130 | #include <security/pam_appl.h> | |
3131 | #include <stdio.h> | |
3132 | int main(void) { | |
3133 | const char *service_name = "qemu"; | |
3134 | const char *user = "frank"; | |
9c9642d0 | 3135 | const struct pam_conv pam_conv = { 0 }; |
8953caf3 | 3136 | pam_handle_t *pamh = NULL; |
9c9642d0 | 3137 | pam_start(service_name, user, &pam_conv, &pamh); |
8953caf3 DB |
3138 | return 0; |
3139 | } | |
3140 | EOF | |
3141 | if compile_prog "" "-lpam" ; then | |
3142 | auth_pam=yes | |
3143 | else | |
3144 | if test "$auth_pam" = "yes"; then | |
3145 | feature_not_found "PAM" "Install PAM development package" | |
3146 | else | |
3147 | auth_pam=no | |
3148 | fi | |
3149 | fi | |
3150 | fi | |
3151 | ||
559607ea DB |
3152 | ########################################## |
3153 | # getifaddrs (for tests/test-io-channel-socket ) | |
3154 | ||
3155 | have_ifaddrs_h=yes | |
3156 | if ! check_include "ifaddrs.h" ; then | |
3157 | have_ifaddrs_h=no | |
3158 | fi | |
3159 | ||
bbbf9bfb SW |
3160 | ########################################## |
3161 | # VTE probe | |
3162 | ||
3163 | if test "$vte" != "no"; then | |
89d85cde DB |
3164 | vteminversion="0.32.0" |
3165 | if $pkg_config --exists "vte-2.91"; then | |
3166 | vtepackage="vte-2.91" | |
528de90a | 3167 | else |
89d85cde | 3168 | vtepackage="vte-2.90" |
528de90a | 3169 | fi |
c6feff9e | 3170 | if $pkg_config --exists "$vtepackage >= $vteminversion"; then |
89138857 SW |
3171 | vte_cflags=$($pkg_config --cflags $vtepackage) |
3172 | vte_libs=$($pkg_config --libs $vtepackage) | |
3173 | vteversion=$($pkg_config --modversion $vtepackage) | |
bbbf9bfb SW |
3174 | vte="yes" |
3175 | elif test "$vte" = "yes"; then | |
89d85cde | 3176 | feature_not_found "vte" "Install libvte-2.90/2.91 devel" |
0d185e63 | 3177 | else |
bbbf9bfb | 3178 | vte="no" |
a4ccabcf AL |
3179 | fi |
3180 | fi | |
3181 | ||
11d9f695 FB |
3182 | ########################################## |
3183 | # SDL probe | |
3184 | ||
aee8a619 CMAB |
3185 | # Look for sdl configuration program (pkg-config or sdl2-config). Try |
3186 | # sdl2-config even without cross prefix, and favour pkg-config over sdl2-config. | |
47c03744 | 3187 | |
c6093a05 PX |
3188 | sdl_probe () |
3189 | { | |
0015ca5c DB |
3190 | if $pkg_config sdl2 --exists; then |
3191 | sdlconfig="$pkg_config sdl2" | |
c6093a05 | 3192 | sdlversion=$($sdlconfig --modversion 2>/dev/null) |
aee8a619 | 3193 | elif has "$sdl2_config"; then |
0015ca5c | 3194 | sdlconfig="$sdl2_config" |
c6093a05 PX |
3195 | sdlversion=$($sdlconfig --version) |
3196 | else | |
3197 | if test "$sdl" = "yes" ; then | |
3198 | feature_not_found "sdl" "Install SDL2-devel" | |
3199 | fi | |
3200 | sdl=no | |
3201 | # no need to do the rest | |
3202 | return | |
3203 | fi | |
aee8a619 | 3204 | if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl2-config; then |
c6093a05 | 3205 | echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 |
a0dfd8a4 | 3206 | fi |
11d9f695 | 3207 | |
ac119f9d | 3208 | cat > $TMPC << EOF |
11d9f695 FB |
3209 | #include <SDL.h> |
3210 | #undef main /* We don't want SDL to override our main() */ | |
3211 | int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } | |
3212 | EOF | |
89138857 | 3213 | sdl_cflags=$($sdlconfig --cflags 2>/dev/null) |
2ca5c430 | 3214 | sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug |
74f42e18 | 3215 | if test "$static" = "yes" ; then |
0015ca5c DB |
3216 | if $pkg_config sdl2 --exists; then |
3217 | sdl_libs=$($pkg_config sdl2 --static --libs 2>/dev/null) | |
5f37e6d4 TH |
3218 | else |
3219 | sdl_libs=$($sdlconfig --static-libs 2>/dev/null) | |
3220 | fi | |
74f42e18 | 3221 | else |
89138857 | 3222 | sdl_libs=$($sdlconfig --libs 2>/dev/null) |
74f42e18 | 3223 | fi |
52166aa0 | 3224 | if compile_prog "$sdl_cflags" "$sdl_libs" ; then |
0015ca5c | 3225 | sdl=yes |
cd01b4a3 | 3226 | |
67c274d3 | 3227 | # static link with sdl ? (note: sdl.pc's --static --libs is broken) |
e633a5c6 | 3228 | if test "$sdl" = "yes" && test "$static" = "yes" ; then |
67c274d3 | 3229 | if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then |
89138857 SW |
3230 | sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)" |
3231 | sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)" | |
ac119f9d | 3232 | fi |
52166aa0 | 3233 | if compile_prog "$sdl_cflags" "$sdl_libs" ; then |
ac119f9d JQ |
3234 | : |
3235 | else | |
3236 | sdl=no | |
3237 | fi | |
3238 | fi # static link | |
c4198157 JQ |
3239 | else # sdl not found |
3240 | if test "$sdl" = "yes" ; then | |
0015ca5c | 3241 | feature_not_found "sdl" "Install SDL2 devel" |
c4198157 JQ |
3242 | fi |
3243 | sdl=no | |
ac119f9d | 3244 | fi # sdl compile test |
c6093a05 PX |
3245 | } |
3246 | ||
a442fe2f DB |
3247 | sdl_image_probe () |
3248 | { | |
3249 | if test "$sdl_image" != "no" ; then | |
3250 | if $pkg_config SDL2_image --exists; then | |
3251 | if test "$static" = "yes"; then | |
3252 | sdl_image_libs=$($pkg_config SDL2_image --libs --static 2>/dev/null) | |
3253 | else | |
3254 | sdl_image_libs=$($pkg_config SDL2_image --libs 2>/dev/null) | |
3255 | fi | |
3256 | sdl_image_cflags=$($pkg_config SDL2_image --cflags 2>/dev/null) | |
3257 | sdl_image=yes | |
3258 | ||
3259 | sdl_cflags="$sdl_cflags $sdl_image_cflags" | |
3260 | sdl_libs="$sdl_libs $sdl_image_libs" | |
3261 | else | |
3262 | if test "$sdl_image" = "yes" ; then | |
3263 | feature_not_found "sdl_image" "Install SDL Image devel" | |
3264 | else | |
3265 | sdl_image=no | |
3266 | fi | |
3267 | fi | |
3268 | fi | |
3269 | } | |
3270 | ||
c6093a05 PX |
3271 | if test "$sdl" != "no" ; then |
3272 | sdl_probe | |
a68551bc | 3273 | fi |
11d9f695 | 3274 | |
a442fe2f DB |
3275 | if test "$sdl" = "yes" ; then |
3276 | sdl_image_probe | |
3277 | else | |
3278 | if test "$sdl_image" = "yes"; then | |
3279 | echo "warning: SDL Image requested, but SDL is not available, disabling" | |
3280 | fi | |
3281 | sdl_image=no | |
3282 | fi | |
3283 | ||
5368a422 | 3284 | if test "$sdl" = "yes" ; then |
ac119f9d | 3285 | cat > $TMPC <<EOF |
5368a422 AL |
3286 | #include <SDL.h> |
3287 | #if defined(SDL_VIDEO_DRIVER_X11) | |
3288 | #include <X11/XKBlib.h> | |
3289 | #else | |
3290 | #error No x11 support | |
3291 | #endif | |
3292 | int main(void) { return 0; } | |
3293 | EOF | |
f676c67e | 3294 | if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then |
8781595b | 3295 | need_x11=yes |
f676c67e JW |
3296 | sdl_cflags="$sdl_cflags $x11_cflags" |
3297 | sdl_libs="$sdl_libs $x11_libs" | |
ac119f9d | 3298 | fi |
5368a422 AL |
3299 | fi |
3300 | ||
2da776db MH |
3301 | ########################################## |
3302 | # RDMA needs OpenFabrics libraries | |
3303 | if test "$rdma" != "no" ; then | |
3304 | cat > $TMPC <<EOF | |
3305 | #include <rdma/rdma_cma.h> | |
3306 | int main(void) { return 0; } | |
3307 | EOF | |
ef6d4ccd | 3308 | rdma_libs="-lrdmacm -libverbs -libumad" |
2da776db MH |
3309 | if compile_prog "" "$rdma_libs" ; then |
3310 | rdma="yes" | |
ef6d4ccd | 3311 | libs_softmmu="$libs_softmmu $rdma_libs" |
2da776db MH |
3312 | else |
3313 | if test "$rdma" = "yes" ; then | |
3314 | error_exit \ | |
ef6d4ccd | 3315 | " OpenFabrics librdmacm/libibverbs/libibumad not present." \ |
2da776db | 3316 | " Your options:" \ |
ef6d4ccd | 3317 | " (1) Fast: Install infiniband packages (devel) from your distro." \ |
2da776db MH |
3318 | " (2) Cleanest: Install libraries from www.openfabrics.org" \ |
3319 | " (3) Also: Install softiwarp if you don't have RDMA hardware" | |
3320 | fi | |
3321 | rdma="no" | |
3322 | fi | |
3323 | fi | |
3324 | ||
21ab34c9 MA |
3325 | ########################################## |
3326 | # PVRDMA detection | |
3327 | ||
3328 | cat > $TMPC <<EOF && | |
3329 | #include <sys/mman.h> | |
3330 | ||
3331 | int | |
3332 | main(void) | |
3333 | { | |
3334 | char buf = 0; | |
3335 | void *addr = &buf; | |
3336 | addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); | |
3337 | ||
3338 | return 0; | |
3339 | } | |
3340 | EOF | |
3341 | ||
3342 | if test "$rdma" = "yes" ; then | |
3343 | case "$pvrdma" in | |
3344 | "") | |
3345 | if compile_prog "" ""; then | |
3346 | pvrdma="yes" | |
3347 | else | |
3348 | pvrdma="no" | |
3349 | fi | |
3350 | ;; | |
3351 | "yes") | |
3352 | if ! compile_prog "" ""; then | |
3353 | error_exit "PVRDMA is not supported since mremap is not implemented" | |
3354 | fi | |
3355 | pvrdma="yes" | |
3356 | ;; | |
3357 | "no") | |
3358 | pvrdma="no" | |
3359 | ;; | |
3360 | esac | |
3361 | else | |
3362 | if test "$pvrdma" = "yes" ; then | |
3363 | error_exit "PVRDMA requires rdma suppport" | |
3364 | fi | |
3365 | pvrdma="no" | |
3366 | fi | |
95c6bff3 | 3367 | |
ee108585 YS |
3368 | # Let's see if enhanced reg_mr is supported |
3369 | if test "$pvrdma" = "yes" ; then | |
3370 | ||
3371 | cat > $TMPC <<EOF && | |
3372 | #include <infiniband/verbs.h> | |
3373 | ||
3374 | int | |
3375 | main(void) | |
3376 | { | |
3377 | struct ibv_mr *mr; | |
3378 | struct ibv_pd *pd = NULL; | |
3379 | size_t length = 10; | |
3380 | uint64_t iova = 0; | |
3381 | int access = 0; | |
3382 | void *addr = NULL; | |
3383 | ||
3384 | mr = ibv_reg_mr_iova(pd, addr, length, iova, access); | |
3385 | ||
3386 | ibv_dereg_mr(mr); | |
3387 | ||
3388 | return 0; | |
3389 | } | |
3390 | EOF | |
3391 | if ! compile_prog "" "-libverbs"; then | |
3392 | QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR" | |
3393 | fi | |
3394 | fi | |
3395 | ||
2f9606b3 AL |
3396 | ########################################## |
3397 | # VNC SASL detection | |
e633a5c6 | 3398 | if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then |
ea784e3b | 3399 | cat > $TMPC <<EOF |
2f9606b3 AL |
3400 | #include <sasl/sasl.h> |
3401 | #include <stdio.h> | |
3402 | int main(void) { sasl_server_init(NULL, "qemu"); return 0; } | |
3403 | EOF | |
ea784e3b | 3404 | # Assuming Cyrus-SASL installed in /usr prefix |
bd702ffc PMD |
3405 | # QEMU defines struct iovec in "qemu/osdep.h", |
3406 | # we don't want libsasl to redefine it in <sasl/sasl.h>. | |
3407 | vnc_sasl_cflags="-DSTRUCT_IOVEC_DEFINED" | |
ea784e3b JQ |
3408 | vnc_sasl_libs="-lsasl2" |
3409 | if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then | |
3410 | vnc_sasl=yes | |
3411 | libs_softmmu="$vnc_sasl_libs $libs_softmmu" | |
ca273d58 | 3412 | QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags" |
ea784e3b JQ |
3413 | else |
3414 | if test "$vnc_sasl" = "yes" ; then | |
21684af0 | 3415 | feature_not_found "vnc-sasl" "Install Cyrus SASL devel" |
2f9606b3 | 3416 | fi |
ea784e3b JQ |
3417 | vnc_sasl=no |
3418 | fi | |
2f9606b3 AL |
3419 | fi |
3420 | ||
2f6f5c7a CC |
3421 | ########################################## |
3422 | # VNC JPEG detection | |
e633a5c6 | 3423 | if test "$vnc" = "yes" && test "$vnc_jpeg" != "no" ; then |
2f6f5c7a CC |
3424 | cat > $TMPC <<EOF |
3425 | #include <stdio.h> | |
3426 | #include <jpeglib.h> | |
3427 | int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } | |
3428 | EOF | |
3429 | vnc_jpeg_cflags="" | |
3430 | vnc_jpeg_libs="-ljpeg" | |
3431 | if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then | |
3432 | vnc_jpeg=yes | |
3433 | libs_softmmu="$vnc_jpeg_libs $libs_softmmu" | |
ca273d58 | 3434 | QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags" |
2f6f5c7a CC |
3435 | else |
3436 | if test "$vnc_jpeg" = "yes" ; then | |
21684af0 | 3437 | feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel" |
2f6f5c7a CC |
3438 | fi |
3439 | vnc_jpeg=no | |
3440 | fi | |
3441 | fi | |
3442 | ||
efe556ad CC |
3443 | ########################################## |
3444 | # VNC PNG detection | |
e633a5c6 | 3445 | if test "$vnc" = "yes" && test "$vnc_png" != "no" ; then |
efe556ad CC |
3446 | cat > $TMPC <<EOF |
3447 | //#include <stdio.h> | |
3448 | #include <png.h> | |
832ce9c2 | 3449 | #include <stddef.h> |
efe556ad CC |
3450 | int main(void) { |
3451 | png_structp png_ptr; | |
3452 | png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); | |
7edc3fed | 3453 | return png_ptr != 0; |
efe556ad CC |
3454 | } |
3455 | EOF | |
65d5d3f9 | 3456 | if $pkg_config libpng --exists; then |
89138857 SW |
3457 | vnc_png_cflags=$($pkg_config libpng --cflags) |
3458 | vnc_png_libs=$($pkg_config libpng --libs) | |
9af8025e | 3459 | else |
efe556ad CC |
3460 | vnc_png_cflags="" |
3461 | vnc_png_libs="-lpng" | |
9af8025e | 3462 | fi |
efe556ad CC |
3463 | if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then |
3464 | vnc_png=yes | |
3465 | libs_softmmu="$vnc_png_libs $libs_softmmu" | |
9af8025e | 3466 | QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" |
efe556ad CC |
3467 | else |
3468 | if test "$vnc_png" = "yes" ; then | |
21684af0 | 3469 | feature_not_found "vnc-png" "Install libpng devel" |
efe556ad CC |
3470 | fi |
3471 | vnc_png=no | |
3472 | fi | |
3473 | fi | |
3474 | ||
6a021536 GH |
3475 | ########################################## |
3476 | # xkbcommon probe | |
3477 | if test "$xkbcommon" != "no" ; then | |
3478 | if $pkg_config xkbcommon --exists; then | |
3479 | xkbcommon_cflags=$($pkg_config xkbcommon --cflags) | |
3480 | xkbcommon_libs=$($pkg_config xkbcommon --libs) | |
3481 | xkbcommon=yes | |
3482 | else | |
3483 | if test "$xkbcommon" = "yes" ; then | |
3484 | feature_not_found "xkbcommon" "Install libxkbcommon-devel" | |
3485 | fi | |
3486 | xkbcommon=no | |
3487 | fi | |
3488 | fi | |
3489 | ||
76655d6d | 3490 | |
ee682d27 | 3491 | ########################################## |
c1bb86cd | 3492 | # xfsctl() probe, used for file-posix.c |
dce512de CH |
3493 | if test "$xfs" != "no" ; then |
3494 | cat > $TMPC << EOF | |
ffc41d10 | 3495 | #include <stddef.h> /* NULL */ |
dce512de CH |
3496 | #include <xfs/xfs.h> |
3497 | int main(void) | |
3498 | { | |
3499 | xfsctl(NULL, 0, 0, NULL); | |
3500 | return 0; | |
3501 | } | |
3502 | EOF | |
3503 | if compile_prog "" "" ; then | |
3504 | xfs="yes" | |
3505 | else | |
3506 | if test "$xfs" = "yes" ; then | |
21684af0 | 3507 | feature_not_found "xfs" "Instal xfsprogs/xfslibs devel" |
dce512de CH |
3508 | fi |
3509 | xfs=no | |
3510 | fi | |
3511 | fi | |
3512 | ||
8a16d273 TS |
3513 | ########################################## |
3514 | # vde libraries probe | |
dfb278bd | 3515 | if test "$vde" != "no" ; then |
4baae0ac | 3516 | vde_libs="-lvdeplug" |
8a16d273 TS |
3517 | cat > $TMPC << EOF |
3518 | #include <libvdeplug.h> | |
4a7f0e06 PB |
3519 | int main(void) |
3520 | { | |
3521 | struct vde_open_args a = {0, 0, 0}; | |
fea08e08 PM |
3522 | char s[] = ""; |
3523 | vde_open(s, s, &a); | |
4a7f0e06 PB |
3524 | return 0; |
3525 | } | |
8a16d273 | 3526 | EOF |
52166aa0 | 3527 | if compile_prog "" "$vde_libs" ; then |
4baae0ac | 3528 | vde=yes |
dfb278bd JQ |
3529 | else |
3530 | if test "$vde" = "yes" ; then | |
21684af0 | 3531 | feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" |
dfb278bd JQ |
3532 | fi |
3533 | vde=no | |
4baae0ac | 3534 | fi |
8a16d273 TS |
3535 | fi |
3536 | ||
58952137 | 3537 | ########################################## |
0a985b37 VM |
3538 | # netmap support probe |
3539 | # Apart from looking for netmap headers, we make sure that the host API version | |
3540 | # supports the netmap backend (>=11). The upper bound (15) is meant to simulate | |
3541 | # a minor/major version number. Minor new features will be marked with values up | |
3542 | # to 15, and if something happens that requires a change to the backend we will | |
3543 | # move above 15, submit the backend fixes and modify this two bounds. | |
58952137 VM |
3544 | if test "$netmap" != "no" ; then |
3545 | cat > $TMPC << EOF | |
3546 | #include <inttypes.h> | |
3547 | #include <net/if.h> | |
3548 | #include <net/netmap.h> | |
3549 | #include <net/netmap_user.h> | |
0a985b37 VM |
3550 | #if (NETMAP_API < 11) || (NETMAP_API > 15) |
3551 | #error | |
3552 | #endif | |
58952137 VM |
3553 | int main(void) { return 0; } |
3554 | EOF | |
3555 | if compile_prog "" "" ; then | |
3556 | netmap=yes | |
3557 | else | |
3558 | if test "$netmap" = "yes" ; then | |
3559 | feature_not_found "netmap" | |
3560 | fi | |
3561 | netmap=no | |
3562 | fi | |
3563 | fi | |
3564 | ||
47e98658 CB |
3565 | ########################################## |
3566 | # libcap-ng library probe | |
3567 | if test "$cap_ng" != "no" ; then | |
3568 | cap_libs="-lcap-ng" | |
3569 | cat > $TMPC << EOF | |
3570 | #include <cap-ng.h> | |
3571 | int main(void) | |
3572 | { | |
3573 | capng_capability_to_name(CAPNG_EFFECTIVE); | |
3574 | return 0; | |
3575 | } | |
3576 | EOF | |
3577 | if compile_prog "" "$cap_libs" ; then | |
3578 | cap_ng=yes | |
3579 | libs_tools="$cap_libs $libs_tools" | |
3580 | else | |
3581 | if test "$cap_ng" = "yes" ; then | |
21684af0 | 3582 | feature_not_found "cap_ng" "Install libcap-ng devel" |
47e98658 CB |
3583 | fi |
3584 | cap_ng=no | |
3585 | fi | |
3586 | fi | |
3587 | ||
8f28f3fb | 3588 | ########################################## |
c2de5c91 | 3589 | # Sound support libraries probe |
8f28f3fb | 3590 | |
89138857 | 3591 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g') |
c2de5c91 | 3592 | for drv in $audio_drv_list; do |
3593 | case $drv in | |
e42975a1 | 3594 | alsa | try-alsa) |
c80a867f GH |
3595 | if $pkg_config alsa --exists; then |
3596 | alsa_libs=$($pkg_config alsa --libs) | |
e42975a1 GH |
3597 | if test "$drv" = "try-alsa"; then |
3598 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/') | |
3599 | fi | |
c80a867f | 3600 | else |
e42975a1 GH |
3601 | if test "$drv" = "try-alsa"; then |
3602 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa//') | |
3603 | else | |
3604 | error_exit "$drv check failed" \ | |
3605 | "Make sure to have the $drv libs and headers installed." | |
3606 | fi | |
c80a867f | 3607 | fi |
c2de5c91 | 3608 | ;; |
3609 | ||
e42975a1 | 3610 | pa | try-pa) |
c80a867f GH |
3611 | if $pkg_config libpulse --exists; then |
3612 | pulse_libs=$($pkg_config libpulse --libs) | |
e42975a1 GH |
3613 | if test "$drv" = "try-pa"; then |
3614 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/') | |
3615 | fi | |
c80a867f | 3616 | else |
e42975a1 GH |
3617 | if test "$drv" = "try-pa"; then |
3618 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa//') | |
3619 | else | |
3620 | error_exit "$drv check failed" \ | |
3621 | "Make sure to have the $drv libs and headers installed." | |
3622 | fi | |
c80a867f | 3623 | fi |
b8e59f18 | 3624 | ;; |
3625 | ||
373967b2 GH |
3626 | sdl) |
3627 | if test "$sdl" = "no"; then | |
3628 | error_exit "sdl not found or disabled, can not use sdl audio driver" | |
3629 | fi | |
3630 | ;; | |
3631 | ||
e42975a1 GH |
3632 | try-sdl) |
3633 | if test "$sdl" = "no"; then | |
3634 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl//') | |
3635 | else | |
3636 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl/sdl/') | |
3637 | fi | |
3638 | ;; | |
3639 | ||
997e690a | 3640 | coreaudio) |
b1149911 | 3641 | coreaudio_libs="-framework CoreAudio" |
997e690a JQ |
3642 | ;; |
3643 | ||
a4bf6780 | 3644 | dsound) |
b1149911 | 3645 | dsound_libs="-lole32 -ldxguid" |
d5631638 | 3646 | audio_win_int="yes" |
a4bf6780 JQ |
3647 | ;; |
3648 | ||
3649 | oss) | |
b1149911 | 3650 | oss_libs="$oss_lib" |
a4bf6780 JQ |
3651 | ;; |
3652 | ||
2e445703 GM |
3653 | jack | try-jack) |
3654 | if $pkg_config jack --exists; then | |
3655 | jack_libs=$($pkg_config jack --libs) | |
3656 | if test "$drv" = "try-jack"; then | |
3657 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack/jack/') | |
3658 | fi | |
3659 | else | |
3660 | if test "$drv" = "try-jack"; then | |
3661 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack//') | |
3662 | else | |
3663 | error_exit "$drv check failed" \ | |
3664 | "Make sure to have the $drv libs and headers installed." | |
3665 | fi | |
3666 | fi | |
3667 | ;; | |
3668 | ||
e4c63a6a | 3669 | *) |
1c9b2a52 | 3670 | echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { |
76ad07a4 PM |
3671 | error_exit "Unknown driver '$drv' selected" \ |
3672 | "Possible drivers are: $audio_possible_drivers" | |
e4c63a6a | 3673 | } |
3674 | ;; | |
c2de5c91 | 3675 | esac |
3676 | done | |
8f28f3fb | 3677 | |
2e4d9fb1 AJ |
3678 | ########################################## |
3679 | # BrlAPI probe | |
3680 | ||
4ffcedb6 | 3681 | if test "$brlapi" != "no" ; then |
eb82284f JQ |
3682 | brlapi_libs="-lbrlapi" |
3683 | cat > $TMPC << EOF | |
2e4d9fb1 | 3684 | #include <brlapi.h> |
832ce9c2 | 3685 | #include <stddef.h> |
2e4d9fb1 AJ |
3686 | int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } |
3687 | EOF | |
52166aa0 | 3688 | if compile_prog "" "$brlapi_libs" ; then |
eb82284f | 3689 | brlapi=yes |
4ffcedb6 JQ |
3690 | else |
3691 | if test "$brlapi" = "yes" ; then | |
21684af0 | 3692 | feature_not_found "brlapi" "Install brlapi devel" |
4ffcedb6 JQ |
3693 | fi |
3694 | brlapi=no | |
eb82284f JQ |
3695 | fi |
3696 | fi | |
2e4d9fb1 | 3697 | |
e08bb301 ST |
3698 | ########################################## |
3699 | # iconv probe | |
3700 | if test "$iconv" != "no" ; then | |
3701 | cat > $TMPC << EOF | |
3702 | #include <iconv.h> | |
3703 | int main(void) { | |
3704 | iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); | |
3705 | return conv != (iconv_t) -1; | |
3706 | } | |
3707 | EOF | |
3708 | iconv_prefix_list="/usr/local:/usr" | |
3709 | iconv_lib_list=":-liconv" | |
3710 | IFS=: | |
3711 | for iconv_prefix in $iconv_prefix_list; do | |
3712 | IFS=: | |
3713 | iconv_cflags="-I$iconv_prefix/include" | |
3714 | iconv_ldflags="-L$iconv_prefix/lib" | |
3715 | for iconv_link in $iconv_lib_list; do | |
3716 | unset IFS | |
3717 | iconv_lib="$iconv_ldflags $iconv_link" | |
3718 | echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log | |
3719 | if compile_prog "$iconv_cflags" "$iconv_lib" ; then | |
3720 | iconv_found=yes | |
3721 | break | |
3722 | fi | |
3723 | done | |
3724 | if test "$iconv_found" = yes ; then | |
3725 | break | |
3726 | fi | |
3727 | done | |
3728 | if test "$iconv_found" = "yes" ; then | |
3729 | iconv=yes | |
3730 | else | |
3731 | if test "$iconv" = "yes" ; then | |
3732 | feature_not_found "iconv" "Install iconv devel" | |
3733 | fi | |
3734 | iconv=no | |
3735 | fi | |
3736 | fi | |
3737 | ||
4d3b6f6e AZ |
3738 | ########################################## |
3739 | # curses probe | |
e08bb301 ST |
3740 | if test "$iconv" = "no" ; then |
3741 | # curses will need iconv | |
3742 | curses=no | |
3743 | fi | |
a3605bf6 MT |
3744 | if test "$curses" != "no" ; then |
3745 | if test "$mingw32" = "yes" ; then | |
8ddc5bf9 ST |
3746 | curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" |
3747 | curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses" | |
a3605bf6 | 3748 | else |
7c703002 | 3749 | curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" |
8ddc5bf9 | 3750 | curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw" |
a3605bf6 | 3751 | fi |
c584a6d0 | 3752 | curses_found=no |
4d3b6f6e | 3753 | cat > $TMPC << EOF |
8ddc5bf9 | 3754 | #include <locale.h> |
4d3b6f6e | 3755 | #include <curses.h> |
8ddc5bf9 | 3756 | #include <wchar.h> |
2f8b7cd5 | 3757 | #include <langinfo.h> |
ef9a2524 | 3758 | int main(void) { |
2f8b7cd5 | 3759 | const char *codeset; |
8ddc5bf9 ST |
3760 | wchar_t wch = L'w'; |
3761 | setlocale(LC_ALL, ""); | |
ef9a2524 | 3762 | resize_term(0, 0); |
8ddc5bf9 ST |
3763 | addwstr(L"wide chars\n"); |
3764 | addnwstr(&wch, 1); | |
7c703002 | 3765 | add_wch(WACS_DEGREE); |
2f8b7cd5 ST |
3766 | codeset = nl_langinfo(CODESET); |
3767 | return codeset != 0; | |
ef9a2524 | 3768 | } |
4d3b6f6e | 3769 | EOF |
ecbe251f | 3770 | IFS=: |
8ddc5bf9 | 3771 | for curses_inc in $curses_inc_list; do |
b01a4fd3 PM |
3772 | # Make sure we get the wide character prototypes |
3773 | curses_inc="-DNCURSES_WIDECHAR $curses_inc" | |
7c703002 | 3774 | IFS=: |
8ddc5bf9 ST |
3775 | for curses_lib in $curses_lib_list; do |
3776 | unset IFS | |
3777 | if compile_prog "$curses_inc" "$curses_lib" ; then | |
3778 | curses_found=yes | |
8ddc5bf9 ST |
3779 | break |
3780 | fi | |
3781 | done | |
7c703002 ST |
3782 | if test "$curses_found" = yes ; then |
3783 | break | |
3784 | fi | |
4f78ef9a | 3785 | done |
ecbe251f | 3786 | unset IFS |
c584a6d0 JQ |
3787 | if test "$curses_found" = "yes" ; then |
3788 | curses=yes | |
3789 | else | |
3790 | if test "$curses" = "yes" ; then | |
21684af0 | 3791 | feature_not_found "curses" "Install ncurses devel" |
c584a6d0 JQ |
3792 | fi |
3793 | curses=no | |
3794 | fi | |
4f78ef9a | 3795 | fi |
4d3b6f6e | 3796 | |
769ce76d AG |
3797 | ########################################## |
3798 | # curl probe | |
788c8196 | 3799 | if test "$curl" != "no" ; then |
65d5d3f9 | 3800 | if $pkg_config libcurl --exists; then |
a3605bf6 MT |
3801 | curlconfig="$pkg_config libcurl" |
3802 | else | |
3803 | curlconfig=curl-config | |
3804 | fi | |
769ce76d AG |
3805 | cat > $TMPC << EOF |
3806 | #include <curl/curl.h> | |
0b862ced | 3807 | int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } |
769ce76d | 3808 | EOF |
89138857 SW |
3809 | curl_cflags=$($curlconfig --cflags 2>/dev/null) |
3810 | curl_libs=$($curlconfig --libs 2>/dev/null) | |
b1d5a277 | 3811 | if compile_prog "$curl_cflags" "$curl_libs" ; then |
769ce76d | 3812 | curl=yes |
788c8196 JQ |
3813 | else |
3814 | if test "$curl" = "yes" ; then | |
21684af0 | 3815 | feature_not_found "curl" "Install libcurl devel" |
788c8196 JQ |
3816 | fi |
3817 | curl=no | |
769ce76d AG |
3818 | fi |
3819 | fi # test "$curl" | |
3820 | ||
e18df141 AL |
3821 | ########################################## |
3822 | # glib support probe | |
a52d28af | 3823 | |
00f2cfbb | 3824 | glib_req_ver=2.48 |
aa0d1f44 PB |
3825 | glib_modules=gthread-2.0 |
3826 | if test "$modules" = yes; then | |
a88afc64 | 3827 | glib_modules="$glib_modules gmodule-export-2.0" |
aa0d1f44 | 3828 | fi |
54cb65d8 EC |
3829 | if test "$plugins" = yes; then |
3830 | glib_modules="$glib_modules gmodule-2.0" | |
3831 | fi | |
e26110cf | 3832 | |
4eaf7202 SJ |
3833 | # This workaround is required due to a bug in pkg-config file for glib as it |
3834 | # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static | |
3835 | ||
e633a5c6 | 3836 | if test "$static" = yes && test "$mingw32" = yes; then |
4eaf7202 SJ |
3837 | QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS" |
3838 | fi | |
3839 | ||
aa0d1f44 | 3840 | for i in $glib_modules; do |
e26110cf | 3841 | if $pkg_config --atleast-version=$glib_req_ver $i; then |
89138857 SW |
3842 | glib_cflags=$($pkg_config --cflags $i) |
3843 | glib_libs=$($pkg_config --libs $i) | |
4a058899 | 3844 | QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS" |
e26110cf FZ |
3845 | LIBS="$glib_libs $LIBS" |
3846 | libs_qga="$glib_libs $libs_qga" | |
3847 | else | |
3848 | error_exit "glib-$glib_req_ver $i is required to compile QEMU" | |
3849 | fi | |
3850 | done | |
3851 | ||
f876b765 MAL |
3852 | if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then |
3853 | gio=yes | |
3854 | gio_cflags=$($pkg_config --cflags gio-2.0) | |
3855 | gio_libs=$($pkg_config --libs gio-2.0) | |
25a97a56 | 3856 | gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) |
0dba4897 MAL |
3857 | if [ ! -x "$gdbus_codegen" ]; then |
3858 | gdbus_codegen= | |
3859 | fi | |
f876b765 MAL |
3860 | else |
3861 | gio=no | |
3862 | fi | |
3863 | ||
25a97a56 MAL |
3864 | if $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then |
3865 | gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)" | |
3866 | gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)" | |
3867 | fi | |
3868 | ||
977a82ab DB |
3869 | # Sanity check that the current size_t matches the |
3870 | # size that glib thinks it should be. This catches | |
3871 | # problems on multi-arch where people try to build | |
3872 | # 32-bit QEMU while pointing at 64-bit glib headers | |
3873 | cat > $TMPC <<EOF | |
3874 | #include <glib.h> | |
3875 | #include <unistd.h> | |
3876 | ||
3877 | #define QEMU_BUILD_BUG_ON(x) \ | |
3878 | typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); | |
3879 | ||
3880 | int main(void) { | |
3881 | QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); | |
3882 | return 0; | |
3883 | } | |
3884 | EOF | |
3885 | ||
5919e032 | 3886 | if ! compile_prog "$CFLAGS" "$LIBS" ; then |
977a82ab DB |
3887 | error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ |
3888 | "You probably need to set PKG_CONFIG_LIBDIR"\ | |
3889 | "to point to the right pkg-config files for your"\ | |
3890 | "build target" | |
3891 | fi | |
3892 | ||
bbbf2e04 JS |
3893 | # Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage |
3894 | cat > $TMPC << EOF | |
3895 | #include <glib.h> | |
3896 | int main(void) { return 0; } | |
3897 | EOF | |
3898 | if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then | |
3899 | if cc_has_warning_flag "-Wno-unknown-attributes"; then | |
3900 | glib_cflags="-Wno-unknown-attributes $glib_cflags" | |
3901 | CFLAGS="-Wno-unknown-attributes $CFLAGS" | |
3902 | fi | |
3903 | fi | |
3904 | ||
9bda600b EB |
3905 | # Silence clang warnings triggered by glib < 2.57.2 |
3906 | cat > $TMPC << EOF | |
3907 | #include <glib.h> | |
3908 | typedef struct Foo { | |
3909 | int i; | |
3910 | } Foo; | |
3911 | static void foo_free(Foo *f) | |
3912 | { | |
3913 | g_free(f); | |
3914 | } | |
3915 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free); | |
3916 | int main(void) { return 0; } | |
3917 | EOF | |
3918 | if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then | |
3919 | if cc_has_warning_flag "-Wno-unused-function"; then | |
3920 | glib_cflags="$glib_cflags -Wno-unused-function" | |
3921 | CFLAGS="$CFLAGS -Wno-unused-function" | |
3922 | fi | |
3923 | fi | |
3924 | ||
6a1f42bd SW |
3925 | ######################################### |
3926 | # zlib check | |
3927 | ||
3928 | if test "$zlib" != "no" ; then | |
3929 | if $pkg_config --exists zlib; then | |
3930 | zlib_cflags=$($pkg_config --cflags zlib) | |
3931 | zlib_libs=$($pkg_config --libs zlib) | |
3932 | QEMU_CFLAGS="$zlib_cflags $QEMU_CFLAGS" | |
3933 | LIBS="$zlib_libs $LIBS" | |
3934 | else | |
3935 | cat > $TMPC << EOF | |
3936 | #include <zlib.h> | |
3937 | int main(void) { zlibVersion(); return 0; } | |
3938 | EOF | |
3939 | if compile_prog "" "-lz" ; then | |
3940 | LIBS="$LIBS -lz" | |
3941 | else | |
3942 | error_exit "zlib check failed" \ | |
3943 | "Make sure to have the zlib libs and headers installed." | |
3944 | fi | |
3945 | fi | |
3946 | fi | |
3947 | ||
e26110cf FZ |
3948 | ########################################## |
3949 | # SHA command probe for modules | |
3950 | if test "$modules" = yes; then | |
3951 | shacmd_probe="sha1sum sha1 shasum" | |
3952 | for c in $shacmd_probe; do | |
8ccefb91 | 3953 | if has $c; then |
e26110cf FZ |
3954 | shacmd="$c" |
3955 | break | |
3956 | fi | |
3957 | done | |
3958 | if test "$shacmd" = ""; then | |
3959 | error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" | |
3960 | fi | |
e18df141 AL |
3961 | fi |
3962 | ||
e2134eb9 GH |
3963 | ########################################## |
3964 | # pixman support probe | |
3965 | ||
e633a5c6 | 3966 | if test "$want_tools" = "no" && test "$softmmu" = "no"; then |
74880fe2 RS |
3967 | pixman_cflags= |
3968 | pixman_libs= | |
35c4e86c | 3969 | elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then |
89138857 SW |
3970 | pixman_cflags=$($pkg_config --cflags pixman-1) |
3971 | pixman_libs=$($pkg_config --libs pixman-1) | |
e2134eb9 | 3972 | else |
c12b6d70 GH |
3973 | error_exit "pixman >= 0.21.8 not present." \ |
3974 | "Please install the pixman devel package." | |
e2134eb9 | 3975 | fi |
e2134eb9 | 3976 | |
fe8fc5ae PB |
3977 | ########################################## |
3978 | # libmpathpersist probe | |
3979 | ||
3980 | if test "$mpath" != "no" ; then | |
1b0578f5 | 3981 | # probe for the new API |
fe8fc5ae PB |
3982 | cat > $TMPC <<EOF |
3983 | #include <libudev.h> | |
3984 | #include <mpath_persist.h> | |
3985 | unsigned mpath_mx_alloc_len = 1024; | |
3986 | int logsink; | |
b3f1c8c4 PB |
3987 | static struct config *multipath_conf; |
3988 | extern struct udev *udev; | |
3989 | extern struct config *get_multipath_config(void); | |
3990 | extern void put_multipath_config(struct config *conf); | |
3991 | struct udev *udev; | |
3992 | struct config *get_multipath_config(void) { return multipath_conf; } | |
3993 | void put_multipath_config(struct config *conf) { } | |
3994 | ||
fe8fc5ae | 3995 | int main(void) { |
b3f1c8c4 PB |
3996 | udev = udev_new(); |
3997 | multipath_conf = mpath_lib_init(); | |
fe8fc5ae PB |
3998 | return 0; |
3999 | } | |
4000 | EOF | |
4001 | if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then | |
4002 | mpathpersist=yes | |
1b0578f5 | 4003 | mpathpersist_new_api=yes |
fe8fc5ae | 4004 | else |
1b0578f5 MOA |
4005 | # probe for the old API |
4006 | cat > $TMPC <<EOF | |
4007 | #include <libudev.h> | |
4008 | #include <mpath_persist.h> | |
4009 | unsigned mpath_mx_alloc_len = 1024; | |
4010 | int logsink; | |
4011 | int main(void) { | |
4012 | struct udev *udev = udev_new(); | |
4013 | mpath_lib_init(udev); | |
4014 | return 0; | |
4015 | } | |
4016 | EOF | |
4017 | if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then | |
4018 | mpathpersist=yes | |
4019 | mpathpersist_new_api=no | |
4020 | else | |
4021 | mpathpersist=no | |
4022 | fi | |
fe8fc5ae PB |
4023 | fi |
4024 | else | |
4025 | mpathpersist=no | |
4026 | fi | |
4027 | ||
414f0dab | 4028 | ########################################## |
e5d355d1 | 4029 | # pthread probe |
4b29ec41 | 4030 | PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" |
3c529d93 | 4031 | |
4dd75c70 | 4032 | pthread=no |
e5d355d1 | 4033 | cat > $TMPC << EOF |
3c529d93 | 4034 | #include <pthread.h> |
7a42bbe4 SW |
4035 | static void *f(void *p) { return NULL; } |
4036 | int main(void) { | |
4037 | pthread_t thread; | |
4038 | pthread_create(&thread, 0, f, 0); | |
4039 | return 0; | |
4040 | } | |
414f0dab | 4041 | EOF |
bd00d539 AF |
4042 | if compile_prog "" "" ; then |
4043 | pthread=yes | |
4044 | else | |
4045 | for pthread_lib in $PTHREADLIBS_LIST; do | |
4046 | if compile_prog "" "$pthread_lib" ; then | |
4047 | pthread=yes | |
e3c56761 PP |
4048 | found=no |
4049 | for lib_entry in $LIBS; do | |
4050 | if test "$lib_entry" = "$pthread_lib"; then | |
4051 | found=yes | |
4052 | break | |
4053 | fi | |
4054 | done | |
4055 | if test "$found" = "no"; then | |
4056 | LIBS="$pthread_lib $LIBS" | |
14ab3aa7 | 4057 | libs_qga="$pthread_lib $libs_qga" |
e3c56761 | 4058 | fi |
409437e1 | 4059 | PTHREAD_LIB="$pthread_lib" |
bd00d539 AF |
4060 | break |
4061 | fi | |
4062 | done | |
4063 | fi | |
414f0dab | 4064 | |
e633a5c6 | 4065 | if test "$mingw32" != yes && test "$pthread" = no; then |
76ad07a4 PM |
4066 | error_exit "pthread check failed" \ |
4067 | "Make sure to have the pthread libs and headers installed." | |
e5d355d1 AL |
4068 | fi |
4069 | ||
479a5747 RB |
4070 | # check for pthread_setname_np with thread id |
4071 | pthread_setname_np_w_tid=no | |
5c312079 DDAG |
4072 | cat > $TMPC << EOF |
4073 | #include <pthread.h> | |
4074 | ||
4075 | static void *f(void *p) { return NULL; } | |
4076 | int main(void) | |
4077 | { | |
4078 | pthread_t thread; | |
4079 | pthread_create(&thread, 0, f, 0); | |
4080 | pthread_setname_np(thread, "QEMU"); | |
4081 | return 0; | |
4082 | } | |
4083 | EOF | |
4084 | if compile_prog "" "$pthread_lib" ; then | |
479a5747 RB |
4085 | pthread_setname_np_w_tid=yes |
4086 | fi | |
4087 | ||
4088 | # check for pthread_setname_np without thread id | |
4089 | pthread_setname_np_wo_tid=no | |
4090 | cat > $TMPC << EOF | |
4091 | #include <pthread.h> | |
4092 | ||
4093 | static void *f(void *p) { pthread_setname_np("QEMU"); } | |
4094 | int main(void) | |
4095 | { | |
4096 | pthread_t thread; | |
4097 | pthread_create(&thread, 0, f, 0); | |
4098 | return 0; | |
4099 | } | |
4100 | EOF | |
4101 | if compile_prog "" "$pthread_lib" ; then | |
4102 | pthread_setname_np_wo_tid=yes | |
5c312079 DDAG |
4103 | fi |
4104 | ||
f27aaf4b CB |
4105 | ########################################## |
4106 | # rbd probe | |
4107 | if test "$rbd" != "no" ; then | |
4108 | cat > $TMPC <<EOF | |
4109 | #include <stdio.h> | |
ad32e9c0 | 4110 | #include <rbd/librbd.h> |
f27aaf4b | 4111 | int main(void) { |
ad32e9c0 JD |
4112 | rados_t cluster; |
4113 | rados_create(&cluster, NULL); | |
f27aaf4b CB |
4114 | return 0; |
4115 | } | |
4116 | EOF | |
ad32e9c0 JD |
4117 | rbd_libs="-lrbd -lrados" |
4118 | if compile_prog "" "$rbd_libs" ; then | |
4119 | rbd=yes | |
f27aaf4b CB |
4120 | else |
4121 | if test "$rbd" = "yes" ; then | |
21684af0 | 4122 | feature_not_found "rados block device" "Install librbd/ceph devel" |
f27aaf4b CB |
4123 | fi |
4124 | rbd=no | |
4125 | fi | |
f27aaf4b CB |
4126 | fi |
4127 | ||
0a12ec87 | 4128 | ########################################## |
b10d49d7 PT |
4129 | # libssh probe |
4130 | if test "$libssh" != "no" ; then | |
4131 | if $pkg_config --exists libssh; then | |
4132 | libssh_cflags=$($pkg_config libssh --cflags) | |
4133 | libssh_libs=$($pkg_config libssh --libs) | |
4134 | libssh=yes | |
0a12ec87 | 4135 | else |
b10d49d7 PT |
4136 | if test "$libssh" = "yes" ; then |
4137 | error_exit "libssh required for --enable-libssh" | |
0a12ec87 | 4138 | fi |
b10d49d7 | 4139 | libssh=no |
0a12ec87 RJ |
4140 | fi |
4141 | fi | |
4142 | ||
9a2d462e | 4143 | ########################################## |
b10d49d7 PT |
4144 | # Check for libssh 0.8 |
4145 | # This is done like this instead of using the LIBSSH_VERSION_* and | |
4146 | # SSH_VERSION_* macros because some distributions in the past shipped | |
4147 | # snapshots of the future 0.8 from Git, and those snapshots did not | |
4148 | # have updated version numbers (still referring to 0.7.0). | |
9a2d462e | 4149 | |
b10d49d7 | 4150 | if test "$libssh" = "yes"; then |
9a2d462e | 4151 | cat > $TMPC <<EOF |
b10d49d7 PT |
4152 | #include <libssh/libssh.h> |
4153 | int main(void) { return ssh_get_server_publickey(NULL, NULL); } | |
9a2d462e | 4154 | EOF |
b10d49d7 PT |
4155 | if compile_prog "$libssh_cflags" "$libssh_libs"; then |
4156 | libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags" | |
9a2d462e RJ |
4157 | fi |
4158 | fi | |
4159 | ||
5c6c3a6c CH |
4160 | ########################################## |
4161 | # linux-aio probe | |
5c6c3a6c CH |
4162 | |
4163 | if test "$linux_aio" != "no" ; then | |
4164 | cat > $TMPC <<EOF | |
4165 | #include <libaio.h> | |
4166 | #include <sys/eventfd.h> | |
832ce9c2 | 4167 | #include <stddef.h> |
5c6c3a6c CH |
4168 | int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } |
4169 | EOF | |
4170 | if compile_prog "" "-laio" ; then | |
4171 | linux_aio=yes | |
5c6c3a6c CH |
4172 | else |
4173 | if test "$linux_aio" = "yes" ; then | |
21684af0 | 4174 | feature_not_found "linux AIO" "Install libaio devel" |
5c6c3a6c | 4175 | fi |
3cfcae3c | 4176 | linux_aio=no |
5c6c3a6c CH |
4177 | fi |
4178 | fi | |
c10dd856 AM |
4179 | ########################################## |
4180 | # linux-io-uring probe | |
4181 | ||
4182 | if test "$linux_io_uring" != "no" ; then | |
4183 | if $pkg_config liburing; then | |
4184 | linux_io_uring_cflags=$($pkg_config --cflags liburing) | |
4185 | linux_io_uring_libs=$($pkg_config --libs liburing) | |
4186 | linux_io_uring=yes | |
73fd282e SH |
4187 | |
4188 | # io_uring is used in libqemuutil.a where per-file -libs variables are not | |
4189 | # seen by programs linking the archive. It's not ideal, but just add the | |
4190 | # library dependency globally. | |
4191 | LIBS="$linux_io_uring_libs $LIBS" | |
c10dd856 AM |
4192 | else |
4193 | if test "$linux_io_uring" = "yes" ; then | |
4194 | feature_not_found "linux io_uring" "Install liburing devel" | |
4195 | fi | |
4196 | linux_io_uring=no | |
4197 | fi | |
4198 | fi | |
5c6c3a6c | 4199 | |
3b8acc11 | 4200 | ########################################## |
7aaa6a16 | 4201 | # TPM emulation is only on POSIX |
3b8acc11 | 4202 | |
7aaa6a16 PB |
4203 | if test "$tpm" = ""; then |
4204 | if test "$mingw32" = "yes"; then | |
4205 | tpm=no | |
4206 | else | |
4207 | tpm=yes | |
4208 | fi | |
4209 | elif test "$tpm" = "yes"; then | |
4210 | if test "$mingw32" = "yes" ; then | |
4211 | error_exit "TPM emulation only available on POSIX systems" | |
4212 | fi | |
3b8acc11 PB |
4213 | fi |
4214 | ||
758e8e38 VJ |
4215 | ########################################## |
4216 | # attr probe | |
4217 | ||
4218 | if test "$attr" != "no" ; then | |
4219 | cat > $TMPC <<EOF | |
4220 | #include <stdio.h> | |
4221 | #include <sys/types.h> | |
f2338fb4 PB |
4222 | #ifdef CONFIG_LIBATTR |
4223 | #include <attr/xattr.h> | |
4224 | #else | |
4f26f2b6 | 4225 | #include <sys/xattr.h> |
f2338fb4 | 4226 | #endif |
758e8e38 VJ |
4227 | int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } |
4228 | EOF | |
4f26f2b6 AK |
4229 | if compile_prog "" "" ; then |
4230 | attr=yes | |
4231 | # Older distros have <attr/xattr.h>, and need -lattr: | |
f2338fb4 | 4232 | elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then |
758e8e38 VJ |
4233 | attr=yes |
4234 | LIBS="-lattr $LIBS" | |
4f26f2b6 | 4235 | libattr=yes |
758e8e38 VJ |
4236 | else |
4237 | if test "$attr" = "yes" ; then | |
21684af0 | 4238 | feature_not_found "ATTR" "Install libc6 or libattr devel" |
758e8e38 VJ |
4239 | fi |
4240 | attr=no | |
4241 | fi | |
4242 | fi | |
4243 | ||
bf9298b9 AL |
4244 | ########################################## |
4245 | # iovec probe | |
4246 | cat > $TMPC <<EOF | |
db34f0b3 | 4247 | #include <sys/types.h> |
bf9298b9 | 4248 | #include <sys/uio.h> |
db34f0b3 | 4249 | #include <unistd.h> |
f91f9bee | 4250 | int main(void) { return sizeof(struct iovec); } |
bf9298b9 AL |
4251 | EOF |
4252 | iovec=no | |
52166aa0 | 4253 | if compile_prog "" "" ; then |
bf9298b9 AL |
4254 | iovec=yes |
4255 | fi | |
4256 | ||
ceb42de8 AL |
4257 | ########################################## |
4258 | # preadv probe | |
4259 | cat > $TMPC <<EOF | |
4260 | #include <sys/types.h> | |
4261 | #include <sys/uio.h> | |
4262 | #include <unistd.h> | |
c075a723 | 4263 | int main(void) { return preadv(0, 0, 0, 0); } |
ceb42de8 AL |
4264 | EOF |
4265 | preadv=no | |
52166aa0 | 4266 | if compile_prog "" "" ; then |
ceb42de8 AL |
4267 | preadv=yes |
4268 | fi | |
4269 | ||
f652e6af AJ |
4270 | ########################################## |
4271 | # fdt probe | |
e169e1e1 PM |
4272 | # fdt support is mandatory for at least some target architectures, |
4273 | # so insist on it if we're building those system emulators. | |
4274 | fdt_required=no | |
4275 | for target in $target_list; do | |
4276 | case $target in | |
c8c35e5f | 4277 | aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu|rx-softmmu) |
e169e1e1 PM |
4278 | fdt_required=yes |
4279 | ;; | |
4280 | esac | |
4281 | done | |
4282 | ||
4283 | if test "$fdt_required" = "yes"; then | |
4284 | if test "$fdt" = "no"; then | |
4285 | error_exit "fdt disabled but some requested targets require it." \ | |
4286 | "You can turn off fdt only if you also disable all the system emulation" \ | |
4287 | "targets which need it (by specifying a cut down --target-list)." | |
4288 | fi | |
4289 | fdt=yes | |
7ba4a4d3 PMD |
4290 | elif test "$fdt" != "yes" ; then |
4291 | fdt=no | |
e169e1e1 PM |
4292 | fi |
4293 | ||
d599938a LV |
4294 | # fdt is only required when building softmmu targets |
4295 | if test -z "$fdt" -a "$softmmu" != "yes" ; then | |
4296 | fdt="no" | |
4297 | fi | |
4298 | ||
2df87df7 | 4299 | if test "$fdt" != "no" ; then |
b41af4ba | 4300 | fdt_libs="-lfdt" |
96ce6545 | 4301 | # explicitly check for libfdt_env.h as it is missing in some stable installs |
6e85fce0 | 4302 | # and test for required functions to make sure we are on a version >= 1.4.2 |
b41af4ba | 4303 | cat > $TMPC << EOF |
31ce0adb | 4304 | #include <libfdt.h> |
96ce6545 | 4305 | #include <libfdt_env.h> |
fea35ca4 | 4306 | int main(void) { fdt_check_full(NULL, 0); return 0; } |
f652e6af | 4307 | EOF |
52166aa0 | 4308 | if compile_prog "" "$fdt_libs" ; then |
a540f158 | 4309 | # system DTC is good - use it |
e3971d61 | 4310 | fdt=system |
a540f158 | 4311 | else |
aef45d51 DB |
4312 | # have GIT checkout, so activate dtc submodule |
4313 | if test -e "${source_path}/.git" ; then | |
4314 | git_submodules="${git_submodules} dtc" | |
4315 | fi | |
4316 | if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then | |
e3971d61 | 4317 | fdt=git |
aef45d51 DB |
4318 | mkdir -p dtc |
4319 | if [ "$pwd_is_source_path" != "y" ] ; then | |
4320 | symlink "$source_path/dtc/Makefile" "dtc/Makefile" | |
aef45d51 DB |
4321 | fi |
4322 | fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt" | |
8a99e9a3 PMD |
4323 | fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt" |
4324 | fdt_libs="$fdt_libs" | |
aef45d51 DB |
4325 | elif test "$fdt" = "yes" ; then |
4326 | # Not a git build & no libfdt found, prompt for system install | |
4327 | error_exit "DTC (libfdt) version >= 1.4.2 not present." \ | |
4328 | "Please install the DTC (libfdt) devel package" | |
4329 | else | |
4330 | # don't have and don't want | |
4331 | fdt_libs= | |
4332 | fdt=no | |
4333 | fi | |
f652e6af AJ |
4334 | fi |
4335 | fi | |
4336 | ||
a540f158 PC |
4337 | libs_softmmu="$libs_softmmu $fdt_libs" |
4338 | ||
20ff075b | 4339 | ########################################## |
fb719563 | 4340 | # opengl probe (for sdl2, gtk, milkymist-tmu2) |
b1546f32 | 4341 | |
d52c454a MAL |
4342 | gbm="no" |
4343 | if $pkg_config gbm; then | |
4344 | gbm_cflags="$($pkg_config --cflags gbm)" | |
4345 | gbm_libs="$($pkg_config --libs gbm)" | |
4346 | gbm="yes" | |
4347 | fi | |
4348 | ||
da076ffe | 4349 | if test "$opengl" != "no" ; then |
4939a1df | 4350 | opengl_pkgs="epoxy gbm" |
5f9b1e35 GH |
4351 | if $pkg_config $opengl_pkgs; then |
4352 | opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" | |
4353 | opengl_libs="$($pkg_config --libs $opengl_pkgs)" | |
da076ffe | 4354 | opengl=yes |
925a0400 GH |
4355 | if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then |
4356 | gtk_gl="yes" | |
4357 | fi | |
cc720a5d | 4358 | QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags" |
20ff075b | 4359 | else |
da076ffe | 4360 | if test "$opengl" = "yes" ; then |
dcf30025 | 4361 | feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" |
20ff075b | 4362 | fi |
f676c67e | 4363 | opengl_cflags="" |
da076ffe GH |
4364 | opengl_libs="" |
4365 | opengl=no | |
20ff075b MW |
4366 | fi |
4367 | fi | |
4368 | ||
014cb152 GH |
4369 | if test "$opengl" = "yes"; then |
4370 | cat > $TMPC << EOF | |
4371 | #include <epoxy/egl.h> | |
4372 | #ifndef EGL_MESA_image_dma_buf_export | |
4373 | # error mesa/epoxy lacks support for dmabufs (mesa 10.6+) | |
4374 | #endif | |
4375 | int main(void) { return 0; } | |
4376 | EOF | |
4377 | if compile_prog "" "" ; then | |
4378 | opengl_dmabuf=yes | |
4379 | fi | |
4380 | fi | |
c9a12e75 | 4381 | |
e633a5c6 | 4382 | if test "$opengl" = "yes" && test "$have_x11" = "yes"; then |
99e1a93b PMD |
4383 | for target in $target_list; do |
4384 | case $target in | |
4385 | lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL | |
4386 | need_x11=yes | |
4387 | ;; | |
4388 | esac | |
4389 | done | |
4390 | fi | |
4391 | ||
ed279a06 KK |
4392 | ########################################## |
4393 | # libxml2 probe | |
4394 | if test "$libxml2" != "no" ; then | |
4395 | if $pkg_config --exists libxml-2.0; then | |
4396 | libxml2="yes" | |
4397 | libxml2_cflags=$($pkg_config --cflags libxml-2.0) | |
4398 | libxml2_libs=$($pkg_config --libs libxml-2.0) | |
4399 | else | |
4400 | if test "$libxml2" = "yes"; then | |
4401 | feature_not_found "libxml2" "Install libxml2 devel" | |
4402 | fi | |
4403 | libxml2="no" | |
4404 | fi | |
4405 | fi | |
c9a12e75 | 4406 | |
eb100396 BR |
4407 | ########################################## |
4408 | # glusterfs probe | |
4409 | if test "$glusterfs" != "no" ; then | |
65d5d3f9 | 4410 | if $pkg_config --atleast-version=3 glusterfs-api; then |
e01bee08 | 4411 | glusterfs="yes" |
89138857 SW |
4412 | glusterfs_cflags=$($pkg_config --cflags glusterfs-api) |
4413 | glusterfs_libs=$($pkg_config --libs glusterfs-api) | |
d85fa9eb JC |
4414 | if $pkg_config --atleast-version=4 glusterfs-api; then |
4415 | glusterfs_xlator_opt="yes" | |
4416 | fi | |
65d5d3f9 | 4417 | if $pkg_config --atleast-version=5 glusterfs-api; then |
0c14fb47 BR |
4418 | glusterfs_discard="yes" |
4419 | fi | |
7c815372 | 4420 | if $pkg_config --atleast-version=6 glusterfs-api; then |
df3a429a | 4421 | glusterfs_fallocate="yes" |
7c815372 BR |
4422 | glusterfs_zerofill="yes" |
4423 | fi | |
e014dbe7 PKK |
4424 | cat > $TMPC << EOF |
4425 | #include <glusterfs/api/glfs.h> | |
4426 | ||
4427 | int | |
4428 | main(void) | |
4429 | { | |
4430 | /* new glfs_ftruncate() passes two additional args */ | |
4431 | return glfs_ftruncate(NULL, 0, NULL, NULL); | |
4432 | } | |
4433 | EOF | |
4434 | if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then | |
4435 | glusterfs_ftruncate_has_stat="yes" | |
4436 | fi | |
0e3b891f NV |
4437 | cat > $TMPC << EOF |
4438 | #include <glusterfs/api/glfs.h> | |
4439 | ||
4440 | /* new glfs_io_cbk() passes two additional glfs_stat structs */ | |
4441 | static void | |
4442 | glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data) | |
4443 | {} | |
4444 | ||
4445 | int | |
4446 | main(void) | |
4447 | { | |
4448 | glfs_io_cbk iocb = &glusterfs_iocb; | |
4449 | iocb(NULL, 0 , NULL, NULL, NULL); | |
4450 | return 0; | |
4451 | } | |
4452 | EOF | |
4453 | if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then | |
4454 | glusterfs_iocb_has_stat="yes" | |
4455 | fi | |
eb100396 BR |
4456 | else |
4457 | if test "$glusterfs" = "yes" ; then | |
8efc9363 HT |
4458 | feature_not_found "GlusterFS backend support" \ |
4459 | "Install glusterfs-api devel >= 3" | |
eb100396 | 4460 | fi |
e01bee08 | 4461 | glusterfs="no" |
eb100396 BR |
4462 | fi |
4463 | fi | |
4464 | ||
39386ac7 | 4465 | # Check for inotify functions when we are building linux-user |
3b3f24ad AJ |
4466 | # emulator. This is done because older glibc versions don't |
4467 | # have syscall stubs for these implemented. In that case we | |
4468 | # don't provide them even if kernel supports them. | |
4469 | # | |
4470 | inotify=no | |
67ba57f6 | 4471 | cat > $TMPC << EOF |
3b3f24ad AJ |
4472 | #include <sys/inotify.h> |
4473 | ||
4474 | int | |
4475 | main(void) | |
4476 | { | |
4477 | /* try to start inotify */ | |
8690e420 | 4478 | return inotify_init(); |
3b3f24ad AJ |
4479 | } |
4480 | EOF | |
52166aa0 | 4481 | if compile_prog "" "" ; then |
67ba57f6 | 4482 | inotify=yes |
3b3f24ad AJ |
4483 | fi |
4484 | ||
c05c7a73 RV |
4485 | inotify1=no |
4486 | cat > $TMPC << EOF | |
4487 | #include <sys/inotify.h> | |
4488 | ||
4489 | int | |
4490 | main(void) | |
4491 | { | |
4492 | /* try to start inotify */ | |
4493 | return inotify_init1(0); | |
4494 | } | |
4495 | EOF | |
4496 | if compile_prog "" "" ; then | |
4497 | inotify1=yes | |
4498 | fi | |
4499 | ||
099d6b0f RV |
4500 | # check if pipe2 is there |
4501 | pipe2=no | |
4502 | cat > $TMPC << EOF | |
099d6b0f RV |
4503 | #include <unistd.h> |
4504 | #include <fcntl.h> | |
4505 | ||
4506 | int main(void) | |
4507 | { | |
4508 | int pipefd[2]; | |
9bca8162 | 4509 | return pipe2(pipefd, O_CLOEXEC); |
099d6b0f RV |
4510 | } |
4511 | EOF | |
52166aa0 | 4512 | if compile_prog "" "" ; then |
099d6b0f RV |
4513 | pipe2=yes |
4514 | fi | |
4515 | ||
40ff6d7e KW |
4516 | # check if accept4 is there |
4517 | accept4=no | |
4518 | cat > $TMPC << EOF | |
40ff6d7e KW |
4519 | #include <sys/socket.h> |
4520 | #include <stddef.h> | |
4521 | ||
4522 | int main(void) | |
4523 | { | |
4524 | accept4(0, NULL, NULL, SOCK_CLOEXEC); | |
4525 | return 0; | |
4526 | } | |
4527 | EOF | |
4528 | if compile_prog "" "" ; then | |
4529 | accept4=yes | |
4530 | fi | |
4531 | ||
3ce34dfb VS |
4532 | # check if tee/splice is there. vmsplice was added same time. |
4533 | splice=no | |
4534 | cat > $TMPC << EOF | |
3ce34dfb VS |
4535 | #include <unistd.h> |
4536 | #include <fcntl.h> | |
4537 | #include <limits.h> | |
4538 | ||
4539 | int main(void) | |
4540 | { | |
66ea0f22 | 4541 | int len, fd = 0; |
3ce34dfb VS |
4542 | len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); |
4543 | splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); | |
4544 | return 0; | |
4545 | } | |
4546 | EOF | |
52166aa0 | 4547 | if compile_prog "" "" ; then |
3ce34dfb VS |
4548 | splice=yes |
4549 | fi | |
4550 | ||
a99d57bb WG |
4551 | ########################################## |
4552 | # libnuma probe | |
4553 | ||
4554 | if test "$numa" != "no" ; then | |
4555 | cat > $TMPC << EOF | |
4556 | #include <numa.h> | |
4557 | int main(void) { return numa_available(); } | |
4558 | EOF | |
4559 | ||
4560 | if compile_prog "" "-lnuma" ; then | |
4561 | numa=yes | |
4562 | libs_softmmu="-lnuma $libs_softmmu" | |
4563 | else | |
4564 | if test "$numa" = "yes" ; then | |
4565 | feature_not_found "numa" "install numactl devel" | |
4566 | fi | |
4567 | numa=no | |
4568 | fi | |
4569 | fi | |
4570 | ||
7b01cb97 AD |
4571 | if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then |
4572 | echo "ERROR: tcmalloc && jemalloc can't be used at the same time" | |
4573 | exit 1 | |
4574 | fi | |
4575 | ||
5a22ab71 YZ |
4576 | # Even if malloc_trim() is available, these non-libc memory allocators |
4577 | # do not support it. | |
4578 | if test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then | |
4579 | if test "$malloc_trim" = "yes" ; then | |
4580 | echo "Disabling malloc_trim with non-libc memory allocator" | |
4581 | fi | |
4582 | malloc_trim="no" | |
4583 | fi | |
4584 | ||
4585 | ####################################### | |
4586 | # malloc_trim | |
4587 | ||
4588 | if test "$malloc_trim" != "no" ; then | |
4589 | cat > $TMPC << EOF | |
4590 | #include <malloc.h> | |
4591 | int main(void) { malloc_trim(0); return 0; } | |
4592 | EOF | |
4593 | if compile_prog "" "" ; then | |
4594 | malloc_trim="yes" | |
4595 | else | |
4596 | malloc_trim="no" | |
4597 | fi | |
4598 | fi | |
4599 | ||
2847b469 FZ |
4600 | ########################################## |
4601 | # tcmalloc probe | |
4602 | ||
4603 | if test "$tcmalloc" = "yes" ; then | |
4604 | cat > $TMPC << EOF | |
4605 | #include <stdlib.h> | |
f2dfe54c LB |
4606 | int main(void) { |
4607 | void *tmp = malloc(1); | |
4608 | if (tmp != NULL) { | |
4609 | return 0; | |
4610 | } | |
4611 | return 1; | |
4612 | } | |
2847b469 FZ |
4613 | EOF |
4614 | ||
4615 | if compile_prog "" "-ltcmalloc" ; then | |
4616 | LIBS="-ltcmalloc $LIBS" | |
4617 | else | |
4618 | feature_not_found "tcmalloc" "install gperftools devel" | |
4619 | fi | |
4620 | fi | |
4621 | ||
7b01cb97 AD |
4622 | ########################################## |
4623 | # jemalloc probe | |
4624 | ||
4625 | if test "$jemalloc" = "yes" ; then | |
4626 | cat > $TMPC << EOF | |
4627 | #include <stdlib.h> | |
f2dfe54c LB |
4628 | int main(void) { |
4629 | void *tmp = malloc(1); | |
4630 | if (tmp != NULL) { | |
4631 | return 0; | |
4632 | } | |
4633 | return 1; | |
4634 | } | |
7b01cb97 AD |
4635 | EOF |
4636 | ||
4637 | if compile_prog "" "-ljemalloc" ; then | |
4638 | LIBS="-ljemalloc $LIBS" | |
4639 | else | |
4640 | feature_not_found "jemalloc" "install jemalloc devel" | |
4641 | fi | |
4642 | fi | |
4643 | ||
dcc38d1c MT |
4644 | ########################################## |
4645 | # signalfd probe | |
4646 | signalfd="no" | |
4647 | cat > $TMPC << EOF | |
dcc38d1c MT |
4648 | #include <unistd.h> |
4649 | #include <sys/syscall.h> | |
4650 | #include <signal.h> | |
4651 | int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } | |
4652 | EOF | |
4653 | ||
4654 | if compile_prog "" "" ; then | |
4655 | signalfd=yes | |
4656 | fi | |
4657 | ||
d339d766 RJ |
4658 | # check if optreset global is declared by <getopt.h> |
4659 | optreset="no" | |
4660 | cat > $TMPC << EOF | |
4661 | #include <getopt.h> | |
4662 | int main(void) { return optreset; } | |
4663 | EOF | |
4664 | ||
4665 | if compile_prog "" "" ; then | |
4666 | optreset=yes | |
4667 | fi | |
4668 | ||
c2882b96 RV |
4669 | # check if eventfd is supported |
4670 | eventfd=no | |
4671 | cat > $TMPC << EOF | |
4672 | #include <sys/eventfd.h> | |
4673 | ||
4674 | int main(void) | |
4675 | { | |
55cc7f3e | 4676 | return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); |
c2882b96 RV |
4677 | } |
4678 | EOF | |
4679 | if compile_prog "" "" ; then | |
4680 | eventfd=yes | |
4681 | fi | |
4682 | ||
751bcc39 MAL |
4683 | # check if memfd is supported |
4684 | memfd=no | |
4685 | cat > $TMPC << EOF | |
75e5b70e | 4686 | #include <sys/mman.h> |
751bcc39 MAL |
4687 | |
4688 | int main(void) | |
4689 | { | |
4690 | return memfd_create("foo", MFD_ALLOW_SEALING); | |
4691 | } | |
4692 | EOF | |
4693 | if compile_prog "" "" ; then | |
4694 | memfd=yes | |
4695 | fi | |
4696 | ||
955727d2 CT |
4697 | # check for usbfs |
4698 | have_usbfs=no | |
4699 | if test "$linux_user" = "yes"; then | |
96566d09 TP |
4700 | cat > $TMPC << EOF |
4701 | #include <linux/usbdevice_fs.h> | |
4702 | ||
4703 | #ifndef USBDEVFS_GET_CAPABILITIES | |
4704 | #error "USBDEVFS_GET_CAPABILITIES undefined" | |
4705 | #endif | |
4706 | ||
4707 | #ifndef USBDEVFS_DISCONNECT_CLAIM | |
4708 | #error "USBDEVFS_DISCONNECT_CLAIM undefined" | |
4709 | #endif | |
4710 | ||
4711 | int main(void) | |
4712 | { | |
4713 | return 0; | |
4714 | } | |
4715 | EOF | |
4716 | if compile_prog "" ""; then | |
955727d2 CT |
4717 | have_usbfs=yes |
4718 | fi | |
955727d2 | 4719 | fi |
751bcc39 | 4720 | |
d0927938 UH |
4721 | # check for fallocate |
4722 | fallocate=no | |
4723 | cat > $TMPC << EOF | |
4724 | #include <fcntl.h> | |
4725 | ||
4726 | int main(void) | |
4727 | { | |
4728 | fallocate(0, 0, 0, 0); | |
4729 | return 0; | |
4730 | } | |
4731 | EOF | |
8fb03151 | 4732 | if compile_prog "" "" ; then |
d0927938 UH |
4733 | fallocate=yes |
4734 | fi | |
4735 | ||
3d4fa43e KK |
4736 | # check for fallocate hole punching |
4737 | fallocate_punch_hole=no | |
4738 | cat > $TMPC << EOF | |
4739 | #include <fcntl.h> | |
4740 | #include <linux/falloc.h> | |
4741 | ||
4742 | int main(void) | |
4743 | { | |
4744 | fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); | |
4745 | return 0; | |
4746 | } | |
4747 | EOF | |
4748 | if compile_prog "" "" ; then | |
4749 | fallocate_punch_hole=yes | |
4750 | fi | |
4751 | ||
b953f075 DL |
4752 | # check that fallocate supports range zeroing inside the file |
4753 | fallocate_zero_range=no | |
4754 | cat > $TMPC << EOF | |
4755 | #include <fcntl.h> | |
4756 | #include <linux/falloc.h> | |
4757 | ||
4758 | int main(void) | |
4759 | { | |
4760 | fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0); | |
4761 | return 0; | |
4762 | } | |
4763 | EOF | |
4764 | if compile_prog "" "" ; then | |
4765 | fallocate_zero_range=yes | |
4766 | fi | |
4767 | ||
ed911435 KW |
4768 | # check for posix_fallocate |
4769 | posix_fallocate=no | |
4770 | cat > $TMPC << EOF | |
4771 | #include <fcntl.h> | |
4772 | ||
4773 | int main(void) | |
4774 | { | |
4775 | posix_fallocate(0, 0, 0); | |
4776 | return 0; | |
4777 | } | |
4778 | EOF | |
4779 | if compile_prog "" "" ; then | |
4780 | posix_fallocate=yes | |
4781 | fi | |
4782 | ||
c727f47d PM |
4783 | # check for sync_file_range |
4784 | sync_file_range=no | |
4785 | cat > $TMPC << EOF | |
4786 | #include <fcntl.h> | |
4787 | ||
4788 | int main(void) | |
4789 | { | |
4790 | sync_file_range(0, 0, 0, 0); | |
4791 | return 0; | |
4792 | } | |
4793 | EOF | |
8fb03151 | 4794 | if compile_prog "" "" ; then |
c727f47d PM |
4795 | sync_file_range=yes |
4796 | fi | |
4797 | ||
dace20dc PM |
4798 | # check for linux/fiemap.h and FS_IOC_FIEMAP |
4799 | fiemap=no | |
4800 | cat > $TMPC << EOF | |
4801 | #include <sys/ioctl.h> | |
4802 | #include <linux/fs.h> | |
4803 | #include <linux/fiemap.h> | |
4804 | ||
4805 | int main(void) | |
4806 | { | |
4807 | ioctl(0, FS_IOC_FIEMAP, 0); | |
4808 | return 0; | |
4809 | } | |
4810 | EOF | |
8fb03151 | 4811 | if compile_prog "" "" ; then |
dace20dc PM |
4812 | fiemap=yes |
4813 | fi | |
4814 | ||
d0927938 UH |
4815 | # check for dup3 |
4816 | dup3=no | |
4817 | cat > $TMPC << EOF | |
4818 | #include <unistd.h> | |
4819 | ||
4820 | int main(void) | |
4821 | { | |
4822 | dup3(0, 0, 0); | |
4823 | return 0; | |
4824 | } | |
4825 | EOF | |
78f5d726 | 4826 | if compile_prog "" "" ; then |
d0927938 UH |
4827 | dup3=yes |
4828 | fi | |
4829 | ||
4e0c6529 AB |
4830 | # check for ppoll support |
4831 | ppoll=no | |
4832 | cat > $TMPC << EOF | |
4833 | #include <poll.h> | |
4834 | ||
4835 | int main(void) | |
4836 | { | |
4837 | struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; | |
4838 | ppoll(&pfd, 1, 0, 0); | |
4839 | return 0; | |
4840 | } | |
4841 | EOF | |
4842 | if compile_prog "" "" ; then | |
4843 | ppoll=yes | |
4844 | fi | |
4845 | ||
cd758dd0 AB |
4846 | # check for prctl(PR_SET_TIMERSLACK , ... ) support |
4847 | prctl_pr_set_timerslack=no | |
4848 | cat > $TMPC << EOF | |
4849 | #include <sys/prctl.h> | |
4850 | ||
4851 | int main(void) | |
4852 | { | |
4853 | prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); | |
4854 | return 0; | |
4855 | } | |
4856 | EOF | |
4857 | if compile_prog "" "" ; then | |
4858 | prctl_pr_set_timerslack=yes | |
4859 | fi | |
4860 | ||
3b6edd16 PM |
4861 | # check for epoll support |
4862 | epoll=no | |
4863 | cat > $TMPC << EOF | |
4864 | #include <sys/epoll.h> | |
4865 | ||
4866 | int main(void) | |
4867 | { | |
4868 | epoll_create(0); | |
4869 | return 0; | |
4870 | } | |
4871 | EOF | |
8fb03151 | 4872 | if compile_prog "" "" ; then |
3b6edd16 PM |
4873 | epoll=yes |
4874 | fi | |
4875 | ||
227f0214 PM |
4876 | # epoll_create1 is a later addition |
4877 | # so we must check separately for its presence | |
3b6edd16 PM |
4878 | epoll_create1=no |
4879 | cat > $TMPC << EOF | |
4880 | #include <sys/epoll.h> | |
4881 | ||
4882 | int main(void) | |
4883 | { | |
19e83f6b PM |
4884 | /* Note that we use epoll_create1 as a value, not as |
4885 | * a function being called. This is necessary so that on | |
4886 | * old SPARC glibc versions where the function was present in | |
4887 | * the library but not declared in the header file we will | |
4888 | * fail the configure check. (Otherwise we will get a compiler | |
4889 | * warning but not an error, and will proceed to fail the | |
4890 | * qemu compile where we compile with -Werror.) | |
4891 | */ | |
c075a723 | 4892 | return (int)(uintptr_t)&epoll_create1; |
3b6edd16 PM |
4893 | } |
4894 | EOF | |
8fb03151 | 4895 | if compile_prog "" "" ; then |
3b6edd16 PM |
4896 | epoll_create1=yes |
4897 | fi | |
4898 | ||
a8fd1aba PM |
4899 | # check for sendfile support |
4900 | sendfile=no | |
4901 | cat > $TMPC << EOF | |
4902 | #include <sys/sendfile.h> | |
4903 | ||
4904 | int main(void) | |
4905 | { | |
4906 | return sendfile(0, 0, 0, 0); | |
4907 | } | |
4908 | EOF | |
4909 | if compile_prog "" "" ; then | |
4910 | sendfile=yes | |
4911 | fi | |
4912 | ||
51834341 RV |
4913 | # check for timerfd support (glibc 2.8 and newer) |
4914 | timerfd=no | |
4915 | cat > $TMPC << EOF | |
4916 | #include <sys/timerfd.h> | |
4917 | ||
4918 | int main(void) | |
4919 | { | |
4920 | return(timerfd_create(CLOCK_REALTIME, 0)); | |
4921 | } | |
4922 | EOF | |
4923 | if compile_prog "" "" ; then | |
4924 | timerfd=yes | |
4925 | fi | |
4926 | ||
9af5c906 RV |
4927 | # check for setns and unshare support |
4928 | setns=no | |
4929 | cat > $TMPC << EOF | |
4930 | #include <sched.h> | |
4931 | ||
4932 | int main(void) | |
4933 | { | |
4934 | int ret; | |
4935 | ret = setns(0, 0); | |
4936 | ret = unshare(0); | |
4937 | return ret; | |
4938 | } | |
4939 | EOF | |
4940 | if compile_prog "" "" ; then | |
4941 | setns=yes | |
4942 | fi | |
4943 | ||
38860a03 AM |
4944 | # clock_adjtime probe |
4945 | clock_adjtime=no | |
4946 | cat > $TMPC <<EOF | |
4947 | #include <time.h> | |
4948 | ||
4949 | int main(void) | |
4950 | { | |
4951 | return clock_adjtime(0, 0); | |
4952 | } | |
4953 | EOF | |
4954 | clock_adjtime=no | |
4955 | if compile_prog "" "" ; then | |
4956 | clock_adjtime=yes | |
4957 | fi | |
4958 | ||
5a03cd00 AM |
4959 | # syncfs probe |
4960 | syncfs=no | |
4961 | cat > $TMPC <<EOF | |
4962 | #include <unistd.h> | |
4963 | ||
4964 | int main(void) | |
4965 | { | |
4966 | return syncfs(0); | |
4967 | } | |
4968 | EOF | |
4969 | syncfs=no | |
4970 | if compile_prog "" "" ; then | |
4971 | syncfs=yes | |
4972 | fi | |
4973 | ||
db37dd89 AM |
4974 | # check for kcov support (kernel must be 4.4+, compiled with certain options) |
4975 | kcov=no | |
4976 | if check_include sys/kcov.h ; then | |
4977 | kcov=yes | |
4978 | fi | |
4979 | ||
516e8b7d PM |
4980 | # If we're making warnings fatal, apply this to Sphinx runs as well |
4981 | sphinx_werror="" | |
4982 | if test "$werror" = "yes"; then | |
4983 | sphinx_werror="-W" | |
4984 | fi | |
4985 | ||
5f71eac0 PM |
4986 | # Check we have a new enough version of sphinx-build |
4987 | has_sphinx_build() { | |
4988 | # This is a bit awkward but works: create a trivial document and | |
4989 | # try to run it with our configuration file (which enforces a | |
4990 | # version requirement). This will fail if either | |
4991 | # sphinx-build doesn't exist at all or if it is too old. | |
4992 | mkdir -p "$TMPDIR1/sphinx" | |
4993 | touch "$TMPDIR1/sphinx/index.rst" | |
988ae6c3 AB |
4994 | "$sphinx_build" $sphinx_werror -c "$source_path/docs" \ |
4995 | -b html "$TMPDIR1/sphinx" \ | |
4996 | "$TMPDIR1/sphinx/out" >> config.log 2>&1 | |
5f71eac0 PM |
4997 | } |
4998 | ||
cc8ae6de | 4999 | # Check if tools are available to build documentation. |
a25dba17 | 5000 | if test "$docs" != "no" ; then |
758b617a PM |
5001 | if has_sphinx_build; then |
5002 | sphinx_ok=yes | |
5003 | else | |
5004 | sphinx_ok=no | |
5005 | fi | |
5006 | if has makeinfo && has pod2man && test "$sphinx_ok" = "yes"; then | |
a25dba17 | 5007 | docs=yes |
83a3ab8b | 5008 | else |
a25dba17 | 5009 | if test "$docs" = "yes" ; then |
758b617a PM |
5010 | if has $sphinx_build && test "$sphinx_ok" != "yes"; then |
5011 | echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2 | |
5012 | fi | |
5013 | feature_not_found "docs" "Install texinfo, Perl/perl-podlators and a Python 3 version of python-sphinx" | |
83a3ab8b | 5014 | fi |
a25dba17 | 5015 | docs=no |
83a3ab8b | 5016 | fi |
cc8ae6de PB |
5017 | fi |
5018 | ||
f514f41c | 5019 | # Search for bswap_32 function |
6ae9a1f4 JQ |
5020 | byteswap_h=no |
5021 | cat > $TMPC << EOF | |
5022 | #include <byteswap.h> | |
5023 | int main(void) { return bswap_32(0); } | |
5024 | EOF | |
52166aa0 | 5025 | if compile_prog "" "" ; then |
6ae9a1f4 JQ |
5026 | byteswap_h=yes |
5027 | fi | |
5028 | ||
75f13596 | 5029 | # Search for bswap32 function |
6ae9a1f4 JQ |
5030 | bswap_h=no |
5031 | cat > $TMPC << EOF | |
5032 | #include <sys/endian.h> | |
5033 | #include <sys/types.h> | |
5034 | #include <machine/bswap.h> | |
5035 | int main(void) { return bswap32(0); } | |
5036 | EOF | |
52166aa0 | 5037 | if compile_prog "" "" ; then |
6ae9a1f4 JQ |
5038 | bswap_h=yes |
5039 | fi | |
5040 | ||
c589b249 | 5041 | ########################################## |
e49ab19f | 5042 | # Do we have libiscsi >= 1.9.0 |
c589b249 | 5043 | if test "$libiscsi" != "no" ; then |
e49ab19f | 5044 | if $pkg_config --atleast-version=1.9.0 libiscsi; then |
3c33ea96 | 5045 | libiscsi="yes" |
ca871ec8 SW |
5046 | libiscsi_cflags=$($pkg_config --cflags libiscsi) |
5047 | libiscsi_libs=$($pkg_config --libs libiscsi) | |
c589b249 RS |
5048 | else |
5049 | if test "$libiscsi" = "yes" ; then | |
e49ab19f | 5050 | feature_not_found "libiscsi" "Install libiscsi >= 1.9.0" |
c589b249 RS |
5051 | fi |
5052 | libiscsi="no" | |
5053 | fi | |
5054 | fi | |
5055 | ||
8bacde8d NC |
5056 | ########################################## |
5057 | # Do we need libm | |
5058 | cat > $TMPC << EOF | |
5059 | #include <math.h> | |
f80ea986 | 5060 | int main(int argc, char **argv) { return isnan(sin((double)argc)); } |
8bacde8d NC |
5061 | EOF |
5062 | if compile_prog "" "" ; then | |
5063 | : | |
5064 | elif compile_prog "" "-lm" ; then | |
5065 | LIBS="-lm $LIBS" | |
5066 | libs_qga="-lm $libs_qga" | |
5067 | else | |
76ad07a4 | 5068 | error_exit "libm check failed" |
8bacde8d NC |
5069 | fi |
5070 | ||
da93a1fd AL |
5071 | ########################################## |
5072 | # Do we need librt | |
8bacde8d NC |
5073 | # uClibc provides 2 versions of clock_gettime(), one with realtime |
5074 | # support and one without. This means that the clock_gettime() don't | |
5075 | # need -lrt. We still need it for timer_create() so we check for this | |
5076 | # function in addition. | |
da93a1fd AL |
5077 | cat > $TMPC <<EOF |
5078 | #include <signal.h> | |
5079 | #include <time.h> | |
8bacde8d NC |
5080 | int main(void) { |
5081 | timer_create(CLOCK_REALTIME, NULL, NULL); | |
5082 | return clock_gettime(CLOCK_REALTIME, NULL); | |
5083 | } | |
da93a1fd AL |
5084 | EOF |
5085 | ||
52166aa0 | 5086 | if compile_prog "" "" ; then |
07ffa4bd | 5087 | : |
8bacde8d | 5088 | # we need pthread for static linking. use previous pthread test result |
18e588b1 RL |
5089 | elif compile_prog "" "$pthread_lib -lrt" ; then |
5090 | LIBS="$LIBS -lrt" | |
5091 | libs_qga="$libs_qga -lrt" | |
da93a1fd AL |
5092 | fi |
5093 | ||
d99e97e6 TH |
5094 | # Check whether we need to link libutil for openpty() |
5095 | cat > $TMPC << EOF | |
5096 | extern int openpty(int *am, int *as, char *name, void *termp, void *winp); | |
5097 | int main(void) { return openpty(0, 0, 0, 0, 0); } | |
5098 | EOF | |
5099 | ||
5100 | if ! compile_prog "" "" ; then | |
5101 | if compile_prog "" "-lutil" ; then | |
6362a53f | 5102 | libs_softmmu="-lutil $libs_softmmu" |
d99e97e6 TH |
5103 | libs_tools="-lutil $libs_tools" |
5104 | fi | |
6362a53f JQ |
5105 | fi |
5106 | ||
de5071c5 | 5107 | ########################################## |
cd4ec0b4 GH |
5108 | # spice probe |
5109 | if test "$spice" != "no" ; then | |
5110 | cat > $TMPC << EOF | |
5111 | #include <spice.h> | |
5112 | int main(void) { spice_server_new(); return 0; } | |
5113 | EOF | |
710fc4f5 JD |
5114 | spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) |
5115 | spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) | |
1b63665c | 5116 | if $pkg_config --atleast-version=0.12.5 spice-server && \ |
65d5d3f9 | 5117 | $pkg_config --atleast-version=0.12.3 spice-protocol && \ |
cd4ec0b4 GH |
5118 | compile_prog "$spice_cflags" "$spice_libs" ; then |
5119 | spice="yes" | |
5120 | libs_softmmu="$libs_softmmu $spice_libs" | |
5121 | QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" | |
2e0e3c39 AL |
5122 | spice_protocol_version=$($pkg_config --modversion spice-protocol) |
5123 | spice_server_version=$($pkg_config --modversion spice-server) | |
cd4ec0b4 GH |
5124 | else |
5125 | if test "$spice" = "yes" ; then | |
8efc9363 | 5126 | feature_not_found "spice" \ |
1b63665c | 5127 | "Install spice-server(>=0.12.5) and spice-protocol(>=0.12.3) devel" |
cd4ec0b4 GH |
5128 | fi |
5129 | spice="no" | |
5130 | fi | |
5131 | fi | |
5132 | ||
7b02f544 | 5133 | # check for smartcard support |
7b02f544 | 5134 | if test "$smartcard" != "no"; then |
0f5c642d | 5135 | if $pkg_config --atleast-version=2.5.1 libcacard; then |
7b02f544 MAL |
5136 | libcacard_cflags=$($pkg_config --cflags libcacard) |
5137 | libcacard_libs=$($pkg_config --libs libcacard) | |
7b02f544 | 5138 | smartcard="yes" |
afd347ab | 5139 | else |
7b02f544 MAL |
5140 | if test "$smartcard" = "yes"; then |
5141 | feature_not_found "smartcard" "Install libcacard devel" | |
111a38b0 | 5142 | fi |
7b02f544 | 5143 | smartcard="no" |
111a38b0 RR |
5144 | fi |
5145 | fi | |
111a38b0 | 5146 | |
2b2325ff GH |
5147 | # check for libusb |
5148 | if test "$libusb" != "no" ; then | |
65d5d3f9 | 5149 | if $pkg_config --atleast-version=1.0.13 libusb-1.0; then |
2b2325ff | 5150 | libusb="yes" |
ca871ec8 SW |
5151 | libusb_cflags=$($pkg_config --cflags libusb-1.0) |
5152 | libusb_libs=$($pkg_config --libs libusb-1.0) | |
2b2325ff GH |
5153 | else |
5154 | if test "$libusb" = "yes"; then | |
8efc9363 | 5155 | feature_not_found "libusb" "Install libusb devel >= 1.0.13" |
2b2325ff GH |
5156 | fi |
5157 | libusb="no" | |
5158 | fi | |
5159 | fi | |
5160 | ||
69354a83 HG |
5161 | # check for usbredirparser for usb network redirection support |
5162 | if test "$usb_redir" != "no" ; then | |
65d5d3f9 | 5163 | if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then |
69354a83 | 5164 | usb_redir="yes" |
ca871ec8 SW |
5165 | usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) |
5166 | usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) | |
69354a83 HG |
5167 | else |
5168 | if test "$usb_redir" = "yes"; then | |
21684af0 | 5169 | feature_not_found "usb-redir" "Install usbredir devel" |
69354a83 HG |
5170 | fi |
5171 | usb_redir="no" | |
5172 | fi | |
5173 | fi | |
5174 | ||
d9840e25 TS |
5175 | ########################################## |
5176 | # check if we have VSS SDK headers for win | |
5177 | ||
e633a5c6 EB |
5178 | if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ |
5179 | test "$vss_win32_sdk" != "no" ; then | |
d9840e25 | 5180 | case "$vss_win32_sdk" in |
690604f6 | 5181 | "") vss_win32_include="-isystem $source_path" ;; |
d9840e25 TS |
5182 | *\ *) # The SDK is installed in "Program Files" by default, but we cannot |
5183 | # handle path with spaces. So we symlink the headers into ".sdk/vss". | |
690604f6 | 5184 | vss_win32_include="-isystem $source_path/.sdk/vss" |
d9840e25 TS |
5185 | symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" |
5186 | ;; | |
690604f6 | 5187 | *) vss_win32_include="-isystem $vss_win32_sdk" |
d9840e25 TS |
5188 | esac |
5189 | cat > $TMPC << EOF | |
5190 | #define __MIDL_user_allocate_free_DEFINED__ | |
5191 | #include <inc/win2003/vss.h> | |
5192 | int main(void) { return VSS_CTX_BACKUP; } | |
5193 | EOF | |
5194 | if compile_prog "$vss_win32_include" "" ; then | |
5195 | guest_agent_with_vss="yes" | |
5196 | QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" | |
315d3184 | 5197 | libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" |
f33ca81f | 5198 | qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" |
d9840e25 TS |
5199 | else |
5200 | if test "$vss_win32_sdk" != "" ; then | |
5201 | echo "ERROR: Please download and install Microsoft VSS SDK:" | |
5202 | echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" | |
5203 | echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" | |
5204 | echo "ERROR: scripts/extract-vsssdk-headers setup.exe" | |
5205 | echo "ERROR: The headers are extracted in the directory \`inc'." | |
5206 | feature_not_found "VSS support" | |
5207 | fi | |
5208 | guest_agent_with_vss="no" | |
5209 | fi | |
5210 | fi | |
5211 | ||
5212 | ########################################## | |
5213 | # lookup Windows platform SDK (if not specified) | |
5214 | # The SDK is needed only to build .tlb (type library) file of guest agent | |
5215 | # VSS provider from the source. It is usually unnecessary because the | |
5216 | # pre-compiled .tlb file is included. | |
5217 | ||
e633a5c6 EB |
5218 | if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ |
5219 | test "$guest_agent_with_vss" = "yes" ; then | |
d9840e25 TS |
5220 | if test -z "$win_sdk"; then |
5221 | programfiles="$PROGRAMFILES" | |
5222 | test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" | |
5223 | if test -n "$programfiles"; then | |
5224 | win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null | |
5225 | else | |
5226 | feature_not_found "Windows SDK" | |
5227 | fi | |
5228 | elif test "$win_sdk" = "no"; then | |
5229 | win_sdk="" | |
5230 | fi | |
5231 | fi | |
5232 | ||
50cbebb9 MR |
5233 | ########################################## |
5234 | # check if mingw environment provides a recent ntddscsi.h | |
e633a5c6 | 5235 | if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then |
50cbebb9 MR |
5236 | cat > $TMPC << EOF |
5237 | #include <windows.h> | |
5238 | #include <ntddscsi.h> | |
5239 | int main(void) { | |
5240 | #if !defined(IOCTL_SCSI_GET_ADDRESS) | |
5241 | #error Missing required ioctl definitions | |
5242 | #endif | |
5243 | SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; | |
5244 | return addr.Lun; | |
5245 | } | |
5246 | EOF | |
5247 | if compile_prog "" "" ; then | |
5248 | guest_agent_ntddscsi=yes | |
996b9cdc | 5249 | libs_qga="-lsetupapi -lcfgmgr32 $libs_qga" |
50cbebb9 MR |
5250 | fi |
5251 | fi | |
5252 | ||
9d9e1521 GH |
5253 | ########################################## |
5254 | # virgl renderer probe | |
5255 | ||
5256 | if test "$virglrenderer" != "no" ; then | |
5257 | cat > $TMPC << EOF | |
5258 | #include <virglrenderer.h> | |
5259 | int main(void) { virgl_renderer_poll(); return 0; } | |
5260 | EOF | |
5261 | virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null) | |
5262 | virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null) | |
47479c55 | 5263 | virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null) |
9d9e1521 GH |
5264 | if $pkg_config virglrenderer >/dev/null 2>&1 && \ |
5265 | compile_prog "$virgl_cflags" "$virgl_libs" ; then | |
5266 | virglrenderer="yes" | |
5267 | else | |
5268 | if test "$virglrenderer" = "yes" ; then | |
5269 | feature_not_found "virglrenderer" | |
5270 | fi | |
5271 | virglrenderer="no" | |
5272 | fi | |
5273 | fi | |
5274 | ||
8ca80760 RH |
5275 | ########################################## |
5276 | # capstone | |
5277 | ||
e219c499 RH |
5278 | case "$capstone" in |
5279 | "" | yes) | |
5280 | if $pkg_config capstone; then | |
5281 | capstone=system | |
e633a5c6 | 5282 | elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then |
e219c499 RH |
5283 | capstone=git |
5284 | elif test -e "${source_path}/capstone/Makefile" ; then | |
5285 | capstone=internal | |
5286 | elif test -z "$capstone" ; then | |
5287 | capstone=no | |
5288 | else | |
5289 | feature_not_found "capstone" "Install capstone devel or git submodule" | |
5290 | fi | |
5291 | ;; | |
5292 | ||
5293 | system) | |
5294 | if ! $pkg_config capstone; then | |
5295 | feature_not_found "capstone" "Install capstone devel" | |
5296 | fi | |
5297 | ;; | |
5298 | esac | |
5299 | ||
5300 | case "$capstone" in | |
5301 | git | internal) | |
5302 | if test "$capstone" = git; then | |
5303 | git_submodules="${git_submodules} capstone" | |
5304 | fi | |
5305 | mkdir -p capstone | |
5306 | QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include" | |
5307 | if test "$mingw32" = "yes"; then | |
5308 | LIBCAPSTONE=capstone.lib | |
5309 | else | |
5310 | LIBCAPSTONE=libcapstone.a | |
5311 | fi | |
02f9135b | 5312 | libs_cpu="-L\$(BUILD_DIR)/capstone -lcapstone $libs_cpu" |
e219c499 RH |
5313 | ;; |
5314 | ||
5315 | system) | |
8ca80760 | 5316 | QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)" |
02f9135b | 5317 | libs_cpu="$($pkg_config --libs capstone) $libs_cpu" |
e219c499 RH |
5318 | ;; |
5319 | ||
5320 | no) | |
5321 | ;; | |
5322 | *) | |
5323 | error_exit "Unknown state for capstone: $capstone" | |
5324 | ;; | |
5325 | esac | |
8ca80760 | 5326 | |
5f6b9e8f BS |
5327 | ########################################## |
5328 | # check if we have fdatasync | |
5329 | ||
5330 | fdatasync=no | |
5331 | cat > $TMPC << EOF | |
5332 | #include <unistd.h> | |
d1722a27 AR |
5333 | int main(void) { |
5334 | #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 | |
5335 | return fdatasync(0); | |
5336 | #else | |
e172fe11 | 5337 | #error Not supported |
d1722a27 AR |
5338 | #endif |
5339 | } | |
5f6b9e8f BS |
5340 | EOF |
5341 | if compile_prog "" "" ; then | |
5342 | fdatasync=yes | |
5343 | fi | |
5344 | ||
e78815a5 AF |
5345 | ########################################## |
5346 | # check if we have madvise | |
5347 | ||
5348 | madvise=no | |
5349 | cat > $TMPC << EOF | |
5350 | #include <sys/types.h> | |
5351 | #include <sys/mman.h> | |
832ce9c2 | 5352 | #include <stddef.h> |
e78815a5 AF |
5353 | int main(void) { return madvise(NULL, 0, MADV_DONTNEED); } |
5354 | EOF | |
5355 | if compile_prog "" "" ; then | |
5356 | madvise=yes | |
5357 | fi | |
5358 | ||
5359 | ########################################## | |
5360 | # check if we have posix_madvise | |
5361 | ||
5362 | posix_madvise=no | |
5363 | cat > $TMPC << EOF | |
5364 | #include <sys/mman.h> | |
832ce9c2 | 5365 | #include <stddef.h> |
e78815a5 AF |
5366 | int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } |
5367 | EOF | |
5368 | if compile_prog "" "" ; then | |
5369 | posix_madvise=yes | |
5370 | fi | |
5371 | ||
9bc5a719 AG |
5372 | ########################################## |
5373 | # check if we have posix_memalign() | |
5374 | ||
5375 | posix_memalign=no | |
5376 | cat > $TMPC << EOF | |
5377 | #include <stdlib.h> | |
5378 | int main(void) { | |
5379 | void *p; | |
5380 | return posix_memalign(&p, 8, 8); | |
5381 | } | |
5382 | EOF | |
5383 | if compile_prog "" "" ; then | |
5384 | posix_memalign=yes | |
5385 | fi | |
5386 | ||
0a852417 PD |
5387 | ########################################## |
5388 | # check if we have posix_syslog | |
5389 | ||
5390 | posix_syslog=no | |
5391 | cat > $TMPC << EOF | |
5392 | #include <syslog.h> | |
5393 | int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; } | |
5394 | EOF | |
5395 | if compile_prog "" "" ; then | |
5396 | posix_syslog=yes | |
5397 | fi | |
5398 | ||
401bc051 PM |
5399 | ########################################## |
5400 | # check if we have sem_timedwait | |
5401 | ||
5402 | sem_timedwait=no | |
5403 | cat > $TMPC << EOF | |
5404 | #include <semaphore.h> | |
811294b7 | 5405 | int main(void) { sem_t s; struct timespec t = {0}; return sem_timedwait(&s, &t); } |
401bc051 PM |
5406 | EOF |
5407 | if compile_prog "" "" ; then | |
5408 | sem_timedwait=yes | |
5409 | fi | |
5410 | ||
5c99fa37 KF |
5411 | ########################################## |
5412 | # check if we have strchrnul | |
5413 | ||
5414 | strchrnul=no | |
5415 | cat > $TMPC << EOF | |
5416 | #include <string.h> | |
5417 | int main(void); | |
5418 | // Use a haystack that the compiler shouldn't be able to constant fold | |
5419 | char *haystack = (char*)&main; | |
5420 | int main(void) { return strchrnul(haystack, 'x') != &haystack[6]; } | |
5421 | EOF | |
5422 | if compile_prog "" "" ; then | |
5423 | strchrnul=yes | |
5424 | fi | |
5425 | ||
8a792b03 JX |
5426 | ######################################### |
5427 | # check if we have st_atim | |
5428 | ||
5429 | st_atim=no | |
5430 | cat > $TMPC << EOF | |
5431 | #include <sys/stat.h> | |
5432 | #include <stddef.h> | |
5433 | int main(void) { return offsetof(struct stat, st_atim); } | |
5434 | EOF | |
5435 | if compile_prog "" "" ; then | |
5436 | st_atim=yes | |
5437 | fi | |
5438 | ||
94a420b1 SH |
5439 | ########################################## |
5440 | # check if trace backend exists | |
5441 | ||
5b808275 | 5442 | $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null |
94a420b1 | 5443 | if test "$?" -ne 0 ; then |
5b808275 LV |
5444 | error_exit "invalid trace backends" \ |
5445 | "Please choose supported trace backends." | |
94a420b1 SH |
5446 | fi |
5447 | ||
7e24e92a SH |
5448 | ########################################## |
5449 | # For 'ust' backend, test if ust headers are present | |
5b808275 | 5450 | if have_backend "ust"; then |
7e24e92a | 5451 | cat > $TMPC << EOF |
bf15f63c | 5452 | #include <lttng/tracepoint.h> |
7e24e92a SH |
5453 | int main(void) { return 0; } |
5454 | EOF | |
c79ed23d | 5455 | if compile_prog "" "-Wl,--no-as-needed -ldl" ; then |
bf15f63c | 5456 | if $pkg_config lttng-ust --exists; then |
89138857 | 5457 | lttng_ust_libs=$($pkg_config --libs lttng-ust) |
bf15f63c | 5458 | else |
c79ed23d | 5459 | lttng_ust_libs="-llttng-ust -ldl" |
bf15f63c MG |
5460 | fi |
5461 | if $pkg_config liburcu-bp --exists; then | |
89138857 | 5462 | urcu_bp_libs=$($pkg_config --libs liburcu-bp) |
bf15f63c MG |
5463 | else |
5464 | urcu_bp_libs="-lurcu-bp" | |
5465 | fi | |
5466 | ||
5467 | LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS" | |
5468 | libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga" | |
7e24e92a | 5469 | else |
bf15f63c | 5470 | error_exit "Trace backend 'ust' missing lttng-ust header files" |
7e24e92a SH |
5471 | fi |
5472 | fi | |
b3d08c02 DB |
5473 | |
5474 | ########################################## | |
5475 | # For 'dtrace' backend, test if 'dtrace' command is present | |
5b808275 | 5476 | if have_backend "dtrace"; then |
b3d08c02 | 5477 | if ! has 'dtrace' ; then |
76ad07a4 | 5478 | error_exit "dtrace command is not found in PATH $PATH" |
b3d08c02 | 5479 | fi |
c276b17d DB |
5480 | trace_backend_stap="no" |
5481 | if has 'stap' ; then | |
5482 | trace_backend_stap="yes" | |
5483 | fi | |
b3d08c02 DB |
5484 | fi |
5485 | ||
023367e6 | 5486 | ########################################## |
519175a2 | 5487 | # check and set a backend for coroutine |
d0e2fce5 | 5488 | |
7c2acc70 | 5489 | # We prefer ucontext, but it's not always possible. The fallback |
33c53c54 DB |
5490 | # is sigcontext. On Windows the only valid backend is the Windows |
5491 | # specific one. | |
7c2acc70 PM |
5492 | |
5493 | ucontext_works=no | |
5494 | if test "$darwin" != "yes"; then | |
5495 | cat > $TMPC << EOF | |
d0e2fce5 | 5496 | #include <ucontext.h> |
cdf84806 PM |
5497 | #ifdef __stub_makecontext |
5498 | #error Ignoring glibc stub makecontext which will always fail | |
5499 | #endif | |
75cafad7 | 5500 | int main(void) { makecontext(0, 0, 0); return 0; } |
d0e2fce5 | 5501 | EOF |
7c2acc70 PM |
5502 | if compile_prog "" "" ; then |
5503 | ucontext_works=yes | |
5504 | fi | |
5505 | fi | |
5506 | ||
5507 | if test "$coroutine" = ""; then | |
5508 | if test "$mingw32" = "yes"; then | |
5509 | coroutine=win32 | |
5510 | elif test "$ucontext_works" = "yes"; then | |
5511 | coroutine=ucontext | |
5512 | else | |
5513 | coroutine=sigaltstack | |
d0e2fce5 | 5514 | fi |
519175a2 | 5515 | else |
7c2acc70 PM |
5516 | case $coroutine in |
5517 | windows) | |
5518 | if test "$mingw32" != "yes"; then | |
5519 | error_exit "'windows' coroutine backend only valid for Windows" | |
5520 | fi | |
5521 | # Unfortunately the user visible backend name doesn't match the | |
5522 | # coroutine-*.c filename for this case, so we have to adjust it here. | |
5523 | coroutine=win32 | |
5524 | ;; | |
5525 | ucontext) | |
5526 | if test "$ucontext_works" != "yes"; then | |
5527 | feature_not_found "ucontext" | |
5528 | fi | |
5529 | ;; | |
33c53c54 | 5530 | sigaltstack) |
7c2acc70 PM |
5531 | if test "$mingw32" = "yes"; then |
5532 | error_exit "only the 'windows' coroutine backend is valid for Windows" | |
5533 | fi | |
5534 | ;; | |
5535 | *) | |
5536 | error_exit "unknown coroutine backend $coroutine" | |
5537 | ;; | |
5538 | esac | |
d0e2fce5 AK |
5539 | fi |
5540 | ||
70c60c08 | 5541 | if test "$coroutine_pool" = ""; then |
33c53c54 | 5542 | coroutine_pool=yes |
70c60c08 SH |
5543 | fi |
5544 | ||
7d992e4d | 5545 | if test "$debug_stack_usage" = "yes"; then |
7d992e4d PL |
5546 | if test "$coroutine_pool" = "yes"; then |
5547 | echo "WARN: disabling coroutine pool for stack usage debugging" | |
5548 | coroutine_pool=no | |
5549 | fi | |
5550 | fi | |
5551 | ||
5552 | ||
d2042378 AK |
5553 | ########################################## |
5554 | # check if we have open_by_handle_at | |
5555 | ||
4e1797f9 | 5556 | open_by_handle_at=no |
d2042378 AK |
5557 | cat > $TMPC << EOF |
5558 | #include <fcntl.h> | |
acc55ba8 SW |
5559 | #if !defined(AT_EMPTY_PATH) |
5560 | # error missing definition | |
5561 | #else | |
75cafad7 | 5562 | int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } |
acc55ba8 | 5563 | #endif |
d2042378 AK |
5564 | EOF |
5565 | if compile_prog "" "" ; then | |
5566 | open_by_handle_at=yes | |
5567 | fi | |
5568 | ||
e06a765e HPB |
5569 | ######################################## |
5570 | # check if we have linux/magic.h | |
5571 | ||
5572 | linux_magic_h=no | |
5573 | cat > $TMPC << EOF | |
5574 | #include <linux/magic.h> | |
5575 | int main(void) { | |
75cafad7 | 5576 | return 0; |
e06a765e HPB |
5577 | } |
5578 | EOF | |
5579 | if compile_prog "" "" ; then | |
5580 | linux_magic_h=yes | |
5581 | fi | |
5582 | ||
06d71fa1 | 5583 | ######################################## |
c95e3080 KW |
5584 | # check whether we can disable warning option with a pragma (this is needed |
5585 | # to silence warnings in the headers of some versions of external libraries). | |
5586 | # This test has to be compiled with -Werror as otherwise an unknown pragma is | |
5587 | # only a warning. | |
5588 | # | |
5589 | # If we can't selectively disable warning in the code, disable -Werror so that | |
5590 | # the build doesn't fail anyway. | |
5591 | ||
06d71fa1 PM |
5592 | pragma_disable_unused_but_set=no |
5593 | cat > $TMPC << EOF | |
e6f53fd5 | 5594 | #pragma GCC diagnostic push |
c95e3080 | 5595 | #pragma GCC diagnostic ignored "-Wstrict-prototypes" |
e6f53fd5 | 5596 | #pragma GCC diagnostic pop |
c95e3080 | 5597 | |
06d71fa1 PM |
5598 | int main(void) { |
5599 | return 0; | |
5600 | } | |
5601 | EOF | |
5602 | if compile_prog "-Werror" "" ; then | |
cc6e3ca9 | 5603 | pragma_diagnostic_available=yes |
c95e3080 KW |
5604 | else |
5605 | werror=no | |
06d71fa1 PM |
5606 | fi |
5607 | ||
3f4349dc | 5608 | ######################################## |
541be927 | 5609 | # check if we have valgrind/valgrind.h |
3f4349dc KW |
5610 | |
5611 | valgrind_h=no | |
5612 | cat > $TMPC << EOF | |
5613 | #include <valgrind/valgrind.h> | |
3f4349dc | 5614 | int main(void) { |
3f4349dc KW |
5615 | return 0; |
5616 | } | |
5617 | EOF | |
5618 | if compile_prog "" "" ; then | |
5619 | valgrind_h=yes | |
5620 | fi | |
5621 | ||
8ab1bf12 LC |
5622 | ######################################## |
5623 | # check if environ is declared | |
5624 | ||
5625 | has_environ=no | |
5626 | cat > $TMPC << EOF | |
5627 | #include <unistd.h> | |
5628 | int main(void) { | |
c075a723 | 5629 | environ = 0; |
8ab1bf12 LC |
5630 | return 0; |
5631 | } | |
5632 | EOF | |
5633 | if compile_prog "" "" ; then | |
5634 | has_environ=yes | |
5635 | fi | |
5636 | ||
76a347e1 RH |
5637 | ######################################## |
5638 | # check if cpuid.h is usable. | |
5639 | ||
76a347e1 RH |
5640 | cat > $TMPC << EOF |
5641 | #include <cpuid.h> | |
5642 | int main(void) { | |
774d566c PM |
5643 | unsigned a, b, c, d; |
5644 | int max = __get_cpuid_max(0, 0); | |
5645 | ||
5646 | if (max >= 1) { | |
5647 | __cpuid(1, a, b, c, d); | |
5648 | } | |
5649 | ||
5650 | if (max >= 7) { | |
5651 | __cpuid_count(7, 0, a, b, c, d); | |
5652 | } | |
5653 | ||
5654 | return 0; | |
76a347e1 RH |
5655 | } |
5656 | EOF | |
5657 | if compile_prog "" "" ; then | |
5658 | cpuid_h=yes | |
5659 | fi | |
5660 | ||
5dd89908 RH |
5661 | ########################################## |
5662 | # avx2 optimization requirement check | |
5663 | # | |
5664 | # There is no point enabling this if cpuid.h is not usable, | |
5665 | # since we won't be able to select the new routines. | |
5666 | ||
e633a5c6 | 5667 | if test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then |
5dd89908 RH |
5668 | cat > $TMPC << EOF |
5669 | #pragma GCC push_options | |
5670 | #pragma GCC target("avx2") | |
5671 | #include <cpuid.h> | |
5672 | #include <immintrin.h> | |
5673 | static int bar(void *a) { | |
5674 | __m256i x = *(__m256i *)a; | |
5675 | return _mm256_testz_si256(x, x); | |
5676 | } | |
5677 | int main(int argc, char *argv[]) { return bar(argv[0]); } | |
5678 | EOF | |
5679 | if compile_object "" ; then | |
5680 | avx2_opt="yes" | |
86583a07 LM |
5681 | else |
5682 | avx2_opt="no" | |
5dd89908 RH |
5683 | fi |
5684 | fi | |
5685 | ||
6b8cd447 RH |
5686 | ########################################## |
5687 | # avx512f optimization requirement check | |
5688 | # | |
5689 | # There is no point enabling this if cpuid.h is not usable, | |
5690 | # since we won't be able to select the new routines. | |
5691 | # by default, it is turned off. | |
5692 | # if user explicitly want to enable it, check environment | |
5693 | ||
5694 | if test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then | |
5695 | cat > $TMPC << EOF | |
5696 | #pragma GCC push_options | |
5697 | #pragma GCC target("avx512f") | |
5698 | #include <cpuid.h> | |
5699 | #include <immintrin.h> | |
5700 | static int bar(void *a) { | |
5701 | __m512i x = *(__m512i *)a; | |
5702 | return _mm512_test_epi64_mask(x, x); | |
5703 | } | |
5704 | int main(int argc, char *argv[]) | |
5705 | { | |
5706 | return bar(argv[0]); | |
5707 | } | |
5708 | EOF | |
5709 | if ! compile_object "" ; then | |
5710 | avx512f_opt="no" | |
5711 | fi | |
5712 | else | |
5713 | avx512f_opt="no" | |
5714 | fi | |
5715 | ||
f540166b RH |
5716 | ######################################## |
5717 | # check if __[u]int128_t is usable. | |
5718 | ||
5719 | int128=no | |
5720 | cat > $TMPC << EOF | |
5721 | __int128_t a; | |
5722 | __uint128_t b; | |
5723 | int main (void) { | |
5724 | a = a + b; | |
5725 | b = a * b; | |
464e3671 | 5726 | a = a * a; |
f540166b RH |
5727 | return 0; |
5728 | } | |
5729 | EOF | |
5730 | if compile_prog "" "" ; then | |
5731 | int128=yes | |
5732 | fi | |
76a347e1 | 5733 | |
7ebee43e RH |
5734 | ######################################### |
5735 | # See if 128-bit atomic operations are supported. | |
5736 | ||
5737 | atomic128=no | |
5738 | if test "$int128" = "yes"; then | |
5739 | cat > $TMPC << EOF | |
5740 | int main(void) | |
5741 | { | |
5742 | unsigned __int128 x = 0, y = 0; | |
5743 | y = __atomic_load_16(&x, 0); | |
5744 | __atomic_store_16(&x, y, 0); | |
5745 | __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0); | |
5746 | return 0; | |
5747 | } | |
5748 | EOF | |
5749 | if compile_prog "" "" ; then | |
5750 | atomic128=yes | |
5751 | fi | |
5752 | fi | |
5753 | ||
e6cd4bb5 | 5754 | cmpxchg128=no |
e633a5c6 | 5755 | if test "$int128" = yes && test "$atomic128" = no; then |
e6cd4bb5 RH |
5756 | cat > $TMPC << EOF |
5757 | int main(void) | |
5758 | { | |
5759 | unsigned __int128 x = 0, y = 0; | |
5760 | __sync_val_compare_and_swap_16(&x, y, x); | |
5761 | return 0; | |
5762 | } | |
5763 | EOF | |
5764 | if compile_prog "" "" ; then | |
5765 | cmpxchg128=yes | |
5766 | fi | |
5767 | fi | |
5768 | ||
df79b996 RH |
5769 | ######################################### |
5770 | # See if 64-bit atomic operations are supported. | |
5771 | # Note that without __atomic builtins, we can only | |
5772 | # assume atomic loads/stores max at pointer size. | |
5773 | ||
5774 | cat > $TMPC << EOF | |
5775 | #include <stdint.h> | |
5776 | int main(void) | |
5777 | { | |
5778 | uint64_t x = 0, y = 0; | |
5779 | #ifdef __ATOMIC_RELAXED | |
5780 | y = __atomic_load_8(&x, 0); | |
5781 | __atomic_store_8(&x, y, 0); | |
5782 | __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0); | |
5783 | __atomic_exchange_8(&x, y, 0); | |
5784 | __atomic_fetch_add_8(&x, y, 0); | |
5785 | #else | |
5786 | typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1]; | |
5787 | __sync_lock_test_and_set(&x, y); | |
5788 | __sync_val_compare_and_swap(&x, y, 0); | |
5789 | __sync_fetch_and_add(&x, y); | |
5790 | #endif | |
5791 | return 0; | |
5792 | } | |
5793 | EOF | |
5794 | if compile_prog "" "" ; then | |
5795 | atomic64=yes | |
5796 | fi | |
5797 | ||
26fffe29 EC |
5798 | ######################################### |
5799 | # See if --dynamic-list is supported by the linker | |
5800 | ld_dynamic_list="no" | |
5801 | if test "$static" = "no" ; then | |
5802 | cat > $TMPTXT <<EOF | |
5803 | { | |
5804 | foo; | |
5805 | }; | |
5806 | EOF | |
5807 | ||
5808 | cat > $TMPC <<EOF | |
5809 | #include <stdio.h> | |
5810 | void foo(void); | |
5811 | ||
5812 | void foo(void) | |
5813 | { | |
5814 | printf("foo\n"); | |
5815 | } | |
5816 | ||
5817 | int main(void) | |
5818 | { | |
5819 | foo(); | |
5820 | return 0; | |
5821 | } | |
5822 | EOF | |
5823 | ||
5824 | if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then | |
5825 | ld_dynamic_list="yes" | |
5826 | fi | |
5827 | fi | |
5828 | ||
5829 | ######################################### | |
5830 | # See if -exported_symbols_list is supported by the linker | |
5831 | ||
5832 | ld_exported_symbols_list="no" | |
5833 | if test "$static" = "no" ; then | |
5834 | cat > $TMPTXT <<EOF | |
5835 | _foo | |
5836 | EOF | |
5837 | ||
5838 | if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then | |
5839 | ld_exported_symbols_list="yes" | |
5840 | fi | |
5841 | fi | |
5842 | ||
5843 | if test "$plugins" = "yes" && | |
5844 | test "$ld_dynamic_list" = "no" && | |
5845 | test "$ld_exported_symbols_list" = "no" ; then | |
5846 | error_exit \ | |
5847 | "Plugin support requires dynamic linking and specifying a set of symbols " \ | |
5848 | "that are exported to plugins. Unfortunately your linker doesn't " \ | |
5849 | "support the flag (--dynamic-list or -exported_symbols_list) used " \ | |
5850 | "for this purpose. You can't build with --static." | |
5851 | fi | |
5852 | ||
db8aaae8 RH |
5853 | ######################################## |
5854 | # See if __attribute__((alias)) is supported. | |
5855 | # This false for Xcode 9, but has been remedied for Xcode 10. | |
5856 | # Unfortunately, travis uses Xcode 9 by default. | |
5857 | ||
5858 | attralias=no | |
5859 | cat > $TMPC << EOF | |
5860 | int x = 1; | |
5861 | extern const int y __attribute__((alias("x"))); | |
5862 | int main(void) { return 0; } | |
5863 | EOF | |
5864 | if compile_prog "" "" ; then | |
5865 | attralias=yes | |
5866 | fi | |
5867 | ||
1e6e9aca RH |
5868 | ######################################## |
5869 | # check if getauxval is available. | |
5870 | ||
5871 | getauxval=no | |
5872 | cat > $TMPC << EOF | |
5873 | #include <sys/auxv.h> | |
5874 | int main(void) { | |
5875 | return getauxval(AT_HWCAP) == 0; | |
5876 | } | |
5877 | EOF | |
5878 | if compile_prog "" "" ; then | |
5879 | getauxval=yes | |
5880 | fi | |
5881 | ||
fd0e6053 JS |
5882 | ######################################## |
5883 | # check if ccache is interfering with | |
5884 | # semantic analysis of macros | |
5885 | ||
5e4dfd3d | 5886 | unset CCACHE_CPP2 |
fd0e6053 JS |
5887 | ccache_cpp2=no |
5888 | cat > $TMPC << EOF | |
5889 | static const int Z = 1; | |
5890 | #define fn() ({ Z; }) | |
5891 | #define TAUT(X) ((X) == Z) | |
5892 | #define PAREN(X, Y) (X == Y) | |
5893 | #define ID(X) (X) | |
5894 | int main(int argc, char *argv[]) | |
5895 | { | |
5896 | int x = 0, y = 0; | |
5897 | x = ID(x); | |
5898 | x = fn(); | |
5899 | fn(); | |
5900 | if (PAREN(x, y)) return 0; | |
5901 | if (TAUT(Z)) return 0; | |
5902 | return 0; | |
5903 | } | |
5904 | EOF | |
5905 | ||
5906 | if ! compile_object "-Werror"; then | |
5907 | ccache_cpp2=yes | |
5908 | fi | |
5909 | ||
b553a042 JS |
5910 | ################################################# |
5911 | # clang does not support glibc + FORTIFY_SOURCE. | |
5912 | ||
5913 | if test "$fortify_source" != "no"; then | |
5914 | if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then | |
5915 | fortify_source="no"; | |
e189091f | 5916 | elif test -n "$cxx" && has $cxx && |
cfcc7c14 | 5917 | echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then |
b553a042 JS |
5918 | fortify_source="no"; |
5919 | else | |
5920 | fortify_source="yes" | |
5921 | fi | |
5922 | fi | |
5923 | ||
1efad060 FZ |
5924 | ############################################### |
5925 | # Check if copy_file_range is provided by glibc | |
5926 | have_copy_file_range=no | |
5927 | cat > $TMPC << EOF | |
5928 | #include <unistd.h> | |
5929 | int main(void) { | |
5930 | copy_file_range(0, NULL, 0, NULL, 0, 0); | |
5931 | return 0; | |
5932 | } | |
5933 | EOF | |
5934 | if compile_prog "" "" ; then | |
5935 | have_copy_file_range=yes | |
5936 | fi | |
5937 | ||
277abf15 JV |
5938 | ########################################## |
5939 | # check if struct fsxattr is available via linux/fs.h | |
5940 | ||
5941 | have_fsxattr=no | |
5942 | cat > $TMPC << EOF | |
5943 | #include <linux/fs.h> | |
5944 | struct fsxattr foo; | |
5945 | int main(void) { | |
5946 | return 0; | |
5947 | } | |
5948 | EOF | |
5949 | if compile_prog "" "" ; then | |
5950 | have_fsxattr=yes | |
5951 | fi | |
5952 | ||
a40161cb PB |
5953 | ########################################## |
5954 | # check for usable membarrier system call | |
5955 | if test "$membarrier" = "yes"; then | |
5956 | have_membarrier=no | |
5957 | if test "$mingw32" = "yes" ; then | |
5958 | have_membarrier=yes | |
5959 | elif test "$linux" = "yes" ; then | |
5960 | cat > $TMPC << EOF | |
5961 | #include <linux/membarrier.h> | |
5962 | #include <sys/syscall.h> | |
5963 | #include <unistd.h> | |
5964 | #include <stdlib.h> | |
5965 | int main(void) { | |
5966 | syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); | |
5967 | syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); | |
5968 | exit(0); | |
5969 | } | |
5970 | EOF | |
5971 | if compile_prog "" "" ; then | |
5972 | have_membarrier=yes | |
5973 | fi | |
5974 | fi | |
5975 | if test "$have_membarrier" = "no"; then | |
5976 | feature_not_found "membarrier" "membarrier system call not available" | |
5977 | fi | |
5978 | else | |
5979 | # Do not enable it by default even for Mingw32, because it doesn't | |
5980 | # work on Wine. | |
5981 | membarrier=no | |
5982 | fi | |
5983 | ||
b66e10e4 PM |
5984 | ########################################## |
5985 | # check if rtnetlink.h exists and is useful | |
575b22b1 LV |
5986 | have_rtnetlink=no |
5987 | cat > $TMPC << EOF | |
5988 | #include <linux/rtnetlink.h> | |
5989 | int main(void) { | |
5990 | return IFLA_PROTO_DOWN; | |
5991 | } | |
5992 | EOF | |
5993 | if compile_prog "" "" ; then | |
5994 | have_rtnetlink=yes | |
5995 | fi | |
5996 | ||
6a02c806 SH |
5997 | ########################################## |
5998 | # check for usable AF_VSOCK environment | |
5999 | have_af_vsock=no | |
6000 | cat > $TMPC << EOF | |
6001 | #include <errno.h> | |
6002 | #include <sys/types.h> | |
6003 | #include <sys/socket.h> | |
6004 | #if !defined(AF_VSOCK) | |
6005 | # error missing AF_VSOCK flag | |
6006 | #endif | |
6007 | #include <linux/vm_sockets.h> | |
6008 | int main(void) { | |
6009 | int sock, ret; | |
6010 | struct sockaddr_vm svm; | |
6011 | socklen_t len = sizeof(svm); | |
6012 | sock = socket(AF_VSOCK, SOCK_STREAM, 0); | |
6013 | ret = getpeername(sock, (struct sockaddr *)&svm, &len); | |
6014 | if ((ret == -1) && (errno == ENOTCONN)) { | |
6015 | return 0; | |
6016 | } | |
6017 | return -1; | |
6018 | } | |
6019 | EOF | |
6020 | if compile_prog "" "" ; then | |
6021 | have_af_vsock=yes | |
6022 | fi | |
6023 | ||
f0d92b56 LM |
6024 | ########################################## |
6025 | # check for usable AF_ALG environment | |
4f67366e | 6026 | have_afalg=no |
f0d92b56 LM |
6027 | cat > $TMPC << EOF |
6028 | #include <errno.h> | |
6029 | #include <sys/types.h> | |
6030 | #include <sys/socket.h> | |
6031 | #include <linux/if_alg.h> | |
6032 | int main(void) { | |
6033 | int sock; | |
6034 | sock = socket(AF_ALG, SOCK_SEQPACKET, 0); | |
6035 | return sock; | |
6036 | } | |
6037 | EOF | |
6038 | if compile_prog "" "" ; then | |
6039 | have_afalg=yes | |
6040 | fi | |
6041 | if test "$crypto_afalg" = "yes" | |
6042 | then | |
6043 | if test "$have_afalg" != "yes" | |
6044 | then | |
6045 | error_exit "AF_ALG requested but could not be detected" | |
6046 | fi | |
6047 | fi | |
6048 | ||
6049 | ||
c97d6d2c SAGDR |
6050 | ################################################# |
6051 | # Check to see if we have the Hypervisor framework | |
d2d08522 | 6052 | if [ "$darwin" = "yes" ] ; then |
c97d6d2c SAGDR |
6053 | cat > $TMPC << EOF |
6054 | #include <Hypervisor/hv.h> | |
6055 | int main() { return 0;} | |
6056 | EOF | |
6057 | if ! compile_object ""; then | |
6058 | hvf='no' | |
6059 | else | |
6060 | hvf='yes' | |
db5adeaa | 6061 | QEMU_LDFLAGS="-framework Hypervisor $QEMU_LDFLAGS" |
c97d6d2c SAGDR |
6062 | fi |
6063 | fi | |
6064 | ||
6969ec6c JC |
6065 | ################################################# |
6066 | # Sparc implicitly links with --relax, which is | |
6067 | # incompatible with -r, so --no-relax should be | |
6068 | # given. It does no harm to give it on other | |
6069 | # platforms too. | |
6070 | ||
6071 | # Note: the prototype is needed since QEMU_CFLAGS | |
6072 | # contains -Wmissing-prototypes | |
6073 | cat > $TMPC << EOF | |
6074 | extern int foo(void); | |
6075 | int foo(void) { return 0; } | |
6076 | EOF | |
6077 | if ! compile_object ""; then | |
6078 | error_exit "Failed to compile object file for LD_REL_FLAGS test" | |
6079 | fi | |
7ecf44a5 PB |
6080 | for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do |
6081 | if do_cc -nostdlib $i -o $TMPMO $TMPO; then | |
6082 | LD_REL_FLAGS=$i | |
6083 | break | |
6084 | fi | |
6085 | done | |
6086 | if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then | |
6087 | feature_not_found "modules" "Cannot find how to build relocatable objects" | |
6969ec6c JC |
6088 | fi |
6089 | ||
4d04351f CC |
6090 | ########################################## |
6091 | # check for sysmacros.h | |
6092 | ||
6093 | have_sysmacros=no | |
6094 | cat > $TMPC << EOF | |
6095 | #include <sys/sysmacros.h> | |
6096 | int main(void) { | |
6097 | return makedev(0, 0); | |
6098 | } | |
6099 | EOF | |
6100 | if compile_prog "" "" ; then | |
6101 | have_sysmacros=yes | |
6102 | fi | |
6103 | ||
da92c3ff AM |
6104 | ########################################## |
6105 | # Veritas HyperScale block driver VxHS | |
6106 | # Check if libvxhs is installed | |
6107 | ||
6108 | if test "$vxhs" != "no" ; then | |
6109 | cat > $TMPC <<EOF | |
6110 | #include <stdint.h> | |
6111 | #include <qnio/qnio_api.h> | |
6112 | ||
6113 | void *vxhs_callback; | |
6114 | ||
6115 | int main(void) { | |
6116 | iio_init(QNIO_VERSION, vxhs_callback); | |
6117 | return 0; | |
6118 | } | |
6119 | EOF | |
6120 | vxhs_libs="-lvxhs -lssl" | |
6121 | if compile_prog "" "$vxhs_libs" ; then | |
6122 | vxhs=yes | |
6123 | else | |
6124 | if test "$vxhs" = "yes" ; then | |
6125 | feature_not_found "vxhs block device" "Install libvxhs See github" | |
6126 | fi | |
6127 | vxhs=no | |
6128 | fi | |
6129 | fi | |
6130 | ||
49e00a18 AG |
6131 | ########################################## |
6132 | # check for _Static_assert() | |
6133 | ||
6134 | have_static_assert=no | |
6135 | cat > $TMPC << EOF | |
6136 | _Static_assert(1, "success"); | |
6137 | int main(void) { | |
6138 | return 0; | |
6139 | } | |
6140 | EOF | |
6141 | if compile_prog "" "" ; then | |
6142 | have_static_assert=yes | |
6143 | fi | |
6144 | ||
e674605f TG |
6145 | ########################################## |
6146 | # check for utmpx.h, it is missing e.g. on OpenBSD | |
6147 | ||
6148 | have_utmpx=no | |
6149 | cat > $TMPC << EOF | |
6150 | #include <utmpx.h> | |
6151 | struct utmpx user_info; | |
6152 | int main(void) { | |
6153 | return 0; | |
6154 | } | |
6155 | EOF | |
6156 | if compile_prog "" "" ; then | |
6157 | have_utmpx=yes | |
6158 | fi | |
6159 | ||
db1ed1ab RH |
6160 | ########################################## |
6161 | # check for getrandom() | |
6162 | ||
6163 | have_getrandom=no | |
6164 | cat > $TMPC << EOF | |
6165 | #include <sys/random.h> | |
6166 | int main(void) { | |
6167 | return getrandom(0, 0, GRND_NONBLOCK); | |
6168 | } | |
6169 | EOF | |
6170 | if compile_prog "" "" ; then | |
6171 | have_getrandom=yes | |
6172 | fi | |
6173 | ||
247724cb MAL |
6174 | ########################################## |
6175 | # checks for sanitizers | |
6176 | ||
247724cb MAL |
6177 | have_asan=no |
6178 | have_ubsan=no | |
d83414e1 MAL |
6179 | have_asan_iface_h=no |
6180 | have_asan_iface_fiber=no | |
247724cb MAL |
6181 | |
6182 | if test "$sanitizers" = "yes" ; then | |
b9f44da2 | 6183 | write_c_skeleton |
247724cb MAL |
6184 | if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then |
6185 | have_asan=yes | |
6186 | fi | |
b9f44da2 MAL |
6187 | |
6188 | # we could use a simple skeleton for flags checks, but this also | |
6189 | # detect the static linking issue of ubsan, see also: | |
6190 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 | |
6191 | cat > $TMPC << EOF | |
6192 | #include <stdlib.h> | |
6193 | int main(void) { | |
6194 | void *tmp = malloc(10); | |
f2dfe54c LB |
6195 | if (tmp != NULL) { |
6196 | return *(int *)(tmp + 2); | |
6197 | } | |
b9f44da2 MAL |
6198 | } |
6199 | EOF | |
247724cb MAL |
6200 | if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then |
6201 | have_ubsan=yes | |
6202 | fi | |
d83414e1 MAL |
6203 | |
6204 | if check_include "sanitizer/asan_interface.h" ; then | |
6205 | have_asan_iface_h=yes | |
6206 | fi | |
6207 | ||
6208 | cat > $TMPC << EOF | |
6209 | #include <sanitizer/asan_interface.h> | |
6210 | int main(void) { | |
6211 | __sanitizer_start_switch_fiber(0, 0, 0); | |
6212 | return 0; | |
6213 | } | |
6214 | EOF | |
6215 | if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then | |
6216 | have_asan_iface_fiber=yes | |
6217 | fi | |
247724cb MAL |
6218 | fi |
6219 | ||
adc28027 AB |
6220 | ########################################## |
6221 | # checks for fuzzer | |
6222 | if test "$fuzzing" = "yes" ; then | |
6223 | write_c_fuzzer_skeleton | |
6224 | if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address,fuzzer" ""; then | |
6225 | have_fuzzer=yes | |
6226 | fi | |
6227 | fi | |
6228 | ||
0aebab04 LY |
6229 | # Thread sanitizer is, for now, much noisier than the other sanitizers; |
6230 | # keep it separate until that is not the case. | |
6231 | if test "$tsan" = "yes" && test "$sanitizers" = "yes"; then | |
6232 | error_exit "TSAN is not supported with other sanitiziers." | |
6233 | fi | |
6234 | have_tsan=no | |
6235 | have_tsan_iface_fiber=no | |
6236 | if test "$tsan" = "yes" ; then | |
6237 | write_c_skeleton | |
6238 | if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then | |
6239 | have_tsan=yes | |
6240 | fi | |
6241 | cat > $TMPC << EOF | |
6242 | #include <sanitizer/tsan_interface.h> | |
6243 | int main(void) { | |
6244 | __tsan_create_fiber(0); | |
6245 | return 0; | |
6246 | } | |
6247 | EOF | |
6248 | if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then | |
6249 | have_tsan_iface_fiber=yes | |
6250 | fi | |
6251 | fi | |
6252 | ||
17824406 JH |
6253 | ########################################## |
6254 | # check for libpmem | |
6255 | ||
6256 | if test "$libpmem" != "no"; then | |
6257 | if $pkg_config --exists "libpmem"; then | |
6258 | libpmem="yes" | |
6259 | libpmem_libs=$($pkg_config --libs libpmem) | |
6260 | libpmem_cflags=$($pkg_config --cflags libpmem) | |
6261 | libs_softmmu="$libs_softmmu $libpmem_libs" | |
6262 | QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags" | |
6263 | else | |
6264 | if test "$libpmem" = "yes" ; then | |
6265 | feature_not_found "libpmem" "Install nvml or pmdk" | |
6266 | fi | |
6267 | libpmem="no" | |
6268 | fi | |
6269 | fi | |
6270 | ||
675b9b53 MAL |
6271 | ########################################## |
6272 | # check for slirp | |
6273 | ||
d599938a LV |
6274 | # slirp is only required when building softmmu targets |
6275 | if test -z "$slirp" -a "$softmmu" != "yes" ; then | |
6276 | slirp="no" | |
6277 | fi | |
6278 | ||
675b9b53 MAL |
6279 | case "$slirp" in |
6280 | "" | yes) | |
6281 | if $pkg_config slirp; then | |
6282 | slirp=system | |
7c57bdd8 MAL |
6283 | elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then |
6284 | slirp=git | |
675b9b53 MAL |
6285 | elif test -e "${source_path}/slirp/Makefile" ; then |
6286 | slirp=internal | |
6287 | elif test -z "$slirp" ; then | |
6288 | slirp=no | |
6289 | else | |
6290 | feature_not_found "slirp" "Install slirp devel or git submodule" | |
6291 | fi | |
6292 | ;; | |
6293 | ||
6294 | system) | |
6295 | if ! $pkg_config slirp; then | |
6296 | feature_not_found "slirp" "Install slirp devel" | |
6297 | fi | |
6298 | ;; | |
6299 | esac | |
6300 | ||
6301 | case "$slirp" in | |
7c57bdd8 MAL |
6302 | git | internal) |
6303 | if test "$slirp" = git; then | |
6304 | git_submodules="${git_submodules} slirp" | |
6305 | fi | |
675b9b53 MAL |
6306 | mkdir -p slirp |
6307 | slirp_cflags="-I\$(SRC_PATH)/slirp/src -I\$(BUILD_DIR)/slirp/src" | |
6308 | slirp_libs="-L\$(BUILD_DIR)/slirp -lslirp" | |
b965e8c5 PB |
6309 | if test "$mingw32" = "yes" ; then |
6310 | slirp_libs="$slirp_libs -lws2_32 -liphlpapi" | |
6311 | fi | |
675b9b53 MAL |
6312 | ;; |
6313 | ||
6314 | system) | |
6315 | slirp_version=$($pkg_config --modversion slirp 2>/dev/null) | |
6316 | slirp_cflags=$($pkg_config --cflags slirp 2>/dev/null) | |
6317 | slirp_libs=$($pkg_config --libs slirp 2>/dev/null) | |
6318 | ;; | |
6319 | ||
6320 | no) | |
6321 | ;; | |
6322 | *) | |
6323 | error_exit "Unknown state for slirp: $slirp" | |
6324 | ;; | |
6325 | esac | |
6326 | ||
54e7aac0 AK |
6327 | ########################################## |
6328 | # check for usable __NR_keyctl syscall | |
6329 | ||
6330 | if test "$linux" = "yes" ; then | |
6331 | ||
6332 | have_keyring=no | |
6333 | cat > $TMPC << EOF | |
6334 | #include <errno.h> | |
6335 | #include <asm/unistd.h> | |
6336 | #include <linux/keyctl.h> | |
6337 | #include <unistd.h> | |
6338 | int main(void) { | |
6339 | return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0); | |
6340 | } | |
6341 | EOF | |
6342 | if compile_prog "" "" ; then | |
6343 | have_keyring=yes | |
6344 | fi | |
6345 | fi | |
6346 | if test "$secret_keyring" != "no" | |
6347 | then | |
6348 | if test "$have_keyring" == "yes" | |
6349 | then | |
6350 | secret_keyring=yes | |
6351 | else | |
6352 | if test "$secret_keyring" = "yes" | |
6353 | then | |
6354 | error_exit "syscall __NR_keyctl requested, \ | |
6355 | but not implemented on your system" | |
6356 | else | |
6357 | secret_keyring=no | |
6358 | fi | |
6359 | fi | |
6360 | fi | |
6361 | ||
92500362 AK |
6362 | ########################################## |
6363 | # check for usable keyutils.h | |
6364 | ||
6365 | if test "$linux" = "yes" ; then | |
6366 | ||
6367 | have_keyutils=no | |
6368 | cat > $TMPC << EOF | |
6369 | #include <errno.h> | |
6370 | #include <asm/unistd.h> | |
6371 | #include <unistd.h> | |
6372 | #include <sys/types.h> | |
6373 | #include <keyutils.h> | |
6374 | int main(void) { | |
6375 | return request_key("user", NULL, NULL, 0); | |
6376 | } | |
6377 | EOF | |
6378 | if compile_prog "" "-lkeyutils"; then | |
6379 | have_keyutils=yes | |
6380 | fi | |
6381 | fi | |
6382 | ||
675b9b53 | 6383 | |
7e24e92a | 6384 | ########################################## |
e86ecd4b JQ |
6385 | # End of CC checks |
6386 | # After here, no more $cc or $ld runs | |
6387 | ||
d83414e1 MAL |
6388 | write_c_skeleton |
6389 | ||
1d728c39 | 6390 | if test "$gcov" = "yes" ; then |
db5adeaa PB |
6391 | QEMU_CFLAGS="-fprofile-arcs -ftest-coverage -g $QEMU_CFLAGS" |
6392 | QEMU_LDFLAGS="-fprofile-arcs -ftest-coverage $QEMU_LDFLAGS" | |
b553a042 | 6393 | elif test "$fortify_source" = "yes" ; then |
e600cdf3 | 6394 | CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" |
48e56d50 PB |
6395 | elif test "$debug" = "no"; then |
6396 | CFLAGS="-O2 $CFLAGS" | |
e86ecd4b | 6397 | fi |
a316e378 | 6398 | |
247724cb | 6399 | if test "$have_asan" = "yes"; then |
db5adeaa PB |
6400 | QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS" |
6401 | QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS" | |
d83414e1 MAL |
6402 | if test "$have_asan_iface_h" = "no" ; then |
6403 | echo "ASAN build enabled, but ASAN header missing." \ | |
6404 | "Without code annotation, the report may be inferior." | |
6405 | elif test "$have_asan_iface_fiber" = "no" ; then | |
6406 | echo "ASAN build enabled, but ASAN header is too old." \ | |
6407 | "Without code annotation, the report may be inferior." | |
6408 | fi | |
247724cb | 6409 | fi |
0aebab04 LY |
6410 | if test "$have_tsan" = "yes" ; then |
6411 | if test "$have_tsan_iface_fiber" = "yes" ; then | |
6412 | QEMU_CFLAGS="-fsanitize=thread $QEMU_CFLAGS" | |
6413 | QEMU_LDFLAGS="-fsanitize=thread $QEMU_LDFLAGS" | |
6414 | else | |
6415 | error_exit "Cannot enable TSAN due to missing fiber annotation interface." | |
6416 | fi | |
6417 | elif test "$tsan" = "yes" ; then | |
6418 | error_exit "Cannot enable TSAN due to missing sanitize thread interface." | |
6419 | fi | |
247724cb | 6420 | if test "$have_ubsan" = "yes"; then |
db5adeaa PB |
6421 | QEMU_CFLAGS="-fsanitize=undefined $QEMU_CFLAGS" |
6422 | QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS" | |
247724cb MAL |
6423 | fi |
6424 | ||
6542aa9c PL |
6425 | ########################################## |
6426 | # Do we have libnfs | |
6427 | if test "$libnfs" != "no" ; then | |
b7d769c9 | 6428 | if $pkg_config --atleast-version=1.9.3 libnfs; then |
6542aa9c PL |
6429 | libnfs="yes" |
6430 | libnfs_libs=$($pkg_config --libs libnfs) | |
6542aa9c PL |
6431 | else |
6432 | if test "$libnfs" = "yes" ; then | |
8efc9363 | 6433 | feature_not_found "libnfs" "Install libnfs devel >= 1.9.3" |
6542aa9c PL |
6434 | fi |
6435 | libnfs="no" | |
6436 | fi | |
6437 | fi | |
1d728c39 | 6438 | |
3efac6eb TG |
6439 | ########################################## |
6440 | # Do we have libudev | |
6441 | if test "$libudev" != "no" ; then | |
6442 | if $pkg_config libudev && test "$static" != "yes"; then | |
6443 | libudev="yes" | |
6444 | libudev_libs=$($pkg_config --libs libudev) | |
6445 | else | |
6446 | libudev="no" | |
6447 | fi | |
6448 | fi | |
6449 | ||
6ca026cb PM |
6450 | # Now we've finished running tests it's OK to add -Werror to the compiler flags |
6451 | if test "$werror" = "yes"; then | |
6452 | QEMU_CFLAGS="-Werror $QEMU_CFLAGS" | |
6453 | fi | |
6454 | ||
0aebab04 LY |
6455 | # Exclude --warn-common with TSan to suppress warnings from the TSan libraries. |
6456 | if test "$solaris" = "no" && test "$tsan" = "no"; then | |
e86ecd4b | 6457 | if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then |
db5adeaa | 6458 | QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS" |
e86ecd4b JQ |
6459 | fi |
6460 | fi | |
6461 | ||
94dd53c5 GH |
6462 | # test if pod2man has --utf8 option |
6463 | if pod2man --help | grep -q utf8; then | |
6464 | POD2MAN="pod2man --utf8" | |
6465 | else | |
6466 | POD2MAN="pod2man" | |
6467 | fi | |
6468 | ||
952afb71 BS |
6469 | # Use ASLR, no-SEH and DEP if available |
6470 | if test "$mingw32" = "yes" ; then | |
6471 | for flag in --dynamicbase --no-seh --nxcompat; do | |
e9a3591f | 6472 | if ld_has $flag ; then |
db5adeaa | 6473 | QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS" |
952afb71 BS |
6474 | fi |
6475 | done | |
6476 | fi | |
6477 | ||
7776ea6b PMD |
6478 | # Disable OpenBSD W^X if available |
6479 | if test "$tcg" = "yes" && test "$targetos" = "OpenBSD"; then | |
6480 | cat > $TMPC <<EOF | |
6481 | int main(void) { return 0; } | |
6482 | EOF | |
6483 | wx_ldflags="-Wl,-z,wxneeded" | |
6484 | if compile_prog "" "$wx_ldflags"; then | |
6485 | QEMU_LDFLAGS="$QEMU_LDFLAGS $wx_ldflags" | |
6486 | fi | |
6487 | fi | |
6488 | ||
10ea68b3 | 6489 | qemu_confdir=$sysconfdir$confsuffix |
e26110cf | 6490 | qemu_moddir=$libdir$confsuffix |
528ae5b8 | 6491 | qemu_datadir=$datadir$confsuffix |
834574ea | 6492 | qemu_localedir="$datadir/locale" |
a8260d38 | 6493 | qemu_icondir="$datadir/icons" |
67ea9546 | 6494 | qemu_desktopdir="$datadir/applications" |
e7b45cc4 | 6495 | |
e0580342 KR |
6496 | # We can only support ivshmem if we have eventfd |
6497 | if [ "$eventfd" = "yes" ]; then | |
6498 | ivshmem=yes | |
6499 | fi | |
6500 | ||
4b1c11fd DB |
6501 | tools="" |
6502 | if test "$want_tools" = "yes" ; then | |
72d277a7 | 6503 | tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) qemu-edid\$(EXESUF) $tools" |
4b1c11fd | 6504 | if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then |
f353415f | 6505 | tools="qemu-nbd\$(EXESUF) qemu-storage-daemon\$(EXESUF) $tools" |
b1449edb KR |
6506 | fi |
6507 | if [ "$ivshmem" = "yes" ]; then | |
a75eb03b | 6508 | tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools" |
4b1c11fd | 6509 | fi |
1b9d35f3 VP |
6510 | if [ "$curl" = "yes" ]; then |
6511 | tools="elf2dmp\$(EXESUF) $tools" | |
3fa2d384 | 6512 | fi |
4b1c11fd DB |
6513 | fi |
6514 | if test "$softmmu" = yes ; then | |
b855f8d1 | 6515 | if test "$linux" = yes; then |
7e462613 | 6516 | if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; then |
aabfd88d | 6517 | virtfs=yes |
fdbff6bd | 6518 | helpers="$helpers fsdev/virtfs-proxy-helper\$(EXESUF)" |
aabfd88d AF |
6519 | else |
6520 | if test "$virtfs" = yes; then | |
7e462613 | 6521 | error_exit "VirtFS requires libcap-ng devel and libattr devel" |
983eef5a | 6522 | fi |
17500370 | 6523 | virtfs=no |
aabfd88d | 6524 | fi |
fe8fc5ae PB |
6525 | if test "$mpath" != no && test "$mpathpersist" = yes ; then |
6526 | mpath=yes | |
6527 | else | |
6528 | if test "$mpath" = yes; then | |
6529 | error_exit "Multipath requires libmpathpersist devel" | |
6530 | fi | |
6531 | mpath=no | |
6532 | fi | |
fdbff6bd | 6533 | helpers="$helpers scsi/qemu-pr-helper\$(EXESUF)" |
b855f8d1 PB |
6534 | else |
6535 | if test "$virtfs" = yes; then | |
6536 | error_exit "VirtFS is supported only on Linux" | |
6537 | fi | |
6538 | virtfs=no | |
fe8fc5ae PB |
6539 | if test "$mpath" = yes; then |
6540 | error_exit "Multipath is supported only on Linux" | |
6541 | fi | |
6542 | mpath=no | |
17bff52b | 6543 | fi |
ff69fd8c LV |
6544 | if test "$xkbcommon" = "yes"; then |
6545 | tools="qemu-keymap\$(EXESUF) $tools" | |
6546 | fi | |
6a021536 | 6547 | fi |
9d6bc27b MR |
6548 | |
6549 | # Probe for guest agent support/options | |
6550 | ||
e8ef31a3 | 6551 | if [ "$guest_agent" != "no" ]; then |
a5125905 LV |
6552 | if [ "$softmmu" = no -a "$want_tools" = no ] ; then |
6553 | guest_agent=no | |
6554 | elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then | |
0814465a | 6555 | tools="qemu-ga\$(EXESUF) $tools" |
e8ef31a3 MT |
6556 | guest_agent=yes |
6557 | elif [ "$guest_agent" != yes ]; then | |
6558 | guest_agent=no | |
6559 | else | |
6560 | error_exit "Guest agent is not supported on this platform" | |
ca35f780 | 6561 | fi |
00c705fb | 6562 | fi |
ca35f780 | 6563 | |
9d6bc27b MR |
6564 | # Guest agent Window MSI package |
6565 | ||
6566 | if test "$guest_agent" != yes; then | |
6567 | if test "$guest_agent_msi" = yes; then | |
6568 | error_exit "MSI guest agent package requires guest agent enabled" | |
6569 | fi | |
6570 | guest_agent_msi=no | |
6571 | elif test "$mingw32" != "yes"; then | |
6572 | if test "$guest_agent_msi" = "yes"; then | |
6573 | error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" | |
6574 | fi | |
6575 | guest_agent_msi=no | |
6576 | elif ! has wixl; then | |
6577 | if test "$guest_agent_msi" = "yes"; then | |
6578 | error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" | |
6579 | fi | |
6580 | guest_agent_msi=no | |
1a34904e MR |
6581 | else |
6582 | # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't | |
6583 | # disabled explicitly | |
6584 | if test "$guest_agent_msi" != "no"; then | |
6585 | guest_agent_msi=yes | |
6586 | fi | |
9d6bc27b MR |
6587 | fi |
6588 | ||
1a34904e | 6589 | if test "$guest_agent_msi" = "yes"; then |
9d6bc27b MR |
6590 | if test "$guest_agent_with_vss" = "yes"; then |
6591 | QEMU_GA_MSI_WITH_VSS="-D InstallVss" | |
6592 | fi | |
6593 | ||
6594 | if test "$QEMU_GA_MANUFACTURER" = ""; then | |
6595 | QEMU_GA_MANUFACTURER=QEMU | |
6596 | fi | |
6597 | ||
6598 | if test "$QEMU_GA_DISTRO" = ""; then | |
6599 | QEMU_GA_DISTRO=Linux | |
6600 | fi | |
6601 | ||
6602 | if test "$QEMU_GA_VERSION" = ""; then | |
89138857 | 6603 | QEMU_GA_VERSION=$(cat $source_path/VERSION) |
9d6bc27b MR |
6604 | fi |
6605 | ||
89138857 | 6606 | QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin" |
9d6bc27b MR |
6607 | |
6608 | case "$cpu" in | |
6609 | x86_64) | |
6610 | QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" | |
6611 | ;; | |
6612 | i386) | |
6613 | QEMU_GA_MSI_ARCH="-D Arch=32" | |
6614 | ;; | |
6615 | *) | |
6616 | error_exit "CPU $cpu not supported for building installation package" | |
6617 | ;; | |
6618 | esac | |
6619 | fi | |
6620 | ||
ca35f780 PB |
6621 | # Mac OS X ships with a broken assembler |
6622 | roms= | |
e633a5c6 EB |
6623 | if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ |
6624 | test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \ | |
6625 | test "$softmmu" = yes ; then | |
e57218b6 | 6626 | # Different host OS linkers have different ideas about the name of the ELF |
c65d5e4e BS |
6627 | # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd |
6628 | # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. | |
6629 | for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do | |
e57218b6 PM |
6630 | if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then |
6631 | ld_i386_emulation="$emu" | |
6632 | roms="optionrom" | |
6633 | break | |
6634 | fi | |
6635 | done | |
ca35f780 | 6636 | fi |
ca35f780 | 6637 | |
2e33c3f8 | 6638 | # Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 |
9933c305 | 6639 | if test "$cpu" = "s390x" ; then |
2e33c3f8 TH |
6640 | write_c_skeleton |
6641 | if compile_prog "-march=z900" ""; then | |
6642 | roms="$roms s390-ccw" | |
1ef6bfc2 PMD |
6643 | # SLOF is required for building the s390-ccw firmware on s390x, |
6644 | # since it is using the libnet code from SLOF for network booting. | |
6645 | if test -e "${source_path}/.git" ; then | |
6646 | git_submodules="${git_submodules} roms/SLOF" | |
6647 | fi | |
2e33c3f8 | 6648 | fi |
9933c305 CB |
6649 | fi |
6650 | ||
11cde1c8 BD |
6651 | # Check that the C++ compiler exists and works with the C compiler. |
6652 | # All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added. | |
6653 | if has $cxx; then | |
6654 | cat > $TMPC <<EOF | |
6655 | int c_function(void); | |
6656 | int main(void) { return c_function(); } | |
6657 | EOF | |
6658 | ||
6659 | compile_object | |
6660 | ||
6661 | cat > $TMPCXX <<EOF | |
6662 | extern "C" { | |
6663 | int c_function(void); | |
6664 | } | |
6665 | int c_function(void) { return 42; } | |
6666 | EOF | |
6667 | ||
6668 | update_cxxflags | |
6669 | ||
db5adeaa | 6670 | if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then |
11cde1c8 BD |
6671 | # C++ compiler $cxx works ok with C compiler $cc |
6672 | : | |
6673 | else | |
6674 | echo "C++ compiler $cxx does not work with C compiler $cc" | |
6675 | echo "Disabling C++ specific optional code" | |
6676 | cxx= | |
6677 | fi | |
6678 | else | |
6679 | echo "No C++ compiler available; disabling C++ specific optional code" | |
6680 | cxx= | |
6681 | fi | |
6682 | ||
02d34f62 CR |
6683 | echo_version() { |
6684 | if test "$1" = "yes" ; then | |
6685 | echo "($2)" | |
6686 | fi | |
6687 | } | |
6688 | ||
50e12060 JK |
6689 | # prepend pixman and ftd flags after all config tests are done |
6690 | QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS" | |
8a99e9a3 | 6691 | QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS" |
50e12060 | 6692 | libs_softmmu="$pixman_libs $libs_softmmu" |
5ca9388a | 6693 | |
43ce4dfe | 6694 | echo "Install prefix $prefix" |
89138857 | 6695 | echo "BIOS directory $(eval echo $qemu_datadir)" |
3d5eecab | 6696 | echo "firmware path $(eval echo $firmwarepath)" |
89138857 SW |
6697 | echo "binary directory $(eval echo $bindir)" |
6698 | echo "library directory $(eval echo $libdir)" | |
6699 | echo "module directory $(eval echo $qemu_moddir)" | |
6700 | echo "libexec directory $(eval echo $libexecdir)" | |
6701 | echo "include directory $(eval echo $includedir)" | |
6702 | echo "config directory $(eval echo $sysconfdir)" | |
11d9f695 | 6703 | if test "$mingw32" = "no" ; then |
89138857 SW |
6704 | echo "local state directory $(eval echo $local_statedir)" |
6705 | echo "Manual directory $(eval echo $mandir)" | |
43ce4dfe | 6706 | echo "ELF interp prefix $interp_prefix" |
5a699bbb LE |
6707 | else |
6708 | echo "local state directory queried at runtime" | |
d9840e25 | 6709 | echo "Windows SDK $win_sdk" |
11d9f695 | 6710 | fi |
bc4486fb | 6711 | echo "Build directory $(pwd)" |
5a67135a | 6712 | echo "Source path $source_path" |
cc84d63a | 6713 | echo "GIT binary $git" |
aef45d51 | 6714 | echo "GIT submodules $git_submodules" |
43ce4dfe | 6715 | echo "C compiler $cc" |
83469015 | 6716 | echo "Host C compiler $host_cc" |
83f73fce | 6717 | echo "C++ compiler $cxx" |
3c4a4d0d | 6718 | echo "Objective-C compiler $objcc" |
45d285ab | 6719 | echo "ARFLAGS $ARFLAGS" |
0c439cbf | 6720 | echo "CFLAGS $CFLAGS" |
a558ee17 | 6721 | echo "QEMU_CFLAGS $QEMU_CFLAGS" |
8a99e9a3 | 6722 | echo "QEMU_LDFLAGS $QEMU_LDFLAGS" |
43ce4dfe | 6723 | echo "make $make" |
6a882643 | 6724 | echo "install $install" |
755ee70f | 6725 | echo "python $python ($python_version)" |
2eb054c2 PM |
6726 | if test "$docs" != "no"; then |
6727 | echo "sphinx-build $sphinx_build" | |
6728 | fi | |
39d87c8c | 6729 | echo "genisoimage $genisoimage" |
675b9b53 MAL |
6730 | echo "slirp support $slirp $(echo_version $slirp $slirp_version)" |
6731 | if test "$slirp" != "no" ; then | |
e2d8830e BS |
6732 | echo "smbd $smbd" |
6733 | fi | |
17969268 | 6734 | echo "module support $modules" |
bd83c861 | 6735 | echo "alt path mod load $module_upgrades" |
43ce4dfe | 6736 | echo "host CPU $cpu" |
de83cd02 | 6737 | echo "host big endian $bigendian" |
97a847bc | 6738 | echo "target list $target_list" |
43ce4dfe | 6739 | echo "gprof enabled $gprof" |
03b4fe7d | 6740 | echo "sparse enabled $sparse" |
1625af87 | 6741 | echo "strip binaries $strip_opt" |
05c2a3e7 | 6742 | echo "profiler $profiler" |
43ce4dfe | 6743 | echo "static build $static" |
5b0753e0 FB |
6744 | if test "$darwin" = "yes" ; then |
6745 | echo "Cocoa support $cocoa" | |
6746 | fi | |
89138857 | 6747 | echo "SDL support $sdl $(echo_version $sdl $sdlversion)" |
a442fe2f | 6748 | echo "SDL image support $sdl_image" |
89138857 | 6749 | echo "GTK support $gtk $(echo_version $gtk $gtk_version)" |
925a0400 | 6750 | echo "GTK GL support $gtk_gl" |
89138857 | 6751 | echo "VTE support $vte $(echo_version $vte $vteversion)" |
a1c5e949 | 6752 | echo "TLS priority $tls_priority" |
ddbb0d09 | 6753 | echo "GNUTLS support $gnutls" |
91bfcdb0 | 6754 | echo "libgcrypt $gcrypt" |
e0576942 DB |
6755 | if test "$gcrypt" = "yes" |
6756 | then | |
6757 | echo " hmac $gcrypt_hmac" | |
6758 | echo " XTS $gcrypt_xts" | |
6759 | fi | |
89138857 | 6760 | echo "nettle $nettle $(echo_version $nettle $nettle_version)" |
dc2207af DB |
6761 | if test "$nettle" = "yes" |
6762 | then | |
6763 | echo " XTS $nettle_xts" | |
6764 | fi | |
9a2fd434 | 6765 | echo "libtasn1 $tasn1" |
8953caf3 | 6766 | echo "PAM $auth_pam" |
e08bb301 | 6767 | echo "iconv support $iconv" |
4d3b6f6e | 6768 | echo "curses support $curses" |
47479c55 | 6769 | echo "virgl support $virglrenderer $(echo_version $virglrenderer $virgl_version)" |
769ce76d | 6770 | echo "curl support $curl" |
67b915a5 | 6771 | echo "mingw32 support $mingw32" |
0c58ac1c | 6772 | echo "Audio drivers $audio_drv_list" |
b64ec4e4 FZ |
6773 | echo "Block whitelist (rw) $block_drv_rw_whitelist" |
6774 | echo "Block whitelist (ro) $block_drv_ro_whitelist" | |
983eef5a | 6775 | echo "VirtFS support $virtfs" |
fe8fc5ae | 6776 | echo "Multipath support $mpath" |
821601ea JS |
6777 | echo "VNC support $vnc" |
6778 | if test "$vnc" = "yes" ; then | |
821601ea JS |
6779 | echo "VNC SASL support $vnc_sasl" |
6780 | echo "VNC JPEG support $vnc_jpeg" | |
6781 | echo "VNC PNG support $vnc_png" | |
821601ea | 6782 | fi |
e37630ca | 6783 | echo "xen support $xen" |
3996e85c PD |
6784 | if test "$xen" = "yes" ; then |
6785 | echo "xen ctrl version $xen_ctrl_version" | |
6786 | fi | |
2e4d9fb1 | 6787 | echo "brlapi support $brlapi" |
a25dba17 | 6788 | echo "Documentation $docs" |
40d6444e | 6789 | echo "PIE $pie" |
8a16d273 | 6790 | echo "vde support $vde" |
58952137 | 6791 | echo "netmap support $netmap" |
5c6c3a6c | 6792 | echo "Linux AIO support $linux_aio" |
c10dd856 | 6793 | echo "Linux io_uring support $linux_io_uring" |
758e8e38 | 6794 | echo "ATTR/XATTR support $attr" |
77755340 | 6795 | echo "Install blobs $blobs" |
b31a0277 | 6796 | echo "KVM support $kvm" |
b0cb0a66 | 6797 | echo "HAX support $hax" |
c97d6d2c | 6798 | echo "HVF support $hvf" |
d661d9a4 | 6799 | echo "WHPX support $whpx" |
b3f6ea7e PB |
6800 | echo "TCG support $tcg" |
6801 | if test "$tcg" = "yes" ; then | |
6802 | echo "TCG debug enabled $debug_tcg" | |
6803 | echo "TCG interpreter $tcg_interpreter" | |
6804 | fi | |
5a22ab71 | 6805 | echo "malloc trim support $malloc_trim" |
2da776db | 6806 | echo "RDMA support $rdma" |
21ab34c9 | 6807 | echo "PVRDMA support $pvrdma" |
f652e6af | 6808 | echo "fdt support $fdt" |
a40161cb | 6809 | echo "membarrier $membarrier" |
ceb42de8 | 6810 | echo "preadv support $preadv" |
5f6b9e8f | 6811 | echo "fdatasync $fdatasync" |
e78815a5 AF |
6812 | echo "madvise $madvise" |
6813 | echo "posix_madvise $posix_madvise" | |
9bc5a719 | 6814 | echo "posix_memalign $posix_memalign" |
47e98658 | 6815 | echo "libcap-ng support $cap_ng" |
d5970055 | 6816 | echo "vhost-net support $vhost_net" |
042cea27 | 6817 | echo "vhost-crypto support $vhost_crypto" |
5e9be92d | 6818 | echo "vhost-scsi support $vhost_scsi" |
fc0b9b0e | 6819 | echo "vhost-vsock support $vhost_vsock" |
e6a74868 | 6820 | echo "vhost-user support $vhost_user" |
98fc1ada | 6821 | echo "vhost-user-fs support $vhost_user_fs" |
5b808275 | 6822 | echo "Trace backends $trace_backends" |
713572a7 | 6823 | if have_backend "simple"; then |
9410b56c | 6824 | echo "Trace output file $trace_file-<pid>" |
e00e36fb | 6825 | fi |
89138857 | 6826 | echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)" |
f27aaf4b | 6827 | echo "rbd support $rbd" |
dce512de | 6828 | echo "xfsctl support $xfs" |
7b02f544 | 6829 | echo "smartcard support $smartcard" |
2b2325ff | 6830 | echo "libusb $libusb" |
69354a83 | 6831 | echo "usb net redir $usb_redir" |
da076ffe | 6832 | echo "OpenGL support $opengl" |
014cb152 | 6833 | echo "OpenGL dmabufs $opengl_dmabuf" |
c589b249 | 6834 | echo "libiscsi support $libiscsi" |
6542aa9c | 6835 | echo "libnfs support $libnfs" |
d138cee9 | 6836 | echo "build guest agent $guest_agent" |
d9840e25 | 6837 | echo "QGA VSS support $guest_agent_with_vss" |
50cbebb9 | 6838 | echo "QGA w32 disk info $guest_agent_ntddscsi" |
4c875d89 | 6839 | echo "QGA MSI support $guest_agent_msi" |
f794573e | 6840 | echo "seccomp support $seccomp" |
7c2acc70 | 6841 | echo "coroutine backend $coroutine" |
70c60c08 | 6842 | echo "coroutine pool $coroutine_pool" |
7d992e4d | 6843 | echo "debug stack usage $debug_stack_usage" |
ba59fb77 | 6844 | echo "mutex debugging $debug_mutex" |
f0d92b56 | 6845 | echo "crypto afalg $crypto_afalg" |
eb100396 | 6846 | echo "GlusterFS support $glusterfs" |
1d728c39 BS |
6847 | echo "gcov $gcov_tool" |
6848 | echo "gcov enabled $gcov" | |
ab214c29 | 6849 | echo "TPM support $tpm" |
b10d49d7 | 6850 | echo "libssh support $libssh" |
3556c233 | 6851 | echo "QOM debugging $qom_cast_debug" |
ed1701c6 | 6852 | echo "Live block migration $live_block_migration" |
607dacd0 QN |
6853 | echo "lzo support $lzo" |
6854 | echo "snappy support $snappy" | |
6b383c08 | 6855 | echo "bzip2 support $bzip2" |
83bc1f97 | 6856 | echo "lzfse support $lzfse" |
3a678481 | 6857 | echo "zstd support $zstd" |
a99d57bb | 6858 | echo "NUMA host support $numa" |
ed279a06 | 6859 | echo "libxml2 $libxml2" |
2847b469 | 6860 | echo "tcmalloc support $tcmalloc" |
7b01cb97 | 6861 | echo "jemalloc support $jemalloc" |
99f2dbd3 | 6862 | echo "avx2 optimization $avx2_opt" |
6b8cd447 | 6863 | echo "avx512f optimization $avx512f_opt" |
a6b1d4c0 | 6864 | echo "replication support $replication" |
da92c3ff | 6865 | echo "VxHS block device $vxhs" |
2f740136 JC |
6866 | echo "bochs support $bochs" |
6867 | echo "cloop support $cloop" | |
6868 | echo "dmg support $dmg" | |
6869 | echo "qcow v1 support $qcow1" | |
6870 | echo "vdi support $vdi" | |
6871 | echo "vvfat support $vvfat" | |
6872 | echo "qed support $qed" | |
6873 | echo "parallels support $parallels" | |
6874 | echo "sheepdog support $sheepdog" | |
8ca80760 | 6875 | echo "capstone $capstone" |
17824406 | 6876 | echo "libpmem support $libpmem" |
3efac6eb | 6877 | echo "libudev $libudev" |
f3494749 | 6878 | echo "default devices $default_devices" |
40e8c6f4 | 6879 | echo "plugin support $plugins" |
adc28027 | 6880 | echo "fuzzing support $fuzzing" |
f48e590a | 6881 | echo "gdb $gdb_bin" |
b767d257 | 6882 | echo "rng-none $rng_none" |
54e7aac0 | 6883 | echo "Linux keyring $secret_keyring" |
67b915a5 | 6884 | |
898be3e0 PM |
6885 | if test "$supported_cpu" = "no"; then |
6886 | echo | |
6887 | echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!" | |
6888 | echo | |
6889 | echo "CPU host architecture $cpu support is not currently maintained." | |
6890 | echo "The QEMU project intends to remove support for this host CPU in" | |
6891 | echo "a future release if nobody volunteers to maintain it and to" | |
6892 | echo "provide a build host for our continuous integration setup." | |
6893 | echo "configure has succeeded and you can continue to build, but" | |
6894 | echo "if you care about QEMU on this platform you should contact" | |
6895 | echo "us upstream at qemu-devel@nongnu.org." | |
6896 | fi | |
6897 | ||
6898 | if test "$supported_os" = "no"; then | |
6899 | echo | |
6900 | echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!" | |
6901 | echo | |
c50126aa PM |
6902 | echo "Host OS $targetos support is not currently maintained." |
6903 | echo "The QEMU project intends to remove support for this host OS in" | |
898be3e0 PM |
6904 | echo "a future release if nobody volunteers to maintain it and to" |
6905 | echo "provide a build host for our continuous integration setup." | |
6906 | echo "configure has succeeded and you can continue to build, but" | |
6907 | echo "if you care about QEMU on this platform you should contact" | |
6908 | echo "us upstream at qemu-devel@nongnu.org." | |
6909 | fi | |
6910 | ||
98ec69ac | 6911 | config_host_mak="config-host.mak" |
98ec69ac | 6912 | |
dbd99ae3 SW |
6913 | echo "# Automatically generated by configure - do not modify" >config-all-disas.mak |
6914 | ||
98ec69ac | 6915 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
98ec69ac | 6916 | echo >> $config_host_mak |
98ec69ac | 6917 | |
e6c3b0f7 | 6918 | echo all: >> $config_host_mak |
99d7cc75 PB |
6919 | echo "prefix=$prefix" >> $config_host_mak |
6920 | echo "bindir=$bindir" >> $config_host_mak | |
3aa5d2be | 6921 | echo "libdir=$libdir" >> $config_host_mak |
8bf188aa | 6922 | echo "libexecdir=$libexecdir" >> $config_host_mak |
0f94d6da | 6923 | echo "includedir=$includedir" >> $config_host_mak |
99d7cc75 | 6924 | echo "mandir=$mandir" >> $config_host_mak |
99d7cc75 | 6925 | echo "sysconfdir=$sysconfdir" >> $config_host_mak |
22d07038 | 6926 | echo "qemu_confdir=$qemu_confdir" >> $config_host_mak |
9afa52ce | 6927 | echo "qemu_datadir=$qemu_datadir" >> $config_host_mak |
3d5eecab | 6928 | echo "qemu_firmwarepath=$firmwarepath" >> $config_host_mak |
9afa52ce | 6929 | echo "qemu_docdir=$qemu_docdir" >> $config_host_mak |
e26110cf | 6930 | echo "qemu_moddir=$qemu_moddir" >> $config_host_mak |
5a699bbb LE |
6931 | if test "$mingw32" = "no" ; then |
6932 | echo "qemu_localstatedir=$local_statedir" >> $config_host_mak | |
6933 | fi | |
f354b1a1 | 6934 | echo "qemu_helperdir=$libexecdir" >> $config_host_mak |
834574ea | 6935 | echo "qemu_localedir=$qemu_localedir" >> $config_host_mak |
a8260d38 | 6936 | echo "qemu_icondir=$qemu_icondir" >> $config_host_mak |
67ea9546 | 6937 | echo "qemu_desktopdir=$qemu_desktopdir" >> $config_host_mak |
02f9135b | 6938 | echo "libs_cpu=$libs_cpu" >> $config_host_mak |
f544a488 | 6939 | echo "libs_softmmu=$libs_softmmu" >> $config_host_mak |
cc84d63a | 6940 | echo "GIT=$git" >> $config_host_mak |
aef45d51 | 6941 | echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak |
f62bbee5 | 6942 | echo "GIT_UPDATE=$git_update" >> $config_host_mak |
804edf29 | 6943 | |
98ec69ac | 6944 | echo "ARCH=$ARCH" >> $config_host_mak |
727e5283 | 6945 | |
f3494749 PB |
6946 | if test "$default_devices" = "yes" ; then |
6947 | echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak | |
6948 | else | |
6949 | echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak | |
6950 | fi | |
f8393946 | 6951 | if test "$debug_tcg" = "yes" ; then |
2358a494 | 6952 | echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak |
f8393946 | 6953 | fi |
1625af87 | 6954 | if test "$strip_opt" = "yes" ; then |
52ba784d | 6955 | echo "STRIP=${strip}" >> $config_host_mak |
1625af87 | 6956 | fi |
7d13299d | 6957 | if test "$bigendian" = "yes" ; then |
e2542fe2 | 6958 | echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak |
97a847bc | 6959 | fi |
67b915a5 | 6960 | if test "$mingw32" = "yes" ; then |
98ec69ac | 6961 | echo "CONFIG_WIN32=y" >> $config_host_mak |
89138857 | 6962 | rc_version=$(cat $source_path/VERSION) |
9fe6de94 BS |
6963 | version_major=${rc_version%%.*} |
6964 | rc_version=${rc_version#*.} | |
6965 | version_minor=${rc_version%%.*} | |
6966 | rc_version=${rc_version#*.} | |
6967 | version_subminor=${rc_version%%.*} | |
6968 | version_micro=0 | |
6969 | echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak | |
6970 | echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak | |
d9840e25 TS |
6971 | if test "$guest_agent_with_vss" = "yes" ; then |
6972 | echo "CONFIG_QGA_VSS=y" >> $config_host_mak | |
f33ca81f | 6973 | echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak |
d9840e25 TS |
6974 | echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak |
6975 | fi | |
50cbebb9 | 6976 | if test "$guest_agent_ntddscsi" = "yes" ; then |
76dc75ca | 6977 | echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak |
50cbebb9 | 6978 | fi |
1a34904e | 6979 | if test "$guest_agent_msi" = "yes"; then |
d661d9a4 | 6980 | echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak |
9dacf32d YH |
6981 | echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak |
6982 | echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak | |
6983 | echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak | |
6984 | echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak | |
6985 | echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak | |
6986 | echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak | |
6987 | fi | |
210fa556 | 6988 | else |
35f4df27 | 6989 | echo "CONFIG_POSIX=y" >> $config_host_mak |
dffcb71c MM |
6990 | fi |
6991 | ||
6992 | if test "$linux" = "yes" ; then | |
6993 | echo "CONFIG_LINUX=y" >> $config_host_mak | |
67b915a5 | 6994 | fi |
128ab2ff | 6995 | |
83fb7adf | 6996 | if test "$darwin" = "yes" ; then |
98ec69ac | 6997 | echo "CONFIG_DARWIN=y" >> $config_host_mak |
83fb7adf | 6998 | fi |
b29fe3ed | 6999 | |
ec530c81 | 7000 | if test "$solaris" = "yes" ; then |
98ec69ac | 7001 | echo "CONFIG_SOLARIS=y" >> $config_host_mak |
ec530c81 | 7002 | fi |
179cf400 AF |
7003 | if test "$haiku" = "yes" ; then |
7004 | echo "CONFIG_HAIKU=y" >> $config_host_mak | |
7005 | fi | |
97a847bc | 7006 | if test "$static" = "yes" ; then |
98ec69ac | 7007 | echo "CONFIG_STATIC=y" >> $config_host_mak |
7d13299d | 7008 | fi |
1ba16968 | 7009 | if test "$profiler" = "yes" ; then |
2358a494 | 7010 | echo "CONFIG_PROFILER=y" >> $config_host_mak |
05c2a3e7 | 7011 | fi |
c932ce31 PB |
7012 | if test "$want_tools" = "yes" ; then |
7013 | echo "CONFIG_TOOLS=y" >> $config_host_mak | |
7014 | fi | |
675b9b53 | 7015 | if test "$slirp" != "no"; then |
98ec69ac | 7016 | echo "CONFIG_SLIRP=y" >> $config_host_mak |
e2d8830e | 7017 | echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak |
675b9b53 MAL |
7018 | echo "SLIRP_CFLAGS=$slirp_cflags" >> $config_host_mak |
7019 | echo "SLIRP_LIBS=$slirp_libs" >> $config_host_mak | |
7020 | fi | |
7c57bdd8 | 7021 | if [ "$slirp" = "git" -o "$slirp" = "internal" ]; then |
3b8593ee | 7022 | echo "config-host.h: slirp/all" >> $config_host_mak |
c20709aa | 7023 | fi |
8a16d273 | 7024 | if test "$vde" = "yes" ; then |
98ec69ac | 7025 | echo "CONFIG_VDE=y" >> $config_host_mak |
e2ad6f16 | 7026 | echo "VDE_LIBS=$vde_libs" >> $config_host_mak |
8a16d273 | 7027 | fi |
58952137 VM |
7028 | if test "$netmap" = "yes" ; then |
7029 | echo "CONFIG_NETMAP=y" >> $config_host_mak | |
7030 | fi | |
015a33bd GA |
7031 | if test "$l2tpv3" = "yes" ; then |
7032 | echo "CONFIG_L2TPV3=y" >> $config_host_mak | |
7033 | fi | |
4cc600d2 PB |
7034 | if test "$gprof" = "yes" ; then |
7035 | echo "CONFIG_GPROF=y" >> $config_host_mak | |
7036 | fi | |
47e98658 | 7037 | if test "$cap_ng" = "yes" ; then |
a358bca2 | 7038 | echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak |
47e98658 | 7039 | fi |
2358a494 | 7040 | echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak |
0c58ac1c | 7041 | for drv in $audio_drv_list; do |
1ef1ec2a | 7042 | def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]') |
ce3dc033 | 7043 | case "$drv" in |
051c7d5c | 7044 | alsa | oss | pa | sdl) |
ce3dc033 GH |
7045 | echo "$def=m" >> $config_host_mak ;; |
7046 | *) | |
7047 | echo "$def=y" >> $config_host_mak ;; | |
7048 | esac | |
0c58ac1c | 7049 | done |
b1149911 FZ |
7050 | echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak |
7051 | echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak | |
7052 | echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak | |
7053 | echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak | |
7054 | echo "OSS_LIBS=$oss_libs" >> $config_host_mak | |
2e445703 | 7055 | echo "JACK_LIBS=$jack_libs" >> $config_host_mak |
d5631638 | 7056 | if test "$audio_win_int" = "yes" ; then |
7057 | echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak | |
7058 | fi | |
b64ec4e4 FZ |
7059 | echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak |
7060 | echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak | |
821601ea JS |
7061 | if test "$vnc" = "yes" ; then |
7062 | echo "CONFIG_VNC=y" >> $config_host_mak | |
7063 | fi | |
2f9606b3 | 7064 | if test "$vnc_sasl" = "yes" ; then |
98ec69ac | 7065 | echo "CONFIG_VNC_SASL=y" >> $config_host_mak |
2f9606b3 | 7066 | fi |
821601ea | 7067 | if test "$vnc_jpeg" = "yes" ; then |
2f6f5c7a | 7068 | echo "CONFIG_VNC_JPEG=y" >> $config_host_mak |
2f6f5c7a | 7069 | fi |
821601ea | 7070 | if test "$vnc_png" = "yes" ; then |
efe556ad | 7071 | echo "CONFIG_VNC_PNG=y" >> $config_host_mak |
efe556ad | 7072 | fi |
6a021536 GH |
7073 | if test "$xkbcommon" = "yes" ; then |
7074 | echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak | |
7075 | echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak | |
7076 | fi | |
dce512de CH |
7077 | if test "$xfs" = "yes" ; then |
7078 | echo "CONFIG_XFS=y" >> $config_host_mak | |
7079 | fi | |
89138857 | 7080 | qemu_version=$(head $source_path/VERSION) |
98ec69ac | 7081 | echo "VERSION=$qemu_version" >>$config_host_mak |
2358a494 | 7082 | echo "PKGVERSION=$pkgversion" >>$config_host_mak |
98ec69ac | 7083 | echo "SRC_PATH=$source_path" >> $config_host_mak |
2b1f35b9 | 7084 | echo "TARGET_DIRS=$target_list" >> $config_host_mak |
a25dba17 | 7085 | if [ "$docs" = "yes" ] ; then |
98ec69ac | 7086 | echo "BUILD_DOCS=yes" >> $config_host_mak |
cc8ae6de | 7087 | fi |
17969268 | 7088 | if test "$modules" = "yes"; then |
e26110cf FZ |
7089 | # $shacmd can generate a hash started with digit, which the compiler doesn't |
7090 | # like as an symbol. So prefix it with an underscore | |
89138857 | 7091 | echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak |
17969268 FZ |
7092 | echo "CONFIG_MODULES=y" >> $config_host_mak |
7093 | fi | |
bd83c861 CE |
7094 | if test "$module_upgrades" = "yes"; then |
7095 | echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak | |
7096 | fi | |
e633a5c6 | 7097 | if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then |
8781595b GH |
7098 | echo "CONFIG_X11=y" >> $config_host_mak |
7099 | echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak | |
7100 | echo "X11_LIBS=$x11_libs" >> $config_host_mak | |
7101 | fi | |
1ac88f28 | 7102 | if test "$sdl" = "yes" ; then |
96400a14 | 7103 | echo "CONFIG_SDL=m" >> $config_host_mak |
1ac88f28 | 7104 | echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak |
8ecc89f6 | 7105 | echo "SDL_LIBS=$sdl_libs" >> $config_host_mak |
a442fe2f DB |
7106 | if test "$sdl_image" = "yes" ; then |
7107 | echo "CONFIG_SDL_IMAGE=y" >> $config_host_mak | |
7108 | fi | |
49ecc3fa FB |
7109 | fi |
7110 | if test "$cocoa" = "yes" ; then | |
98ec69ac | 7111 | echo "CONFIG_COCOA=y" >> $config_host_mak |
4d3b6f6e | 7112 | fi |
e08bb301 ST |
7113 | if test "$iconv" = "yes" ; then |
7114 | echo "CONFIG_ICONV=y" >> $config_host_mak | |
7115 | echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak | |
7116 | echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak | |
7117 | fi | |
4d3b6f6e | 7118 | if test "$curses" = "yes" ; then |
2373f7d5 GH |
7119 | echo "CONFIG_CURSES=m" >> $config_host_mak |
7120 | echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak | |
7121 | echo "CURSES_LIBS=$curses_lib" >> $config_host_mak | |
49ecc3fa | 7122 | fi |
099d6b0f | 7123 | if test "$pipe2" = "yes" ; then |
2358a494 | 7124 | echo "CONFIG_PIPE2=y" >> $config_host_mak |
099d6b0f | 7125 | fi |
40ff6d7e KW |
7126 | if test "$accept4" = "yes" ; then |
7127 | echo "CONFIG_ACCEPT4=y" >> $config_host_mak | |
7128 | fi | |
3ce34dfb | 7129 | if test "$splice" = "yes" ; then |
2358a494 | 7130 | echo "CONFIG_SPLICE=y" >> $config_host_mak |
3ce34dfb | 7131 | fi |
c2882b96 RV |
7132 | if test "$eventfd" = "yes" ; then |
7133 | echo "CONFIG_EVENTFD=y" >> $config_host_mak | |
7134 | fi | |
751bcc39 MAL |
7135 | if test "$memfd" = "yes" ; then |
7136 | echo "CONFIG_MEMFD=y" >> $config_host_mak | |
7137 | fi | |
955727d2 CT |
7138 | if test "$have_usbfs" = "yes" ; then |
7139 | echo "CONFIG_USBFS=y" >> $config_host_mak | |
7140 | fi | |
d0927938 UH |
7141 | if test "$fallocate" = "yes" ; then |
7142 | echo "CONFIG_FALLOCATE=y" >> $config_host_mak | |
7143 | fi | |
3d4fa43e KK |
7144 | if test "$fallocate_punch_hole" = "yes" ; then |
7145 | echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak | |
7146 | fi | |
b953f075 DL |
7147 | if test "$fallocate_zero_range" = "yes" ; then |
7148 | echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak | |
7149 | fi | |
ed911435 KW |
7150 | if test "$posix_fallocate" = "yes" ; then |
7151 | echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak | |
7152 | fi | |
c727f47d PM |
7153 | if test "$sync_file_range" = "yes" ; then |
7154 | echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak | |
7155 | fi | |
dace20dc PM |
7156 | if test "$fiemap" = "yes" ; then |
7157 | echo "CONFIG_FIEMAP=y" >> $config_host_mak | |
7158 | fi | |
d0927938 UH |
7159 | if test "$dup3" = "yes" ; then |
7160 | echo "CONFIG_DUP3=y" >> $config_host_mak | |
7161 | fi | |
4e0c6529 AB |
7162 | if test "$ppoll" = "yes" ; then |
7163 | echo "CONFIG_PPOLL=y" >> $config_host_mak | |
7164 | fi | |
cd758dd0 AB |
7165 | if test "$prctl_pr_set_timerslack" = "yes" ; then |
7166 | echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak | |
7167 | fi | |
3b6edd16 PM |
7168 | if test "$epoll" = "yes" ; then |
7169 | echo "CONFIG_EPOLL=y" >> $config_host_mak | |
7170 | fi | |
7171 | if test "$epoll_create1" = "yes" ; then | |
7172 | echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak | |
7173 | fi | |
a8fd1aba PM |
7174 | if test "$sendfile" = "yes" ; then |
7175 | echo "CONFIG_SENDFILE=y" >> $config_host_mak | |
7176 | fi | |
51834341 RV |
7177 | if test "$timerfd" = "yes" ; then |
7178 | echo "CONFIG_TIMERFD=y" >> $config_host_mak | |
7179 | fi | |
9af5c906 RV |
7180 | if test "$setns" = "yes" ; then |
7181 | echo "CONFIG_SETNS=y" >> $config_host_mak | |
7182 | fi | |
38860a03 AM |
7183 | if test "$clock_adjtime" = "yes" ; then |
7184 | echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak | |
7185 | fi | |
5a03cd00 AM |
7186 | if test "$syncfs" = "yes" ; then |
7187 | echo "CONFIG_SYNCFS=y" >> $config_host_mak | |
7188 | fi | |
db37dd89 AM |
7189 | if test "$kcov" = "yes" ; then |
7190 | echo "CONFIG_KCOV=y" >> $config_host_mak | |
7191 | fi | |
3b3f24ad | 7192 | if test "$inotify" = "yes" ; then |
2358a494 | 7193 | echo "CONFIG_INOTIFY=y" >> $config_host_mak |
3b3f24ad | 7194 | fi |
c05c7a73 RV |
7195 | if test "$inotify1" = "yes" ; then |
7196 | echo "CONFIG_INOTIFY1=y" >> $config_host_mak | |
7197 | fi | |
401bc051 PM |
7198 | if test "$sem_timedwait" = "yes" ; then |
7199 | echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak | |
7200 | fi | |
5c99fa37 KF |
7201 | if test "$strchrnul" = "yes" ; then |
7202 | echo "HAVE_STRCHRNUL=y" >> $config_host_mak | |
7203 | fi | |
8a792b03 JX |
7204 | if test "$st_atim" = "yes" ; then |
7205 | echo "HAVE_STRUCT_STAT_ST_ATIM=y" >> $config_host_mak | |
7206 | fi | |
6ae9a1f4 JQ |
7207 | if test "$byteswap_h" = "yes" ; then |
7208 | echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak | |
7209 | fi | |
7210 | if test "$bswap_h" = "yes" ; then | |
7211 | echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak | |
7212 | fi | |
769ce76d | 7213 | if test "$curl" = "yes" ; then |
d3399d7c | 7214 | echo "CONFIG_CURL=m" >> $config_host_mak |
b1d5a277 | 7215 | echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak |
6ebc91e5 | 7216 | echo "CURL_LIBS=$curl_libs" >> $config_host_mak |
769ce76d | 7217 | fi |
2e4d9fb1 | 7218 | if test "$brlapi" = "yes" ; then |
98ec69ac | 7219 | echo "CONFIG_BRLAPI=y" >> $config_host_mak |
8eca2889 | 7220 | echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak |
2e4d9fb1 | 7221 | fi |
a4ccabcf | 7222 | if test "$gtk" = "yes" ; then |
e0fb129c | 7223 | echo "CONFIG_GTK=m" >> $config_host_mak |
a4ccabcf | 7224 | echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak |
014cb152 | 7225 | echo "GTK_LIBS=$gtk_libs" >> $config_host_mak |
925a0400 GH |
7226 | if test "$gtk_gl" = "yes" ; then |
7227 | echo "CONFIG_GTK_GL=y" >> $config_host_mak | |
7228 | fi | |
bbbf9bfb | 7229 | fi |
f876b765 MAL |
7230 | if test "$gio" = "yes" ; then |
7231 | echo "CONFIG_GIO=y" >> $config_host_mak | |
7232 | echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak | |
7233 | echo "GIO_LIBS=$gio_libs" >> $config_host_mak | |
25a97a56 | 7234 | echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak |
f876b765 | 7235 | fi |
a1c5e949 | 7236 | echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak |
ddbb0d09 DB |
7237 | if test "$gnutls" = "yes" ; then |
7238 | echo "CONFIG_GNUTLS=y" >> $config_host_mak | |
7239 | fi | |
91bfcdb0 DB |
7240 | if test "$gcrypt" = "yes" ; then |
7241 | echo "CONFIG_GCRYPT=y" >> $config_host_mak | |
1f923c70 LM |
7242 | if test "$gcrypt_hmac" = "yes" ; then |
7243 | echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak | |
7244 | fi | |
62893b67 | 7245 | fi |
91bfcdb0 DB |
7246 | if test "$nettle" = "yes" ; then |
7247 | echo "CONFIG_NETTLE=y" >> $config_host_mak | |
becaeb72 | 7248 | echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak |
ed754746 | 7249 | fi |
e0576942 DB |
7250 | if test "$qemu_private_xts" = "yes" ; then |
7251 | echo "CONFIG_QEMU_PRIVATE_XTS=y" >> $config_host_mak | |
7252 | fi | |
9a2fd434 DB |
7253 | if test "$tasn1" = "yes" ; then |
7254 | echo "CONFIG_TASN1=y" >> $config_host_mak | |
7255 | fi | |
8953caf3 DB |
7256 | if test "$auth_pam" = "yes" ; then |
7257 | echo "CONFIG_AUTH_PAM=y" >> $config_host_mak | |
7258 | fi | |
559607ea DB |
7259 | if test "$have_ifaddrs_h" = "yes" ; then |
7260 | echo "HAVE_IFADDRS_H=y" >> $config_host_mak | |
7261 | fi | |
6b39b063 EB |
7262 | if test "$have_broken_size_max" = "yes" ; then |
7263 | echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak | |
7264 | fi | |
277abf15 JV |
7265 | |
7266 | # Work around a system header bug with some kernel/XFS header | |
7267 | # versions where they both try to define 'struct fsxattr': | |
7268 | # xfs headers will not try to redefine structs from linux headers | |
7269 | # if this macro is set. | |
7270 | if test "$have_fsxattr" = "yes" ; then | |
7271 | echo "HAVE_FSXATTR=y" >> $config_host_mak | |
7272 | fi | |
1efad060 FZ |
7273 | if test "$have_copy_file_range" = "yes" ; then |
7274 | echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak | |
7275 | fi | |
bbbf9bfb SW |
7276 | if test "$vte" = "yes" ; then |
7277 | echo "CONFIG_VTE=y" >> $config_host_mak | |
a4ccabcf | 7278 | echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak |
e0fb129c | 7279 | echo "VTE_LIBS=$vte_libs" >> $config_host_mak |
a4ccabcf | 7280 | fi |
9d9e1521 GH |
7281 | if test "$virglrenderer" = "yes" ; then |
7282 | echo "CONFIG_VIRGL=y" >> $config_host_mak | |
7283 | echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak | |
7284 | echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak | |
7285 | fi | |
e37630ca | 7286 | if test "$xen" = "yes" ; then |
6dbd588a | 7287 | echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak |
d5b93ddf | 7288 | echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak |
e37630ca | 7289 | fi |
5c6c3a6c CH |
7290 | if test "$linux_aio" = "yes" ; then |
7291 | echo "CONFIG_LINUX_AIO=y" >> $config_host_mak | |
7292 | fi | |
c10dd856 AM |
7293 | if test "$linux_io_uring" = "yes" ; then |
7294 | echo "CONFIG_LINUX_IO_URING=y" >> $config_host_mak | |
7295 | echo "LINUX_IO_URING_CFLAGS=$linux_io_uring_cflags" >> $config_host_mak | |
7296 | echo "LINUX_IO_URING_LIBS=$linux_io_uring_libs" >> $config_host_mak | |
7297 | fi | |
758e8e38 VJ |
7298 | if test "$attr" = "yes" ; then |
7299 | echo "CONFIG_ATTR=y" >> $config_host_mak | |
7300 | fi | |
4f26f2b6 AK |
7301 | if test "$libattr" = "yes" ; then |
7302 | echo "CONFIG_LIBATTR=y" >> $config_host_mak | |
7303 | fi | |
983eef5a MI |
7304 | if test "$virtfs" = "yes" ; then |
7305 | echo "CONFIG_VIRTFS=y" >> $config_host_mak | |
758e8e38 | 7306 | fi |
fe8fc5ae PB |
7307 | if test "$mpath" = "yes" ; then |
7308 | echo "CONFIG_MPATH=y" >> $config_host_mak | |
1b0578f5 MOA |
7309 | if test "$mpathpersist_new_api" = "yes"; then |
7310 | echo "CONFIG_MPATH_NEW_API=y" >> $config_host_mak | |
7311 | fi | |
fe8fc5ae | 7312 | fi |
5e9be92d NB |
7313 | if test "$vhost_scsi" = "yes" ; then |
7314 | echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak | |
7315 | fi | |
af3bba76 PB |
7316 | if test "$vhost_net" = "yes" ; then |
7317 | echo "CONFIG_VHOST_NET=y" >> $config_host_mak | |
7318 | fi | |
7319 | if test "$vhost_net_user" = "yes" ; then | |
56f41de7 | 7320 | echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak |
03ce5744 | 7321 | fi |
042cea27 GA |
7322 | if test "$vhost_crypto" = "yes" ; then |
7323 | echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak | |
7324 | fi | |
fc0b9b0e SH |
7325 | if test "$vhost_vsock" = "yes" ; then |
7326 | echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak | |
5fe97d88 SG |
7327 | if test "$vhost_user" = "yes" ; then |
7328 | echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak | |
7329 | fi | |
fc0b9b0e | 7330 | fi |
299e6f19 PB |
7331 | if test "$vhost_kernel" = "yes" ; then |
7332 | echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak | |
7333 | fi | |
e6a74868 MAL |
7334 | if test "$vhost_user" = "yes" ; then |
7335 | echo "CONFIG_VHOST_USER=y" >> $config_host_mak | |
7336 | fi | |
98fc1ada DDAG |
7337 | if test "$vhost_user_fs" = "yes" ; then |
7338 | echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak | |
7339 | fi | |
77755340 | 7340 | if test "$blobs" = "yes" ; then |
98ec69ac | 7341 | echo "INSTALL_BLOBS=yes" >> $config_host_mak |
77755340 | 7342 | fi |
bf9298b9 | 7343 | if test "$iovec" = "yes" ; then |
2358a494 | 7344 | echo "CONFIG_IOVEC=y" >> $config_host_mak |
bf9298b9 | 7345 | fi |
ceb42de8 | 7346 | if test "$preadv" = "yes" ; then |
2358a494 | 7347 | echo "CONFIG_PREADV=y" >> $config_host_mak |
ceb42de8 | 7348 | fi |
e3971d61 | 7349 | if test "$fdt" != "no" ; then |
3f0855b1 | 7350 | echo "CONFIG_FDT=y" >> $config_host_mak |
f652e6af | 7351 | fi |
a40161cb PB |
7352 | if test "$membarrier" = "yes" ; then |
7353 | echo "CONFIG_MEMBARRIER=y" >> $config_host_mak | |
7354 | fi | |
dcc38d1c MT |
7355 | if test "$signalfd" = "yes" ; then |
7356 | echo "CONFIG_SIGNALFD=y" >> $config_host_mak | |
7357 | fi | |
d339d766 RJ |
7358 | if test "$optreset" = "yes" ; then |
7359 | echo "HAVE_OPTRESET=y" >> $config_host_mak | |
7360 | fi | |
b3f6ea7e PB |
7361 | if test "$tcg" = "yes"; then |
7362 | echo "CONFIG_TCG=y" >> $config_host_mak | |
7363 | if test "$tcg_interpreter" = "yes" ; then | |
7364 | echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak | |
7365 | fi | |
9195b2c2 | 7366 | fi |
5f6b9e8f BS |
7367 | if test "$fdatasync" = "yes" ; then |
7368 | echo "CONFIG_FDATASYNC=y" >> $config_host_mak | |
7369 | fi | |
e78815a5 AF |
7370 | if test "$madvise" = "yes" ; then |
7371 | echo "CONFIG_MADVISE=y" >> $config_host_mak | |
7372 | fi | |
7373 | if test "$posix_madvise" = "yes" ; then | |
7374 | echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak | |
7375 | fi | |
9bc5a719 AG |
7376 | if test "$posix_memalign" = "yes" ; then |
7377 | echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak | |
7378 | fi | |
97a847bc | 7379 | |
cd4ec0b4 GH |
7380 | if test "$spice" = "yes" ; then |
7381 | echo "CONFIG_SPICE=y" >> $config_host_mak | |
7382 | fi | |
36707144 | 7383 | |
7b02f544 MAL |
7384 | if test "$smartcard" = "yes" ; then |
7385 | echo "CONFIG_SMARTCARD=y" >> $config_host_mak | |
7b62bf5a FZ |
7386 | echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak |
7387 | echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak | |
111a38b0 RR |
7388 | fi |
7389 | ||
2b2325ff GH |
7390 | if test "$libusb" = "yes" ; then |
7391 | echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak | |
b878b652 FZ |
7392 | echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak |
7393 | echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak | |
2b2325ff GH |
7394 | fi |
7395 | ||
69354a83 HG |
7396 | if test "$usb_redir" = "yes" ; then |
7397 | echo "CONFIG_USB_REDIR=y" >> $config_host_mak | |
cc7923fc FZ |
7398 | echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak |
7399 | echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak | |
69354a83 HG |
7400 | fi |
7401 | ||
da076ffe GH |
7402 | if test "$opengl" = "yes" ; then |
7403 | echo "CONFIG_OPENGL=y" >> $config_host_mak | |
7404 | echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak | |
014cb152 GH |
7405 | if test "$opengl_dmabuf" = "yes" ; then |
7406 | echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak | |
7407 | fi | |
20ff075b MW |
7408 | fi |
7409 | ||
d52c454a MAL |
7410 | if test "$gbm" = "yes" ; then |
7411 | echo "CONFIG_GBM=y" >> $config_host_mak | |
7412 | echo "GBM_LIBS=$gbm_libs" >> $config_host_mak | |
7413 | echo "GBM_CFLAGS=$gbm_cflags" >> $config_host_mak | |
7414 | fi | |
7415 | ||
7416 | ||
5a22ab71 YZ |
7417 | if test "$malloc_trim" = "yes" ; then |
7418 | echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak | |
7419 | fi | |
7420 | ||
99f2dbd3 LL |
7421 | if test "$avx2_opt" = "yes" ; then |
7422 | echo "CONFIG_AVX2_OPT=y" >> $config_host_mak | |
7423 | fi | |
7424 | ||
6b8cd447 RH |
7425 | if test "$avx512f_opt" = "yes" ; then |
7426 | echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak | |
7427 | fi | |
7428 | ||
607dacd0 QN |
7429 | if test "$lzo" = "yes" ; then |
7430 | echo "CONFIG_LZO=y" >> $config_host_mak | |
7431 | fi | |
7432 | ||
7433 | if test "$snappy" = "yes" ; then | |
7434 | echo "CONFIG_SNAPPY=y" >> $config_host_mak | |
7435 | fi | |
7436 | ||
6b383c08 PW |
7437 | if test "$bzip2" = "yes" ; then |
7438 | echo "CONFIG_BZIP2=y" >> $config_host_mak | |
7439 | echo "BZIP2_LIBS=-lbz2" >> $config_host_mak | |
7440 | fi | |
7441 | ||
83bc1f97 JF |
7442 | if test "$lzfse" = "yes" ; then |
7443 | echo "CONFIG_LZFSE=y" >> $config_host_mak | |
7444 | echo "LZFSE_LIBS=-llzfse" >> $config_host_mak | |
7445 | fi | |
7446 | ||
3a678481 JQ |
7447 | if test "$zstd" = "yes" ; then |
7448 | echo "CONFIG_ZSTD=y" >> $config_host_mak | |
7449 | fi | |
7450 | ||
c589b249 | 7451 | if test "$libiscsi" = "yes" ; then |
d3399d7c | 7452 | echo "CONFIG_LIBISCSI=m" >> $config_host_mak |
6ebc91e5 FZ |
7453 | echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak |
7454 | echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak | |
c589b249 RS |
7455 | fi |
7456 | ||
6542aa9c | 7457 | if test "$libnfs" = "yes" ; then |
4be4879f CL |
7458 | echo "CONFIG_LIBNFS=m" >> $config_host_mak |
7459 | echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak | |
6542aa9c PL |
7460 | fi |
7461 | ||
f794573e EO |
7462 | if test "$seccomp" = "yes"; then |
7463 | echo "CONFIG_SECCOMP=y" >> $config_host_mak | |
c3883e1f FZ |
7464 | echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak |
7465 | echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak | |
f794573e EO |
7466 | fi |
7467 | ||
83fb7adf | 7468 | # XXX: suppress that |
7d3505c5 | 7469 | if [ "$bsd" = "yes" ] ; then |
2358a494 | 7470 | echo "CONFIG_BSD=y" >> $config_host_mak |
7d3505c5 FB |
7471 | fi |
7472 | ||
4d9310f4 DB |
7473 | if test "$localtime_r" = "yes" ; then |
7474 | echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak | |
7475 | fi | |
3556c233 PB |
7476 | if test "$qom_cast_debug" = "yes" ; then |
7477 | echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak | |
7478 | fi | |
f27aaf4b | 7479 | if test "$rbd" = "yes" ; then |
d3399d7c | 7480 | echo "CONFIG_RBD=m" >> $config_host_mak |
6ebc91e5 FZ |
7481 | echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak |
7482 | echo "RBD_LIBS=$rbd_libs" >> $config_host_mak | |
d0e2fce5 AK |
7483 | fi |
7484 | ||
7c2acc70 | 7485 | echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak |
70c60c08 SH |
7486 | if test "$coroutine_pool" = "yes" ; then |
7487 | echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak | |
7488 | else | |
7489 | echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak | |
7490 | fi | |
20ff6c80 | 7491 | |
7d992e4d PL |
7492 | if test "$debug_stack_usage" = "yes" ; then |
7493 | echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak | |
7494 | fi | |
7495 | ||
f0d92b56 LM |
7496 | if test "$crypto_afalg" = "yes" ; then |
7497 | echo "CONFIG_AF_ALG=y" >> $config_host_mak | |
7498 | fi | |
7499 | ||
d2042378 AK |
7500 | if test "$open_by_handle_at" = "yes" ; then |
7501 | echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak | |
7502 | fi | |
7503 | ||
e06a765e HPB |
7504 | if test "$linux_magic_h" = "yes" ; then |
7505 | echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak | |
8ab1bf12 LC |
7506 | fi |
7507 | ||
cc6e3ca9 GH |
7508 | if test "$pragma_diagnostic_available" = "yes" ; then |
7509 | echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak | |
06d71fa1 PM |
7510 | fi |
7511 | ||
3f4349dc KW |
7512 | if test "$valgrind_h" = "yes" ; then |
7513 | echo "CONFIG_VALGRIND_H=y" >> $config_host_mak | |
7514 | fi | |
7515 | ||
d83414e1 MAL |
7516 | if test "$have_asan_iface_fiber" = "yes" ; then |
7517 | echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak | |
7518 | fi | |
7519 | ||
0aebab04 LY |
7520 | if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then |
7521 | echo "CONFIG_TSAN=y" >> $config_host_mak | |
7522 | fi | |
7523 | ||
8ab1bf12 LC |
7524 | if test "$has_environ" = "yes" ; then |
7525 | echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak | |
e06a765e HPB |
7526 | fi |
7527 | ||
76a347e1 RH |
7528 | if test "$cpuid_h" = "yes" ; then |
7529 | echo "CONFIG_CPUID_H=y" >> $config_host_mak | |
7530 | fi | |
7531 | ||
f540166b RH |
7532 | if test "$int128" = "yes" ; then |
7533 | echo "CONFIG_INT128=y" >> $config_host_mak | |
7534 | fi | |
7535 | ||
7ebee43e RH |
7536 | if test "$atomic128" = "yes" ; then |
7537 | echo "CONFIG_ATOMIC128=y" >> $config_host_mak | |
7538 | fi | |
7539 | ||
e6cd4bb5 RH |
7540 | if test "$cmpxchg128" = "yes" ; then |
7541 | echo "CONFIG_CMPXCHG128=y" >> $config_host_mak | |
7542 | fi | |
7543 | ||
df79b996 RH |
7544 | if test "$atomic64" = "yes" ; then |
7545 | echo "CONFIG_ATOMIC64=y" >> $config_host_mak | |
7546 | fi | |
7547 | ||
db8aaae8 RH |
7548 | if test "$attralias" = "yes" ; then |
7549 | echo "CONFIG_ATTRIBUTE_ALIAS=y" >> $config_host_mak | |
7550 | fi | |
7551 | ||
1e6e9aca RH |
7552 | if test "$getauxval" = "yes" ; then |
7553 | echo "CONFIG_GETAUXVAL=y" >> $config_host_mak | |
7554 | fi | |
7555 | ||
eb100396 | 7556 | if test "$glusterfs" = "yes" ; then |
d3399d7c | 7557 | echo "CONFIG_GLUSTERFS=m" >> $config_host_mak |
6ebc91e5 FZ |
7558 | echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak |
7559 | echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak | |
0c14fb47 BR |
7560 | fi |
7561 | ||
d85fa9eb JC |
7562 | if test "$glusterfs_xlator_opt" = "yes" ; then |
7563 | echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak | |
7564 | fi | |
7565 | ||
0c14fb47 BR |
7566 | if test "$glusterfs_discard" = "yes" ; then |
7567 | echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak | |
eb100396 | 7568 | fi |
e06a765e | 7569 | |
df3a429a NV |
7570 | if test "$glusterfs_fallocate" = "yes" ; then |
7571 | echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak | |
7572 | fi | |
7573 | ||
7c815372 BR |
7574 | if test "$glusterfs_zerofill" = "yes" ; then |
7575 | echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak | |
7576 | fi | |
7577 | ||
e014dbe7 PKK |
7578 | if test "$glusterfs_ftruncate_has_stat" = "yes" ; then |
7579 | echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak | |
7580 | fi | |
7581 | ||
0e3b891f NV |
7582 | if test "$glusterfs_iocb_has_stat" = "yes" ; then |
7583 | echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak | |
7584 | fi | |
7585 | ||
b10d49d7 PT |
7586 | if test "$libssh" = "yes" ; then |
7587 | echo "CONFIG_LIBSSH=m" >> $config_host_mak | |
7588 | echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak | |
7589 | echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak | |
0a12ec87 RJ |
7590 | fi |
7591 | ||
ed1701c6 DDAG |
7592 | if test "$live_block_migration" = "yes" ; then |
7593 | echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak | |
7594 | fi | |
7595 | ||
3b8acc11 | 7596 | if test "$tpm" = "yes"; then |
3cae16db | 7597 | echo 'CONFIG_TPM=y' >> $config_host_mak |
3b8acc11 PB |
7598 | fi |
7599 | ||
5b808275 LV |
7600 | echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak |
7601 | if have_backend "nop"; then | |
6d8a764e | 7602 | echo "CONFIG_TRACE_NOP=y" >> $config_host_mak |
22890ab5 | 7603 | fi |
5b808275 | 7604 | if have_backend "simple"; then |
6d8a764e LV |
7605 | echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak |
7606 | # Set the appropriate trace file. | |
953ffe0f | 7607 | trace_file="\"$trace_file-\" FMT_pid" |
9410b56c | 7608 | fi |
ed7f5f1d PB |
7609 | if have_backend "log"; then |
7610 | echo "CONFIG_TRACE_LOG=y" >> $config_host_mak | |
6d8a764e | 7611 | fi |
5b808275 | 7612 | if have_backend "ust"; then |
6d8a764e LV |
7613 | echo "CONFIG_TRACE_UST=y" >> $config_host_mak |
7614 | fi | |
5b808275 | 7615 | if have_backend "dtrace"; then |
6d8a764e LV |
7616 | echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak |
7617 | if test "$trace_backend_stap" = "yes" ; then | |
7618 | echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak | |
7619 | fi | |
c276b17d | 7620 | fi |
5b808275 | 7621 | if have_backend "ftrace"; then |
781e9545 ET |
7622 | if test "$linux" = "yes" ; then |
7623 | echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak | |
781e9545 | 7624 | else |
21684af0 | 7625 | feature_not_found "ftrace(trace backend)" "ftrace requires Linux" |
781e9545 ET |
7626 | fi |
7627 | fi | |
0a852417 PD |
7628 | if have_backend "syslog"; then |
7629 | if test "$posix_syslog" = "yes" ; then | |
7630 | echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak | |
7631 | else | |
7632 | feature_not_found "syslog(trace backend)" "syslog not available" | |
7633 | fi | |
7634 | fi | |
9410b56c PS |
7635 | echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak |
7636 | ||
2da776db MH |
7637 | if test "$rdma" = "yes" ; then |
7638 | echo "CONFIG_RDMA=y" >> $config_host_mak | |
392fb643 | 7639 | echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak |
2da776db MH |
7640 | fi |
7641 | ||
21ab34c9 MA |
7642 | if test "$pvrdma" = "yes" ; then |
7643 | echo "CONFIG_PVRDMA=y" >> $config_host_mak | |
7644 | fi | |
7645 | ||
575b22b1 LV |
7646 | if test "$have_rtnetlink" = "yes" ; then |
7647 | echo "CONFIG_RTNETLINK=y" >> $config_host_mak | |
7648 | fi | |
7649 | ||
ed279a06 KK |
7650 | if test "$libxml2" = "yes" ; then |
7651 | echo "CONFIG_LIBXML2=y" >> $config_host_mak | |
7652 | echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak | |
7653 | echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak | |
7654 | fi | |
7655 | ||
a6b1d4c0 CX |
7656 | if test "$replication" = "yes" ; then |
7657 | echo "CONFIG_REPLICATION=y" >> $config_host_mak | |
7658 | fi | |
7659 | ||
6a02c806 SH |
7660 | if test "$have_af_vsock" = "yes" ; then |
7661 | echo "CONFIG_AF_VSOCK=y" >> $config_host_mak | |
7662 | fi | |
7663 | ||
4d04351f CC |
7664 | if test "$have_sysmacros" = "yes" ; then |
7665 | echo "CONFIG_SYSMACROS=y" >> $config_host_mak | |
7666 | fi | |
7667 | ||
49e00a18 AG |
7668 | if test "$have_static_assert" = "yes" ; then |
7669 | echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak | |
7670 | fi | |
7671 | ||
e674605f TG |
7672 | if test "$have_utmpx" = "yes" ; then |
7673 | echo "HAVE_UTMPX=y" >> $config_host_mak | |
7674 | fi | |
db1ed1ab RH |
7675 | if test "$have_getrandom" = "yes" ; then |
7676 | echo "CONFIG_GETRANDOM=y" >> $config_host_mak | |
7677 | fi | |
e0580342 KR |
7678 | if test "$ivshmem" = "yes" ; then |
7679 | echo "CONFIG_IVSHMEM=y" >> $config_host_mak | |
8ca80760 | 7680 | fi |
e219c499 | 7681 | if test "$capstone" != "no" ; then |
8ca80760 | 7682 | echo "CONFIG_CAPSTONE=y" >> $config_host_mak |
e0580342 | 7683 | fi |
ba59fb77 PB |
7684 | if test "$debug_mutex" = "yes" ; then |
7685 | echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak | |
7686 | fi | |
e0580342 | 7687 | |
5c312079 DDAG |
7688 | # Hold two types of flag: |
7689 | # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on | |
7690 | # a thread we have a handle to | |
479a5747 | 7691 | # CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular |
5c312079 | 7692 | # platform |
479a5747 RB |
7693 | if test "$pthread_setname_np_w_tid" = "yes" ; then |
7694 | echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak | |
7695 | echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=y" >> $config_host_mak | |
7696 | elif test "$pthread_setname_np_wo_tid" = "yes" ; then | |
5c312079 | 7697 | echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak |
479a5747 | 7698 | echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=y" >> $config_host_mak |
5c312079 DDAG |
7699 | fi |
7700 | ||
da92c3ff AM |
7701 | if test "$vxhs" = "yes" ; then |
7702 | echo "CONFIG_VXHS=y" >> $config_host_mak | |
7703 | echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak | |
7704 | fi | |
7705 | ||
17824406 JH |
7706 | if test "$libpmem" = "yes" ; then |
7707 | echo "CONFIG_LIBPMEM=y" >> $config_host_mak | |
7708 | fi | |
7709 | ||
2f740136 JC |
7710 | if test "$bochs" = "yes" ; then |
7711 | echo "CONFIG_BOCHS=y" >> $config_host_mak | |
7712 | fi | |
7713 | if test "$cloop" = "yes" ; then | |
7714 | echo "CONFIG_CLOOP=y" >> $config_host_mak | |
7715 | fi | |
7716 | if test "$dmg" = "yes" ; then | |
7717 | echo "CONFIG_DMG=y" >> $config_host_mak | |
7718 | fi | |
7719 | if test "$qcow1" = "yes" ; then | |
7720 | echo "CONFIG_QCOW1=y" >> $config_host_mak | |
7721 | fi | |
7722 | if test "$vdi" = "yes" ; then | |
7723 | echo "CONFIG_VDI=y" >> $config_host_mak | |
7724 | fi | |
7725 | if test "$vvfat" = "yes" ; then | |
7726 | echo "CONFIG_VVFAT=y" >> $config_host_mak | |
7727 | fi | |
7728 | if test "$qed" = "yes" ; then | |
7729 | echo "CONFIG_QED=y" >> $config_host_mak | |
7730 | fi | |
7731 | if test "$parallels" = "yes" ; then | |
7732 | echo "CONFIG_PARALLELS=y" >> $config_host_mak | |
7733 | fi | |
7734 | if test "$sheepdog" = "yes" ; then | |
7735 | echo "CONFIG_SHEEPDOG=y" >> $config_host_mak | |
7736 | fi | |
adc28027 AB |
7737 | if test "$fuzzing" = "yes" ; then |
7738 | if test "$have_fuzzer" = "yes"; then | |
7739 | FUZZ_LDFLAGS=" -fsanitize=address,fuzzer" | |
7740 | FUZZ_CFLAGS=" -fsanitize=address,fuzzer" | |
7741 | CFLAGS=" -fsanitize=address,fuzzer-no-link" | |
7742 | else | |
7743 | error_exit "Your compiler doesn't support -fsanitize=address,fuzzer" | |
7744 | exit 1 | |
7745 | fi | |
7746 | fi | |
2f740136 | 7747 | |
40e8c6f4 AB |
7748 | if test "$plugins" = "yes" ; then |
7749 | echo "CONFIG_PLUGIN=y" >> $config_host_mak | |
7750 | LIBS="-ldl $LIBS" | |
26fffe29 EC |
7751 | # Copy the export object list to the build dir |
7752 | if test "$ld_dynamic_list" = "yes" ; then | |
7753 | echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak | |
7754 | ld_symbols=qemu-plugins-ld.symbols | |
7755 | cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols | |
7756 | elif test "$ld_exported_symbols_list" = "yes" ; then | |
7757 | echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak | |
7758 | ld64_symbols=qemu-plugins-ld64.symbols | |
7759 | echo "# Automatically generated by configure - do not modify" > $ld64_symbols | |
7760 | grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \ | |
7761 | sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols | |
7762 | else | |
7763 | error_exit \ | |
7764 | "If \$plugins=yes, either \$ld_dynamic_list or " \ | |
7765 | "\$ld_exported_symbols_list should have been set to 'yes'." | |
7766 | fi | |
40e8c6f4 AB |
7767 | fi |
7768 | ||
f48e590a AB |
7769 | if test -n "$gdb_bin" ; then |
7770 | echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak | |
7771 | fi | |
7772 | ||
54e7aac0 AK |
7773 | if test "$secret_keyring" = "yes" ; then |
7774 | echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak | |
92500362 AK |
7775 | if test "$have_keyutils" = "yes" ; then |
7776 | echo "CONFIG_TEST_SECRET_KEYRING=y" >> $config_host_mak | |
7777 | fi | |
54e7aac0 AK |
7778 | fi |
7779 | ||
5b5e3037 | 7780 | if test "$tcg_interpreter" = "yes"; then |
9edc19c9 | 7781 | QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" |
5b5e3037 | 7782 | elif test "$ARCH" = "sparc64" ; then |
9edc19c9 | 7783 | QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES" |
5b5e3037 | 7784 | elif test "$ARCH" = "s390x" ; then |
9edc19c9 | 7785 | QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES" |
e633a5c6 | 7786 | elif test "$ARCH" = "x86_64" || test "$ARCH" = "x32" ; then |
9edc19c9 | 7787 | QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES" |
40d964b5 | 7788 | elif test "$ARCH" = "ppc64" ; then |
9edc19c9 | 7789 | QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES" |
e633a5c6 | 7790 | elif test "$ARCH" = "riscv32" || test "$ARCH" = "riscv64" ; then |
c4f80543 | 7791 | QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/riscv $QEMU_INCLUDES" |
5b5e3037 | 7792 | else |
9edc19c9 | 7793 | QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES" |
5b5e3037 | 7794 | fi |
5b5e3037 | 7795 | |
fdbff6bd | 7796 | echo "HELPERS=$helpers" >> $config_host_mak |
98ec69ac | 7797 | echo "TOOLS=$tools" >> $config_host_mak |
98ec69ac | 7798 | echo "ROMS=$roms" >> $config_host_mak |
804edf29 JQ |
7799 | echo "MAKE=$make" >> $config_host_mak |
7800 | echo "INSTALL=$install" >> $config_host_mak | |
1901cb14 BS |
7801 | echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak |
7802 | echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak | |
e999ee44 MT |
7803 | echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak |
7804 | echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak | |
c886edfb | 7805 | echo "PYTHON=$python" >> $config_host_mak |
2eb054c2 | 7806 | echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak |
516e8b7d | 7807 | echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak |
39d87c8c | 7808 | echo "GENISOIMAGE=$genisoimage" >> $config_host_mak |
804edf29 | 7809 | echo "CC=$cc" >> $config_host_mak |
a31a8642 MT |
7810 | if $iasl -h > /dev/null 2>&1; then |
7811 | echo "IASL=$iasl" >> $config_host_mak | |
7812 | fi | |
804edf29 | 7813 | echo "HOST_CC=$host_cc" >> $config_host_mak |
83f73fce | 7814 | echo "CXX=$cxx" >> $config_host_mak |
3c4a4d0d | 7815 | echo "OBJCC=$objcc" >> $config_host_mak |
804edf29 | 7816 | echo "AR=$ar" >> $config_host_mak |
45d285ab | 7817 | echo "ARFLAGS=$ARFLAGS" >> $config_host_mak |
cdbd727c | 7818 | echo "AS=$as" >> $config_host_mak |
5f6f0e27 | 7819 | echo "CCAS=$ccas" >> $config_host_mak |
3dd46c78 | 7820 | echo "CPP=$cpp" >> $config_host_mak |
804edf29 JQ |
7821 | echo "OBJCOPY=$objcopy" >> $config_host_mak |
7822 | echo "LD=$ld" >> $config_host_mak | |
9f81aeb5 | 7823 | echo "RANLIB=$ranlib" >> $config_host_mak |
4852ee95 | 7824 | echo "NM=$nm" >> $config_host_mak |
daa79d9a | 7825 | echo "PKG_CONFIG=$pkg_config_exe" >> $config_host_mak |
9fe6de94 | 7826 | echo "WINDRES=$windres" >> $config_host_mak |
e2a2ed06 | 7827 | echo "CFLAGS=$CFLAGS" >> $config_host_mak |
46eef33b | 7828 | echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak |
a558ee17 | 7829 | echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak |
11cde1c8 | 7830 | echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak |
f9728943 | 7831 | echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak |
e39f0062 PB |
7832 | if test "$sparse" = "yes" ; then |
7833 | echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak | |
80fd48df | 7834 | echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak |
2944d742 | 7835 | echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak |
e39f0062 PB |
7836 | echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak |
7837 | echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak | |
7838 | fi | |
8a99e9a3 | 7839 | echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak |
db5adeaa | 7840 | echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak |
6969ec6c | 7841 | echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak |
e57218b6 | 7842 | echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak |
73da375e | 7843 | echo "LIBS+=$LIBS" >> $config_host_mak |
3e2e0e6b | 7844 | echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak |
409437e1 | 7845 | echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak |
804edf29 | 7846 | echo "EXESUF=$EXESUF" >> $config_host_mak |
17969268 FZ |
7847 | echo "DSOSUF=$DSOSUF" >> $config_host_mak |
7848 | echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak | |
957f1f99 | 7849 | echo "LIBS_QGA+=$libs_qga" >> $config_host_mak |
90246037 DB |
7850 | echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak |
7851 | echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak | |
94dd53c5 | 7852 | echo "POD2MAN=$POD2MAN" >> $config_host_mak |
1d728c39 BS |
7853 | if test "$gcov" = "yes" ; then |
7854 | echo "CONFIG_GCOV=y" >> $config_host_mak | |
7855 | echo "GCOV=$gcov_tool" >> $config_host_mak | |
7856 | fi | |
804edf29 | 7857 | |
3efac6eb TG |
7858 | if test "$libudev" != "no"; then |
7859 | echo "CONFIG_LIBUDEV=y" >> $config_host_mak | |
7860 | echo "LIBUDEV_LIBS=$libudev_libs" >> $config_host_mak | |
7861 | fi | |
adc28027 AB |
7862 | if test "$fuzzing" != "no"; then |
7863 | echo "CONFIG_FUZZ=y" >> $config_host_mak | |
7864 | echo "FUZZ_CFLAGS=$FUZZ_CFLAGS" >> $config_host_mak | |
7865 | echo "FUZZ_LDFLAGS=$FUZZ_LDFLAGS" >> $config_host_mak | |
7866 | fi | |
3efac6eb | 7867 | |
05dfa22b PMD |
7868 | if test "$edk2_blobs" = "yes" ; then |
7869 | echo "DECOMPRESS_EDK2_BLOBS=y" >> $config_host_mak | |
7870 | fi | |
7871 | ||
b767d257 MMG |
7872 | if test "$rng_none" = "yes"; then |
7873 | echo "CONFIG_RNG_NONE=y" >> $config_host_mak | |
7874 | fi | |
7875 | ||
6efd7517 PM |
7876 | # use included Linux headers |
7877 | if test "$linux" = "yes" ; then | |
a307beb6 | 7878 | mkdir -p linux-headers |
6efd7517 | 7879 | case "$cpu" in |
c72b26ec | 7880 | i386|x86_64|x32) |
08312a63 | 7881 | linux_arch=x86 |
6efd7517 | 7882 | ;; |
f8378acc | 7883 | ppc|ppc64|ppc64le) |
08312a63 | 7884 | linux_arch=powerpc |
6efd7517 PM |
7885 | ;; |
7886 | s390x) | |
08312a63 PM |
7887 | linux_arch=s390 |
7888 | ;; | |
1f080313 CF |
7889 | aarch64) |
7890 | linux_arch=arm64 | |
7891 | ;; | |
222e7d11 SL |
7892 | mips64) |
7893 | linux_arch=mips | |
7894 | ;; | |
08312a63 PM |
7895 | *) |
7896 | # For most CPUs the kernel architecture name and QEMU CPU name match. | |
7897 | linux_arch="$cpu" | |
6efd7517 PM |
7898 | ;; |
7899 | esac | |
08312a63 PM |
7900 | # For non-KVM architectures we will not have asm headers |
7901 | if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then | |
7902 | symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm | |
7903 | fi | |
6efd7517 PM |
7904 | fi |
7905 | ||
1d14ffa9 | 7906 | for target in $target_list; do |
97a847bc | 7907 | target_dir="$target" |
25be210f | 7908 | config_target_mak=$target_dir/config-target.mak |
89138857 | 7909 | target_name=$(echo $target | cut -d '-' -f 1) |
52bf9771 TN |
7910 | target_aligned_only="no" |
7911 | case "$target_name" in | |
7912 | alpha|hppa|mips64el|mips64|mipsel|mips|mipsn32|mipsn32el|sh4|sh4eb|sparc|sparc64|sparc32plus|xtensa|xtensaeb) | |
7913 | target_aligned_only="yes" | |
7914 | ;; | |
7915 | esac | |
97a847bc | 7916 | target_bigendian="no" |
c1799a84 | 7917 | case "$target_name" in |
a69dc537 | 7918 | armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) |
52bf9771 | 7919 | target_bigendian="yes" |
ea2d6a39 JQ |
7920 | ;; |
7921 | esac | |
97a847bc | 7922 | target_softmmu="no" |
997344f3 | 7923 | target_user_only="no" |
831b7825 | 7924 | target_linux_user="no" |
84778508 | 7925 | target_bsd_user="no" |
9e407a85 | 7926 | case "$target" in |
c1799a84 | 7927 | ${target_name}-softmmu) |
9e407a85 PB |
7928 | target_softmmu="yes" |
7929 | ;; | |
c1799a84 | 7930 | ${target_name}-linux-user) |
9e407a85 PB |
7931 | target_user_only="yes" |
7932 | target_linux_user="yes" | |
7933 | ;; | |
c1799a84 | 7934 | ${target_name}-bsd-user) |
84778508 BS |
7935 | target_user_only="yes" |
7936 | target_bsd_user="yes" | |
7937 | ;; | |
9e407a85 | 7938 | *) |
76ad07a4 | 7939 | error_exit "Target '$target' not recognised" |
9e407a85 PB |
7940 | exit 1 |
7941 | ;; | |
7942 | esac | |
831b7825 | 7943 | |
97a847bc | 7944 | mkdir -p $target_dir |
25be210f | 7945 | echo "# Automatically generated by configure - do not modify" > $config_target_mak |
de83cd02 | 7946 | |
e5fe0c52 | 7947 | bflt="no" |
ca759f9e | 7948 | mttcg="no" |
89138857 | 7949 | interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g") |
56aebc89 | 7950 | gdb_xml_files="" |
7ba1e619 | 7951 | |
c1799a84 | 7952 | TARGET_ARCH="$target_name" |
6acff7da | 7953 | TARGET_BASE_ARCH="" |
e6e91b9c | 7954 | TARGET_ABI_DIR="" |
e73aae67 | 7955 | |
c1799a84 | 7956 | case "$target_name" in |
2408a527 | 7957 | i386) |
0a7fa00a | 7958 | mttcg="yes" |
7b0f97ba | 7959 | gdb_xml_files="i386-32bit.xml" |
28988117 | 7960 | TARGET_SYSTBL_ABI=i386 |
2408a527 AJ |
7961 | ;; |
7962 | x86_64) | |
6acff7da | 7963 | TARGET_BASE_ARCH=i386 |
8d62f35a | 7964 | TARGET_SYSTBL_ABI=common,64 |
0a7fa00a | 7965 | mttcg="yes" |
7b0f97ba | 7966 | gdb_xml_files="i386-64bit.xml" |
2408a527 AJ |
7967 | ;; |
7968 | alpha) | |
5ee4f3c2 | 7969 | mttcg="yes" |
6116aea9 | 7970 | TARGET_SYSTBL_ABI=common |
2408a527 AJ |
7971 | ;; |
7972 | arm|armeb) | |
b498c8a0 | 7973 | TARGET_ARCH=arm |
5bcb4986 | 7974 | TARGET_SYSTBL_ABI=common,oabi |
2408a527 | 7975 | bflt="yes" |
ca759f9e | 7976 | mttcg="yes" |
c888f7e0 | 7977 | gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml arm-m-profile.xml" |
2408a527 | 7978 | ;; |
722dd7be MW |
7979 | aarch64|aarch64_be) |
7980 | TARGET_ARCH=aarch64 | |
6a49fa95 AG |
7981 | TARGET_BASE_ARCH=arm |
7982 | bflt="yes" | |
ca759f9e | 7983 | mttcg="yes" |
c888f7e0 | 7984 | gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml arm-m-profile.xml" |
6a49fa95 | 7985 | ;; |
2408a527 | 7986 | cris) |
2408a527 | 7987 | ;; |
61766fe9 | 7988 | hppa) |
7b93dab5 | 7989 | mttcg="yes" |
9566f4c6 | 7990 | TARGET_SYSTBL_ABI=common,32 |
61766fe9 | 7991 | ;; |
613a22c9 | 7992 | lm32) |
613a22c9 | 7993 | ;; |
2408a527 | 7994 | m68k) |
2408a527 | 7995 | bflt="yes" |
a976ed3f | 7996 | gdb_xml_files="cf-core.xml cf-fp.xml m68k-core.xml m68k-fp.xml" |
5b85cae9 | 7997 | TARGET_SYSTBL_ABI=common |
2408a527 | 7998 | ;; |
877fdc12 EI |
7999 | microblaze|microblazeel) |
8000 | TARGET_ARCH=microblaze | |
ddf0c4cd | 8001 | TARGET_SYSTBL_ABI=common |
72b675ca | 8002 | bflt="yes" |
be73ef64 | 8003 | echo "TARGET_ABI32=y" >> $config_target_mak |
72b675ca | 8004 | ;; |
0adcffb1 | 8005 | mips|mipsel) |
0454728c | 8006 | mttcg="yes" |
b498c8a0 | 8007 | TARGET_ARCH=mips |
25be210f | 8008 | echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak |
c59716fc | 8009 | TARGET_SYSTBL_ABI=o32 |
2408a527 AJ |
8010 | ;; |
8011 | mipsn32|mipsn32el) | |
0454728c | 8012 | mttcg="yes" |
597e2cec | 8013 | TARGET_ARCH=mips64 |
6acff7da | 8014 | TARGET_BASE_ARCH=mips |
25be210f | 8015 | echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak |
597e2cec | 8016 | echo "TARGET_ABI32=y" >> $config_target_mak |
686a0fe4 | 8017 | TARGET_SYSTBL_ABI=n32 |
2408a527 AJ |
8018 | ;; |
8019 | mips64|mips64el) | |
a092a955 | 8020 | mttcg="no" |
b498c8a0 | 8021 | TARGET_ARCH=mips64 |
6acff7da | 8022 | TARGET_BASE_ARCH=mips |
25be210f | 8023 | echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak |
686a0fe4 | 8024 | TARGET_SYSTBL_ABI=n64 |
2408a527 | 8025 | ;; |
d15a9c23 AG |
8026 | moxie) |
8027 | ;; | |
e671711c MV |
8028 | nios2) |
8029 | ;; | |
4a09d0bb | 8030 | or1k) |
e67db06e JL |
8031 | TARGET_ARCH=openrisc |
8032 | TARGET_BASE_ARCH=openrisc | |
e67db06e | 8033 | ;; |
2408a527 | 8034 | ppc) |
c8b3532d | 8035 | gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" |
76a691f1 | 8036 | TARGET_SYSTBL_ABI=common,nospu,32 |
2408a527 | 8037 | ;; |
2408a527 | 8038 | ppc64) |
6acff7da | 8039 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 8040 | TARGET_ABI_DIR=ppc |
76a691f1 | 8041 | TARGET_SYSTBL_ABI=common,nospu,64 |
f0b0685d | 8042 | mttcg=yes |
1438eff3 | 8043 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" |
2408a527 | 8044 | ;; |
9c35126c DK |
8045 | ppc64le) |
8046 | TARGET_ARCH=ppc64 | |
8047 | TARGET_BASE_ARCH=ppc | |
8048 | TARGET_ABI_DIR=ppc | |
76a691f1 | 8049 | TARGET_SYSTBL_ABI=common,nospu,64 |
f0b0685d | 8050 | mttcg=yes |
1438eff3 | 8051 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" |
9c35126c | 8052 | ;; |
2408a527 | 8053 | ppc64abi32) |
b498c8a0 | 8054 | TARGET_ARCH=ppc64 |
6acff7da | 8055 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 8056 | TARGET_ABI_DIR=ppc |
76a691f1 | 8057 | TARGET_SYSTBL_ABI=common,nospu,32 |
25be210f | 8058 | echo "TARGET_ABI32=y" >> $config_target_mak |
1438eff3 | 8059 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" |
2408a527 | 8060 | ;; |
25fa194b MC |
8061 | riscv32) |
8062 | TARGET_BASE_ARCH=riscv | |
8063 | TARGET_ABI_DIR=riscv | |
8064 | mttcg=yes | |
ae4a70c0 | 8065 | gdb_xml_files="riscv-32bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-32bit-csr.xml riscv-32bit-virtual.xml" |
25fa194b MC |
8066 | ;; |
8067 | riscv64) | |
8068 | TARGET_BASE_ARCH=riscv | |
8069 | TARGET_ABI_DIR=riscv | |
8070 | mttcg=yes | |
ae4a70c0 | 8071 | gdb_xml_files="riscv-64bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-64bit-csr.xml riscv-64bit-virtual.xml" |
25fa194b | 8072 | ;; |
c8c35e5f YS |
8073 | rx) |
8074 | TARGET_ARCH=rx | |
8075 | bflt="yes" | |
8076 | target_compiler=$cross_cc_rx | |
8077 | gdb_xml_files="rx-core.xml" | |
8078 | ;; | |
2408a527 | 8079 | sh4|sh4eb) |
b498c8a0 | 8080 | TARGET_ARCH=sh4 |
d0c832f6 | 8081 | TARGET_SYSTBL_ABI=common |
2408a527 AJ |
8082 | bflt="yes" |
8083 | ;; | |
8084 | sparc) | |
bb0cdc03 | 8085 | TARGET_SYSTBL_ABI=common,32 |
2408a527 AJ |
8086 | ;; |
8087 | sparc64) | |
6acff7da | 8088 | TARGET_BASE_ARCH=sparc |
bb0cdc03 | 8089 | TARGET_SYSTBL_ABI=common,64 |
2408a527 AJ |
8090 | ;; |
8091 | sparc32plus) | |
b498c8a0 | 8092 | TARGET_ARCH=sparc64 |
6acff7da | 8093 | TARGET_BASE_ARCH=sparc |
e6e91b9c | 8094 | TARGET_ABI_DIR=sparc |
bb0cdc03 | 8095 | TARGET_SYSTBL_ABI=common,32 |
25be210f | 8096 | echo "TARGET_ABI32=y" >> $config_target_mak |
2408a527 | 8097 | ;; |
24e804ec | 8098 | s390x) |
318f371d | 8099 | TARGET_SYSTBL_ABI=common,64 |
63685bc4 | 8100 | mttcg=yes |
86158a2a | 8101 | gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml" |
24e804ec | 8102 | ;; |
444e06b1 CG |
8103 | tilegx) |
8104 | ;; | |
5ecaa4ed PC |
8105 | tricore) |
8106 | ;; | |
d2fbca94 | 8107 | unicore32) |
d2fbca94 | 8108 | ;; |
cfa550c6 MF |
8109 | xtensa|xtensaeb) |
8110 | TARGET_ARCH=xtensa | |
a4a93592 | 8111 | TARGET_SYSTBL_ABI=common |
02e33e9f | 8112 | bflt="yes" |
9fb40342 | 8113 | mttcg="yes" |
cfa550c6 | 8114 | ;; |
2408a527 | 8115 | *) |
76ad07a4 | 8116 | error_exit "Unsupported target CPU" |
2408a527 AJ |
8117 | ;; |
8118 | esac | |
5e8861a0 PB |
8119 | # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH |
8120 | if [ "$TARGET_BASE_ARCH" = "" ]; then | |
8121 | TARGET_BASE_ARCH=$TARGET_ARCH | |
8122 | fi | |
8123 | ||
5e8861a0 PB |
8124 | symlink "$source_path/Makefile.target" "$target_dir/Makefile" |
8125 | ||
99afc91d DB |
8126 | upper() { |
8127 | echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' | |
8128 | } | |
8129 | ||
89138857 | 8130 | target_arch_name="$(upper $TARGET_ARCH)" |
25be210f | 8131 | echo "TARGET_$target_arch_name=y" >> $config_target_mak |
c1799a84 | 8132 | echo "TARGET_NAME=$target_name" >> $config_target_mak |
25be210f | 8133 | echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak |
e6e91b9c JQ |
8134 | if [ "$TARGET_ABI_DIR" = "" ]; then |
8135 | TARGET_ABI_DIR=$TARGET_ARCH | |
8136 | fi | |
25be210f | 8137 | echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak |
adfc3e91 SS |
8138 | if [ "$HOST_VARIANT_DIR" != "" ]; then |
8139 | echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak | |
8140 | fi | |
4d6a835d LV |
8141 | if [ "$TARGET_SYSTBL_ABI" != "" ]; then |
8142 | echo "TARGET_SYSTBL_ABI=$TARGET_SYSTBL_ABI" >> $config_target_mak | |
8143 | fi | |
3b6b7550 PB |
8144 | |
8145 | if supported_xen_target $target; then | |
8146 | echo "CONFIG_XEN=y" >> $config_target_mak | |
e0e312f3 | 8147 | echo "$target/config-devices.mak: CONFIG_XEN=y" >> $config_host_mak |
3b6b7550 | 8148 | if test "$xen_pci_passthrough" = yes; then |
eb6fda0f | 8149 | echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" |
1b0c87fc | 8150 | fi |
e0e312f3 PB |
8151 | else |
8152 | echo "$target/config-devices.mak: CONFIG_XEN=n" >> $config_host_mak | |
3b6b7550 PB |
8153 | fi |
8154 | if supported_kvm_target $target; then | |
8155 | echo "CONFIG_KVM=y" >> $config_target_mak | |
e0e312f3 PB |
8156 | echo "$target/config-devices.mak: CONFIG_KVM=y" >> $config_host_mak |
8157 | else | |
8158 | echo "$target/config-devices.mak: CONFIG_KVM=n" >> $config_host_mak | |
3b6b7550 PB |
8159 | fi |
8160 | if supported_hax_target $target; then | |
8161 | echo "CONFIG_HAX=y" >> $config_target_mak | |
b0cb0a66 | 8162 | fi |
c97d6d2c SAGDR |
8163 | if supported_hvf_target $target; then |
8164 | echo "CONFIG_HVF=y" >> $config_target_mak | |
8165 | fi | |
d661d9a4 JTV |
8166 | if supported_whpx_target $target; then |
8167 | echo "CONFIG_WHPX=y" >> $config_target_mak | |
8168 | fi | |
52bf9771 TN |
8169 | if test "$target_aligned_only" = "yes" ; then |
8170 | echo "TARGET_ALIGNED_ONLY=y" >> $config_target_mak | |
8171 | fi | |
de83cd02 | 8172 | if test "$target_bigendian" = "yes" ; then |
25be210f | 8173 | echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak |
de83cd02 | 8174 | fi |
97a847bc | 8175 | if test "$target_softmmu" = "yes" ; then |
25be210f | 8176 | echo "CONFIG_SOFTMMU=y" >> $config_target_mak |
ca759f9e AB |
8177 | if test "$mttcg" = "yes" ; then |
8178 | echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak | |
8179 | fi | |
43ce4dfe | 8180 | fi |
997344f3 | 8181 | if test "$target_user_only" = "yes" ; then |
25be210f | 8182 | echo "CONFIG_USER_ONLY=y" >> $config_target_mak |
a2c80be9 | 8183 | echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak |
997344f3 | 8184 | fi |
831b7825 | 8185 | if test "$target_linux_user" = "yes" ; then |
25be210f | 8186 | echo "CONFIG_LINUX_USER=y" >> $config_target_mak |
831b7825 | 8187 | fi |
56aebc89 PB |
8188 | list="" |
8189 | if test ! -z "$gdb_xml_files" ; then | |
8190 | for x in $gdb_xml_files; do | |
8191 | list="$list $source_path/gdb-xml/$x" | |
8192 | done | |
3d0f1517 | 8193 | echo "TARGET_XML_FILES=$list" >> $config_target_mak |
56aebc89 | 8194 | fi |
97a847bc | 8195 | |
e633a5c6 | 8196 | if test "$target_user_only" = "yes" && test "$bflt" = "yes"; then |
25be210f | 8197 | echo "TARGET_HAS_BFLT=y" >> $config_target_mak |
e5fe0c52 | 8198 | fi |
84778508 | 8199 | if test "$target_bsd_user" = "yes" ; then |
25be210f | 8200 | echo "CONFIG_BSD_USER=y" >> $config_target_mak |
84778508 | 8201 | fi |
5b0753e0 | 8202 | |
716a507c | 8203 | |
db5adeaa | 8204 | # generate QEMU_CFLAGS/QEMU_LDFLAGS for targets |
fa282484 | 8205 | |
4afddb55 | 8206 | cflags="" |
fa282484 | 8207 | ldflags="" |
9b8e111f | 8208 | |
c765fcac PC |
8209 | disas_config() { |
8210 | echo "CONFIG_${1}_DIS=y" >> $config_target_mak | |
8211 | echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak | |
8212 | } | |
8213 | ||
64656024 JQ |
8214 | for i in $ARCH $TARGET_BASE_ARCH ; do |
8215 | case "$i" in | |
8216 | alpha) | |
c765fcac | 8217 | disas_config "ALPHA" |
64656024 | 8218 | ;; |
82295d8a RH |
8219 | aarch64) |
8220 | if test -n "${cxx}"; then | |
c765fcac | 8221 | disas_config "ARM_A64" |
82295d8a RH |
8222 | fi |
8223 | ;; | |
64656024 | 8224 | arm) |
c765fcac | 8225 | disas_config "ARM" |
999b53ec | 8226 | if test -n "${cxx}"; then |
c765fcac | 8227 | disas_config "ARM_A64" |
999b53ec | 8228 | fi |
64656024 JQ |
8229 | ;; |
8230 | cris) | |
c765fcac | 8231 | disas_config "CRIS" |
64656024 | 8232 | ;; |
429b31a2 RH |
8233 | hppa) |
8234 | disas_config "HPPA" | |
8235 | ;; | |
c72b26ec | 8236 | i386|x86_64|x32) |
c765fcac | 8237 | disas_config "I386" |
64656024 | 8238 | ;; |
79368f49 | 8239 | lm32) |
c765fcac | 8240 | disas_config "LM32" |
79368f49 | 8241 | ;; |
64656024 | 8242 | m68k) |
c765fcac | 8243 | disas_config "M68K" |
64656024 | 8244 | ;; |
877fdc12 | 8245 | microblaze*) |
c765fcac | 8246 | disas_config "MICROBLAZE" |
64656024 JQ |
8247 | ;; |
8248 | mips*) | |
c765fcac | 8249 | disas_config "MIPS" |
89a955e8 AM |
8250 | if test -n "${cxx}"; then |
8251 | disas_config "NANOMIPS" | |
8252 | fi | |
64656024 | 8253 | ;; |
d15a9c23 | 8254 | moxie*) |
c765fcac | 8255 | disas_config "MOXIE" |
d15a9c23 | 8256 | ;; |
e671711c MV |
8257 | nios2) |
8258 | disas_config "NIOS2" | |
8259 | ;; | |
4a09d0bb | 8260 | or1k) |
c765fcac | 8261 | disas_config "OPENRISC" |
e67db06e | 8262 | ;; |
64656024 | 8263 | ppc*) |
c765fcac | 8264 | disas_config "PPC" |
64656024 | 8265 | ;; |
c4f80543 | 8266 | riscv*) |
25fa194b MC |
8267 | disas_config "RISCV" |
8268 | ;; | |
c8c35e5f YS |
8269 | rx) |
8270 | disas_config "RX" | |
8271 | ;; | |
24e804ec | 8272 | s390*) |
c765fcac | 8273 | disas_config "S390" |
64656024 JQ |
8274 | ;; |
8275 | sh4) | |
c765fcac | 8276 | disas_config "SH4" |
64656024 JQ |
8277 | ;; |
8278 | sparc*) | |
c765fcac | 8279 | disas_config "SPARC" |
64656024 | 8280 | ;; |
cfa550c6 | 8281 | xtensa*) |
c765fcac | 8282 | disas_config "XTENSA" |
cfa550c6 | 8283 | ;; |
64656024 JQ |
8284 | esac |
8285 | done | |
9195b2c2 | 8286 | if test "$tcg_interpreter" = "yes" ; then |
c765fcac | 8287 | disas_config "TCI" |
9195b2c2 | 8288 | fi |
64656024 | 8289 | |
6ee7126f JQ |
8290 | case "$ARCH" in |
8291 | alpha) | |
8292 | # Ensure there's only a single GP | |
8293 | cflags="-msmall-data $cflags" | |
8294 | ;; | |
8295 | esac | |
8296 | ||
d02c1db3 | 8297 | if test "$gprof" = "yes" ; then |
d02c1db3 JQ |
8298 | if test "$target_linux_user" = "yes" ; then |
8299 | cflags="-p $cflags" | |
8300 | ldflags="-p $ldflags" | |
8301 | fi | |
8302 | if test "$target_softmmu" = "yes" ; then | |
8303 | ldflags="-p $ldflags" | |
25be210f | 8304 | echo "GPROF_CFLAGS=-p" >> $config_target_mak |
d02c1db3 JQ |
8305 | fi |
8306 | fi | |
8307 | ||
e9a3591f CB |
8308 | # Newer kernels on s390 check for an S390_PGSTE program header and |
8309 | # enable the pgste page table extensions in that case. This makes | |
8310 | # the vm.allocate_pgste sysctl unnecessary. We enable this program | |
8311 | # header if | |
8312 | # - we build on s390x | |
8313 | # - we build the system emulation for s390x (qemu-system-s390x) | |
8314 | # - KVM is enabled | |
8315 | # - the linker supports --s390-pgste | |
e633a5c6 EB |
8316 | if test "$TARGET_ARCH" = "s390x" && test "$target_softmmu" = "yes" && \ |
8317 | test "$ARCH" = "s390x" && test "$kvm" = "yes"; then | |
e9a3591f CB |
8318 | if ld_has --s390-pgste ; then |
8319 | ldflags="-Wl,--s390-pgste $ldflags" | |
8320 | fi | |
8321 | fi | |
8322 | ||
db5adeaa | 8323 | echo "QEMU_LDFLAGS+=$ldflags" >> $config_target_mak |
25be210f | 8324 | echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak |
fa282484 | 8325 | |
97a847bc | 8326 | done # for target in $targets |
7d13299d | 8327 | |
d52c454a MAL |
8328 | echo "PIXMAN_CFLAGS=$pixman_cflags" >> $config_host_mak |
8329 | echo "PIXMAN_LIBS=$pixman_libs" >> $config_host_mak | |
8330 | ||
e3971d61 | 8331 | if [ "$fdt" = "git" ]; then |
3b8593ee | 8332 | echo "config-host.h: dtc/all" >> $config_host_mak |
a540f158 | 8333 | fi |
e219c499 | 8334 | if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then |
3b8593ee | 8335 | echo "config-host.h: capstone/all" >> $config_host_mak |
e219c499 RH |
8336 | fi |
8337 | if test -n "$LIBCAPSTONE"; then | |
8338 | echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak | |
8339 | fi | |
a540f158 | 8340 | |
a99d57bb WG |
8341 | if test "$numa" = "yes"; then |
8342 | echo "CONFIG_NUMA=y" >> $config_host_mak | |
8343 | fi | |
8344 | ||
fd0e6053 JS |
8345 | if test "$ccache_cpp2" = "yes"; then |
8346 | echo "export CCACHE_CPP2=y" >> $config_host_mak | |
8347 | fi | |
8348 | ||
e29e5c6e PM |
8349 | # If we're using a separate build tree, set it up now. |
8350 | # DIRS are directories which we simply mkdir in the build tree; | |
8351 | # LINKS are things to symlink back into the source tree | |
8352 | # (these can be both files and directories). | |
8353 | # Caution: do not add files or directories here using wildcards. This | |
8354 | # will result in problems later if a new file matching the wildcard is | |
8355 | # added to the source tree -- nothing will cause configure to be rerun | |
8356 | # so the build tree will be missing the link back to the new file, and | |
8357 | # tests might fail. Prefer to keep the relevant files in their own | |
8358 | # directory and symlink the directory instead. | |
1cf4323e TH |
8359 | DIRS="tests tests/tcg tests/tcg/lm32 tests/qapi-schema tests/qtest/libqos" |
8360 | DIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph" | |
b855f8d1 | 8361 | DIRS="$DIRS docs docs/interop fsdev scsi" |
744a928c | 8362 | DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" |
d1807a4f | 8363 | DIRS="$DIRS roms/seabios roms/vgabios" |
2038f8c8 PB |
8364 | LINKS="Makefile" |
8365 | LINKS="$LINKS tests/tcg/lm32/Makefile po/Makefile" | |
8366 | LINKS="$LINKS tests/tcg/Makefile.target tests/fp/Makefile" | |
671f760b | 8367 | LINKS="$LINKS tests/plugin/Makefile" |
e29e5c6e | 8368 | LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps" |
e29e5c6e PM |
8369 | LINKS="$LINKS pc-bios/s390-ccw/Makefile" |
8370 | LINKS="$LINKS roms/seabios/Makefile roms/vgabios/Makefile" | |
8371 | LINKS="$LINKS pc-bios/qemu-icon.bmp" | |
8372 | LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit | |
39950353 PM |
8373 | LINKS="$LINKS tests/acceptance tests/data" |
8374 | LINKS="$LINKS tests/qemu-iotests/check" | |
8f8fd9ed | 8375 | LINKS="$LINKS python" |
753d11f2 RH |
8376 | for bios_file in \ |
8377 | $source_path/pc-bios/*.bin \ | |
225a9ab8 | 8378 | $source_path/pc-bios/*.lid \ |
753d11f2 RH |
8379 | $source_path/pc-bios/*.rom \ |
8380 | $source_path/pc-bios/*.dtb \ | |
e89e33e1 | 8381 | $source_path/pc-bios/*.img \ |
753d11f2 | 8382 | $source_path/pc-bios/openbios-* \ |
4e73c781 | 8383 | $source_path/pc-bios/u-boot.* \ |
26ce90fd | 8384 | $source_path/pc-bios/edk2-*.fd.bz2 \ |
753d11f2 RH |
8385 | $source_path/pc-bios/palcode-* |
8386 | do | |
e29e5c6e | 8387 | LINKS="$LINKS pc-bios/$(basename $bios_file)" |
d1807a4f PB |
8388 | done |
8389 | mkdir -p $DIRS | |
e29e5c6e | 8390 | for f in $LINKS ; do |
cab00a5a | 8391 | if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then |
f9245e10 PM |
8392 | symlink "$source_path/$f" "$f" |
8393 | fi | |
d1807a4f | 8394 | done |
1ad2134f | 8395 | |
2038f8c8 PB |
8396 | (for i in $cross_cc_vars; do |
8397 | export $i | |
8398 | done | |
afc3a8f9 | 8399 | export target_list source_path use_containers |
2038f8c8 PB |
8400 | $source_path/tests/tcg/configure.sh) |
8401 | ||
c34ebfdc | 8402 | # temporary config to build submodules |
2d9f27d2 | 8403 | for rom in seabios vgabios ; do |
c34ebfdc | 8404 | config_mak=roms/$rom/config.mak |
37116c89 | 8405 | echo "# Automatically generated by configure - do not modify" > $config_mak |
c34ebfdc | 8406 | echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak |
cdbd727c | 8407 | echo "AS=$as" >> $config_mak |
5f6f0e27 | 8408 | echo "CCAS=$ccas" >> $config_mak |
c34ebfdc AL |
8409 | echo "CC=$cc" >> $config_mak |
8410 | echo "BCC=bcc" >> $config_mak | |
3dd46c78 | 8411 | echo "CPP=$cpp" >> $config_mak |
c34ebfdc | 8412 | echo "OBJCOPY=objcopy" >> $config_mak |
a31a8642 | 8413 | echo "IASL=$iasl" >> $config_mak |
c34ebfdc | 8414 | echo "LD=$ld" >> $config_mak |
9f81aeb5 | 8415 | echo "RANLIB=$ranlib" >> $config_mak |
c34ebfdc AL |
8416 | done |
8417 | ||
76c7560a HR |
8418 | # set up qemu-iotests in this build directory |
8419 | iotests_common_env="tests/qemu-iotests/common.env" | |
76c7560a HR |
8420 | |
8421 | echo "# Automatically generated by configure - do not modify" > "$iotests_common_env" | |
8422 | echo >> "$iotests_common_env" | |
8423 | echo "export PYTHON='$python'" >> "$iotests_common_env" | |
8424 | ||
dc655404 MT |
8425 | # Save the configure command line for later reuse. |
8426 | cat <<EOD >config.status | |
8427 | #!/bin/sh | |
8428 | # Generated by configure. | |
8429 | # Run this file to recreate the current configuration. | |
8430 | # Compiler output produced by configure, useful for debugging | |
8431 | # configure, is in config.log if it exists. | |
8432 | EOD | |
e811da7f DB |
8433 | |
8434 | preserve_env() { | |
8435 | envname=$1 | |
8436 | ||
8437 | eval envval=\$$envname | |
8438 | ||
8439 | if test -n "$envval" | |
8440 | then | |
8441 | echo "$envname='$envval'" >> config.status | |
8442 | echo "export $envname" >> config.status | |
8443 | else | |
8444 | echo "unset $envname" >> config.status | |
8445 | fi | |
8446 | } | |
8447 | ||
8448 | # Preserve various env variables that influence what | |
8449 | # features/build target configure will detect | |
8450 | preserve_env AR | |
8451 | preserve_env AS | |
8452 | preserve_env CC | |
8453 | preserve_env CPP | |
8454 | preserve_env CXX | |
8455 | preserve_env INSTALL | |
8456 | preserve_env LD | |
8457 | preserve_env LD_LIBRARY_PATH | |
8458 | preserve_env LIBTOOL | |
8459 | preserve_env MAKE | |
8460 | preserve_env NM | |
8461 | preserve_env OBJCOPY | |
8462 | preserve_env PATH | |
8463 | preserve_env PKG_CONFIG | |
8464 | preserve_env PKG_CONFIG_LIBDIR | |
8465 | preserve_env PKG_CONFIG_PATH | |
8466 | preserve_env PYTHON | |
e811da7f DB |
8467 | preserve_env SDL2_CONFIG |
8468 | preserve_env SMBD | |
8469 | preserve_env STRIP | |
8470 | preserve_env WINDRES | |
8471 | ||
dc655404 MT |
8472 | printf "exec" >>config.status |
8473 | printf " '%s'" "$0" "$@" >>config.status | |
cf7cc929 | 8474 | echo ' "$@"' >>config.status |
dc655404 MT |
8475 | chmod +x config.status |
8476 | ||
8cd05ab6 | 8477 | rm -r "$TMPDIR1" |