]>
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 | ||
dedad027 DB |
14 | # make source path absolute |
15 | source_path=$(cd "$(dirname -- "$0")"; pwd) | |
16 | ||
17 | if test "$PWD" = "$source_path" | |
18 | then | |
19 | echo "Using './build' as the directory for build output" | |
20 | ||
21 | MARKER=build/auto-created-by-configure | |
22 | ||
23 | if test -e build | |
24 | then | |
25 | if test -f $MARKER | |
26 | then | |
27 | rm -rf build | |
28 | else | |
29 | echo "ERROR: ./build dir already exists and was not previously created by configure" | |
30 | exit 1 | |
31 | fi | |
32 | fi | |
33 | ||
34 | mkdir build | |
35 | touch $MARKER | |
36 | ||
37 | cat > GNUmakefile <<'EOF' | |
38 | # This file is auto-generated by configure to support in-source tree | |
39 | # 'make' command invocation | |
40 | ||
41 | ifeq ($(MAKECMDGOALS),) | |
42 | recurse: all | |
43 | endif | |
44 | ||
45 | .NOTPARALLEL: % | |
46 | %: force | |
47 | @echo 'changing dir to build for $(MAKE) "$(MAKECMDGOALS)"...' | |
48 | @$(MAKE) -C build -f Makefile $(MAKECMDGOALS) | |
49 | @if test "$(MAKECMDGOALS)" = "distclean" && \ | |
50 | test -e build/auto-created-by-configure ; \ | |
51 | then \ | |
52 | rm -rf build GNUmakefile ; \ | |
53 | fi | |
54 | force: ; | |
55 | .PHONY: force | |
56 | GNUmakefile: ; | |
57 | ||
58 | EOF | |
59 | cd build | |
60 | exec $source_path/configure "$@" | |
61 | fi | |
62 | ||
8cd05ab6 PM |
63 | # Temporary directory used for files created while |
64 | # configure runs. Since it is in the build directory | |
65 | # we can safely blow away any previous version of it | |
66 | # (and we need not jump through hoops to try to delete | |
67 | # it when configure exits.) | |
68 | TMPDIR1="config-temp" | |
69 | rm -rf "${TMPDIR1}" | |
70 | mkdir -p "${TMPDIR1}" | |
71 | if [ $? -ne 0 ]; then | |
72 | echo "ERROR: failed to create temporary directory" | |
73 | exit 1 | |
7d13299d FB |
74 | fi |
75 | ||
8cd05ab6 PM |
76 | TMPB="qemu-conf" |
77 | TMPC="${TMPDIR1}/${TMPB}.c" | |
66518bf6 | 78 | TMPO="${TMPDIR1}/${TMPB}.o" |
9c83ffd8 | 79 | TMPCXX="${TMPDIR1}/${TMPB}.cxx" |
8cd05ab6 | 80 | TMPE="${TMPDIR1}/${TMPB}.exe" |
6969ec6c | 81 | TMPMO="${TMPDIR1}/${TMPB}.mo" |
26fffe29 | 82 | TMPTXT="${TMPDIR1}/${TMPB}.txt" |
7d13299d | 83 | |
da1d85e3 | 84 | rm -f config.log |
9ac81bbb | 85 | |
b48e3611 PM |
86 | # Print a helpful header at the top of config.log |
87 | echo "# QEMU configure log $(date)" >> config.log | |
979ae168 PM |
88 | printf "# Configured with:" >> config.log |
89 | printf " '%s'" "$0" "$@" >> config.log | |
90 | echo >> config.log | |
b48e3611 PM |
91 | echo "#" >> config.log |
92 | ||
d880a3ba PB |
93 | print_error() { |
94 | (echo | |
76ad07a4 PM |
95 | echo "ERROR: $1" |
96 | while test -n "$2"; do | |
97 | echo " $2" | |
98 | shift | |
99 | done | |
d880a3ba PB |
100 | echo) >&2 |
101 | } | |
102 | ||
103 | error_exit() { | |
104 | print_error "$@" | |
76ad07a4 PM |
105 | exit 1 |
106 | } | |
107 | ||
9c83ffd8 PM |
108 | do_compiler() { |
109 | # Run the compiler, capturing its output to the log. First argument | |
110 | # is compiler binary to execute. | |
111 | local compiler="$1" | |
112 | shift | |
8bbe05d7 IJ |
113 | if test -n "$BASH_VERSION"; then eval ' |
114 | echo >>config.log " | |
115 | funcs: ${FUNCNAME[*]} | |
116 | lines: ${BASH_LINENO[*]}" | |
117 | '; fi | |
9c83ffd8 PM |
118 | echo $compiler "$@" >> config.log |
119 | $compiler "$@" >> config.log 2>&1 || return $? | |
8dc38a78 PM |
120 | # Test passed. If this is an --enable-werror build, rerun |
121 | # the test with -Werror and bail out if it fails. This | |
122 | # makes warning-generating-errors in configure test code | |
123 | # obvious to developers. | |
124 | if test "$werror" != "yes"; then | |
125 | return 0 | |
126 | fi | |
127 | # Don't bother rerunning the compile if we were already using -Werror | |
128 | case "$*" in | |
129 | *-Werror*) | |
130 | return 0 | |
131 | ;; | |
132 | esac | |
9c83ffd8 PM |
133 | echo $compiler -Werror "$@" >> config.log |
134 | $compiler -Werror "$@" >> config.log 2>&1 && return $? | |
76ad07a4 PM |
135 | error_exit "configure test passed without -Werror but failed with -Werror." \ |
136 | "This is probably a bug in the configure script. The failing command" \ | |
137 | "will be at the bottom of config.log." \ | |
138 | "You can run configure with --disable-werror to bypass this check." | |
8dc38a78 PM |
139 | } |
140 | ||
9c83ffd8 PM |
141 | do_cc() { |
142 | do_compiler "$cc" "$@" | |
143 | } | |
144 | ||
145 | do_cxx() { | |
146 | do_compiler "$cxx" "$@" | |
147 | } | |
148 | ||
00849b92 RH |
149 | # Append $2 to the variable named $1, with space separation |
150 | add_to() { | |
151 | eval $1=\${$1:+\"\$$1 \"}\$2 | |
152 | } | |
153 | ||
9c83ffd8 PM |
154 | update_cxxflags() { |
155 | # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those | |
156 | # options which some versions of GCC's C++ compiler complain about | |
157 | # because they only make sense for C programs. | |
53422040 | 158 | QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" |
086d5f75 | 159 | CXXFLAGS=$(echo "$CFLAGS" | sed s/-std=gnu99/-std=gnu++11/) |
9c83ffd8 PM |
160 | for arg in $QEMU_CFLAGS; do |
161 | case $arg in | |
162 | -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ | |
163 | -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls) | |
164 | ;; | |
165 | *) | |
166 | QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg | |
167 | ;; | |
168 | esac | |
169 | done | |
170 | } | |
171 | ||
52166aa0 | 172 | compile_object() { |
fd0e6053 | 173 | local_cflags="$1" |
086d5f75 | 174 | do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC |
52166aa0 JQ |
175 | } |
176 | ||
177 | compile_prog() { | |
178 | local_cflags="$1" | |
179 | local_ldflags="$2" | |
086d5f75 | 180 | do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $QEMU_LDFLAGS $local_ldflags |
52166aa0 JQ |
181 | } |
182 | ||
11568d6d PB |
183 | # symbolically link $1 to $2. Portable version of "ln -sf". |
184 | symlink() { | |
72b8b5a1 | 185 | rm -rf "$2" |
ec5b06d7 | 186 | mkdir -p "$(dirname "$2")" |
72b8b5a1 | 187 | ln -s "$1" "$2" |
11568d6d PB |
188 | } |
189 | ||
0dba6195 LM |
190 | # check whether a command is available to this shell (may be either an |
191 | # executable or a builtin) | |
192 | has() { | |
193 | type "$1" >/dev/null 2>&1 | |
194 | } | |
195 | ||
196 | # search for an executable in PATH | |
197 | path_of() { | |
198 | local_command="$1" | |
199 | local_ifs="$IFS" | |
200 | local_dir="" | |
201 | ||
202 | # pathname has a dir component? | |
203 | if [ "${local_command#*/}" != "$local_command" ]; then | |
204 | if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then | |
205 | echo "$local_command" | |
206 | return 0 | |
207 | fi | |
208 | fi | |
209 | if [ -z "$local_command" ]; then | |
210 | return 1 | |
211 | fi | |
212 | ||
213 | IFS=: | |
214 | for local_dir in $PATH; do | |
215 | if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then | |
216 | echo "$local_dir/$local_command" | |
217 | IFS="${local_ifs:-$(printf ' \t\n')}" | |
218 | return 0 | |
219 | fi | |
220 | done | |
221 | # not found | |
222 | IFS="${local_ifs:-$(printf ' \t\n')}" | |
223 | return 1 | |
224 | } | |
225 | ||
0a01d76f MAL |
226 | version_ge () { |
227 | local_ver1=`echo $1 | tr . ' '` | |
228 | local_ver2=`echo $2 | tr . ' '` | |
229 | while true; do | |
230 | set x $local_ver1 | |
231 | local_first=${2-0} | |
232 | # shift 2 does nothing if there are less than 2 arguments | |
233 | shift; shift | |
234 | local_ver1=$* | |
235 | set x $local_ver2 | |
236 | # the second argument finished, the first must be greater or equal | |
237 | test $# = 1 && return 0 | |
238 | test $local_first -lt $2 && return 1 | |
239 | test $local_first -gt $2 && return 0 | |
240 | shift; shift | |
241 | local_ver2=$* | |
242 | done | |
243 | } | |
244 | ||
5b808275 LV |
245 | have_backend () { |
246 | echo "$trace_backends" | grep "$1" >/dev/null | |
247 | } | |
248 | ||
3b6b7550 PB |
249 | glob() { |
250 | eval test -z '"${1#'"$2"'}"' | |
251 | } | |
252 | ||
253 | supported_hax_target() { | |
254 | test "$hax" = "yes" || return 1 | |
255 | glob "$1" "*-softmmu" || return 1 | |
256 | case "${1%-softmmu}" in | |
257 | i386|x86_64) | |
258 | return 0 | |
259 | ;; | |
260 | esac | |
261 | return 1 | |
262 | } | |
263 | ||
264 | supported_kvm_target() { | |
265 | test "$kvm" = "yes" || return 1 | |
266 | glob "$1" "*-softmmu" || return 1 | |
267 | case "${1%-softmmu}:$cpu" in | |
268 | arm:arm | aarch64:aarch64 | \ | |
269 | i386:i386 | i386:x86_64 | i386:x32 | \ | |
270 | x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \ | |
aa2953fd | 271 | mips:mips | mipsel:mips | mips64:mips | mips64el:mips | \ |
f8378acc | 272 | ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | ppc64:ppc64le | \ |
3b6b7550 PB |
273 | s390x:s390x) |
274 | return 0 | |
275 | ;; | |
276 | esac | |
277 | return 1 | |
278 | } | |
279 | ||
280 | supported_xen_target() { | |
281 | test "$xen" = "yes" || return 1 | |
282 | glob "$1" "*-softmmu" || return 1 | |
b5ed2e11 PB |
283 | # Only i386 and x86_64 provide the xenpv machine. |
284 | case "${1%-softmmu}" in | |
285 | i386|x86_64) | |
3b6b7550 PB |
286 | return 0 |
287 | ;; | |
288 | esac | |
289 | return 1 | |
290 | } | |
291 | ||
c97d6d2c SAGDR |
292 | supported_hvf_target() { |
293 | test "$hvf" = "yes" || return 1 | |
294 | glob "$1" "*-softmmu" || return 1 | |
295 | case "${1%-softmmu}" in | |
296 | x86_64) | |
297 | return 0 | |
298 | ;; | |
299 | esac | |
300 | return 1 | |
301 | } | |
302 | ||
d661d9a4 JTV |
303 | supported_whpx_target() { |
304 | test "$whpx" = "yes" || return 1 | |
305 | glob "$1" "*-softmmu" || return 1 | |
306 | case "${1%-softmmu}" in | |
307 | i386|x86_64) | |
308 | return 0 | |
309 | ;; | |
310 | esac | |
311 | return 1 | |
312 | } | |
313 | ||
d880a3ba PB |
314 | supported_target() { |
315 | case "$1" in | |
316 | *-softmmu) | |
317 | ;; | |
318 | *-linux-user) | |
319 | if test "$linux" != "yes"; then | |
320 | print_error "Target '$target' is only available on a Linux host" | |
321 | return 1 | |
322 | fi | |
323 | ;; | |
324 | *-bsd-user) | |
325 | if test "$bsd" != "yes"; then | |
326 | print_error "Target '$target' is only available on a BSD host" | |
327 | return 1 | |
328 | fi | |
329 | ;; | |
330 | *) | |
331 | print_error "Invalid target name '$target'" | |
332 | return 1 | |
333 | ;; | |
334 | esac | |
b3f6ea7e PB |
335 | test "$tcg" = "yes" && return 0 |
336 | supported_kvm_target "$1" && return 0 | |
337 | supported_xen_target "$1" && return 0 | |
338 | supported_hax_target "$1" && return 0 | |
c97d6d2c | 339 | supported_hvf_target "$1" && return 0 |
d661d9a4 | 340 | supported_whpx_target "$1" && return 0 |
b3f6ea7e PB |
341 | print_error "TCG disabled, but hardware accelerator not available for '$target'" |
342 | return 1 | |
d880a3ba PB |
343 | } |
344 | ||
e9a3591f CB |
345 | |
346 | ld_has() { | |
347 | $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1 | |
348 | } | |
349 | ||
4ace32e2 AO |
350 | if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]"; |
351 | then | |
352 | error_exit "main directory cannot contain spaces nor colons" | |
353 | fi | |
354 | ||
14211825 | 355 | # default parameters |
2ff6b91e | 356 | cpu="" |
a31a8642 | 357 | iasl="iasl" |
1e43adfc | 358 | interp_prefix="/usr/gnemul/qemu-%M" |
43ce4dfe | 359 | static="no" |
7d13299d | 360 | cross_prefix="" |
0c58ac1c | 361 | audio_drv_list="" |
b64ec4e4 FZ |
362 | block_drv_rw_whitelist="" |
363 | block_drv_ro_whitelist="" | |
e49d021e | 364 | host_cc="cc" |
02f9135b | 365 | libs_cpu="" |
73da375e | 366 | libs_softmmu="" |
3e2e0e6b | 367 | libs_tools="" |
d5631638 | 368 | audio_win_int="" |
957f1f99 | 369 | libs_qga="" |
5bc62e01 | 370 | debug_info="yes" |
63678e17 | 371 | stack_protector="" |
1e4f6065 | 372 | safe_stack="" |
afc3a8f9 | 373 | use_containers="yes" |
f2385398 | 374 | gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb") |
ac0df51d | 375 | |
92712822 DB |
376 | if test -e "$source_path/.git" |
377 | then | |
f62bbee5 | 378 | git_update=yes |
92712822 | 379 | git_submodules="ui/keycodemapdb" |
3ac1f813 EC |
380 | git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" |
381 | git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" | |
92712822 | 382 | else |
f62bbee5 | 383 | git_update=no |
92712822 | 384 | git_submodules="" |
5c0ef67a DB |
385 | |
386 | if ! test -f "$source_path/ui/keycodemapdb/README" | |
387 | then | |
388 | echo | |
389 | echo "ERROR: missing file $source_path/ui/keycodemapdb/README" | |
390 | echo | |
391 | echo "This is not a GIT checkout but module content appears to" | |
392 | echo "be missing. Do not use 'git archive' or GitHub download links" | |
393 | echo "to acquire QEMU source archives. Non-GIT builds are only" | |
394 | echo "supported with source archives linked from:" | |
395 | echo | |
a3e3b521 | 396 | echo " https://www.qemu.org/download/#source" |
5c0ef67a DB |
397 | echo |
398 | echo "Developers working with GIT can use scripts/archive-source.sh" | |
399 | echo "if they need to create valid source archives." | |
400 | echo | |
401 | exit 1 | |
402 | fi | |
92712822 | 403 | fi |
cc84d63a | 404 | git="git" |
ac0df51d | 405 | |
afb63ebd SW |
406 | # Don't accept a target_list environment variable. |
407 | unset target_list | |
447e133f | 408 | unset target_list_exclude |
377529c0 PB |
409 | |
410 | # Default value for a variable defining feature "foo". | |
411 | # * foo="no" feature will only be used if --enable-foo arg is given | |
412 | # * foo="" feature will be searched for, and if found, will be used | |
413 | # unless --disable-foo is given | |
414 | # * foo="yes" this value will only be set by --enable-foo flag. | |
415 | # feature will searched for, | |
416 | # if not found, configure exits with error | |
417 | # | |
418 | # Always add --enable-foo and --disable-foo command line args. | |
419 | # Distributions want to ensure that several features are compiled in, and it | |
420 | # is impossible without a --enable-foo that exits if a feature is not found. | |
421 | ||
377529c0 PB |
422 | brlapi="" |
423 | curl="" | |
424 | curses="" | |
425 | docs="" | |
426 | fdt="" | |
58952137 | 427 | netmap="no" |
377529c0 | 428 | sdl="" |
a442fe2f | 429 | sdl_image="" |
983eef5a | 430 | virtfs="" |
fe8fc5ae | 431 | mpath="" |
821601ea | 432 | vnc="yes" |
377529c0 | 433 | sparse="no" |
377529c0 | 434 | vde="" |
377529c0 PB |
435 | vnc_sasl="" |
436 | vnc_jpeg="" | |
437 | vnc_png="" | |
6a021536 | 438 | xkbcommon="" |
377529c0 | 439 | xen="" |
d5b93ddf | 440 | xen_ctrl_version="" |
eb6fda0f | 441 | xen_pci_passthrough="" |
377529c0 | 442 | linux_aio="" |
c10dd856 | 443 | linux_io_uring="" |
47e98658 | 444 | cap_ng="" |
377529c0 | 445 | attr="" |
4f26f2b6 | 446 | libattr="" |
377529c0 | 447 | xfs="" |
b3f6ea7e | 448 | tcg="yes" |
a40161cb | 449 | membarrier="" |
299e6f19 PB |
450 | vhost_net="" |
451 | vhost_crypto="" | |
452 | vhost_scsi="" | |
453 | vhost_vsock="" | |
e6a74868 | 454 | vhost_user="" |
98fc1ada | 455 | vhost_user_fs="" |
d41a75a2 | 456 | kvm="no" |
b0cb0a66 | 457 | hax="no" |
c97d6d2c | 458 | hvf="no" |
d661d9a4 | 459 | whpx="no" |
2da776db | 460 | rdma="" |
21ab34c9 | 461 | pvrdma="" |
377529c0 PB |
462 | gprof="no" |
463 | debug_tcg="no" | |
377529c0 | 464 | debug="no" |
247724cb | 465 | sanitizers="no" |
0aebab04 | 466 | tsan="no" |
b553a042 | 467 | fortify_source="" |
377529c0 | 468 | strip_opt="yes" |
9195b2c2 | 469 | tcg_interpreter="no" |
377529c0 PB |
470 | bigendian="no" |
471 | mingw32="no" | |
1d728c39 BS |
472 | gcov="no" |
473 | gcov_tool="gcov" | |
377529c0 | 474 | EXESUF="" |
17969268 FZ |
475 | DSOSUF=".so" |
476 | LDFLAGS_SHARED="-shared" | |
477 | modules="no" | |
bd83c861 | 478 | module_upgrades="no" |
377529c0 | 479 | prefix="/usr/local" |
3d5eecab | 480 | firmwarepath="\${prefix}/share/qemu-firmware" |
377529c0 | 481 | confsuffix="/qemu" |
675b9b53 | 482 | slirp="" |
377529c0 PB |
483 | oss_lib="" |
484 | bsd="no" | |
485 | linux="no" | |
486 | solaris="no" | |
487 | profiler="no" | |
488 | cocoa="no" | |
489 | softmmu="yes" | |
490 | linux_user="no" | |
377529c0 | 491 | bsd_user="no" |
377529c0 | 492 | blobs="yes" |
05dfa22b | 493 | edk2_blobs="no" |
377529c0 | 494 | pkgversion="" |
40d6444e | 495 | pie="" |
3556c233 | 496 | qom_cast_debug="yes" |
baf86d6b | 497 | trace_backends="log" |
377529c0 PB |
498 | trace_file="trace" |
499 | spice="" | |
500 | rbd="" | |
7b02f544 | 501 | smartcard="" |
2b2325ff | 502 | libusb="" |
69354a83 | 503 | usb_redir="" |
da076ffe | 504 | opengl="" |
014cb152 | 505 | opengl_dmabuf="no" |
5dd89908 | 506 | cpuid_h="no" |
86583a07 | 507 | avx2_opt="" |
1ece9905 | 508 | zlib="yes" |
8ca80760 | 509 | capstone="" |
b25c9dff SW |
510 | lzo="" |
511 | snappy="" | |
6b383c08 | 512 | bzip2="" |
83bc1f97 | 513 | lzfse="" |
3a678481 | 514 | zstd="" |
e8ef31a3 | 515 | guest_agent="" |
d9840e25 | 516 | guest_agent_with_vss="no" |
50cbebb9 | 517 | guest_agent_ntddscsi="no" |
9dacf32d | 518 | guest_agent_msi="" |
d9840e25 TS |
519 | vss_win32_sdk="" |
520 | win_sdk="no" | |
e10ee3f5 | 521 | want_tools="" |
c589b249 | 522 | libiscsi="" |
6542aa9c | 523 | libnfs="" |
519175a2 | 524 | coroutine="" |
70c60c08 | 525 | coroutine_pool="" |
7d992e4d | 526 | debug_stack_usage="no" |
f0d92b56 | 527 | crypto_afalg="no" |
f794573e | 528 | seccomp="" |
eb100396 | 529 | glusterfs="" |
d85fa9eb | 530 | glusterfs_xlator_opt="no" |
0c14fb47 | 531 | glusterfs_discard="no" |
df3a429a | 532 | glusterfs_fallocate="no" |
7c815372 | 533 | glusterfs_zerofill="no" |
e014dbe7 | 534 | glusterfs_ftruncate_has_stat="no" |
0e3b891f | 535 | glusterfs_iocb_has_stat="no" |
a4ccabcf | 536 | gtk="" |
925a0400 | 537 | gtk_gl="no" |
a1c5e949 | 538 | tls_priority="NORMAL" |
ddbb0d09 | 539 | gnutls="" |
91bfcdb0 | 540 | nettle="" |
dc2207af | 541 | nettle_xts="no" |
91bfcdb0 | 542 | gcrypt="" |
1f923c70 | 543 | gcrypt_hmac="no" |
e0576942 DB |
544 | gcrypt_xts="no" |
545 | qemu_private_xts="yes" | |
8953caf3 | 546 | auth_pam="" |
bbbf9bfb | 547 | vte="" |
9d9e1521 | 548 | virglrenderer="" |
7aaa6a16 | 549 | tpm="" |
b10d49d7 | 550 | libssh="" |
ed1701c6 | 551 | live_block_migration="yes" |
a99d57bb | 552 | numa="" |
2847b469 | 553 | tcmalloc="no" |
7b01cb97 | 554 | jemalloc="no" |
a6b1d4c0 | 555 | replication="yes" |
2f740136 JC |
556 | bochs="yes" |
557 | cloop="yes" | |
558 | dmg="yes" | |
559 | qcow1="yes" | |
560 | vdi="yes" | |
561 | vvfat="yes" | |
562 | qed="yes" | |
563 | parallels="yes" | |
564 | sheepdog="yes" | |
ed279a06 | 565 | libxml2="" |
ba59fb77 | 566 | debug_mutex="no" |
17824406 | 567 | libpmem="" |
f3494749 | 568 | default_devices="yes" |
40e8c6f4 | 569 | plugins="no" |
adc28027 | 570 | fuzzing="no" |
b767d257 | 571 | rng_none="no" |
54e7aac0 | 572 | secret_keyring="" |
21b2eca6 | 573 | libdaxctl="" |
a5665051 PB |
574 | meson="" |
575 | skip_meson=no | |
377529c0 | 576 | |
fb59dabd | 577 | bogus_os="no" |
5a22ab71 | 578 | malloc_trim="" |
898be3e0 | 579 | |
ac0df51d AL |
580 | # parse CC options first |
581 | for opt do | |
89138857 | 582 | optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') |
ac0df51d AL |
583 | case "$opt" in |
584 | --cross-prefix=*) cross_prefix="$optarg" | |
585 | ;; | |
3d8df640 | 586 | --cc=*) CC="$optarg" |
ac0df51d | 587 | ;; |
83f73fce TS |
588 | --cxx=*) CXX="$optarg" |
589 | ;; | |
2ff6b91e JQ |
590 | --cpu=*) cpu="$optarg" |
591 | ;; | |
de385287 | 592 | --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" |
db5adeaa | 593 | QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" |
e2a2ed06 | 594 | ;; |
11cde1c8 | 595 | --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" |
11cde1c8 | 596 | ;; |
db5adeaa | 597 | --extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" |
f9943cd5 | 598 | EXTRA_LDFLAGS="$optarg" |
e2a2ed06 | 599 | ;; |
5bc62e01 GH |
600 | --enable-debug-info) debug_info="yes" |
601 | ;; | |
602 | --disable-debug-info) debug_info="no" | |
603 | ;; | |
d75402b5 AB |
604 | --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" |
605 | ;; | |
d422b2bc AB |
606 | --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} |
607 | eval "cross_cc_cflags_${cc_arch}=\$optarg" | |
2038f8c8 | 608 | cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" |
d422b2bc | 609 | ;; |
d75402b5 | 610 | --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} |
2038f8c8 | 611 | cc_archs="$cc_archs $cc_arch" |
d75402b5 | 612 | eval "cross_cc_${cc_arch}=\$optarg" |
2038f8c8 | 613 | cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}" |
d75402b5 | 614 | ;; |
ac0df51d AL |
615 | esac |
616 | done | |
ac0df51d AL |
617 | # OS specific |
618 | # Using uname is really, really broken. Once we have the right set of checks | |
93148aa5 | 619 | # we can eliminate its usage altogether. |
ac0df51d | 620 | |
e49d021e PM |
621 | # Preferred compiler: |
622 | # ${CC} (if set) | |
623 | # ${cross_prefix}gcc (if cross-prefix specified) | |
624 | # system compiler | |
625 | if test -z "${CC}${cross_prefix}"; then | |
626 | cc="$host_cc" | |
627 | else | |
628 | cc="${CC-${cross_prefix}gcc}" | |
629 | fi | |
630 | ||
83f73fce TS |
631 | if test -z "${CXX}${cross_prefix}"; then |
632 | cxx="c++" | |
633 | else | |
634 | cxx="${CXX-${cross_prefix}g++}" | |
635 | fi | |
636 | ||
b3198cc2 | 637 | ar="${AR-${cross_prefix}ar}" |
cdbd727c | 638 | as="${AS-${cross_prefix}as}" |
5f6f0e27 | 639 | ccas="${CCAS-$cc}" |
3dd46c78 | 640 | cpp="${CPP-$cc -E}" |
b3198cc2 SY |
641 | objcopy="${OBJCOPY-${cross_prefix}objcopy}" |
642 | ld="${LD-${cross_prefix}ld}" | |
9f81aeb5 | 643 | ranlib="${RANLIB-${cross_prefix}ranlib}" |
4852ee95 | 644 | nm="${NM-${cross_prefix}nm}" |
b3198cc2 SY |
645 | strip="${STRIP-${cross_prefix}strip}" |
646 | windres="${WINDRES-${cross_prefix}windres}" | |
17884d7b ST |
647 | pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" |
648 | query_pkg_config() { | |
649 | "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" | |
650 | } | |
651 | pkg_config=query_pkg_config | |
47c03744 | 652 | sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" |
ac0df51d | 653 | |
45d285ab PM |
654 | # If the user hasn't specified ARFLAGS, default to 'rv', just as make does. |
655 | ARFLAGS="${ARFLAGS-rv}" | |
656 | ||
be17dc90 | 657 | # default flags for all hosts |
2d31515b PM |
658 | # We use -fwrapv to tell the compiler that we require a C dialect where |
659 | # left shift of signed integers is well defined and has the expected | |
660 | # 2s-complement style results. (Both clang and gcc agree that it | |
661 | # provides these semantics.) | |
086d5f75 PB |
662 | QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS" |
663 | QEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" | |
c95e3080 | 664 | QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" |
be17dc90 | 665 | QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" |
25211446 PB |
666 | QEMU_INCLUDES="-iquote . -iquote ${source_path} -iquote ${source_path}/accel/tcg -iquote ${source_path}/include" |
667 | QEMU_INCLUDES="$QEMU_INCLUDES -iquote ${source_path}/disas/libvixl" | |
086d5f75 PB |
668 | CFLAGS="-std=gnu99 -Wall" |
669 | ||
be17dc90 | 670 | |
cab00a5a MT |
671 | # running configure in the source tree? |
672 | # we know that's the case if configure is there. | |
673 | if test -f "./configure"; then | |
674 | pwd_is_source_path="y" | |
675 | else | |
676 | pwd_is_source_path="n" | |
677 | fi | |
678 | ||
ac0df51d AL |
679 | check_define() { |
680 | cat > $TMPC <<EOF | |
681 | #if !defined($1) | |
fd786e1a | 682 | #error $1 not defined |
ac0df51d AL |
683 | #endif |
684 | int main(void) { return 0; } | |
685 | EOF | |
52166aa0 | 686 | compile_object |
ac0df51d AL |
687 | } |
688 | ||
307119e7 GH |
689 | check_include() { |
690 | cat > $TMPC <<EOF | |
691 | #include <$1> | |
692 | int main(void) { return 0; } | |
693 | EOF | |
694 | compile_object | |
695 | } | |
696 | ||
93b25869 JS |
697 | write_c_skeleton() { |
698 | cat > $TMPC <<EOF | |
699 | int main(void) { return 0; } | |
700 | EOF | |
701 | } | |
702 | ||
adc28027 AB |
703 | write_c_fuzzer_skeleton() { |
704 | cat > $TMPC <<EOF | |
705 | #include <stdint.h> | |
706 | #include <sys/types.h> | |
707 | int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); | |
708 | int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } | |
709 | EOF | |
710 | } | |
711 | ||
bbea4050 PM |
712 | if check_define __linux__ ; then |
713 | targetos="Linux" | |
714 | elif check_define _WIN32 ; then | |
715 | targetos='MINGW32' | |
716 | elif check_define __OpenBSD__ ; then | |
717 | targetos='OpenBSD' | |
718 | elif check_define __sun__ ; then | |
719 | targetos='SunOS' | |
720 | elif check_define __HAIKU__ ; then | |
721 | targetos='Haiku' | |
951fedfc PM |
722 | elif check_define __FreeBSD__ ; then |
723 | targetos='FreeBSD' | |
724 | elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then | |
725 | targetos='GNU/kFreeBSD' | |
726 | elif check_define __DragonFly__ ; then | |
727 | targetos='DragonFly' | |
728 | elif check_define __NetBSD__; then | |
729 | targetos='NetBSD' | |
730 | elif check_define __APPLE__; then | |
731 | targetos='Darwin' | |
bbea4050 | 732 | else |
951fedfc PM |
733 | # This is a fatal error, but don't report it yet, because we |
734 | # might be going to just print the --help text, or it might | |
735 | # be the result of a missing compiler. | |
736 | targetos='bogus' | |
737 | bogus_os='yes' | |
bbea4050 PM |
738 | fi |
739 | ||
740 | # Some host OSes need non-standard checks for which CPU to use. | |
741 | # Note that these checks are broken for cross-compilation: if you're | |
742 | # cross-compiling to one of these OSes then you'll need to specify | |
743 | # the correct CPU with the --cpu option. | |
744 | case $targetos in | |
745 | Darwin) | |
746 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can | |
747 | # run 64-bit userspace code. | |
748 | # If the user didn't specify a CPU explicitly and the kernel says this is | |
749 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. | |
750 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | |
751 | cpu="x86_64" | |
752 | fi | |
753 | ;; | |
754 | SunOS) | |
89138857 | 755 | # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo |
bbea4050 PM |
756 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then |
757 | cpu="x86_64" | |
758 | fi | |
759 | esac | |
760 | ||
2ff6b91e JQ |
761 | if test ! -z "$cpu" ; then |
762 | # command line argument | |
763 | : | |
764 | elif check_define __i386__ ; then | |
ac0df51d AL |
765 | cpu="i386" |
766 | elif check_define __x86_64__ ; then | |
c72b26ec RH |
767 | if check_define __ILP32__ ; then |
768 | cpu="x32" | |
769 | else | |
770 | cpu="x86_64" | |
771 | fi | |
3aa9bd6c | 772 | elif check_define __sparc__ ; then |
3aa9bd6c BS |
773 | if check_define __arch64__ ; then |
774 | cpu="sparc64" | |
775 | else | |
776 | cpu="sparc" | |
777 | fi | |
fdf7ed96 | 778 | elif check_define _ARCH_PPC ; then |
779 | if check_define _ARCH_PPC64 ; then | |
f8378acc RH |
780 | if check_define _LITTLE_ENDIAN ; then |
781 | cpu="ppc64le" | |
782 | else | |
783 | cpu="ppc64" | |
784 | fi | |
fdf7ed96 | 785 | else |
786 | cpu="ppc" | |
787 | fi | |
afa05235 AJ |
788 | elif check_define __mips__ ; then |
789 | cpu="mips" | |
d66ed0ea AJ |
790 | elif check_define __s390__ ; then |
791 | if check_define __s390x__ ; then | |
792 | cpu="s390x" | |
793 | else | |
794 | cpu="s390" | |
795 | fi | |
c4f80543 AF |
796 | elif check_define __riscv ; then |
797 | if check_define _LP64 ; then | |
798 | cpu="riscv64" | |
799 | else | |
800 | cpu="riscv32" | |
801 | fi | |
21d89f84 PM |
802 | elif check_define __arm__ ; then |
803 | cpu="arm" | |
1f080313 CF |
804 | elif check_define __aarch64__ ; then |
805 | cpu="aarch64" | |
ac0df51d | 806 | else |
89138857 | 807 | cpu=$(uname -m) |
ac0df51d AL |
808 | fi |
809 | ||
359bc95d PM |
810 | ARCH= |
811 | # Normalise host CPU name and set ARCH. | |
812 | # Note that this case should only have supported host CPUs, not guests. | |
7d13299d | 813 | case "$cpu" in |
ee35e968 | 814 | ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64) |
898be3e0 | 815 | ;; |
f8378acc RH |
816 | ppc64le) |
817 | ARCH="ppc64" | |
f8378acc | 818 | ;; |
7d13299d | 819 | i386|i486|i586|i686|i86pc|BePC) |
97a847bc | 820 | cpu="i386" |
7d13299d | 821 | ;; |
aaa5fa14 AJ |
822 | x86_64|amd64) |
823 | cpu="x86_64" | |
824 | ;; | |
21d89f84 PM |
825 | armv*b|armv*l|arm) |
826 | cpu="arm" | |
7d13299d | 827 | ;; |
1f080313 CF |
828 | aarch64) |
829 | cpu="aarch64" | |
830 | ;; | |
afa05235 AJ |
831 | mips*) |
832 | cpu="mips" | |
833 | ;; | |
3142255c | 834 | sparc|sun4[cdmuv]) |
ae228531 FB |
835 | cpu="sparc" |
836 | ;; | |
7d13299d | 837 | *) |
359bc95d PM |
838 | # This will result in either an error or falling back to TCI later |
839 | ARCH=unknown | |
7d13299d FB |
840 | ;; |
841 | esac | |
359bc95d PM |
842 | if test -z "$ARCH"; then |
843 | ARCH="$cpu" | |
844 | fi | |
e2d52ad3 | 845 | |
7d13299d | 846 | # OS specific |
0dbfc675 | 847 | |
adfc3e91 SS |
848 | # host *BSD for user mode |
849 | HOST_VARIANT_DIR="" | |
850 | ||
7d13299d | 851 | case $targetos in |
67b915a5 | 852 | MINGW32*) |
0dbfc675 | 853 | mingw32="yes" |
b0cb0a66 | 854 | hax="yes" |
299e6f19 | 855 | vhost_user="no" |
3cec7cc2 | 856 | audio_possible_drivers="dsound sdl" |
307119e7 GH |
857 | if check_include dsound.h; then |
858 | audio_drv_list="dsound" | |
859 | else | |
860 | audio_drv_list="" | |
861 | fi | |
898be3e0 | 862 | supported_os="yes" |
67b915a5 | 863 | ;; |
5c40d2bd | 864 | GNU/kFreeBSD) |
a167ba50 | 865 | bsd="yes" |
6a485418 | 866 | audio_drv_list="oss try-sdl" |
0bac1111 | 867 | audio_possible_drivers="oss sdl pa" |
5c40d2bd | 868 | ;; |
7d3505c5 | 869 | FreeBSD) |
0dbfc675 | 870 | bsd="yes" |
0db4a067 | 871 | make="${MAKE-gmake}" |
6a485418 | 872 | audio_drv_list="oss try-sdl" |
0bac1111 | 873 | audio_possible_drivers="oss sdl pa" |
f01576f1 JL |
874 | # needed for kinfo_getvmmap(3) in libutil.h |
875 | LIBS="-lutil $LIBS" | |
a7764f15 EM |
876 | # needed for kinfo_getproc |
877 | libs_qga="-lutil $libs_qga" | |
58952137 | 878 | netmap="" # enable netmap autodetect |
adfc3e91 | 879 | HOST_VARIANT_DIR="freebsd" |
7d3505c5 | 880 | ;; |
c5e97233 | 881 | DragonFly) |
0dbfc675 | 882 | bsd="yes" |
0db4a067 | 883 | make="${MAKE-gmake}" |
6a485418 | 884 | audio_drv_list="oss try-sdl" |
0bac1111 | 885 | audio_possible_drivers="oss sdl pa" |
adfc3e91 | 886 | HOST_VARIANT_DIR="dragonfly" |
c5e97233 | 887 | ;; |
7d3505c5 | 888 | NetBSD) |
0dbfc675 | 889 | bsd="yes" |
604a5b99 | 890 | hax="yes" |
0db4a067 | 891 | make="${MAKE-gmake}" |
6a485418 | 892 | audio_drv_list="oss try-sdl" |
0bac1111 | 893 | audio_possible_drivers="oss sdl" |
0dbfc675 | 894 | oss_lib="-lossaudio" |
adfc3e91 | 895 | HOST_VARIANT_DIR="netbsd" |
7d3505c5 FB |
896 | ;; |
897 | OpenBSD) | |
0dbfc675 | 898 | bsd="yes" |
0db4a067 | 899 | make="${MAKE-gmake}" |
f92c7168 | 900 | audio_drv_list="try-sdl" |
0bac1111 | 901 | audio_possible_drivers="sdl" |
adfc3e91 | 902 | HOST_VARIANT_DIR="openbsd" |
7d3505c5 | 903 | ;; |
83fb7adf | 904 | Darwin) |
0dbfc675 JQ |
905 | bsd="yes" |
906 | darwin="yes" | |
b0cb0a66 | 907 | hax="yes" |
c97d6d2c | 908 | hvf="yes" |
17969268 | 909 | LDFLAGS_SHARED="-bundle -undefined dynamic_lookup" |
0dbfc675 | 910 | if [ "$cpu" = "x86_64" ] ; then |
a558ee17 | 911 | QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" |
db5adeaa | 912 | QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" |
0dbfc675 | 913 | fi |
0dbfc675 | 914 | cocoa="yes" |
6a485418 | 915 | audio_drv_list="coreaudio try-sdl" |
14382605 | 916 | audio_possible_drivers="coreaudio sdl" |
db5adeaa | 917 | QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" |
7973f21c | 918 | libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" |
a0b7cf6b PM |
919 | # Disable attempts to use ObjectiveC features in os/object.h since they |
920 | # won't work when we're compiling with gcc as a C compiler. | |
921 | QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" | |
adfc3e91 | 922 | HOST_VARIANT_DIR="darwin" |
83fb7adf | 923 | ;; |
ec530c81 | 924 | SunOS) |
0dbfc675 | 925 | solaris="yes" |
0db4a067 PB |
926 | make="${MAKE-gmake}" |
927 | install="${INSTALL-ginstall}" | |
e2d8830e | 928 | smbd="${SMBD-/usr/sfw/sbin/smbd}" |
0dbfc675 | 929 | if test -f /usr/include/sys/soundcard.h ; then |
6a485418 | 930 | audio_drv_list="oss try-sdl" |
0dbfc675 JQ |
931 | fi |
932 | audio_possible_drivers="oss sdl" | |
d741429a BS |
933 | # needed for CMSG_ macros in sys/socket.h |
934 | QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" | |
935 | # needed for TIOCWIN* defines in termios.h | |
936 | QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" | |
560d375f AF |
937 | solarisnetlibs="-lsocket -lnsl -lresolv" |
938 | LIBS="$solarisnetlibs $LIBS" | |
939 | libs_qga="$solarisnetlibs $libs_qga" | |
86b2bd93 | 940 | ;; |
179cf400 AF |
941 | Haiku) |
942 | haiku="yes" | |
fc433430 DC |
943 | QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -DBSD_SOURCE $QEMU_CFLAGS" |
944 | LIBS="-lposix_error_mapper -lnetwork -lbsd $LIBS" | |
179cf400 | 945 | ;; |
898be3e0 | 946 | Linux) |
7183834a | 947 | audio_drv_list="try-pa oss" |
0bac1111 | 948 | audio_possible_drivers="oss alsa sdl pa" |
0dbfc675 JQ |
949 | linux="yes" |
950 | linux_user="yes" | |
af2be207 | 951 | kvm="yes" |
25211446 | 952 | QEMU_INCLUDES="-isystem ${source_path}/linux-headers -I$PWD/linux-headers $QEMU_INCLUDES" |
3efac6eb | 953 | libudev="yes" |
898be3e0 | 954 | ;; |
7d13299d FB |
955 | esac |
956 | ||
7d3505c5 | 957 | if [ "$bsd" = "yes" ] ; then |
b1a550a0 | 958 | if [ "$darwin" != "yes" ] ; then |
08de3949 | 959 | bsd_user="yes" |
83fb7adf | 960 | fi |
7d3505c5 FB |
961 | fi |
962 | ||
0db4a067 PB |
963 | : ${make=${MAKE-make}} |
964 | : ${install=${INSTALL-install}} | |
faf44142 DB |
965 | # We prefer python 3.x. A bare 'python' is traditionally |
966 | # python 2.x, but some distros have it as python 3.x, so | |
ddf90699 | 967 | # we check that too |
faf44142 | 968 | python= |
0a01d76f | 969 | explicit_python=no |
ddf90699 | 970 | for binary in "${PYTHON-python3}" python |
faf44142 DB |
971 | do |
972 | if has "$binary" | |
973 | then | |
95c5f2de | 974 | python=$(command -v "$binary") |
faf44142 DB |
975 | break |
976 | fi | |
977 | done | |
903458c8 MA |
978 | |
979 | sphinx_build= | |
980 | for binary in sphinx-build-3 sphinx-build | |
981 | do | |
982 | if has "$binary" | |
983 | then | |
984 | sphinx_build=$(command -v "$binary") | |
985 | break | |
986 | fi | |
987 | done | |
988 | ||
39d87c8c AB |
989 | # Check for ancillary tools used in testing |
990 | genisoimage= | |
3df437c7 | 991 | for binary in genisoimage mkisofs |
39d87c8c AB |
992 | do |
993 | if has $binary | |
994 | then | |
995 | genisoimage=$(command -v "$binary") | |
996 | break | |
997 | fi | |
998 | done | |
999 | ||
e2d8830e | 1000 | : ${smbd=${SMBD-/usr/sbin/smbd}} |
0db4a067 | 1001 | |
3c4a4d0d PM |
1002 | # Default objcc to clang if available, otherwise use CC |
1003 | if has clang; then | |
1004 | objcc=clang | |
1005 | else | |
1006 | objcc="$cc" | |
1007 | fi | |
1008 | ||
3457a3f8 | 1009 | if test "$mingw32" = "yes" ; then |
3457a3f8 | 1010 | EXESUF=".exe" |
17969268 | 1011 | DSOSUF=".dll" |
78e9d4ad | 1012 | # MinGW needs -mthreads for TLS and macro _MT. |
086d5f75 | 1013 | CFLAGS="-mthreads $CFLAGS" |
b965e8c5 | 1014 | LIBS="-lwinmm -lws2_32 $LIBS" |
93b25869 | 1015 | write_c_skeleton; |
f7cf5d5b SW |
1016 | if compile_prog "" "-liberty" ; then |
1017 | LIBS="-liberty $LIBS" | |
1018 | fi | |
c5ec15ea | 1019 | prefix="c:/Program Files/QEMU" |
683035de | 1020 | confsuffix="" |
105fad6b | 1021 | libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" |
3457a3f8 JQ |
1022 | fi |
1023 | ||
487fefdb | 1024 | werror="" |
85aa5189 | 1025 | |
7d13299d | 1026 | for opt do |
89138857 | 1027 | optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') |
7d13299d | 1028 | case "$opt" in |
2efc3265 FB |
1029 | --help|-h) show_help=yes |
1030 | ;; | |
99123e13 MF |
1031 | --version|-V) exec cat $source_path/VERSION |
1032 | ;; | |
b1a550a0 | 1033 | --prefix=*) prefix="$optarg" |
7d13299d | 1034 | ;; |
b1a550a0 | 1035 | --interp-prefix=*) interp_prefix="$optarg" |
32ce6337 | 1036 | ;; |
ac0df51d | 1037 | --cross-prefix=*) |
7d13299d | 1038 | ;; |
ac0df51d | 1039 | --cc=*) |
7d13299d | 1040 | ;; |
b1a550a0 | 1041 | --host-cc=*) host_cc="$optarg" |
83469015 | 1042 | ;; |
83f73fce TS |
1043 | --cxx=*) |
1044 | ;; | |
e007dbec MT |
1045 | --iasl=*) iasl="$optarg" |
1046 | ;; | |
3c4a4d0d PM |
1047 | --objcc=*) objcc="$optarg" |
1048 | ;; | |
b1a550a0 | 1049 | --make=*) make="$optarg" |
7d13299d | 1050 | ;; |
6a882643 PB |
1051 | --install=*) install="$optarg" |
1052 | ;; | |
0a01d76f | 1053 | --python=*) python="$optarg" ; explicit_python=yes |
c886edfb | 1054 | ;; |
2eb054c2 PM |
1055 | --sphinx-build=*) sphinx_build="$optarg" |
1056 | ;; | |
a5665051 PB |
1057 | --skip-meson) skip_meson=yes |
1058 | ;; | |
1059 | --meson=*) meson="$optarg" | |
1060 | ;; | |
1d728c39 BS |
1061 | --gcov=*) gcov_tool="$optarg" |
1062 | ;; | |
e2d8830e BS |
1063 | --smbd=*) smbd="$optarg" |
1064 | ;; | |
e2a2ed06 | 1065 | --extra-cflags=*) |
7d13299d | 1066 | ;; |
11cde1c8 BD |
1067 | --extra-cxxflags=*) |
1068 | ;; | |
e2a2ed06 | 1069 | --extra-ldflags=*) |
7d13299d | 1070 | ;; |
5bc62e01 GH |
1071 | --enable-debug-info) |
1072 | ;; | |
1073 | --disable-debug-info) | |
1074 | ;; | |
d75402b5 AB |
1075 | --cross-cc-*) |
1076 | ;; | |
17969268 FZ |
1077 | --enable-modules) |
1078 | modules="yes" | |
3aa88b31 SH |
1079 | ;; |
1080 | --disable-modules) | |
1081 | modules="no" | |
17969268 | 1082 | ;; |
bd83c861 CE |
1083 | --disable-module-upgrades) module_upgrades="no" |
1084 | ;; | |
1085 | --enable-module-upgrades) module_upgrades="yes" | |
1086 | ;; | |
2ff6b91e | 1087 | --cpu=*) |
7d13299d | 1088 | ;; |
b1a550a0 | 1089 | --target-list=*) target_list="$optarg" |
447e133f AB |
1090 | if test "$target_list_exclude"; then |
1091 | error_exit "Can't mix --target-list with --target-list-exclude" | |
1092 | fi | |
1093 | ;; | |
1094 | --target-list-exclude=*) target_list_exclude="$optarg" | |
1095 | if test "$target_list"; then | |
1096 | error_exit "Can't mix --target-list-exclude with --target-list" | |
1097 | fi | |
de83cd02 | 1098 | ;; |
5b808275 LV |
1099 | --enable-trace-backends=*) trace_backends="$optarg" |
1100 | ;; | |
1101 | # XXX: backwards compatibility | |
1102 | --enable-trace-backend=*) trace_backends="$optarg" | |
94a420b1 | 1103 | ;; |
74242e0f | 1104 | --with-trace-file=*) trace_file="$optarg" |
9410b56c | 1105 | ;; |
f3494749 PB |
1106 | --with-default-devices) default_devices="yes" |
1107 | ;; | |
1108 | --without-default-devices) default_devices="no" | |
1109 | ;; | |
7d13299d FB |
1110 | --enable-gprof) gprof="yes" |
1111 | ;; | |
1d728c39 BS |
1112 | --enable-gcov) gcov="yes" |
1113 | ;; | |
79427693 LM |
1114 | --static) |
1115 | static="yes" | |
17884d7b | 1116 | QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" |
43ce4dfe | 1117 | ;; |
0b24e75f PB |
1118 | --mandir=*) mandir="$optarg" |
1119 | ;; | |
1120 | --bindir=*) bindir="$optarg" | |
1121 | ;; | |
3aa5d2be AL |
1122 | --libdir=*) libdir="$optarg" |
1123 | ;; | |
8bf188aa MT |
1124 | --libexecdir=*) libexecdir="$optarg" |
1125 | ;; | |
0f94d6da AL |
1126 | --includedir=*) includedir="$optarg" |
1127 | ;; | |
528ae5b8 | 1128 | --datadir=*) datadir="$optarg" |
0b24e75f | 1129 | ;; |
023d3d67 EH |
1130 | --with-confsuffix=*) confsuffix="$optarg" |
1131 | ;; | |
850da188 | 1132 | --docdir=*) qemu_docdir="$optarg" |
0b24e75f | 1133 | ;; |
ca2fb938 | 1134 | --sysconfdir=*) sysconfdir="$optarg" |
07381cc1 | 1135 | ;; |
785c23ae LC |
1136 | --localstatedir=*) local_statedir="$optarg" |
1137 | ;; | |
3d5eecab GH |
1138 | --firmwarepath=*) firmwarepath="$optarg" |
1139 | ;; | |
181ce1d0 OH |
1140 | --host=*|--build=*|\ |
1141 | --disable-dependency-tracking|\ | |
785c23ae | 1142 | --sbindir=*|--sharedstatedir=*|\ |
023ddd74 MF |
1143 | --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ |
1144 | --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) | |
1145 | # These switches are silently ignored, for compatibility with | |
1146 | # autoconf-generated configure scripts. This allows QEMU's | |
1147 | # configure to be used by RPM and similar macros that set | |
1148 | # lots of directory switches by default. | |
1149 | ;; | |
97a847bc FB |
1150 | --disable-sdl) sdl="no" |
1151 | ;; | |
c4198157 JQ |
1152 | --enable-sdl) sdl="yes" |
1153 | ;; | |
a442fe2f DB |
1154 | --disable-sdl-image) sdl_image="no" |
1155 | ;; | |
1156 | --enable-sdl-image) sdl_image="yes" | |
1157 | ;; | |
3556c233 PB |
1158 | --disable-qom-cast-debug) qom_cast_debug="no" |
1159 | ;; | |
1160 | --enable-qom-cast-debug) qom_cast_debug="yes" | |
1161 | ;; | |
983eef5a MI |
1162 | --disable-virtfs) virtfs="no" |
1163 | ;; | |
1164 | --enable-virtfs) virtfs="yes" | |
1165 | ;; | |
fe8fc5ae PB |
1166 | --disable-mpath) mpath="no" |
1167 | ;; | |
1168 | --enable-mpath) mpath="yes" | |
1169 | ;; | |
821601ea JS |
1170 | --disable-vnc) vnc="no" |
1171 | ;; | |
1172 | --enable-vnc) vnc="yes" | |
1173 | ;; | |
2f6a1ab0 BS |
1174 | --oss-lib=*) oss_lib="$optarg" |
1175 | ;; | |
0c58ac1c | 1176 | --audio-drv-list=*) audio_drv_list="$optarg" |
102a52e4 | 1177 | ;; |
89138857 | 1178 | --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') |
b64ec4e4 | 1179 | ;; |
89138857 | 1180 | --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') |
eb852011 | 1181 | ;; |
f8393946 AJ |
1182 | --enable-debug-tcg) debug_tcg="yes" |
1183 | ;; | |
1184 | --disable-debug-tcg) debug_tcg="no" | |
1185 | ;; | |
f3d08ee6 PB |
1186 | --enable-debug) |
1187 | # Enable debugging options that aren't excessively noisy | |
1188 | debug_tcg="yes" | |
1fcc6d42 | 1189 | debug_mutex="yes" |
f3d08ee6 PB |
1190 | debug="yes" |
1191 | strip_opt="no" | |
b553a042 | 1192 | fortify_source="no" |
f3d08ee6 | 1193 | ;; |
247724cb MAL |
1194 | --enable-sanitizers) sanitizers="yes" |
1195 | ;; | |
1196 | --disable-sanitizers) sanitizers="no" | |
1197 | ;; | |
0aebab04 LY |
1198 | --enable-tsan) tsan="yes" |
1199 | ;; | |
1200 | --disable-tsan) tsan="no" | |
1201 | ;; | |
03b4fe7d AL |
1202 | --enable-sparse) sparse="yes" |
1203 | ;; | |
1204 | --disable-sparse) sparse="no" | |
1205 | ;; | |
1625af87 AL |
1206 | --disable-strip) strip_opt="no" |
1207 | ;; | |
2f9606b3 AL |
1208 | --disable-vnc-sasl) vnc_sasl="no" |
1209 | ;; | |
ea784e3b JQ |
1210 | --enable-vnc-sasl) vnc_sasl="yes" |
1211 | ;; | |
2f6f5c7a CC |
1212 | --disable-vnc-jpeg) vnc_jpeg="no" |
1213 | ;; | |
1214 | --enable-vnc-jpeg) vnc_jpeg="yes" | |
1215 | ;; | |
efe556ad CC |
1216 | --disable-vnc-png) vnc_png="no" |
1217 | ;; | |
1218 | --enable-vnc-png) vnc_png="yes" | |
1219 | ;; | |
443f1376 | 1220 | --disable-slirp) slirp="no" |
1d14ffa9 | 1221 | ;; |
7c57bdd8 MAL |
1222 | --enable-slirp=git) slirp="git" |
1223 | ;; | |
675b9b53 MAL |
1224 | --enable-slirp=system) slirp="system" |
1225 | ;; | |
e0e6c8c0 | 1226 | --disable-vde) vde="no" |
8a16d273 | 1227 | ;; |
dfb278bd JQ |
1228 | --enable-vde) vde="yes" |
1229 | ;; | |
58952137 VM |
1230 | --disable-netmap) netmap="no" |
1231 | ;; | |
1232 | --enable-netmap) netmap="yes" | |
1233 | ;; | |
e37630ca AL |
1234 | --disable-xen) xen="no" |
1235 | ;; | |
fc321b4b JQ |
1236 | --enable-xen) xen="yes" |
1237 | ;; | |
eb6fda0f AP |
1238 | --disable-xen-pci-passthrough) xen_pci_passthrough="no" |
1239 | ;; | |
1240 | --enable-xen-pci-passthrough) xen_pci_passthrough="yes" | |
1241 | ;; | |
2e4d9fb1 AJ |
1242 | --disable-brlapi) brlapi="no" |
1243 | ;; | |
4ffcedb6 JQ |
1244 | --enable-brlapi) brlapi="yes" |
1245 | ;; | |
7ba1e619 AL |
1246 | --disable-kvm) kvm="no" |
1247 | ;; | |
b31a0277 JQ |
1248 | --enable-kvm) kvm="yes" |
1249 | ;; | |
b0cb0a66 | 1250 | --disable-hax) hax="no" |
180fb750 | 1251 | ;; |
b0cb0a66 | 1252 | --enable-hax) hax="yes" |
180fb750 | 1253 | ;; |
c97d6d2c SAGDR |
1254 | --disable-hvf) hvf="no" |
1255 | ;; | |
1256 | --enable-hvf) hvf="yes" | |
1257 | ;; | |
d661d9a4 JTV |
1258 | --disable-whpx) whpx="no" |
1259 | ;; | |
1260 | --enable-whpx) whpx="yes" | |
1261 | ;; | |
9195b2c2 SW |
1262 | --disable-tcg-interpreter) tcg_interpreter="no" |
1263 | ;; | |
1264 | --enable-tcg-interpreter) tcg_interpreter="yes" | |
1265 | ;; | |
47e98658 CB |
1266 | --disable-cap-ng) cap_ng="no" |
1267 | ;; | |
1268 | --enable-cap-ng) cap_ng="yes" | |
1269 | ;; | |
b3f6ea7e PB |
1270 | --disable-tcg) tcg="no" |
1271 | ;; | |
1272 | --enable-tcg) tcg="yes" | |
1273 | ;; | |
5a22ab71 YZ |
1274 | --disable-malloc-trim) malloc_trim="no" |
1275 | ;; | |
1276 | --enable-malloc-trim) malloc_trim="yes" | |
1277 | ;; | |
cd4ec0b4 GH |
1278 | --disable-spice) spice="no" |
1279 | ;; | |
1280 | --enable-spice) spice="yes" | |
1281 | ;; | |
c589b249 RS |
1282 | --disable-libiscsi) libiscsi="no" |
1283 | ;; | |
1284 | --enable-libiscsi) libiscsi="yes" | |
1285 | ;; | |
6542aa9c PL |
1286 | --disable-libnfs) libnfs="no" |
1287 | ;; | |
1288 | --enable-libnfs) libnfs="yes" | |
1289 | ;; | |
05c2a3e7 FB |
1290 | --enable-profiler) profiler="yes" |
1291 | ;; | |
14821030 PB |
1292 | --disable-cocoa) cocoa="no" |
1293 | ;; | |
c2de5c91 | 1294 | --enable-cocoa) |
1295 | cocoa="yes" ; | |
89138857 | 1296 | audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" |
1d14ffa9 | 1297 | ;; |
cad25d69 | 1298 | --disable-system) softmmu="no" |
0a8e90f4 | 1299 | ;; |
cad25d69 | 1300 | --enable-system) softmmu="yes" |
0a8e90f4 | 1301 | ;; |
0953a80f ZA |
1302 | --disable-user) |
1303 | linux_user="no" ; | |
1304 | bsd_user="no" ; | |
0953a80f ZA |
1305 | ;; |
1306 | --enable-user) ;; | |
831b7825 | 1307 | --disable-linux-user) linux_user="no" |
0a8e90f4 | 1308 | ;; |
831b7825 TS |
1309 | --enable-linux-user) linux_user="yes" |
1310 | ;; | |
84778508 BS |
1311 | --disable-bsd-user) bsd_user="no" |
1312 | ;; | |
1313 | --enable-bsd-user) bsd_user="yes" | |
1314 | ;; | |
40d6444e | 1315 | --enable-pie) pie="yes" |
34005a00 | 1316 | ;; |
40d6444e | 1317 | --disable-pie) pie="no" |
34005a00 | 1318 | ;; |
85aa5189 FB |
1319 | --enable-werror) werror="yes" |
1320 | ;; | |
1321 | --disable-werror) werror="no" | |
1322 | ;; | |
63678e17 SN |
1323 | --enable-stack-protector) stack_protector="yes" |
1324 | ;; | |
1325 | --disable-stack-protector) stack_protector="no" | |
1326 | ;; | |
1e4f6065 DB |
1327 | --enable-safe-stack) safe_stack="yes" |
1328 | ;; | |
1329 | --disable-safe-stack) safe_stack="no" | |
1330 | ;; | |
4d3b6f6e AZ |
1331 | --disable-curses) curses="no" |
1332 | ;; | |
c584a6d0 JQ |
1333 | --enable-curses) curses="yes" |
1334 | ;; | |
e08bb301 ST |
1335 | --disable-iconv) iconv="no" |
1336 | ;; | |
1337 | --enable-iconv) iconv="yes" | |
1338 | ;; | |
769ce76d AG |
1339 | --disable-curl) curl="no" |
1340 | ;; | |
788c8196 JQ |
1341 | --enable-curl) curl="yes" |
1342 | ;; | |
2df87df7 JQ |
1343 | --disable-fdt) fdt="no" |
1344 | ;; | |
1345 | --enable-fdt) fdt="yes" | |
1346 | ;; | |
5c6c3a6c CH |
1347 | --disable-linux-aio) linux_aio="no" |
1348 | ;; | |
1349 | --enable-linux-aio) linux_aio="yes" | |
1350 | ;; | |
c10dd856 AM |
1351 | --disable-linux-io-uring) linux_io_uring="no" |
1352 | ;; | |
1353 | --enable-linux-io-uring) linux_io_uring="yes" | |
1354 | ;; | |
758e8e38 VJ |
1355 | --disable-attr) attr="no" |
1356 | ;; | |
1357 | --enable-attr) attr="yes" | |
1358 | ;; | |
a40161cb PB |
1359 | --disable-membarrier) membarrier="no" |
1360 | ;; | |
1361 | --enable-membarrier) membarrier="yes" | |
1362 | ;; | |
77755340 TS |
1363 | --disable-blobs) blobs="no" |
1364 | ;; | |
7e563bfb | 1365 | --with-pkgversion=*) pkgversion="$optarg" |
4a19f1ec | 1366 | ;; |
519175a2 AB |
1367 | --with-coroutine=*) coroutine="$optarg" |
1368 | ;; | |
70c60c08 SH |
1369 | --disable-coroutine-pool) coroutine_pool="no" |
1370 | ;; | |
1371 | --enable-coroutine-pool) coroutine_pool="yes" | |
1372 | ;; | |
7d992e4d PL |
1373 | --enable-debug-stack-usage) debug_stack_usage="yes" |
1374 | ;; | |
f0d92b56 LM |
1375 | --enable-crypto-afalg) crypto_afalg="yes" |
1376 | ;; | |
1377 | --disable-crypto-afalg) crypto_afalg="no" | |
1378 | ;; | |
a25dba17 | 1379 | --disable-docs) docs="no" |
70ec5dc0 | 1380 | ;; |
a25dba17 | 1381 | --enable-docs) docs="yes" |
83a3ab8b | 1382 | ;; |
d5970055 MT |
1383 | --disable-vhost-net) vhost_net="no" |
1384 | ;; | |
1385 | --enable-vhost-net) vhost_net="yes" | |
1386 | ;; | |
042cea27 GA |
1387 | --disable-vhost-crypto) vhost_crypto="no" |
1388 | ;; | |
299e6f19 | 1389 | --enable-vhost-crypto) vhost_crypto="yes" |
042cea27 | 1390 | ;; |
5e9be92d NB |
1391 | --disable-vhost-scsi) vhost_scsi="no" |
1392 | ;; | |
1393 | --enable-vhost-scsi) vhost_scsi="yes" | |
1394 | ;; | |
fc0b9b0e SH |
1395 | --disable-vhost-vsock) vhost_vsock="no" |
1396 | ;; | |
1397 | --enable-vhost-vsock) vhost_vsock="yes" | |
1398 | ;; | |
98fc1ada DDAG |
1399 | --disable-vhost-user-fs) vhost_user_fs="no" |
1400 | ;; | |
1401 | --enable-vhost-user-fs) vhost_user_fs="yes" | |
1402 | ;; | |
da076ffe | 1403 | --disable-opengl) opengl="no" |
20ff075b | 1404 | ;; |
da076ffe | 1405 | --enable-opengl) opengl="yes" |
20ff075b | 1406 | ;; |
f27aaf4b CB |
1407 | --disable-rbd) rbd="no" |
1408 | ;; | |
1409 | --enable-rbd) rbd="yes" | |
1410 | ;; | |
8c84cf11 ST |
1411 | --disable-xfsctl) xfs="no" |
1412 | ;; | |
1413 | --enable-xfsctl) xfs="yes" | |
1414 | ;; | |
7b02f544 | 1415 | --disable-smartcard) smartcard="no" |
111a38b0 | 1416 | ;; |
7b02f544 | 1417 | --enable-smartcard) smartcard="yes" |
111a38b0 | 1418 | ;; |
2b2325ff GH |
1419 | --disable-libusb) libusb="no" |
1420 | ;; | |
1421 | --enable-libusb) libusb="yes" | |
1422 | ;; | |
69354a83 HG |
1423 | --disable-usb-redir) usb_redir="no" |
1424 | ;; | |
1425 | --enable-usb-redir) usb_redir="yes" | |
1426 | ;; | |
1ece9905 AL |
1427 | --disable-zlib-test) zlib="no" |
1428 | ;; | |
b25c9dff SW |
1429 | --disable-lzo) lzo="no" |
1430 | ;; | |
607dacd0 QN |
1431 | --enable-lzo) lzo="yes" |
1432 | ;; | |
b25c9dff SW |
1433 | --disable-snappy) snappy="no" |
1434 | ;; | |
607dacd0 QN |
1435 | --enable-snappy) snappy="yes" |
1436 | ;; | |
6b383c08 PW |
1437 | --disable-bzip2) bzip2="no" |
1438 | ;; | |
1439 | --enable-bzip2) bzip2="yes" | |
1440 | ;; | |
83bc1f97 JF |
1441 | --enable-lzfse) lzfse="yes" |
1442 | ;; | |
1443 | --disable-lzfse) lzfse="no" | |
1444 | ;; | |
3a678481 JQ |
1445 | --disable-zstd) zstd="no" |
1446 | ;; | |
1447 | --enable-zstd) zstd="yes" | |
1448 | ;; | |
d138cee9 MR |
1449 | --enable-guest-agent) guest_agent="yes" |
1450 | ;; | |
1451 | --disable-guest-agent) guest_agent="no" | |
1452 | ;; | |
9dacf32d YH |
1453 | --enable-guest-agent-msi) guest_agent_msi="yes" |
1454 | ;; | |
1455 | --disable-guest-agent-msi) guest_agent_msi="no" | |
1456 | ;; | |
d9840e25 TS |
1457 | --with-vss-sdk) vss_win32_sdk="" |
1458 | ;; | |
1459 | --with-vss-sdk=*) vss_win32_sdk="$optarg" | |
1460 | ;; | |
1461 | --without-vss-sdk) vss_win32_sdk="no" | |
1462 | ;; | |
1463 | --with-win-sdk) win_sdk="" | |
1464 | ;; | |
1465 | --with-win-sdk=*) win_sdk="$optarg" | |
1466 | ;; | |
1467 | --without-win-sdk) win_sdk="no" | |
1468 | ;; | |
4b1c11fd DB |
1469 | --enable-tools) want_tools="yes" |
1470 | ;; | |
1471 | --disable-tools) want_tools="no" | |
1472 | ;; | |
f794573e EO |
1473 | --enable-seccomp) seccomp="yes" |
1474 | ;; | |
1475 | --disable-seccomp) seccomp="no" | |
1476 | ;; | |
eb100396 BR |
1477 | --disable-glusterfs) glusterfs="no" |
1478 | ;; | |
86583a07 LM |
1479 | --disable-avx2) avx2_opt="no" |
1480 | ;; | |
1481 | --enable-avx2) avx2_opt="yes" | |
1482 | ;; | |
6b8cd447 RH |
1483 | --disable-avx512f) avx512f_opt="no" |
1484 | ;; | |
1485 | --enable-avx512f) avx512f_opt="yes" | |
1486 | ;; | |
1487 | ||
eb100396 BR |
1488 | --enable-glusterfs) glusterfs="yes" |
1489 | ;; | |
52b53c04 FZ |
1490 | --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) |
1491 | echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 | |
583f6e7b | 1492 | ;; |
cb6414df FZ |
1493 | --enable-vhdx|--disable-vhdx) |
1494 | echo "$0: $opt is obsolete, VHDX driver is always built" >&2 | |
1495 | ;; | |
315d3184 FZ |
1496 | --enable-uuid|--disable-uuid) |
1497 | echo "$0: $opt is obsolete, UUID support is always built" >&2 | |
1498 | ;; | |
a4ccabcf AL |
1499 | --disable-gtk) gtk="no" |
1500 | ;; | |
1501 | --enable-gtk) gtk="yes" | |
1502 | ;; | |
a1c5e949 DB |
1503 | --tls-priority=*) tls_priority="$optarg" |
1504 | ;; | |
ddbb0d09 DB |
1505 | --disable-gnutls) gnutls="no" |
1506 | ;; | |
1507 | --enable-gnutls) gnutls="yes" | |
1508 | ;; | |
91bfcdb0 DB |
1509 | --disable-nettle) nettle="no" |
1510 | ;; | |
1511 | --enable-nettle) nettle="yes" | |
1512 | ;; | |
1513 | --disable-gcrypt) gcrypt="no" | |
1514 | ;; | |
1515 | --enable-gcrypt) gcrypt="yes" | |
1516 | ;; | |
8953caf3 DB |
1517 | --disable-auth-pam) auth_pam="no" |
1518 | ;; | |
1519 | --enable-auth-pam) auth_pam="yes" | |
1520 | ;; | |
2da776db MH |
1521 | --enable-rdma) rdma="yes" |
1522 | ;; | |
1523 | --disable-rdma) rdma="no" | |
1524 | ;; | |
21ab34c9 MA |
1525 | --enable-pvrdma) pvrdma="yes" |
1526 | ;; | |
1527 | --disable-pvrdma) pvrdma="no" | |
1528 | ;; | |
bbbf9bfb SW |
1529 | --disable-vte) vte="no" |
1530 | ;; | |
1531 | --enable-vte) vte="yes" | |
1532 | ;; | |
9d9e1521 GH |
1533 | --disable-virglrenderer) virglrenderer="no" |
1534 | ;; | |
1535 | --enable-virglrenderer) virglrenderer="yes" | |
1536 | ;; | |
e91c793c CR |
1537 | --disable-tpm) tpm="no" |
1538 | ;; | |
ab214c29 SB |
1539 | --enable-tpm) tpm="yes" |
1540 | ;; | |
b10d49d7 | 1541 | --disable-libssh) libssh="no" |
0a12ec87 | 1542 | ;; |
b10d49d7 | 1543 | --enable-libssh) libssh="yes" |
0a12ec87 | 1544 | ;; |
ed1701c6 DDAG |
1545 | --disable-live-block-migration) live_block_migration="no" |
1546 | ;; | |
1547 | --enable-live-block-migration) live_block_migration="yes" | |
1548 | ;; | |
a99d57bb WG |
1549 | --disable-numa) numa="no" |
1550 | ;; | |
1551 | --enable-numa) numa="yes" | |
1552 | ;; | |
ed279a06 KK |
1553 | --disable-libxml2) libxml2="no" |
1554 | ;; | |
1555 | --enable-libxml2) libxml2="yes" | |
1556 | ;; | |
2847b469 FZ |
1557 | --disable-tcmalloc) tcmalloc="no" |
1558 | ;; | |
1559 | --enable-tcmalloc) tcmalloc="yes" | |
1560 | ;; | |
7b01cb97 AD |
1561 | --disable-jemalloc) jemalloc="no" |
1562 | ;; | |
1563 | --enable-jemalloc) jemalloc="yes" | |
1564 | ;; | |
a6b1d4c0 CX |
1565 | --disable-replication) replication="no" |
1566 | ;; | |
1567 | --enable-replication) replication="yes" | |
1568 | ;; | |
2f740136 JC |
1569 | --disable-bochs) bochs="no" |
1570 | ;; | |
1571 | --enable-bochs) bochs="yes" | |
1572 | ;; | |
1573 | --disable-cloop) cloop="no" | |
1574 | ;; | |
1575 | --enable-cloop) cloop="yes" | |
1576 | ;; | |
1577 | --disable-dmg) dmg="no" | |
1578 | ;; | |
1579 | --enable-dmg) dmg="yes" | |
1580 | ;; | |
1581 | --disable-qcow1) qcow1="no" | |
1582 | ;; | |
1583 | --enable-qcow1) qcow1="yes" | |
1584 | ;; | |
1585 | --disable-vdi) vdi="no" | |
1586 | ;; | |
1587 | --enable-vdi) vdi="yes" | |
1588 | ;; | |
1589 | --disable-vvfat) vvfat="no" | |
1590 | ;; | |
1591 | --enable-vvfat) vvfat="yes" | |
1592 | ;; | |
1593 | --disable-qed) qed="no" | |
1594 | ;; | |
1595 | --enable-qed) qed="yes" | |
1596 | ;; | |
1597 | --disable-parallels) parallels="no" | |
1598 | ;; | |
1599 | --enable-parallels) parallels="yes" | |
1600 | ;; | |
1601 | --disable-sheepdog) sheepdog="no" | |
1602 | ;; | |
1603 | --enable-sheepdog) sheepdog="yes" | |
1604 | ;; | |
e6a74868 MAL |
1605 | --disable-vhost-user) vhost_user="no" |
1606 | ;; | |
299e6f19 PB |
1607 | --enable-vhost-user) vhost_user="yes" |
1608 | ;; | |
108a6481 CL |
1609 | --disable-vhost-vdpa) vhost_vdpa="no" |
1610 | ;; | |
1611 | --enable-vhost-vdpa) vhost_vdpa="yes" | |
1612 | ;; | |
299e6f19 PB |
1613 | --disable-vhost-kernel) vhost_kernel="no" |
1614 | ;; | |
1615 | --enable-vhost-kernel) vhost_kernel="yes" | |
e6a74868 | 1616 | ;; |
8ca80760 RH |
1617 | --disable-capstone) capstone="no" |
1618 | ;; | |
1619 | --enable-capstone) capstone="yes" | |
1620 | ;; | |
e219c499 RH |
1621 | --enable-capstone=git) capstone="git" |
1622 | ;; | |
1623 | --enable-capstone=system) capstone="system" | |
1624 | ;; | |
cc84d63a DB |
1625 | --with-git=*) git="$optarg" |
1626 | ;; | |
f62bbee5 DB |
1627 | --enable-git-update) git_update=yes |
1628 | ;; | |
1629 | --disable-git-update) git_update=no | |
1630 | ;; | |
ba59fb77 PB |
1631 | --enable-debug-mutex) debug_mutex=yes |
1632 | ;; | |
1633 | --disable-debug-mutex) debug_mutex=no | |
1634 | ;; | |
17824406 JH |
1635 | --enable-libpmem) libpmem=yes |
1636 | ;; | |
1637 | --disable-libpmem) libpmem=no | |
1638 | ;; | |
75411919 JLC |
1639 | --enable-xkbcommon) xkbcommon=yes |
1640 | ;; | |
1641 | --disable-xkbcommon) xkbcommon=no | |
1642 | ;; | |
40e8c6f4 AB |
1643 | --enable-plugins) plugins="yes" |
1644 | ;; | |
1645 | --disable-plugins) plugins="no" | |
1646 | ;; | |
afc3a8f9 AB |
1647 | --enable-containers) use_containers="yes" |
1648 | ;; | |
1649 | --disable-containers) use_containers="no" | |
1650 | ;; | |
adc28027 AB |
1651 | --enable-fuzzing) fuzzing=yes |
1652 | ;; | |
1653 | --disable-fuzzing) fuzzing=no | |
1654 | ;; | |
f48e590a AB |
1655 | --gdb=*) gdb_bin="$optarg" |
1656 | ;; | |
b767d257 MMG |
1657 | --enable-rng-none) rng_none=yes |
1658 | ;; | |
1659 | --disable-rng-none) rng_none=no | |
1660 | ;; | |
54e7aac0 AK |
1661 | --enable-keyring) secret_keyring="yes" |
1662 | ;; | |
1663 | --disable-keyring) secret_keyring="no" | |
1664 | ;; | |
21b2eca6 JL |
1665 | --enable-libdaxctl) libdaxctl=yes |
1666 | ;; | |
1667 | --disable-libdaxctl) libdaxctl=no | |
1668 | ;; | |
2d2ad6d0 FZ |
1669 | *) |
1670 | echo "ERROR: unknown option $opt" | |
1671 | echo "Try '$0 --help' for more information" | |
1672 | exit 1 | |
7f1559c6 | 1673 | ;; |
7d13299d FB |
1674 | esac |
1675 | done | |
1676 | ||
22a87800 MAL |
1677 | libdir="${libdir:-$prefix/lib}" |
1678 | libexecdir="${libexecdir:-$prefix/libexec}" | |
1679 | includedir="${includedir:-$prefix/include}" | |
1680 | ||
1681 | if test "$mingw32" = "yes" ; then | |
1682 | mandir="$prefix" | |
1683 | datadir="$prefix" | |
1684 | qemu_docdir="$prefix" | |
1685 | bindir="$prefix" | |
1686 | sysconfdir="$prefix" | |
1687 | local_statedir= | |
1688 | else | |
1689 | mandir="${mandir:-$prefix/share/man}" | |
1690 | datadir="${datadir:-$prefix/share}" | |
1691 | qemu_docdir="${qemu_docdir:-$prefix/share/doc/qemu}" | |
1692 | bindir="${bindir:-$prefix/bin}" | |
1693 | sysconfdir="${sysconfdir:-$prefix/etc}" | |
1694 | local_statedir="${local_statedir:-$prefix/var}" | |
1695 | fi | |
1696 | ||
40293e58 | 1697 | case "$cpu" in |
e3608d66 RH |
1698 | ppc) |
1699 | CPU_CFLAGS="-m32" | |
db5adeaa | 1700 | QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" |
e3608d66 RH |
1701 | ;; |
1702 | ppc64) | |
1703 | CPU_CFLAGS="-m64" | |
db5adeaa | 1704 | QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" |
e3608d66 | 1705 | ;; |
9b9c37c3 | 1706 | sparc) |
f1079bb8 | 1707 | CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" |
db5adeaa | 1708 | QEMU_LDFLAGS="-m32 -mv8plus $QEMU_LDFLAGS" |
3142255c | 1709 | ;; |
ed968ff1 | 1710 | sparc64) |
79f3b12f | 1711 | CPU_CFLAGS="-m64 -mcpu=ultrasparc" |
db5adeaa | 1712 | QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" |
3142255c | 1713 | ;; |
76d83bde | 1714 | s390) |
061cdd81 | 1715 | CPU_CFLAGS="-m31" |
db5adeaa | 1716 | QEMU_LDFLAGS="-m31 $QEMU_LDFLAGS" |
28d7cc49 RH |
1717 | ;; |
1718 | s390x) | |
061cdd81 | 1719 | CPU_CFLAGS="-m64" |
db5adeaa | 1720 | QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" |
76d83bde | 1721 | ;; |
40293e58 | 1722 | i386) |
79f3b12f | 1723 | CPU_CFLAGS="-m32" |
db5adeaa | 1724 | QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" |
40293e58 FB |
1725 | ;; |
1726 | x86_64) | |
7ebee43e RH |
1727 | # ??? Only extremely old AMD cpus do not have cmpxchg16b. |
1728 | # If we truly care, we should simply detect this case at | |
1729 | # runtime and generate the fallback to serial emulation. | |
1730 | CPU_CFLAGS="-m64 -mcx16" | |
db5adeaa | 1731 | QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" |
d2fbca94 | 1732 | ;; |
c72b26ec RH |
1733 | x32) |
1734 | CPU_CFLAGS="-mx32" | |
db5adeaa | 1735 | QEMU_LDFLAGS="-mx32 $QEMU_LDFLAGS" |
c72b26ec | 1736 | ;; |
30163d89 | 1737 | # No special flags required for other host CPUs |
3142255c BS |
1738 | esac |
1739 | ||
2038f8c8 PB |
1740 | eval "cross_cc_${cpu}=\$host_cc" |
1741 | cross_cc_vars="$cross_cc_vars cross_cc_${cpu}" | |
79f3b12f | 1742 | QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" |
79f3b12f | 1743 | |
affc88cc PM |
1744 | # For user-mode emulation the host arch has to be one we explicitly |
1745 | # support, even if we're using TCI. | |
1746 | if [ "$ARCH" = "unknown" ]; then | |
1747 | bsd_user="no" | |
1748 | linux_user="no" | |
1749 | fi | |
1750 | ||
1cf295be PMD |
1751 | if [ "$bsd_user" = "no" -a "$linux_user" = "no" -a "$softmmu" = "no" ] ; then |
1752 | tcg="no" | |
1753 | fi | |
1754 | ||
60e0df25 PM |
1755 | default_target_list="" |
1756 | ||
6e92f823 PM |
1757 | mak_wilds="" |
1758 | ||
1759 | if [ "$softmmu" = "yes" ]; then | |
1760 | mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak" | |
60e0df25 | 1761 | fi |
6e92f823 PM |
1762 | if [ "$linux_user" = "yes" ]; then |
1763 | mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak" | |
60e0df25 | 1764 | fi |
6e92f823 PM |
1765 | if [ "$bsd_user" = "yes" ]; then |
1766 | mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" | |
60e0df25 PM |
1767 | fi |
1768 | ||
447e133f AB |
1769 | if test -z "$target_list_exclude"; then |
1770 | for config in $mak_wilds; do | |
1771 | default_target_list="${default_target_list} $(basename "$config" .mak)" | |
1772 | done | |
1773 | else | |
1774 | exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g') | |
1775 | for config in $mak_wilds; do | |
1776 | target="$(basename "$config" .mak)" | |
1777 | exclude="no" | |
1778 | for excl in $exclude_list; do | |
1779 | if test "$excl" = "$target"; then | |
1780 | exclude="yes" | |
1781 | break; | |
1782 | fi | |
1783 | done | |
1784 | if test "$exclude" = "no"; then | |
1785 | default_target_list="${default_target_list} $target" | |
1786 | fi | |
1787 | done | |
1788 | fi | |
6e92f823 | 1789 | |
c53eeaf7 | 1790 | # Enumerate public trace backends for --help output |
64a6047d | 1791 | trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) |
c53eeaf7 | 1792 | |
af5db58e PB |
1793 | if test x"$show_help" = x"yes" ; then |
1794 | cat << EOF | |
1795 | ||
1796 | Usage: configure [options] | |
1797 | Options: [defaults in brackets after descriptions] | |
1798 | ||
08fb77ed SW |
1799 | Standard options: |
1800 | --help print this message | |
1801 | --prefix=PREFIX install in PREFIX [$prefix] | |
1802 | --interp-prefix=PREFIX where to find shared libraries, etc. | |
1803 | use %M for cpu name [$interp_prefix] | |
1804 | --target-list=LIST set target list (default: build everything) | |
1805 | $(echo Available targets: $default_target_list | \ | |
1806 | fold -s -w 53 | sed -e 's/^/ /') | |
447e133f | 1807 | --target-list-exclude=LIST exclude a set of targets from the default target-list |
08fb77ed SW |
1808 | |
1809 | Advanced options (experts only): | |
08fb77ed SW |
1810 | --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] |
1811 | --cc=CC use C compiler CC [$cc] | |
1812 | --iasl=IASL use ACPI compiler IASL [$iasl] | |
1813 | --host-cc=CC use C compiler CC [$host_cc] for code run at | |
1814 | build time | |
1815 | --cxx=CXX use C++ compiler CXX [$cxx] | |
1816 | --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] | |
1817 | --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS | |
11cde1c8 | 1818 | --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS |
08fb77ed | 1819 | --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS |
d75402b5 | 1820 | --cross-cc-ARCH=CC use compiler when building ARCH guest test cases |
d422b2bc | 1821 | --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests |
08fb77ed SW |
1822 | --make=MAKE use specified make [$make] |
1823 | --install=INSTALL use specified install [$install] | |
1824 | --python=PYTHON use specified python [$python] | |
2eb054c2 | 1825 | --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build] |
a5665051 | 1826 | --meson=MESON use specified meson [$meson] |
08fb77ed | 1827 | --smbd=SMBD use specified smbd [$smbd] |
db1b5f13 | 1828 | --with-git=GIT use specified git [$git] |
08fb77ed SW |
1829 | --static enable static build [$static] |
1830 | --mandir=PATH install man pages in PATH | |
1831 | --datadir=PATH install firmware in PATH$confsuffix | |
1832 | --docdir=PATH install documentation in PATH$confsuffix | |
1833 | --bindir=PATH install binaries in PATH | |
1834 | --libdir=PATH install libraries in PATH | |
db1b5f13 | 1835 | --libexecdir=PATH install helper binaries in PATH |
08fb77ed SW |
1836 | --sysconfdir=PATH install config in PATH$confsuffix |
1837 | --localstatedir=PATH install local state in PATH (set at runtime on win32) | |
3d5eecab | 1838 | --firmwarepath=PATH search PATH for firmware files |
13336606 | 1839 | --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs. |
e26110cf | 1840 | --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] |
db1b5f13 | 1841 | --with-pkgversion=VERS use specified string as sub-version of the package |
08fb77ed | 1842 | --enable-debug enable common debug build options |
247724cb | 1843 | --enable-sanitizers enable default sanitizers |
0aebab04 | 1844 | --enable-tsan enable thread sanitizer |
08fb77ed SW |
1845 | --disable-strip disable stripping binaries |
1846 | --disable-werror disable compilation abort on warning | |
63678e17 | 1847 | --disable-stack-protector disable compiler-provided stack protection |
08fb77ed SW |
1848 | --audio-drv-list=LIST set audio drivers list: |
1849 | Available drivers: $audio_possible_drivers | |
1850 | --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L | |
1851 | --block-drv-rw-whitelist=L | |
1852 | set block driver read-write whitelist | |
1853 | (affects only QEMU, not qemu-img) | |
1854 | --block-drv-ro-whitelist=L | |
1855 | set block driver read-only whitelist | |
1856 | (affects only QEMU, not qemu-img) | |
5b808275 | 1857 | --enable-trace-backends=B Set trace backend |
c53eeaf7 | 1858 | Available backends: $trace_backend_list |
08fb77ed SW |
1859 | --with-trace-file=NAME Full PATH,NAME of file to store traces |
1860 | Default:trace-<pid> | |
c23f23b9 MT |
1861 | --disable-slirp disable SLIRP userspace network connectivity |
1862 | --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) | |
5a22ab71 | 1863 | --enable-malloc-trim enable libc malloc_trim() for memory optimization |
c23f23b9 MT |
1864 | --oss-lib path to OSS library |
1865 | --cpu=CPU Build for host CPU [$cpu] | |
08fb77ed | 1866 | --with-coroutine=BACKEND coroutine backend. Supported options: |
33c53c54 | 1867 | ucontext, sigaltstack, windows |
08fb77ed SW |
1868 | --enable-gcov enable test coverage analysis with gcov |
1869 | --gcov=GCOV use specified gcov [$gcov_tool] | |
c23f23b9 MT |
1870 | --disable-blobs disable installing provided firmware blobs |
1871 | --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent | |
1872 | --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) | |
a1c5e949 | 1873 | --tls-priority default TLS protocol/cipher priority string |
c12d66aa LM |
1874 | --enable-gprof QEMU profiling with gprof |
1875 | --enable-profiler profiler support | |
c12d66aa LM |
1876 | --enable-debug-stack-usage |
1877 | track the maximum stack usage of stacks created by qemu_alloc_stack | |
40e8c6f4 AB |
1878 | --enable-plugins |
1879 | enable plugins via shared library loading | |
afc3a8f9 | 1880 | --disable-containers don't use containers for cross-building |
f48e590a | 1881 | --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] |
c23f23b9 MT |
1882 | |
1883 | Optional features, enabled with --enable-FEATURE and | |
1884 | disabled with --disable-FEATURE, default is enabled if available: | |
1885 | ||
1886 | system all system emulation targets | |
1887 | user supported user emulation targets | |
1888 | linux-user all linux usermode emulation targets | |
1889 | bsd-user all BSD usermode emulation targets | |
c23f23b9 MT |
1890 | docs build documentation |
1891 | guest-agent build the QEMU Guest Agent | |
1892 | guest-agent-msi build guest agent Windows MSI installation package | |
1893 | pie Position Independent Executables | |
21e709aa | 1894 | modules modules support (non-Windows) |
bd83c861 | 1895 | module-upgrades try to load modules from alternate paths for upgrades |
c23f23b9 MT |
1896 | debug-tcg TCG debugging (default is disabled) |
1897 | debug-info debugging information | |
1898 | sparse sparse checker | |
1e4f6065 DB |
1899 | safe-stack SafeStack Stack Smash Protection. Depends on |
1900 | clang/llvm >= 3.7 and requires coroutine backend ucontext. | |
c23f23b9 | 1901 | |
ddbb0d09 | 1902 | gnutls GNUTLS cryptography support |
91bfcdb0 DB |
1903 | nettle nettle cryptography support |
1904 | gcrypt libgcrypt cryptography support | |
8953caf3 | 1905 | auth-pam PAM access control |
c23f23b9 | 1906 | sdl SDL UI |
04c6e16f | 1907 | sdl-image SDL Image support for icons |
c23f23b9 | 1908 | gtk gtk UI |
c23f23b9 MT |
1909 | vte vte support for the gtk UI |
1910 | curses curses UI | |
e08bb301 | 1911 | iconv font glyph conversion support |
c23f23b9 | 1912 | vnc VNC UI support |
c23f23b9 MT |
1913 | vnc-sasl SASL encryption for VNC server |
1914 | vnc-jpeg JPEG lossy compression for VNC server | |
1915 | vnc-png PNG compression for VNC server | |
c23f23b9 MT |
1916 | cocoa Cocoa UI (Mac OS X only) |
1917 | virtfs VirtFS | |
fe8fc5ae | 1918 | mpath Multipath persistent reservation passthrough |
c23f23b9 | 1919 | xen xen backend driver support |
70c292af | 1920 | xen-pci-passthrough PCI passthrough support for Xen |
c23f23b9 MT |
1921 | brlapi BrlAPI (Braile) |
1922 | curl curl connectivity | |
a40161cb | 1923 | membarrier membarrier system call (for Linux 4.14+ or Windows) |
c23f23b9 | 1924 | fdt fdt device tree |
c23f23b9 | 1925 | kvm KVM acceleration support |
b0cb0a66 | 1926 | hax HAX acceleration support |
c97d6d2c | 1927 | hvf Hypervisor.framework acceleration support |
d661d9a4 | 1928 | whpx Windows Hypervisor Platform acceleration support |
21ab34c9 MA |
1929 | rdma Enable RDMA-based migration |
1930 | pvrdma Enable PVRDMA support | |
c23f23b9 MT |
1931 | vde support for vde network |
1932 | netmap support for netmap network | |
1933 | linux-aio Linux AIO support | |
c10dd856 | 1934 | linux-io-uring Linux io_uring support |
c23f23b9 MT |
1935 | cap-ng libcap-ng support |
1936 | attr attr and xattr support | |
299e6f19 PB |
1937 | vhost-net vhost-net kernel acceleration support |
1938 | vhost-vsock virtio sockets device support | |
1939 | vhost-scsi vhost-scsi kernel target support | |
1940 | vhost-crypto vhost-user-crypto backend support | |
1941 | vhost-kernel vhost kernel backend support | |
1942 | vhost-user vhost-user backend support | |
108a6481 | 1943 | vhost-vdpa vhost-vdpa kernel backend support |
c23f23b9 MT |
1944 | spice spice |
1945 | rbd rados block device (rbd) | |
1946 | libiscsi iscsi support | |
1947 | libnfs nfs support | |
7b02f544 | 1948 | smartcard smartcard support (libcacard) |
c23f23b9 | 1949 | libusb libusb (for usb passthrough) |
ed1701c6 | 1950 | live-block-migration Block migration in the main migration stream |
c23f23b9 MT |
1951 | usb-redir usb network redirection support |
1952 | lzo support of lzo compression library | |
1953 | snappy support of snappy compression library | |
1954 | bzip2 support of bzip2 compression library | |
1955 | (for reading bzip2-compressed dmg images) | |
83bc1f97 JF |
1956 | lzfse support of lzfse compression library |
1957 | (for reading lzfse-compressed dmg images) | |
3a678481 | 1958 | zstd support for zstd compression library |
d298ac10 | 1959 | (for migration compression and qcow2 cluster compression) |
c23f23b9 MT |
1960 | seccomp seccomp support |
1961 | coroutine-pool coroutine freelist (better performance) | |
1962 | glusterfs GlusterFS backend | |
c23f23b9 | 1963 | tpm TPM support |
b10d49d7 | 1964 | libssh ssh block device support |
c23f23b9 | 1965 | numa libnuma support |
ed279a06 | 1966 | libxml2 for Parallels image format |
c23f23b9 | 1967 | tcmalloc tcmalloc support |
7b01cb97 | 1968 | jemalloc jemalloc support |
86583a07 | 1969 | avx2 AVX2 optimization support |
6b8cd447 | 1970 | avx512f AVX512F optimization support |
a6b1d4c0 | 1971 | replication replication support |
c12d66aa LM |
1972 | opengl opengl support |
1973 | virglrenderer virgl rendering support | |
1974 | xfsctl xfsctl support | |
1975 | qom-cast-debug cast debugging support | |
8de73fa8 | 1976 | tools build qemu-io, qemu-nbd and qemu-img tools |
2f740136 JC |
1977 | bochs bochs image format support |
1978 | cloop cloop image format support | |
1979 | dmg dmg image format support | |
1980 | qcow1 qcow v1 image format support | |
1981 | vdi vdi image format support | |
1982 | vvfat vvfat image format support | |
1983 | qed qed image format support | |
1984 | parallels parallels image format support | |
1985 | sheepdog sheepdog block driver support | |
f0d92b56 | 1986 | crypto-afalg Linux AF_ALG crypto backend driver |
8ca80760 | 1987 | capstone capstone disassembler support |
ba59fb77 | 1988 | debug-mutex mutex debugging support |
17824406 | 1989 | libpmem libpmem support |
75411919 | 1990 | xkbcommon xkbcommon support |
b767d257 | 1991 | rng-none dummy RNG, avoid using /dev/(u)random and getrandom() |
21b2eca6 | 1992 | libdaxctl libdaxctl support |
08fb77ed SW |
1993 | |
1994 | NOTE: The object files are built at the place where configure is launched | |
af5db58e | 1995 | EOF |
2d2ad6d0 | 1996 | exit 0 |
af5db58e PB |
1997 | fi |
1998 | ||
9c790242 | 1999 | # Remove old dependency files to make sure that they get properly regenerated |
bb768f71 | 2000 | rm -f */config-devices.mak.d |
9c790242 | 2001 | |
4d6a835d LV |
2002 | # Remove syscall_nr.h to be sure they will be regenerated in the build |
2003 | # directory, not in the source directory | |
bb0cdc03 | 2004 | for arch in alpha hppa m68k xtensa sh4 microblaze arm ppc s390x sparc sparc64 \ |
686a0fe4 | 2005 | i386 x86_64 mips mips64 ; do |
4d6a835d LV |
2006 | # remove the file if it has been generated in the source directory |
2007 | rm -f "${source_path}/linux-user/${arch}/syscall_nr.h" | |
2008 | # remove the dependency files | |
91e5998f LV |
2009 | for target in ${arch}*-linux-user ; do |
2010 | test -d "${target}" && find "${target}" -type f -name "*.d" \ | |
2011 | -exec grep -q "${source_path}/linux-user/${arch}/syscall_nr.h" {} \; \ | |
2012 | -print | while read file ; do rm "${file}" "${file%.d}.o" ; done | |
2013 | done | |
4d6a835d LV |
2014 | done |
2015 | ||
faf44142 DB |
2016 | if test -z "$python" |
2017 | then | |
2018 | error_exit "Python not found. Use --python=/path/to/python" | |
c53eeaf7 SH |
2019 | fi |
2020 | ||
2021 | # Note that if the Python conditional here evaluates True we will exit | |
2022 | # with status 1 which is a shell 'false' value. | |
ddf90699 EH |
2023 | if ! $python -c 'import sys; sys.exit(sys.version_info < (3,5))'; then |
2024 | error_exit "Cannot use '$python', Python >= 3.5 is required." \ | |
c53eeaf7 SH |
2025 | "Use --python=/path/to/python to specify a supported Python." |
2026 | fi | |
2027 | ||
755ee70f | 2028 | # Preserve python version since some functionality is dependent on it |
406ab2f3 | 2029 | 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 | 2030 | |
c53eeaf7 SH |
2031 | # Suppress writing compiled files |
2032 | python="$python -B" | |
2033 | ||
0a01d76f MAL |
2034 | if test -z "$meson"; then |
2035 | if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.55.0; then | |
2036 | meson=meson | |
2037 | elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then | |
2038 | meson=git | |
2039 | elif test -e "${source_path}/meson/meson.py" ; then | |
2040 | meson=internal | |
2041 | else | |
2042 | if test "$explicit_python" = yes; then | |
2043 | error_exit "--python requires using QEMU's embedded Meson distribution, but it was not found." | |
2044 | else | |
2045 | error_exit "Meson not found. Use --meson=/path/to/meson" | |
2046 | fi | |
2047 | fi | |
2048 | else | |
2049 | # Meson uses its own Python interpreter to invoke other Python scripts, | |
2050 | # but the user wants to use the one they specified with --python. | |
2051 | # | |
2052 | # We do not want to override the distro Python interpreter (and sometimes | |
2053 | # cannot: for example in Homebrew /usr/bin/meson is a bash script), so | |
2054 | # just require --meson=git|internal together with --python. | |
2055 | if test "$explicit_python" = yes; then | |
2056 | case "$meson" in | |
2057 | git | internal) ;; | |
2058 | *) error_exit "--python requires using QEMU's embedded Meson distribution." ;; | |
2059 | esac | |
2060 | fi | |
a5665051 | 2061 | fi |
a5665051 | 2062 | |
0a01d76f MAL |
2063 | if test "$meson" = git; then |
2064 | git_submodules="${git_submodules} meson" | |
a5665051 | 2065 | fi |
0a01d76f MAL |
2066 | if test "$git_update" = yes; then |
2067 | (cd "${source_path}" && GIT="$git" "./scripts/git-submodule.sh" update "$git_submodules") | |
2068 | fi | |
2069 | ||
2070 | case "$meson" in | |
2071 | git | internal) | |
2072 | if ! $python -c 'import pkg_resources' > /dev/null 2>&1; then | |
2073 | error_exit "Python setuptools not found" | |
2074 | fi | |
2075 | meson="$python ${source_path}/meson/meson.py" | |
2076 | ;; | |
2077 | *) meson=$(command -v meson) ;; | |
2078 | esac | |
2079 | ||
a5665051 | 2080 | |
9aae6e54 DHB |
2081 | # Check that the C compiler works. Doing this here before testing |
2082 | # the host CPU ensures that we had a valid CC to autodetect the | |
2083 | # $cpu var (and we should bail right here if that's not the case). | |
2084 | # It also allows the help message to be printed without a CC. | |
2085 | write_c_skeleton; | |
2086 | if compile_object ; then | |
2087 | : C compiler works ok | |
2088 | else | |
2089 | error_exit "\"$cc\" either does not exist or does not work" | |
2090 | fi | |
2091 | if ! compile_prog ; then | |
2092 | error_exit "\"$cc\" cannot build an executable (is your linker broken?)" | |
2093 | fi | |
2094 | ||
359bc95d PM |
2095 | # Now we have handled --enable-tcg-interpreter and know we're not just |
2096 | # printing the help message, bail out if the host CPU isn't supported. | |
2097 | if test "$ARCH" = "unknown"; then | |
2098 | if test "$tcg_interpreter" = "yes" ; then | |
2099 | echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" | |
359bc95d | 2100 | else |
76ad07a4 | 2101 | error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter" |
359bc95d PM |
2102 | fi |
2103 | fi | |
2104 | ||
9c83ffd8 PM |
2105 | # Consult white-list to determine whether to enable werror |
2106 | # by default. Only enable by default for git builds | |
9c83ffd8 | 2107 | if test -z "$werror" ; then |
fd73745d | 2108 | if test -e "$source_path/.git" && \ |
e633a5c6 | 2109 | { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then |
9c83ffd8 PM |
2110 | werror="yes" |
2111 | else | |
2112 | werror="no" | |
2113 | fi | |
2114 | fi | |
2115 | ||
fb59dabd PM |
2116 | if test "$bogus_os" = "yes"; then |
2117 | # Now that we know that we're not printing the help and that | |
2118 | # the compiler works (so the results of the check_defines we used | |
2119 | # to identify the OS are reliable), if we didn't recognize the | |
2120 | # host OS we should stop now. | |
951fedfc | 2121 | error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" |
fb59dabd PM |
2122 | fi |
2123 | ||
efc6c070 TH |
2124 | # Check whether the compiler matches our minimum requirements: |
2125 | cat > $TMPC << EOF | |
2126 | #if defined(__clang_major__) && defined(__clang_minor__) | |
2127 | # ifdef __apple_build_version__ | |
2128 | # if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1) | |
2129 | # error You need at least XCode Clang v5.1 to compile QEMU | |
2130 | # endif | |
2131 | # else | |
2132 | # if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4) | |
2133 | # error You need at least Clang v3.4 to compile QEMU | |
2134 | # endif | |
2135 | # endif | |
2136 | #elif defined(__GNUC__) && defined(__GNUC_MINOR__) | |
2137 | # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) | |
2138 | # error You need at least GCC v4.8 to compile QEMU | |
2139 | # endif | |
2140 | #else | |
2141 | # error You either need GCC or Clang to compiler QEMU | |
2142 | #endif | |
2143 | int main (void) { return 0; } | |
2144 | EOF | |
2145 | if ! compile_prog "" "" ; then | |
2146 | error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)" | |
2147 | fi | |
2148 | ||
00849b92 RH |
2149 | # Accumulate -Wfoo and -Wno-bar separately. |
2150 | # We will list all of the enable flags first, and the disable flags second. | |
2151 | # Note that we do not add -Werror, because that would enable it for all | |
2152 | # configure tests. If a configure test failed due to -Werror this would | |
2153 | # just silently disable some features, so it's too error prone. | |
2154 | ||
2155 | warn_flags= | |
2156 | add_to warn_flags -Wold-style-declaration | |
2157 | add_to warn_flags -Wold-style-definition | |
2158 | add_to warn_flags -Wtype-limits | |
2159 | add_to warn_flags -Wformat-security | |
2160 | add_to warn_flags -Wformat-y2k | |
2161 | add_to warn_flags -Winit-self | |
2162 | add_to warn_flags -Wignored-qualifiers | |
2163 | add_to warn_flags -Wempty-body | |
2164 | add_to warn_flags -Wnested-externs | |
2165 | add_to warn_flags -Wendif-labels | |
2166 | add_to warn_flags -Wexpansion-to-defined | |
2167 | ||
2168 | nowarn_flags= | |
2169 | add_to nowarn_flags -Wno-initializer-overrides | |
2170 | add_to nowarn_flags -Wno-missing-include-dirs | |
2171 | add_to nowarn_flags -Wno-shift-negative-value | |
2172 | add_to nowarn_flags -Wno-string-plus-int | |
2173 | add_to nowarn_flags -Wno-typedef-redefinition | |
aabab967 | 2174 | add_to nowarn_flags -Wno-tautological-type-limit-compare |
bac8d222 | 2175 | add_to nowarn_flags -Wno-psabi |
00849b92 RH |
2176 | |
2177 | gcc_flags="$warn_flags $nowarn_flags" | |
93b25869 JS |
2178 | |
2179 | cc_has_warning_flag() { | |
2180 | write_c_skeleton; | |
2181 | ||
a1d29d6c PM |
2182 | # Use the positive sense of the flag when testing for -Wno-wombat |
2183 | # support (gcc will happily accept the -Wno- form of unknown | |
2184 | # warning options). | |
93b25869 JS |
2185 | optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" |
2186 | compile_prog "-Werror $optflag" "" | |
2187 | } | |
2188 | ||
2189 | for flag in $gcc_flags; do | |
2190 | if cc_has_warning_flag $flag ; then | |
2191 | QEMU_CFLAGS="$QEMU_CFLAGS $flag" | |
8d05095c PB |
2192 | fi |
2193 | done | |
2194 | ||
3b463a3f | 2195 | if test "$stack_protector" != "no"; then |
fccd35a0 RR |
2196 | cat > $TMPC << EOF |
2197 | int main(int argc, char *argv[]) | |
2198 | { | |
2199 | char arr[64], *p = arr, *c = argv[0]; | |
2200 | while (*c) { | |
2201 | *p++ = *c++; | |
2202 | } | |
2203 | return 0; | |
2204 | } | |
2205 | EOF | |
63678e17 | 2206 | gcc_flags="-fstack-protector-strong -fstack-protector-all" |
3b463a3f | 2207 | sp_on=0 |
63678e17 | 2208 | for flag in $gcc_flags; do |
590e5dd9 PM |
2209 | # We need to check both a compile and a link, since some compiler |
2210 | # setups fail only on a .c->.o compile and some only at link time | |
086d5f75 | 2211 | if compile_object "-Werror $flag" && |
590e5dd9 | 2212 | compile_prog "-Werror $flag" ""; then |
63678e17 | 2213 | QEMU_CFLAGS="$QEMU_CFLAGS $flag" |
db5adeaa | 2214 | QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" |
3b463a3f | 2215 | sp_on=1 |
63678e17 SN |
2216 | break |
2217 | fi | |
2218 | done | |
3b463a3f MR |
2219 | if test "$stack_protector" = yes; then |
2220 | if test $sp_on = 0; then | |
2221 | error_exit "Stack protector not supported" | |
2222 | fi | |
2223 | fi | |
37746c5e MAL |
2224 | fi |
2225 | ||
20bc94a2 PB |
2226 | # Disable -Wmissing-braces on older compilers that warn even for |
2227 | # the "universal" C zero initializer {0}. | |
2228 | cat > $TMPC << EOF | |
2229 | struct { | |
2230 | int a[2]; | |
2231 | } x = {0}; | |
2232 | EOF | |
2233 | if compile_object "-Werror" "" ; then | |
2234 | : | |
2235 | else | |
2236 | QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" | |
2237 | fi | |
2238 | ||
21e709aa MAL |
2239 | # Our module code doesn't support Windows |
2240 | if test "$modules" = "yes" && test "$mingw32" = "yes" ; then | |
2241 | error_exit "Modules are not available for Windows" | |
2242 | fi | |
2243 | ||
bd83c861 CE |
2244 | # module_upgrades is only reasonable if modules are enabled |
2245 | if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then | |
2246 | error_exit "Can't enable module-upgrades as Modules are not enabled" | |
2247 | fi | |
2248 | ||
d376e9de | 2249 | # Static linking is not possible with modules or PIE |
40d6444e | 2250 | if test "$static" = "yes" ; then |
aa0d1f44 PB |
2251 | if test "$modules" = "yes" ; then |
2252 | error_exit "static and modules are mutually incompatible" | |
2253 | fi | |
40d6444e AK |
2254 | fi |
2255 | ||
768b7855 EC |
2256 | # Unconditional check for compiler __thread support |
2257 | cat > $TMPC << EOF | |
2258 | static __thread int tls_var; | |
2259 | int main(void) { return tls_var; } | |
2260 | EOF | |
2261 | ||
2262 | if ! compile_prog "-Werror" "" ; then | |
2263 | error_exit "Your compiler does not support the __thread specifier for " \ | |
2264 | "Thread-Local Storage (TLS). Please upgrade to a version that does." | |
2265 | fi | |
2266 | ||
b2634124 | 2267 | cat > $TMPC << EOF |
21d4a791 AK |
2268 | |
2269 | #ifdef __linux__ | |
2270 | # define THREAD __thread | |
2271 | #else | |
2272 | # define THREAD | |
2273 | #endif | |
21d4a791 | 2274 | static THREAD int tls_var; |
21d4a791 | 2275 | int main(void) { return tls_var; } |
40d6444e | 2276 | EOF |
412aeacd | 2277 | |
b2634124 RH |
2278 | # Check we support --no-pie first; we will need this for building ROMs. |
2279 | if compile_prog "-Werror -fno-pie" "-no-pie"; then | |
2280 | CFLAGS_NOPIE="-fno-pie" | |
2281 | LDFLAGS_NOPIE="-no-pie" | |
2282 | fi | |
2283 | ||
12781462 | 2284 | if test "$static" = "yes"; then |
eca7a8e6 | 2285 | if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then |
086d5f75 | 2286 | CFLAGS="-fPIE -DPIE $CFLAGS" |
12781462 RH |
2287 | QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" |
2288 | pie="yes" | |
2289 | elif test "$pie" = "yes"; then | |
2290 | error_exit "-static-pie not available due to missing toolchain support" | |
2291 | else | |
2292 | QEMU_LDFLAGS="-static $QEMU_LDFLAGS" | |
2293 | pie="no" | |
2294 | fi | |
2295 | elif test "$pie" = "no"; then | |
086d5f75 PB |
2296 | CFLAGS="$CFLAGS_NOPIE $CFLAGS" |
2297 | LDFLAGS="$LDFLAGS_NOPIE $LDFLAGS" | |
eca7a8e6 | 2298 | elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then |
086d5f75 PB |
2299 | CFLAGS="-fPIE -DPIE $CFLAGS" |
2300 | LDFLAGS="-pie $LDFLAGS" | |
2c674109 RH |
2301 | pie="yes" |
2302 | elif test "$pie" = "yes"; then | |
2303 | error_exit "PIE not available due to missing toolchain support" | |
2304 | else | |
2305 | echo "Disabling PIE due to missing toolchain support" | |
2306 | pie="no" | |
40d6444e AK |
2307 | fi |
2308 | ||
e6cbd751 RH |
2309 | # Detect support for PT_GNU_RELRO + DT_BIND_NOW. |
2310 | # The combination is known as "full relro", because .got.plt is read-only too. | |
2311 | if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then | |
2312 | QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS" | |
2313 | fi | |
2314 | ||
09dada40 PB |
2315 | ########################################## |
2316 | # __sync_fetch_and_and requires at least -march=i486. Many toolchains | |
2317 | # use i686 as default anyway, but for those that don't, an explicit | |
2318 | # specification is necessary | |
2319 | ||
2320 | if test "$cpu" = "i386"; then | |
2321 | cat > $TMPC << EOF | |
2322 | static int sfaa(int *ptr) | |
2323 | { | |
2324 | return __sync_fetch_and_and(ptr, 0); | |
2325 | } | |
2326 | ||
2327 | int main(void) | |
2328 | { | |
2329 | int val = 42; | |
1405b629 | 2330 | val = __sync_val_compare_and_swap(&val, 0, 1); |
09dada40 PB |
2331 | sfaa(&val); |
2332 | return val; | |
2333 | } | |
2334 | EOF | |
2335 | if ! compile_prog "" "" ; then | |
2336 | QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" | |
2337 | fi | |
2338 | fi | |
2339 | ||
2340 | ######################################### | |
ec530c81 | 2341 | # Solaris specific configure tool chain decisions |
09dada40 | 2342 | |
ec530c81 | 2343 | if test "$solaris" = "yes" ; then |
6792aa11 LM |
2344 | if has $install; then |
2345 | : | |
2346 | else | |
76ad07a4 PM |
2347 | error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \ |
2348 | "install fileutils from www.blastwave.org using pkg-get -i fileutils" \ | |
2349 | "to get ginstall which is used by default (which lives in /opt/csw/bin)" | |
ec530c81 | 2350 | fi |
89138857 | 2351 | if test "$(path_of $install)" = "/usr/sbin/install" ; then |
76ad07a4 PM |
2352 | error_exit "Solaris /usr/sbin/install is not an appropriate install program." \ |
2353 | "try ginstall from the GNU fileutils available from www.blastwave.org" \ | |
2354 | "using pkg-get -i fileutils, or use --install=/usr/ucb/install" | |
ec530c81 | 2355 | fi |
6792aa11 LM |
2356 | if has ar; then |
2357 | : | |
2358 | else | |
ec530c81 | 2359 | if test -f /usr/ccs/bin/ar ; then |
76ad07a4 PM |
2360 | error_exit "No path includes ar" \ |
2361 | "Add /usr/ccs/bin to your path and rerun configure" | |
ec530c81 | 2362 | fi |
76ad07a4 | 2363 | error_exit "No path includes ar" |
ec530c81 | 2364 | fi |
5fafdf24 | 2365 | fi |
ec530c81 | 2366 | |
afb63ebd | 2367 | if test -z "${target_list+xxx}" ; then |
d880a3ba PB |
2368 | for target in $default_target_list; do |
2369 | supported_target $target 2>/dev/null && \ | |
2370 | target_list="$target_list $target" | |
2371 | done | |
2372 | target_list="${target_list# }" | |
121afa9e | 2373 | else |
89138857 | 2374 | target_list=$(echo "$target_list" | sed -e 's/,/ /g') |
d880a3ba PB |
2375 | for target in $target_list; do |
2376 | # Check that we recognised the target name; this allows a more | |
2377 | # friendly error message than if we let it fall through. | |
2378 | case " $default_target_list " in | |
2379 | *" $target "*) | |
2380 | ;; | |
2381 | *) | |
2382 | error_exit "Unknown target name '$target'" | |
2383 | ;; | |
2384 | esac | |
2385 | supported_target $target || exit 1 | |
2386 | done | |
121afa9e | 2387 | fi |
25b48338 | 2388 | |
f55fe278 PB |
2389 | # see if system emulation was really requested |
2390 | case " $target_list " in | |
2391 | *"-softmmu "*) softmmu=yes | |
2392 | ;; | |
2393 | *) softmmu=no | |
2394 | ;; | |
2395 | esac | |
5327cf48 | 2396 | |
05dfa22b PMD |
2397 | for target in $target_list; do |
2398 | case "$target" in | |
2399 | arm-softmmu | aarch64-softmmu | i386-softmmu | x86_64-softmmu) | |
2400 | edk2_blobs="yes" | |
2401 | ;; | |
2402 | esac | |
2403 | done | |
623ef637 PMD |
2404 | # The EDK2 binaries are compressed with bzip2 |
2405 | if test "$edk2_blobs" = "yes" && ! has bzip2; then | |
2406 | error_exit "The bzip2 program is required for building QEMU" | |
2407 | fi | |
05dfa22b | 2408 | |
249247c9 JQ |
2409 | feature_not_found() { |
2410 | feature=$1 | |
21684af0 | 2411 | remedy=$2 |
249247c9 | 2412 | |
76ad07a4 | 2413 | error_exit "User requested feature $feature" \ |
21684af0 SS |
2414 | "configure was not able to find it." \ |
2415 | "$remedy" | |
249247c9 JQ |
2416 | } |
2417 | ||
7d13299d FB |
2418 | # --- |
2419 | # big/little endian test | |
2420 | cat > $TMPC << EOF | |
61cc919f MF |
2421 | short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; |
2422 | short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; | |
2423 | extern int foo(short *, short *); | |
2424 | int main(int argc, char *argv[]) { | |
2425 | return foo(big_endian, little_endian); | |
7d13299d FB |
2426 | } |
2427 | EOF | |
2428 | ||
61cc919f | 2429 | if compile_object ; then |
12f15c91 | 2430 | if strings -a $TMPO | grep -q BiGeNdIaN ; then |
61cc919f | 2431 | bigendian="yes" |
12f15c91 | 2432 | elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then |
61cc919f MF |
2433 | bigendian="no" |
2434 | else | |
2435 | echo big/little test failed | |
21d89f84 | 2436 | fi |
61cc919f MF |
2437 | else |
2438 | echo big/little test failed | |
7d13299d FB |
2439 | fi |
2440 | ||
e10ee3f5 PMD |
2441 | ########################################## |
2442 | # system tools | |
2443 | if test -z "$want_tools"; then | |
2444 | if test "$softmmu" = "no"; then | |
2445 | want_tools=no | |
2446 | else | |
2447 | want_tools=yes | |
2448 | fi | |
2449 | fi | |
2450 | ||
a30878e7 PM |
2451 | ########################################## |
2452 | # cocoa implies not SDL or GTK | |
2453 | # (the cocoa UI code currently assumes it is always the active UI | |
2454 | # and doesn't interact well with other UI frontend code) | |
2455 | if test "$cocoa" = "yes"; then | |
2456 | if test "$sdl" = "yes"; then | |
2457 | error_exit "Cocoa and SDL UIs cannot both be enabled at once" | |
2458 | fi | |
2459 | if test "$gtk" = "yes"; then | |
2460 | error_exit "Cocoa and GTK UIs cannot both be enabled at once" | |
2461 | fi | |
2462 | gtk=no | |
2463 | sdl=no | |
2464 | fi | |
2465 | ||
6b39b063 EB |
2466 | # Some versions of Mac OS X incorrectly define SIZE_MAX |
2467 | cat > $TMPC << EOF | |
2468 | #include <stdint.h> | |
2469 | #include <stdio.h> | |
2470 | int main(int argc, char *argv[]) { | |
2471 | return printf("%zu", SIZE_MAX); | |
2472 | } | |
2473 | EOF | |
2474 | have_broken_size_max=no | |
2475 | if ! compile_object -Werror ; then | |
2476 | have_broken_size_max=yes | |
2477 | fi | |
2478 | ||
015a33bd GA |
2479 | ########################################## |
2480 | # L2TPV3 probe | |
2481 | ||
2482 | cat > $TMPC <<EOF | |
2483 | #include <sys/socket.h> | |
bff6cb72 | 2484 | #include <linux/ip.h> |
015a33bd GA |
2485 | int main(void) { return sizeof(struct mmsghdr); } |
2486 | EOF | |
2487 | if compile_prog "" "" ; then | |
2488 | l2tpv3=yes | |
2489 | else | |
2490 | l2tpv3=no | |
2491 | fi | |
2492 | ||
c9c8b88f DC |
2493 | if check_include "pty.h" ; then |
2494 | pty_h=yes | |
2495 | else | |
2496 | pty_h=no | |
2497 | fi | |
2498 | ||
195588cc DC |
2499 | cat > $TMPC <<EOF |
2500 | #include <sys/mman.h> | |
2501 | int main(int argc, char *argv[]) { | |
2502 | return mlockall(MCL_FUTURE); | |
2503 | } | |
2504 | EOF | |
2505 | if compile_prog "" "" ; then | |
2506 | have_mlockall=yes | |
2507 | else | |
2508 | have_mlockall=no | |
2509 | fi | |
2510 | ||
299e6f19 PB |
2511 | ######################################### |
2512 | # vhost interdependencies and host support | |
2513 | ||
2514 | # vhost backends | |
2515 | test "$vhost_user" = "" && vhost_user=yes | |
2516 | if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then | |
2517 | error_exit "vhost-user isn't available on win32" | |
2518 | fi | |
108a6481 CL |
2519 | test "$vhost_vdpa" = "" && vhost_vdpa=$linux |
2520 | if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then | |
2521 | error_exit "vhost-vdpa is only available on Linux" | |
2522 | fi | |
299e6f19 PB |
2523 | test "$vhost_kernel" = "" && vhost_kernel=$linux |
2524 | if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then | |
2525 | error_exit "vhost-kernel is only available on Linux" | |
2526 | fi | |
2527 | ||
2528 | # vhost-kernel devices | |
2529 | test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel | |
2530 | if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then | |
2531 | error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" | |
2532 | fi | |
2533 | test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel | |
2534 | if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then | |
2535 | error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" | |
2536 | fi | |
2537 | ||
2538 | # vhost-user backends | |
2539 | test "$vhost_net_user" = "" && vhost_net_user=$vhost_user | |
2540 | if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then | |
2541 | error_exit "--enable-vhost-net-user requires --enable-vhost-user" | |
2542 | fi | |
2543 | test "$vhost_crypto" = "" && vhost_crypto=$vhost_user | |
2544 | if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then | |
2545 | error_exit "--enable-vhost-crypto requires --enable-vhost-user" | |
2546 | fi | |
98fc1ada DDAG |
2547 | test "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user |
2548 | if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then | |
2549 | error_exit "--enable-vhost-user-fs requires --enable-vhost-user" | |
2550 | fi | |
108a6481 CL |
2551 | #vhost-vdpa backends |
2552 | test "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa | |
2553 | if test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then | |
2554 | error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa" | |
2555 | fi | |
299e6f19 PB |
2556 | |
2557 | # OR the vhost-kernel and vhost-user values for simplicity | |
2558 | if test "$vhost_net" = ""; then | |
2559 | test "$vhost_net_user" = "yes" && vhost_net=yes | |
2560 | test "$vhost_kernel" = "yes" && vhost_net=yes | |
2561 | fi | |
2562 | ||
4d9310f4 DB |
2563 | ########################################## |
2564 | # MinGW / Mingw-w64 localtime_r/gmtime_r check | |
2565 | ||
2566 | if test "$mingw32" = "yes"; then | |
2567 | # Some versions of MinGW / Mingw-w64 lack localtime_r | |
2568 | # and gmtime_r entirely. | |
2569 | # | |
2570 | # Some versions of Mingw-w64 define a macro for | |
2571 | # localtime_r/gmtime_r. | |
2572 | # | |
2573 | # Some versions of Mingw-w64 will define functions | |
2574 | # for localtime_r/gmtime_r, but only if you have | |
2575 | # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun | |
2576 | # though, unistd.h and pthread.h both define | |
2577 | # that for you. | |
2578 | # | |
2579 | # So this #undef localtime_r and #include <unistd.h> | |
2580 | # are not in fact redundant. | |
2581 | cat > $TMPC << EOF | |
2582 | #include <unistd.h> | |
2583 | #include <time.h> | |
2584 | #undef localtime_r | |
2585 | int main(void) { localtime_r(NULL, NULL); return 0; } | |
2586 | EOF | |
2587 | if compile_prog "" "" ; then | |
2588 | localtime_r="yes" | |
2589 | else | |
2590 | localtime_r="no" | |
2591 | fi | |
2592 | fi | |
2593 | ||
779ab5e3 SW |
2594 | ########################################## |
2595 | # pkg-config probe | |
2596 | ||
2597 | if ! has "$pkg_config_exe"; then | |
76ad07a4 | 2598 | error_exit "pkg-config binary '$pkg_config_exe' not found" |
779ab5e3 SW |
2599 | fi |
2600 | ||
b0a47e79 JQ |
2601 | ########################################## |
2602 | # NPTL probe | |
2603 | ||
24cb36a6 | 2604 | if test "$linux_user" = "yes"; then |
b0a47e79 | 2605 | cat > $TMPC <<EOF |
bd0c5661 | 2606 | #include <sched.h> |
30813cea | 2607 | #include <linux/futex.h> |
182eacc0 | 2608 | int main(void) { |
bd0c5661 PB |
2609 | #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) |
2610 | #error bork | |
2611 | #endif | |
182eacc0 | 2612 | return 0; |
bd0c5661 PB |
2613 | } |
2614 | EOF | |
24cb36a6 | 2615 | if ! compile_object ; then |
21684af0 | 2616 | feature_not_found "nptl" "Install glibc and linux kernel headers." |
b0a47e79 | 2617 | fi |
bd0c5661 PB |
2618 | fi |
2619 | ||
607dacd0 QN |
2620 | ########################################## |
2621 | # lzo check | |
2622 | ||
2623 | if test "$lzo" != "no" ; then | |
2624 | cat > $TMPC << EOF | |
2625 | #include <lzo/lzo1x.h> | |
2626 | int main(void) { lzo_version(); return 0; } | |
2627 | EOF | |
2628 | if compile_prog "" "-llzo2" ; then | |
b25c9dff SW |
2629 | libs_softmmu="$libs_softmmu -llzo2" |
2630 | lzo="yes" | |
607dacd0 | 2631 | else |
b25c9dff SW |
2632 | if test "$lzo" = "yes"; then |
2633 | feature_not_found "liblzo2" "Install liblzo2 devel" | |
2634 | fi | |
2635 | lzo="no" | |
607dacd0 | 2636 | fi |
607dacd0 QN |
2637 | fi |
2638 | ||
2639 | ########################################## | |
2640 | # snappy check | |
2641 | ||
2642 | if test "$snappy" != "no" ; then | |
2643 | cat > $TMPC << EOF | |
2644 | #include <snappy-c.h> | |
2645 | int main(void) { snappy_max_compressed_length(4096); return 0; } | |
2646 | EOF | |
2647 | if compile_prog "" "-lsnappy" ; then | |
b25c9dff SW |
2648 | libs_softmmu="$libs_softmmu -lsnappy" |
2649 | snappy="yes" | |
607dacd0 | 2650 | else |
b25c9dff SW |
2651 | if test "$snappy" = "yes"; then |
2652 | feature_not_found "libsnappy" "Install libsnappy devel" | |
2653 | fi | |
2654 | snappy="no" | |
607dacd0 | 2655 | fi |
607dacd0 QN |
2656 | fi |
2657 | ||
6b383c08 PW |
2658 | ########################################## |
2659 | # bzip2 check | |
2660 | ||
2661 | if test "$bzip2" != "no" ; then | |
2662 | cat > $TMPC << EOF | |
2663 | #include <bzlib.h> | |
2664 | int main(void) { BZ2_bzlibVersion(); return 0; } | |
2665 | EOF | |
2666 | if compile_prog "" "-lbz2" ; then | |
2667 | bzip2="yes" | |
2668 | else | |
2669 | if test "$bzip2" = "yes"; then | |
2670 | feature_not_found "libbzip2" "Install libbzip2 devel" | |
2671 | fi | |
2672 | bzip2="no" | |
2673 | fi | |
2674 | fi | |
2675 | ||
83bc1f97 JF |
2676 | ########################################## |
2677 | # lzfse check | |
2678 | ||
2679 | if test "$lzfse" != "no" ; then | |
2680 | cat > $TMPC << EOF | |
2681 | #include <lzfse.h> | |
2682 | int main(void) { lzfse_decode_scratch_size(); return 0; } | |
2683 | EOF | |
2684 | if compile_prog "" "-llzfse" ; then | |
2685 | lzfse="yes" | |
2686 | else | |
2687 | if test "$lzfse" = "yes"; then | |
2688 | feature_not_found "lzfse" "Install lzfse devel" | |
2689 | fi | |
2690 | lzfse="no" | |
2691 | fi | |
2692 | fi | |
2693 | ||
3a678481 JQ |
2694 | ########################################## |
2695 | # zstd check | |
2696 | ||
2697 | if test "$zstd" != "no" ; then | |
297254c7 JQ |
2698 | libzstd_minver="1.4.0" |
2699 | if $pkg_config --atleast-version=$libzstd_minver libzstd ; then | |
3a678481 JQ |
2700 | zstd_cflags="$($pkg_config --cflags libzstd)" |
2701 | zstd_libs="$($pkg_config --libs libzstd)" | |
2702 | LIBS="$zstd_libs $LIBS" | |
2703 | QEMU_CFLAGS="$QEMU_CFLAGS $zstd_cflags" | |
2704 | zstd="yes" | |
2705 | else | |
2706 | if test "$zstd" = "yes" ; then | |
2707 | feature_not_found "libzstd" "Install libzstd devel" | |
2708 | fi | |
2709 | zstd="no" | |
2710 | fi | |
2711 | fi | |
2712 | ||
f794573e EO |
2713 | ########################################## |
2714 | # libseccomp check | |
2715 | ||
2716 | if test "$seccomp" != "no" ; then | |
25ed0ecc HD |
2717 | libseccomp_minver="2.3.0" |
2718 | if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then | |
c3883e1f FZ |
2719 | seccomp_cflags="$($pkg_config --cflags libseccomp)" |
2720 | seccomp_libs="$($pkg_config --libs libseccomp)" | |
693e5910 | 2721 | seccomp="yes" |
f794573e | 2722 | else |
693e5910 | 2723 | if test "$seccomp" = "yes" ; then |
25ed0ecc HD |
2724 | feature_not_found "libseccomp" \ |
2725 | "Install libseccomp devel >= $libseccomp_minver" | |
693e5910 AJ |
2726 | fi |
2727 | seccomp="no" | |
f794573e EO |
2728 | fi |
2729 | fi | |
e37630ca AL |
2730 | ########################################## |
2731 | # xen probe | |
2732 | ||
fc321b4b | 2733 | if test "$xen" != "no" ; then |
c1cdd9d5 JG |
2734 | # Check whether Xen library path is specified via --extra-ldflags to avoid |
2735 | # overriding this setting with pkg-config output. If not, try pkg-config | |
2736 | # to obtain all needed flags. | |
2737 | ||
2738 | if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ | |
2739 | $pkg_config --exists xencontrol ; then | |
2740 | xen_ctrl_version="$(printf '%d%02d%02d' \ | |
2741 | $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" | |
2742 | xen=yes | |
2743 | xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab" | |
2744 | xen_pc="$xen_pc xenevtchn xendevicemodel" | |
58ea9a7a AP |
2745 | if $pkg_config --exists xentoolcore; then |
2746 | xen_pc="$xen_pc xentoolcore" | |
2747 | fi | |
c1cdd9d5 JG |
2748 | QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)" |
2749 | libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu" | |
c1cdd9d5 | 2750 | else |
d5b93ddf | 2751 | |
c1cdd9d5 | 2752 | xen_libs="-lxenstore -lxenctrl -lxenguest" |
d9506cab | 2753 | xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" |
50ced5b3 | 2754 | |
c1cdd9d5 JG |
2755 | # First we test whether Xen headers and libraries are available. |
2756 | # If no, we are done and there is no Xen support. | |
2757 | # If yes, more tests are run to detect the Xen version. | |
2758 | ||
2759 | # Xen (any) | |
2760 | cat > $TMPC <<EOF | |
e37630ca | 2761 | #include <xenctrl.h> |
50ced5b3 SW |
2762 | int main(void) { |
2763 | return 0; | |
2764 | } | |
2765 | EOF | |
c1cdd9d5 JG |
2766 | if ! compile_prog "" "$xen_libs" ; then |
2767 | # Xen not found | |
2768 | if test "$xen" = "yes" ; then | |
2769 | feature_not_found "xen" "Install xen devel" | |
2770 | fi | |
2771 | xen=no | |
50ced5b3 | 2772 | |
c1cdd9d5 JG |
2773 | # Xen unstable |
2774 | elif | |
2775 | cat > $TMPC <<EOF && | |
2cbf8903 RL |
2776 | #undef XC_WANT_COMPAT_DEVICEMODEL_API |
2777 | #define __XEN_TOOLS__ | |
2778 | #include <xendevicemodel.h> | |
d3c49ebb | 2779 | #include <xenforeignmemory.h> |
2cbf8903 RL |
2780 | int main(void) { |
2781 | xendevicemodel_handle *xd; | |
d3c49ebb | 2782 | xenforeignmemory_handle *xfmem; |
2cbf8903 RL |
2783 | |
2784 | xd = xendevicemodel_open(0, 0); | |
2785 | xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); | |
2786 | ||
d3c49ebb PD |
2787 | xfmem = xenforeignmemory_open(0, 0); |
2788 | xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); | |
2789 | ||
2cbf8903 RL |
2790 | return 0; |
2791 | } | |
2792 | EOF | |
2793 | compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" | |
2794 | then | |
2795 | xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" | |
2796 | xen_ctrl_version=41100 | |
2797 | xen=yes | |
2798 | elif | |
2799 | cat > $TMPC <<EOF && | |
5ba3d756 ID |
2800 | #undef XC_WANT_COMPAT_MAP_FOREIGN_API |
2801 | #include <xenforeignmemory.h> | |
58ea9a7a | 2802 | #include <xentoolcore.h> |
5ba3d756 ID |
2803 | int main(void) { |
2804 | xenforeignmemory_handle *xfmem; | |
2805 | ||
2806 | xfmem = xenforeignmemory_open(0, 0); | |
2807 | xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); | |
58ea9a7a | 2808 | xentoolcore_restrict_all(0); |
5ba3d756 ID |
2809 | |
2810 | return 0; | |
2811 | } | |
2812 | EOF | |
58ea9a7a | 2813 | compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" |
5ba3d756 | 2814 | then |
58ea9a7a | 2815 | xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" |
5ba3d756 ID |
2816 | xen_ctrl_version=41000 |
2817 | xen=yes | |
2818 | elif | |
2819 | cat > $TMPC <<EOF && | |
da8090cc PD |
2820 | #undef XC_WANT_COMPAT_DEVICEMODEL_API |
2821 | #define __XEN_TOOLS__ | |
2822 | #include <xendevicemodel.h> | |
2823 | int main(void) { | |
2824 | xendevicemodel_handle *xd; | |
2825 | ||
2826 | xd = xendevicemodel_open(0, 0); | |
2827 | xendevicemodel_close(xd); | |
50ced5b3 | 2828 | |
da8090cc PD |
2829 | return 0; |
2830 | } | |
2831 | EOF | |
c1cdd9d5 JG |
2832 | compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" |
2833 | then | |
2834 | xen_stable_libs="-lxendevicemodel $xen_stable_libs" | |
2835 | xen_ctrl_version=40900 | |
2836 | xen=yes | |
2837 | elif | |
2838 | cat > $TMPC <<EOF && | |
b6eb9b45 PS |
2839 | /* |
2840 | * If we have stable libs the we don't want the libxc compat | |
2841 | * layers, regardless of what CFLAGS we may have been given. | |
2842 | * | |
2843 | * Also, check if xengnttab_grant_copy_segment_t is defined and | |
2844 | * grant copy operation is implemented. | |
2845 | */ | |
2846 | #undef XC_WANT_COMPAT_EVTCHN_API | |
2847 | #undef XC_WANT_COMPAT_GNTTAB_API | |
2848 | #undef XC_WANT_COMPAT_MAP_FOREIGN_API | |
2849 | #include <xenctrl.h> | |
2850 | #include <xenstore.h> | |
2851 | #include <xenevtchn.h> | |
2852 | #include <xengnttab.h> | |
2853 | #include <xenforeignmemory.h> | |
2854 | #include <stdint.h> | |
2855 | #include <xen/hvm/hvm_info_table.h> | |
2856 | #if !defined(HVM_MAX_VCPUS) | |
2857 | # error HVM_MAX_VCPUS not defined | |
2858 | #endif | |
2859 | int main(void) { | |
2860 | xc_interface *xc = NULL; | |
2861 | xenforeignmemory_handle *xfmem; | |
2862 | xenevtchn_handle *xe; | |
2863 | xengnttab_handle *xg; | |
b6eb9b45 PS |
2864 | xengnttab_grant_copy_segment_t* seg = NULL; |
2865 | ||
2866 | xs_daemon_open(); | |
2867 | ||
2868 | xc = xc_interface_open(0, 0, 0); | |
2869 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2870 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2871 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2872 | xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); | |
b6eb9b45 PS |
2873 | |
2874 | xfmem = xenforeignmemory_open(0, 0); | |
2875 | xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); | |
2876 | ||
2877 | xe = xenevtchn_open(0, 0); | |
2878 | xenevtchn_fd(xe); | |
2879 | ||
2880 | xg = xengnttab_open(0, 0); | |
2881 | xengnttab_grant_copy(xg, 0, seg); | |
2882 | ||
2883 | return 0; | |
2884 | } | |
2885 | EOF | |
c1cdd9d5 JG |
2886 | compile_prog "" "$xen_libs $xen_stable_libs" |
2887 | then | |
2888 | xen_ctrl_version=40800 | |
2889 | xen=yes | |
2890 | elif | |
2891 | cat > $TMPC <<EOF && | |
5eeb39c2 IC |
2892 | /* |
2893 | * If we have stable libs the we don't want the libxc compat | |
2894 | * layers, regardless of what CFLAGS we may have been given. | |
2895 | */ | |
2896 | #undef XC_WANT_COMPAT_EVTCHN_API | |
2897 | #undef XC_WANT_COMPAT_GNTTAB_API | |
2898 | #undef XC_WANT_COMPAT_MAP_FOREIGN_API | |
2899 | #include <xenctrl.h> | |
2900 | #include <xenstore.h> | |
2901 | #include <xenevtchn.h> | |
2902 | #include <xengnttab.h> | |
2903 | #include <xenforeignmemory.h> | |
2904 | #include <stdint.h> | |
2905 | #include <xen/hvm/hvm_info_table.h> | |
2906 | #if !defined(HVM_MAX_VCPUS) | |
2907 | # error HVM_MAX_VCPUS not defined | |
2908 | #endif | |
2909 | int main(void) { | |
2910 | xc_interface *xc = NULL; | |
2911 | xenforeignmemory_handle *xfmem; | |
2912 | xenevtchn_handle *xe; | |
2913 | xengnttab_handle *xg; | |
5eeb39c2 IC |
2914 | |
2915 | xs_daemon_open(); | |
2916 | ||
2917 | xc = xc_interface_open(0, 0, 0); | |
2918 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2919 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2920 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2921 | xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); | |
5eeb39c2 IC |
2922 | |
2923 | xfmem = xenforeignmemory_open(0, 0); | |
2924 | xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); | |
2925 | ||
2926 | xe = xenevtchn_open(0, 0); | |
2927 | xenevtchn_fd(xe); | |
2928 | ||
2929 | xg = xengnttab_open(0, 0); | |
2930 | xengnttab_map_grant_ref(xg, 0, 0, 0); | |
2931 | ||
2932 | return 0; | |
2933 | } | |
2934 | EOF | |
c1cdd9d5 JG |
2935 | compile_prog "" "$xen_libs $xen_stable_libs" |
2936 | then | |
2937 | xen_ctrl_version=40701 | |
2938 | xen=yes | |
c1cdd9d5 JG |
2939 | |
2940 | # Xen 4.6 | |
2941 | elif | |
2942 | cat > $TMPC <<EOF && | |
cdadde39 | 2943 | #include <xenctrl.h> |
e108a3c1 | 2944 | #include <xenstore.h> |
d5b93ddf AP |
2945 | #include <stdint.h> |
2946 | #include <xen/hvm/hvm_info_table.h> | |
2947 | #if !defined(HVM_MAX_VCPUS) | |
2948 | # error HVM_MAX_VCPUS not defined | |
2949 | #endif | |
d8b441a3 JB |
2950 | int main(void) { |
2951 | xc_interface *xc; | |
2952 | xs_daemon_open(); | |
2953 | xc = xc_interface_open(0, 0, 0); | |
2954 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2955 | xc_gnttab_open(NULL, 0); | |
2956 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2957 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2958 | xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); | |
20a544c7 | 2959 | xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); |
d8b441a3 JB |
2960 | return 0; |
2961 | } | |
2962 | EOF | |
c1cdd9d5 JG |
2963 | compile_prog "" "$xen_libs" |
2964 | then | |
2965 | xen_ctrl_version=40600 | |
2966 | xen=yes | |
2967 | ||
2968 | # Xen 4.5 | |
2969 | elif | |
2970 | cat > $TMPC <<EOF && | |
d8b441a3 JB |
2971 | #include <xenctrl.h> |
2972 | #include <xenstore.h> | |
2973 | #include <stdint.h> | |
2974 | #include <xen/hvm/hvm_info_table.h> | |
2975 | #if !defined(HVM_MAX_VCPUS) | |
2976 | # error HVM_MAX_VCPUS not defined | |
2977 | #endif | |
3996e85c PD |
2978 | int main(void) { |
2979 | xc_interface *xc; | |
2980 | xs_daemon_open(); | |
2981 | xc = xc_interface_open(0, 0, 0); | |
2982 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2983 | xc_gnttab_open(NULL, 0); | |
2984 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2985 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2986 | xc_hvm_create_ioreq_server(xc, 0, 0, NULL); | |
2987 | return 0; | |
2988 | } | |
2989 | EOF | |
c1cdd9d5 JG |
2990 | compile_prog "" "$xen_libs" |
2991 | then | |
2992 | xen_ctrl_version=40500 | |
2993 | xen=yes | |
3996e85c | 2994 | |
c1cdd9d5 JG |
2995 | elif |
2996 | cat > $TMPC <<EOF && | |
3996e85c PD |
2997 | #include <xenctrl.h> |
2998 | #include <xenstore.h> | |
2999 | #include <stdint.h> | |
3000 | #include <xen/hvm/hvm_info_table.h> | |
3001 | #if !defined(HVM_MAX_VCPUS) | |
3002 | # error HVM_MAX_VCPUS not defined | |
3003 | #endif | |
8688e065 SS |
3004 | int main(void) { |
3005 | xc_interface *xc; | |
3006 | xs_daemon_open(); | |
3007 | xc = xc_interface_open(0, 0, 0); | |
3008 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
3009 | xc_gnttab_open(NULL, 0); | |
3010 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
3011 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
3012 | return 0; | |
3013 | } | |
3014 | EOF | |
c1cdd9d5 JG |
3015 | compile_prog "" "$xen_libs" |
3016 | then | |
3017 | xen_ctrl_version=40200 | |
3018 | xen=yes | |
8688e065 | 3019 | |
c1cdd9d5 JG |
3020 | else |
3021 | if test "$xen" = "yes" ; then | |
3022 | feature_not_found "xen (unsupported version)" \ | |
3023 | "Install a supported xen (xen 4.2 or newer)" | |
3024 | fi | |
3025 | xen=no | |
fc321b4b | 3026 | fi |
d5b93ddf | 3027 | |
c1cdd9d5 JG |
3028 | if test "$xen" = yes; then |
3029 | if test $xen_ctrl_version -ge 40701 ; then | |
3030 | libs_softmmu="$xen_stable_libs $libs_softmmu" | |
3031 | fi | |
3032 | libs_softmmu="$xen_libs $libs_softmmu" | |
5eeb39c2 | 3033 | fi |
d5b93ddf | 3034 | fi |
e37630ca AL |
3035 | fi |
3036 | ||
eb6fda0f | 3037 | if test "$xen_pci_passthrough" != "no"; then |
edfb07ed | 3038 | if test "$xen" = "yes" && test "$linux" = "yes"; then |
eb6fda0f AP |
3039 | xen_pci_passthrough=yes |
3040 | else | |
3041 | if test "$xen_pci_passthrough" = "yes"; then | |
76ad07a4 PM |
3042 | error_exit "User requested feature Xen PCI Passthrough" \ |
3043 | " but this feature requires /sys from Linux" | |
eb6fda0f AP |
3044 | fi |
3045 | xen_pci_passthrough=no | |
3046 | fi | |
3047 | fi | |
3048 | ||
d661d9a4 JTV |
3049 | ########################################## |
3050 | # Windows Hypervisor Platform accelerator (WHPX) check | |
3051 | if test "$whpx" != "no" ; then | |
327fccb2 | 3052 | if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then |
d661d9a4 JTV |
3053 | whpx="yes" |
3054 | else | |
3055 | if test "$whpx" = "yes"; then | |
53537bb1 | 3056 | feature_not_found "WinHvPlatform" "WinHvEmulation is not installed" |
d661d9a4 JTV |
3057 | fi |
3058 | whpx="no" | |
3059 | fi | |
3060 | fi | |
3061 | ||
dfffc653 JQ |
3062 | ########################################## |
3063 | # Sparse probe | |
3064 | if test "$sparse" != "no" ; then | |
0dba6195 | 3065 | if has cgcc; then |
dfffc653 JQ |
3066 | sparse=yes |
3067 | else | |
3068 | if test "$sparse" = "yes" ; then | |
21684af0 | 3069 | feature_not_found "sparse" "Install sparse binary" |
dfffc653 JQ |
3070 | fi |
3071 | sparse=no | |
3072 | fi | |
3073 | fi | |
3074 | ||
f676c67e JW |
3075 | ########################################## |
3076 | # X11 probe | |
f676c67e | 3077 | if $pkg_config --exists "x11"; then |
8781595b | 3078 | have_x11=yes |
89138857 SW |
3079 | x11_cflags=$($pkg_config --cflags x11) |
3080 | x11_libs=$($pkg_config --libs x11) | |
f676c67e JW |
3081 | fi |
3082 | ||
a4ccabcf AL |
3083 | ########################################## |
3084 | # GTK probe | |
3085 | ||
3086 | if test "$gtk" != "no"; then | |
89d85cde DB |
3087 | gtkpackage="gtk+-3.0" |
3088 | gtkx11package="gtk+-x11-3.0" | |
7b23d121 | 3089 | gtkversion="3.22.0" |
bbbf9bfb | 3090 | if $pkg_config --exists "$gtkpackage >= $gtkversion"; then |
89138857 SW |
3091 | gtk_cflags=$($pkg_config --cflags $gtkpackage) |
3092 | gtk_libs=$($pkg_config --libs $gtkpackage) | |
3093 | gtk_version=$($pkg_config --modversion $gtkpackage) | |
0a337ed0 | 3094 | if $pkg_config --exists "$gtkx11package >= $gtkversion"; then |
8781595b | 3095 | need_x11=yes |
f676c67e JW |
3096 | gtk_cflags="$gtk_cflags $x11_cflags" |
3097 | gtk_libs="$gtk_libs $x11_libs" | |
0a337ed0 | 3098 | fi |
bbbf9bfb SW |
3099 | gtk="yes" |
3100 | elif test "$gtk" = "yes"; then | |
5fe309ff | 3101 | feature_not_found "gtk" "Install gtk3-devel" |
bbbf9bfb SW |
3102 | else |
3103 | gtk="no" | |
3104 | fi | |
3105 | fi | |
3106 | ||
ddbb0d09 DB |
3107 | |
3108 | ########################################## | |
3109 | # GNUTLS probe | |
3110 | ||
3111 | if test "$gnutls" != "no"; then | |
a73e82ef | 3112 | pass="no" |
a0722409 | 3113 | if $pkg_config --exists "gnutls >= 3.1.18"; then |
89138857 SW |
3114 | gnutls_cflags=$($pkg_config --cflags gnutls) |
3115 | gnutls_libs=$($pkg_config --libs gnutls) | |
a73e82ef RH |
3116 | # Packaging for the static libraries is not always correct. |
3117 | # At least ubuntu 18.04 ships only shared libraries. | |
3118 | write_c_skeleton | |
3119 | if compile_prog "" "$gnutls_libs" ; then | |
243dc2cf | 3120 | LIBS="$gnutls_libs $LIBS" |
a73e82ef RH |
3121 | QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" |
3122 | pass="yes" | |
3123 | fi | |
3124 | fi | |
3125 | if test "$pass" = "no" && test "$gnutls" = "yes"; then | |
a0722409 | 3126 | feature_not_found "gnutls" "Install gnutls devel >= 3.1.18" |
ddbb0d09 | 3127 | else |
a73e82ef | 3128 | gnutls="$pass" |
ddbb0d09 | 3129 | fi |
ddbb0d09 DB |
3130 | fi |
3131 | ||
91bfcdb0 DB |
3132 | |
3133 | # If user didn't give a --disable/enable-gcrypt flag, | |
3134 | # then mark as disabled if user requested nettle | |
a0722409 | 3135 | # explicitly |
91bfcdb0 DB |
3136 | if test -z "$gcrypt" |
3137 | then | |
a0722409 | 3138 | if test "$nettle" = "yes" |
91bfcdb0 DB |
3139 | then |
3140 | gcrypt="no" | |
3141 | fi | |
3142 | fi | |
3143 | ||
3144 | # If user didn't give a --disable/enable-nettle flag, | |
3145 | # then mark as disabled if user requested gcrypt | |
a0722409 | 3146 | # explicitly |
91bfcdb0 DB |
3147 | if test -z "$nettle" |
3148 | then | |
a0722409 | 3149 | if test "$gcrypt" = "yes" |
91bfcdb0 DB |
3150 | then |
3151 | nettle="no" | |
3152 | fi | |
3153 | fi | |
3154 | ||
dea7a64e | 3155 | has_libgcrypt() { |
91bfcdb0 DB |
3156 | if ! has "libgcrypt-config" |
3157 | then | |
3158 | return 1 | |
3159 | fi | |
3160 | ||
3161 | if test -n "$cross_prefix" | |
3162 | then | |
89138857 | 3163 | host=$(libgcrypt-config --host) |
91bfcdb0 DB |
3164 | if test "$host-" != $cross_prefix |
3165 | then | |
3166 | return 1 | |
3167 | fi | |
3168 | fi | |
3169 | ||
dea7a64e DB |
3170 | maj=`libgcrypt-config --version | awk -F . '{print $1}'` |
3171 | min=`libgcrypt-config --version | awk -F . '{print $2}'` | |
3172 | ||
3173 | if test $maj != 1 || test $min -lt 5 | |
3174 | then | |
3175 | return 1 | |
3176 | fi | |
3177 | ||
91bfcdb0 DB |
3178 | return 0 |
3179 | } | |
3180 | ||
a0722409 DB |
3181 | |
3182 | if test "$nettle" != "no"; then | |
a73e82ef | 3183 | pass="no" |
64dd2f3b | 3184 | if $pkg_config --exists "nettle >= 2.7.1"; then |
a0722409 DB |
3185 | nettle_cflags=$($pkg_config --cflags nettle) |
3186 | nettle_libs=$($pkg_config --libs nettle) | |
3187 | nettle_version=$($pkg_config --modversion nettle) | |
a73e82ef RH |
3188 | # Link test to make sure the given libraries work (e.g for static). |
3189 | write_c_skeleton | |
3190 | if compile_prog "" "$nettle_libs" ; then | |
243dc2cf | 3191 | LIBS="$nettle_libs $LIBS" |
a73e82ef RH |
3192 | QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" |
3193 | if test -z "$gcrypt"; then | |
3194 | gcrypt="no" | |
3195 | fi | |
3196 | pass="yes" | |
a0722409 | 3197 | fi |
a73e82ef | 3198 | fi |
dc2207af DB |
3199 | if test "$pass" = "yes" |
3200 | then | |
3201 | cat > $TMPC << EOF | |
3202 | #include <nettle/xts.h> | |
3203 | int main(void) { | |
3204 | return 0; | |
3205 | } | |
3206 | EOF | |
3207 | if compile_prog "$nettle_cflags" "$nettle_libs" ; then | |
3208 | nettle_xts=yes | |
3209 | qemu_private_xts=no | |
3210 | fi | |
3211 | fi | |
a73e82ef RH |
3212 | if test "$pass" = "no" && test "$nettle" = "yes"; then |
3213 | feature_not_found "nettle" "Install nettle devel >= 2.7.1" | |
a0722409 | 3214 | else |
a73e82ef | 3215 | nettle="$pass" |
a0722409 DB |
3216 | fi |
3217 | fi | |
3218 | ||
91bfcdb0 | 3219 | if test "$gcrypt" != "no"; then |
a73e82ef | 3220 | pass="no" |
dea7a64e | 3221 | if has_libgcrypt; then |
89138857 SW |
3222 | gcrypt_cflags=$(libgcrypt-config --cflags) |
3223 | gcrypt_libs=$(libgcrypt-config --libs) | |
a73e82ef | 3224 | # Debian has removed -lgpg-error from libgcrypt-config |
91bfcdb0 DB |
3225 | # as it "spreads unnecessary dependencies" which in |
3226 | # turn breaks static builds... | |
3227 | if test "$static" = "yes" | |
3228 | then | |
3229 | gcrypt_libs="$gcrypt_libs -lgpg-error" | |
3230 | fi | |
1f923c70 | 3231 | |
a73e82ef RH |
3232 | # Link test to make sure the given libraries work (e.g for static). |
3233 | write_c_skeleton | |
3234 | if compile_prog "" "$gcrypt_libs" ; then | |
243dc2cf | 3235 | LIBS="$gcrypt_libs $LIBS" |
a73e82ef RH |
3236 | QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" |
3237 | pass="yes" | |
3238 | fi | |
3239 | fi | |
3240 | if test "$pass" = "yes"; then | |
3241 | gcrypt="yes" | |
1f923c70 LM |
3242 | cat > $TMPC << EOF |
3243 | #include <gcrypt.h> | |
3244 | int main(void) { | |
3245 | gcry_mac_hd_t handle; | |
3246 | gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5, | |
3247 | GCRY_MAC_FLAG_SECURE, NULL); | |
3248 | return 0; | |
3249 | } | |
3250 | EOF | |
3251 | if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then | |
3252 | gcrypt_hmac=yes | |
3253 | fi | |
e0576942 DB |
3254 | cat > $TMPC << EOF |
3255 | #include <gcrypt.h> | |
3256 | int main(void) { | |
3257 | gcry_cipher_hd_t handle; | |
3258 | gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0); | |
3259 | return 0; | |
3260 | } | |
3261 | EOF | |
3262 | if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then | |
3263 | gcrypt_xts=yes | |
3264 | qemu_private_xts=no | |
3265 | fi | |
a73e82ef RH |
3266 | elif test "$gcrypt" = "yes"; then |
3267 | feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0" | |
62893b67 | 3268 | else |
a73e82ef | 3269 | gcrypt="no" |
62893b67 DB |
3270 | fi |
3271 | fi | |
3272 | ||
ddbb0d09 | 3273 | |
91bfcdb0 DB |
3274 | if test "$gcrypt" = "yes" && test "$nettle" = "yes" |
3275 | then | |
3276 | error_exit "Only one of gcrypt & nettle can be enabled" | |
3277 | fi | |
3278 | ||
9a2fd434 DB |
3279 | ########################################## |
3280 | # libtasn1 - only for the TLS creds/session test suite | |
3281 | ||
3282 | tasn1=yes | |
90246037 DB |
3283 | tasn1_cflags="" |
3284 | tasn1_libs="" | |
9a2fd434 | 3285 | if $pkg_config --exists "libtasn1"; then |
89138857 SW |
3286 | tasn1_cflags=$($pkg_config --cflags libtasn1) |
3287 | tasn1_libs=$($pkg_config --libs libtasn1) | |
9a2fd434 DB |
3288 | else |
3289 | tasn1=no | |
3290 | fi | |
3291 | ||
ed754746 | 3292 | |
8953caf3 DB |
3293 | ########################################## |
3294 | # PAM probe | |
3295 | ||
3296 | if test "$auth_pam" != "no"; then | |
3297 | cat > $TMPC <<EOF | |
3298 | #include <security/pam_appl.h> | |
3299 | #include <stdio.h> | |
3300 | int main(void) { | |
3301 | const char *service_name = "qemu"; | |
3302 | const char *user = "frank"; | |
9c9642d0 | 3303 | const struct pam_conv pam_conv = { 0 }; |
8953caf3 | 3304 | pam_handle_t *pamh = NULL; |
9c9642d0 | 3305 | pam_start(service_name, user, &pam_conv, &pamh); |
8953caf3 DB |
3306 | return 0; |
3307 | } | |
3308 | EOF | |
3309 | if compile_prog "" "-lpam" ; then | |
3310 | auth_pam=yes | |
3311 | else | |
3312 | if test "$auth_pam" = "yes"; then | |
3313 | feature_not_found "PAM" "Install PAM development package" | |
3314 | else | |
3315 | auth_pam=no | |
3316 | fi | |
3317 | fi | |
3318 | fi | |
3319 | ||
559607ea DB |
3320 | ########################################## |
3321 | # getifaddrs (for tests/test-io-channel-socket ) | |
3322 | ||
3323 | have_ifaddrs_h=yes | |
3324 | if ! check_include "ifaddrs.h" ; then | |
3325 | have_ifaddrs_h=no | |
3326 | fi | |
3327 | ||
e865b97f CG |
3328 | ######################################### |
3329 | # libdrm check | |
3330 | have_drm_h=no | |
3331 | if check_include "libdrm/drm.h" ; then | |
3332 | have_drm_h=yes | |
3333 | fi | |
3334 | ||
2a4b472c DC |
3335 | ######################################### |
3336 | # sys/signal.h check | |
3337 | have_sys_signal_h=no | |
3338 | if check_include "sys/signal.h" ; then | |
3339 | have_sys_signal_h=yes | |
3340 | fi | |
3341 | ||
bbbf9bfb SW |
3342 | ########################################## |
3343 | # VTE probe | |
3344 | ||
3345 | if test "$vte" != "no"; then | |
89d85cde DB |
3346 | vteminversion="0.32.0" |
3347 | if $pkg_config --exists "vte-2.91"; then | |
3348 | vtepackage="vte-2.91" | |
528de90a | 3349 | else |
89d85cde | 3350 | vtepackage="vte-2.90" |
528de90a | 3351 | fi |
c6feff9e | 3352 | if $pkg_config --exists "$vtepackage >= $vteminversion"; then |
89138857 SW |
3353 | vte_cflags=$($pkg_config --cflags $vtepackage) |
3354 | vte_libs=$($pkg_config --libs $vtepackage) | |
3355 | vteversion=$($pkg_config --modversion $vtepackage) | |
bbbf9bfb SW |
3356 | vte="yes" |
3357 | elif test "$vte" = "yes"; then | |
89d85cde | 3358 | feature_not_found "vte" "Install libvte-2.90/2.91 devel" |
0d185e63 | 3359 | else |
bbbf9bfb | 3360 | vte="no" |
a4ccabcf AL |
3361 | fi |
3362 | fi | |
3363 | ||
11d9f695 FB |
3364 | ########################################## |
3365 | # SDL probe | |
3366 | ||
aee8a619 CMAB |
3367 | # Look for sdl configuration program (pkg-config or sdl2-config). Try |
3368 | # sdl2-config even without cross prefix, and favour pkg-config over sdl2-config. | |
47c03744 | 3369 | |
c6093a05 PX |
3370 | sdl_probe () |
3371 | { | |
0015ca5c DB |
3372 | if $pkg_config sdl2 --exists; then |
3373 | sdlconfig="$pkg_config sdl2" | |
c6093a05 | 3374 | sdlversion=$($sdlconfig --modversion 2>/dev/null) |
aee8a619 | 3375 | elif has "$sdl2_config"; then |
0015ca5c | 3376 | sdlconfig="$sdl2_config" |
c6093a05 PX |
3377 | sdlversion=$($sdlconfig --version) |
3378 | else | |
3379 | if test "$sdl" = "yes" ; then | |
3380 | feature_not_found "sdl" "Install SDL2-devel" | |
3381 | fi | |
3382 | sdl=no | |
3383 | # no need to do the rest | |
3384 | return | |
3385 | fi | |
aee8a619 | 3386 | if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl2-config; then |
c6093a05 | 3387 | echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 |
a0dfd8a4 | 3388 | fi |
11d9f695 | 3389 | |
ac119f9d | 3390 | cat > $TMPC << EOF |
11d9f695 FB |
3391 | #include <SDL.h> |
3392 | #undef main /* We don't want SDL to override our main() */ | |
3393 | int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } | |
3394 | EOF | |
89138857 | 3395 | sdl_cflags=$($sdlconfig --cflags 2>/dev/null) |
2ca5c430 | 3396 | sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug |
74f42e18 | 3397 | if test "$static" = "yes" ; then |
0015ca5c DB |
3398 | if $pkg_config sdl2 --exists; then |
3399 | sdl_libs=$($pkg_config sdl2 --static --libs 2>/dev/null) | |
5f37e6d4 TH |
3400 | else |
3401 | sdl_libs=$($sdlconfig --static-libs 2>/dev/null) | |
3402 | fi | |
74f42e18 | 3403 | else |
89138857 | 3404 | sdl_libs=$($sdlconfig --libs 2>/dev/null) |
74f42e18 | 3405 | fi |
52166aa0 | 3406 | if compile_prog "$sdl_cflags" "$sdl_libs" ; then |
0015ca5c | 3407 | sdl=yes |
cd01b4a3 | 3408 | |
67c274d3 | 3409 | # static link with sdl ? (note: sdl.pc's --static --libs is broken) |
e633a5c6 | 3410 | if test "$sdl" = "yes" && test "$static" = "yes" ; then |
67c274d3 | 3411 | if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then |
89138857 SW |
3412 | sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)" |
3413 | sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)" | |
ac119f9d | 3414 | fi |
52166aa0 | 3415 | if compile_prog "$sdl_cflags" "$sdl_libs" ; then |
ac119f9d JQ |
3416 | : |
3417 | else | |
3418 | sdl=no | |
3419 | fi | |
3420 | fi # static link | |
c4198157 JQ |
3421 | else # sdl not found |
3422 | if test "$sdl" = "yes" ; then | |
0015ca5c | 3423 | feature_not_found "sdl" "Install SDL2 devel" |
c4198157 JQ |
3424 | fi |
3425 | sdl=no | |
ac119f9d | 3426 | fi # sdl compile test |
c6093a05 PX |
3427 | } |
3428 | ||
a442fe2f DB |
3429 | sdl_image_probe () |
3430 | { | |
3431 | if test "$sdl_image" != "no" ; then | |
3432 | if $pkg_config SDL2_image --exists; then | |
3433 | if test "$static" = "yes"; then | |
3434 | sdl_image_libs=$($pkg_config SDL2_image --libs --static 2>/dev/null) | |
3435 | else | |
3436 | sdl_image_libs=$($pkg_config SDL2_image --libs 2>/dev/null) | |
3437 | fi | |
3438 | sdl_image_cflags=$($pkg_config SDL2_image --cflags 2>/dev/null) | |
3439 | sdl_image=yes | |
3440 | ||
3441 | sdl_cflags="$sdl_cflags $sdl_image_cflags" | |
3442 | sdl_libs="$sdl_libs $sdl_image_libs" | |
3443 | else | |
3444 | if test "$sdl_image" = "yes" ; then | |
3445 | feature_not_found "sdl_image" "Install SDL Image devel" | |
3446 | else | |
3447 | sdl_image=no | |
3448 | fi | |
3449 | fi | |
3450 | fi | |
3451 | } | |
3452 | ||
c6093a05 PX |
3453 | if test "$sdl" != "no" ; then |
3454 | sdl_probe | |
a68551bc | 3455 | fi |
11d9f695 | 3456 | |
a442fe2f DB |
3457 | if test "$sdl" = "yes" ; then |
3458 | sdl_image_probe | |
3459 | else | |
3460 | if test "$sdl_image" = "yes"; then | |
3461 | echo "warning: SDL Image requested, but SDL is not available, disabling" | |
3462 | fi | |
3463 | sdl_image=no | |
3464 | fi | |
3465 | ||
5368a422 | 3466 | if test "$sdl" = "yes" ; then |
ac119f9d | 3467 | cat > $TMPC <<EOF |
5368a422 AL |
3468 | #include <SDL.h> |
3469 | #if defined(SDL_VIDEO_DRIVER_X11) | |
3470 | #include <X11/XKBlib.h> | |
3471 | #else | |
3472 | #error No x11 support | |
3473 | #endif | |
3474 | int main(void) { return 0; } | |
3475 | EOF | |
f676c67e | 3476 | if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then |
8781595b | 3477 | need_x11=yes |
f676c67e JW |
3478 | sdl_cflags="$sdl_cflags $x11_cflags" |
3479 | sdl_libs="$sdl_libs $x11_libs" | |
ac119f9d | 3480 | fi |
5368a422 AL |
3481 | fi |
3482 | ||
2da776db MH |
3483 | ########################################## |
3484 | # RDMA needs OpenFabrics libraries | |
3485 | if test "$rdma" != "no" ; then | |
3486 | cat > $TMPC <<EOF | |
3487 | #include <rdma/rdma_cma.h> | |
3488 | int main(void) { return 0; } | |
3489 | EOF | |
ef6d4ccd | 3490 | rdma_libs="-lrdmacm -libverbs -libumad" |
2da776db MH |
3491 | if compile_prog "" "$rdma_libs" ; then |
3492 | rdma="yes" | |
ef6d4ccd | 3493 | libs_softmmu="$libs_softmmu $rdma_libs" |
2da776db MH |
3494 | else |
3495 | if test "$rdma" = "yes" ; then | |
3496 | error_exit \ | |
ef6d4ccd | 3497 | " OpenFabrics librdmacm/libibverbs/libibumad not present." \ |
2da776db | 3498 | " Your options:" \ |
ef6d4ccd | 3499 | " (1) Fast: Install infiniband packages (devel) from your distro." \ |
2da776db MH |
3500 | " (2) Cleanest: Install libraries from www.openfabrics.org" \ |
3501 | " (3) Also: Install softiwarp if you don't have RDMA hardware" | |
3502 | fi | |
3503 | rdma="no" | |
3504 | fi | |
3505 | fi | |
3506 | ||
21ab34c9 MA |
3507 | ########################################## |
3508 | # PVRDMA detection | |
3509 | ||
3510 | cat > $TMPC <<EOF && | |
3511 | #include <sys/mman.h> | |
3512 | ||
3513 | int | |
3514 | main(void) | |
3515 | { | |
3516 | char buf = 0; | |
3517 | void *addr = &buf; | |
3518 | addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); | |
3519 | ||
3520 | return 0; | |
3521 | } | |
3522 | EOF | |
3523 | ||
3524 | if test "$rdma" = "yes" ; then | |
3525 | case "$pvrdma" in | |
3526 | "") | |
3527 | if compile_prog "" ""; then | |
3528 | pvrdma="yes" | |
3529 | else | |
3530 | pvrdma="no" | |
3531 | fi | |
3532 | ;; | |
3533 | "yes") | |
3534 | if ! compile_prog "" ""; then | |
3535 | error_exit "PVRDMA is not supported since mremap is not implemented" | |
3536 | fi | |
3537 | pvrdma="yes" | |
3538 | ;; | |
3539 | "no") | |
3540 | pvrdma="no" | |
3541 | ;; | |
3542 | esac | |
3543 | else | |
3544 | if test "$pvrdma" = "yes" ; then | |
3545 | error_exit "PVRDMA requires rdma suppport" | |
3546 | fi | |
3547 | pvrdma="no" | |
3548 | fi | |
95c6bff3 | 3549 | |
ee108585 YS |
3550 | # Let's see if enhanced reg_mr is supported |
3551 | if test "$pvrdma" = "yes" ; then | |
3552 | ||
3553 | cat > $TMPC <<EOF && | |
3554 | #include <infiniband/verbs.h> | |
3555 | ||
3556 | int | |
3557 | main(void) | |
3558 | { | |
3559 | struct ibv_mr *mr; | |
3560 | struct ibv_pd *pd = NULL; | |
3561 | size_t length = 10; | |
3562 | uint64_t iova = 0; | |
3563 | int access = 0; | |
3564 | void *addr = NULL; | |
3565 | ||
3566 | mr = ibv_reg_mr_iova(pd, addr, length, iova, access); | |
3567 | ||
3568 | ibv_dereg_mr(mr); | |
3569 | ||
3570 | return 0; | |
3571 | } | |
3572 | EOF | |
3573 | if ! compile_prog "" "-libverbs"; then | |
3574 | QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR" | |
3575 | fi | |
3576 | fi | |
3577 | ||
2f9606b3 AL |
3578 | ########################################## |
3579 | # VNC SASL detection | |
e633a5c6 | 3580 | if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then |
ea784e3b | 3581 | cat > $TMPC <<EOF |
2f9606b3 AL |
3582 | #include <sasl/sasl.h> |
3583 | #include <stdio.h> | |
3584 | int main(void) { sasl_server_init(NULL, "qemu"); return 0; } | |
3585 | EOF | |
ea784e3b | 3586 | # Assuming Cyrus-SASL installed in /usr prefix |
bd702ffc PMD |
3587 | # QEMU defines struct iovec in "qemu/osdep.h", |
3588 | # we don't want libsasl to redefine it in <sasl/sasl.h>. | |
3589 | vnc_sasl_cflags="-DSTRUCT_IOVEC_DEFINED" | |
ea784e3b JQ |
3590 | vnc_sasl_libs="-lsasl2" |
3591 | if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then | |
3592 | vnc_sasl=yes | |
3593 | libs_softmmu="$vnc_sasl_libs $libs_softmmu" | |
ca273d58 | 3594 | QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags" |
ea784e3b JQ |
3595 | else |
3596 | if test "$vnc_sasl" = "yes" ; then | |
21684af0 | 3597 | feature_not_found "vnc-sasl" "Install Cyrus SASL devel" |
2f9606b3 | 3598 | fi |
ea784e3b JQ |
3599 | vnc_sasl=no |
3600 | fi | |
2f9606b3 AL |
3601 | fi |
3602 | ||
2f6f5c7a CC |
3603 | ########################################## |
3604 | # VNC JPEG detection | |
e633a5c6 | 3605 | if test "$vnc" = "yes" && test "$vnc_jpeg" != "no" ; then |
2f6f5c7a CC |
3606 | cat > $TMPC <<EOF |
3607 | #include <stdio.h> | |
3608 | #include <jpeglib.h> | |
3609 | int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } | |
3610 | EOF | |
3611 | vnc_jpeg_cflags="" | |
3612 | vnc_jpeg_libs="-ljpeg" | |
3613 | if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then | |
3614 | vnc_jpeg=yes | |
3615 | libs_softmmu="$vnc_jpeg_libs $libs_softmmu" | |
ca273d58 | 3616 | QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags" |
2f6f5c7a CC |
3617 | else |
3618 | if test "$vnc_jpeg" = "yes" ; then | |
21684af0 | 3619 | feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel" |
2f6f5c7a CC |
3620 | fi |
3621 | vnc_jpeg=no | |
3622 | fi | |
3623 | fi | |
3624 | ||
efe556ad CC |
3625 | ########################################## |
3626 | # VNC PNG detection | |
e633a5c6 | 3627 | if test "$vnc" = "yes" && test "$vnc_png" != "no" ; then |
efe556ad CC |
3628 | cat > $TMPC <<EOF |
3629 | //#include <stdio.h> | |
3630 | #include <png.h> | |
832ce9c2 | 3631 | #include <stddef.h> |
efe556ad CC |
3632 | int main(void) { |
3633 | png_structp png_ptr; | |
3634 | png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); | |
7edc3fed | 3635 | return png_ptr != 0; |
efe556ad CC |
3636 | } |
3637 | EOF | |
65d5d3f9 | 3638 | if $pkg_config libpng --exists; then |
89138857 SW |
3639 | vnc_png_cflags=$($pkg_config libpng --cflags) |
3640 | vnc_png_libs=$($pkg_config libpng --libs) | |
9af8025e | 3641 | else |
efe556ad CC |
3642 | vnc_png_cflags="" |
3643 | vnc_png_libs="-lpng" | |
9af8025e | 3644 | fi |
efe556ad CC |
3645 | if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then |
3646 | vnc_png=yes | |
3647 | libs_softmmu="$vnc_png_libs $libs_softmmu" | |
9af8025e | 3648 | QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" |
efe556ad CC |
3649 | else |
3650 | if test "$vnc_png" = "yes" ; then | |
21684af0 | 3651 | feature_not_found "vnc-png" "Install libpng devel" |
efe556ad CC |
3652 | fi |
3653 | vnc_png=no | |
3654 | fi | |
3655 | fi | |
3656 | ||
6a021536 GH |
3657 | ########################################## |
3658 | # xkbcommon probe | |
3659 | if test "$xkbcommon" != "no" ; then | |
3660 | if $pkg_config xkbcommon --exists; then | |
3661 | xkbcommon_cflags=$($pkg_config xkbcommon --cflags) | |
3662 | xkbcommon_libs=$($pkg_config xkbcommon --libs) | |
3663 | xkbcommon=yes | |
3664 | else | |
3665 | if test "$xkbcommon" = "yes" ; then | |
3666 | feature_not_found "xkbcommon" "Install libxkbcommon-devel" | |
3667 | fi | |
3668 | xkbcommon=no | |
3669 | fi | |
3670 | fi | |
3671 | ||
76655d6d | 3672 | |
ee682d27 | 3673 | ########################################## |
c1bb86cd | 3674 | # xfsctl() probe, used for file-posix.c |
dce512de CH |
3675 | if test "$xfs" != "no" ; then |
3676 | cat > $TMPC << EOF | |
ffc41d10 | 3677 | #include <stddef.h> /* NULL */ |
dce512de CH |
3678 | #include <xfs/xfs.h> |
3679 | int main(void) | |
3680 | { | |
3681 | xfsctl(NULL, 0, 0, NULL); | |
3682 | return 0; | |
3683 | } | |
3684 | EOF | |
3685 | if compile_prog "" "" ; then | |
3686 | xfs="yes" | |
3687 | else | |
3688 | if test "$xfs" = "yes" ; then | |
21684af0 | 3689 | feature_not_found "xfs" "Instal xfsprogs/xfslibs devel" |
dce512de CH |
3690 | fi |
3691 | xfs=no | |
3692 | fi | |
3693 | fi | |
3694 | ||
8a16d273 TS |
3695 | ########################################## |
3696 | # vde libraries probe | |
dfb278bd | 3697 | if test "$vde" != "no" ; then |
4baae0ac | 3698 | vde_libs="-lvdeplug" |
8a16d273 TS |
3699 | cat > $TMPC << EOF |
3700 | #include <libvdeplug.h> | |
4a7f0e06 PB |
3701 | int main(void) |
3702 | { | |
3703 | struct vde_open_args a = {0, 0, 0}; | |
fea08e08 PM |
3704 | char s[] = ""; |
3705 | vde_open(s, s, &a); | |
4a7f0e06 PB |
3706 | return 0; |
3707 | } | |
8a16d273 | 3708 | EOF |
52166aa0 | 3709 | if compile_prog "" "$vde_libs" ; then |
4baae0ac | 3710 | vde=yes |
dfb278bd JQ |
3711 | else |
3712 | if test "$vde" = "yes" ; then | |
21684af0 | 3713 | feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" |
dfb278bd JQ |
3714 | fi |
3715 | vde=no | |
4baae0ac | 3716 | fi |
8a16d273 TS |
3717 | fi |
3718 | ||
58952137 | 3719 | ########################################## |
0a985b37 VM |
3720 | # netmap support probe |
3721 | # Apart from looking for netmap headers, we make sure that the host API version | |
3722 | # supports the netmap backend (>=11). The upper bound (15) is meant to simulate | |
3723 | # a minor/major version number. Minor new features will be marked with values up | |
3724 | # to 15, and if something happens that requires a change to the backend we will | |
3725 | # move above 15, submit the backend fixes and modify this two bounds. | |
58952137 VM |
3726 | if test "$netmap" != "no" ; then |
3727 | cat > $TMPC << EOF | |
3728 | #include <inttypes.h> | |
3729 | #include <net/if.h> | |
3730 | #include <net/netmap.h> | |
3731 | #include <net/netmap_user.h> | |
0a985b37 VM |
3732 | #if (NETMAP_API < 11) || (NETMAP_API > 15) |
3733 | #error | |
3734 | #endif | |
58952137 VM |
3735 | int main(void) { return 0; } |
3736 | EOF | |
3737 | if compile_prog "" "" ; then | |
3738 | netmap=yes | |
3739 | else | |
3740 | if test "$netmap" = "yes" ; then | |
3741 | feature_not_found "netmap" | |
3742 | fi | |
3743 | netmap=no | |
3744 | fi | |
3745 | fi | |
3746 | ||
47e98658 CB |
3747 | ########################################## |
3748 | # libcap-ng library probe | |
3749 | if test "$cap_ng" != "no" ; then | |
3750 | cap_libs="-lcap-ng" | |
3751 | cat > $TMPC << EOF | |
3752 | #include <cap-ng.h> | |
3753 | int main(void) | |
3754 | { | |
3755 | capng_capability_to_name(CAPNG_EFFECTIVE); | |
3756 | return 0; | |
3757 | } | |
3758 | EOF | |
3759 | if compile_prog "" "$cap_libs" ; then | |
3760 | cap_ng=yes | |
3761 | libs_tools="$cap_libs $libs_tools" | |
3762 | else | |
3763 | if test "$cap_ng" = "yes" ; then | |
21684af0 | 3764 | feature_not_found "cap_ng" "Install libcap-ng devel" |
47e98658 CB |
3765 | fi |
3766 | cap_ng=no | |
3767 | fi | |
3768 | fi | |
3769 | ||
8f28f3fb | 3770 | ########################################## |
c2de5c91 | 3771 | # Sound support libraries probe |
8f28f3fb | 3772 | |
89138857 | 3773 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g') |
c2de5c91 | 3774 | for drv in $audio_drv_list; do |
3775 | case $drv in | |
e42975a1 | 3776 | alsa | try-alsa) |
c80a867f GH |
3777 | if $pkg_config alsa --exists; then |
3778 | alsa_libs=$($pkg_config alsa --libs) | |
e42975a1 GH |
3779 | if test "$drv" = "try-alsa"; then |
3780 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/') | |
3781 | fi | |
c80a867f | 3782 | else |
e42975a1 GH |
3783 | if test "$drv" = "try-alsa"; then |
3784 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa//') | |
3785 | else | |
3786 | error_exit "$drv check failed" \ | |
3787 | "Make sure to have the $drv libs and headers installed." | |
3788 | fi | |
c80a867f | 3789 | fi |
c2de5c91 | 3790 | ;; |
3791 | ||
e42975a1 | 3792 | pa | try-pa) |
c80a867f GH |
3793 | if $pkg_config libpulse --exists; then |
3794 | pulse_libs=$($pkg_config libpulse --libs) | |
e42975a1 GH |
3795 | if test "$drv" = "try-pa"; then |
3796 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/') | |
3797 | fi | |
c80a867f | 3798 | else |
e42975a1 GH |
3799 | if test "$drv" = "try-pa"; then |
3800 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa//') | |
3801 | else | |
3802 | error_exit "$drv check failed" \ | |
3803 | "Make sure to have the $drv libs and headers installed." | |
3804 | fi | |
c80a867f | 3805 | fi |
b8e59f18 | 3806 | ;; |
3807 | ||
373967b2 GH |
3808 | sdl) |
3809 | if test "$sdl" = "no"; then | |
3810 | error_exit "sdl not found or disabled, can not use sdl audio driver" | |
3811 | fi | |
3812 | ;; | |
3813 | ||
e42975a1 GH |
3814 | try-sdl) |
3815 | if test "$sdl" = "no"; then | |
3816 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl//') | |
3817 | else | |
3818 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl/sdl/') | |
3819 | fi | |
3820 | ;; | |
3821 | ||
997e690a | 3822 | coreaudio) |
b1149911 | 3823 | coreaudio_libs="-framework CoreAudio" |
997e690a JQ |
3824 | ;; |
3825 | ||
a4bf6780 | 3826 | dsound) |
b1149911 | 3827 | dsound_libs="-lole32 -ldxguid" |
d5631638 | 3828 | audio_win_int="yes" |
a4bf6780 JQ |
3829 | ;; |
3830 | ||
3831 | oss) | |
b1149911 | 3832 | oss_libs="$oss_lib" |
a4bf6780 JQ |
3833 | ;; |
3834 | ||
2e445703 GM |
3835 | jack | try-jack) |
3836 | if $pkg_config jack --exists; then | |
3837 | jack_libs=$($pkg_config jack --libs) | |
3838 | if test "$drv" = "try-jack"; then | |
3839 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack/jack/') | |
3840 | fi | |
3841 | else | |
3842 | if test "$drv" = "try-jack"; then | |
3843 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack//') | |
3844 | else | |
3845 | error_exit "$drv check failed" \ | |
3846 | "Make sure to have the $drv libs and headers installed." | |
3847 | fi | |
3848 | fi | |
3849 | ;; | |
3850 | ||
e4c63a6a | 3851 | *) |
1c9b2a52 | 3852 | echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { |
76ad07a4 PM |
3853 | error_exit "Unknown driver '$drv' selected" \ |
3854 | "Possible drivers are: $audio_possible_drivers" | |
e4c63a6a | 3855 | } |
3856 | ;; | |
c2de5c91 | 3857 | esac |
3858 | done | |
8f28f3fb | 3859 | |
2e4d9fb1 AJ |
3860 | ########################################## |
3861 | # BrlAPI probe | |
3862 | ||
4ffcedb6 | 3863 | if test "$brlapi" != "no" ; then |
eb82284f JQ |
3864 | brlapi_libs="-lbrlapi" |
3865 | cat > $TMPC << EOF | |
2e4d9fb1 | 3866 | #include <brlapi.h> |
832ce9c2 | 3867 | #include <stddef.h> |
2e4d9fb1 AJ |
3868 | int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } |
3869 | EOF | |
52166aa0 | 3870 | if compile_prog "" "$brlapi_libs" ; then |
eb82284f | 3871 | brlapi=yes |
4ffcedb6 JQ |
3872 | else |
3873 | if test "$brlapi" = "yes" ; then | |
21684af0 | 3874 | feature_not_found "brlapi" "Install brlapi devel" |
4ffcedb6 JQ |
3875 | fi |
3876 | brlapi=no | |
eb82284f JQ |
3877 | fi |
3878 | fi | |
2e4d9fb1 | 3879 | |
e08bb301 ST |
3880 | ########################################## |
3881 | # iconv probe | |
3882 | if test "$iconv" != "no" ; then | |
3883 | cat > $TMPC << EOF | |
3884 | #include <iconv.h> | |
3885 | int main(void) { | |
3886 | iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); | |
3887 | return conv != (iconv_t) -1; | |
3888 | } | |
3889 | EOF | |
3890 | iconv_prefix_list="/usr/local:/usr" | |
3891 | iconv_lib_list=":-liconv" | |
3892 | IFS=: | |
3893 | for iconv_prefix in $iconv_prefix_list; do | |
3894 | IFS=: | |
3895 | iconv_cflags="-I$iconv_prefix/include" | |
3896 | iconv_ldflags="-L$iconv_prefix/lib" | |
3897 | for iconv_link in $iconv_lib_list; do | |
3898 | unset IFS | |
3899 | iconv_lib="$iconv_ldflags $iconv_link" | |
3900 | echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log | |
3901 | if compile_prog "$iconv_cflags" "$iconv_lib" ; then | |
3902 | iconv_found=yes | |
3903 | break | |
3904 | fi | |
3905 | done | |
3906 | if test "$iconv_found" = yes ; then | |
3907 | break | |
3908 | fi | |
3909 | done | |
3910 | if test "$iconv_found" = "yes" ; then | |
3911 | iconv=yes | |
3912 | else | |
3913 | if test "$iconv" = "yes" ; then | |
3914 | feature_not_found "iconv" "Install iconv devel" | |
3915 | fi | |
3916 | iconv=no | |
3917 | fi | |
3918 | fi | |
3919 | ||
4d3b6f6e AZ |
3920 | ########################################## |
3921 | # curses probe | |
e08bb301 ST |
3922 | if test "$iconv" = "no" ; then |
3923 | # curses will need iconv | |
3924 | curses=no | |
3925 | fi | |
a3605bf6 MT |
3926 | if test "$curses" != "no" ; then |
3927 | if test "$mingw32" = "yes" ; then | |
8ddc5bf9 ST |
3928 | curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" |
3929 | curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses" | |
a3605bf6 | 3930 | else |
7c703002 | 3931 | curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" |
8ddc5bf9 | 3932 | curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw" |
a3605bf6 | 3933 | fi |
c584a6d0 | 3934 | curses_found=no |
4d3b6f6e | 3935 | cat > $TMPC << EOF |
8ddc5bf9 | 3936 | #include <locale.h> |
4d3b6f6e | 3937 | #include <curses.h> |
8ddc5bf9 | 3938 | #include <wchar.h> |
2f8b7cd5 | 3939 | #include <langinfo.h> |
ef9a2524 | 3940 | int main(void) { |
2f8b7cd5 | 3941 | const char *codeset; |
8ddc5bf9 ST |
3942 | wchar_t wch = L'w'; |
3943 | setlocale(LC_ALL, ""); | |
ef9a2524 | 3944 | resize_term(0, 0); |
8ddc5bf9 ST |
3945 | addwstr(L"wide chars\n"); |
3946 | addnwstr(&wch, 1); | |
7c703002 | 3947 | add_wch(WACS_DEGREE); |
2f8b7cd5 ST |
3948 | codeset = nl_langinfo(CODESET); |
3949 | return codeset != 0; | |
ef9a2524 | 3950 | } |
4d3b6f6e | 3951 | EOF |
ecbe251f | 3952 | IFS=: |
8ddc5bf9 | 3953 | for curses_inc in $curses_inc_list; do |
b01a4fd3 PM |
3954 | # Make sure we get the wide character prototypes |
3955 | curses_inc="-DNCURSES_WIDECHAR $curses_inc" | |
7c703002 | 3956 | IFS=: |
8ddc5bf9 ST |
3957 | for curses_lib in $curses_lib_list; do |
3958 | unset IFS | |
3959 | if compile_prog "$curses_inc" "$curses_lib" ; then | |
3960 | curses_found=yes | |
8ddc5bf9 ST |
3961 | break |
3962 | fi | |
3963 | done | |
7c703002 ST |
3964 | if test "$curses_found" = yes ; then |
3965 | break | |
3966 | fi | |
4f78ef9a | 3967 | done |
ecbe251f | 3968 | unset IFS |
c584a6d0 JQ |
3969 | if test "$curses_found" = "yes" ; then |
3970 | curses=yes | |
3971 | else | |
3972 | if test "$curses" = "yes" ; then | |
21684af0 | 3973 | feature_not_found "curses" "Install ncurses devel" |
c584a6d0 JQ |
3974 | fi |
3975 | curses=no | |
3976 | fi | |
4f78ef9a | 3977 | fi |
4d3b6f6e | 3978 | |
769ce76d AG |
3979 | ########################################## |
3980 | # curl probe | |
788c8196 | 3981 | if test "$curl" != "no" ; then |
65d5d3f9 | 3982 | if $pkg_config libcurl --exists; then |
a3605bf6 MT |
3983 | curlconfig="$pkg_config libcurl" |
3984 | else | |
3985 | curlconfig=curl-config | |
3986 | fi | |
769ce76d AG |
3987 | cat > $TMPC << EOF |
3988 | #include <curl/curl.h> | |
0b862ced | 3989 | int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } |
769ce76d | 3990 | EOF |
89138857 SW |
3991 | curl_cflags=$($curlconfig --cflags 2>/dev/null) |
3992 | curl_libs=$($curlconfig --libs 2>/dev/null) | |
b1d5a277 | 3993 | if compile_prog "$curl_cflags" "$curl_libs" ; then |
769ce76d | 3994 | curl=yes |
788c8196 JQ |
3995 | else |
3996 | if test "$curl" = "yes" ; then | |
21684af0 | 3997 | feature_not_found "curl" "Install libcurl devel" |
788c8196 JQ |
3998 | fi |
3999 | curl=no | |
769ce76d AG |
4000 | fi |
4001 | fi # test "$curl" | |
4002 | ||
e18df141 AL |
4003 | ########################################## |
4004 | # glib support probe | |
a52d28af | 4005 | |
00f2cfbb | 4006 | glib_req_ver=2.48 |
aa0d1f44 PB |
4007 | glib_modules=gthread-2.0 |
4008 | if test "$modules" = yes; then | |
a88afc64 | 4009 | glib_modules="$glib_modules gmodule-export-2.0" |
aa0d1f44 | 4010 | fi |
54cb65d8 EC |
4011 | if test "$plugins" = yes; then |
4012 | glib_modules="$glib_modules gmodule-2.0" | |
4013 | fi | |
e26110cf | 4014 | |
4eaf7202 SJ |
4015 | # This workaround is required due to a bug in pkg-config file for glib as it |
4016 | # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static | |
4017 | ||
e633a5c6 | 4018 | if test "$static" = yes && test "$mingw32" = yes; then |
4eaf7202 SJ |
4019 | QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS" |
4020 | fi | |
4021 | ||
aa0d1f44 | 4022 | for i in $glib_modules; do |
e26110cf | 4023 | if $pkg_config --atleast-version=$glib_req_ver $i; then |
89138857 SW |
4024 | glib_cflags=$($pkg_config --cflags $i) |
4025 | glib_libs=$($pkg_config --libs $i) | |
4a058899 | 4026 | QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS" |
e26110cf FZ |
4027 | LIBS="$glib_libs $LIBS" |
4028 | libs_qga="$glib_libs $libs_qga" | |
4029 | else | |
4030 | error_exit "glib-$glib_req_ver $i is required to compile QEMU" | |
4031 | fi | |
4032 | done | |
4033 | ||
f876b765 MAL |
4034 | if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then |
4035 | gio=yes | |
4036 | gio_cflags=$($pkg_config --cflags gio-2.0) | |
4037 | gio_libs=$($pkg_config --libs gio-2.0) | |
25a97a56 | 4038 | gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) |
0dba4897 MAL |
4039 | if [ ! -x "$gdbus_codegen" ]; then |
4040 | gdbus_codegen= | |
4041 | fi | |
f876b765 MAL |
4042 | else |
4043 | gio=no | |
4044 | fi | |
4045 | ||
25a97a56 MAL |
4046 | if $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then |
4047 | gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)" | |
4048 | gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)" | |
4049 | fi | |
4050 | ||
977a82ab DB |
4051 | # Sanity check that the current size_t matches the |
4052 | # size that glib thinks it should be. This catches | |
4053 | # problems on multi-arch where people try to build | |
4054 | # 32-bit QEMU while pointing at 64-bit glib headers | |
4055 | cat > $TMPC <<EOF | |
4056 | #include <glib.h> | |
4057 | #include <unistd.h> | |
4058 | ||
4059 | #define QEMU_BUILD_BUG_ON(x) \ | |
4060 | typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); | |
4061 | ||
4062 | int main(void) { | |
4063 | QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); | |
4064 | return 0; | |
4065 | } | |
4066 | EOF | |
4067 | ||
5919e032 | 4068 | if ! compile_prog "$CFLAGS" "$LIBS" ; then |
977a82ab DB |
4069 | error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ |
4070 | "You probably need to set PKG_CONFIG_LIBDIR"\ | |
4071 | "to point to the right pkg-config files for your"\ | |
4072 | "build target" | |
4073 | fi | |
4074 | ||
bbbf2e04 JS |
4075 | # Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage |
4076 | cat > $TMPC << EOF | |
4077 | #include <glib.h> | |
4078 | int main(void) { return 0; } | |
4079 | EOF | |
4080 | if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then | |
4081 | if cc_has_warning_flag "-Wno-unknown-attributes"; then | |
4082 | glib_cflags="-Wno-unknown-attributes $glib_cflags" | |
086d5f75 | 4083 | QEMU_CFLAGS="-Wno-unknown-attributes $CFLAGS" |
bbbf2e04 JS |
4084 | fi |
4085 | fi | |
4086 | ||
9bda600b EB |
4087 | # Silence clang warnings triggered by glib < 2.57.2 |
4088 | cat > $TMPC << EOF | |
4089 | #include <glib.h> | |
4090 | typedef struct Foo { | |
4091 | int i; | |
4092 | } Foo; | |
4093 | static void foo_free(Foo *f) | |
4094 | { | |
4095 | g_free(f); | |
4096 | } | |
4097 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free); | |
4098 | int main(void) { return 0; } | |
4099 | EOF | |
4100 | if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then | |
4101 | if cc_has_warning_flag "-Wno-unused-function"; then | |
4102 | glib_cflags="$glib_cflags -Wno-unused-function" | |
4103 | CFLAGS="$CFLAGS -Wno-unused-function" | |
4104 | fi | |
4105 | fi | |
4106 | ||
6a1f42bd SW |
4107 | ######################################### |
4108 | # zlib check | |
4109 | ||
4110 | if test "$zlib" != "no" ; then | |
4111 | if $pkg_config --exists zlib; then | |
4112 | zlib_cflags=$($pkg_config --cflags zlib) | |
4113 | zlib_libs=$($pkg_config --libs zlib) | |
4114 | QEMU_CFLAGS="$zlib_cflags $QEMU_CFLAGS" | |
4115 | LIBS="$zlib_libs $LIBS" | |
4116 | else | |
4117 | cat > $TMPC << EOF | |
4118 | #include <zlib.h> | |
4119 | int main(void) { zlibVersion(); return 0; } | |
4120 | EOF | |
4121 | if compile_prog "" "-lz" ; then | |
4122 | LIBS="$LIBS -lz" | |
4123 | else | |
4124 | error_exit "zlib check failed" \ | |
4125 | "Make sure to have the zlib libs and headers installed." | |
4126 | fi | |
4127 | fi | |
4128 | fi | |
4129 | ||
e26110cf FZ |
4130 | ########################################## |
4131 | # SHA command probe for modules | |
4132 | if test "$modules" = yes; then | |
4133 | shacmd_probe="sha1sum sha1 shasum" | |
4134 | for c in $shacmd_probe; do | |
8ccefb91 | 4135 | if has $c; then |
e26110cf FZ |
4136 | shacmd="$c" |
4137 | break | |
4138 | fi | |
4139 | done | |
4140 | if test "$shacmd" = ""; then | |
4141 | error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" | |
4142 | fi | |
e18df141 AL |
4143 | fi |
4144 | ||
e2134eb9 GH |
4145 | ########################################## |
4146 | # pixman support probe | |
4147 | ||
9b52b17b | 4148 | if test "$softmmu" = "no"; then |
74880fe2 RS |
4149 | pixman_cflags= |
4150 | pixman_libs= | |
35c4e86c | 4151 | elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then |
89138857 SW |
4152 | pixman_cflags=$($pkg_config --cflags pixman-1) |
4153 | pixman_libs=$($pkg_config --libs pixman-1) | |
e2134eb9 | 4154 | else |
c12b6d70 GH |
4155 | error_exit "pixman >= 0.21.8 not present." \ |
4156 | "Please install the pixman devel package." | |
e2134eb9 | 4157 | fi |
e2134eb9 | 4158 | |
fe8fc5ae PB |
4159 | ########################################## |
4160 | # libmpathpersist probe | |
4161 | ||
4162 | if test "$mpath" != "no" ; then | |
1b0578f5 | 4163 | # probe for the new API |
fe8fc5ae PB |
4164 | cat > $TMPC <<EOF |
4165 | #include <libudev.h> | |
4166 | #include <mpath_persist.h> | |
4167 | unsigned mpath_mx_alloc_len = 1024; | |
4168 | int logsink; | |
b3f1c8c4 PB |
4169 | static struct config *multipath_conf; |
4170 | extern struct udev *udev; | |
4171 | extern struct config *get_multipath_config(void); | |
4172 | extern void put_multipath_config(struct config *conf); | |
4173 | struct udev *udev; | |
4174 | struct config *get_multipath_config(void) { return multipath_conf; } | |
4175 | void put_multipath_config(struct config *conf) { } | |
4176 | ||
fe8fc5ae | 4177 | int main(void) { |
b3f1c8c4 PB |
4178 | udev = udev_new(); |
4179 | multipath_conf = mpath_lib_init(); | |
fe8fc5ae PB |
4180 | return 0; |
4181 | } | |
4182 | EOF | |
4183 | if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then | |
4184 | mpathpersist=yes | |
1b0578f5 | 4185 | mpathpersist_new_api=yes |
fe8fc5ae | 4186 | else |
1b0578f5 MOA |
4187 | # probe for the old API |
4188 | cat > $TMPC <<EOF | |
4189 | #include <libudev.h> | |
4190 | #include <mpath_persist.h> | |
4191 | unsigned mpath_mx_alloc_len = 1024; | |
4192 | int logsink; | |
4193 | int main(void) { | |
4194 | struct udev *udev = udev_new(); | |
4195 | mpath_lib_init(udev); | |
4196 | return 0; | |
4197 | } | |
4198 | EOF | |
4199 | if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then | |
4200 | mpathpersist=yes | |
4201 | mpathpersist_new_api=no | |
4202 | else | |
4203 | mpathpersist=no | |
4204 | fi | |
fe8fc5ae PB |
4205 | fi |
4206 | else | |
4207 | mpathpersist=no | |
4208 | fi | |
4209 | ||
414f0dab | 4210 | ########################################## |
e5d355d1 | 4211 | # pthread probe |
4b29ec41 | 4212 | PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" |
3c529d93 | 4213 | |
4dd75c70 | 4214 | pthread=no |
e5d355d1 | 4215 | cat > $TMPC << EOF |
3c529d93 | 4216 | #include <pthread.h> |
7a42bbe4 SW |
4217 | static void *f(void *p) { return NULL; } |
4218 | int main(void) { | |
4219 | pthread_t thread; | |
4220 | pthread_create(&thread, 0, f, 0); | |
4221 | return 0; | |
4222 | } | |
414f0dab | 4223 | EOF |
bd00d539 AF |
4224 | if compile_prog "" "" ; then |
4225 | pthread=yes | |
4226 | else | |
4227 | for pthread_lib in $PTHREADLIBS_LIST; do | |
4228 | if compile_prog "" "$pthread_lib" ; then | |
4229 | pthread=yes | |
e3c56761 PP |
4230 | found=no |
4231 | for lib_entry in $LIBS; do | |
4232 | if test "$lib_entry" = "$pthread_lib"; then | |
4233 | found=yes | |
4234 | break | |
4235 | fi | |
4236 | done | |
4237 | if test "$found" = "no"; then | |
4238 | LIBS="$pthread_lib $LIBS" | |
14ab3aa7 | 4239 | libs_qga="$pthread_lib $libs_qga" |
e3c56761 | 4240 | fi |
409437e1 | 4241 | PTHREAD_LIB="$pthread_lib" |
bd00d539 AF |
4242 | break |
4243 | fi | |
4244 | done | |
4245 | fi | |
414f0dab | 4246 | |
e633a5c6 | 4247 | if test "$mingw32" != yes && test "$pthread" = no; then |
76ad07a4 PM |
4248 | error_exit "pthread check failed" \ |
4249 | "Make sure to have the pthread libs and headers installed." | |
e5d355d1 AL |
4250 | fi |
4251 | ||
479a5747 RB |
4252 | # check for pthread_setname_np with thread id |
4253 | pthread_setname_np_w_tid=no | |
5c312079 DDAG |
4254 | cat > $TMPC << EOF |
4255 | #include <pthread.h> | |
4256 | ||
4257 | static void *f(void *p) { return NULL; } | |
4258 | int main(void) | |
4259 | { | |
4260 | pthread_t thread; | |
4261 | pthread_create(&thread, 0, f, 0); | |
4262 | pthread_setname_np(thread, "QEMU"); | |
4263 | return 0; | |
4264 | } | |
4265 | EOF | |
4266 | if compile_prog "" "$pthread_lib" ; then | |
479a5747 RB |
4267 | pthread_setname_np_w_tid=yes |
4268 | fi | |
4269 | ||
4270 | # check for pthread_setname_np without thread id | |
4271 | pthread_setname_np_wo_tid=no | |
4272 | cat > $TMPC << EOF | |
4273 | #include <pthread.h> | |
4274 | ||
12a9b8d8 | 4275 | static void *f(void *p) { pthread_setname_np("QEMU"); return NULL; } |
479a5747 RB |
4276 | int main(void) |
4277 | { | |
4278 | pthread_t thread; | |
4279 | pthread_create(&thread, 0, f, 0); | |
4280 | return 0; | |
4281 | } | |
4282 | EOF | |
4283 | if compile_prog "" "$pthread_lib" ; then | |
4284 | pthread_setname_np_wo_tid=yes | |
5c312079 DDAG |
4285 | fi |
4286 | ||
f27aaf4b CB |
4287 | ########################################## |
4288 | # rbd probe | |
4289 | if test "$rbd" != "no" ; then | |
4290 | cat > $TMPC <<EOF | |
4291 | #include <stdio.h> | |
ad32e9c0 | 4292 | #include <rbd/librbd.h> |
f27aaf4b | 4293 | int main(void) { |
ad32e9c0 JD |
4294 | rados_t cluster; |
4295 | rados_create(&cluster, NULL); | |
f27aaf4b CB |
4296 | return 0; |
4297 | } | |
4298 | EOF | |
ad32e9c0 JD |
4299 | rbd_libs="-lrbd -lrados" |
4300 | if compile_prog "" "$rbd_libs" ; then | |
4301 | rbd=yes | |
f27aaf4b CB |
4302 | else |
4303 | if test "$rbd" = "yes" ; then | |
21684af0 | 4304 | feature_not_found "rados block device" "Install librbd/ceph devel" |
f27aaf4b CB |
4305 | fi |
4306 | rbd=no | |
4307 | fi | |
f27aaf4b CB |
4308 | fi |
4309 | ||
0a12ec87 | 4310 | ########################################## |
b10d49d7 PT |
4311 | # libssh probe |
4312 | if test "$libssh" != "no" ; then | |
4313 | if $pkg_config --exists libssh; then | |
4314 | libssh_cflags=$($pkg_config libssh --cflags) | |
4315 | libssh_libs=$($pkg_config libssh --libs) | |
4316 | libssh=yes | |
0a12ec87 | 4317 | else |
b10d49d7 PT |
4318 | if test "$libssh" = "yes" ; then |
4319 | error_exit "libssh required for --enable-libssh" | |
0a12ec87 | 4320 | fi |
b10d49d7 | 4321 | libssh=no |
0a12ec87 RJ |
4322 | fi |
4323 | fi | |
4324 | ||
9a2d462e | 4325 | ########################################## |
b10d49d7 PT |
4326 | # Check for libssh 0.8 |
4327 | # This is done like this instead of using the LIBSSH_VERSION_* and | |
4328 | # SSH_VERSION_* macros because some distributions in the past shipped | |
4329 | # snapshots of the future 0.8 from Git, and those snapshots did not | |
4330 | # have updated version numbers (still referring to 0.7.0). | |
9a2d462e | 4331 | |
b10d49d7 | 4332 | if test "$libssh" = "yes"; then |
9a2d462e | 4333 | cat > $TMPC <<EOF |
b10d49d7 PT |
4334 | #include <libssh/libssh.h> |
4335 | int main(void) { return ssh_get_server_publickey(NULL, NULL); } | |
9a2d462e | 4336 | EOF |
b10d49d7 PT |
4337 | if compile_prog "$libssh_cflags" "$libssh_libs"; then |
4338 | libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags" | |
9a2d462e RJ |
4339 | fi |
4340 | fi | |
4341 | ||
5c6c3a6c CH |
4342 | ########################################## |
4343 | # linux-aio probe | |
5c6c3a6c CH |
4344 | |
4345 | if test "$linux_aio" != "no" ; then | |
4346 | cat > $TMPC <<EOF | |
4347 | #include <libaio.h> | |
4348 | #include <sys/eventfd.h> | |
832ce9c2 | 4349 | #include <stddef.h> |
5c6c3a6c CH |
4350 | int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } |
4351 | EOF | |
4352 | if compile_prog "" "-laio" ; then | |
4353 | linux_aio=yes | |
5c6c3a6c CH |
4354 | else |
4355 | if test "$linux_aio" = "yes" ; then | |
21684af0 | 4356 | feature_not_found "linux AIO" "Install libaio devel" |
5c6c3a6c | 4357 | fi |
3cfcae3c | 4358 | linux_aio=no |
5c6c3a6c CH |
4359 | fi |
4360 | fi | |
c10dd856 AM |
4361 | ########################################## |
4362 | # linux-io-uring probe | |
4363 | ||
4364 | if test "$linux_io_uring" != "no" ; then | |
4365 | if $pkg_config liburing; then | |
4366 | linux_io_uring_cflags=$($pkg_config --cflags liburing) | |
4367 | linux_io_uring_libs=$($pkg_config --libs liburing) | |
4368 | linux_io_uring=yes | |
73fd282e SH |
4369 | |
4370 | # io_uring is used in libqemuutil.a where per-file -libs variables are not | |
4371 | # seen by programs linking the archive. It's not ideal, but just add the | |
4372 | # library dependency globally. | |
4373 | LIBS="$linux_io_uring_libs $LIBS" | |
c10dd856 AM |
4374 | else |
4375 | if test "$linux_io_uring" = "yes" ; then | |
4376 | feature_not_found "linux io_uring" "Install liburing devel" | |
4377 | fi | |
4378 | linux_io_uring=no | |
4379 | fi | |
4380 | fi | |
5c6c3a6c | 4381 | |
3b8acc11 | 4382 | ########################################## |
7aaa6a16 | 4383 | # TPM emulation is only on POSIX |
3b8acc11 | 4384 | |
7aaa6a16 PB |
4385 | if test "$tpm" = ""; then |
4386 | if test "$mingw32" = "yes"; then | |
4387 | tpm=no | |
4388 | else | |
4389 | tpm=yes | |
4390 | fi | |
4391 | elif test "$tpm" = "yes"; then | |
4392 | if test "$mingw32" = "yes" ; then | |
4393 | error_exit "TPM emulation only available on POSIX systems" | |
4394 | fi | |
3b8acc11 PB |
4395 | fi |
4396 | ||
758e8e38 VJ |
4397 | ########################################## |
4398 | # attr probe | |
4399 | ||
4400 | if test "$attr" != "no" ; then | |
4401 | cat > $TMPC <<EOF | |
4402 | #include <stdio.h> | |
4403 | #include <sys/types.h> | |
f2338fb4 PB |
4404 | #ifdef CONFIG_LIBATTR |
4405 | #include <attr/xattr.h> | |
4406 | #else | |
4f26f2b6 | 4407 | #include <sys/xattr.h> |
f2338fb4 | 4408 | #endif |
758e8e38 VJ |
4409 | int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } |
4410 | EOF | |
4f26f2b6 AK |
4411 | if compile_prog "" "" ; then |
4412 | attr=yes | |
4413 | # Older distros have <attr/xattr.h>, and need -lattr: | |
f2338fb4 | 4414 | elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then |
758e8e38 VJ |
4415 | attr=yes |
4416 | LIBS="-lattr $LIBS" | |
4f26f2b6 | 4417 | libattr=yes |
758e8e38 VJ |
4418 | else |
4419 | if test "$attr" = "yes" ; then | |
21684af0 | 4420 | feature_not_found "ATTR" "Install libc6 or libattr devel" |
758e8e38 VJ |
4421 | fi |
4422 | attr=no | |
4423 | fi | |
4424 | fi | |
4425 | ||
bf9298b9 AL |
4426 | ########################################## |
4427 | # iovec probe | |
4428 | cat > $TMPC <<EOF | |
db34f0b3 | 4429 | #include <sys/types.h> |
bf9298b9 | 4430 | #include <sys/uio.h> |
db34f0b3 | 4431 | #include <unistd.h> |
f91f9bee | 4432 | int main(void) { return sizeof(struct iovec); } |
bf9298b9 AL |
4433 | EOF |
4434 | iovec=no | |
52166aa0 | 4435 | if compile_prog "" "" ; then |
bf9298b9 AL |
4436 | iovec=yes |
4437 | fi | |
4438 | ||
ceb42de8 AL |
4439 | ########################################## |
4440 | # preadv probe | |
4441 | cat > $TMPC <<EOF | |
4442 | #include <sys/types.h> | |
4443 | #include <sys/uio.h> | |
4444 | #include <unistd.h> | |
c075a723 | 4445 | int main(void) { return preadv(0, 0, 0, 0); } |
ceb42de8 AL |
4446 | EOF |
4447 | preadv=no | |
52166aa0 | 4448 | if compile_prog "" "" ; then |
ceb42de8 AL |
4449 | preadv=yes |
4450 | fi | |
4451 | ||
f652e6af AJ |
4452 | ########################################## |
4453 | # fdt probe | |
e169e1e1 PM |
4454 | # fdt support is mandatory for at least some target architectures, |
4455 | # so insist on it if we're building those system emulators. | |
4456 | fdt_required=no | |
4457 | for target in $target_list; do | |
4458 | case $target in | |
c8c35e5f | 4459 | aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu|rx-softmmu) |
e169e1e1 PM |
4460 | fdt_required=yes |
4461 | ;; | |
4462 | esac | |
4463 | done | |
4464 | ||
4465 | if test "$fdt_required" = "yes"; then | |
4466 | if test "$fdt" = "no"; then | |
4467 | error_exit "fdt disabled but some requested targets require it." \ | |
4468 | "You can turn off fdt only if you also disable all the system emulation" \ | |
4469 | "targets which need it (by specifying a cut down --target-list)." | |
4470 | fi | |
4471 | fdt=yes | |
7ba4a4d3 PMD |
4472 | elif test "$fdt" != "yes" ; then |
4473 | fdt=no | |
e169e1e1 PM |
4474 | fi |
4475 | ||
d599938a LV |
4476 | # fdt is only required when building softmmu targets |
4477 | if test -z "$fdt" -a "$softmmu" != "yes" ; then | |
4478 | fdt="no" | |
4479 | fi | |
4480 | ||
2df87df7 | 4481 | if test "$fdt" != "no" ; then |
b41af4ba | 4482 | fdt_libs="-lfdt" |
96ce6545 | 4483 | # explicitly check for libfdt_env.h as it is missing in some stable installs |
6e85fce0 | 4484 | # and test for required functions to make sure we are on a version >= 1.4.2 |
b41af4ba | 4485 | cat > $TMPC << EOF |
31ce0adb | 4486 | #include <libfdt.h> |
96ce6545 | 4487 | #include <libfdt_env.h> |
fea35ca4 | 4488 | int main(void) { fdt_check_full(NULL, 0); return 0; } |
f652e6af | 4489 | EOF |
52166aa0 | 4490 | if compile_prog "" "$fdt_libs" ; then |
a540f158 | 4491 | # system DTC is good - use it |
e3971d61 | 4492 | fdt=system |
a540f158 | 4493 | else |
aef45d51 DB |
4494 | # have GIT checkout, so activate dtc submodule |
4495 | if test -e "${source_path}/.git" ; then | |
4496 | git_submodules="${git_submodules} dtc" | |
4497 | fi | |
4498 | if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then | |
e3971d61 | 4499 | fdt=git |
aef45d51 DB |
4500 | mkdir -p dtc |
4501 | if [ "$pwd_is_source_path" != "y" ] ; then | |
4502 | symlink "$source_path/dtc/Makefile" "dtc/Makefile" | |
aef45d51 | 4503 | fi |
25211446 PB |
4504 | fdt_cflags="-I${source_path}/dtc/libfdt" |
4505 | fdt_ldflags="-L$PWD/dtc/libfdt" | |
8a99e9a3 | 4506 | fdt_libs="$fdt_libs" |
aef45d51 DB |
4507 | elif test "$fdt" = "yes" ; then |
4508 | # Not a git build & no libfdt found, prompt for system install | |
4509 | error_exit "DTC (libfdt) version >= 1.4.2 not present." \ | |
4510 | "Please install the DTC (libfdt) devel package" | |
4511 | else | |
4512 | # don't have and don't want | |
4513 | fdt_libs= | |
4514 | fdt=no | |
4515 | fi | |
f652e6af AJ |
4516 | fi |
4517 | fi | |
4518 | ||
a540f158 PC |
4519 | libs_softmmu="$libs_softmmu $fdt_libs" |
4520 | ||
20ff075b | 4521 | ########################################## |
fb719563 | 4522 | # opengl probe (for sdl2, gtk, milkymist-tmu2) |
b1546f32 | 4523 | |
d52c454a MAL |
4524 | gbm="no" |
4525 | if $pkg_config gbm; then | |
4526 | gbm_cflags="$($pkg_config --cflags gbm)" | |
4527 | gbm_libs="$($pkg_config --libs gbm)" | |
4528 | gbm="yes" | |
4529 | fi | |
4530 | ||
da076ffe | 4531 | if test "$opengl" != "no" ; then |
4939a1df | 4532 | opengl_pkgs="epoxy gbm" |
5f9b1e35 GH |
4533 | if $pkg_config $opengl_pkgs; then |
4534 | opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" | |
4535 | opengl_libs="$($pkg_config --libs $opengl_pkgs)" | |
da076ffe | 4536 | opengl=yes |
925a0400 GH |
4537 | if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then |
4538 | gtk_gl="yes" | |
4539 | fi | |
cc720a5d | 4540 | QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags" |
20ff075b | 4541 | else |
da076ffe | 4542 | if test "$opengl" = "yes" ; then |
dcf30025 | 4543 | feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" |
20ff075b | 4544 | fi |
f676c67e | 4545 | opengl_cflags="" |
da076ffe GH |
4546 | opengl_libs="" |
4547 | opengl=no | |
20ff075b MW |
4548 | fi |
4549 | fi | |
4550 | ||
014cb152 GH |
4551 | if test "$opengl" = "yes"; then |
4552 | cat > $TMPC << EOF | |
4553 | #include <epoxy/egl.h> | |
4554 | #ifndef EGL_MESA_image_dma_buf_export | |
4555 | # error mesa/epoxy lacks support for dmabufs (mesa 10.6+) | |
4556 | #endif | |
4557 | int main(void) { return 0; } | |
4558 | EOF | |
4559 | if compile_prog "" "" ; then | |
4560 | opengl_dmabuf=yes | |
4561 | fi | |
4562 | fi | |
c9a12e75 | 4563 | |
e633a5c6 | 4564 | if test "$opengl" = "yes" && test "$have_x11" = "yes"; then |
99e1a93b PMD |
4565 | for target in $target_list; do |
4566 | case $target in | |
4567 | lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL | |
4568 | need_x11=yes | |
4569 | ;; | |
4570 | esac | |
4571 | done | |
4572 | fi | |
4573 | ||
ed279a06 KK |
4574 | ########################################## |
4575 | # libxml2 probe | |
4576 | if test "$libxml2" != "no" ; then | |
4577 | if $pkg_config --exists libxml-2.0; then | |
4578 | libxml2="yes" | |
4579 | libxml2_cflags=$($pkg_config --cflags libxml-2.0) | |
4580 | libxml2_libs=$($pkg_config --libs libxml-2.0) | |
4581 | else | |
4582 | if test "$libxml2" = "yes"; then | |
4583 | feature_not_found "libxml2" "Install libxml2 devel" | |
4584 | fi | |
4585 | libxml2="no" | |
4586 | fi | |
4587 | fi | |
c9a12e75 | 4588 | |
eb100396 BR |
4589 | ########################################## |
4590 | # glusterfs probe | |
4591 | if test "$glusterfs" != "no" ; then | |
65d5d3f9 | 4592 | if $pkg_config --atleast-version=3 glusterfs-api; then |
e01bee08 | 4593 | glusterfs="yes" |
89138857 SW |
4594 | glusterfs_cflags=$($pkg_config --cflags glusterfs-api) |
4595 | glusterfs_libs=$($pkg_config --libs glusterfs-api) | |
d85fa9eb JC |
4596 | if $pkg_config --atleast-version=4 glusterfs-api; then |
4597 | glusterfs_xlator_opt="yes" | |
4598 | fi | |
65d5d3f9 | 4599 | if $pkg_config --atleast-version=5 glusterfs-api; then |
0c14fb47 BR |
4600 | glusterfs_discard="yes" |
4601 | fi | |
7c815372 | 4602 | if $pkg_config --atleast-version=6 glusterfs-api; then |
df3a429a | 4603 | glusterfs_fallocate="yes" |
7c815372 BR |
4604 | glusterfs_zerofill="yes" |
4605 | fi | |
e014dbe7 PKK |
4606 | cat > $TMPC << EOF |
4607 | #include <glusterfs/api/glfs.h> | |
4608 | ||
4609 | int | |
4610 | main(void) | |
4611 | { | |
4612 | /* new glfs_ftruncate() passes two additional args */ | |
4613 | return glfs_ftruncate(NULL, 0, NULL, NULL); | |
4614 | } | |
4615 | EOF | |
4616 | if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then | |
4617 | glusterfs_ftruncate_has_stat="yes" | |
4618 | fi | |
0e3b891f NV |
4619 | cat > $TMPC << EOF |
4620 | #include <glusterfs/api/glfs.h> | |
4621 | ||
4622 | /* new glfs_io_cbk() passes two additional glfs_stat structs */ | |
4623 | static void | |
4624 | glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data) | |
4625 | {} | |
4626 | ||
4627 | int | |
4628 | main(void) | |
4629 | { | |
4630 | glfs_io_cbk iocb = &glusterfs_iocb; | |
4631 | iocb(NULL, 0 , NULL, NULL, NULL); | |
4632 | return 0; | |
4633 | } | |
4634 | EOF | |
4635 | if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then | |
4636 | glusterfs_iocb_has_stat="yes" | |
4637 | fi | |
eb100396 BR |
4638 | else |
4639 | if test "$glusterfs" = "yes" ; then | |
8efc9363 HT |
4640 | feature_not_found "GlusterFS backend support" \ |
4641 | "Install glusterfs-api devel >= 3" | |
eb100396 | 4642 | fi |
e01bee08 | 4643 | glusterfs="no" |
eb100396 BR |
4644 | fi |
4645 | fi | |
4646 | ||
39386ac7 | 4647 | # Check for inotify functions when we are building linux-user |
3b3f24ad AJ |
4648 | # emulator. This is done because older glibc versions don't |
4649 | # have syscall stubs for these implemented. In that case we | |
4650 | # don't provide them even if kernel supports them. | |
4651 | # | |
4652 | inotify=no | |
67ba57f6 | 4653 | cat > $TMPC << EOF |
3b3f24ad AJ |
4654 | #include <sys/inotify.h> |
4655 | ||
4656 | int | |
4657 | main(void) | |
4658 | { | |
4659 | /* try to start inotify */ | |
8690e420 | 4660 | return inotify_init(); |
3b3f24ad AJ |
4661 | } |
4662 | EOF | |
52166aa0 | 4663 | if compile_prog "" "" ; then |
67ba57f6 | 4664 | inotify=yes |
3b3f24ad AJ |
4665 | fi |
4666 | ||
c05c7a73 RV |
4667 | inotify1=no |
4668 | cat > $TMPC << EOF | |
4669 | #include <sys/inotify.h> | |
4670 | ||
4671 | int | |
4672 | main(void) | |
4673 | { | |
4674 | /* try to start inotify */ | |
4675 | return inotify_init1(0); | |
4676 | } | |
4677 | EOF | |
4678 | if compile_prog "" "" ; then | |
4679 | inotify1=yes | |
4680 | fi | |
4681 | ||
099d6b0f RV |
4682 | # check if pipe2 is there |
4683 | pipe2=no | |
4684 | cat > $TMPC << EOF | |
099d6b0f RV |
4685 | #include <unistd.h> |
4686 | #include <fcntl.h> | |
4687 | ||
4688 | int main(void) | |
4689 | { | |
4690 | int pipefd[2]; | |
9bca8162 | 4691 | return pipe2(pipefd, O_CLOEXEC); |
099d6b0f RV |
4692 | } |
4693 | EOF | |
52166aa0 | 4694 | if compile_prog "" "" ; then |
099d6b0f RV |
4695 | pipe2=yes |
4696 | fi | |
4697 | ||
40ff6d7e KW |
4698 | # check if accept4 is there |
4699 | accept4=no | |
4700 | cat > $TMPC << EOF | |
40ff6d7e KW |
4701 | #include <sys/socket.h> |
4702 | #include <stddef.h> | |
4703 | ||
4704 | int main(void) | |
4705 | { | |
4706 | accept4(0, NULL, NULL, SOCK_CLOEXEC); | |
4707 | return 0; | |
4708 | } | |
4709 | EOF | |
4710 | if compile_prog "" "" ; then | |
4711 | accept4=yes | |
4712 | fi | |
4713 | ||
3ce34dfb VS |
4714 | # check if tee/splice is there. vmsplice was added same time. |
4715 | splice=no | |
4716 | cat > $TMPC << EOF | |
3ce34dfb VS |
4717 | #include <unistd.h> |
4718 | #include <fcntl.h> | |
4719 | #include <limits.h> | |
4720 | ||
4721 | int main(void) | |
4722 | { | |
66ea0f22 | 4723 | int len, fd = 0; |
3ce34dfb VS |
4724 | len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); |
4725 | splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); | |
4726 | return 0; | |
4727 | } | |
4728 | EOF | |
52166aa0 | 4729 | if compile_prog "" "" ; then |
3ce34dfb VS |
4730 | splice=yes |
4731 | fi | |
4732 | ||
a99d57bb WG |
4733 | ########################################## |
4734 | # libnuma probe | |
4735 | ||
4736 | if test "$numa" != "no" ; then | |
4737 | cat > $TMPC << EOF | |
4738 | #include <numa.h> | |
4739 | int main(void) { return numa_available(); } | |
4740 | EOF | |
4741 | ||
4742 | if compile_prog "" "-lnuma" ; then | |
4743 | numa=yes | |
4744 | libs_softmmu="-lnuma $libs_softmmu" | |
4745 | else | |
4746 | if test "$numa" = "yes" ; then | |
4747 | feature_not_found "numa" "install numactl devel" | |
4748 | fi | |
4749 | numa=no | |
4750 | fi | |
4751 | fi | |
4752 | ||
7b01cb97 AD |
4753 | if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then |
4754 | echo "ERROR: tcmalloc && jemalloc can't be used at the same time" | |
4755 | exit 1 | |
4756 | fi | |
4757 | ||
5a22ab71 YZ |
4758 | # Even if malloc_trim() is available, these non-libc memory allocators |
4759 | # do not support it. | |
4760 | if test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then | |
4761 | if test "$malloc_trim" = "yes" ; then | |
4762 | echo "Disabling malloc_trim with non-libc memory allocator" | |
4763 | fi | |
4764 | malloc_trim="no" | |
4765 | fi | |
4766 | ||
4767 | ####################################### | |
4768 | # malloc_trim | |
4769 | ||
4770 | if test "$malloc_trim" != "no" ; then | |
4771 | cat > $TMPC << EOF | |
4772 | #include <malloc.h> | |
4773 | int main(void) { malloc_trim(0); return 0; } | |
4774 | EOF | |
4775 | if compile_prog "" "" ; then | |
4776 | malloc_trim="yes" | |
4777 | else | |
4778 | malloc_trim="no" | |
4779 | fi | |
4780 | fi | |
4781 | ||
2847b469 FZ |
4782 | ########################################## |
4783 | # tcmalloc probe | |
4784 | ||
4785 | if test "$tcmalloc" = "yes" ; then | |
4786 | cat > $TMPC << EOF | |
4787 | #include <stdlib.h> | |
f2dfe54c LB |
4788 | int main(void) { |
4789 | void *tmp = malloc(1); | |
4790 | if (tmp != NULL) { | |
4791 | return 0; | |
4792 | } | |
4793 | return 1; | |
4794 | } | |
2847b469 FZ |
4795 | EOF |
4796 | ||
4797 | if compile_prog "" "-ltcmalloc" ; then | |
4798 | LIBS="-ltcmalloc $LIBS" | |
4799 | else | |
4800 | feature_not_found "tcmalloc" "install gperftools devel" | |
4801 | fi | |
4802 | fi | |
4803 | ||
7b01cb97 AD |
4804 | ########################################## |
4805 | # jemalloc probe | |
4806 | ||
4807 | if test "$jemalloc" = "yes" ; then | |
4808 | cat > $TMPC << EOF | |
4809 | #include <stdlib.h> | |
f2dfe54c LB |
4810 | int main(void) { |
4811 | void *tmp = malloc(1); | |
4812 | if (tmp != NULL) { | |
4813 | return 0; | |
4814 | } | |
4815 | return 1; | |
4816 | } | |
7b01cb97 AD |
4817 | EOF |
4818 | ||
4819 | if compile_prog "" "-ljemalloc" ; then | |
4820 | LIBS="-ljemalloc $LIBS" | |
4821 | else | |
4822 | feature_not_found "jemalloc" "install jemalloc devel" | |
4823 | fi | |
4824 | fi | |
4825 | ||
dcc38d1c MT |
4826 | ########################################## |
4827 | # signalfd probe | |
4828 | signalfd="no" | |
4829 | cat > $TMPC << EOF | |
dcc38d1c MT |
4830 | #include <unistd.h> |
4831 | #include <sys/syscall.h> | |
4832 | #include <signal.h> | |
4833 | int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } | |
4834 | EOF | |
4835 | ||
4836 | if compile_prog "" "" ; then | |
4837 | signalfd=yes | |
4838 | fi | |
4839 | ||
d339d766 RJ |
4840 | # check if optreset global is declared by <getopt.h> |
4841 | optreset="no" | |
4842 | cat > $TMPC << EOF | |
4843 | #include <getopt.h> | |
4844 | int main(void) { return optreset; } | |
4845 | EOF | |
4846 | ||
4847 | if compile_prog "" "" ; then | |
4848 | optreset=yes | |
4849 | fi | |
4850 | ||
c2882b96 RV |
4851 | # check if eventfd is supported |
4852 | eventfd=no | |
4853 | cat > $TMPC << EOF | |
4854 | #include <sys/eventfd.h> | |
4855 | ||
4856 | int main(void) | |
4857 | { | |
55cc7f3e | 4858 | return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); |
c2882b96 RV |
4859 | } |
4860 | EOF | |
4861 | if compile_prog "" "" ; then | |
4862 | eventfd=yes | |
4863 | fi | |
4864 | ||
751bcc39 MAL |
4865 | # check if memfd is supported |
4866 | memfd=no | |
4867 | cat > $TMPC << EOF | |
75e5b70e | 4868 | #include <sys/mman.h> |
751bcc39 MAL |
4869 | |
4870 | int main(void) | |
4871 | { | |
4872 | return memfd_create("foo", MFD_ALLOW_SEALING); | |
4873 | } | |
4874 | EOF | |
4875 | if compile_prog "" "" ; then | |
4876 | memfd=yes | |
4877 | fi | |
4878 | ||
955727d2 CT |
4879 | # check for usbfs |
4880 | have_usbfs=no | |
4881 | if test "$linux_user" = "yes"; then | |
96566d09 TP |
4882 | cat > $TMPC << EOF |
4883 | #include <linux/usbdevice_fs.h> | |
4884 | ||
4885 | #ifndef USBDEVFS_GET_CAPABILITIES | |
4886 | #error "USBDEVFS_GET_CAPABILITIES undefined" | |
4887 | #endif | |
4888 | ||
4889 | #ifndef USBDEVFS_DISCONNECT_CLAIM | |
4890 | #error "USBDEVFS_DISCONNECT_CLAIM undefined" | |
4891 | #endif | |
4892 | ||
4893 | int main(void) | |
4894 | { | |
4895 | return 0; | |
4896 | } | |
4897 | EOF | |
4898 | if compile_prog "" ""; then | |
955727d2 CT |
4899 | have_usbfs=yes |
4900 | fi | |
955727d2 | 4901 | fi |
751bcc39 | 4902 | |
d0927938 UH |
4903 | # check for fallocate |
4904 | fallocate=no | |
4905 | cat > $TMPC << EOF | |
4906 | #include <fcntl.h> | |
4907 | ||
4908 | int main(void) | |
4909 | { | |
4910 | fallocate(0, 0, 0, 0); | |
4911 | return 0; | |
4912 | } | |
4913 | EOF | |
8fb03151 | 4914 | if compile_prog "" "" ; then |
d0927938 UH |
4915 | fallocate=yes |
4916 | fi | |
4917 | ||
3d4fa43e KK |
4918 | # check for fallocate hole punching |
4919 | fallocate_punch_hole=no | |
4920 | cat > $TMPC << EOF | |
4921 | #include <fcntl.h> | |
4922 | #include <linux/falloc.h> | |
4923 | ||
4924 | int main(void) | |
4925 | { | |
4926 | fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); | |
4927 | return 0; | |
4928 | } | |
4929 | EOF | |
4930 | if compile_prog "" "" ; then | |
4931 | fallocate_punch_hole=yes | |
4932 | fi | |
4933 | ||
b953f075 DL |
4934 | # check that fallocate supports range zeroing inside the file |
4935 | fallocate_zero_range=no | |
4936 | cat > $TMPC << EOF | |
4937 | #include <fcntl.h> | |
4938 | #include <linux/falloc.h> | |
4939 | ||
4940 | int main(void) | |
4941 | { | |
4942 | fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0); | |
4943 | return 0; | |
4944 | } | |
4945 | EOF | |
4946 | if compile_prog "" "" ; then | |
4947 | fallocate_zero_range=yes | |
4948 | fi | |
4949 | ||
ed911435 KW |
4950 | # check for posix_fallocate |
4951 | posix_fallocate=no | |
4952 | cat > $TMPC << EOF | |
4953 | #include <fcntl.h> | |
4954 | ||
4955 | int main(void) | |
4956 | { | |
4957 | posix_fallocate(0, 0, 0); | |
4958 | return 0; | |
4959 | } | |
4960 | EOF | |
4961 | if compile_prog "" "" ; then | |
4962 | posix_fallocate=yes | |
4963 | fi | |
4964 | ||
c727f47d PM |
4965 | # check for sync_file_range |
4966 | sync_file_range=no | |
4967 | cat > $TMPC << EOF | |
4968 | #include <fcntl.h> | |
4969 | ||
4970 | int main(void) | |
4971 | { | |
4972 | sync_file_range(0, 0, 0, 0); | |
4973 | return 0; | |
4974 | } | |
4975 | EOF | |
8fb03151 | 4976 | if compile_prog "" "" ; then |
c727f47d PM |
4977 | sync_file_range=yes |
4978 | fi | |
4979 | ||
dace20dc PM |
4980 | # check for linux/fiemap.h and FS_IOC_FIEMAP |
4981 | fiemap=no | |
4982 | cat > $TMPC << EOF | |
4983 | #include <sys/ioctl.h> | |
4984 | #include <linux/fs.h> | |
4985 | #include <linux/fiemap.h> | |
4986 | ||
4987 | int main(void) | |
4988 | { | |
4989 | ioctl(0, FS_IOC_FIEMAP, 0); | |
4990 | return 0; | |
4991 | } | |
4992 | EOF | |
8fb03151 | 4993 | if compile_prog "" "" ; then |
dace20dc PM |
4994 | fiemap=yes |
4995 | fi | |
4996 | ||
d0927938 UH |
4997 | # check for dup3 |
4998 | dup3=no | |
4999 | cat > $TMPC << EOF | |
5000 | #include <unistd.h> | |
5001 | ||
5002 | int main(void) | |
5003 | { | |
5004 | dup3(0, 0, 0); | |
5005 | return 0; | |
5006 | } | |
5007 | EOF | |
78f5d726 | 5008 | if compile_prog "" "" ; then |
d0927938 UH |
5009 | dup3=yes |
5010 | fi | |
5011 | ||
4e0c6529 AB |
5012 | # check for ppoll support |
5013 | ppoll=no | |
5014 | cat > $TMPC << EOF | |
5015 | #include <poll.h> | |
5016 | ||
5017 | int main(void) | |
5018 | { | |
5019 | struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; | |
5020 | ppoll(&pfd, 1, 0, 0); | |
5021 | return 0; | |
5022 | } | |
5023 | EOF | |
5024 | if compile_prog "" "" ; then | |
5025 | ppoll=yes | |
5026 | fi | |
5027 | ||
cd758dd0 AB |
5028 | # check for prctl(PR_SET_TIMERSLACK , ... ) support |
5029 | prctl_pr_set_timerslack=no | |
5030 | cat > $TMPC << EOF | |
5031 | #include <sys/prctl.h> | |
5032 | ||
5033 | int main(void) | |
5034 | { | |
5035 | prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); | |
5036 | return 0; | |
5037 | } | |
5038 | EOF | |
5039 | if compile_prog "" "" ; then | |
5040 | prctl_pr_set_timerslack=yes | |
5041 | fi | |
5042 | ||
3b6edd16 PM |
5043 | # check for epoll support |
5044 | epoll=no | |
5045 | cat > $TMPC << EOF | |
5046 | #include <sys/epoll.h> | |
5047 | ||
5048 | int main(void) | |
5049 | { | |
5050 | epoll_create(0); | |
5051 | return 0; | |
5052 | } | |
5053 | EOF | |
8fb03151 | 5054 | if compile_prog "" "" ; then |
3b6edd16 PM |
5055 | epoll=yes |
5056 | fi | |
5057 | ||
227f0214 PM |
5058 | # epoll_create1 is a later addition |
5059 | # so we must check separately for its presence | |
3b6edd16 PM |
5060 | epoll_create1=no |
5061 | cat > $TMPC << EOF | |
5062 | #include <sys/epoll.h> | |
5063 | ||
5064 | int main(void) | |
5065 | { | |
19e83f6b PM |
5066 | /* Note that we use epoll_create1 as a value, not as |
5067 | * a function being called. This is necessary so that on | |
5068 | * old SPARC glibc versions where the function was present in | |
5069 | * the library but not declared in the header file we will | |
5070 | * fail the configure check. (Otherwise we will get a compiler | |
5071 | * warning but not an error, and will proceed to fail the | |
5072 | * qemu compile where we compile with -Werror.) | |
5073 | */ | |
c075a723 | 5074 | return (int)(uintptr_t)&epoll_create1; |
3b6edd16 PM |
5075 | } |
5076 | EOF | |
8fb03151 | 5077 | if compile_prog "" "" ; then |
3b6edd16 PM |
5078 | epoll_create1=yes |
5079 | fi | |
5080 | ||
a8fd1aba PM |
5081 | # check for sendfile support |
5082 | sendfile=no | |
5083 | cat > $TMPC << EOF | |
5084 | #include <sys/sendfile.h> | |
5085 | ||
5086 | int main(void) | |
5087 | { | |
5088 | return sendfile(0, 0, 0, 0); | |
5089 | } | |
5090 | EOF | |
5091 | if compile_prog "" "" ; then | |
5092 | sendfile=yes | |
5093 | fi | |
5094 | ||
51834341 RV |
5095 | # check for timerfd support (glibc 2.8 and newer) |
5096 | timerfd=no | |
5097 | cat > $TMPC << EOF | |
5098 | #include <sys/timerfd.h> | |
5099 | ||
5100 | int main(void) | |
5101 | { | |
5102 | return(timerfd_create(CLOCK_REALTIME, 0)); | |
5103 | } | |
5104 | EOF | |
5105 | if compile_prog "" "" ; then | |
5106 | timerfd=yes | |
5107 | fi | |
5108 | ||
9af5c906 RV |
5109 | # check for setns and unshare support |
5110 | setns=no | |
5111 | cat > $TMPC << EOF | |
5112 | #include <sched.h> | |
5113 | ||
5114 | int main(void) | |
5115 | { | |
5116 | int ret; | |
5117 | ret = setns(0, 0); | |
5118 | ret = unshare(0); | |
5119 | return ret; | |
5120 | } | |
5121 | EOF | |
5122 | if compile_prog "" "" ; then | |
5123 | setns=yes | |
5124 | fi | |
5125 | ||
38860a03 AM |
5126 | # clock_adjtime probe |
5127 | clock_adjtime=no | |
5128 | cat > $TMPC <<EOF | |
5129 | #include <time.h> | |
5130 | ||
5131 | int main(void) | |
5132 | { | |
5133 | return clock_adjtime(0, 0); | |
5134 | } | |
5135 | EOF | |
5136 | clock_adjtime=no | |
5137 | if compile_prog "" "" ; then | |
5138 | clock_adjtime=yes | |
5139 | fi | |
5140 | ||
5a03cd00 AM |
5141 | # syncfs probe |
5142 | syncfs=no | |
5143 | cat > $TMPC <<EOF | |
5144 | #include <unistd.h> | |
5145 | ||
5146 | int main(void) | |
5147 | { | |
5148 | return syncfs(0); | |
5149 | } | |
5150 | EOF | |
5151 | syncfs=no | |
5152 | if compile_prog "" "" ; then | |
5153 | syncfs=yes | |
5154 | fi | |
5155 | ||
db37dd89 AM |
5156 | # check for kcov support (kernel must be 4.4+, compiled with certain options) |
5157 | kcov=no | |
5158 | if check_include sys/kcov.h ; then | |
5159 | kcov=yes | |
5160 | fi | |
5161 | ||
516e8b7d PM |
5162 | # If we're making warnings fatal, apply this to Sphinx runs as well |
5163 | sphinx_werror="" | |
5164 | if test "$werror" = "yes"; then | |
5165 | sphinx_werror="-W" | |
5166 | fi | |
5167 | ||
5f71eac0 PM |
5168 | # Check we have a new enough version of sphinx-build |
5169 | has_sphinx_build() { | |
5170 | # This is a bit awkward but works: create a trivial document and | |
5171 | # try to run it with our configuration file (which enforces a | |
5172 | # version requirement). This will fail if either | |
5173 | # sphinx-build doesn't exist at all or if it is too old. | |
5174 | mkdir -p "$TMPDIR1/sphinx" | |
5175 | touch "$TMPDIR1/sphinx/index.rst" | |
988ae6c3 AB |
5176 | "$sphinx_build" $sphinx_werror -c "$source_path/docs" \ |
5177 | -b html "$TMPDIR1/sphinx" \ | |
5178 | "$TMPDIR1/sphinx/out" >> config.log 2>&1 | |
5f71eac0 PM |
5179 | } |
5180 | ||
cc8ae6de | 5181 | # Check if tools are available to build documentation. |
a25dba17 | 5182 | if test "$docs" != "no" ; then |
758b617a PM |
5183 | if has_sphinx_build; then |
5184 | sphinx_ok=yes | |
5185 | else | |
5186 | sphinx_ok=no | |
5187 | fi | |
5188 | if has makeinfo && has pod2man && test "$sphinx_ok" = "yes"; then | |
a25dba17 | 5189 | docs=yes |
83a3ab8b | 5190 | else |
a25dba17 | 5191 | if test "$docs" = "yes" ; then |
758b617a PM |
5192 | if has $sphinx_build && test "$sphinx_ok" != "yes"; then |
5193 | echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2 | |
5194 | fi | |
5195 | feature_not_found "docs" "Install texinfo, Perl/perl-podlators and a Python 3 version of python-sphinx" | |
83a3ab8b | 5196 | fi |
a25dba17 | 5197 | docs=no |
83a3ab8b | 5198 | fi |
cc8ae6de PB |
5199 | fi |
5200 | ||
f514f41c | 5201 | # Search for bswap_32 function |
6ae9a1f4 JQ |
5202 | byteswap_h=no |
5203 | cat > $TMPC << EOF | |
5204 | #include <byteswap.h> | |
5205 | int main(void) { return bswap_32(0); } | |
5206 | EOF | |
52166aa0 | 5207 | if compile_prog "" "" ; then |
6ae9a1f4 JQ |
5208 | byteswap_h=yes |
5209 | fi | |
5210 | ||
75f13596 | 5211 | # Search for bswap32 function |
6ae9a1f4 JQ |
5212 | bswap_h=no |
5213 | cat > $TMPC << EOF | |
5214 | #include <sys/endian.h> | |
5215 | #include <sys/types.h> | |
5216 | #include <machine/bswap.h> | |
5217 | int main(void) { return bswap32(0); } | |
5218 | EOF | |
52166aa0 | 5219 | if compile_prog "" "" ; then |
6ae9a1f4 JQ |
5220 | bswap_h=yes |
5221 | fi | |
5222 | ||
c589b249 | 5223 | ########################################## |
e49ab19f | 5224 | # Do we have libiscsi >= 1.9.0 |
c589b249 | 5225 | if test "$libiscsi" != "no" ; then |
e49ab19f | 5226 | if $pkg_config --atleast-version=1.9.0 libiscsi; then |
3c33ea96 | 5227 | libiscsi="yes" |
ca871ec8 SW |
5228 | libiscsi_cflags=$($pkg_config --cflags libiscsi) |
5229 | libiscsi_libs=$($pkg_config --libs libiscsi) | |
c589b249 RS |
5230 | else |
5231 | if test "$libiscsi" = "yes" ; then | |
e49ab19f | 5232 | feature_not_found "libiscsi" "Install libiscsi >= 1.9.0" |
c589b249 RS |
5233 | fi |
5234 | libiscsi="no" | |
5235 | fi | |
5236 | fi | |
5237 | ||
8bacde8d NC |
5238 | ########################################## |
5239 | # Do we need libm | |
5240 | cat > $TMPC << EOF | |
5241 | #include <math.h> | |
f80ea986 | 5242 | int main(int argc, char **argv) { return isnan(sin((double)argc)); } |
8bacde8d NC |
5243 | EOF |
5244 | if compile_prog "" "" ; then | |
5245 | : | |
5246 | elif compile_prog "" "-lm" ; then | |
5247 | LIBS="-lm $LIBS" | |
5248 | libs_qga="-lm $libs_qga" | |
5249 | else | |
76ad07a4 | 5250 | error_exit "libm check failed" |
8bacde8d NC |
5251 | fi |
5252 | ||
da93a1fd AL |
5253 | ########################################## |
5254 | # Do we need librt | |
8bacde8d NC |
5255 | # uClibc provides 2 versions of clock_gettime(), one with realtime |
5256 | # support and one without. This means that the clock_gettime() don't | |
5257 | # need -lrt. We still need it for timer_create() so we check for this | |
5258 | # function in addition. | |
da93a1fd AL |
5259 | cat > $TMPC <<EOF |
5260 | #include <signal.h> | |
5261 | #include <time.h> | |
8bacde8d NC |
5262 | int main(void) { |
5263 | timer_create(CLOCK_REALTIME, NULL, NULL); | |
5264 | return clock_gettime(CLOCK_REALTIME, NULL); | |
5265 | } | |
da93a1fd AL |
5266 | EOF |
5267 | ||
52166aa0 | 5268 | if compile_prog "" "" ; then |
07ffa4bd | 5269 | : |
8bacde8d | 5270 | # we need pthread for static linking. use previous pthread test result |
18e588b1 RL |
5271 | elif compile_prog "" "$pthread_lib -lrt" ; then |
5272 | LIBS="$LIBS -lrt" | |
5273 | libs_qga="$libs_qga -lrt" | |
da93a1fd AL |
5274 | fi |
5275 | ||
d99e97e6 TH |
5276 | # Check whether we need to link libutil for openpty() |
5277 | cat > $TMPC << EOF | |
5278 | extern int openpty(int *am, int *as, char *name, void *termp, void *winp); | |
5279 | int main(void) { return openpty(0, 0, 0, 0, 0); } | |
5280 | EOF | |
5281 | ||
9df8b20d TH |
5282 | have_openpty="no" |
5283 | if compile_prog "" "" ; then | |
5284 | have_openpty="yes" | |
5285 | else | |
d99e97e6 | 5286 | if compile_prog "" "-lutil" ; then |
6362a53f | 5287 | libs_softmmu="-lutil $libs_softmmu" |
d99e97e6 | 5288 | libs_tools="-lutil $libs_tools" |
9df8b20d | 5289 | have_openpty="yes" |
d99e97e6 | 5290 | fi |
6362a53f JQ |
5291 | fi |
5292 | ||
de5071c5 | 5293 | ########################################## |
cd4ec0b4 GH |
5294 | # spice probe |
5295 | if test "$spice" != "no" ; then | |
5296 | cat > $TMPC << EOF | |
5297 | #include <spice.h> | |
5298 | int main(void) { spice_server_new(); return 0; } | |
5299 | EOF | |
710fc4f5 JD |
5300 | spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) |
5301 | spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) | |
1b63665c | 5302 | if $pkg_config --atleast-version=0.12.5 spice-server && \ |
65d5d3f9 | 5303 | $pkg_config --atleast-version=0.12.3 spice-protocol && \ |
cd4ec0b4 GH |
5304 | compile_prog "$spice_cflags" "$spice_libs" ; then |
5305 | spice="yes" | |
5306 | libs_softmmu="$libs_softmmu $spice_libs" | |
5307 | QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" | |
5308 | else | |
5309 | if test "$spice" = "yes" ; then | |
8efc9363 | 5310 | feature_not_found "spice" \ |
1b63665c | 5311 | "Install spice-server(>=0.12.5) and spice-protocol(>=0.12.3) devel" |
cd4ec0b4 GH |
5312 | fi |
5313 | spice="no" | |
5314 | fi | |
5315 | fi | |
5316 | ||
7b02f544 | 5317 | # check for smartcard support |
7b02f544 | 5318 | if test "$smartcard" != "no"; then |
0f5c642d | 5319 | if $pkg_config --atleast-version=2.5.1 libcacard; then |
7b02f544 MAL |
5320 | libcacard_cflags=$($pkg_config --cflags libcacard) |
5321 | libcacard_libs=$($pkg_config --libs libcacard) | |
7b02f544 | 5322 | smartcard="yes" |
afd347ab | 5323 | else |
7b02f544 MAL |
5324 | if test "$smartcard" = "yes"; then |
5325 | feature_not_found "smartcard" "Install libcacard devel" | |
111a38b0 | 5326 | fi |
7b02f544 | 5327 | smartcard="no" |
111a38b0 RR |
5328 | fi |
5329 | fi | |
111a38b0 | 5330 | |
2b2325ff GH |
5331 | # check for libusb |
5332 | if test "$libusb" != "no" ; then | |
65d5d3f9 | 5333 | if $pkg_config --atleast-version=1.0.13 libusb-1.0; then |
2b2325ff | 5334 | libusb="yes" |
ca871ec8 SW |
5335 | libusb_cflags=$($pkg_config --cflags libusb-1.0) |
5336 | libusb_libs=$($pkg_config --libs libusb-1.0) | |
2b2325ff GH |
5337 | else |
5338 | if test "$libusb" = "yes"; then | |
8efc9363 | 5339 | feature_not_found "libusb" "Install libusb devel >= 1.0.13" |
2b2325ff GH |
5340 | fi |
5341 | libusb="no" | |
5342 | fi | |
5343 | fi | |
5344 | ||
69354a83 HG |
5345 | # check for usbredirparser for usb network redirection support |
5346 | if test "$usb_redir" != "no" ; then | |
65d5d3f9 | 5347 | if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then |
69354a83 | 5348 | usb_redir="yes" |
ca871ec8 SW |
5349 | usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) |
5350 | usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) | |
69354a83 HG |
5351 | else |
5352 | if test "$usb_redir" = "yes"; then | |
21684af0 | 5353 | feature_not_found "usb-redir" "Install usbredir devel" |
69354a83 HG |
5354 | fi |
5355 | usb_redir="no" | |
5356 | fi | |
5357 | fi | |
5358 | ||
d9840e25 TS |
5359 | ########################################## |
5360 | # check if we have VSS SDK headers for win | |
5361 | ||
e633a5c6 EB |
5362 | if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ |
5363 | test "$vss_win32_sdk" != "no" ; then | |
d9840e25 | 5364 | case "$vss_win32_sdk" in |
690604f6 | 5365 | "") vss_win32_include="-isystem $source_path" ;; |
d9840e25 TS |
5366 | *\ *) # The SDK is installed in "Program Files" by default, but we cannot |
5367 | # handle path with spaces. So we symlink the headers into ".sdk/vss". | |
690604f6 | 5368 | vss_win32_include="-isystem $source_path/.sdk/vss" |
d9840e25 TS |
5369 | symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" |
5370 | ;; | |
690604f6 | 5371 | *) vss_win32_include="-isystem $vss_win32_sdk" |
d9840e25 TS |
5372 | esac |
5373 | cat > $TMPC << EOF | |
5374 | #define __MIDL_user_allocate_free_DEFINED__ | |
5375 | #include <inc/win2003/vss.h> | |
5376 | int main(void) { return VSS_CTX_BACKUP; } | |
5377 | EOF | |
5378 | if compile_prog "$vss_win32_include" "" ; then | |
5379 | guest_agent_with_vss="yes" | |
5380 | QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" | |
315d3184 | 5381 | libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" |
f33ca81f | 5382 | qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" |
d9840e25 TS |
5383 | else |
5384 | if test "$vss_win32_sdk" != "" ; then | |
5385 | echo "ERROR: Please download and install Microsoft VSS SDK:" | |
5386 | echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" | |
5387 | echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" | |
5388 | echo "ERROR: scripts/extract-vsssdk-headers setup.exe" | |
5389 | echo "ERROR: The headers are extracted in the directory \`inc'." | |
5390 | feature_not_found "VSS support" | |
5391 | fi | |
5392 | guest_agent_with_vss="no" | |
5393 | fi | |
5394 | fi | |
5395 | ||
5396 | ########################################## | |
5397 | # lookup Windows platform SDK (if not specified) | |
5398 | # The SDK is needed only to build .tlb (type library) file of guest agent | |
5399 | # VSS provider from the source. It is usually unnecessary because the | |
5400 | # pre-compiled .tlb file is included. | |
5401 | ||
e633a5c6 EB |
5402 | if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ |
5403 | test "$guest_agent_with_vss" = "yes" ; then | |
d9840e25 TS |
5404 | if test -z "$win_sdk"; then |
5405 | programfiles="$PROGRAMFILES" | |
5406 | test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" | |
5407 | if test -n "$programfiles"; then | |
5408 | win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null | |
5409 | else | |
5410 | feature_not_found "Windows SDK" | |
5411 | fi | |
5412 | elif test "$win_sdk" = "no"; then | |
5413 | win_sdk="" | |
5414 | fi | |
5415 | fi | |
5416 | ||
50cbebb9 MR |
5417 | ########################################## |
5418 | # check if mingw environment provides a recent ntddscsi.h | |
e633a5c6 | 5419 | if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then |
50cbebb9 MR |
5420 | cat > $TMPC << EOF |
5421 | #include <windows.h> | |
5422 | #include <ntddscsi.h> | |
5423 | int main(void) { | |
5424 | #if !defined(IOCTL_SCSI_GET_ADDRESS) | |
5425 | #error Missing required ioctl definitions | |
5426 | #endif | |
5427 | SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; | |
5428 | return addr.Lun; | |
5429 | } | |
5430 | EOF | |
5431 | if compile_prog "" "" ; then | |
5432 | guest_agent_ntddscsi=yes | |
996b9cdc | 5433 | libs_qga="-lsetupapi -lcfgmgr32 $libs_qga" |
50cbebb9 MR |
5434 | fi |
5435 | fi | |
5436 | ||
9d9e1521 GH |
5437 | ########################################## |
5438 | # virgl renderer probe | |
5439 | ||
5440 | if test "$virglrenderer" != "no" ; then | |
5441 | cat > $TMPC << EOF | |
5442 | #include <virglrenderer.h> | |
5443 | int main(void) { virgl_renderer_poll(); return 0; } | |
5444 | EOF | |
5445 | virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null) | |
5446 | virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null) | |
47479c55 | 5447 | virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null) |
9d9e1521 GH |
5448 | if $pkg_config virglrenderer >/dev/null 2>&1 && \ |
5449 | compile_prog "$virgl_cflags" "$virgl_libs" ; then | |
5450 | virglrenderer="yes" | |
5451 | else | |
5452 | if test "$virglrenderer" = "yes" ; then | |
5453 | feature_not_found "virglrenderer" | |
5454 | fi | |
5455 | virglrenderer="no" | |
5456 | fi | |
5457 | fi | |
5458 | ||
8ca80760 RH |
5459 | ########################################## |
5460 | # capstone | |
5461 | ||
e219c499 RH |
5462 | case "$capstone" in |
5463 | "" | yes) | |
5464 | if $pkg_config capstone; then | |
5465 | capstone=system | |
e633a5c6 | 5466 | elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then |
e219c499 RH |
5467 | capstone=git |
5468 | elif test -e "${source_path}/capstone/Makefile" ; then | |
5469 | capstone=internal | |
5470 | elif test -z "$capstone" ; then | |
5471 | capstone=no | |
5472 | else | |
5473 | feature_not_found "capstone" "Install capstone devel or git submodule" | |
5474 | fi | |
5475 | ;; | |
5476 | ||
5477 | system) | |
5478 | if ! $pkg_config capstone; then | |
5479 | feature_not_found "capstone" "Install capstone devel" | |
5480 | fi | |
5481 | ;; | |
5482 | esac | |
5483 | ||
5484 | case "$capstone" in | |
5485 | git | internal) | |
5486 | if test "$capstone" = git; then | |
5487 | git_submodules="${git_submodules} capstone" | |
5488 | fi | |
5489 | mkdir -p capstone | |
25211446 | 5490 | QEMU_CFLAGS="$QEMU_CFLAGS -I${source_path}/capstone/include" |
e219c499 RH |
5491 | if test "$mingw32" = "yes"; then |
5492 | LIBCAPSTONE=capstone.lib | |
5493 | else | |
5494 | LIBCAPSTONE=libcapstone.a | |
5495 | fi | |
25211446 | 5496 | libs_cpu="-L$PWD/capstone -lcapstone $libs_cpu" |
e219c499 RH |
5497 | ;; |
5498 | ||
5499 | system) | |
8ca80760 | 5500 | QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)" |
02f9135b | 5501 | libs_cpu="$($pkg_config --libs capstone) $libs_cpu" |
e219c499 RH |
5502 | ;; |
5503 | ||
5504 | no) | |
5505 | ;; | |
5506 | *) | |
5507 | error_exit "Unknown state for capstone: $capstone" | |
5508 | ;; | |
5509 | esac | |
8ca80760 | 5510 | |
5f6b9e8f BS |
5511 | ########################################## |
5512 | # check if we have fdatasync | |
5513 | ||
5514 | fdatasync=no | |
5515 | cat > $TMPC << EOF | |
5516 | #include <unistd.h> | |
d1722a27 AR |
5517 | int main(void) { |
5518 | #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 | |
5519 | return fdatasync(0); | |
5520 | #else | |
e172fe11 | 5521 | #error Not supported |
d1722a27 AR |
5522 | #endif |
5523 | } | |
5f6b9e8f BS |
5524 | EOF |
5525 | if compile_prog "" "" ; then | |
5526 | fdatasync=yes | |
5527 | fi | |
5528 | ||
e78815a5 AF |
5529 | ########################################## |
5530 | # check if we have madvise | |
5531 | ||
5532 | madvise=no | |
5533 | cat > $TMPC << EOF | |
5534 | #include <sys/types.h> | |
5535 | #include <sys/mman.h> | |
832ce9c2 | 5536 | #include <stddef.h> |
e78815a5 AF |
5537 | int main(void) { return madvise(NULL, 0, MADV_DONTNEED); } |
5538 | EOF | |
5539 | if compile_prog "" "" ; then | |
5540 | madvise=yes | |
5541 | fi | |
5542 | ||
5543 | ########################################## | |
5544 | # check if we have posix_madvise | |
5545 | ||
5546 | posix_madvise=no | |
5547 | cat > $TMPC << EOF | |
5548 | #include <sys/mman.h> | |
832ce9c2 | 5549 | #include <stddef.h> |
e78815a5 AF |
5550 | int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } |
5551 | EOF | |
5552 | if compile_prog "" "" ; then | |
5553 | posix_madvise=yes | |
5554 | fi | |
5555 | ||
9bc5a719 AG |
5556 | ########################################## |
5557 | # check if we have posix_memalign() | |
5558 | ||
5559 | posix_memalign=no | |
5560 | cat > $TMPC << EOF | |
5561 | #include <stdlib.h> | |
5562 | int main(void) { | |
5563 | void *p; | |
5564 | return posix_memalign(&p, 8, 8); | |
5565 | } | |
5566 | EOF | |
5567 | if compile_prog "" "" ; then | |
5568 | posix_memalign=yes | |
5569 | fi | |
5570 | ||
0a852417 PD |
5571 | ########################################## |
5572 | # check if we have posix_syslog | |
5573 | ||
5574 | posix_syslog=no | |
5575 | cat > $TMPC << EOF | |
5576 | #include <syslog.h> | |
5577 | int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; } | |
5578 | EOF | |
5579 | if compile_prog "" "" ; then | |
5580 | posix_syslog=yes | |
5581 | fi | |
5582 | ||
401bc051 PM |
5583 | ########################################## |
5584 | # check if we have sem_timedwait | |
5585 | ||
5586 | sem_timedwait=no | |
5587 | cat > $TMPC << EOF | |
5588 | #include <semaphore.h> | |
811294b7 | 5589 | int main(void) { sem_t s; struct timespec t = {0}; return sem_timedwait(&s, &t); } |
401bc051 PM |
5590 | EOF |
5591 | if compile_prog "" "" ; then | |
5592 | sem_timedwait=yes | |
5593 | fi | |
5594 | ||
5c99fa37 KF |
5595 | ########################################## |
5596 | # check if we have strchrnul | |
5597 | ||
5598 | strchrnul=no | |
5599 | cat > $TMPC << EOF | |
5600 | #include <string.h> | |
5601 | int main(void); | |
5602 | // Use a haystack that the compiler shouldn't be able to constant fold | |
5603 | char *haystack = (char*)&main; | |
5604 | int main(void) { return strchrnul(haystack, 'x') != &haystack[6]; } | |
5605 | EOF | |
5606 | if compile_prog "" "" ; then | |
5607 | strchrnul=yes | |
5608 | fi | |
5609 | ||
8a792b03 JX |
5610 | ######################################### |
5611 | # check if we have st_atim | |
5612 | ||
5613 | st_atim=no | |
5614 | cat > $TMPC << EOF | |
5615 | #include <sys/stat.h> | |
5616 | #include <stddef.h> | |
5617 | int main(void) { return offsetof(struct stat, st_atim); } | |
5618 | EOF | |
5619 | if compile_prog "" "" ; then | |
5620 | st_atim=yes | |
5621 | fi | |
5622 | ||
94a420b1 SH |
5623 | ########################################## |
5624 | # check if trace backend exists | |
5625 | ||
5b808275 | 5626 | $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null |
94a420b1 | 5627 | if test "$?" -ne 0 ; then |
5b808275 LV |
5628 | error_exit "invalid trace backends" \ |
5629 | "Please choose supported trace backends." | |
94a420b1 SH |
5630 | fi |
5631 | ||
7e24e92a SH |
5632 | ########################################## |
5633 | # For 'ust' backend, test if ust headers are present | |
5b808275 | 5634 | if have_backend "ust"; then |
7e24e92a | 5635 | cat > $TMPC << EOF |
bf15f63c | 5636 | #include <lttng/tracepoint.h> |
7e24e92a SH |
5637 | int main(void) { return 0; } |
5638 | EOF | |
c79ed23d | 5639 | if compile_prog "" "-Wl,--no-as-needed -ldl" ; then |
bf15f63c | 5640 | if $pkg_config lttng-ust --exists; then |
89138857 | 5641 | lttng_ust_libs=$($pkg_config --libs lttng-ust) |
bf15f63c | 5642 | else |
c79ed23d | 5643 | lttng_ust_libs="-llttng-ust -ldl" |
bf15f63c MG |
5644 | fi |
5645 | if $pkg_config liburcu-bp --exists; then | |
89138857 | 5646 | urcu_bp_libs=$($pkg_config --libs liburcu-bp) |
bf15f63c MG |
5647 | else |
5648 | urcu_bp_libs="-lurcu-bp" | |
5649 | fi | |
5650 | ||
5651 | LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS" | |
5652 | libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga" | |
7e24e92a | 5653 | else |
bf15f63c | 5654 | error_exit "Trace backend 'ust' missing lttng-ust header files" |
7e24e92a SH |
5655 | fi |
5656 | fi | |
b3d08c02 DB |
5657 | |
5658 | ########################################## | |
5659 | # For 'dtrace' backend, test if 'dtrace' command is present | |
5b808275 | 5660 | if have_backend "dtrace"; then |
b3d08c02 | 5661 | if ! has 'dtrace' ; then |
76ad07a4 | 5662 | error_exit "dtrace command is not found in PATH $PATH" |
b3d08c02 | 5663 | fi |
c276b17d DB |
5664 | trace_backend_stap="no" |
5665 | if has 'stap' ; then | |
5666 | trace_backend_stap="yes" | |
5667 | fi | |
b3d08c02 DB |
5668 | fi |
5669 | ||
023367e6 | 5670 | ########################################## |
519175a2 | 5671 | # check and set a backend for coroutine |
d0e2fce5 | 5672 | |
7c2acc70 | 5673 | # We prefer ucontext, but it's not always possible. The fallback |
33c53c54 DB |
5674 | # is sigcontext. On Windows the only valid backend is the Windows |
5675 | # specific one. | |
7c2acc70 PM |
5676 | |
5677 | ucontext_works=no | |
5678 | if test "$darwin" != "yes"; then | |
5679 | cat > $TMPC << EOF | |
d0e2fce5 | 5680 | #include <ucontext.h> |
cdf84806 PM |
5681 | #ifdef __stub_makecontext |
5682 | #error Ignoring glibc stub makecontext which will always fail | |
5683 | #endif | |
75cafad7 | 5684 | int main(void) { makecontext(0, 0, 0); return 0; } |
d0e2fce5 | 5685 | EOF |
7c2acc70 PM |
5686 | if compile_prog "" "" ; then |
5687 | ucontext_works=yes | |
5688 | fi | |
5689 | fi | |
5690 | ||
5691 | if test "$coroutine" = ""; then | |
5692 | if test "$mingw32" = "yes"; then | |
5693 | coroutine=win32 | |
5694 | elif test "$ucontext_works" = "yes"; then | |
5695 | coroutine=ucontext | |
5696 | else | |
5697 | coroutine=sigaltstack | |
d0e2fce5 | 5698 | fi |
519175a2 | 5699 | else |
7c2acc70 PM |
5700 | case $coroutine in |
5701 | windows) | |
5702 | if test "$mingw32" != "yes"; then | |
5703 | error_exit "'windows' coroutine backend only valid for Windows" | |
5704 | fi | |
5705 | # Unfortunately the user visible backend name doesn't match the | |
5706 | # coroutine-*.c filename for this case, so we have to adjust it here. | |
5707 | coroutine=win32 | |
5708 | ;; | |
5709 | ucontext) | |
5710 | if test "$ucontext_works" != "yes"; then | |
5711 | feature_not_found "ucontext" | |
5712 | fi | |
5713 | ;; | |
33c53c54 | 5714 | sigaltstack) |
7c2acc70 PM |
5715 | if test "$mingw32" = "yes"; then |
5716 | error_exit "only the 'windows' coroutine backend is valid for Windows" | |
5717 | fi | |
5718 | ;; | |
5719 | *) | |
5720 | error_exit "unknown coroutine backend $coroutine" | |
5721 | ;; | |
5722 | esac | |
d0e2fce5 AK |
5723 | fi |
5724 | ||
70c60c08 | 5725 | if test "$coroutine_pool" = ""; then |
33c53c54 | 5726 | coroutine_pool=yes |
70c60c08 SH |
5727 | fi |
5728 | ||
7d992e4d | 5729 | if test "$debug_stack_usage" = "yes"; then |
7d992e4d PL |
5730 | if test "$coroutine_pool" = "yes"; then |
5731 | echo "WARN: disabling coroutine pool for stack usage debugging" | |
5732 | coroutine_pool=no | |
5733 | fi | |
5734 | fi | |
5735 | ||
1e4f6065 DB |
5736 | ################################################## |
5737 | # SafeStack | |
5738 | ||
5739 | ||
5740 | if test "$safe_stack" = "yes"; then | |
5741 | cat > $TMPC << EOF | |
5742 | int main(int argc, char *argv[]) | |
5743 | { | |
5744 | #if ! __has_feature(safe_stack) | |
5745 | #error SafeStack Disabled | |
5746 | #endif | |
5747 | return 0; | |
5748 | } | |
5749 | EOF | |
5750 | flag="-fsanitize=safe-stack" | |
5751 | # Check that safe-stack is supported and enabled. | |
5752 | if compile_prog "-Werror $flag" "$flag"; then | |
5753 | # Flag needed both at compilation and at linking | |
5754 | QEMU_CFLAGS="$QEMU_CFLAGS $flag" | |
5755 | QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" | |
5756 | else | |
5757 | error_exit "SafeStack not supported by your compiler" | |
5758 | fi | |
5759 | if test "$coroutine" != "ucontext"; then | |
5760 | error_exit "SafeStack is only supported by the coroutine backend ucontext" | |
5761 | fi | |
5762 | else | |
5763 | cat > $TMPC << EOF | |
5764 | int main(int argc, char *argv[]) | |
5765 | { | |
5766 | #if defined(__has_feature) | |
5767 | #if __has_feature(safe_stack) | |
5768 | #error SafeStack Enabled | |
5769 | #endif | |
5770 | #endif | |
5771 | return 0; | |
5772 | } | |
5773 | EOF | |
5774 | if test "$safe_stack" = "no"; then | |
5775 | # Make sure that safe-stack is disabled | |
5776 | if ! compile_prog "-Werror" ""; then | |
5777 | # SafeStack was already enabled, try to explicitly remove the feature | |
5778 | flag="-fno-sanitize=safe-stack" | |
5779 | if ! compile_prog "-Werror $flag" "$flag"; then | |
5780 | error_exit "Configure cannot disable SafeStack" | |
5781 | fi | |
5782 | QEMU_CFLAGS="$QEMU_CFLAGS $flag" | |
5783 | QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" | |
5784 | fi | |
5785 | else # "$safe_stack" = "" | |
5786 | # Set safe_stack to yes or no based on pre-existing flags | |
5787 | if compile_prog "-Werror" ""; then | |
5788 | safe_stack="no" | |
5789 | else | |
5790 | safe_stack="yes" | |
5791 | if test "$coroutine" != "ucontext"; then | |
5792 | error_exit "SafeStack is only supported by the coroutine backend ucontext" | |
5793 | fi | |
5794 | fi | |
5795 | fi | |
5796 | fi | |
7d992e4d | 5797 | |
d2042378 AK |
5798 | ########################################## |
5799 | # check if we have open_by_handle_at | |
5800 | ||
4e1797f9 | 5801 | open_by_handle_at=no |
d2042378 AK |
5802 | cat > $TMPC << EOF |
5803 | #include <fcntl.h> | |
acc55ba8 SW |
5804 | #if !defined(AT_EMPTY_PATH) |
5805 | # error missing definition | |
5806 | #else | |
75cafad7 | 5807 | int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } |
acc55ba8 | 5808 | #endif |
d2042378 AK |
5809 | EOF |
5810 | if compile_prog "" "" ; then | |
5811 | open_by_handle_at=yes | |
5812 | fi | |
5813 | ||
e06a765e HPB |
5814 | ######################################## |
5815 | # check if we have linux/magic.h | |
5816 | ||
5817 | linux_magic_h=no | |
5818 | cat > $TMPC << EOF | |
5819 | #include <linux/magic.h> | |
5820 | int main(void) { | |
75cafad7 | 5821 | return 0; |
e06a765e HPB |
5822 | } |
5823 | EOF | |
5824 | if compile_prog "" "" ; then | |
5825 | linux_magic_h=yes | |
5826 | fi | |
5827 | ||
3f4349dc | 5828 | ######################################## |
541be927 | 5829 | # check if we have valgrind/valgrind.h |
3f4349dc KW |
5830 | |
5831 | valgrind_h=no | |
5832 | cat > $TMPC << EOF | |
5833 | #include <valgrind/valgrind.h> | |
3f4349dc | 5834 | int main(void) { |
3f4349dc KW |
5835 | return 0; |
5836 | } | |
5837 | EOF | |
5838 | if compile_prog "" "" ; then | |
5839 | valgrind_h=yes | |
5840 | fi | |
5841 | ||
8ab1bf12 LC |
5842 | ######################################## |
5843 | # check if environ is declared | |
5844 | ||
5845 | has_environ=no | |
5846 | cat > $TMPC << EOF | |
5847 | #include <unistd.h> | |
5848 | int main(void) { | |
c075a723 | 5849 | environ = 0; |
8ab1bf12 LC |
5850 | return 0; |
5851 | } | |
5852 | EOF | |
5853 | if compile_prog "" "" ; then | |
5854 | has_environ=yes | |
5855 | fi | |
5856 | ||
76a347e1 RH |
5857 | ######################################## |
5858 | # check if cpuid.h is usable. | |
5859 | ||
76a347e1 RH |
5860 | cat > $TMPC << EOF |
5861 | #include <cpuid.h> | |
5862 | int main(void) { | |
774d566c PM |
5863 | unsigned a, b, c, d; |
5864 | int max = __get_cpuid_max(0, 0); | |
5865 | ||
5866 | if (max >= 1) { | |
5867 | __cpuid(1, a, b, c, d); | |
5868 | } | |
5869 | ||
5870 | if (max >= 7) { | |
5871 | __cpuid_count(7, 0, a, b, c, d); | |
5872 | } | |
5873 | ||
5874 | return 0; | |
76a347e1 RH |
5875 | } |
5876 | EOF | |
5877 | if compile_prog "" "" ; then | |
5878 | cpuid_h=yes | |
5879 | fi | |
5880 | ||
5dd89908 RH |
5881 | ########################################## |
5882 | # avx2 optimization requirement check | |
5883 | # | |
5884 | # There is no point enabling this if cpuid.h is not usable, | |
5885 | # since we won't be able to select the new routines. | |
5886 | ||
e633a5c6 | 5887 | if test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then |
5dd89908 RH |
5888 | cat > $TMPC << EOF |
5889 | #pragma GCC push_options | |
5890 | #pragma GCC target("avx2") | |
5891 | #include <cpuid.h> | |
5892 | #include <immintrin.h> | |
5893 | static int bar(void *a) { | |
5894 | __m256i x = *(__m256i *)a; | |
5895 | return _mm256_testz_si256(x, x); | |
5896 | } | |
5897 | int main(int argc, char *argv[]) { return bar(argv[0]); } | |
5898 | EOF | |
5899 | if compile_object "" ; then | |
5900 | avx2_opt="yes" | |
86583a07 LM |
5901 | else |
5902 | avx2_opt="no" | |
5dd89908 RH |
5903 | fi |
5904 | fi | |
5905 | ||
6b8cd447 RH |
5906 | ########################################## |
5907 | # avx512f optimization requirement check | |
5908 | # | |
5909 | # There is no point enabling this if cpuid.h is not usable, | |
5910 | # since we won't be able to select the new routines. | |
5911 | # by default, it is turned off. | |
5912 | # if user explicitly want to enable it, check environment | |
5913 | ||
5914 | if test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then | |
5915 | cat > $TMPC << EOF | |
5916 | #pragma GCC push_options | |
5917 | #pragma GCC target("avx512f") | |
5918 | #include <cpuid.h> | |
5919 | #include <immintrin.h> | |
5920 | static int bar(void *a) { | |
5921 | __m512i x = *(__m512i *)a; | |
5922 | return _mm512_test_epi64_mask(x, x); | |
5923 | } | |
5924 | int main(int argc, char *argv[]) | |
5925 | { | |
5926 | return bar(argv[0]); | |
5927 | } | |
5928 | EOF | |
5929 | if ! compile_object "" ; then | |
5930 | avx512f_opt="no" | |
5931 | fi | |
5932 | else | |
5933 | avx512f_opt="no" | |
5934 | fi | |
5935 | ||
f540166b RH |
5936 | ######################################## |
5937 | # check if __[u]int128_t is usable. | |
5938 | ||
5939 | int128=no | |
5940 | cat > $TMPC << EOF | |
5941 | __int128_t a; | |
5942 | __uint128_t b; | |
5943 | int main (void) { | |
5944 | a = a + b; | |
5945 | b = a * b; | |
464e3671 | 5946 | a = a * a; |
f540166b RH |
5947 | return 0; |
5948 | } | |
5949 | EOF | |
5950 | if compile_prog "" "" ; then | |
5951 | int128=yes | |
5952 | fi | |
76a347e1 | 5953 | |
7ebee43e RH |
5954 | ######################################### |
5955 | # See if 128-bit atomic operations are supported. | |
5956 | ||
5957 | atomic128=no | |
5958 | if test "$int128" = "yes"; then | |
5959 | cat > $TMPC << EOF | |
5960 | int main(void) | |
5961 | { | |
5962 | unsigned __int128 x = 0, y = 0; | |
5963 | y = __atomic_load_16(&x, 0); | |
5964 | __atomic_store_16(&x, y, 0); | |
5965 | __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0); | |
5966 | return 0; | |
5967 | } | |
5968 | EOF | |
5969 | if compile_prog "" "" ; then | |
5970 | atomic128=yes | |
5971 | fi | |
5972 | fi | |
5973 | ||
e6cd4bb5 | 5974 | cmpxchg128=no |
e633a5c6 | 5975 | if test "$int128" = yes && test "$atomic128" = no; then |
e6cd4bb5 RH |
5976 | cat > $TMPC << EOF |
5977 | int main(void) | |
5978 | { | |
5979 | unsigned __int128 x = 0, y = 0; | |
5980 | __sync_val_compare_and_swap_16(&x, y, x); | |
5981 | return 0; | |
5982 | } | |
5983 | EOF | |
5984 | if compile_prog "" "" ; then | |
5985 | cmpxchg128=yes | |
5986 | fi | |
5987 | fi | |
5988 | ||
df79b996 RH |
5989 | ######################################### |
5990 | # See if 64-bit atomic operations are supported. | |
5991 | # Note that without __atomic builtins, we can only | |
5992 | # assume atomic loads/stores max at pointer size. | |
5993 | ||
5994 | cat > $TMPC << EOF | |
5995 | #include <stdint.h> | |
5996 | int main(void) | |
5997 | { | |
5998 | uint64_t x = 0, y = 0; | |
5999 | #ifdef __ATOMIC_RELAXED | |
6000 | y = __atomic_load_8(&x, 0); | |
6001 | __atomic_store_8(&x, y, 0); | |
6002 | __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0); | |
6003 | __atomic_exchange_8(&x, y, 0); | |
6004 | __atomic_fetch_add_8(&x, y, 0); | |
6005 | #else | |
6006 | typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1]; | |
6007 | __sync_lock_test_and_set(&x, y); | |
6008 | __sync_val_compare_and_swap(&x, y, 0); | |
6009 | __sync_fetch_and_add(&x, y); | |
6010 | #endif | |
6011 | return 0; | |
6012 | } | |
6013 | EOF | |
6014 | if compile_prog "" "" ; then | |
6015 | atomic64=yes | |
6016 | fi | |
6017 | ||
26fffe29 EC |
6018 | ######################################### |
6019 | # See if --dynamic-list is supported by the linker | |
6020 | ld_dynamic_list="no" | |
6021 | if test "$static" = "no" ; then | |
6022 | cat > $TMPTXT <<EOF | |
6023 | { | |
6024 | foo; | |
6025 | }; | |
6026 | EOF | |
6027 | ||
6028 | cat > $TMPC <<EOF | |
6029 | #include <stdio.h> | |
6030 | void foo(void); | |
6031 | ||
6032 | void foo(void) | |
6033 | { | |
6034 | printf("foo\n"); | |
6035 | } | |
6036 | ||
6037 | int main(void) | |
6038 | { | |
6039 | foo(); | |
6040 | return 0; | |
6041 | } | |
6042 | EOF | |
6043 | ||
6044 | if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then | |
6045 | ld_dynamic_list="yes" | |
6046 | fi | |
6047 | fi | |
6048 | ||
6049 | ######################################### | |
6050 | # See if -exported_symbols_list is supported by the linker | |
6051 | ||
6052 | ld_exported_symbols_list="no" | |
6053 | if test "$static" = "no" ; then | |
6054 | cat > $TMPTXT <<EOF | |
6055 | _foo | |
6056 | EOF | |
6057 | ||
6058 | if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then | |
6059 | ld_exported_symbols_list="yes" | |
6060 | fi | |
6061 | fi | |
6062 | ||
6063 | if test "$plugins" = "yes" && | |
6064 | test "$ld_dynamic_list" = "no" && | |
6065 | test "$ld_exported_symbols_list" = "no" ; then | |
6066 | error_exit \ | |
6067 | "Plugin support requires dynamic linking and specifying a set of symbols " \ | |
6068 | "that are exported to plugins. Unfortunately your linker doesn't " \ | |
6069 | "support the flag (--dynamic-list or -exported_symbols_list) used " \ | |
6070 | "for this purpose. You can't build with --static." | |
6071 | fi | |
6072 | ||
db8aaae8 RH |
6073 | ######################################## |
6074 | # See if __attribute__((alias)) is supported. | |
6075 | # This false for Xcode 9, but has been remedied for Xcode 10. | |
6076 | # Unfortunately, travis uses Xcode 9 by default. | |
6077 | ||
6078 | attralias=no | |
6079 | cat > $TMPC << EOF | |
6080 | int x = 1; | |
6081 | extern const int y __attribute__((alias("x"))); | |
6082 | int main(void) { return 0; } | |
6083 | EOF | |
6084 | if compile_prog "" "" ; then | |
6085 | attralias=yes | |
6086 | fi | |
6087 | ||
1e6e9aca RH |
6088 | ######################################## |
6089 | # check if getauxval is available. | |
6090 | ||
6091 | getauxval=no | |
6092 | cat > $TMPC << EOF | |
6093 | #include <sys/auxv.h> | |
6094 | int main(void) { | |
6095 | return getauxval(AT_HWCAP) == 0; | |
6096 | } | |
6097 | EOF | |
6098 | if compile_prog "" "" ; then | |
6099 | getauxval=yes | |
6100 | fi | |
6101 | ||
fd0e6053 JS |
6102 | ######################################## |
6103 | # check if ccache is interfering with | |
6104 | # semantic analysis of macros | |
6105 | ||
5e4dfd3d | 6106 | unset CCACHE_CPP2 |
fd0e6053 JS |
6107 | ccache_cpp2=no |
6108 | cat > $TMPC << EOF | |
6109 | static const int Z = 1; | |
6110 | #define fn() ({ Z; }) | |
6111 | #define TAUT(X) ((X) == Z) | |
6112 | #define PAREN(X, Y) (X == Y) | |
6113 | #define ID(X) (X) | |
6114 | int main(int argc, char *argv[]) | |
6115 | { | |
6116 | int x = 0, y = 0; | |
6117 | x = ID(x); | |
6118 | x = fn(); | |
6119 | fn(); | |
6120 | if (PAREN(x, y)) return 0; | |
6121 | if (TAUT(Z)) return 0; | |
6122 | return 0; | |
6123 | } | |
6124 | EOF | |
6125 | ||
6126 | if ! compile_object "-Werror"; then | |
6127 | ccache_cpp2=yes | |
6128 | fi | |
6129 | ||
b553a042 JS |
6130 | ################################################# |
6131 | # clang does not support glibc + FORTIFY_SOURCE. | |
6132 | ||
6133 | if test "$fortify_source" != "no"; then | |
6134 | if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then | |
6135 | fortify_source="no"; | |
e189091f | 6136 | elif test -n "$cxx" && has $cxx && |
cfcc7c14 | 6137 | echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then |
b553a042 JS |
6138 | fortify_source="no"; |
6139 | else | |
6140 | fortify_source="yes" | |
6141 | fi | |
6142 | fi | |
6143 | ||
1efad060 FZ |
6144 | ############################################### |
6145 | # Check if copy_file_range is provided by glibc | |
6146 | have_copy_file_range=no | |
6147 | cat > $TMPC << EOF | |
6148 | #include <unistd.h> | |
6149 | int main(void) { | |
6150 | copy_file_range(0, NULL, 0, NULL, 0, 0); | |
6151 | return 0; | |
6152 | } | |
6153 | EOF | |
6154 | if compile_prog "" "" ; then | |
6155 | have_copy_file_range=yes | |
6156 | fi | |
6157 | ||
277abf15 JV |
6158 | ########################################## |
6159 | # check if struct fsxattr is available via linux/fs.h | |
6160 | ||
6161 | have_fsxattr=no | |
6162 | cat > $TMPC << EOF | |
6163 | #include <linux/fs.h> | |
6164 | struct fsxattr foo; | |
6165 | int main(void) { | |
6166 | return 0; | |
6167 | } | |
6168 | EOF | |
6169 | if compile_prog "" "" ; then | |
6170 | have_fsxattr=yes | |
6171 | fi | |
6172 | ||
a40161cb PB |
6173 | ########################################## |
6174 | # check for usable membarrier system call | |
6175 | if test "$membarrier" = "yes"; then | |
6176 | have_membarrier=no | |
6177 | if test "$mingw32" = "yes" ; then | |
6178 | have_membarrier=yes | |
6179 | elif test "$linux" = "yes" ; then | |
6180 | cat > $TMPC << EOF | |
6181 | #include <linux/membarrier.h> | |
6182 | #include <sys/syscall.h> | |
6183 | #include <unistd.h> | |
6184 | #include <stdlib.h> | |
6185 | int main(void) { | |
6186 | syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); | |
6187 | syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); | |
6188 | exit(0); | |
6189 | } | |
6190 | EOF | |
6191 | if compile_prog "" "" ; then | |
6192 | have_membarrier=yes | |
6193 | fi | |
6194 | fi | |
6195 | if test "$have_membarrier" = "no"; then | |
6196 | feature_not_found "membarrier" "membarrier system call not available" | |
6197 | fi | |
6198 | else | |
6199 | # Do not enable it by default even for Mingw32, because it doesn't | |
6200 | # work on Wine. | |
6201 | membarrier=no | |
6202 | fi | |
6203 | ||
b66e10e4 PM |
6204 | ########################################## |
6205 | # check if rtnetlink.h exists and is useful | |
575b22b1 LV |
6206 | have_rtnetlink=no |
6207 | cat > $TMPC << EOF | |
6208 | #include <linux/rtnetlink.h> | |
6209 | int main(void) { | |
6210 | return IFLA_PROTO_DOWN; | |
6211 | } | |
6212 | EOF | |
6213 | if compile_prog "" "" ; then | |
6214 | have_rtnetlink=yes | |
6215 | fi | |
6216 | ||
6a02c806 SH |
6217 | ########################################## |
6218 | # check for usable AF_VSOCK environment | |
6219 | have_af_vsock=no | |
6220 | cat > $TMPC << EOF | |
6221 | #include <errno.h> | |
6222 | #include <sys/types.h> | |
6223 | #include <sys/socket.h> | |
6224 | #if !defined(AF_VSOCK) | |
6225 | # error missing AF_VSOCK flag | |
6226 | #endif | |
6227 | #include <linux/vm_sockets.h> | |
6228 | int main(void) { | |
6229 | int sock, ret; | |
6230 | struct sockaddr_vm svm; | |
6231 | socklen_t len = sizeof(svm); | |
6232 | sock = socket(AF_VSOCK, SOCK_STREAM, 0); | |
6233 | ret = getpeername(sock, (struct sockaddr *)&svm, &len); | |
6234 | if ((ret == -1) && (errno == ENOTCONN)) { | |
6235 | return 0; | |
6236 | } | |
6237 | return -1; | |
6238 | } | |
6239 | EOF | |
6240 | if compile_prog "" "" ; then | |
6241 | have_af_vsock=yes | |
6242 | fi | |
6243 | ||
f0d92b56 LM |
6244 | ########################################## |
6245 | # check for usable AF_ALG environment | |
4f67366e | 6246 | have_afalg=no |
f0d92b56 LM |
6247 | cat > $TMPC << EOF |
6248 | #include <errno.h> | |
6249 | #include <sys/types.h> | |
6250 | #include <sys/socket.h> | |
6251 | #include <linux/if_alg.h> | |
6252 | int main(void) { | |
6253 | int sock; | |
6254 | sock = socket(AF_ALG, SOCK_SEQPACKET, 0); | |
6255 | return sock; | |
6256 | } | |
6257 | EOF | |
6258 | if compile_prog "" "" ; then | |
6259 | have_afalg=yes | |
6260 | fi | |
6261 | if test "$crypto_afalg" = "yes" | |
6262 | then | |
6263 | if test "$have_afalg" != "yes" | |
6264 | then | |
6265 | error_exit "AF_ALG requested but could not be detected" | |
6266 | fi | |
6267 | fi | |
6268 | ||
6269 | ||
c97d6d2c SAGDR |
6270 | ################################################# |
6271 | # Check to see if we have the Hypervisor framework | |
d2d08522 | 6272 | if [ "$darwin" = "yes" ] ; then |
c97d6d2c SAGDR |
6273 | cat > $TMPC << EOF |
6274 | #include <Hypervisor/hv.h> | |
6275 | int main() { return 0;} | |
6276 | EOF | |
6277 | if ! compile_object ""; then | |
6278 | hvf='no' | |
6279 | else | |
6280 | hvf='yes' | |
db5adeaa | 6281 | QEMU_LDFLAGS="-framework Hypervisor $QEMU_LDFLAGS" |
c97d6d2c SAGDR |
6282 | fi |
6283 | fi | |
6284 | ||
6969ec6c JC |
6285 | ################################################# |
6286 | # Sparc implicitly links with --relax, which is | |
6287 | # incompatible with -r, so --no-relax should be | |
6288 | # given. It does no harm to give it on other | |
6289 | # platforms too. | |
6290 | ||
6291 | # Note: the prototype is needed since QEMU_CFLAGS | |
6292 | # contains -Wmissing-prototypes | |
6293 | cat > $TMPC << EOF | |
6294 | extern int foo(void); | |
6295 | int foo(void) { return 0; } | |
6296 | EOF | |
6297 | if ! compile_object ""; then | |
6298 | error_exit "Failed to compile object file for LD_REL_FLAGS test" | |
6299 | fi | |
7ecf44a5 PB |
6300 | for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do |
6301 | if do_cc -nostdlib $i -o $TMPMO $TMPO; then | |
6302 | LD_REL_FLAGS=$i | |
6303 | break | |
6304 | fi | |
6305 | done | |
6306 | if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then | |
6307 | feature_not_found "modules" "Cannot find how to build relocatable objects" | |
6969ec6c JC |
6308 | fi |
6309 | ||
4d04351f CC |
6310 | ########################################## |
6311 | # check for sysmacros.h | |
6312 | ||
6313 | have_sysmacros=no | |
6314 | cat > $TMPC << EOF | |
6315 | #include <sys/sysmacros.h> | |
6316 | int main(void) { | |
6317 | return makedev(0, 0); | |
6318 | } | |
6319 | EOF | |
6320 | if compile_prog "" "" ; then | |
6321 | have_sysmacros=yes | |
6322 | fi | |
6323 | ||
49e00a18 AG |
6324 | ########################################## |
6325 | # check for _Static_assert() | |
6326 | ||
6327 | have_static_assert=no | |
6328 | cat > $TMPC << EOF | |
6329 | _Static_assert(1, "success"); | |
6330 | int main(void) { | |
6331 | return 0; | |
6332 | } | |
6333 | EOF | |
6334 | if compile_prog "" "" ; then | |
6335 | have_static_assert=yes | |
6336 | fi | |
6337 | ||
e674605f TG |
6338 | ########################################## |
6339 | # check for utmpx.h, it is missing e.g. on OpenBSD | |
6340 | ||
6341 | have_utmpx=no | |
6342 | cat > $TMPC << EOF | |
6343 | #include <utmpx.h> | |
6344 | struct utmpx user_info; | |
6345 | int main(void) { | |
6346 | return 0; | |
6347 | } | |
6348 | EOF | |
6349 | if compile_prog "" "" ; then | |
6350 | have_utmpx=yes | |
6351 | fi | |
6352 | ||
db1ed1ab RH |
6353 | ########################################## |
6354 | # check for getrandom() | |
6355 | ||
6356 | have_getrandom=no | |
6357 | cat > $TMPC << EOF | |
6358 | #include <sys/random.h> | |
6359 | int main(void) { | |
6360 | return getrandom(0, 0, GRND_NONBLOCK); | |
6361 | } | |
6362 | EOF | |
6363 | if compile_prog "" "" ; then | |
6364 | have_getrandom=yes | |
6365 | fi | |
6366 | ||
247724cb MAL |
6367 | ########################################## |
6368 | # checks for sanitizers | |
6369 | ||
247724cb MAL |
6370 | have_asan=no |
6371 | have_ubsan=no | |
d83414e1 MAL |
6372 | have_asan_iface_h=no |
6373 | have_asan_iface_fiber=no | |
247724cb MAL |
6374 | |
6375 | if test "$sanitizers" = "yes" ; then | |
b9f44da2 | 6376 | write_c_skeleton |
247724cb MAL |
6377 | if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then |
6378 | have_asan=yes | |
6379 | fi | |
b9f44da2 MAL |
6380 | |
6381 | # we could use a simple skeleton for flags checks, but this also | |
6382 | # detect the static linking issue of ubsan, see also: | |
6383 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 | |
6384 | cat > $TMPC << EOF | |
6385 | #include <stdlib.h> | |
6386 | int main(void) { | |
6387 | void *tmp = malloc(10); | |
f2dfe54c LB |
6388 | if (tmp != NULL) { |
6389 | return *(int *)(tmp + 2); | |
6390 | } | |
d1abf3fc | 6391 | return 1; |
b9f44da2 MAL |
6392 | } |
6393 | EOF | |
247724cb MAL |
6394 | if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then |
6395 | have_ubsan=yes | |
6396 | fi | |
d83414e1 MAL |
6397 | |
6398 | if check_include "sanitizer/asan_interface.h" ; then | |
6399 | have_asan_iface_h=yes | |
6400 | fi | |
6401 | ||
6402 | cat > $TMPC << EOF | |
6403 | #include <sanitizer/asan_interface.h> | |
6404 | int main(void) { | |
6405 | __sanitizer_start_switch_fiber(0, 0, 0); | |
6406 | return 0; | |
6407 | } | |
6408 | EOF | |
6409 | if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then | |
6410 | have_asan_iface_fiber=yes | |
6411 | fi | |
247724cb MAL |
6412 | fi |
6413 | ||
adc28027 AB |
6414 | ########################################## |
6415 | # checks for fuzzer | |
6416 | if test "$fuzzing" = "yes" ; then | |
6417 | write_c_fuzzer_skeleton | |
dd016265 | 6418 | if compile_prog "$CPU_CFLAGS -Werror -fsanitize=fuzzer" ""; then |
adc28027 AB |
6419 | have_fuzzer=yes |
6420 | fi | |
6421 | fi | |
6422 | ||
0aebab04 LY |
6423 | # Thread sanitizer is, for now, much noisier than the other sanitizers; |
6424 | # keep it separate until that is not the case. | |
6425 | if test "$tsan" = "yes" && test "$sanitizers" = "yes"; then | |
6426 | error_exit "TSAN is not supported with other sanitiziers." | |
6427 | fi | |
6428 | have_tsan=no | |
6429 | have_tsan_iface_fiber=no | |
6430 | if test "$tsan" = "yes" ; then | |
6431 | write_c_skeleton | |
6432 | if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then | |
6433 | have_tsan=yes | |
6434 | fi | |
6435 | cat > $TMPC << EOF | |
6436 | #include <sanitizer/tsan_interface.h> | |
6437 | int main(void) { | |
6438 | __tsan_create_fiber(0); | |
6439 | return 0; | |
6440 | } | |
6441 | EOF | |
6442 | if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then | |
6443 | have_tsan_iface_fiber=yes | |
6444 | fi | |
6445 | fi | |
6446 | ||
17824406 JH |
6447 | ########################################## |
6448 | # check for libpmem | |
6449 | ||
6450 | if test "$libpmem" != "no"; then | |
6451 | if $pkg_config --exists "libpmem"; then | |
6452 | libpmem="yes" | |
6453 | libpmem_libs=$($pkg_config --libs libpmem) | |
6454 | libpmem_cflags=$($pkg_config --cflags libpmem) | |
6455 | libs_softmmu="$libs_softmmu $libpmem_libs" | |
6456 | QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags" | |
6457 | else | |
6458 | if test "$libpmem" = "yes" ; then | |
6459 | feature_not_found "libpmem" "Install nvml or pmdk" | |
6460 | fi | |
6461 | libpmem="no" | |
6462 | fi | |
6463 | fi | |
6464 | ||
21b2eca6 JL |
6465 | ########################################## |
6466 | # check for libdaxctl | |
6467 | ||
6468 | if test "$libdaxctl" != "no"; then | |
6469 | if $pkg_config --atleast-version=57 "libdaxctl"; then | |
6470 | libdaxctl="yes" | |
6471 | libdaxctl_libs=$($pkg_config --libs libdaxctl) | |
6472 | libdaxctl_cflags=$($pkg_config --cflags libdaxctl) | |
6473 | libs_softmmu="$libs_softmmu $libdaxctl_libs" | |
6474 | QEMU_CFLAGS="$QEMU_CFLAGS $libdaxctl_cflags" | |
6475 | else | |
6476 | if test "$libdaxctl" = "yes" ; then | |
6477 | feature_not_found "libdaxctl" "Install libdaxctl" | |
6478 | fi | |
6479 | libdaxctl="no" | |
6480 | fi | |
6481 | fi | |
6482 | ||
675b9b53 MAL |
6483 | ########################################## |
6484 | # check for slirp | |
6485 | ||
d599938a LV |
6486 | # slirp is only required when building softmmu targets |
6487 | if test -z "$slirp" -a "$softmmu" != "yes" ; then | |
6488 | slirp="no" | |
6489 | fi | |
6490 | ||
675b9b53 MAL |
6491 | case "$slirp" in |
6492 | "" | yes) | |
6493 | if $pkg_config slirp; then | |
6494 | slirp=system | |
7c57bdd8 MAL |
6495 | elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then |
6496 | slirp=git | |
675b9b53 MAL |
6497 | elif test -e "${source_path}/slirp/Makefile" ; then |
6498 | slirp=internal | |
6499 | elif test -z "$slirp" ; then | |
6500 | slirp=no | |
6501 | else | |
6502 | feature_not_found "slirp" "Install slirp devel or git submodule" | |
6503 | fi | |
6504 | ;; | |
6505 | ||
6506 | system) | |
6507 | if ! $pkg_config slirp; then | |
6508 | feature_not_found "slirp" "Install slirp devel" | |
6509 | fi | |
6510 | ;; | |
6511 | esac | |
6512 | ||
6513 | case "$slirp" in | |
7c57bdd8 MAL |
6514 | git | internal) |
6515 | if test "$slirp" = git; then | |
6516 | git_submodules="${git_submodules} slirp" | |
6517 | fi | |
675b9b53 | 6518 | mkdir -p slirp |
25211446 PB |
6519 | slirp_cflags="-I${source_path}/slirp/src -I$PWD/slirp/src" |
6520 | slirp_libs="-L$PWD/slirp -lslirp" | |
b965e8c5 PB |
6521 | if test "$mingw32" = "yes" ; then |
6522 | slirp_libs="$slirp_libs -lws2_32 -liphlpapi" | |
6523 | fi | |
675b9b53 MAL |
6524 | ;; |
6525 | ||
6526 | system) | |
6527 | slirp_version=$($pkg_config --modversion slirp 2>/dev/null) | |
6528 | slirp_cflags=$($pkg_config --cflags slirp 2>/dev/null) | |
6529 | slirp_libs=$($pkg_config --libs slirp 2>/dev/null) | |
6530 | ;; | |
6531 | ||
6532 | no) | |
6533 | ;; | |
6534 | *) | |
6535 | error_exit "Unknown state for slirp: $slirp" | |
6536 | ;; | |
6537 | esac | |
6538 | ||
54e7aac0 AK |
6539 | ########################################## |
6540 | # check for usable __NR_keyctl syscall | |
6541 | ||
6542 | if test "$linux" = "yes" ; then | |
6543 | ||
6544 | have_keyring=no | |
6545 | cat > $TMPC << EOF | |
6546 | #include <errno.h> | |
6547 | #include <asm/unistd.h> | |
6548 | #include <linux/keyctl.h> | |
6549 | #include <unistd.h> | |
6550 | int main(void) { | |
6551 | return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0); | |
6552 | } | |
6553 | EOF | |
6554 | if compile_prog "" "" ; then | |
6555 | have_keyring=yes | |
6556 | fi | |
6557 | fi | |
6558 | if test "$secret_keyring" != "no" | |
6559 | then | |
b418d265 | 6560 | if test "$have_keyring" = "yes" |
54e7aac0 AK |
6561 | then |
6562 | secret_keyring=yes | |
6563 | else | |
6564 | if test "$secret_keyring" = "yes" | |
6565 | then | |
6566 | error_exit "syscall __NR_keyctl requested, \ | |
6567 | but not implemented on your system" | |
6568 | else | |
6569 | secret_keyring=no | |
6570 | fi | |
6571 | fi | |
6572 | fi | |
6573 | ||
92500362 AK |
6574 | ########################################## |
6575 | # check for usable keyutils.h | |
6576 | ||
6577 | if test "$linux" = "yes" ; then | |
6578 | ||
6579 | have_keyutils=no | |
6580 | cat > $TMPC << EOF | |
6581 | #include <errno.h> | |
6582 | #include <asm/unistd.h> | |
6583 | #include <unistd.h> | |
6584 | #include <sys/types.h> | |
6585 | #include <keyutils.h> | |
6586 | int main(void) { | |
6587 | return request_key("user", NULL, NULL, 0); | |
6588 | } | |
6589 | EOF | |
6590 | if compile_prog "" "-lkeyutils"; then | |
6591 | have_keyutils=yes | |
6592 | fi | |
6593 | fi | |
6594 | ||
675b9b53 | 6595 | |
7e24e92a | 6596 | ########################################## |
e86ecd4b JQ |
6597 | # End of CC checks |
6598 | # After here, no more $cc or $ld runs | |
6599 | ||
d83414e1 MAL |
6600 | write_c_skeleton |
6601 | ||
1d728c39 | 6602 | if test "$gcov" = "yes" ; then |
db5adeaa PB |
6603 | QEMU_CFLAGS="-fprofile-arcs -ftest-coverage -g $QEMU_CFLAGS" |
6604 | QEMU_LDFLAGS="-fprofile-arcs -ftest-coverage $QEMU_LDFLAGS" | |
b553a042 | 6605 | elif test "$fortify_source" = "yes" ; then |
086d5f75 PB |
6606 | QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" |
6607 | debug=no | |
6608 | fi | |
086d5f75 PB |
6609 | if test "$debug_info" = "yes"; then |
6610 | CFLAGS="-g $CFLAGS" | |
6611 | LDFLAGS="-g $LDFLAGS" | |
6612 | fi | |
a5665051 PB |
6613 | if test "$debug" = "no"; then |
6614 | CFLAGS="-O2 $CFLAGS" | |
6615 | fi | |
086d5f75 PB |
6616 | |
6617 | case "$ARCH" in | |
6618 | alpha) | |
6619 | # Ensure there's only a single GP | |
6620 | QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS" | |
6621 | ;; | |
6622 | esac | |
6623 | ||
6624 | if test "$gprof" = "yes" ; then | |
6625 | QEMU_CFLAGS="-p $QEMU_CFLAGS" | |
6626 | QEMU_LDFLAGS="-p $QEMU_LDFLAGS" | |
6627 | fi | |
a316e378 | 6628 | |
247724cb | 6629 | if test "$have_asan" = "yes"; then |
db5adeaa PB |
6630 | QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS" |
6631 | QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS" | |
d83414e1 MAL |
6632 | if test "$have_asan_iface_h" = "no" ; then |
6633 | echo "ASAN build enabled, but ASAN header missing." \ | |
6634 | "Without code annotation, the report may be inferior." | |
6635 | elif test "$have_asan_iface_fiber" = "no" ; then | |
6636 | echo "ASAN build enabled, but ASAN header is too old." \ | |
6637 | "Without code annotation, the report may be inferior." | |
6638 | fi | |
247724cb | 6639 | fi |
0aebab04 LY |
6640 | if test "$have_tsan" = "yes" ; then |
6641 | if test "$have_tsan_iface_fiber" = "yes" ; then | |
6642 | QEMU_CFLAGS="-fsanitize=thread $QEMU_CFLAGS" | |
6643 | QEMU_LDFLAGS="-fsanitize=thread $QEMU_LDFLAGS" | |
6644 | else | |
6645 | error_exit "Cannot enable TSAN due to missing fiber annotation interface." | |
6646 | fi | |
6647 | elif test "$tsan" = "yes" ; then | |
6648 | error_exit "Cannot enable TSAN due to missing sanitize thread interface." | |
6649 | fi | |
247724cb | 6650 | if test "$have_ubsan" = "yes"; then |
db5adeaa PB |
6651 | QEMU_CFLAGS="-fsanitize=undefined $QEMU_CFLAGS" |
6652 | QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS" | |
247724cb MAL |
6653 | fi |
6654 | ||
6542aa9c PL |
6655 | ########################################## |
6656 | # Do we have libnfs | |
6657 | if test "$libnfs" != "no" ; then | |
b7d769c9 | 6658 | if $pkg_config --atleast-version=1.9.3 libnfs; then |
6542aa9c PL |
6659 | libnfs="yes" |
6660 | libnfs_libs=$($pkg_config --libs libnfs) | |
6542aa9c PL |
6661 | else |
6662 | if test "$libnfs" = "yes" ; then | |
8efc9363 | 6663 | feature_not_found "libnfs" "Install libnfs devel >= 1.9.3" |
6542aa9c PL |
6664 | fi |
6665 | libnfs="no" | |
6666 | fi | |
6667 | fi | |
1d728c39 | 6668 | |
3efac6eb TG |
6669 | ########################################## |
6670 | # Do we have libudev | |
6671 | if test "$libudev" != "no" ; then | |
6672 | if $pkg_config libudev && test "$static" != "yes"; then | |
6673 | libudev="yes" | |
6674 | libudev_libs=$($pkg_config --libs libudev) | |
6675 | else | |
6676 | libudev="no" | |
6677 | fi | |
6678 | fi | |
6679 | ||
6ca026cb PM |
6680 | # Now we've finished running tests it's OK to add -Werror to the compiler flags |
6681 | if test "$werror" = "yes"; then | |
6682 | QEMU_CFLAGS="-Werror $QEMU_CFLAGS" | |
6683 | fi | |
6684 | ||
0aebab04 LY |
6685 | # Exclude --warn-common with TSan to suppress warnings from the TSan libraries. |
6686 | if test "$solaris" = "no" && test "$tsan" = "no"; then | |
e86ecd4b | 6687 | if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then |
db5adeaa | 6688 | QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS" |
e86ecd4b JQ |
6689 | fi |
6690 | fi | |
6691 | ||
94dd53c5 GH |
6692 | # test if pod2man has --utf8 option |
6693 | if pod2man --help | grep -q utf8; then | |
6694 | POD2MAN="pod2man --utf8" | |
6695 | else | |
6696 | POD2MAN="pod2man" | |
6697 | fi | |
6698 | ||
952afb71 BS |
6699 | # Use ASLR, no-SEH and DEP if available |
6700 | if test "$mingw32" = "yes" ; then | |
6701 | for flag in --dynamicbase --no-seh --nxcompat; do | |
e9a3591f | 6702 | if ld_has $flag ; then |
db5adeaa | 6703 | QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS" |
952afb71 BS |
6704 | fi |
6705 | done | |
6706 | fi | |
6707 | ||
7776ea6b PMD |
6708 | # Disable OpenBSD W^X if available |
6709 | if test "$tcg" = "yes" && test "$targetos" = "OpenBSD"; then | |
6710 | cat > $TMPC <<EOF | |
6711 | int main(void) { return 0; } | |
6712 | EOF | |
6713 | wx_ldflags="-Wl,-z,wxneeded" | |
6714 | if compile_prog "" "$wx_ldflags"; then | |
6715 | QEMU_LDFLAGS="$QEMU_LDFLAGS $wx_ldflags" | |
6716 | fi | |
6717 | fi | |
6718 | ||
10ea68b3 | 6719 | qemu_confdir=$sysconfdir$confsuffix |
e26110cf | 6720 | qemu_moddir=$libdir$confsuffix |
528ae5b8 | 6721 | qemu_datadir=$datadir$confsuffix |
834574ea | 6722 | qemu_localedir="$datadir/locale" |
a8260d38 | 6723 | qemu_icondir="$datadir/icons" |
67ea9546 | 6724 | qemu_desktopdir="$datadir/applications" |
e7b45cc4 | 6725 | |
e0580342 KR |
6726 | # We can only support ivshmem if we have eventfd |
6727 | if [ "$eventfd" = "yes" ]; then | |
6728 | ivshmem=yes | |
6729 | fi | |
6730 | ||
4b1c11fd DB |
6731 | tools="" |
6732 | if test "$want_tools" = "yes" ; then | |
72d277a7 | 6733 | tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) qemu-edid\$(EXESUF) $tools" |
4b1c11fd | 6734 | if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then |
f353415f | 6735 | tools="qemu-nbd\$(EXESUF) qemu-storage-daemon\$(EXESUF) $tools" |
b1449edb KR |
6736 | fi |
6737 | if [ "$ivshmem" = "yes" ]; then | |
a75eb03b | 6738 | tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools" |
4b1c11fd | 6739 | fi |
1b9d35f3 VP |
6740 | if [ "$curl" = "yes" ]; then |
6741 | tools="elf2dmp\$(EXESUF) $tools" | |
3fa2d384 | 6742 | fi |
4b1c11fd DB |
6743 | fi |
6744 | if test "$softmmu" = yes ; then | |
b855f8d1 | 6745 | if test "$linux" = yes; then |
7e462613 | 6746 | if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; then |
aabfd88d | 6747 | virtfs=yes |
fdbff6bd | 6748 | helpers="$helpers fsdev/virtfs-proxy-helper\$(EXESUF)" |
aabfd88d AF |
6749 | else |
6750 | if test "$virtfs" = yes; then | |
7e462613 | 6751 | error_exit "VirtFS requires libcap-ng devel and libattr devel" |
983eef5a | 6752 | fi |
17500370 | 6753 | virtfs=no |
aabfd88d | 6754 | fi |
fe8fc5ae PB |
6755 | if test "$mpath" != no && test "$mpathpersist" = yes ; then |
6756 | mpath=yes | |
6757 | else | |
6758 | if test "$mpath" = yes; then | |
6759 | error_exit "Multipath requires libmpathpersist devel" | |
6760 | fi | |
6761 | mpath=no | |
6762 | fi | |
fdbff6bd | 6763 | helpers="$helpers scsi/qemu-pr-helper\$(EXESUF)" |
b855f8d1 PB |
6764 | else |
6765 | if test "$virtfs" = yes; then | |
6766 | error_exit "VirtFS is supported only on Linux" | |
6767 | fi | |
6768 | virtfs=no | |
fe8fc5ae PB |
6769 | if test "$mpath" = yes; then |
6770 | error_exit "Multipath is supported only on Linux" | |
6771 | fi | |
6772 | mpath=no | |
17bff52b | 6773 | fi |
ff69fd8c LV |
6774 | if test "$xkbcommon" = "yes"; then |
6775 | tools="qemu-keymap\$(EXESUF) $tools" | |
6776 | fi | |
6a021536 | 6777 | fi |
9d6bc27b MR |
6778 | |
6779 | # Probe for guest agent support/options | |
6780 | ||
e8ef31a3 | 6781 | if [ "$guest_agent" != "no" ]; then |
a5125905 LV |
6782 | if [ "$softmmu" = no -a "$want_tools" = no ] ; then |
6783 | guest_agent=no | |
6784 | elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then | |
0814465a | 6785 | tools="qemu-ga\$(EXESUF) $tools" |
e8ef31a3 MT |
6786 | guest_agent=yes |
6787 | elif [ "$guest_agent" != yes ]; then | |
6788 | guest_agent=no | |
6789 | else | |
6790 | error_exit "Guest agent is not supported on this platform" | |
ca35f780 | 6791 | fi |
00c705fb | 6792 | fi |
ca35f780 | 6793 | |
9d6bc27b MR |
6794 | # Guest agent Window MSI package |
6795 | ||
6796 | if test "$guest_agent" != yes; then | |
6797 | if test "$guest_agent_msi" = yes; then | |
6798 | error_exit "MSI guest agent package requires guest agent enabled" | |
6799 | fi | |
6800 | guest_agent_msi=no | |
6801 | elif test "$mingw32" != "yes"; then | |
6802 | if test "$guest_agent_msi" = "yes"; then | |
6803 | error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" | |
6804 | fi | |
6805 | guest_agent_msi=no | |
6806 | elif ! has wixl; then | |
6807 | if test "$guest_agent_msi" = "yes"; then | |
6808 | error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" | |
6809 | fi | |
6810 | guest_agent_msi=no | |
1a34904e MR |
6811 | else |
6812 | # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't | |
6813 | # disabled explicitly | |
6814 | if test "$guest_agent_msi" != "no"; then | |
6815 | guest_agent_msi=yes | |
6816 | fi | |
9d6bc27b MR |
6817 | fi |
6818 | ||
1a34904e | 6819 | if test "$guest_agent_msi" = "yes"; then |
9d6bc27b MR |
6820 | if test "$guest_agent_with_vss" = "yes"; then |
6821 | QEMU_GA_MSI_WITH_VSS="-D InstallVss" | |
6822 | fi | |
6823 | ||
6824 | if test "$QEMU_GA_MANUFACTURER" = ""; then | |
6825 | QEMU_GA_MANUFACTURER=QEMU | |
6826 | fi | |
6827 | ||
6828 | if test "$QEMU_GA_DISTRO" = ""; then | |
6829 | QEMU_GA_DISTRO=Linux | |
6830 | fi | |
6831 | ||
6832 | if test "$QEMU_GA_VERSION" = ""; then | |
89138857 | 6833 | QEMU_GA_VERSION=$(cat $source_path/VERSION) |
9d6bc27b MR |
6834 | fi |
6835 | ||
89138857 | 6836 | QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin" |
9d6bc27b MR |
6837 | |
6838 | case "$cpu" in | |
6839 | x86_64) | |
6840 | QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" | |
6841 | ;; | |
6842 | i386) | |
6843 | QEMU_GA_MSI_ARCH="-D Arch=32" | |
6844 | ;; | |
6845 | *) | |
6846 | error_exit "CPU $cpu not supported for building installation package" | |
6847 | ;; | |
6848 | esac | |
6849 | fi | |
6850 | ||
ca35f780 PB |
6851 | # Mac OS X ships with a broken assembler |
6852 | roms= | |
e633a5c6 EB |
6853 | if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ |
6854 | test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \ | |
6855 | test "$softmmu" = yes ; then | |
e57218b6 | 6856 | # Different host OS linkers have different ideas about the name of the ELF |
c65d5e4e BS |
6857 | # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd |
6858 | # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. | |
6859 | for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do | |
e57218b6 PM |
6860 | if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then |
6861 | ld_i386_emulation="$emu" | |
6862 | roms="optionrom" | |
6863 | break | |
6864 | fi | |
6865 | done | |
ca35f780 | 6866 | fi |
ca35f780 | 6867 | |
2e33c3f8 | 6868 | # Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 |
9933c305 | 6869 | if test "$cpu" = "s390x" ; then |
2e33c3f8 TH |
6870 | write_c_skeleton |
6871 | if compile_prog "-march=z900" ""; then | |
6872 | roms="$roms s390-ccw" | |
1ef6bfc2 PMD |
6873 | # SLOF is required for building the s390-ccw firmware on s390x, |
6874 | # since it is using the libnet code from SLOF for network booting. | |
6875 | if test -e "${source_path}/.git" ; then | |
6876 | git_submodules="${git_submodules} roms/SLOF" | |
6877 | fi | |
2e33c3f8 | 6878 | fi |
9933c305 CB |
6879 | fi |
6880 | ||
11cde1c8 BD |
6881 | # Check that the C++ compiler exists and works with the C compiler. |
6882 | # All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added. | |
6883 | if has $cxx; then | |
6884 | cat > $TMPC <<EOF | |
6885 | int c_function(void); | |
6886 | int main(void) { return c_function(); } | |
6887 | EOF | |
6888 | ||
6889 | compile_object | |
6890 | ||
6891 | cat > $TMPCXX <<EOF | |
6892 | extern "C" { | |
6893 | int c_function(void); | |
6894 | } | |
6895 | int c_function(void) { return 42; } | |
6896 | EOF | |
6897 | ||
6898 | update_cxxflags | |
6899 | ||
086d5f75 | 6900 | if do_cxx $CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then |
11cde1c8 BD |
6901 | # C++ compiler $cxx works ok with C compiler $cc |
6902 | : | |
6903 | else | |
6904 | echo "C++ compiler $cxx does not work with C compiler $cc" | |
6905 | echo "Disabling C++ specific optional code" | |
6906 | cxx= | |
6907 | fi | |
6908 | else | |
6909 | echo "No C++ compiler available; disabling C++ specific optional code" | |
6910 | cxx= | |
6911 | fi | |
6912 | ||
02d34f62 CR |
6913 | echo_version() { |
6914 | if test "$1" = "yes" ; then | |
6915 | echo "($2)" | |
6916 | fi | |
6917 | } | |
6918 | ||
50e12060 JK |
6919 | # prepend pixman and ftd flags after all config tests are done |
6920 | QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS" | |
8a99e9a3 | 6921 | QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS" |
50e12060 | 6922 | libs_softmmu="$pixman_libs $libs_softmmu" |
5ca9388a | 6923 | |
98ec69ac | 6924 | config_host_mak="config-host.mak" |
98ec69ac | 6925 | |
dbd99ae3 SW |
6926 | echo "# Automatically generated by configure - do not modify" >config-all-disas.mak |
6927 | ||
98ec69ac | 6928 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
98ec69ac | 6929 | echo >> $config_host_mak |
98ec69ac | 6930 | |
e6c3b0f7 | 6931 | echo all: >> $config_host_mak |
99d7cc75 PB |
6932 | echo "prefix=$prefix" >> $config_host_mak |
6933 | echo "bindir=$bindir" >> $config_host_mak | |
3aa5d2be | 6934 | echo "libdir=$libdir" >> $config_host_mak |
8bf188aa | 6935 | echo "libexecdir=$libexecdir" >> $config_host_mak |
0f94d6da | 6936 | echo "includedir=$includedir" >> $config_host_mak |
99d7cc75 | 6937 | echo "mandir=$mandir" >> $config_host_mak |
99d7cc75 | 6938 | echo "sysconfdir=$sysconfdir" >> $config_host_mak |
22d07038 | 6939 | echo "qemu_confdir=$qemu_confdir" >> $config_host_mak |
9afa52ce | 6940 | echo "qemu_datadir=$qemu_datadir" >> $config_host_mak |
3d5eecab | 6941 | echo "qemu_firmwarepath=$firmwarepath" >> $config_host_mak |
9afa52ce | 6942 | echo "qemu_docdir=$qemu_docdir" >> $config_host_mak |
e26110cf | 6943 | echo "qemu_moddir=$qemu_moddir" >> $config_host_mak |
5a699bbb LE |
6944 | if test "$mingw32" = "no" ; then |
6945 | echo "qemu_localstatedir=$local_statedir" >> $config_host_mak | |
6946 | fi | |
f354b1a1 | 6947 | echo "qemu_helperdir=$libexecdir" >> $config_host_mak |
834574ea | 6948 | echo "qemu_localedir=$qemu_localedir" >> $config_host_mak |
a8260d38 | 6949 | echo "qemu_icondir=$qemu_icondir" >> $config_host_mak |
67ea9546 | 6950 | echo "qemu_desktopdir=$qemu_desktopdir" >> $config_host_mak |
02f9135b | 6951 | echo "libs_cpu=$libs_cpu" >> $config_host_mak |
f544a488 | 6952 | echo "libs_softmmu=$libs_softmmu" >> $config_host_mak |
cc84d63a | 6953 | echo "GIT=$git" >> $config_host_mak |
aef45d51 | 6954 | echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak |
f62bbee5 | 6955 | echo "GIT_UPDATE=$git_update" >> $config_host_mak |
804edf29 | 6956 | |
98ec69ac | 6957 | echo "ARCH=$ARCH" >> $config_host_mak |
727e5283 | 6958 | |
777dddc5 AB |
6959 | echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak |
6960 | echo "GLIB_LDFLAGS=$glib_ldflags" >> $config_host_mak | |
6961 | ||
f3494749 PB |
6962 | if test "$default_devices" = "yes" ; then |
6963 | echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak | |
6964 | else | |
6965 | echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak | |
6966 | fi | |
f8393946 | 6967 | if test "$debug_tcg" = "yes" ; then |
2358a494 | 6968 | echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak |
f8393946 | 6969 | fi |
1625af87 | 6970 | if test "$strip_opt" = "yes" ; then |
52ba784d | 6971 | echo "STRIP=${strip}" >> $config_host_mak |
1625af87 | 6972 | fi |
7d13299d | 6973 | if test "$bigendian" = "yes" ; then |
e2542fe2 | 6974 | echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak |
97a847bc | 6975 | fi |
67b915a5 | 6976 | if test "$mingw32" = "yes" ; then |
98ec69ac | 6977 | echo "CONFIG_WIN32=y" >> $config_host_mak |
89138857 | 6978 | rc_version=$(cat $source_path/VERSION) |
9fe6de94 BS |
6979 | version_major=${rc_version%%.*} |
6980 | rc_version=${rc_version#*.} | |
6981 | version_minor=${rc_version%%.*} | |
6982 | rc_version=${rc_version#*.} | |
6983 | version_subminor=${rc_version%%.*} | |
6984 | version_micro=0 | |
6985 | echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak | |
6986 | echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak | |
d9840e25 TS |
6987 | if test "$guest_agent_with_vss" = "yes" ; then |
6988 | echo "CONFIG_QGA_VSS=y" >> $config_host_mak | |
f33ca81f | 6989 | echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak |
d9840e25 TS |
6990 | echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak |
6991 | fi | |
50cbebb9 | 6992 | if test "$guest_agent_ntddscsi" = "yes" ; then |
76dc75ca | 6993 | echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak |
50cbebb9 | 6994 | fi |
1a34904e | 6995 | if test "$guest_agent_msi" = "yes"; then |
d661d9a4 | 6996 | echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak |
9dacf32d YH |
6997 | echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak |
6998 | echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak | |
6999 | echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak | |
7000 | echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak | |
7001 | echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak | |
7002 | echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak | |
7003 | fi | |
210fa556 | 7004 | else |
35f4df27 | 7005 | echo "CONFIG_POSIX=y" >> $config_host_mak |
dffcb71c MM |
7006 | fi |
7007 | ||
7008 | if test "$linux" = "yes" ; then | |
7009 | echo "CONFIG_LINUX=y" >> $config_host_mak | |
67b915a5 | 7010 | fi |
128ab2ff | 7011 | |
83fb7adf | 7012 | if test "$darwin" = "yes" ; then |
98ec69ac | 7013 | echo "CONFIG_DARWIN=y" >> $config_host_mak |
83fb7adf | 7014 | fi |
b29fe3ed | 7015 | |
ec530c81 | 7016 | if test "$solaris" = "yes" ; then |
98ec69ac | 7017 | echo "CONFIG_SOLARIS=y" >> $config_host_mak |
ec530c81 | 7018 | fi |
179cf400 AF |
7019 | if test "$haiku" = "yes" ; then |
7020 | echo "CONFIG_HAIKU=y" >> $config_host_mak | |
7021 | fi | |
97a847bc | 7022 | if test "$static" = "yes" ; then |
98ec69ac | 7023 | echo "CONFIG_STATIC=y" >> $config_host_mak |
7d13299d | 7024 | fi |
1ba16968 | 7025 | if test "$profiler" = "yes" ; then |
2358a494 | 7026 | echo "CONFIG_PROFILER=y" >> $config_host_mak |
05c2a3e7 | 7027 | fi |
c932ce31 PB |
7028 | if test "$want_tools" = "yes" ; then |
7029 | echo "CONFIG_TOOLS=y" >> $config_host_mak | |
7030 | fi | |
675b9b53 | 7031 | if test "$slirp" != "no"; then |
98ec69ac | 7032 | echo "CONFIG_SLIRP=y" >> $config_host_mak |
e2d8830e | 7033 | echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak |
675b9b53 MAL |
7034 | echo "SLIRP_CFLAGS=$slirp_cflags" >> $config_host_mak |
7035 | echo "SLIRP_LIBS=$slirp_libs" >> $config_host_mak | |
7036 | fi | |
7c57bdd8 | 7037 | if [ "$slirp" = "git" -o "$slirp" = "internal" ]; then |
3b8593ee | 7038 | echo "config-host.h: slirp/all" >> $config_host_mak |
c20709aa | 7039 | fi |
8a16d273 | 7040 | if test "$vde" = "yes" ; then |
98ec69ac | 7041 | echo "CONFIG_VDE=y" >> $config_host_mak |
e2ad6f16 | 7042 | echo "VDE_LIBS=$vde_libs" >> $config_host_mak |
8a16d273 | 7043 | fi |
58952137 VM |
7044 | if test "$netmap" = "yes" ; then |
7045 | echo "CONFIG_NETMAP=y" >> $config_host_mak | |
7046 | fi | |
015a33bd GA |
7047 | if test "$l2tpv3" = "yes" ; then |
7048 | echo "CONFIG_L2TPV3=y" >> $config_host_mak | |
7049 | fi | |
4cc600d2 PB |
7050 | if test "$gprof" = "yes" ; then |
7051 | echo "CONFIG_GPROF=y" >> $config_host_mak | |
7052 | fi | |
47e98658 | 7053 | if test "$cap_ng" = "yes" ; then |
a358bca2 | 7054 | echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak |
47e98658 | 7055 | fi |
2358a494 | 7056 | echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak |
0c58ac1c | 7057 | for drv in $audio_drv_list; do |
1ef1ec2a | 7058 | def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]') |
ce3dc033 | 7059 | case "$drv" in |
051c7d5c | 7060 | alsa | oss | pa | sdl) |
ce3dc033 GH |
7061 | echo "$def=m" >> $config_host_mak ;; |
7062 | *) | |
7063 | echo "$def=y" >> $config_host_mak ;; | |
7064 | esac | |
0c58ac1c | 7065 | done |
b1149911 FZ |
7066 | echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak |
7067 | echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak | |
7068 | echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak | |
7069 | echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak | |
7070 | echo "OSS_LIBS=$oss_libs" >> $config_host_mak | |
2e445703 | 7071 | echo "JACK_LIBS=$jack_libs" >> $config_host_mak |
d5631638 | 7072 | if test "$audio_win_int" = "yes" ; then |
7073 | echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak | |
7074 | fi | |
b64ec4e4 FZ |
7075 | echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak |
7076 | echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak | |
821601ea JS |
7077 | if test "$vnc" = "yes" ; then |
7078 | echo "CONFIG_VNC=y" >> $config_host_mak | |
7079 | fi | |
2f9606b3 | 7080 | if test "$vnc_sasl" = "yes" ; then |
98ec69ac | 7081 | echo "CONFIG_VNC_SASL=y" >> $config_host_mak |
2f9606b3 | 7082 | fi |
821601ea | 7083 | if test "$vnc_jpeg" = "yes" ; then |
2f6f5c7a | 7084 | echo "CONFIG_VNC_JPEG=y" >> $config_host_mak |
2f6f5c7a | 7085 | fi |
821601ea | 7086 | if test "$vnc_png" = "yes" ; then |
efe556ad | 7087 | echo "CONFIG_VNC_PNG=y" >> $config_host_mak |
efe556ad | 7088 | fi |
6a021536 GH |
7089 | if test "$xkbcommon" = "yes" ; then |
7090 | echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak | |
7091 | echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak | |
7092 | fi | |
dce512de CH |
7093 | if test "$xfs" = "yes" ; then |
7094 | echo "CONFIG_XFS=y" >> $config_host_mak | |
7095 | fi | |
89138857 | 7096 | qemu_version=$(head $source_path/VERSION) |
98ec69ac | 7097 | echo "VERSION=$qemu_version" >>$config_host_mak |
2358a494 | 7098 | echo "PKGVERSION=$pkgversion" >>$config_host_mak |
98ec69ac | 7099 | echo "SRC_PATH=$source_path" >> $config_host_mak |
2b1f35b9 | 7100 | echo "TARGET_DIRS=$target_list" >> $config_host_mak |
a25dba17 | 7101 | if [ "$docs" = "yes" ] ; then |
98ec69ac | 7102 | echo "BUILD_DOCS=yes" >> $config_host_mak |
cc8ae6de | 7103 | fi |
17969268 | 7104 | if test "$modules" = "yes"; then |
e26110cf FZ |
7105 | # $shacmd can generate a hash started with digit, which the compiler doesn't |
7106 | # like as an symbol. So prefix it with an underscore | |
89138857 | 7107 | echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak |
17969268 FZ |
7108 | echo "CONFIG_MODULES=y" >> $config_host_mak |
7109 | fi | |
bd83c861 CE |
7110 | if test "$module_upgrades" = "yes"; then |
7111 | echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak | |
7112 | fi | |
e633a5c6 | 7113 | if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then |
8781595b GH |
7114 | echo "CONFIG_X11=y" >> $config_host_mak |
7115 | echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak | |
7116 | echo "X11_LIBS=$x11_libs" >> $config_host_mak | |
7117 | fi | |
1ac88f28 | 7118 | if test "$sdl" = "yes" ; then |
96400a14 | 7119 | echo "CONFIG_SDL=m" >> $config_host_mak |
1ac88f28 | 7120 | echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak |
8ecc89f6 | 7121 | echo "SDL_LIBS=$sdl_libs" >> $config_host_mak |
a442fe2f DB |
7122 | if test "$sdl_image" = "yes" ; then |
7123 | echo "CONFIG_SDL_IMAGE=y" >> $config_host_mak | |
7124 | fi | |
49ecc3fa FB |
7125 | fi |
7126 | if test "$cocoa" = "yes" ; then | |
98ec69ac | 7127 | echo "CONFIG_COCOA=y" >> $config_host_mak |
4d3b6f6e | 7128 | fi |
e08bb301 ST |
7129 | if test "$iconv" = "yes" ; then |
7130 | echo "CONFIG_ICONV=y" >> $config_host_mak | |
7131 | echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak | |
7132 | echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak | |
7133 | fi | |
4d3b6f6e | 7134 | if test "$curses" = "yes" ; then |
2373f7d5 GH |
7135 | echo "CONFIG_CURSES=m" >> $config_host_mak |
7136 | echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak | |
7137 | echo "CURSES_LIBS=$curses_lib" >> $config_host_mak | |
49ecc3fa | 7138 | fi |
099d6b0f | 7139 | if test "$pipe2" = "yes" ; then |
2358a494 | 7140 | echo "CONFIG_PIPE2=y" >> $config_host_mak |
099d6b0f | 7141 | fi |
40ff6d7e KW |
7142 | if test "$accept4" = "yes" ; then |
7143 | echo "CONFIG_ACCEPT4=y" >> $config_host_mak | |
7144 | fi | |
3ce34dfb | 7145 | if test "$splice" = "yes" ; then |
2358a494 | 7146 | echo "CONFIG_SPLICE=y" >> $config_host_mak |
3ce34dfb | 7147 | fi |
c2882b96 RV |
7148 | if test "$eventfd" = "yes" ; then |
7149 | echo "CONFIG_EVENTFD=y" >> $config_host_mak | |
7150 | fi | |
751bcc39 MAL |
7151 | if test "$memfd" = "yes" ; then |
7152 | echo "CONFIG_MEMFD=y" >> $config_host_mak | |
7153 | fi | |
955727d2 CT |
7154 | if test "$have_usbfs" = "yes" ; then |
7155 | echo "CONFIG_USBFS=y" >> $config_host_mak | |
7156 | fi | |
d0927938 UH |
7157 | if test "$fallocate" = "yes" ; then |
7158 | echo "CONFIG_FALLOCATE=y" >> $config_host_mak | |
7159 | fi | |
3d4fa43e KK |
7160 | if test "$fallocate_punch_hole" = "yes" ; then |
7161 | echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak | |
7162 | fi | |
b953f075 DL |
7163 | if test "$fallocate_zero_range" = "yes" ; then |
7164 | echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak | |
7165 | fi | |
ed911435 KW |
7166 | if test "$posix_fallocate" = "yes" ; then |
7167 | echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak | |
7168 | fi | |
c727f47d PM |
7169 | if test "$sync_file_range" = "yes" ; then |
7170 | echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak | |
7171 | fi | |
dace20dc PM |
7172 | if test "$fiemap" = "yes" ; then |
7173 | echo "CONFIG_FIEMAP=y" >> $config_host_mak | |
7174 | fi | |
d0927938 UH |
7175 | if test "$dup3" = "yes" ; then |
7176 | echo "CONFIG_DUP3=y" >> $config_host_mak | |
7177 | fi | |
4e0c6529 AB |
7178 | if test "$ppoll" = "yes" ; then |
7179 | echo "CONFIG_PPOLL=y" >> $config_host_mak | |
7180 | fi | |
cd758dd0 AB |
7181 | if test "$prctl_pr_set_timerslack" = "yes" ; then |
7182 | echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak | |
7183 | fi | |
3b6edd16 PM |
7184 | if test "$epoll" = "yes" ; then |
7185 | echo "CONFIG_EPOLL=y" >> $config_host_mak | |
7186 | fi | |
7187 | if test "$epoll_create1" = "yes" ; then | |
7188 | echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak | |
7189 | fi | |
a8fd1aba PM |
7190 | if test "$sendfile" = "yes" ; then |
7191 | echo "CONFIG_SENDFILE=y" >> $config_host_mak | |
7192 | fi | |
51834341 RV |
7193 | if test "$timerfd" = "yes" ; then |
7194 | echo "CONFIG_TIMERFD=y" >> $config_host_mak | |
7195 | fi | |
9af5c906 RV |
7196 | if test "$setns" = "yes" ; then |
7197 | echo "CONFIG_SETNS=y" >> $config_host_mak | |
7198 | fi | |
38860a03 AM |
7199 | if test "$clock_adjtime" = "yes" ; then |
7200 | echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak | |
7201 | fi | |
5a03cd00 AM |
7202 | if test "$syncfs" = "yes" ; then |
7203 | echo "CONFIG_SYNCFS=y" >> $config_host_mak | |
7204 | fi | |
db37dd89 AM |
7205 | if test "$kcov" = "yes" ; then |
7206 | echo "CONFIG_KCOV=y" >> $config_host_mak | |
7207 | fi | |
3b3f24ad | 7208 | if test "$inotify" = "yes" ; then |
2358a494 | 7209 | echo "CONFIG_INOTIFY=y" >> $config_host_mak |
3b3f24ad | 7210 | fi |
c05c7a73 RV |
7211 | if test "$inotify1" = "yes" ; then |
7212 | echo "CONFIG_INOTIFY1=y" >> $config_host_mak | |
7213 | fi | |
401bc051 PM |
7214 | if test "$sem_timedwait" = "yes" ; then |
7215 | echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak | |
7216 | fi | |
5c99fa37 KF |
7217 | if test "$strchrnul" = "yes" ; then |
7218 | echo "HAVE_STRCHRNUL=y" >> $config_host_mak | |
7219 | fi | |
8a792b03 JX |
7220 | if test "$st_atim" = "yes" ; then |
7221 | echo "HAVE_STRUCT_STAT_ST_ATIM=y" >> $config_host_mak | |
7222 | fi | |
6ae9a1f4 JQ |
7223 | if test "$byteswap_h" = "yes" ; then |
7224 | echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak | |
7225 | fi | |
7226 | if test "$bswap_h" = "yes" ; then | |
7227 | echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak | |
7228 | fi | |
769ce76d | 7229 | if test "$curl" = "yes" ; then |
d3399d7c | 7230 | echo "CONFIG_CURL=m" >> $config_host_mak |
b1d5a277 | 7231 | echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak |
6ebc91e5 | 7232 | echo "CURL_LIBS=$curl_libs" >> $config_host_mak |
769ce76d | 7233 | fi |
2e4d9fb1 | 7234 | if test "$brlapi" = "yes" ; then |
98ec69ac | 7235 | echo "CONFIG_BRLAPI=y" >> $config_host_mak |
8eca2889 | 7236 | echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak |
2e4d9fb1 | 7237 | fi |
a4ccabcf | 7238 | if test "$gtk" = "yes" ; then |
e0fb129c | 7239 | echo "CONFIG_GTK=m" >> $config_host_mak |
a4ccabcf | 7240 | echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak |
014cb152 | 7241 | echo "GTK_LIBS=$gtk_libs" >> $config_host_mak |
925a0400 GH |
7242 | if test "$gtk_gl" = "yes" ; then |
7243 | echo "CONFIG_GTK_GL=y" >> $config_host_mak | |
7244 | fi | |
bbbf9bfb | 7245 | fi |
f876b765 MAL |
7246 | if test "$gio" = "yes" ; then |
7247 | echo "CONFIG_GIO=y" >> $config_host_mak | |
7248 | echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak | |
7249 | echo "GIO_LIBS=$gio_libs" >> $config_host_mak | |
25a97a56 | 7250 | echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak |
f876b765 | 7251 | fi |
a1c5e949 | 7252 | echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak |
ddbb0d09 DB |
7253 | if test "$gnutls" = "yes" ; then |
7254 | echo "CONFIG_GNUTLS=y" >> $config_host_mak | |
7255 | fi | |
91bfcdb0 DB |
7256 | if test "$gcrypt" = "yes" ; then |
7257 | echo "CONFIG_GCRYPT=y" >> $config_host_mak | |
1f923c70 LM |
7258 | if test "$gcrypt_hmac" = "yes" ; then |
7259 | echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak | |
7260 | fi | |
62893b67 | 7261 | fi |
91bfcdb0 DB |
7262 | if test "$nettle" = "yes" ; then |
7263 | echo "CONFIG_NETTLE=y" >> $config_host_mak | |
becaeb72 | 7264 | echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak |
ed754746 | 7265 | fi |
e0576942 DB |
7266 | if test "$qemu_private_xts" = "yes" ; then |
7267 | echo "CONFIG_QEMU_PRIVATE_XTS=y" >> $config_host_mak | |
7268 | fi | |
9a2fd434 DB |
7269 | if test "$tasn1" = "yes" ; then |
7270 | echo "CONFIG_TASN1=y" >> $config_host_mak | |
7271 | fi | |
8953caf3 DB |
7272 | if test "$auth_pam" = "yes" ; then |
7273 | echo "CONFIG_AUTH_PAM=y" >> $config_host_mak | |
7274 | fi | |
559607ea DB |
7275 | if test "$have_ifaddrs_h" = "yes" ; then |
7276 | echo "HAVE_IFADDRS_H=y" >> $config_host_mak | |
7277 | fi | |
e865b97f CG |
7278 | if test "$have_drm_h" = "yes" ; then |
7279 | echo "HAVE_DRM_H=y" >> $config_host_mak | |
7280 | fi | |
6b39b063 EB |
7281 | if test "$have_broken_size_max" = "yes" ; then |
7282 | echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak | |
7283 | fi | |
9df8b20d TH |
7284 | if test "$have_openpty" = "yes" ; then |
7285 | echo "HAVE_OPENPTY=y" >> $config_host_mak | |
7286 | fi | |
2a4b472c DC |
7287 | if test "$have_sys_signal_h" = "yes" ; then |
7288 | echo "HAVE_SYS_SIGNAL_H=y" >> $config_host_mak | |
7289 | fi | |
277abf15 JV |
7290 | |
7291 | # Work around a system header bug with some kernel/XFS header | |
7292 | # versions where they both try to define 'struct fsxattr': | |
7293 | # xfs headers will not try to redefine structs from linux headers | |
7294 | # if this macro is set. | |
7295 | if test "$have_fsxattr" = "yes" ; then | |
7296 | echo "HAVE_FSXATTR=y" >> $config_host_mak | |
7297 | fi | |
1efad060 FZ |
7298 | if test "$have_copy_file_range" = "yes" ; then |
7299 | echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak | |
7300 | fi | |
bbbf9bfb SW |
7301 | if test "$vte" = "yes" ; then |
7302 | echo "CONFIG_VTE=y" >> $config_host_mak | |
a4ccabcf | 7303 | echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak |
e0fb129c | 7304 | echo "VTE_LIBS=$vte_libs" >> $config_host_mak |
a4ccabcf | 7305 | fi |
9d9e1521 GH |
7306 | if test "$virglrenderer" = "yes" ; then |
7307 | echo "CONFIG_VIRGL=y" >> $config_host_mak | |
7308 | echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak | |
7309 | echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak | |
7310 | fi | |
e37630ca | 7311 | if test "$xen" = "yes" ; then |
6dbd588a | 7312 | echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak |
d5b93ddf | 7313 | echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak |
e37630ca | 7314 | fi |
5c6c3a6c CH |
7315 | if test "$linux_aio" = "yes" ; then |
7316 | echo "CONFIG_LINUX_AIO=y" >> $config_host_mak | |
7317 | fi | |
c10dd856 AM |
7318 | if test "$linux_io_uring" = "yes" ; then |
7319 | echo "CONFIG_LINUX_IO_URING=y" >> $config_host_mak | |
7320 | echo "LINUX_IO_URING_CFLAGS=$linux_io_uring_cflags" >> $config_host_mak | |
7321 | echo "LINUX_IO_URING_LIBS=$linux_io_uring_libs" >> $config_host_mak | |
7322 | fi | |
758e8e38 VJ |
7323 | if test "$attr" = "yes" ; then |
7324 | echo "CONFIG_ATTR=y" >> $config_host_mak | |
7325 | fi | |
4f26f2b6 AK |
7326 | if test "$libattr" = "yes" ; then |
7327 | echo "CONFIG_LIBATTR=y" >> $config_host_mak | |
7328 | fi | |
983eef5a MI |
7329 | if test "$virtfs" = "yes" ; then |
7330 | echo "CONFIG_VIRTFS=y" >> $config_host_mak | |
758e8e38 | 7331 | fi |
fe8fc5ae PB |
7332 | if test "$mpath" = "yes" ; then |
7333 | echo "CONFIG_MPATH=y" >> $config_host_mak | |
1b0578f5 MOA |
7334 | if test "$mpathpersist_new_api" = "yes"; then |
7335 | echo "CONFIG_MPATH_NEW_API=y" >> $config_host_mak | |
7336 | fi | |
fe8fc5ae | 7337 | fi |
5e9be92d NB |
7338 | if test "$vhost_scsi" = "yes" ; then |
7339 | echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak | |
7340 | fi | |
af3bba76 PB |
7341 | if test "$vhost_net" = "yes" ; then |
7342 | echo "CONFIG_VHOST_NET=y" >> $config_host_mak | |
7343 | fi | |
7344 | if test "$vhost_net_user" = "yes" ; then | |
56f41de7 | 7345 | echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak |
03ce5744 | 7346 | fi |
108a6481 CL |
7347 | if test "$vhost_net_vdpa" = "yes" ; then |
7348 | echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak | |
7349 | fi | |
042cea27 GA |
7350 | if test "$vhost_crypto" = "yes" ; then |
7351 | echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak | |
7352 | fi | |
fc0b9b0e SH |
7353 | if test "$vhost_vsock" = "yes" ; then |
7354 | echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak | |
5fe97d88 SG |
7355 | if test "$vhost_user" = "yes" ; then |
7356 | echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak | |
7357 | fi | |
fc0b9b0e | 7358 | fi |
299e6f19 PB |
7359 | if test "$vhost_kernel" = "yes" ; then |
7360 | echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak | |
7361 | fi | |
e6a74868 MAL |
7362 | if test "$vhost_user" = "yes" ; then |
7363 | echo "CONFIG_VHOST_USER=y" >> $config_host_mak | |
7364 | fi | |
108a6481 CL |
7365 | if test "$vhost_vdpa" = "yes" ; then |
7366 | echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak | |
7367 | fi | |
98fc1ada DDAG |
7368 | if test "$vhost_user_fs" = "yes" ; then |
7369 | echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak | |
7370 | fi | |
77755340 | 7371 | if test "$blobs" = "yes" ; then |
98ec69ac | 7372 | echo "INSTALL_BLOBS=yes" >> $config_host_mak |
77755340 | 7373 | fi |
bf9298b9 | 7374 | if test "$iovec" = "yes" ; then |
2358a494 | 7375 | echo "CONFIG_IOVEC=y" >> $config_host_mak |
bf9298b9 | 7376 | fi |
ceb42de8 | 7377 | if test "$preadv" = "yes" ; then |
2358a494 | 7378 | echo "CONFIG_PREADV=y" >> $config_host_mak |
ceb42de8 | 7379 | fi |
e3971d61 | 7380 | if test "$fdt" != "no" ; then |
3f0855b1 | 7381 | echo "CONFIG_FDT=y" >> $config_host_mak |
f652e6af | 7382 | fi |
a40161cb PB |
7383 | if test "$membarrier" = "yes" ; then |
7384 | echo "CONFIG_MEMBARRIER=y" >> $config_host_mak | |
7385 | fi | |
dcc38d1c MT |
7386 | if test "$signalfd" = "yes" ; then |
7387 | echo "CONFIG_SIGNALFD=y" >> $config_host_mak | |
7388 | fi | |
d339d766 RJ |
7389 | if test "$optreset" = "yes" ; then |
7390 | echo "HAVE_OPTRESET=y" >> $config_host_mak | |
7391 | fi | |
b3f6ea7e PB |
7392 | if test "$tcg" = "yes"; then |
7393 | echo "CONFIG_TCG=y" >> $config_host_mak | |
7394 | if test "$tcg_interpreter" = "yes" ; then | |
7395 | echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak | |
7396 | fi | |
9195b2c2 | 7397 | fi |
5f6b9e8f BS |
7398 | if test "$fdatasync" = "yes" ; then |
7399 | echo "CONFIG_FDATASYNC=y" >> $config_host_mak | |
7400 | fi | |
e78815a5 AF |
7401 | if test "$madvise" = "yes" ; then |
7402 | echo "CONFIG_MADVISE=y" >> $config_host_mak | |
7403 | fi | |
7404 | if test "$posix_madvise" = "yes" ; then | |
7405 | echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak | |
7406 | fi | |
9bc5a719 AG |
7407 | if test "$posix_memalign" = "yes" ; then |
7408 | echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak | |
7409 | fi | |
97a847bc | 7410 | |
cd4ec0b4 GH |
7411 | if test "$spice" = "yes" ; then |
7412 | echo "CONFIG_SPICE=y" >> $config_host_mak | |
7413 | fi | |
36707144 | 7414 | |
7b02f544 MAL |
7415 | if test "$smartcard" = "yes" ; then |
7416 | echo "CONFIG_SMARTCARD=y" >> $config_host_mak | |
7b62bf5a FZ |
7417 | echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak |
7418 | echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak | |
111a38b0 RR |
7419 | fi |
7420 | ||
2b2325ff GH |
7421 | if test "$libusb" = "yes" ; then |
7422 | echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak | |
b878b652 FZ |
7423 | echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak |
7424 | echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak | |
2b2325ff GH |
7425 | fi |
7426 | ||
69354a83 HG |
7427 | if test "$usb_redir" = "yes" ; then |
7428 | echo "CONFIG_USB_REDIR=y" >> $config_host_mak | |
cc7923fc FZ |
7429 | echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak |
7430 | echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak | |
69354a83 HG |
7431 | fi |
7432 | ||
da076ffe GH |
7433 | if test "$opengl" = "yes" ; then |
7434 | echo "CONFIG_OPENGL=y" >> $config_host_mak | |
7435 | echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak | |
014cb152 GH |
7436 | if test "$opengl_dmabuf" = "yes" ; then |
7437 | echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak | |
7438 | fi | |
20ff075b MW |
7439 | fi |
7440 | ||
d52c454a MAL |
7441 | if test "$gbm" = "yes" ; then |
7442 | echo "CONFIG_GBM=y" >> $config_host_mak | |
7443 | echo "GBM_LIBS=$gbm_libs" >> $config_host_mak | |
7444 | echo "GBM_CFLAGS=$gbm_cflags" >> $config_host_mak | |
7445 | fi | |
7446 | ||
7447 | ||
5a22ab71 YZ |
7448 | if test "$malloc_trim" = "yes" ; then |
7449 | echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak | |
7450 | fi | |
7451 | ||
99f2dbd3 LL |
7452 | if test "$avx2_opt" = "yes" ; then |
7453 | echo "CONFIG_AVX2_OPT=y" >> $config_host_mak | |
7454 | fi | |
7455 | ||
6b8cd447 RH |
7456 | if test "$avx512f_opt" = "yes" ; then |
7457 | echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak | |
7458 | fi | |
7459 | ||
607dacd0 QN |
7460 | if test "$lzo" = "yes" ; then |
7461 | echo "CONFIG_LZO=y" >> $config_host_mak | |
7462 | fi | |
7463 | ||
7464 | if test "$snappy" = "yes" ; then | |
7465 | echo "CONFIG_SNAPPY=y" >> $config_host_mak | |
7466 | fi | |
7467 | ||
6b383c08 PW |
7468 | if test "$bzip2" = "yes" ; then |
7469 | echo "CONFIG_BZIP2=y" >> $config_host_mak | |
7470 | echo "BZIP2_LIBS=-lbz2" >> $config_host_mak | |
7471 | fi | |
7472 | ||
83bc1f97 JF |
7473 | if test "$lzfse" = "yes" ; then |
7474 | echo "CONFIG_LZFSE=y" >> $config_host_mak | |
7475 | echo "LZFSE_LIBS=-llzfse" >> $config_host_mak | |
7476 | fi | |
7477 | ||
3a678481 JQ |
7478 | if test "$zstd" = "yes" ; then |
7479 | echo "CONFIG_ZSTD=y" >> $config_host_mak | |
7480 | fi | |
7481 | ||
c589b249 | 7482 | if test "$libiscsi" = "yes" ; then |
d3399d7c | 7483 | echo "CONFIG_LIBISCSI=m" >> $config_host_mak |
6ebc91e5 FZ |
7484 | echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak |
7485 | echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak | |
c589b249 RS |
7486 | fi |
7487 | ||
6542aa9c | 7488 | if test "$libnfs" = "yes" ; then |
4be4879f CL |
7489 | echo "CONFIG_LIBNFS=m" >> $config_host_mak |
7490 | echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak | |
6542aa9c PL |
7491 | fi |
7492 | ||
f794573e EO |
7493 | if test "$seccomp" = "yes"; then |
7494 | echo "CONFIG_SECCOMP=y" >> $config_host_mak | |
c3883e1f FZ |
7495 | echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak |
7496 | echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak | |
f794573e EO |
7497 | fi |
7498 | ||
83fb7adf | 7499 | # XXX: suppress that |
7d3505c5 | 7500 | if [ "$bsd" = "yes" ] ; then |
2358a494 | 7501 | echo "CONFIG_BSD=y" >> $config_host_mak |
7d3505c5 FB |
7502 | fi |
7503 | ||
4d9310f4 DB |
7504 | if test "$localtime_r" = "yes" ; then |
7505 | echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak | |
7506 | fi | |
3556c233 PB |
7507 | if test "$qom_cast_debug" = "yes" ; then |
7508 | echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak | |
7509 | fi | |
f27aaf4b | 7510 | if test "$rbd" = "yes" ; then |
d3399d7c | 7511 | echo "CONFIG_RBD=m" >> $config_host_mak |
6ebc91e5 FZ |
7512 | echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak |
7513 | echo "RBD_LIBS=$rbd_libs" >> $config_host_mak | |
d0e2fce5 AK |
7514 | fi |
7515 | ||
7c2acc70 | 7516 | echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak |
70c60c08 SH |
7517 | if test "$coroutine_pool" = "yes" ; then |
7518 | echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak | |
7519 | else | |
7520 | echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak | |
7521 | fi | |
20ff6c80 | 7522 | |
7d992e4d PL |
7523 | if test "$debug_stack_usage" = "yes" ; then |
7524 | echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak | |
7525 | fi | |
7526 | ||
f0d92b56 LM |
7527 | if test "$crypto_afalg" = "yes" ; then |
7528 | echo "CONFIG_AF_ALG=y" >> $config_host_mak | |
7529 | fi | |
7530 | ||
d2042378 AK |
7531 | if test "$open_by_handle_at" = "yes" ; then |
7532 | echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak | |
7533 | fi | |
7534 | ||
e06a765e HPB |
7535 | if test "$linux_magic_h" = "yes" ; then |
7536 | echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak | |
8ab1bf12 LC |
7537 | fi |
7538 | ||
3f4349dc KW |
7539 | if test "$valgrind_h" = "yes" ; then |
7540 | echo "CONFIG_VALGRIND_H=y" >> $config_host_mak | |
7541 | fi | |
7542 | ||
d83414e1 MAL |
7543 | if test "$have_asan_iface_fiber" = "yes" ; then |
7544 | echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak | |
7545 | fi | |
7546 | ||
0aebab04 LY |
7547 | if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then |
7548 | echo "CONFIG_TSAN=y" >> $config_host_mak | |
7549 | fi | |
7550 | ||
8ab1bf12 LC |
7551 | if test "$has_environ" = "yes" ; then |
7552 | echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak | |
e06a765e HPB |
7553 | fi |
7554 | ||
76a347e1 RH |
7555 | if test "$cpuid_h" = "yes" ; then |
7556 | echo "CONFIG_CPUID_H=y" >> $config_host_mak | |
7557 | fi | |
7558 | ||
f540166b RH |
7559 | if test "$int128" = "yes" ; then |
7560 | echo "CONFIG_INT128=y" >> $config_host_mak | |
7561 | fi | |
7562 | ||
7ebee43e RH |
7563 | if test "$atomic128" = "yes" ; then |
7564 | echo "CONFIG_ATOMIC128=y" >> $config_host_mak | |
7565 | fi | |
7566 | ||
e6cd4bb5 RH |
7567 | if test "$cmpxchg128" = "yes" ; then |
7568 | echo "CONFIG_CMPXCHG128=y" >> $config_host_mak | |
7569 | fi | |
7570 | ||
df79b996 RH |
7571 | if test "$atomic64" = "yes" ; then |
7572 | echo "CONFIG_ATOMIC64=y" >> $config_host_mak | |
7573 | fi | |
7574 | ||
db8aaae8 RH |
7575 | if test "$attralias" = "yes" ; then |
7576 | echo "CONFIG_ATTRIBUTE_ALIAS=y" >> $config_host_mak | |
7577 | fi | |
7578 | ||
1e6e9aca RH |
7579 | if test "$getauxval" = "yes" ; then |
7580 | echo "CONFIG_GETAUXVAL=y" >> $config_host_mak | |
7581 | fi | |
7582 | ||
eb100396 | 7583 | if test "$glusterfs" = "yes" ; then |
d3399d7c | 7584 | echo "CONFIG_GLUSTERFS=m" >> $config_host_mak |
6ebc91e5 FZ |
7585 | echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak |
7586 | echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak | |
0c14fb47 BR |
7587 | fi |
7588 | ||
d85fa9eb JC |
7589 | if test "$glusterfs_xlator_opt" = "yes" ; then |
7590 | echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak | |
7591 | fi | |
7592 | ||
0c14fb47 BR |
7593 | if test "$glusterfs_discard" = "yes" ; then |
7594 | echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak | |
eb100396 | 7595 | fi |
e06a765e | 7596 | |
df3a429a NV |
7597 | if test "$glusterfs_fallocate" = "yes" ; then |
7598 | echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak | |
7599 | fi | |
7600 | ||
7c815372 BR |
7601 | if test "$glusterfs_zerofill" = "yes" ; then |
7602 | echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak | |
7603 | fi | |
7604 | ||
e014dbe7 PKK |
7605 | if test "$glusterfs_ftruncate_has_stat" = "yes" ; then |
7606 | echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak | |
7607 | fi | |
7608 | ||
0e3b891f NV |
7609 | if test "$glusterfs_iocb_has_stat" = "yes" ; then |
7610 | echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak | |
7611 | fi | |
7612 | ||
b10d49d7 PT |
7613 | if test "$libssh" = "yes" ; then |
7614 | echo "CONFIG_LIBSSH=m" >> $config_host_mak | |
7615 | echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak | |
7616 | echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak | |
0a12ec87 RJ |
7617 | fi |
7618 | ||
ed1701c6 DDAG |
7619 | if test "$live_block_migration" = "yes" ; then |
7620 | echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak | |
7621 | fi | |
7622 | ||
3b8acc11 | 7623 | if test "$tpm" = "yes"; then |
3cae16db | 7624 | echo 'CONFIG_TPM=y' >> $config_host_mak |
3b8acc11 PB |
7625 | fi |
7626 | ||
5b808275 LV |
7627 | echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak |
7628 | if have_backend "nop"; then | |
6d8a764e | 7629 | echo "CONFIG_TRACE_NOP=y" >> $config_host_mak |
22890ab5 | 7630 | fi |
5b808275 | 7631 | if have_backend "simple"; then |
6d8a764e LV |
7632 | echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak |
7633 | # Set the appropriate trace file. | |
953ffe0f | 7634 | trace_file="\"$trace_file-\" FMT_pid" |
9410b56c | 7635 | fi |
ed7f5f1d PB |
7636 | if have_backend "log"; then |
7637 | echo "CONFIG_TRACE_LOG=y" >> $config_host_mak | |
6d8a764e | 7638 | fi |
5b808275 | 7639 | if have_backend "ust"; then |
6d8a764e LV |
7640 | echo "CONFIG_TRACE_UST=y" >> $config_host_mak |
7641 | fi | |
5b808275 | 7642 | if have_backend "dtrace"; then |
6d8a764e LV |
7643 | echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak |
7644 | if test "$trace_backend_stap" = "yes" ; then | |
7645 | echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak | |
7646 | fi | |
c276b17d | 7647 | fi |
5b808275 | 7648 | if have_backend "ftrace"; then |
781e9545 ET |
7649 | if test "$linux" = "yes" ; then |
7650 | echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak | |
781e9545 | 7651 | else |
21684af0 | 7652 | feature_not_found "ftrace(trace backend)" "ftrace requires Linux" |
781e9545 ET |
7653 | fi |
7654 | fi | |
0a852417 PD |
7655 | if have_backend "syslog"; then |
7656 | if test "$posix_syslog" = "yes" ; then | |
7657 | echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak | |
7658 | else | |
7659 | feature_not_found "syslog(trace backend)" "syslog not available" | |
7660 | fi | |
7661 | fi | |
9410b56c PS |
7662 | echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak |
7663 | ||
2da776db MH |
7664 | if test "$rdma" = "yes" ; then |
7665 | echo "CONFIG_RDMA=y" >> $config_host_mak | |
392fb643 | 7666 | echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak |
2da776db MH |
7667 | fi |
7668 | ||
21ab34c9 MA |
7669 | if test "$pvrdma" = "yes" ; then |
7670 | echo "CONFIG_PVRDMA=y" >> $config_host_mak | |
7671 | fi | |
7672 | ||
575b22b1 LV |
7673 | if test "$have_rtnetlink" = "yes" ; then |
7674 | echo "CONFIG_RTNETLINK=y" >> $config_host_mak | |
7675 | fi | |
7676 | ||
ed279a06 KK |
7677 | if test "$libxml2" = "yes" ; then |
7678 | echo "CONFIG_LIBXML2=y" >> $config_host_mak | |
7679 | echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak | |
7680 | echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak | |
7681 | fi | |
7682 | ||
a6b1d4c0 CX |
7683 | if test "$replication" = "yes" ; then |
7684 | echo "CONFIG_REPLICATION=y" >> $config_host_mak | |
7685 | fi | |
7686 | ||
6a02c806 SH |
7687 | if test "$have_af_vsock" = "yes" ; then |
7688 | echo "CONFIG_AF_VSOCK=y" >> $config_host_mak | |
7689 | fi | |
7690 | ||
4d04351f CC |
7691 | if test "$have_sysmacros" = "yes" ; then |
7692 | echo "CONFIG_SYSMACROS=y" >> $config_host_mak | |
7693 | fi | |
7694 | ||
49e00a18 AG |
7695 | if test "$have_static_assert" = "yes" ; then |
7696 | echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak | |
7697 | fi | |
7698 | ||
e674605f TG |
7699 | if test "$have_utmpx" = "yes" ; then |
7700 | echo "HAVE_UTMPX=y" >> $config_host_mak | |
7701 | fi | |
db1ed1ab RH |
7702 | if test "$have_getrandom" = "yes" ; then |
7703 | echo "CONFIG_GETRANDOM=y" >> $config_host_mak | |
7704 | fi | |
e0580342 KR |
7705 | if test "$ivshmem" = "yes" ; then |
7706 | echo "CONFIG_IVSHMEM=y" >> $config_host_mak | |
8ca80760 | 7707 | fi |
e219c499 | 7708 | if test "$capstone" != "no" ; then |
8ca80760 | 7709 | echo "CONFIG_CAPSTONE=y" >> $config_host_mak |
e0580342 | 7710 | fi |
ba59fb77 PB |
7711 | if test "$debug_mutex" = "yes" ; then |
7712 | echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak | |
7713 | fi | |
e0580342 | 7714 | |
5c312079 DDAG |
7715 | # Hold two types of flag: |
7716 | # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on | |
7717 | # a thread we have a handle to | |
479a5747 | 7718 | # CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular |
5c312079 | 7719 | # platform |
479a5747 RB |
7720 | if test "$pthread_setname_np_w_tid" = "yes" ; then |
7721 | echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak | |
7722 | echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=y" >> $config_host_mak | |
7723 | elif test "$pthread_setname_np_wo_tid" = "yes" ; then | |
5c312079 | 7724 | echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak |
479a5747 | 7725 | echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=y" >> $config_host_mak |
5c312079 DDAG |
7726 | fi |
7727 | ||
17824406 JH |
7728 | if test "$libpmem" = "yes" ; then |
7729 | echo "CONFIG_LIBPMEM=y" >> $config_host_mak | |
7730 | fi | |
7731 | ||
21b2eca6 JL |
7732 | if test "$libdaxctl" = "yes" ; then |
7733 | echo "CONFIG_LIBDAXCTL=y" >> $config_host_mak | |
7734 | fi | |
7735 | ||
2f740136 JC |
7736 | if test "$bochs" = "yes" ; then |
7737 | echo "CONFIG_BOCHS=y" >> $config_host_mak | |
7738 | fi | |
7739 | if test "$cloop" = "yes" ; then | |
7740 | echo "CONFIG_CLOOP=y" >> $config_host_mak | |
7741 | fi | |
7742 | if test "$dmg" = "yes" ; then | |
7743 | echo "CONFIG_DMG=y" >> $config_host_mak | |
7744 | fi | |
7745 | if test "$qcow1" = "yes" ; then | |
7746 | echo "CONFIG_QCOW1=y" >> $config_host_mak | |
7747 | fi | |
7748 | if test "$vdi" = "yes" ; then | |
7749 | echo "CONFIG_VDI=y" >> $config_host_mak | |
7750 | fi | |
7751 | if test "$vvfat" = "yes" ; then | |
7752 | echo "CONFIG_VVFAT=y" >> $config_host_mak | |
7753 | fi | |
7754 | if test "$qed" = "yes" ; then | |
7755 | echo "CONFIG_QED=y" >> $config_host_mak | |
7756 | fi | |
7757 | if test "$parallels" = "yes" ; then | |
7758 | echo "CONFIG_PARALLELS=y" >> $config_host_mak | |
7759 | fi | |
7760 | if test "$sheepdog" = "yes" ; then | |
7761 | echo "CONFIG_SHEEPDOG=y" >> $config_host_mak | |
7762 | fi | |
c9c8b88f DC |
7763 | if test "$pty_h" = "yes" ; then |
7764 | echo "HAVE_PTY_H=y" >> $config_host_mak | |
7765 | fi | |
195588cc DC |
7766 | if test "$have_mlockall" = "yes" ; then |
7767 | echo "HAVE_MLOCKALL=y" >> $config_host_mak | |
7768 | fi | |
adc28027 AB |
7769 | if test "$fuzzing" = "yes" ; then |
7770 | if test "$have_fuzzer" = "yes"; then | |
dd016265 AB |
7771 | FUZZ_LDFLAGS=" -fsanitize=fuzzer" |
7772 | FUZZ_CFLAGS=" -fsanitize=fuzzer" | |
086d5f75 | 7773 | QEMU_CFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link" |
adc28027 | 7774 | else |
dd016265 | 7775 | error_exit "Your compiler doesn't support -fsanitize=fuzzer" |
adc28027 AB |
7776 | exit 1 |
7777 | fi | |
7778 | fi | |
2f740136 | 7779 | |
40e8c6f4 AB |
7780 | if test "$plugins" = "yes" ; then |
7781 | echo "CONFIG_PLUGIN=y" >> $config_host_mak | |
7782 | LIBS="-ldl $LIBS" | |
26fffe29 EC |
7783 | # Copy the export object list to the build dir |
7784 | if test "$ld_dynamic_list" = "yes" ; then | |
7785 | echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak | |
7786 | ld_symbols=qemu-plugins-ld.symbols | |
7787 | cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols | |
7788 | elif test "$ld_exported_symbols_list" = "yes" ; then | |
7789 | echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak | |
7790 | ld64_symbols=qemu-plugins-ld64.symbols | |
7791 | echo "# Automatically generated by configure - do not modify" > $ld64_symbols | |
7792 | grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \ | |
7793 | sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols | |
7794 | else | |
7795 | error_exit \ | |
7796 | "If \$plugins=yes, either \$ld_dynamic_list or " \ | |
7797 | "\$ld_exported_symbols_list should have been set to 'yes'." | |
7798 | fi | |
40e8c6f4 AB |
7799 | fi |
7800 | ||
f48e590a AB |
7801 | if test -n "$gdb_bin" ; then |
7802 | echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak | |
7803 | fi | |
7804 | ||
54e7aac0 AK |
7805 | if test "$secret_keyring" = "yes" ; then |
7806 | echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak | |
92500362 AK |
7807 | if test "$have_keyutils" = "yes" ; then |
7808 | echo "CONFIG_TEST_SECRET_KEYRING=y" >> $config_host_mak | |
7809 | fi | |
54e7aac0 AK |
7810 | fi |
7811 | ||
5b5e3037 | 7812 | if test "$tcg_interpreter" = "yes"; then |
25211446 | 7813 | QEMU_INCLUDES="-iquote ${source_path}/tcg/tci $QEMU_INCLUDES" |
5b5e3037 | 7814 | elif test "$ARCH" = "sparc64" ; then |
25211446 | 7815 | QEMU_INCLUDES="-iquote ${source_path}/tcg/sparc $QEMU_INCLUDES" |
5b5e3037 | 7816 | elif test "$ARCH" = "s390x" ; then |
25211446 | 7817 | QEMU_INCLUDES="-iquote ${source_path}/tcg/s390 $QEMU_INCLUDES" |
e633a5c6 | 7818 | elif test "$ARCH" = "x86_64" || test "$ARCH" = "x32" ; then |
25211446 | 7819 | QEMU_INCLUDES="-iquote ${source_path}/tcg/i386 $QEMU_INCLUDES" |
40d964b5 | 7820 | elif test "$ARCH" = "ppc64" ; then |
25211446 | 7821 | QEMU_INCLUDES="-iquote ${source_path}/tcg/ppc $QEMU_INCLUDES" |
e633a5c6 | 7822 | elif test "$ARCH" = "riscv32" || test "$ARCH" = "riscv64" ; then |
25211446 | 7823 | QEMU_INCLUDES="-I${source_path}/tcg/riscv $QEMU_INCLUDES" |
5b5e3037 | 7824 | else |
25211446 | 7825 | QEMU_INCLUDES="-iquote ${source_path}/tcg/${ARCH} $QEMU_INCLUDES" |
5b5e3037 | 7826 | fi |
5b5e3037 | 7827 | |
fdbff6bd | 7828 | echo "HELPERS=$helpers" >> $config_host_mak |
98ec69ac | 7829 | echo "TOOLS=$tools" >> $config_host_mak |
98ec69ac | 7830 | echo "ROMS=$roms" >> $config_host_mak |
804edf29 JQ |
7831 | echo "MAKE=$make" >> $config_host_mak |
7832 | echo "INSTALL=$install" >> $config_host_mak | |
1901cb14 BS |
7833 | echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak |
7834 | echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak | |
e999ee44 MT |
7835 | echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak |
7836 | echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak | |
c886edfb | 7837 | echo "PYTHON=$python" >> $config_host_mak |
2eb054c2 | 7838 | echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak |
516e8b7d | 7839 | echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak |
39d87c8c | 7840 | echo "GENISOIMAGE=$genisoimage" >> $config_host_mak |
a5665051 | 7841 | echo "MESON=$meson" >> $config_host_mak |
804edf29 | 7842 | echo "CC=$cc" >> $config_host_mak |
a31a8642 MT |
7843 | if $iasl -h > /dev/null 2>&1; then |
7844 | echo "IASL=$iasl" >> $config_host_mak | |
7845 | fi | |
804edf29 | 7846 | echo "HOST_CC=$host_cc" >> $config_host_mak |
83f73fce | 7847 | echo "CXX=$cxx" >> $config_host_mak |
3c4a4d0d | 7848 | echo "OBJCC=$objcc" >> $config_host_mak |
804edf29 | 7849 | echo "AR=$ar" >> $config_host_mak |
45d285ab | 7850 | echo "ARFLAGS=$ARFLAGS" >> $config_host_mak |
cdbd727c | 7851 | echo "AS=$as" >> $config_host_mak |
5f6f0e27 | 7852 | echo "CCAS=$ccas" >> $config_host_mak |
3dd46c78 | 7853 | echo "CPP=$cpp" >> $config_host_mak |
804edf29 JQ |
7854 | echo "OBJCOPY=$objcopy" >> $config_host_mak |
7855 | echo "LD=$ld" >> $config_host_mak | |
9f81aeb5 | 7856 | echo "RANLIB=$ranlib" >> $config_host_mak |
4852ee95 | 7857 | echo "NM=$nm" >> $config_host_mak |
daa79d9a | 7858 | echo "PKG_CONFIG=$pkg_config_exe" >> $config_host_mak |
9fe6de94 | 7859 | echo "WINDRES=$windres" >> $config_host_mak |
e2a2ed06 | 7860 | echo "CFLAGS=$CFLAGS" >> $config_host_mak |
086d5f75 | 7861 | echo "CXXFLAGS=$CXXFLAGS" >> $config_host_mak |
46eef33b | 7862 | echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak |
a558ee17 | 7863 | echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak |
11cde1c8 | 7864 | echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak |
f9728943 | 7865 | echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak |
e39f0062 PB |
7866 | if test "$sparse" = "yes" ; then |
7867 | echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak | |
80fd48df | 7868 | echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak |
2944d742 | 7869 | echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak |
e39f0062 PB |
7870 | echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak |
7871 | echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak | |
7872 | fi | |
8a99e9a3 | 7873 | echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak |
db5adeaa | 7874 | echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak |
6969ec6c | 7875 | echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak |
e57218b6 | 7876 | echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak |
73da375e | 7877 | echo "LIBS+=$LIBS" >> $config_host_mak |
3e2e0e6b | 7878 | echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak |
409437e1 | 7879 | echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak |
804edf29 | 7880 | echo "EXESUF=$EXESUF" >> $config_host_mak |
17969268 FZ |
7881 | echo "DSOSUF=$DSOSUF" >> $config_host_mak |
7882 | echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak | |
957f1f99 | 7883 | echo "LIBS_QGA+=$libs_qga" >> $config_host_mak |
90246037 DB |
7884 | echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak |
7885 | echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak | |
94dd53c5 | 7886 | echo "POD2MAN=$POD2MAN" >> $config_host_mak |
1d728c39 BS |
7887 | if test "$gcov" = "yes" ; then |
7888 | echo "CONFIG_GCOV=y" >> $config_host_mak | |
7889 | echo "GCOV=$gcov_tool" >> $config_host_mak | |
7890 | fi | |
804edf29 | 7891 | |
3efac6eb TG |
7892 | if test "$libudev" != "no"; then |
7893 | echo "CONFIG_LIBUDEV=y" >> $config_host_mak | |
7894 | echo "LIBUDEV_LIBS=$libudev_libs" >> $config_host_mak | |
7895 | fi | |
adc28027 AB |
7896 | if test "$fuzzing" != "no"; then |
7897 | echo "CONFIG_FUZZ=y" >> $config_host_mak | |
7898 | echo "FUZZ_CFLAGS=$FUZZ_CFLAGS" >> $config_host_mak | |
7899 | echo "FUZZ_LDFLAGS=$FUZZ_LDFLAGS" >> $config_host_mak | |
7900 | fi | |
3efac6eb | 7901 | |
05dfa22b PMD |
7902 | if test "$edk2_blobs" = "yes" ; then |
7903 | echo "DECOMPRESS_EDK2_BLOBS=y" >> $config_host_mak | |
7904 | fi | |
7905 | ||
b767d257 MMG |
7906 | if test "$rng_none" = "yes"; then |
7907 | echo "CONFIG_RNG_NONE=y" >> $config_host_mak | |
7908 | fi | |
7909 | ||
6efd7517 PM |
7910 | # use included Linux headers |
7911 | if test "$linux" = "yes" ; then | |
a307beb6 | 7912 | mkdir -p linux-headers |
6efd7517 | 7913 | case "$cpu" in |
c72b26ec | 7914 | i386|x86_64|x32) |
08312a63 | 7915 | linux_arch=x86 |
6efd7517 | 7916 | ;; |
f8378acc | 7917 | ppc|ppc64|ppc64le) |
08312a63 | 7918 | linux_arch=powerpc |
6efd7517 PM |
7919 | ;; |
7920 | s390x) | |
08312a63 PM |
7921 | linux_arch=s390 |
7922 | ;; | |
1f080313 CF |
7923 | aarch64) |
7924 | linux_arch=arm64 | |
7925 | ;; | |
222e7d11 SL |
7926 | mips64) |
7927 | linux_arch=mips | |
7928 | ;; | |
08312a63 PM |
7929 | *) |
7930 | # For most CPUs the kernel architecture name and QEMU CPU name match. | |
7931 | linux_arch="$cpu" | |
6efd7517 PM |
7932 | ;; |
7933 | esac | |
08312a63 PM |
7934 | # For non-KVM architectures we will not have asm headers |
7935 | if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then | |
7936 | symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm | |
7937 | fi | |
6efd7517 PM |
7938 | fi |
7939 | ||
1d14ffa9 | 7940 | for target in $target_list; do |
97a847bc | 7941 | target_dir="$target" |
25be210f | 7942 | config_target_mak=$target_dir/config-target.mak |
89138857 | 7943 | target_name=$(echo $target | cut -d '-' -f 1) |
52bf9771 TN |
7944 | target_aligned_only="no" |
7945 | case "$target_name" in | |
7946 | alpha|hppa|mips64el|mips64|mipsel|mips|mipsn32|mipsn32el|sh4|sh4eb|sparc|sparc64|sparc32plus|xtensa|xtensaeb) | |
7947 | target_aligned_only="yes" | |
7948 | ;; | |
7949 | esac | |
97a847bc | 7950 | target_bigendian="no" |
c1799a84 | 7951 | case "$target_name" in |
a69dc537 | 7952 | armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) |
52bf9771 | 7953 | target_bigendian="yes" |
ea2d6a39 JQ |
7954 | ;; |
7955 | esac | |
97a847bc | 7956 | target_softmmu="no" |
997344f3 | 7957 | target_user_only="no" |
831b7825 | 7958 | target_linux_user="no" |
84778508 | 7959 | target_bsd_user="no" |
9e407a85 | 7960 | case "$target" in |
c1799a84 | 7961 | ${target_name}-softmmu) |
9e407a85 PB |
7962 | target_softmmu="yes" |
7963 | ;; | |
c1799a84 | 7964 | ${target_name}-linux-user) |
9e407a85 PB |
7965 | target_user_only="yes" |
7966 | target_linux_user="yes" | |
7967 | ;; | |
c1799a84 | 7968 | ${target_name}-bsd-user) |
84778508 BS |
7969 | target_user_only="yes" |
7970 | target_bsd_user="yes" | |
7971 | ;; | |
9e407a85 | 7972 | *) |
76ad07a4 | 7973 | error_exit "Target '$target' not recognised" |
9e407a85 PB |
7974 | exit 1 |
7975 | ;; | |
7976 | esac | |
831b7825 | 7977 | |
97a847bc | 7978 | mkdir -p $target_dir |
25be210f | 7979 | echo "# Automatically generated by configure - do not modify" > $config_target_mak |
de83cd02 | 7980 | |
e5fe0c52 | 7981 | bflt="no" |
ca759f9e | 7982 | mttcg="no" |
89138857 | 7983 | interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g") |
56aebc89 | 7984 | gdb_xml_files="" |
7ba1e619 | 7985 | |
c1799a84 | 7986 | TARGET_ARCH="$target_name" |
6acff7da | 7987 | TARGET_BASE_ARCH="" |
e6e91b9c | 7988 | TARGET_ABI_DIR="" |
e73aae67 | 7989 | |
c1799a84 | 7990 | case "$target_name" in |
2408a527 | 7991 | i386) |
0a7fa00a | 7992 | mttcg="yes" |
7b0f97ba | 7993 | gdb_xml_files="i386-32bit.xml" |
28988117 | 7994 | TARGET_SYSTBL_ABI=i386 |
2408a527 AJ |
7995 | ;; |
7996 | x86_64) | |
6acff7da | 7997 | TARGET_BASE_ARCH=i386 |
8d62f35a | 7998 | TARGET_SYSTBL_ABI=common,64 |
0a7fa00a | 7999 | mttcg="yes" |
7b0f97ba | 8000 | gdb_xml_files="i386-64bit.xml" |
2408a527 AJ |
8001 | ;; |
8002 | alpha) | |
5ee4f3c2 | 8003 | mttcg="yes" |
6116aea9 | 8004 | TARGET_SYSTBL_ABI=common |
2408a527 AJ |
8005 | ;; |
8006 | arm|armeb) | |
b498c8a0 | 8007 | TARGET_ARCH=arm |
5bcb4986 | 8008 | TARGET_SYSTBL_ABI=common,oabi |
2408a527 | 8009 | bflt="yes" |
ca759f9e | 8010 | mttcg="yes" |
c888f7e0 | 8011 | gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml arm-m-profile.xml" |
2408a527 | 8012 | ;; |
722dd7be MW |
8013 | aarch64|aarch64_be) |
8014 | TARGET_ARCH=aarch64 | |
6a49fa95 AG |
8015 | TARGET_BASE_ARCH=arm |
8016 | bflt="yes" | |
ca759f9e | 8017 | mttcg="yes" |
c888f7e0 | 8018 | 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 | 8019 | ;; |
42f3ff00 MR |
8020 | avr) |
8021 | gdb_xml_files="avr-cpu.xml" | |
8022 | target_compiler=$cross_cc_avr | |
8023 | ;; | |
2408a527 | 8024 | cris) |
2408a527 | 8025 | ;; |
61766fe9 | 8026 | hppa) |
7b93dab5 | 8027 | mttcg="yes" |
9566f4c6 | 8028 | TARGET_SYSTBL_ABI=common,32 |
61766fe9 | 8029 | ;; |
613a22c9 | 8030 | lm32) |
613a22c9 | 8031 | ;; |
2408a527 | 8032 | m68k) |
2408a527 | 8033 | bflt="yes" |
a976ed3f | 8034 | gdb_xml_files="cf-core.xml cf-fp.xml m68k-core.xml m68k-fp.xml" |
5b85cae9 | 8035 | TARGET_SYSTBL_ABI=common |
2408a527 | 8036 | ;; |
877fdc12 EI |
8037 | microblaze|microblazeel) |
8038 | TARGET_ARCH=microblaze | |
ddf0c4cd | 8039 | TARGET_SYSTBL_ABI=common |
72b675ca | 8040 | bflt="yes" |
be73ef64 | 8041 | echo "TARGET_ABI32=y" >> $config_target_mak |
72b675ca | 8042 | ;; |
0adcffb1 | 8043 | mips|mipsel) |
0454728c | 8044 | mttcg="yes" |
b498c8a0 | 8045 | TARGET_ARCH=mips |
25be210f | 8046 | echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak |
c59716fc | 8047 | TARGET_SYSTBL_ABI=o32 |
2408a527 AJ |
8048 | ;; |
8049 | mipsn32|mipsn32el) | |
0454728c | 8050 | mttcg="yes" |
597e2cec | 8051 | TARGET_ARCH=mips64 |
6acff7da | 8052 | TARGET_BASE_ARCH=mips |
25be210f | 8053 | echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak |
597e2cec | 8054 | echo "TARGET_ABI32=y" >> $config_target_mak |
686a0fe4 | 8055 | TARGET_SYSTBL_ABI=n32 |
2408a527 AJ |
8056 | ;; |
8057 | mips64|mips64el) | |
a092a955 | 8058 | mttcg="no" |
b498c8a0 | 8059 | TARGET_ARCH=mips64 |
6acff7da | 8060 | TARGET_BASE_ARCH=mips |
25be210f | 8061 | echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak |
686a0fe4 | 8062 | TARGET_SYSTBL_ABI=n64 |
2408a527 | 8063 | ;; |
d15a9c23 AG |
8064 | moxie) |
8065 | ;; | |
e671711c MV |
8066 | nios2) |
8067 | ;; | |
4a09d0bb | 8068 | or1k) |
e67db06e JL |
8069 | TARGET_ARCH=openrisc |
8070 | TARGET_BASE_ARCH=openrisc | |
e67db06e | 8071 | ;; |
2408a527 | 8072 | ppc) |
c8b3532d | 8073 | gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" |
76a691f1 | 8074 | TARGET_SYSTBL_ABI=common,nospu,32 |
2408a527 | 8075 | ;; |
2408a527 | 8076 | ppc64) |
6acff7da | 8077 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 8078 | TARGET_ABI_DIR=ppc |
76a691f1 | 8079 | TARGET_SYSTBL_ABI=common,nospu,64 |
f0b0685d | 8080 | mttcg=yes |
1438eff3 | 8081 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" |
2408a527 | 8082 | ;; |
9c35126c DK |
8083 | ppc64le) |
8084 | TARGET_ARCH=ppc64 | |
8085 | TARGET_BASE_ARCH=ppc | |
8086 | TARGET_ABI_DIR=ppc | |
76a691f1 | 8087 | TARGET_SYSTBL_ABI=common,nospu,64 |
f0b0685d | 8088 | mttcg=yes |
1438eff3 | 8089 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" |
9c35126c | 8090 | ;; |
2408a527 | 8091 | ppc64abi32) |
b498c8a0 | 8092 | TARGET_ARCH=ppc64 |
6acff7da | 8093 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 8094 | TARGET_ABI_DIR=ppc |
76a691f1 | 8095 | TARGET_SYSTBL_ABI=common,nospu,32 |
25be210f | 8096 | echo "TARGET_ABI32=y" >> $config_target_mak |
1438eff3 | 8097 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" |
2408a527 | 8098 | ;; |
25fa194b MC |
8099 | riscv32) |
8100 | TARGET_BASE_ARCH=riscv | |
8101 | TARGET_ABI_DIR=riscv | |
8102 | mttcg=yes | |
ae4a70c0 | 8103 | 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 |
8104 | ;; |
8105 | riscv64) | |
8106 | TARGET_BASE_ARCH=riscv | |
8107 | TARGET_ABI_DIR=riscv | |
8108 | mttcg=yes | |
ae4a70c0 | 8109 | gdb_xml_files="riscv-64bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-64bit-csr.xml riscv-64bit-virtual.xml" |
25fa194b | 8110 | ;; |
c8c35e5f YS |
8111 | rx) |
8112 | TARGET_ARCH=rx | |
8113 | bflt="yes" | |
8114 | target_compiler=$cross_cc_rx | |
8115 | gdb_xml_files="rx-core.xml" | |
8116 | ;; | |
2408a527 | 8117 | sh4|sh4eb) |
b498c8a0 | 8118 | TARGET_ARCH=sh4 |
d0c832f6 | 8119 | TARGET_SYSTBL_ABI=common |
2408a527 AJ |
8120 | bflt="yes" |
8121 | ;; | |
8122 | sparc) | |
bb0cdc03 | 8123 | TARGET_SYSTBL_ABI=common,32 |
2408a527 AJ |
8124 | ;; |
8125 | sparc64) | |
6acff7da | 8126 | TARGET_BASE_ARCH=sparc |
bb0cdc03 | 8127 | TARGET_SYSTBL_ABI=common,64 |
2408a527 AJ |
8128 | ;; |
8129 | sparc32plus) | |
b498c8a0 | 8130 | TARGET_ARCH=sparc64 |
6acff7da | 8131 | TARGET_BASE_ARCH=sparc |
e6e91b9c | 8132 | TARGET_ABI_DIR=sparc |
bb0cdc03 | 8133 | TARGET_SYSTBL_ABI=common,32 |
25be210f | 8134 | echo "TARGET_ABI32=y" >> $config_target_mak |
2408a527 | 8135 | ;; |
24e804ec | 8136 | s390x) |
318f371d | 8137 | TARGET_SYSTBL_ABI=common,64 |
63685bc4 | 8138 | mttcg=yes |
86158a2a | 8139 | 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 | 8140 | ;; |
444e06b1 CG |
8141 | tilegx) |
8142 | ;; | |
5ecaa4ed PC |
8143 | tricore) |
8144 | ;; | |
d2fbca94 | 8145 | unicore32) |
d2fbca94 | 8146 | ;; |
cfa550c6 MF |
8147 | xtensa|xtensaeb) |
8148 | TARGET_ARCH=xtensa | |
a4a93592 | 8149 | TARGET_SYSTBL_ABI=common |
02e33e9f | 8150 | bflt="yes" |
9fb40342 | 8151 | mttcg="yes" |
cfa550c6 | 8152 | ;; |
2408a527 | 8153 | *) |
76ad07a4 | 8154 | error_exit "Unsupported target CPU" |
2408a527 AJ |
8155 | ;; |
8156 | esac | |
5e8861a0 PB |
8157 | # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH |
8158 | if [ "$TARGET_BASE_ARCH" = "" ]; then | |
8159 | TARGET_BASE_ARCH=$TARGET_ARCH | |
8160 | fi | |
8161 | ||
5e8861a0 PB |
8162 | symlink "$source_path/Makefile.target" "$target_dir/Makefile" |
8163 | ||
99afc91d DB |
8164 | upper() { |
8165 | echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' | |
8166 | } | |
8167 | ||
89138857 | 8168 | target_arch_name="$(upper $TARGET_ARCH)" |
25be210f | 8169 | echo "TARGET_$target_arch_name=y" >> $config_target_mak |
c1799a84 | 8170 | echo "TARGET_NAME=$target_name" >> $config_target_mak |
25be210f | 8171 | echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak |
e6e91b9c JQ |
8172 | if [ "$TARGET_ABI_DIR" = "" ]; then |
8173 | TARGET_ABI_DIR=$TARGET_ARCH | |
8174 | fi | |
25be210f | 8175 | echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak |
adfc3e91 SS |
8176 | if [ "$HOST_VARIANT_DIR" != "" ]; then |
8177 | echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak | |
8178 | fi | |
4d6a835d LV |
8179 | if [ "$TARGET_SYSTBL_ABI" != "" ]; then |
8180 | echo "TARGET_SYSTBL_ABI=$TARGET_SYSTBL_ABI" >> $config_target_mak | |
8181 | fi | |
3b6b7550 PB |
8182 | |
8183 | if supported_xen_target $target; then | |
8184 | echo "CONFIG_XEN=y" >> $config_target_mak | |
e0e312f3 | 8185 | echo "$target/config-devices.mak: CONFIG_XEN=y" >> $config_host_mak |
3b6b7550 | 8186 | if test "$xen_pci_passthrough" = yes; then |
eb6fda0f | 8187 | echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" |
1b0c87fc | 8188 | fi |
e0e312f3 PB |
8189 | else |
8190 | echo "$target/config-devices.mak: CONFIG_XEN=n" >> $config_host_mak | |
3b6b7550 PB |
8191 | fi |
8192 | if supported_kvm_target $target; then | |
8193 | echo "CONFIG_KVM=y" >> $config_target_mak | |
e0e312f3 PB |
8194 | echo "$target/config-devices.mak: CONFIG_KVM=y" >> $config_host_mak |
8195 | else | |
8196 | echo "$target/config-devices.mak: CONFIG_KVM=n" >> $config_host_mak | |
3b6b7550 PB |
8197 | fi |
8198 | if supported_hax_target $target; then | |
8199 | echo "CONFIG_HAX=y" >> $config_target_mak | |
b0cb0a66 | 8200 | fi |
c97d6d2c SAGDR |
8201 | if supported_hvf_target $target; then |
8202 | echo "CONFIG_HVF=y" >> $config_target_mak | |
8203 | fi | |
d661d9a4 JTV |
8204 | if supported_whpx_target $target; then |
8205 | echo "CONFIG_WHPX=y" >> $config_target_mak | |
8206 | fi | |
52bf9771 TN |
8207 | if test "$target_aligned_only" = "yes" ; then |
8208 | echo "TARGET_ALIGNED_ONLY=y" >> $config_target_mak | |
8209 | fi | |
de83cd02 | 8210 | if test "$target_bigendian" = "yes" ; then |
25be210f | 8211 | echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak |
de83cd02 | 8212 | fi |
97a847bc | 8213 | if test "$target_softmmu" = "yes" ; then |
25be210f | 8214 | echo "CONFIG_SOFTMMU=y" >> $config_target_mak |
ca759f9e AB |
8215 | if test "$mttcg" = "yes" ; then |
8216 | echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak | |
8217 | fi | |
43ce4dfe | 8218 | fi |
997344f3 | 8219 | if test "$target_user_only" = "yes" ; then |
25be210f | 8220 | echo "CONFIG_USER_ONLY=y" >> $config_target_mak |
a2c80be9 | 8221 | echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak |
997344f3 | 8222 | fi |
831b7825 | 8223 | if test "$target_linux_user" = "yes" ; then |
25be210f | 8224 | echo "CONFIG_LINUX_USER=y" >> $config_target_mak |
831b7825 | 8225 | fi |
56aebc89 PB |
8226 | list="" |
8227 | if test ! -z "$gdb_xml_files" ; then | |
8228 | for x in $gdb_xml_files; do | |
8229 | list="$list $source_path/gdb-xml/$x" | |
8230 | done | |
3d0f1517 | 8231 | echo "TARGET_XML_FILES=$list" >> $config_target_mak |
56aebc89 | 8232 | fi |
97a847bc | 8233 | |
e633a5c6 | 8234 | if test "$target_user_only" = "yes" && test "$bflt" = "yes"; then |
25be210f | 8235 | echo "TARGET_HAS_BFLT=y" >> $config_target_mak |
e5fe0c52 | 8236 | fi |
84778508 | 8237 | if test "$target_bsd_user" = "yes" ; then |
25be210f | 8238 | echo "CONFIG_BSD_USER=y" >> $config_target_mak |
84778508 | 8239 | fi |
5b0753e0 | 8240 | |
716a507c | 8241 | |
db5adeaa | 8242 | # generate QEMU_CFLAGS/QEMU_LDFLAGS for targets |
fa282484 | 8243 | |
4afddb55 | 8244 | cflags="" |
fa282484 | 8245 | ldflags="" |
9b8e111f | 8246 | |
c765fcac PC |
8247 | disas_config() { |
8248 | echo "CONFIG_${1}_DIS=y" >> $config_target_mak | |
8249 | echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak | |
8250 | } | |
8251 | ||
64656024 JQ |
8252 | for i in $ARCH $TARGET_BASE_ARCH ; do |
8253 | case "$i" in | |
8254 | alpha) | |
c765fcac | 8255 | disas_config "ALPHA" |
64656024 | 8256 | ;; |
82295d8a RH |
8257 | aarch64) |
8258 | if test -n "${cxx}"; then | |
c765fcac | 8259 | disas_config "ARM_A64" |
82295d8a RH |
8260 | fi |
8261 | ;; | |
64656024 | 8262 | arm) |
c765fcac | 8263 | disas_config "ARM" |
999b53ec | 8264 | if test -n "${cxx}"; then |
c765fcac | 8265 | disas_config "ARM_A64" |
999b53ec | 8266 | fi |
64656024 | 8267 | ;; |
42f3ff00 MR |
8268 | avr) |
8269 | disas_config "AVR" | |
8270 | ;; | |
64656024 | 8271 | cris) |
c765fcac | 8272 | disas_config "CRIS" |
64656024 | 8273 | ;; |
429b31a2 RH |
8274 | hppa) |
8275 | disas_config "HPPA" | |
8276 | ;; | |
c72b26ec | 8277 | i386|x86_64|x32) |
c765fcac | 8278 | disas_config "I386" |
64656024 | 8279 | ;; |
79368f49 | 8280 | lm32) |
c765fcac | 8281 | disas_config "LM32" |
79368f49 | 8282 | ;; |
64656024 | 8283 | m68k) |
c765fcac | 8284 | disas_config "M68K" |
64656024 | 8285 | ;; |
877fdc12 | 8286 | microblaze*) |
c765fcac | 8287 | disas_config "MICROBLAZE" |
64656024 JQ |
8288 | ;; |
8289 | mips*) | |
c765fcac | 8290 | disas_config "MIPS" |
89a955e8 AM |
8291 | if test -n "${cxx}"; then |
8292 | disas_config "NANOMIPS" | |
8293 | fi | |
64656024 | 8294 | ;; |
d15a9c23 | 8295 | moxie*) |
c765fcac | 8296 | disas_config "MOXIE" |
d15a9c23 | 8297 | ;; |
e671711c MV |
8298 | nios2) |
8299 | disas_config "NIOS2" | |
8300 | ;; | |
4a09d0bb | 8301 | or1k) |
c765fcac | 8302 | disas_config "OPENRISC" |
e67db06e | 8303 | ;; |
64656024 | 8304 | ppc*) |
c765fcac | 8305 | disas_config "PPC" |
64656024 | 8306 | ;; |
c4f80543 | 8307 | riscv*) |
25fa194b MC |
8308 | disas_config "RISCV" |
8309 | ;; | |
c8c35e5f YS |
8310 | rx) |
8311 | disas_config "RX" | |
8312 | ;; | |
24e804ec | 8313 | s390*) |
c765fcac | 8314 | disas_config "S390" |
64656024 JQ |
8315 | ;; |
8316 | sh4) | |
c765fcac | 8317 | disas_config "SH4" |
64656024 JQ |
8318 | ;; |
8319 | sparc*) | |
c765fcac | 8320 | disas_config "SPARC" |
64656024 | 8321 | ;; |
cfa550c6 | 8322 | xtensa*) |
c765fcac | 8323 | disas_config "XTENSA" |
cfa550c6 | 8324 | ;; |
64656024 JQ |
8325 | esac |
8326 | done | |
9195b2c2 | 8327 | if test "$tcg_interpreter" = "yes" ; then |
c765fcac | 8328 | disas_config "TCI" |
9195b2c2 | 8329 | fi |
64656024 | 8330 | |
e9a3591f CB |
8331 | # Newer kernels on s390 check for an S390_PGSTE program header and |
8332 | # enable the pgste page table extensions in that case. This makes | |
8333 | # the vm.allocate_pgste sysctl unnecessary. We enable this program | |
8334 | # header if | |
8335 | # - we build on s390x | |
8336 | # - we build the system emulation for s390x (qemu-system-s390x) | |
8337 | # - KVM is enabled | |
8338 | # - the linker supports --s390-pgste | |
e633a5c6 EB |
8339 | if test "$TARGET_ARCH" = "s390x" && test "$target_softmmu" = "yes" && \ |
8340 | test "$ARCH" = "s390x" && test "$kvm" = "yes"; then | |
e9a3591f CB |
8341 | if ld_has --s390-pgste ; then |
8342 | ldflags="-Wl,--s390-pgste $ldflags" | |
8343 | fi | |
8344 | fi | |
8345 | ||
db5adeaa | 8346 | echo "QEMU_LDFLAGS+=$ldflags" >> $config_target_mak |
25be210f | 8347 | echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak |
fa282484 | 8348 | |
97a847bc | 8349 | done # for target in $targets |
7d13299d | 8350 | |
d52c454a MAL |
8351 | echo "PIXMAN_CFLAGS=$pixman_cflags" >> $config_host_mak |
8352 | echo "PIXMAN_LIBS=$pixman_libs" >> $config_host_mak | |
8353 | ||
e3971d61 | 8354 | if [ "$fdt" = "git" ]; then |
3b8593ee | 8355 | echo "config-host.h: dtc/all" >> $config_host_mak |
a540f158 | 8356 | fi |
e219c499 | 8357 | if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then |
3b8593ee | 8358 | echo "config-host.h: capstone/all" >> $config_host_mak |
e219c499 RH |
8359 | fi |
8360 | if test -n "$LIBCAPSTONE"; then | |
8361 | echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak | |
8362 | fi | |
a540f158 | 8363 | |
a99d57bb WG |
8364 | if test "$numa" = "yes"; then |
8365 | echo "CONFIG_NUMA=y" >> $config_host_mak | |
8366 | fi | |
8367 | ||
fd0e6053 JS |
8368 | if test "$ccache_cpp2" = "yes"; then |
8369 | echo "export CCACHE_CPP2=y" >> $config_host_mak | |
8370 | fi | |
8371 | ||
1e4f6065 DB |
8372 | if test "$safe_stack" = "yes"; then |
8373 | echo "CONFIG_SAFESTACK=y" >> $config_host_mak | |
8374 | fi | |
8375 | ||
e29e5c6e PM |
8376 | # If we're using a separate build tree, set it up now. |
8377 | # DIRS are directories which we simply mkdir in the build tree; | |
8378 | # LINKS are things to symlink back into the source tree | |
8379 | # (these can be both files and directories). | |
8380 | # Caution: do not add files or directories here using wildcards. This | |
8381 | # will result in problems later if a new file matching the wildcard is | |
8382 | # added to the source tree -- nothing will cause configure to be rerun | |
8383 | # so the build tree will be missing the link back to the new file, and | |
8384 | # tests might fail. Prefer to keep the relevant files in their own | |
8385 | # directory and symlink the directory instead. | |
1cf4323e TH |
8386 | DIRS="tests tests/tcg tests/tcg/lm32 tests/qapi-schema tests/qtest/libqos" |
8387 | DIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph" | |
b855f8d1 | 8388 | DIRS="$DIRS docs docs/interop fsdev scsi" |
744a928c | 8389 | DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" |
8db2a4fd | 8390 | DIRS="$DIRS roms/seabios" |
2038f8c8 PB |
8391 | LINKS="Makefile" |
8392 | LINKS="$LINKS tests/tcg/lm32/Makefile po/Makefile" | |
8393 | LINKS="$LINKS tests/tcg/Makefile.target tests/fp/Makefile" | |
671f760b | 8394 | LINKS="$LINKS tests/plugin/Makefile" |
e29e5c6e | 8395 | LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps" |
e29e5c6e | 8396 | LINKS="$LINKS pc-bios/s390-ccw/Makefile" |
8db2a4fd | 8397 | LINKS="$LINKS roms/seabios/Makefile" |
e29e5c6e PM |
8398 | LINKS="$LINKS pc-bios/qemu-icon.bmp" |
8399 | LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit | |
39950353 PM |
8400 | LINKS="$LINKS tests/acceptance tests/data" |
8401 | LINKS="$LINKS tests/qemu-iotests/check" | |
8f8fd9ed | 8402 | LINKS="$LINKS python" |
753d11f2 RH |
8403 | for bios_file in \ |
8404 | $source_path/pc-bios/*.bin \ | |
225a9ab8 | 8405 | $source_path/pc-bios/*.lid \ |
753d11f2 RH |
8406 | $source_path/pc-bios/*.rom \ |
8407 | $source_path/pc-bios/*.dtb \ | |
e89e33e1 | 8408 | $source_path/pc-bios/*.img \ |
753d11f2 | 8409 | $source_path/pc-bios/openbios-* \ |
4e73c781 | 8410 | $source_path/pc-bios/u-boot.* \ |
26ce90fd | 8411 | $source_path/pc-bios/edk2-*.fd.bz2 \ |
753d11f2 RH |
8412 | $source_path/pc-bios/palcode-* |
8413 | do | |
e29e5c6e | 8414 | LINKS="$LINKS pc-bios/$(basename $bios_file)" |
d1807a4f PB |
8415 | done |
8416 | mkdir -p $DIRS | |
e29e5c6e | 8417 | for f in $LINKS ; do |
cab00a5a | 8418 | if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then |
f9245e10 PM |
8419 | symlink "$source_path/$f" "$f" |
8420 | fi | |
d1807a4f | 8421 | done |
1ad2134f | 8422 | |
2038f8c8 PB |
8423 | (for i in $cross_cc_vars; do |
8424 | export $i | |
8425 | done | |
afc3a8f9 | 8426 | export target_list source_path use_containers |
2038f8c8 PB |
8427 | $source_path/tests/tcg/configure.sh) |
8428 | ||
c34ebfdc | 8429 | # temporary config to build submodules |
8db2a4fd | 8430 | for rom in seabios; do |
c34ebfdc | 8431 | config_mak=roms/$rom/config.mak |
37116c89 | 8432 | echo "# Automatically generated by configure - do not modify" > $config_mak |
c34ebfdc | 8433 | echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak |
cdbd727c | 8434 | echo "AS=$as" >> $config_mak |
5f6f0e27 | 8435 | echo "CCAS=$ccas" >> $config_mak |
c34ebfdc AL |
8436 | echo "CC=$cc" >> $config_mak |
8437 | echo "BCC=bcc" >> $config_mak | |
3dd46c78 | 8438 | echo "CPP=$cpp" >> $config_mak |
c34ebfdc | 8439 | echo "OBJCOPY=objcopy" >> $config_mak |
a31a8642 | 8440 | echo "IASL=$iasl" >> $config_mak |
c34ebfdc | 8441 | echo "LD=$ld" >> $config_mak |
9f81aeb5 | 8442 | echo "RANLIB=$ranlib" >> $config_mak |
c34ebfdc AL |
8443 | done |
8444 | ||
76c7560a HR |
8445 | # set up qemu-iotests in this build directory |
8446 | iotests_common_env="tests/qemu-iotests/common.env" | |
76c7560a HR |
8447 | |
8448 | echo "# Automatically generated by configure - do not modify" > "$iotests_common_env" | |
8449 | echo >> "$iotests_common_env" | |
8450 | echo "export PYTHON='$python'" >> "$iotests_common_env" | |
8451 | ||
a5665051 | 8452 | if test "$skip_meson" = no; then |
fc929892 MAL |
8453 | cross="config-meson.cross.new" |
8454 | meson_quote() { | |
8455 | echo "['$(echo $* | sed "s/ /','/g")']" | |
8456 | } | |
8457 | ||
8458 | echo "# Automatically generated by configure - do not modify" > $cross | |
8459 | echo "[properties]" >> $cross | |
8460 | test -z "$cxx" && echo "link_language = 'c'" >> $cross | |
8461 | echo "[binaries]" >> $cross | |
8462 | echo "c = $(meson_quote $cc)" >> $cross | |
8463 | test -n "$cxx" && echo "cpp = $(meson_quote $cxx)" >> $cross | |
8464 | echo "ar = $(meson_quote $ar)" >> $cross | |
8465 | echo "nm = $(meson_quote $nm)" >> $cross | |
8466 | echo "pkgconfig = $(meson_quote $pkg_config_exe)" >> $cross | |
8467 | echo "ranlib = $(meson_quote $ranlib)" >> $cross | |
8468 | echo "strip = $(meson_quote $strip)" >> $cross | |
8469 | echo "windres = $(meson_quote $windres)" >> $cross | |
8470 | if test -n "$cross_prefix"; then | |
8471 | cross_arg="--cross-file config-meson.cross" | |
8472 | # Hack: Meson expects an absolute path for the *build* machine | |
8473 | # for the prefix, so add a slash in front of a Windows path that | |
8474 | # includes a drive letter. | |
8475 | # | |
8476 | # See https://github.com/mesonbuild/meson/issues/7577. | |
8477 | echo "[host_machine]" >> $cross | |
8478 | if test "$mingw32" = "yes" ; then | |
8479 | echo "system = 'windows'" >> $cross | |
8480 | case $prefix in | |
8481 | ?:*) pre_prefix=/ ;; | |
8482 | esac | |
8483 | fi | |
8484 | case "$ARCH" in | |
8485 | i386|x86_64) | |
8486 | echo "cpu_family = 'x86'" >> $cross | |
8487 | ;; | |
8488 | ppc64le) | |
8489 | echo "cpu_family = 'ppc64'" >> $cross | |
8490 | ;; | |
8491 | *) | |
8492 | echo "cpu_family = '$ARCH'" >> $cross | |
8493 | ;; | |
8494 | esac | |
8495 | echo "cpu = '$cpu'" >> $cross | |
8496 | if test "$bigendian" = "yes" ; then | |
8497 | echo "endian = 'big'" >> $cross | |
8498 | else | |
8499 | echo "endian = 'little'" >> $cross | |
8500 | fi | |
8501 | else | |
8502 | cross_arg="--native-file config-meson.cross" | |
8503 | fi | |
8504 | mv $cross config-meson.cross | |
8505 | ||
a5665051 PB |
8506 | rm -rf meson-private meson-info meson-logs |
8507 | NINJA=$PWD/ninjatool $meson setup \ | |
fc929892 MAL |
8508 | --prefix "${pre_prefix}$prefix" \ |
8509 | --libdir "${pre_prefix}$libdir" \ | |
8510 | --libexecdir "${pre_prefix}$libexecdir" \ | |
8511 | --bindir "${pre_prefix}$bindir" \ | |
8512 | --includedir "${pre_prefix}$includedir" \ | |
8513 | --datadir "${pre_prefix}$datadir" \ | |
8514 | --mandir "${pre_prefix}$mandir" \ | |
8515 | --sysconfdir "${pre_prefix}$sysconfdir" \ | |
8516 | --localstatedir "${pre_prefix}$local_statedir" \ | |
a5665051 PB |
8517 | -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ |
8518 | -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \ | |
8519 | -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \ | |
8520 | -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \ | |
fc929892 | 8521 | $cross_arg \ |
a5665051 PB |
8522 | "$PWD" "$source_path" |
8523 | ||
8524 | if test "$?" -ne 0 ; then | |
8525 | error_exit "meson setup failed" | |
8526 | fi | |
8527 | touch ninjatool.stamp | |
8528 | fi | |
8529 | ||
dc655404 MT |
8530 | # Save the configure command line for later reuse. |
8531 | cat <<EOD >config.status | |
8532 | #!/bin/sh | |
8533 | # Generated by configure. | |
8534 | # Run this file to recreate the current configuration. | |
8535 | # Compiler output produced by configure, useful for debugging | |
8536 | # configure, is in config.log if it exists. | |
8537 | EOD | |
e811da7f DB |
8538 | |
8539 | preserve_env() { | |
8540 | envname=$1 | |
8541 | ||
8542 | eval envval=\$$envname | |
8543 | ||
8544 | if test -n "$envval" | |
8545 | then | |
8546 | echo "$envname='$envval'" >> config.status | |
8547 | echo "export $envname" >> config.status | |
8548 | else | |
8549 | echo "unset $envname" >> config.status | |
8550 | fi | |
8551 | } | |
8552 | ||
8553 | # Preserve various env variables that influence what | |
8554 | # features/build target configure will detect | |
8555 | preserve_env AR | |
8556 | preserve_env AS | |
8557 | preserve_env CC | |
8558 | preserve_env CPP | |
8559 | preserve_env CXX | |
8560 | preserve_env INSTALL | |
8561 | preserve_env LD | |
8562 | preserve_env LD_LIBRARY_PATH | |
8563 | preserve_env LIBTOOL | |
8564 | preserve_env MAKE | |
8565 | preserve_env NM | |
8566 | preserve_env OBJCOPY | |
8567 | preserve_env PATH | |
8568 | preserve_env PKG_CONFIG | |
8569 | preserve_env PKG_CONFIG_LIBDIR | |
8570 | preserve_env PKG_CONFIG_PATH | |
8571 | preserve_env PYTHON | |
e811da7f DB |
8572 | preserve_env SDL2_CONFIG |
8573 | preserve_env SMBD | |
8574 | preserve_env STRIP | |
8575 | preserve_env WINDRES | |
8576 | ||
dc655404 | 8577 | printf "exec" >>config.status |
a5665051 PB |
8578 | for i in "$0" "$@"; do |
8579 | test "$i" = --skip-meson || printf " '%s'" "$i" >>config.status | |
8580 | done | |
cf7cc929 | 8581 | echo ' "$@"' >>config.status |
dc655404 MT |
8582 | chmod +x config.status |
8583 | ||
8cd05ab6 | 8584 | rm -r "$TMPDIR1" |