target/arm: Implement ARMv8.2-DotProd
[qemu.git] / configure
blobca7de4f55fc8f9018dde551c981e9d73767bfaa9
1 #!/bin/sh
3 # qemu configure script (c) 2003 Fabrice Bellard
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
11 # Don't allow CCACHE, if present, to use cached results of compile tests!
12 export CCACHE_RECACHE=yes
14 # Temporary directory used for files created while
15 # configure runs. Since it is in the build directory
16 # we can safely blow away any previous version of it
17 # (and we need not jump through hoops to try to delete
18 # it when configure exits.)
19 TMPDIR1="config-temp"
20 rm -rf "${TMPDIR1}"
21 mkdir -p "${TMPDIR1}"
22 if [ $? -ne 0 ]; then
23 echo "ERROR: failed to create temporary directory"
24 exit 1
27 TMPB="qemu-conf"
28 TMPC="${TMPDIR1}/${TMPB}.c"
29 TMPO="${TMPDIR1}/${TMPB}.o"
30 TMPCXX="${TMPDIR1}/${TMPB}.cxx"
31 TMPE="${TMPDIR1}/${TMPB}.exe"
32 TMPMO="${TMPDIR1}/${TMPB}.mo"
34 rm -f config.log
36 # Print a helpful header at the top of config.log
37 echo "# QEMU configure log $(date)" >> config.log
38 printf "# Configured with:" >> config.log
39 printf " '%s'" "$0" "$@" >> config.log
40 echo >> config.log
41 echo "#" >> config.log
43 print_error() {
44 (echo
45 echo "ERROR: $1"
46 while test -n "$2"; do
47 echo " $2"
48 shift
49 done
50 echo) >&2
53 error_exit() {
54 print_error "$@"
55 exit 1
58 do_compiler() {
59 # Run the compiler, capturing its output to the log. First argument
60 # is compiler binary to execute.
61 local compiler="$1"
62 shift
63 if test -n "$BASH_VERSION"; then eval '
64 echo >>config.log "
65 funcs: ${FUNCNAME[*]}
66 lines: ${BASH_LINENO[*]}"
67 '; fi
68 echo $compiler "$@" >> config.log
69 $compiler "$@" >> config.log 2>&1 || return $?
70 # Test passed. If this is an --enable-werror build, rerun
71 # the test with -Werror and bail out if it fails. This
72 # makes warning-generating-errors in configure test code
73 # obvious to developers.
74 if test "$werror" != "yes"; then
75 return 0
77 # Don't bother rerunning the compile if we were already using -Werror
78 case "$*" in
79 *-Werror*)
80 return 0
82 esac
83 echo $compiler -Werror "$@" >> config.log
84 $compiler -Werror "$@" >> config.log 2>&1 && return $?
85 error_exit "configure test passed without -Werror but failed with -Werror." \
86 "This is probably a bug in the configure script. The failing command" \
87 "will be at the bottom of config.log." \
88 "You can run configure with --disable-werror to bypass this check."
91 do_cc() {
92 do_compiler "$cc" "$@"
95 do_cxx() {
96 do_compiler "$cxx" "$@"
99 update_cxxflags() {
100 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
101 # options which some versions of GCC's C++ compiler complain about
102 # because they only make sense for C programs.
103 QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS"
105 for arg in $QEMU_CFLAGS; do
106 case $arg in
107 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
108 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
111 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
113 esac
114 done
117 compile_object() {
118 local_cflags="$1"
119 do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
122 compile_prog() {
123 local_cflags="$1"
124 local_ldflags="$2"
125 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
128 # symbolically link $1 to $2. Portable version of "ln -sf".
129 symlink() {
130 rm -rf "$2"
131 mkdir -p "$(dirname "$2")"
132 ln -s "$1" "$2"
135 # check whether a command is available to this shell (may be either an
136 # executable or a builtin)
137 has() {
138 type "$1" >/dev/null 2>&1
141 # search for an executable in PATH
142 path_of() {
143 local_command="$1"
144 local_ifs="$IFS"
145 local_dir=""
147 # pathname has a dir component?
148 if [ "${local_command#*/}" != "$local_command" ]; then
149 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
150 echo "$local_command"
151 return 0
154 if [ -z "$local_command" ]; then
155 return 1
158 IFS=:
159 for local_dir in $PATH; do
160 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
161 echo "$local_dir/$local_command"
162 IFS="${local_ifs:-$(printf ' \t\n')}"
163 return 0
165 done
166 # not found
167 IFS="${local_ifs:-$(printf ' \t\n')}"
168 return 1
171 have_backend () {
172 echo "$trace_backends" | grep "$1" >/dev/null
175 glob() {
176 eval test -z '"${1#'"$2"'}"'
179 supported_hax_target() {
180 test "$hax" = "yes" || return 1
181 glob "$1" "*-softmmu" || return 1
182 case "${1%-softmmu}" in
183 i386|x86_64)
184 return 0
186 esac
187 return 1
190 supported_kvm_target() {
191 test "$kvm" = "yes" || return 1
192 glob "$1" "*-softmmu" || return 1
193 case "${1%-softmmu}:$cpu" in
194 arm:arm | aarch64:aarch64 | \
195 i386:i386 | i386:x86_64 | i386:x32 | \
196 x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \
197 mips:mips | mipsel:mips | \
198 ppc:ppc | ppcemb:ppc | ppc64:ppc | \
199 ppc:ppc64 | ppcemb:ppc64 | ppc64:ppc64 | \
200 s390x:s390x)
201 return 0
203 esac
204 return 1
207 supported_xen_target() {
208 test "$xen" = "yes" || return 1
209 glob "$1" "*-softmmu" || return 1
210 # Only i386 and x86_64 provide the xenpv machine.
211 case "${1%-softmmu}" in
212 i386|x86_64)
213 return 0
215 esac
216 return 1
219 supported_hvf_target() {
220 test "$hvf" = "yes" || return 1
221 glob "$1" "*-softmmu" || return 1
222 case "${1%-softmmu}" in
223 x86_64)
224 return 0
226 esac
227 return 1
230 supported_whpx_target() {
231 test "$whpx" = "yes" || return 1
232 glob "$1" "*-softmmu" || return 1
233 case "${1%-softmmu}" in
234 i386|x86_64)
235 return 0
237 esac
238 return 1
241 supported_target() {
242 case "$1" in
243 *-softmmu)
245 *-linux-user)
246 if test "$linux" != "yes"; then
247 print_error "Target '$target' is only available on a Linux host"
248 return 1
251 *-bsd-user)
252 if test "$bsd" != "yes"; then
253 print_error "Target '$target' is only available on a BSD host"
254 return 1
258 print_error "Invalid target name '$target'"
259 return 1
261 esac
262 test "$tcg" = "yes" && return 0
263 supported_kvm_target "$1" && return 0
264 supported_xen_target "$1" && return 0
265 supported_hax_target "$1" && return 0
266 supported_hvf_target "$1" && return 0
267 supported_whpx_target "$1" && return 0
268 print_error "TCG disabled, but hardware accelerator not available for '$target'"
269 return 1
273 ld_has() {
274 $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
277 # default parameters
278 source_path=$(dirname "$0")
279 cpu=""
280 iasl="iasl"
281 interp_prefix="/usr/gnemul/qemu-%M"
282 static="no"
283 cross_prefix=""
284 audio_drv_list=""
285 block_drv_rw_whitelist=""
286 block_drv_ro_whitelist=""
287 host_cc="cc"
288 libs_softmmu=""
289 libs_tools=""
290 audio_pt_int=""
291 audio_win_int=""
292 libs_qga=""
293 debug_info="yes"
294 stack_protector=""
296 if test -e "$source_path/.git"
297 then
298 git_update=yes
299 git_submodules="ui/keycodemapdb"
300 else
301 git_update=no
302 git_submodules=""
304 git="git"
306 # Don't accept a target_list environment variable.
307 unset target_list
309 # Default value for a variable defining feature "foo".
310 # * foo="no" feature will only be used if --enable-foo arg is given
311 # * foo="" feature will be searched for, and if found, will be used
312 # unless --disable-foo is given
313 # * foo="yes" this value will only be set by --enable-foo flag.
314 # feature will searched for,
315 # if not found, configure exits with error
317 # Always add --enable-foo and --disable-foo command line args.
318 # Distributions want to ensure that several features are compiled in, and it
319 # is impossible without a --enable-foo that exits if a feature is not found.
321 bluez=""
322 brlapi=""
323 curl=""
324 curses=""
325 docs=""
326 fdt=""
327 netmap="no"
328 sdl=""
329 sdlabi=""
330 virtfs=""
331 mpath=""
332 vnc="yes"
333 sparse="no"
334 vde=""
335 vnc_sasl=""
336 vnc_jpeg=""
337 vnc_png=""
338 xkbcommon=""
339 xen=""
340 xen_ctrl_version=""
341 xen_pv_domain_build="no"
342 xen_pci_passthrough=""
343 linux_aio=""
344 cap_ng=""
345 attr=""
346 libattr=""
347 xfs=""
348 tcg="yes"
349 membarrier=""
350 vhost_net="no"
351 vhost_crypto="no"
352 vhost_scsi="no"
353 vhost_vsock="no"
354 vhost_user=""
355 kvm="no"
356 hax="no"
357 hvf="no"
358 whpx="no"
359 rdma=""
360 gprof="no"
361 debug_tcg="no"
362 debug="no"
363 sanitizers="no"
364 fortify_source=""
365 strip_opt="yes"
366 tcg_interpreter="no"
367 bigendian="no"
368 mingw32="no"
369 gcov="no"
370 gcov_tool="gcov"
371 EXESUF=""
372 DSOSUF=".so"
373 LDFLAGS_SHARED="-shared"
374 modules="no"
375 prefix="/usr/local"
376 mandir="\${prefix}/share/man"
377 datadir="\${prefix}/share"
378 firmwarepath="\${prefix}/share/qemu-firmware"
379 qemu_docdir="\${prefix}/share/doc/qemu"
380 bindir="\${prefix}/bin"
381 libdir="\${prefix}/lib"
382 libexecdir="\${prefix}/libexec"
383 includedir="\${prefix}/include"
384 sysconfdir="\${prefix}/etc"
385 local_statedir="\${prefix}/var"
386 confsuffix="/qemu"
387 slirp="yes"
388 oss_lib=""
389 bsd="no"
390 linux="no"
391 solaris="no"
392 profiler="no"
393 cocoa="no"
394 softmmu="yes"
395 linux_user="no"
396 bsd_user="no"
397 blobs="yes"
398 pkgversion=""
399 pie=""
400 qom_cast_debug="yes"
401 trace_backends="log"
402 trace_file="trace"
403 spice=""
404 rbd=""
405 smartcard=""
406 libusb=""
407 usb_redir=""
408 opengl=""
409 opengl_dmabuf="no"
410 cpuid_h="no"
411 avx2_opt="no"
412 zlib="yes"
413 capstone=""
414 lzo=""
415 snappy=""
416 bzip2=""
417 guest_agent=""
418 guest_agent_with_vss="no"
419 guest_agent_ntddscsi="no"
420 guest_agent_msi=""
421 vss_win32_sdk=""
422 win_sdk="no"
423 want_tools="yes"
424 libiscsi=""
425 libnfs=""
426 coroutine=""
427 coroutine_pool=""
428 debug_stack_usage="no"
429 crypto_afalg="no"
430 seccomp=""
431 glusterfs=""
432 glusterfs_xlator_opt="no"
433 glusterfs_discard="no"
434 glusterfs_fallocate="no"
435 glusterfs_zerofill="no"
436 gtk=""
437 gtkabi=""
438 gtk_gl="no"
439 tls_priority="NORMAL"
440 gnutls=""
441 gnutls_rnd=""
442 nettle=""
443 nettle_kdf="no"
444 gcrypt=""
445 gcrypt_hmac="no"
446 gcrypt_kdf="no"
447 vte=""
448 virglrenderer=""
449 tpm="yes"
450 libssh2=""
451 live_block_migration="yes"
452 numa=""
453 tcmalloc="no"
454 jemalloc="no"
455 replication="yes"
456 vxhs=""
457 libxml2=""
458 docker="no"
459 debug_mutex="no"
461 # cross compilers defaults, can be overridden with --cross-cc-ARCH
462 cross_cc_aarch64="aarch64-linux-gnu-gcc"
463 cross_cc_aarch64_be="$cross_cc_aarch64"
464 cross_cc_cflags_aarch64_be="-mbig-endian"
465 cross_cc_arm="arm-linux-gnueabihf-gcc"
466 cross_cc_cflags_armeb="-mbig-endian"
467 cross_cc_i386="i386-pc-linux-gnu-gcc"
468 cross_cc_cflags_i386=""
469 cross_cc_powerpc="powerpc-linux-gnu-gcc"
470 cross_cc_powerpc="powerpc-linux-gnu-gcc"
472 enabled_cross_compilers=""
474 supported_cpu="no"
475 supported_os="no"
476 bogus_os="no"
477 malloc_trim=""
479 # parse CC options first
480 for opt do
481 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
482 case "$opt" in
483 --cross-prefix=*) cross_prefix="$optarg"
485 --cc=*) CC="$optarg"
487 --cxx=*) CXX="$optarg"
489 --source-path=*) source_path="$optarg"
491 --cpu=*) cpu="$optarg"
493 --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
495 --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
497 --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
498 EXTRA_LDFLAGS="$optarg"
500 --enable-debug-info) debug_info="yes"
502 --disable-debug-info) debug_info="no"
504 --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option"
506 --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*}
507 eval "cross_cc_cflags_${cc_arch}=\$optarg"
509 --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
510 eval "cross_cc_${cc_arch}=\$optarg"
512 esac
513 done
514 # OS specific
515 # Using uname is really, really broken. Once we have the right set of checks
516 # we can eliminate its usage altogether.
518 # Preferred compiler:
519 # ${CC} (if set)
520 # ${cross_prefix}gcc (if cross-prefix specified)
521 # system compiler
522 if test -z "${CC}${cross_prefix}"; then
523 cc="$host_cc"
524 else
525 cc="${CC-${cross_prefix}gcc}"
528 if test -z "${CXX}${cross_prefix}"; then
529 cxx="c++"
530 else
531 cxx="${CXX-${cross_prefix}g++}"
534 ar="${AR-${cross_prefix}ar}"
535 as="${AS-${cross_prefix}as}"
536 ccas="${CCAS-$cc}"
537 cpp="${CPP-$cc -E}"
538 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
539 ld="${LD-${cross_prefix}ld}"
540 ranlib="${RANLIB-${cross_prefix}ranlib}"
541 nm="${NM-${cross_prefix}nm}"
542 strip="${STRIP-${cross_prefix}strip}"
543 windres="${WINDRES-${cross_prefix}windres}"
544 pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
545 query_pkg_config() {
546 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
548 pkg_config=query_pkg_config
549 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
550 sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
552 # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
553 ARFLAGS="${ARFLAGS-rv}"
555 # default flags for all hosts
556 # We use -fwrapv to tell the compiler that we require a C dialect where
557 # left shift of signed integers is well defined and has the expected
558 # 2s-complement style results. (Both clang and gcc agree that it
559 # provides these semantics.)
560 QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
561 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
562 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
563 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
564 QEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg -iquote \$(SRC_PATH)/include"
565 if test "$debug_info" = "yes"; then
566 CFLAGS="-g $CFLAGS"
567 LDFLAGS="-g $LDFLAGS"
570 # make source path absolute
571 source_path=$(cd "$source_path"; pwd)
573 # running configure in the source tree?
574 # we know that's the case if configure is there.
575 if test -f "./configure"; then
576 pwd_is_source_path="y"
577 else
578 pwd_is_source_path="n"
581 check_define() {
582 cat > $TMPC <<EOF
583 #if !defined($1)
584 #error $1 not defined
585 #endif
586 int main(void) { return 0; }
588 compile_object
591 check_include() {
592 cat > $TMPC <<EOF
593 #include <$1>
594 int main(void) { return 0; }
596 compile_object
599 write_c_skeleton() {
600 cat > $TMPC <<EOF
601 int main(void) { return 0; }
605 if check_define __linux__ ; then
606 targetos="Linux"
607 elif check_define _WIN32 ; then
608 targetos='MINGW32'
609 elif check_define __OpenBSD__ ; then
610 targetos='OpenBSD'
611 elif check_define __sun__ ; then
612 targetos='SunOS'
613 elif check_define __HAIKU__ ; then
614 targetos='Haiku'
615 elif check_define __FreeBSD__ ; then
616 targetos='FreeBSD'
617 elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then
618 targetos='GNU/kFreeBSD'
619 elif check_define __DragonFly__ ; then
620 targetos='DragonFly'
621 elif check_define __NetBSD__; then
622 targetos='NetBSD'
623 elif check_define __APPLE__; then
624 targetos='Darwin'
625 else
626 # This is a fatal error, but don't report it yet, because we
627 # might be going to just print the --help text, or it might
628 # be the result of a missing compiler.
629 targetos='bogus'
630 bogus_os='yes'
633 # Some host OSes need non-standard checks for which CPU to use.
634 # Note that these checks are broken for cross-compilation: if you're
635 # cross-compiling to one of these OSes then you'll need to specify
636 # the correct CPU with the --cpu option.
637 case $targetos in
638 Darwin)
639 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
640 # run 64-bit userspace code.
641 # If the user didn't specify a CPU explicitly and the kernel says this is
642 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
643 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
644 cpu="x86_64"
647 SunOS)
648 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
649 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
650 cpu="x86_64"
652 esac
654 if test ! -z "$cpu" ; then
655 # command line argument
657 elif check_define __i386__ ; then
658 cpu="i386"
659 elif check_define __x86_64__ ; then
660 if check_define __ILP32__ ; then
661 cpu="x32"
662 else
663 cpu="x86_64"
665 elif check_define __sparc__ ; then
666 if check_define __arch64__ ; then
667 cpu="sparc64"
668 else
669 cpu="sparc"
671 elif check_define _ARCH_PPC ; then
672 if check_define _ARCH_PPC64 ; then
673 cpu="ppc64"
674 else
675 cpu="ppc"
677 elif check_define __mips__ ; then
678 cpu="mips"
679 elif check_define __s390__ ; then
680 if check_define __s390x__ ; then
681 cpu="s390x"
682 else
683 cpu="s390"
685 elif check_define __arm__ ; then
686 cpu="arm"
687 elif check_define __aarch64__ ; then
688 cpu="aarch64"
689 else
690 cpu=$(uname -m)
693 ARCH=
694 # Normalise host CPU name and set ARCH.
695 # Note that this case should only have supported host CPUs, not guests.
696 case "$cpu" in
697 ppc|ppc64|s390|s390x|sparc64|x32)
698 cpu="$cpu"
699 supported_cpu="yes"
700 eval "cross_cc_${cpu}=\$host_cc"
702 i386|i486|i586|i686|i86pc|BePC)
703 cpu="i386"
704 supported_cpu="yes"
705 cross_cc_i386=$host_cc
707 x86_64|amd64)
708 cpu="x86_64"
709 supported_cpu="yes"
710 cross_cc_x86_64=$host_cc
712 armv*b|armv*l|arm)
713 cpu="arm"
714 supported_cpu="yes"
715 cross_cc_arm=$host_cc
717 aarch64)
718 cpu="aarch64"
719 supported_cpu="yes"
720 cross_cc_aarch64=$host_cc
722 mips*)
723 cpu="mips"
724 supported_cpu="yes"
725 cross_cc_mips=$host_cc
727 sparc|sun4[cdmuv])
728 cpu="sparc"
729 supported_cpu="yes"
730 cross_cc_sparc=$host_cc
733 # This will result in either an error or falling back to TCI later
734 ARCH=unknown
736 esac
737 if test -z "$ARCH"; then
738 ARCH="$cpu"
741 # OS specific
743 # host *BSD for user mode
744 HOST_VARIANT_DIR=""
746 case $targetos in
747 MINGW32*)
748 mingw32="yes"
749 hax="yes"
750 audio_possible_drivers="dsound sdl"
751 if check_include dsound.h; then
752 audio_drv_list="dsound"
753 else
754 audio_drv_list=""
756 supported_os="yes"
758 GNU/kFreeBSD)
759 bsd="yes"
760 audio_drv_list="oss"
761 audio_possible_drivers="oss sdl pa"
763 FreeBSD)
764 bsd="yes"
765 make="${MAKE-gmake}"
766 audio_drv_list="oss"
767 audio_possible_drivers="oss sdl pa"
768 # needed for kinfo_getvmmap(3) in libutil.h
769 LIBS="-lutil $LIBS"
770 # needed for kinfo_getproc
771 libs_qga="-lutil $libs_qga"
772 netmap="" # enable netmap autodetect
773 HOST_VARIANT_DIR="freebsd"
774 supported_os="yes"
776 DragonFly)
777 bsd="yes"
778 make="${MAKE-gmake}"
779 audio_drv_list="oss"
780 audio_possible_drivers="oss sdl pa"
781 HOST_VARIANT_DIR="dragonfly"
783 NetBSD)
784 bsd="yes"
785 make="${MAKE-gmake}"
786 audio_drv_list="oss"
787 audio_possible_drivers="oss sdl"
788 oss_lib="-lossaudio"
789 HOST_VARIANT_DIR="netbsd"
790 supported_os="yes"
792 OpenBSD)
793 bsd="yes"
794 make="${MAKE-gmake}"
795 audio_drv_list="sdl"
796 audio_possible_drivers="sdl"
797 HOST_VARIANT_DIR="openbsd"
798 supported_os="yes"
800 Darwin)
801 bsd="yes"
802 darwin="yes"
803 hax="yes"
804 hvf="yes"
805 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
806 if [ "$cpu" = "x86_64" ] ; then
807 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
808 LDFLAGS="-arch x86_64 $LDFLAGS"
810 cocoa="yes"
811 audio_drv_list="coreaudio"
812 audio_possible_drivers="coreaudio sdl"
813 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
814 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
815 # Disable attempts to use ObjectiveC features in os/object.h since they
816 # won't work when we're compiling with gcc as a C compiler.
817 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
818 HOST_VARIANT_DIR="darwin"
819 supported_os="yes"
821 SunOS)
822 solaris="yes"
823 make="${MAKE-gmake}"
824 install="${INSTALL-ginstall}"
825 smbd="${SMBD-/usr/sfw/sbin/smbd}"
826 if test -f /usr/include/sys/soundcard.h ; then
827 audio_drv_list="oss"
829 audio_possible_drivers="oss sdl"
830 # needed for CMSG_ macros in sys/socket.h
831 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
832 # needed for TIOCWIN* defines in termios.h
833 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
834 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
835 solarisnetlibs="-lsocket -lnsl -lresolv"
836 LIBS="$solarisnetlibs $LIBS"
837 libs_qga="$solarisnetlibs $libs_qga"
839 Haiku)
840 haiku="yes"
841 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
842 LIBS="-lposix_error_mapper -lnetwork $LIBS"
844 Linux)
845 audio_drv_list="oss"
846 audio_possible_drivers="oss alsa sdl pa"
847 linux="yes"
848 linux_user="yes"
849 kvm="yes"
850 vhost_net="yes"
851 vhost_crypto="yes"
852 vhost_scsi="yes"
853 vhost_vsock="yes"
854 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
855 supported_os="yes"
857 esac
859 if [ "$bsd" = "yes" ] ; then
860 if [ "$darwin" != "yes" ] ; then
861 bsd_user="yes"
865 : ${make=${MAKE-make}}
866 : ${install=${INSTALL-install}}
867 : ${python=${PYTHON-python}}
868 : ${smbd=${SMBD-/usr/sbin/smbd}}
870 # Default objcc to clang if available, otherwise use CC
871 if has clang; then
872 objcc=clang
873 else
874 objcc="$cc"
877 if test "$mingw32" = "yes" ; then
878 EXESUF=".exe"
879 DSOSUF=".dll"
880 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
881 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
882 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
883 # MinGW needs -mthreads for TLS and macro _MT.
884 QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
885 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
886 write_c_skeleton;
887 if compile_prog "" "-liberty" ; then
888 LIBS="-liberty $LIBS"
890 prefix="c:/Program Files/QEMU"
891 mandir="\${prefix}"
892 datadir="\${prefix}"
893 qemu_docdir="\${prefix}"
894 bindir="\${prefix}"
895 sysconfdir="\${prefix}"
896 local_statedir=
897 confsuffix=""
898 libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga"
901 werror=""
903 for opt do
904 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
905 case "$opt" in
906 --help|-h) show_help=yes
908 --version|-V) exec cat $source_path/VERSION
910 --prefix=*) prefix="$optarg"
912 --interp-prefix=*) interp_prefix="$optarg"
914 --source-path=*)
916 --cross-prefix=*)
918 --cc=*)
920 --host-cc=*) host_cc="$optarg"
922 --cxx=*)
924 --iasl=*) iasl="$optarg"
926 --objcc=*) objcc="$optarg"
928 --make=*) make="$optarg"
930 --install=*) install="$optarg"
932 --python=*) python="$optarg"
934 --gcov=*) gcov_tool="$optarg"
936 --smbd=*) smbd="$optarg"
938 --extra-cflags=*)
940 --extra-cxxflags=*)
942 --extra-ldflags=*)
944 --enable-debug-info)
946 --disable-debug-info)
948 --cross-cc-*)
950 --enable-modules)
951 modules="yes"
953 --disable-modules)
954 modules="no"
956 --cpu=*)
958 --target-list=*) target_list="$optarg"
960 --enable-trace-backends=*) trace_backends="$optarg"
962 # XXX: backwards compatibility
963 --enable-trace-backend=*) trace_backends="$optarg"
965 --with-trace-file=*) trace_file="$optarg"
967 --enable-gprof) gprof="yes"
969 --enable-gcov) gcov="yes"
971 --static)
972 static="yes"
973 LDFLAGS="-static $LDFLAGS"
974 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
976 --mandir=*) mandir="$optarg"
978 --bindir=*) bindir="$optarg"
980 --libdir=*) libdir="$optarg"
982 --libexecdir=*) libexecdir="$optarg"
984 --includedir=*) includedir="$optarg"
986 --datadir=*) datadir="$optarg"
988 --with-confsuffix=*) confsuffix="$optarg"
990 --docdir=*) qemu_docdir="$optarg"
992 --sysconfdir=*) sysconfdir="$optarg"
994 --localstatedir=*) local_statedir="$optarg"
996 --firmwarepath=*) firmwarepath="$optarg"
998 --host=*|--build=*|\
999 --disable-dependency-tracking|\
1000 --sbindir=*|--sharedstatedir=*|\
1001 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
1002 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
1003 # These switches are silently ignored, for compatibility with
1004 # autoconf-generated configure scripts. This allows QEMU's
1005 # configure to be used by RPM and similar macros that set
1006 # lots of directory switches by default.
1008 --disable-sdl) sdl="no"
1010 --enable-sdl) sdl="yes"
1012 --with-sdlabi=*) sdlabi="$optarg"
1014 --disable-qom-cast-debug) qom_cast_debug="no"
1016 --enable-qom-cast-debug) qom_cast_debug="yes"
1018 --disable-virtfs) virtfs="no"
1020 --enable-virtfs) virtfs="yes"
1022 --disable-mpath) mpath="no"
1024 --enable-mpath) mpath="yes"
1026 --disable-vnc) vnc="no"
1028 --enable-vnc) vnc="yes"
1030 --oss-lib=*) oss_lib="$optarg"
1032 --audio-drv-list=*) audio_drv_list="$optarg"
1034 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
1036 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
1038 --enable-debug-tcg) debug_tcg="yes"
1040 --disable-debug-tcg) debug_tcg="no"
1042 --enable-debug)
1043 # Enable debugging options that aren't excessively noisy
1044 debug_tcg="yes"
1045 debug_mutex="yes"
1046 debug="yes"
1047 strip_opt="no"
1048 fortify_source="no"
1050 --enable-sanitizers) sanitizers="yes"
1052 --disable-sanitizers) sanitizers="no"
1054 --enable-sparse) sparse="yes"
1056 --disable-sparse) sparse="no"
1058 --disable-strip) strip_opt="no"
1060 --disable-vnc-sasl) vnc_sasl="no"
1062 --enable-vnc-sasl) vnc_sasl="yes"
1064 --disable-vnc-jpeg) vnc_jpeg="no"
1066 --enable-vnc-jpeg) vnc_jpeg="yes"
1068 --disable-vnc-png) vnc_png="no"
1070 --enable-vnc-png) vnc_png="yes"
1072 --disable-slirp) slirp="no"
1074 --disable-vde) vde="no"
1076 --enable-vde) vde="yes"
1078 --disable-netmap) netmap="no"
1080 --enable-netmap) netmap="yes"
1082 --disable-xen) xen="no"
1084 --enable-xen) xen="yes"
1086 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
1088 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
1090 --disable-xen-pv-domain-build) xen_pv_domain_build="no"
1092 --enable-xen-pv-domain-build) xen_pv_domain_build="yes"
1094 --disable-brlapi) brlapi="no"
1096 --enable-brlapi) brlapi="yes"
1098 --disable-bluez) bluez="no"
1100 --enable-bluez) bluez="yes"
1102 --disable-kvm) kvm="no"
1104 --enable-kvm) kvm="yes"
1106 --disable-hax) hax="no"
1108 --enable-hax) hax="yes"
1110 --disable-hvf) hvf="no"
1112 --enable-hvf) hvf="yes"
1114 --disable-whpx) whpx="no"
1116 --enable-whpx) whpx="yes"
1118 --disable-tcg-interpreter) tcg_interpreter="no"
1120 --enable-tcg-interpreter) tcg_interpreter="yes"
1122 --disable-cap-ng) cap_ng="no"
1124 --enable-cap-ng) cap_ng="yes"
1126 --disable-tcg) tcg="no"
1128 --enable-tcg) tcg="yes"
1130 --disable-malloc-trim) malloc_trim="no"
1132 --enable-malloc-trim) malloc_trim="yes"
1134 --disable-spice) spice="no"
1136 --enable-spice) spice="yes"
1138 --disable-libiscsi) libiscsi="no"
1140 --enable-libiscsi) libiscsi="yes"
1142 --disable-libnfs) libnfs="no"
1144 --enable-libnfs) libnfs="yes"
1146 --enable-profiler) profiler="yes"
1148 --disable-cocoa) cocoa="no"
1150 --enable-cocoa)
1151 cocoa="yes" ;
1152 audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
1154 --disable-system) softmmu="no"
1156 --enable-system) softmmu="yes"
1158 --disable-user)
1159 linux_user="no" ;
1160 bsd_user="no" ;
1162 --enable-user) ;;
1163 --disable-linux-user) linux_user="no"
1165 --enable-linux-user) linux_user="yes"
1167 --disable-bsd-user) bsd_user="no"
1169 --enable-bsd-user) bsd_user="yes"
1171 --enable-pie) pie="yes"
1173 --disable-pie) pie="no"
1175 --enable-werror) werror="yes"
1177 --disable-werror) werror="no"
1179 --enable-stack-protector) stack_protector="yes"
1181 --disable-stack-protector) stack_protector="no"
1183 --disable-curses) curses="no"
1185 --enable-curses) curses="yes"
1187 --disable-curl) curl="no"
1189 --enable-curl) curl="yes"
1191 --disable-fdt) fdt="no"
1193 --enable-fdt) fdt="yes"
1195 --disable-linux-aio) linux_aio="no"
1197 --enable-linux-aio) linux_aio="yes"
1199 --disable-attr) attr="no"
1201 --enable-attr) attr="yes"
1203 --disable-membarrier) membarrier="no"
1205 --enable-membarrier) membarrier="yes"
1207 --disable-blobs) blobs="no"
1209 --with-pkgversion=*) pkgversion="$optarg"
1211 --with-coroutine=*) coroutine="$optarg"
1213 --disable-coroutine-pool) coroutine_pool="no"
1215 --enable-coroutine-pool) coroutine_pool="yes"
1217 --enable-debug-stack-usage) debug_stack_usage="yes"
1219 --enable-crypto-afalg) crypto_afalg="yes"
1221 --disable-crypto-afalg) crypto_afalg="no"
1223 --disable-docs) docs="no"
1225 --enable-docs) docs="yes"
1227 --disable-vhost-net) vhost_net="no"
1229 --enable-vhost-net) vhost_net="yes"
1231 --disable-vhost-crypto) vhost_crypto="no"
1233 --enable-vhost-crypto)
1234 vhost_crypto="yes"
1235 if test "$mingw32" = "yes"; then
1236 error_exit "vhost-crypto isn't available on win32"
1239 --disable-vhost-scsi) vhost_scsi="no"
1241 --enable-vhost-scsi) vhost_scsi="yes"
1243 --disable-vhost-vsock) vhost_vsock="no"
1245 --enable-vhost-vsock) vhost_vsock="yes"
1247 --disable-opengl) opengl="no"
1249 --enable-opengl) opengl="yes"
1251 --disable-rbd) rbd="no"
1253 --enable-rbd) rbd="yes"
1255 --disable-xfsctl) xfs="no"
1257 --enable-xfsctl) xfs="yes"
1259 --disable-smartcard) smartcard="no"
1261 --enable-smartcard) smartcard="yes"
1263 --disable-libusb) libusb="no"
1265 --enable-libusb) libusb="yes"
1267 --disable-usb-redir) usb_redir="no"
1269 --enable-usb-redir) usb_redir="yes"
1271 --disable-zlib-test) zlib="no"
1273 --disable-lzo) lzo="no"
1275 --enable-lzo) lzo="yes"
1277 --disable-snappy) snappy="no"
1279 --enable-snappy) snappy="yes"
1281 --disable-bzip2) bzip2="no"
1283 --enable-bzip2) bzip2="yes"
1285 --enable-guest-agent) guest_agent="yes"
1287 --disable-guest-agent) guest_agent="no"
1289 --enable-guest-agent-msi) guest_agent_msi="yes"
1291 --disable-guest-agent-msi) guest_agent_msi="no"
1293 --with-vss-sdk) vss_win32_sdk=""
1295 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1297 --without-vss-sdk) vss_win32_sdk="no"
1299 --with-win-sdk) win_sdk=""
1301 --with-win-sdk=*) win_sdk="$optarg"
1303 --without-win-sdk) win_sdk="no"
1305 --enable-tools) want_tools="yes"
1307 --disable-tools) want_tools="no"
1309 --enable-seccomp) seccomp="yes"
1311 --disable-seccomp) seccomp="no"
1313 --disable-glusterfs) glusterfs="no"
1315 --enable-glusterfs) glusterfs="yes"
1317 --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
1318 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
1320 --enable-vhdx|--disable-vhdx)
1321 echo "$0: $opt is obsolete, VHDX driver is always built" >&2
1323 --enable-uuid|--disable-uuid)
1324 echo "$0: $opt is obsolete, UUID support is always built" >&2
1326 --disable-gtk) gtk="no"
1328 --enable-gtk) gtk="yes"
1330 --tls-priority=*) tls_priority="$optarg"
1332 --disable-gnutls) gnutls="no"
1334 --enable-gnutls) gnutls="yes"
1336 --disable-nettle) nettle="no"
1338 --enable-nettle) nettle="yes"
1340 --disable-gcrypt) gcrypt="no"
1342 --enable-gcrypt) gcrypt="yes"
1344 --enable-rdma) rdma="yes"
1346 --disable-rdma) rdma="no"
1348 --with-gtkabi=*) gtkabi="$optarg"
1350 --disable-vte) vte="no"
1352 --enable-vte) vte="yes"
1354 --disable-virglrenderer) virglrenderer="no"
1356 --enable-virglrenderer) virglrenderer="yes"
1358 --disable-tpm) tpm="no"
1360 --enable-tpm) tpm="yes"
1362 --disable-libssh2) libssh2="no"
1364 --enable-libssh2) libssh2="yes"
1366 --disable-live-block-migration) live_block_migration="no"
1368 --enable-live-block-migration) live_block_migration="yes"
1370 --disable-numa) numa="no"
1372 --enable-numa) numa="yes"
1374 --disable-libxml2) libxml2="no"
1376 --enable-libxml2) libxml2="yes"
1378 --disable-tcmalloc) tcmalloc="no"
1380 --enable-tcmalloc) tcmalloc="yes"
1382 --disable-jemalloc) jemalloc="no"
1384 --enable-jemalloc) jemalloc="yes"
1386 --disable-replication) replication="no"
1388 --enable-replication) replication="yes"
1390 --disable-vxhs) vxhs="no"
1392 --enable-vxhs) vxhs="yes"
1394 --disable-vhost-user) vhost_user="no"
1396 --enable-vhost-user)
1397 vhost_user="yes"
1398 if test "$mingw32" = "yes"; then
1399 error_exit "vhost-user isn't available on win32"
1402 --disable-capstone) capstone="no"
1404 --enable-capstone) capstone="yes"
1406 --enable-capstone=git) capstone="git"
1408 --enable-capstone=system) capstone="system"
1410 --with-git=*) git="$optarg"
1412 --enable-git-update) git_update=yes
1414 --disable-git-update) git_update=no
1416 --enable-debug-mutex) debug_mutex=yes
1418 --disable-debug-mutex) debug_mutex=no
1421 echo "ERROR: unknown option $opt"
1422 echo "Try '$0 --help' for more information"
1423 exit 1
1425 esac
1426 done
1428 if test "$vhost_user" = ""; then
1429 if test "$mingw32" = "yes"; then
1430 vhost_user="no"
1431 else
1432 vhost_user="yes"
1436 case "$cpu" in
1437 ppc)
1438 CPU_CFLAGS="-m32"
1439 LDFLAGS="-m32 $LDFLAGS"
1440 cross_cc_powerpc=$cc
1441 cross_cc_cflags_powerpc=$CPU_CFLAGS
1443 ppc64)
1444 CPU_CFLAGS="-m64"
1445 LDFLAGS="-m64 $LDFLAGS"
1446 cross_cc_ppc64=$cc
1447 cross_cc_cflags_ppc64=$CPU_CFLAGS
1449 sparc)
1450 CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc"
1451 LDFLAGS="-m32 -mv8plus $LDFLAGS"
1452 cross_cc_sparc=$cc
1453 cross_cc_cflags_sparc=$CPU_CFLAGS
1455 sparc64)
1456 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
1457 LDFLAGS="-m64 $LDFLAGS"
1458 cross_cc_sparc64=$cc
1459 cross_cc_cflags_sparc64=$CPU_CFLAGS
1461 s390)
1462 CPU_CFLAGS="-m31"
1463 LDFLAGS="-m31 $LDFLAGS"
1464 cross_cc_s390=$cc
1465 cross_cc_cflags_s390=$CPU_CFLAGS
1467 s390x)
1468 CPU_CFLAGS="-m64"
1469 LDFLAGS="-m64 $LDFLAGS"
1470 cross_cc_s390x=$cc
1471 cross_cc_cflags_s390x=$CPU_CFLAGS
1473 i386)
1474 CPU_CFLAGS="-m32"
1475 LDFLAGS="-m32 $LDFLAGS"
1476 cross_cc_i386=$cc
1477 cross_cc_cflags_i386=$CPU_CFLAGS
1479 x86_64)
1480 # ??? Only extremely old AMD cpus do not have cmpxchg16b.
1481 # If we truly care, we should simply detect this case at
1482 # runtime and generate the fallback to serial emulation.
1483 CPU_CFLAGS="-m64 -mcx16"
1484 LDFLAGS="-m64 $LDFLAGS"
1485 cross_cc_x86_64=$cc
1486 cross_cc_cflags_x86_64=$CPU_CFLAGS
1488 x32)
1489 CPU_CFLAGS="-mx32"
1490 LDFLAGS="-mx32 $LDFLAGS"
1491 cross_cc_i386=$cc
1492 cross_cc_cflags_i386=$CPU_CFLAGS
1494 # No special flags required for other host CPUs
1495 esac
1497 QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1499 # For user-mode emulation the host arch has to be one we explicitly
1500 # support, even if we're using TCI.
1501 if [ "$ARCH" = "unknown" ]; then
1502 bsd_user="no"
1503 linux_user="no"
1506 default_target_list=""
1508 mak_wilds=""
1510 if [ "$softmmu" = "yes" ]; then
1511 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
1513 if [ "$linux_user" = "yes" ]; then
1514 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
1516 if [ "$bsd_user" = "yes" ]; then
1517 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
1520 for config in $mak_wilds; do
1521 default_target_list="${default_target_list} $(basename "$config" .mak)"
1522 done
1524 # Enumerate public trace backends for --help output
1525 trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/'))
1527 if test x"$show_help" = x"yes" ; then
1528 cat << EOF
1530 Usage: configure [options]
1531 Options: [defaults in brackets after descriptions]
1533 Standard options:
1534 --help print this message
1535 --prefix=PREFIX install in PREFIX [$prefix]
1536 --interp-prefix=PREFIX where to find shared libraries, etc.
1537 use %M for cpu name [$interp_prefix]
1538 --target-list=LIST set target list (default: build everything)
1539 $(echo Available targets: $default_target_list | \
1540 fold -s -w 53 | sed -e 's/^/ /')
1542 Advanced options (experts only):
1543 --source-path=PATH path of source code [$source_path]
1544 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1545 --cc=CC use C compiler CC [$cc]
1546 --iasl=IASL use ACPI compiler IASL [$iasl]
1547 --host-cc=CC use C compiler CC [$host_cc] for code run at
1548 build time
1549 --cxx=CXX use C++ compiler CXX [$cxx]
1550 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1551 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
1552 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS
1553 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1554 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases
1555 --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests
1556 --make=MAKE use specified make [$make]
1557 --install=INSTALL use specified install [$install]
1558 --python=PYTHON use specified python [$python]
1559 --smbd=SMBD use specified smbd [$smbd]
1560 --with-git=GIT use specified git [$git]
1561 --static enable static build [$static]
1562 --mandir=PATH install man pages in PATH
1563 --datadir=PATH install firmware in PATH$confsuffix
1564 --docdir=PATH install documentation in PATH$confsuffix
1565 --bindir=PATH install binaries in PATH
1566 --libdir=PATH install libraries in PATH
1567 --libexecdir=PATH install helper binaries in PATH
1568 --sysconfdir=PATH install config in PATH$confsuffix
1569 --localstatedir=PATH install local state in PATH (set at runtime on win32)
1570 --firmwarepath=PATH search PATH for firmware files
1571 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
1572 --with-pkgversion=VERS use specified string as sub-version of the package
1573 --enable-debug enable common debug build options
1574 --enable-sanitizers enable default sanitizers
1575 --disable-strip disable stripping binaries
1576 --disable-werror disable compilation abort on warning
1577 --disable-stack-protector disable compiler-provided stack protection
1578 --audio-drv-list=LIST set audio drivers list:
1579 Available drivers: $audio_possible_drivers
1580 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1581 --block-drv-rw-whitelist=L
1582 set block driver read-write whitelist
1583 (affects only QEMU, not qemu-img)
1584 --block-drv-ro-whitelist=L
1585 set block driver read-only whitelist
1586 (affects only QEMU, not qemu-img)
1587 --enable-trace-backends=B Set trace backend
1588 Available backends: $trace_backend_list
1589 --with-trace-file=NAME Full PATH,NAME of file to store traces
1590 Default:trace-<pid>
1591 --disable-slirp disable SLIRP userspace network connectivity
1592 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1593 --enable-malloc-trim enable libc malloc_trim() for memory optimization
1594 --oss-lib path to OSS library
1595 --cpu=CPU Build for host CPU [$cpu]
1596 --with-coroutine=BACKEND coroutine backend. Supported options:
1597 ucontext, sigaltstack, windows
1598 --enable-gcov enable test coverage analysis with gcov
1599 --gcov=GCOV use specified gcov [$gcov_tool]
1600 --disable-blobs disable installing provided firmware blobs
1601 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1602 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1603 --tls-priority default TLS protocol/cipher priority string
1604 --enable-gprof QEMU profiling with gprof
1605 --enable-profiler profiler support
1606 --enable-xen-pv-domain-build
1607 xen pv domain builder
1608 --enable-debug-stack-usage
1609 track the maximum stack usage of stacks created by qemu_alloc_stack
1611 Optional features, enabled with --enable-FEATURE and
1612 disabled with --disable-FEATURE, default is enabled if available:
1614 system all system emulation targets
1615 user supported user emulation targets
1616 linux-user all linux usermode emulation targets
1617 bsd-user all BSD usermode emulation targets
1618 docs build documentation
1619 guest-agent build the QEMU Guest Agent
1620 guest-agent-msi build guest agent Windows MSI installation package
1621 pie Position Independent Executables
1622 modules modules support
1623 debug-tcg TCG debugging (default is disabled)
1624 debug-info debugging information
1625 sparse sparse checker
1627 gnutls GNUTLS cryptography support
1628 nettle nettle cryptography support
1629 gcrypt libgcrypt cryptography support
1630 sdl SDL UI
1631 --with-sdlabi select preferred SDL ABI 1.2 or 2.0
1632 gtk gtk UI
1633 --with-gtkabi select preferred GTK ABI 2.0 or 3.0
1634 vte vte support for the gtk UI
1635 curses curses UI
1636 vnc VNC UI support
1637 vnc-sasl SASL encryption for VNC server
1638 vnc-jpeg JPEG lossy compression for VNC server
1639 vnc-png PNG compression for VNC server
1640 cocoa Cocoa UI (Mac OS X only)
1641 virtfs VirtFS
1642 mpath Multipath persistent reservation passthrough
1643 xen xen backend driver support
1644 xen-pci-passthrough PCI passthrough support for Xen
1645 brlapi BrlAPI (Braile)
1646 curl curl connectivity
1647 membarrier membarrier system call (for Linux 4.14+ or Windows)
1648 fdt fdt device tree
1649 bluez bluez stack connectivity
1650 kvm KVM acceleration support
1651 hax HAX acceleration support
1652 hvf Hypervisor.framework acceleration support
1653 whpx Windows Hypervisor Platform acceleration support
1654 rdma Enable RDMA-based migration and PVRDMA support
1655 vde support for vde network
1656 netmap support for netmap network
1657 linux-aio Linux AIO support
1658 cap-ng libcap-ng support
1659 attr attr and xattr support
1660 vhost-net vhost-net acceleration support
1661 vhost-crypto vhost-crypto acceleration support
1662 spice spice
1663 rbd rados block device (rbd)
1664 libiscsi iscsi support
1665 libnfs nfs support
1666 smartcard smartcard support (libcacard)
1667 libusb libusb (for usb passthrough)
1668 live-block-migration Block migration in the main migration stream
1669 usb-redir usb network redirection support
1670 lzo support of lzo compression library
1671 snappy support of snappy compression library
1672 bzip2 support of bzip2 compression library
1673 (for reading bzip2-compressed dmg images)
1674 seccomp seccomp support
1675 coroutine-pool coroutine freelist (better performance)
1676 glusterfs GlusterFS backend
1677 tpm TPM support
1678 libssh2 ssh block device support
1679 numa libnuma support
1680 libxml2 for Parallels image format
1681 tcmalloc tcmalloc support
1682 jemalloc jemalloc support
1683 replication replication support
1684 vhost-vsock virtio sockets device support
1685 opengl opengl support
1686 virglrenderer virgl rendering support
1687 xfsctl xfsctl support
1688 qom-cast-debug cast debugging support
1689 tools build qemu-io, qemu-nbd and qemu-image tools
1690 vxhs Veritas HyperScale vDisk backend support
1691 crypto-afalg Linux AF_ALG crypto backend driver
1692 vhost-user vhost-user support
1693 capstone capstone disassembler support
1694 debug-mutex mutex debugging support
1696 NOTE: The object files are built at the place where configure is launched
1698 exit 0
1701 if ! has $python; then
1702 error_exit "Python not found. Use --python=/path/to/python"
1705 # Note that if the Python conditional here evaluates True we will exit
1706 # with status 1 which is a shell 'false' value.
1707 if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then
1708 error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 is required." \
1709 "Use --python=/path/to/python to specify a supported Python."
1712 # Suppress writing compiled files
1713 python="$python -B"
1715 # Check that the C compiler works. Doing this here before testing
1716 # the host CPU ensures that we had a valid CC to autodetect the
1717 # $cpu var (and we should bail right here if that's not the case).
1718 # It also allows the help message to be printed without a CC.
1719 write_c_skeleton;
1720 if compile_object ; then
1721 : C compiler works ok
1722 else
1723 error_exit "\"$cc\" either does not exist or does not work"
1725 if ! compile_prog ; then
1726 error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
1729 # Now we have handled --enable-tcg-interpreter and know we're not just
1730 # printing the help message, bail out if the host CPU isn't supported.
1731 if test "$ARCH" = "unknown"; then
1732 if test "$tcg_interpreter" = "yes" ; then
1733 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1734 else
1735 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1739 # Consult white-list to determine whether to enable werror
1740 # by default. Only enable by default for git builds
1741 if test -z "$werror" ; then
1742 if test -d "$source_path/.git" -a \
1743 \( "$linux" = "yes" -o "$mingw32" = "yes" \) ; then
1744 werror="yes"
1745 else
1746 werror="no"
1750 if test "$bogus_os" = "yes"; then
1751 # Now that we know that we're not printing the help and that
1752 # the compiler works (so the results of the check_defines we used
1753 # to identify the OS are reliable), if we didn't recognize the
1754 # host OS we should stop now.
1755 error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
1758 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1759 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1760 gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1761 gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
1762 gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags"
1763 gcc_flags="-Wno-string-plus-int $gcc_flags"
1764 gcc_flags="-Wno-error=address-of-packed-member $gcc_flags"
1765 # Note that we do not add -Werror to gcc_flags here, because that would
1766 # enable it for all configure tests. If a configure test failed due
1767 # to -Werror this would just silently disable some features,
1768 # so it's too error prone.
1770 cc_has_warning_flag() {
1771 write_c_skeleton;
1773 # Use the positive sense of the flag when testing for -Wno-wombat
1774 # support (gcc will happily accept the -Wno- form of unknown
1775 # warning options).
1776 optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
1777 compile_prog "-Werror $optflag" ""
1780 for flag in $gcc_flags; do
1781 if cc_has_warning_flag $flag ; then
1782 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1784 done
1786 if test "$stack_protector" != "no"; then
1787 cat > $TMPC << EOF
1788 int main(int argc, char *argv[])
1790 char arr[64], *p = arr, *c = argv[0];
1791 while (*c) {
1792 *p++ = *c++;
1794 return 0;
1797 gcc_flags="-fstack-protector-strong -fstack-protector-all"
1798 sp_on=0
1799 for flag in $gcc_flags; do
1800 # We need to check both a compile and a link, since some compiler
1801 # setups fail only on a .c->.o compile and some only at link time
1802 if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
1803 compile_prog "-Werror $flag" ""; then
1804 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1805 sp_on=1
1806 break
1808 done
1809 if test "$stack_protector" = yes; then
1810 if test $sp_on = 0; then
1811 error_exit "Stack protector not supported"
1816 # Disable -Wmissing-braces on older compilers that warn even for
1817 # the "universal" C zero initializer {0}.
1818 cat > $TMPC << EOF
1819 struct {
1820 int a[2];
1821 } x = {0};
1823 if compile_object "-Werror" "" ; then
1825 else
1826 QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces"
1829 # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1830 # large functions that use global variables. The bug is in all releases of
1831 # GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1832 # 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1833 cat > $TMPC << EOF
1834 #if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1835 int main(void) { return 0; }
1836 #else
1837 #error No bug in this compiler.
1838 #endif
1840 if compile_prog "-Werror -fno-gcse" "" ; then
1841 TRANSLATE_OPT_CFLAGS=-fno-gcse
1844 if test "$static" = "yes" ; then
1845 if test "$modules" = "yes" ; then
1846 error_exit "static and modules are mutually incompatible"
1848 if test "$pie" = "yes" ; then
1849 error_exit "static and pie are mutually incompatible"
1850 else
1851 pie="no"
1855 # Unconditional check for compiler __thread support
1856 cat > $TMPC << EOF
1857 static __thread int tls_var;
1858 int main(void) { return tls_var; }
1861 if ! compile_prog "-Werror" "" ; then
1862 error_exit "Your compiler does not support the __thread specifier for " \
1863 "Thread-Local Storage (TLS). Please upgrade to a version that does."
1866 if test "$pie" = ""; then
1867 case "$cpu-$targetos" in
1868 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
1871 pie="no"
1873 esac
1876 if test "$pie" != "no" ; then
1877 cat > $TMPC << EOF
1879 #ifdef __linux__
1880 # define THREAD __thread
1881 #else
1882 # define THREAD
1883 #endif
1885 static THREAD int tls_var;
1887 int main(void) { return tls_var; }
1890 if compile_prog "-fPIE -DPIE" "-pie"; then
1891 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1892 LDFLAGS="-pie $LDFLAGS"
1893 pie="yes"
1894 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1895 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1897 else
1898 if test "$pie" = "yes"; then
1899 error_exit "PIE not available due to missing toolchain support"
1900 else
1901 echo "Disabling PIE due to missing toolchain support"
1902 pie="no"
1906 if compile_prog "-Werror -fno-pie" "-nopie"; then
1907 CFLAGS_NOPIE="-fno-pie"
1908 LDFLAGS_NOPIE="-nopie"
1912 ##########################################
1913 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
1914 # use i686 as default anyway, but for those that don't, an explicit
1915 # specification is necessary
1917 if test "$cpu" = "i386"; then
1918 cat > $TMPC << EOF
1919 static int sfaa(int *ptr)
1921 return __sync_fetch_and_and(ptr, 0);
1924 int main(void)
1926 int val = 42;
1927 val = __sync_val_compare_and_swap(&val, 0, 1);
1928 sfaa(&val);
1929 return val;
1932 if ! compile_prog "" "" ; then
1933 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1937 #########################################
1938 # Solaris specific configure tool chain decisions
1940 if test "$solaris" = "yes" ; then
1941 if has $install; then
1943 else
1944 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1945 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1946 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1948 if test "$(path_of $install)" = "/usr/sbin/install" ; then
1949 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1950 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1951 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1953 if has ar; then
1955 else
1956 if test -f /usr/ccs/bin/ar ; then
1957 error_exit "No path includes ar" \
1958 "Add /usr/ccs/bin to your path and rerun configure"
1960 error_exit "No path includes ar"
1964 if test -z "${target_list+xxx}" ; then
1965 for target in $default_target_list; do
1966 supported_target $target 2>/dev/null && \
1967 target_list="$target_list $target"
1968 done
1969 target_list="${target_list# }"
1970 else
1971 target_list=$(echo "$target_list" | sed -e 's/,/ /g')
1972 for target in $target_list; do
1973 # Check that we recognised the target name; this allows a more
1974 # friendly error message than if we let it fall through.
1975 case " $default_target_list " in
1976 *" $target "*)
1979 error_exit "Unknown target name '$target'"
1981 esac
1982 supported_target $target || exit 1
1983 done
1986 # see if system emulation was really requested
1987 case " $target_list " in
1988 *"-softmmu "*) softmmu=yes
1990 *) softmmu=no
1992 esac
1994 feature_not_found() {
1995 feature=$1
1996 remedy=$2
1998 error_exit "User requested feature $feature" \
1999 "configure was not able to find it." \
2000 "$remedy"
2003 # ---
2004 # big/little endian test
2005 cat > $TMPC << EOF
2006 short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
2007 short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
2008 extern int foo(short *, short *);
2009 int main(int argc, char *argv[]) {
2010 return foo(big_endian, little_endian);
2014 if compile_object ; then
2015 if strings -a $TMPO | grep -q BiGeNdIaN ; then
2016 bigendian="yes"
2017 elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
2018 bigendian="no"
2019 else
2020 echo big/little test failed
2022 else
2023 echo big/little test failed
2026 ##########################################
2027 # cocoa implies not SDL or GTK
2028 # (the cocoa UI code currently assumes it is always the active UI
2029 # and doesn't interact well with other UI frontend code)
2030 if test "$cocoa" = "yes"; then
2031 if test "$sdl" = "yes"; then
2032 error_exit "Cocoa and SDL UIs cannot both be enabled at once"
2034 if test "$gtk" = "yes"; then
2035 error_exit "Cocoa and GTK UIs cannot both be enabled at once"
2037 gtk=no
2038 sdl=no
2041 # Some versions of Mac OS X incorrectly define SIZE_MAX
2042 cat > $TMPC << EOF
2043 #include <stdint.h>
2044 #include <stdio.h>
2045 int main(int argc, char *argv[]) {
2046 return printf("%zu", SIZE_MAX);
2049 have_broken_size_max=no
2050 if ! compile_object -Werror ; then
2051 have_broken_size_max=yes
2054 ##########################################
2055 # L2TPV3 probe
2057 cat > $TMPC <<EOF
2058 #include <sys/socket.h>
2059 #include <linux/ip.h>
2060 int main(void) { return sizeof(struct mmsghdr); }
2062 if compile_prog "" "" ; then
2063 l2tpv3=yes
2064 else
2065 l2tpv3=no
2068 ##########################################
2069 # MinGW / Mingw-w64 localtime_r/gmtime_r check
2071 if test "$mingw32" = "yes"; then
2072 # Some versions of MinGW / Mingw-w64 lack localtime_r
2073 # and gmtime_r entirely.
2075 # Some versions of Mingw-w64 define a macro for
2076 # localtime_r/gmtime_r.
2078 # Some versions of Mingw-w64 will define functions
2079 # for localtime_r/gmtime_r, but only if you have
2080 # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
2081 # though, unistd.h and pthread.h both define
2082 # that for you.
2084 # So this #undef localtime_r and #include <unistd.h>
2085 # are not in fact redundant.
2086 cat > $TMPC << EOF
2087 #include <unistd.h>
2088 #include <time.h>
2089 #undef localtime_r
2090 int main(void) { localtime_r(NULL, NULL); return 0; }
2092 if compile_prog "" "" ; then
2093 localtime_r="yes"
2094 else
2095 localtime_r="no"
2099 ##########################################
2100 # pkg-config probe
2102 if ! has "$pkg_config_exe"; then
2103 error_exit "pkg-config binary '$pkg_config_exe' not found"
2106 ##########################################
2107 # NPTL probe
2109 if test "$linux_user" = "yes"; then
2110 cat > $TMPC <<EOF
2111 #include <sched.h>
2112 #include <linux/futex.h>
2113 int main(void) {
2114 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
2115 #error bork
2116 #endif
2117 return 0;
2120 if ! compile_object ; then
2121 feature_not_found "nptl" "Install glibc and linux kernel headers."
2125 #########################################
2126 # zlib check
2128 if test "$zlib" != "no" ; then
2129 cat > $TMPC << EOF
2130 #include <zlib.h>
2131 int main(void) { zlibVersion(); return 0; }
2133 if compile_prog "" "-lz" ; then
2135 else
2136 error_exit "zlib check failed" \
2137 "Make sure to have the zlib libs and headers installed."
2140 LIBS="$LIBS -lz"
2142 ##########################################
2143 # lzo check
2145 if test "$lzo" != "no" ; then
2146 cat > $TMPC << EOF
2147 #include <lzo/lzo1x.h>
2148 int main(void) { lzo_version(); return 0; }
2150 if compile_prog "" "-llzo2" ; then
2151 libs_softmmu="$libs_softmmu -llzo2"
2152 lzo="yes"
2153 else
2154 if test "$lzo" = "yes"; then
2155 feature_not_found "liblzo2" "Install liblzo2 devel"
2157 lzo="no"
2161 ##########################################
2162 # snappy check
2164 if test "$snappy" != "no" ; then
2165 cat > $TMPC << EOF
2166 #include <snappy-c.h>
2167 int main(void) { snappy_max_compressed_length(4096); return 0; }
2169 if compile_prog "" "-lsnappy" ; then
2170 libs_softmmu="$libs_softmmu -lsnappy"
2171 snappy="yes"
2172 else
2173 if test "$snappy" = "yes"; then
2174 feature_not_found "libsnappy" "Install libsnappy devel"
2176 snappy="no"
2180 ##########################################
2181 # bzip2 check
2183 if test "$bzip2" != "no" ; then
2184 cat > $TMPC << EOF
2185 #include <bzlib.h>
2186 int main(void) { BZ2_bzlibVersion(); return 0; }
2188 if compile_prog "" "-lbz2" ; then
2189 bzip2="yes"
2190 else
2191 if test "$bzip2" = "yes"; then
2192 feature_not_found "libbzip2" "Install libbzip2 devel"
2194 bzip2="no"
2198 ##########################################
2199 # libseccomp check
2201 if test "$seccomp" != "no" ; then
2202 case "$cpu" in
2203 i386|x86_64)
2204 libseccomp_minver="2.1.0"
2206 mips)
2207 libseccomp_minver="2.2.0"
2209 arm|aarch64)
2210 libseccomp_minver="2.2.3"
2212 ppc|ppc64|s390x)
2213 libseccomp_minver="2.3.0"
2216 libseccomp_minver=""
2218 esac
2220 if test "$libseccomp_minver" != "" &&
2221 $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
2222 seccomp_cflags="$($pkg_config --cflags libseccomp)"
2223 seccomp_libs="$($pkg_config --libs libseccomp)"
2224 seccomp="yes"
2225 else
2226 if test "$seccomp" = "yes" ; then
2227 if test "$libseccomp_minver" != "" ; then
2228 feature_not_found "libseccomp" \
2229 "Install libseccomp devel >= $libseccomp_minver"
2230 else
2231 feature_not_found "libseccomp" \
2232 "libseccomp is not supported for host cpu $cpu"
2235 seccomp="no"
2238 ##########################################
2239 # xen probe
2241 if test "$xen" != "no" ; then
2242 # Check whether Xen library path is specified via --extra-ldflags to avoid
2243 # overriding this setting with pkg-config output. If not, try pkg-config
2244 # to obtain all needed flags.
2246 if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \
2247 $pkg_config --exists xencontrol ; then
2248 xen_ctrl_version="$(printf '%d%02d%02d' \
2249 $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
2250 xen=yes
2251 xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
2252 xen_pc="$xen_pc xenevtchn xendevicemodel"
2253 if $pkg_config --exists xentoolcore; then
2254 xen_pc="$xen_pc xentoolcore"
2256 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
2257 libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
2258 LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS"
2259 else
2261 xen_libs="-lxenstore -lxenctrl -lxenguest"
2262 xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
2264 # First we test whether Xen headers and libraries are available.
2265 # If no, we are done and there is no Xen support.
2266 # If yes, more tests are run to detect the Xen version.
2268 # Xen (any)
2269 cat > $TMPC <<EOF
2270 #include <xenctrl.h>
2271 int main(void) {
2272 return 0;
2275 if ! compile_prog "" "$xen_libs" ; then
2276 # Xen not found
2277 if test "$xen" = "yes" ; then
2278 feature_not_found "xen" "Install xen devel"
2280 xen=no
2282 # Xen unstable
2283 elif
2284 cat > $TMPC <<EOF &&
2285 #undef XC_WANT_COMPAT_DEVICEMODEL_API
2286 #define __XEN_TOOLS__
2287 #include <xendevicemodel.h>
2288 #include <xenforeignmemory.h>
2289 int main(void) {
2290 xendevicemodel_handle *xd;
2291 xenforeignmemory_handle *xfmem;
2293 xd = xendevicemodel_open(0, 0);
2294 xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0);
2296 xfmem = xenforeignmemory_open(0, 0);
2297 xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0);
2299 return 0;
2302 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
2303 then
2304 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
2305 xen_ctrl_version=41100
2306 xen=yes
2307 elif
2308 cat > $TMPC <<EOF &&
2309 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2310 #include <xenforeignmemory.h>
2311 #include <xentoolcore.h>
2312 int main(void) {
2313 xenforeignmemory_handle *xfmem;
2315 xfmem = xenforeignmemory_open(0, 0);
2316 xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0);
2317 xentoolcore_restrict_all(0);
2319 return 0;
2322 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
2323 then
2324 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
2325 xen_ctrl_version=41000
2326 xen=yes
2327 elif
2328 cat > $TMPC <<EOF &&
2329 #undef XC_WANT_COMPAT_DEVICEMODEL_API
2330 #define __XEN_TOOLS__
2331 #include <xendevicemodel.h>
2332 int main(void) {
2333 xendevicemodel_handle *xd;
2335 xd = xendevicemodel_open(0, 0);
2336 xendevicemodel_close(xd);
2338 return 0;
2341 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
2342 then
2343 xen_stable_libs="-lxendevicemodel $xen_stable_libs"
2344 xen_ctrl_version=40900
2345 xen=yes
2346 elif
2347 cat > $TMPC <<EOF &&
2349 * If we have stable libs the we don't want the libxc compat
2350 * layers, regardless of what CFLAGS we may have been given.
2352 * Also, check if xengnttab_grant_copy_segment_t is defined and
2353 * grant copy operation is implemented.
2355 #undef XC_WANT_COMPAT_EVTCHN_API
2356 #undef XC_WANT_COMPAT_GNTTAB_API
2357 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2358 #include <xenctrl.h>
2359 #include <xenstore.h>
2360 #include <xenevtchn.h>
2361 #include <xengnttab.h>
2362 #include <xenforeignmemory.h>
2363 #include <stdint.h>
2364 #include <xen/hvm/hvm_info_table.h>
2365 #if !defined(HVM_MAX_VCPUS)
2366 # error HVM_MAX_VCPUS not defined
2367 #endif
2368 int main(void) {
2369 xc_interface *xc = NULL;
2370 xenforeignmemory_handle *xfmem;
2371 xenevtchn_handle *xe;
2372 xengnttab_handle *xg;
2373 xen_domain_handle_t handle;
2374 xengnttab_grant_copy_segment_t* seg = NULL;
2376 xs_daemon_open();
2378 xc = xc_interface_open(0, 0, 0);
2379 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2380 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2381 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2382 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2383 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2385 xfmem = xenforeignmemory_open(0, 0);
2386 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2388 xe = xenevtchn_open(0, 0);
2389 xenevtchn_fd(xe);
2391 xg = xengnttab_open(0, 0);
2392 xengnttab_grant_copy(xg, 0, seg);
2394 return 0;
2397 compile_prog "" "$xen_libs $xen_stable_libs"
2398 then
2399 xen_ctrl_version=40800
2400 xen=yes
2401 elif
2402 cat > $TMPC <<EOF &&
2404 * If we have stable libs the we don't want the libxc compat
2405 * layers, regardless of what CFLAGS we may have been given.
2407 #undef XC_WANT_COMPAT_EVTCHN_API
2408 #undef XC_WANT_COMPAT_GNTTAB_API
2409 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2410 #include <xenctrl.h>
2411 #include <xenstore.h>
2412 #include <xenevtchn.h>
2413 #include <xengnttab.h>
2414 #include <xenforeignmemory.h>
2415 #include <stdint.h>
2416 #include <xen/hvm/hvm_info_table.h>
2417 #if !defined(HVM_MAX_VCPUS)
2418 # error HVM_MAX_VCPUS not defined
2419 #endif
2420 int main(void) {
2421 xc_interface *xc = NULL;
2422 xenforeignmemory_handle *xfmem;
2423 xenevtchn_handle *xe;
2424 xengnttab_handle *xg;
2425 xen_domain_handle_t handle;
2427 xs_daemon_open();
2429 xc = xc_interface_open(0, 0, 0);
2430 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2431 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2432 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2433 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2434 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2436 xfmem = xenforeignmemory_open(0, 0);
2437 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2439 xe = xenevtchn_open(0, 0);
2440 xenevtchn_fd(xe);
2442 xg = xengnttab_open(0, 0);
2443 xengnttab_map_grant_ref(xg, 0, 0, 0);
2445 return 0;
2448 compile_prog "" "$xen_libs $xen_stable_libs"
2449 then
2450 xen_ctrl_version=40701
2451 xen=yes
2452 elif
2453 cat > $TMPC <<EOF &&
2454 #include <xenctrl.h>
2455 #include <stdint.h>
2456 int main(void) {
2457 xc_interface *xc = NULL;
2458 xen_domain_handle_t handle;
2459 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2460 return 0;
2463 compile_prog "" "$xen_libs"
2464 then
2465 xen_ctrl_version=40700
2466 xen=yes
2468 # Xen 4.6
2469 elif
2470 cat > $TMPC <<EOF &&
2471 #include <xenctrl.h>
2472 #include <xenstore.h>
2473 #include <stdint.h>
2474 #include <xen/hvm/hvm_info_table.h>
2475 #if !defined(HVM_MAX_VCPUS)
2476 # error HVM_MAX_VCPUS not defined
2477 #endif
2478 int main(void) {
2479 xc_interface *xc;
2480 xs_daemon_open();
2481 xc = xc_interface_open(0, 0, 0);
2482 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2483 xc_gnttab_open(NULL, 0);
2484 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2485 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2486 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2487 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
2488 return 0;
2491 compile_prog "" "$xen_libs"
2492 then
2493 xen_ctrl_version=40600
2494 xen=yes
2496 # Xen 4.5
2497 elif
2498 cat > $TMPC <<EOF &&
2499 #include <xenctrl.h>
2500 #include <xenstore.h>
2501 #include <stdint.h>
2502 #include <xen/hvm/hvm_info_table.h>
2503 #if !defined(HVM_MAX_VCPUS)
2504 # error HVM_MAX_VCPUS not defined
2505 #endif
2506 int main(void) {
2507 xc_interface *xc;
2508 xs_daemon_open();
2509 xc = xc_interface_open(0, 0, 0);
2510 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2511 xc_gnttab_open(NULL, 0);
2512 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2513 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2514 xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
2515 return 0;
2518 compile_prog "" "$xen_libs"
2519 then
2520 xen_ctrl_version=40500
2521 xen=yes
2523 elif
2524 cat > $TMPC <<EOF &&
2525 #include <xenctrl.h>
2526 #include <xenstore.h>
2527 #include <stdint.h>
2528 #include <xen/hvm/hvm_info_table.h>
2529 #if !defined(HVM_MAX_VCPUS)
2530 # error HVM_MAX_VCPUS not defined
2531 #endif
2532 int main(void) {
2533 xc_interface *xc;
2534 xs_daemon_open();
2535 xc = xc_interface_open(0, 0, 0);
2536 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2537 xc_gnttab_open(NULL, 0);
2538 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2539 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2540 return 0;
2543 compile_prog "" "$xen_libs"
2544 then
2545 xen_ctrl_version=40200
2546 xen=yes
2548 else
2549 if test "$xen" = "yes" ; then
2550 feature_not_found "xen (unsupported version)" \
2551 "Install a supported xen (xen 4.2 or newer)"
2553 xen=no
2556 if test "$xen" = yes; then
2557 if test $xen_ctrl_version -ge 40701 ; then
2558 libs_softmmu="$xen_stable_libs $libs_softmmu"
2560 libs_softmmu="$xen_libs $libs_softmmu"
2565 if test "$xen_pci_passthrough" != "no"; then
2566 if test "$xen" = "yes" && test "$linux" = "yes"; then
2567 xen_pci_passthrough=yes
2568 else
2569 if test "$xen_pci_passthrough" = "yes"; then
2570 error_exit "User requested feature Xen PCI Passthrough" \
2571 " but this feature requires /sys from Linux"
2573 xen_pci_passthrough=no
2577 if test "$xen_pv_domain_build" = "yes" &&
2578 test "$xen" != "yes"; then
2579 error_exit "User requested Xen PV domain builder support" \
2580 "which requires Xen support."
2583 ##########################################
2584 # Windows Hypervisor Platform accelerator (WHPX) check
2585 if test "$whpx" != "no" ; then
2586 if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then
2587 whpx="yes"
2588 else
2589 if test "$whpx" = "yes"; then
2590 feature_not_found "WinHvPlatform" "WinHvEmulation is not installed"
2592 whpx="no"
2596 ##########################################
2597 # Sparse probe
2598 if test "$sparse" != "no" ; then
2599 if has cgcc; then
2600 sparse=yes
2601 else
2602 if test "$sparse" = "yes" ; then
2603 feature_not_found "sparse" "Install sparse binary"
2605 sparse=no
2609 ##########################################
2610 # X11 probe
2611 if $pkg_config --exists "x11"; then
2612 have_x11=yes
2613 x11_cflags=$($pkg_config --cflags x11)
2614 x11_libs=$($pkg_config --libs x11)
2617 ##########################################
2618 # GTK probe
2620 if test "$gtk" != "no"; then
2621 if test "$gtkabi" = ""; then
2622 # The GTK ABI was not specified explicitly, so try whether 3.0 is available.
2623 # Use 2.0 as a fallback if that is available.
2624 if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
2625 gtkabi=3.0
2626 elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
2627 gtkabi=2.0
2628 else
2629 gtkabi=3.0
2632 gtkpackage="gtk+-$gtkabi"
2633 gtkx11package="gtk+-x11-$gtkabi"
2634 if test "$gtkabi" = "3.0" ; then
2635 gtkversion="3.0.0"
2636 else
2637 gtkversion="2.18.0"
2639 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
2640 gtk_cflags=$($pkg_config --cflags $gtkpackage)
2641 gtk_libs=$($pkg_config --libs $gtkpackage)
2642 gtk_version=$($pkg_config --modversion $gtkpackage)
2643 if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
2644 need_x11=yes
2645 gtk_cflags="$gtk_cflags $x11_cflags"
2646 gtk_libs="$gtk_libs $x11_libs"
2648 gtk="yes"
2649 elif test "$gtk" = "yes"; then
2650 feature_not_found "gtk" "Install gtk3-devel"
2651 else
2652 gtk="no"
2657 ##########################################
2658 # GNUTLS probe
2660 gnutls_works() {
2661 # Unfortunately some distros have bad pkg-config information for gnutls
2662 # such that it claims to exist but you get a compiler error if you try
2663 # to use the options returned by --libs. Specifically, Ubuntu for --static
2664 # builds doesn't work:
2665 # https://bugs.launchpad.net/ubuntu/+source/gnutls26/+bug/1478035
2667 # So sanity check the cflags/libs before assuming gnutls can be used.
2668 if ! $pkg_config --exists "gnutls"; then
2669 return 1
2672 write_c_skeleton
2673 compile_prog "$($pkg_config --cflags gnutls)" "$($pkg_config --libs gnutls)"
2676 gnutls_gcrypt=no
2677 gnutls_nettle=no
2678 if test "$gnutls" != "no"; then
2679 if gnutls_works; then
2680 gnutls_cflags=$($pkg_config --cflags gnutls)
2681 gnutls_libs=$($pkg_config --libs gnutls)
2682 libs_softmmu="$gnutls_libs $libs_softmmu"
2683 libs_tools="$gnutls_libs $libs_tools"
2684 QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
2685 gnutls="yes"
2687 # gnutls_rnd requires >= 2.11.0
2688 if $pkg_config --exists "gnutls >= 2.11.0"; then
2689 gnutls_rnd="yes"
2690 else
2691 gnutls_rnd="no"
2694 if $pkg_config --exists 'gnutls >= 3.0'; then
2695 gnutls_gcrypt=no
2696 gnutls_nettle=yes
2697 elif $pkg_config --exists 'gnutls >= 2.12'; then
2698 case $($pkg_config --libs --static gnutls) in
2699 *gcrypt*)
2700 gnutls_gcrypt=yes
2701 gnutls_nettle=no
2703 *nettle*)
2704 gnutls_gcrypt=no
2705 gnutls_nettle=yes
2708 gnutls_gcrypt=yes
2709 gnutls_nettle=no
2711 esac
2712 else
2713 gnutls_gcrypt=yes
2714 gnutls_nettle=no
2716 elif test "$gnutls" = "yes"; then
2717 feature_not_found "gnutls" "Install gnutls devel"
2718 else
2719 gnutls="no"
2720 gnutls_rnd="no"
2722 else
2723 gnutls_rnd="no"
2727 # If user didn't give a --disable/enable-gcrypt flag,
2728 # then mark as disabled if user requested nettle
2729 # explicitly, or if gnutls links to nettle
2730 if test -z "$gcrypt"
2731 then
2732 if test "$nettle" = "yes" || test "$gnutls_nettle" = "yes"
2733 then
2734 gcrypt="no"
2738 # If user didn't give a --disable/enable-nettle flag,
2739 # then mark as disabled if user requested gcrypt
2740 # explicitly, or if gnutls links to gcrypt
2741 if test -z "$nettle"
2742 then
2743 if test "$gcrypt" = "yes" || test "$gnutls_gcrypt" = "yes"
2744 then
2745 nettle="no"
2749 has_libgcrypt_config() {
2750 if ! has "libgcrypt-config"
2751 then
2752 return 1
2755 if test -n "$cross_prefix"
2756 then
2757 host=$(libgcrypt-config --host)
2758 if test "$host-" != $cross_prefix
2759 then
2760 return 1
2764 return 0
2767 if test "$gcrypt" != "no"; then
2768 if has_libgcrypt_config; then
2769 gcrypt_cflags=$(libgcrypt-config --cflags)
2770 gcrypt_libs=$(libgcrypt-config --libs)
2771 # Debian has remove -lgpg-error from libgcrypt-config
2772 # as it "spreads unnecessary dependencies" which in
2773 # turn breaks static builds...
2774 if test "$static" = "yes"
2775 then
2776 gcrypt_libs="$gcrypt_libs -lgpg-error"
2778 libs_softmmu="$gcrypt_libs $libs_softmmu"
2779 libs_tools="$gcrypt_libs $libs_tools"
2780 QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
2781 gcrypt="yes"
2782 if test -z "$nettle"; then
2783 nettle="no"
2786 cat > $TMPC << EOF
2787 #include <gcrypt.h>
2788 int main(void) {
2789 gcry_kdf_derive(NULL, 0, GCRY_KDF_PBKDF2,
2790 GCRY_MD_SHA256,
2791 NULL, 0, 0, 0, NULL);
2792 return 0;
2795 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2796 gcrypt_kdf=yes
2799 cat > $TMPC << EOF
2800 #include <gcrypt.h>
2801 int main(void) {
2802 gcry_mac_hd_t handle;
2803 gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5,
2804 GCRY_MAC_FLAG_SECURE, NULL);
2805 return 0;
2808 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2809 gcrypt_hmac=yes
2811 else
2812 if test "$gcrypt" = "yes"; then
2813 feature_not_found "gcrypt" "Install gcrypt devel"
2814 else
2815 gcrypt="no"
2821 if test "$nettle" != "no"; then
2822 if $pkg_config --exists "nettle"; then
2823 nettle_cflags=$($pkg_config --cflags nettle)
2824 nettle_libs=$($pkg_config --libs nettle)
2825 nettle_version=$($pkg_config --modversion nettle)
2826 libs_softmmu="$nettle_libs $libs_softmmu"
2827 libs_tools="$nettle_libs $libs_tools"
2828 QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
2829 nettle="yes"
2831 cat > $TMPC << EOF
2832 #include <stddef.h>
2833 #include <nettle/pbkdf2.h>
2834 int main(void) {
2835 pbkdf2_hmac_sha256(8, NULL, 1000, 8, NULL, 8, NULL);
2836 return 0;
2839 if compile_prog "$nettle_cflags" "$nettle_libs" ; then
2840 nettle_kdf=yes
2842 else
2843 if test "$nettle" = "yes"; then
2844 feature_not_found "nettle" "Install nettle devel"
2845 else
2846 nettle="no"
2851 if test "$gcrypt" = "yes" && test "$nettle" = "yes"
2852 then
2853 error_exit "Only one of gcrypt & nettle can be enabled"
2856 ##########################################
2857 # libtasn1 - only for the TLS creds/session test suite
2859 tasn1=yes
2860 tasn1_cflags=""
2861 tasn1_libs=""
2862 if $pkg_config --exists "libtasn1"; then
2863 tasn1_cflags=$($pkg_config --cflags libtasn1)
2864 tasn1_libs=$($pkg_config --libs libtasn1)
2865 else
2866 tasn1=no
2870 ##########################################
2871 # getifaddrs (for tests/test-io-channel-socket )
2873 have_ifaddrs_h=yes
2874 if ! check_include "ifaddrs.h" ; then
2875 have_ifaddrs_h=no
2878 ##########################################
2879 # VTE probe
2881 if test "$vte" != "no"; then
2882 if test "$gtkabi" = "3.0"; then
2883 vteminversion="0.32.0"
2884 if $pkg_config --exists "vte-2.91"; then
2885 vtepackage="vte-2.91"
2886 else
2887 vtepackage="vte-2.90"
2889 else
2890 vtepackage="vte"
2891 vteminversion="0.24.0"
2893 if $pkg_config --exists "$vtepackage >= $vteminversion"; then
2894 vte_cflags=$($pkg_config --cflags $vtepackage)
2895 vte_libs=$($pkg_config --libs $vtepackage)
2896 vteversion=$($pkg_config --modversion $vtepackage)
2897 vte="yes"
2898 elif test "$vte" = "yes"; then
2899 if test "$gtkabi" = "3.0"; then
2900 feature_not_found "vte" "Install libvte-2.90/2.91 devel"
2901 else
2902 feature_not_found "vte" "Install libvte devel"
2904 else
2905 vte="no"
2909 ##########################################
2910 # SDL probe
2912 # Look for sdl configuration program (pkg-config or sdl-config). Try
2913 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
2915 sdl_probe ()
2917 sdl_too_old=no
2918 if test "$sdlabi" = ""; then
2919 if $pkg_config --exists "sdl2"; then
2920 sdlabi=2.0
2921 elif $pkg_config --exists "sdl"; then
2922 sdlabi=1.2
2923 else
2924 sdlabi=2.0
2928 if test $sdlabi = "2.0"; then
2929 sdl_config=$sdl2_config
2930 sdlname=sdl2
2931 sdlconfigname=sdl2_config
2932 elif test $sdlabi = "1.2"; then
2933 sdlname=sdl
2934 sdlconfigname=sdl_config
2935 else
2936 error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0"
2939 if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then
2940 sdl_config=$sdlconfigname
2943 if $pkg_config $sdlname --exists; then
2944 sdlconfig="$pkg_config $sdlname"
2945 sdlversion=$($sdlconfig --modversion 2>/dev/null)
2946 elif has ${sdl_config}; then
2947 sdlconfig="$sdl_config"
2948 sdlversion=$($sdlconfig --version)
2949 else
2950 if test "$sdl" = "yes" ; then
2951 feature_not_found "sdl" "Install SDL2-devel"
2953 sdl=no
2954 # no need to do the rest
2955 return
2957 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
2958 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
2961 cat > $TMPC << EOF
2962 #include <SDL.h>
2963 #undef main /* We don't want SDL to override our main() */
2964 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
2966 sdl_cflags=$($sdlconfig --cflags 2>/dev/null)
2967 sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug
2968 if test "$static" = "yes" ; then
2969 if $pkg_config $sdlname --exists; then
2970 sdl_libs=$($pkg_config $sdlname --static --libs 2>/dev/null)
2971 else
2972 sdl_libs=$($sdlconfig --static-libs 2>/dev/null)
2974 else
2975 sdl_libs=$($sdlconfig --libs 2>/dev/null)
2977 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2978 if test $(echo $sdlversion | sed 's/[^0-9]//g') -lt 121 ; then
2979 sdl_too_old=yes
2980 else
2981 sdl=yes
2984 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
2985 if test "$sdl" = "yes" -a "$static" = "yes" ; then
2986 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
2987 sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)"
2988 sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)"
2990 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2992 else
2993 sdl=no
2995 fi # static link
2996 else # sdl not found
2997 if test "$sdl" = "yes" ; then
2998 feature_not_found "sdl" "Install SDL devel"
3000 sdl=no
3001 fi # sdl compile test
3004 if test "$sdl" != "no" ; then
3005 sdl_probe
3008 if test "$sdl" = "yes" ; then
3009 cat > $TMPC <<EOF
3010 #include <SDL.h>
3011 #if defined(SDL_VIDEO_DRIVER_X11)
3012 #include <X11/XKBlib.h>
3013 #else
3014 #error No x11 support
3015 #endif
3016 int main(void) { return 0; }
3018 if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then
3019 need_x11=yes
3020 sdl_cflags="$sdl_cflags $x11_cflags"
3021 sdl_libs="$sdl_libs $x11_libs"
3025 ##########################################
3026 # RDMA needs OpenFabrics libraries
3027 if test "$rdma" != "no" ; then
3028 cat > $TMPC <<EOF
3029 #include <rdma/rdma_cma.h>
3030 int main(void) { return 0; }
3032 rdma_libs="-lrdmacm -libverbs -libumad"
3033 if compile_prog "" "$rdma_libs" ; then
3034 rdma="yes"
3035 libs_softmmu="$libs_softmmu $rdma_libs"
3036 else
3037 if test "$rdma" = "yes" ; then
3038 error_exit \
3039 " OpenFabrics librdmacm/libibverbs/libibumad not present." \
3040 " Your options:" \
3041 " (1) Fast: Install infiniband packages (devel) from your distro." \
3042 " (2) Cleanest: Install libraries from www.openfabrics.org" \
3043 " (3) Also: Install softiwarp if you don't have RDMA hardware"
3045 rdma="no"
3050 ##########################################
3051 # VNC SASL detection
3052 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
3053 cat > $TMPC <<EOF
3054 #include <sasl/sasl.h>
3055 #include <stdio.h>
3056 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
3058 # Assuming Cyrus-SASL installed in /usr prefix
3059 vnc_sasl_cflags=""
3060 vnc_sasl_libs="-lsasl2"
3061 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
3062 vnc_sasl=yes
3063 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
3064 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
3065 else
3066 if test "$vnc_sasl" = "yes" ; then
3067 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
3069 vnc_sasl=no
3073 ##########################################
3074 # VNC JPEG detection
3075 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
3076 cat > $TMPC <<EOF
3077 #include <stdio.h>
3078 #include <jpeglib.h>
3079 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
3081 vnc_jpeg_cflags=""
3082 vnc_jpeg_libs="-ljpeg"
3083 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
3084 vnc_jpeg=yes
3085 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
3086 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
3087 else
3088 if test "$vnc_jpeg" = "yes" ; then
3089 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
3091 vnc_jpeg=no
3095 ##########################################
3096 # VNC PNG detection
3097 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
3098 cat > $TMPC <<EOF
3099 //#include <stdio.h>
3100 #include <png.h>
3101 #include <stddef.h>
3102 int main(void) {
3103 png_structp png_ptr;
3104 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
3105 return png_ptr != 0;
3108 if $pkg_config libpng --exists; then
3109 vnc_png_cflags=$($pkg_config libpng --cflags)
3110 vnc_png_libs=$($pkg_config libpng --libs)
3111 else
3112 vnc_png_cflags=""
3113 vnc_png_libs="-lpng"
3115 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
3116 vnc_png=yes
3117 libs_softmmu="$vnc_png_libs $libs_softmmu"
3118 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
3119 else
3120 if test "$vnc_png" = "yes" ; then
3121 feature_not_found "vnc-png" "Install libpng devel"
3123 vnc_png=no
3127 ##########################################
3128 # xkbcommon probe
3129 if test "$xkbcommon" != "no" ; then
3130 if $pkg_config xkbcommon --exists; then
3131 xkbcommon_cflags=$($pkg_config xkbcommon --cflags)
3132 xkbcommon_libs=$($pkg_config xkbcommon --libs)
3133 xkbcommon=yes
3134 else
3135 if test "$xkbcommon" = "yes" ; then
3136 feature_not_found "xkbcommon" "Install libxkbcommon-devel"
3138 xkbcommon=no
3142 ##########################################
3143 # fnmatch() probe, used for ACL routines
3144 fnmatch="no"
3145 cat > $TMPC << EOF
3146 #include <fnmatch.h>
3147 int main(void)
3149 fnmatch("foo", "foo", 0);
3150 return 0;
3153 if compile_prog "" "" ; then
3154 fnmatch="yes"
3157 ##########################################
3158 # xfsctl() probe, used for file-posix.c
3159 if test "$xfs" != "no" ; then
3160 cat > $TMPC << EOF
3161 #include <stddef.h> /* NULL */
3162 #include <xfs/xfs.h>
3163 int main(void)
3165 xfsctl(NULL, 0, 0, NULL);
3166 return 0;
3169 if compile_prog "" "" ; then
3170 xfs="yes"
3171 else
3172 if test "$xfs" = "yes" ; then
3173 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
3175 xfs=no
3179 ##########################################
3180 # vde libraries probe
3181 if test "$vde" != "no" ; then
3182 vde_libs="-lvdeplug"
3183 cat > $TMPC << EOF
3184 #include <libvdeplug.h>
3185 int main(void)
3187 struct vde_open_args a = {0, 0, 0};
3188 char s[] = "";
3189 vde_open(s, s, &a);
3190 return 0;
3193 if compile_prog "" "$vde_libs" ; then
3194 vde=yes
3195 else
3196 if test "$vde" = "yes" ; then
3197 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
3199 vde=no
3203 ##########################################
3204 # netmap support probe
3205 # Apart from looking for netmap headers, we make sure that the host API version
3206 # supports the netmap backend (>=11). The upper bound (15) is meant to simulate
3207 # a minor/major version number. Minor new features will be marked with values up
3208 # to 15, and if something happens that requires a change to the backend we will
3209 # move above 15, submit the backend fixes and modify this two bounds.
3210 if test "$netmap" != "no" ; then
3211 cat > $TMPC << EOF
3212 #include <inttypes.h>
3213 #include <net/if.h>
3214 #include <net/netmap.h>
3215 #include <net/netmap_user.h>
3216 #if (NETMAP_API < 11) || (NETMAP_API > 15)
3217 #error
3218 #endif
3219 int main(void) { return 0; }
3221 if compile_prog "" "" ; then
3222 netmap=yes
3223 else
3224 if test "$netmap" = "yes" ; then
3225 feature_not_found "netmap"
3227 netmap=no
3231 ##########################################
3232 # libcap-ng library probe
3233 if test "$cap_ng" != "no" ; then
3234 cap_libs="-lcap-ng"
3235 cat > $TMPC << EOF
3236 #include <cap-ng.h>
3237 int main(void)
3239 capng_capability_to_name(CAPNG_EFFECTIVE);
3240 return 0;
3243 if compile_prog "" "$cap_libs" ; then
3244 cap_ng=yes
3245 libs_tools="$cap_libs $libs_tools"
3246 else
3247 if test "$cap_ng" = "yes" ; then
3248 feature_not_found "cap_ng" "Install libcap-ng devel"
3250 cap_ng=no
3254 ##########################################
3255 # Sound support libraries probe
3257 audio_drv_probe()
3259 drv=$1
3260 hdr=$2
3261 lib=$3
3262 exp=$4
3263 cfl=$5
3264 cat > $TMPC << EOF
3265 #include <$hdr>
3266 int main(void) { $exp }
3268 if compile_prog "$cfl" "$lib" ; then
3270 else
3271 error_exit "$drv check failed" \
3272 "Make sure to have the $drv libs and headers installed."
3276 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g')
3277 for drv in $audio_drv_list; do
3278 case $drv in
3279 alsa)
3280 audio_drv_probe $drv alsa/asoundlib.h -lasound \
3281 "return snd_pcm_close((snd_pcm_t *)0);"
3282 alsa_libs="-lasound"
3286 audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \
3287 "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;"
3288 pulse_libs="-lpulse"
3289 audio_pt_int="yes"
3292 sdl)
3293 if test "$sdl" = "no"; then
3294 error_exit "sdl not found or disabled, can not use sdl audio driver"
3298 coreaudio)
3299 coreaudio_libs="-framework CoreAudio"
3302 dsound)
3303 dsound_libs="-lole32 -ldxguid"
3304 audio_win_int="yes"
3307 oss)
3308 oss_libs="$oss_lib"
3311 wav)
3312 # XXX: Probes for CoreAudio, DirectSound
3316 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
3317 error_exit "Unknown driver '$drv' selected" \
3318 "Possible drivers are: $audio_possible_drivers"
3321 esac
3322 done
3324 ##########################################
3325 # BrlAPI probe
3327 if test "$brlapi" != "no" ; then
3328 brlapi_libs="-lbrlapi"
3329 cat > $TMPC << EOF
3330 #include <brlapi.h>
3331 #include <stddef.h>
3332 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
3334 if compile_prog "" "$brlapi_libs" ; then
3335 brlapi=yes
3336 else
3337 if test "$brlapi" = "yes" ; then
3338 feature_not_found "brlapi" "Install brlapi devel"
3340 brlapi=no
3344 ##########################################
3345 # curses probe
3346 if test "$curses" != "no" ; then
3347 if test "$mingw32" = "yes" ; then
3348 curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
3349 curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
3350 else
3351 curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
3352 curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
3354 curses_found=no
3355 cat > $TMPC << EOF
3356 #include <locale.h>
3357 #include <curses.h>
3358 #include <wchar.h>
3359 int main(void) {
3360 wchar_t wch = L'w';
3361 setlocale(LC_ALL, "");
3362 resize_term(0, 0);
3363 addwstr(L"wide chars\n");
3364 addnwstr(&wch, 1);
3365 add_wch(WACS_DEGREE);
3366 return 0;
3369 IFS=:
3370 for curses_inc in $curses_inc_list; do
3371 # Make sure we get the wide character prototypes
3372 curses_inc="-DNCURSES_WIDECHAR $curses_inc"
3373 IFS=:
3374 for curses_lib in $curses_lib_list; do
3375 unset IFS
3376 if compile_prog "$curses_inc" "$curses_lib" ; then
3377 curses_found=yes
3378 break
3380 done
3381 if test "$curses_found" = yes ; then
3382 break
3384 done
3385 unset IFS
3386 if test "$curses_found" = "yes" ; then
3387 curses=yes
3388 else
3389 if test "$curses" = "yes" ; then
3390 feature_not_found "curses" "Install ncurses devel"
3392 curses=no
3396 ##########################################
3397 # curl probe
3398 if test "$curl" != "no" ; then
3399 if $pkg_config libcurl --exists; then
3400 curlconfig="$pkg_config libcurl"
3401 else
3402 curlconfig=curl-config
3404 cat > $TMPC << EOF
3405 #include <curl/curl.h>
3406 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
3408 curl_cflags=$($curlconfig --cflags 2>/dev/null)
3409 curl_libs=$($curlconfig --libs 2>/dev/null)
3410 if compile_prog "$curl_cflags" "$curl_libs" ; then
3411 curl=yes
3412 else
3413 if test "$curl" = "yes" ; then
3414 feature_not_found "curl" "Install libcurl devel"
3416 curl=no
3418 fi # test "$curl"
3420 ##########################################
3421 # bluez support probe
3422 if test "$bluez" != "no" ; then
3423 cat > $TMPC << EOF
3424 #include <bluetooth/bluetooth.h>
3425 int main(void) { return bt_error(0); }
3427 bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null)
3428 bluez_libs=$($pkg_config --libs bluez 2>/dev/null)
3429 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
3430 bluez=yes
3431 libs_softmmu="$bluez_libs $libs_softmmu"
3432 else
3433 if test "$bluez" = "yes" ; then
3434 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
3436 bluez="no"
3440 ##########################################
3441 # glib support probe
3443 if test "$mingw32" = yes; then
3444 glib_req_ver=2.30
3445 else
3446 glib_req_ver=2.22
3448 glib_modules=gthread-2.0
3449 if test "$modules" = yes; then
3450 glib_modules="$glib_modules gmodule-export-2.0"
3453 # This workaround is required due to a bug in pkg-config file for glib as it
3454 # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
3456 if test "$static" = yes -a "$mingw32" = yes; then
3457 QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS"
3460 for i in $glib_modules; do
3461 if $pkg_config --atleast-version=$glib_req_ver $i; then
3462 glib_cflags=$($pkg_config --cflags $i)
3463 glib_libs=$($pkg_config --libs $i)
3464 QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
3465 LIBS="$glib_libs $LIBS"
3466 libs_qga="$glib_libs $libs_qga"
3467 else
3468 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
3470 done
3472 # Sanity check that the current size_t matches the
3473 # size that glib thinks it should be. This catches
3474 # problems on multi-arch where people try to build
3475 # 32-bit QEMU while pointing at 64-bit glib headers
3476 cat > $TMPC <<EOF
3477 #include <glib.h>
3478 #include <unistd.h>
3480 #define QEMU_BUILD_BUG_ON(x) \
3481 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
3483 int main(void) {
3484 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
3485 return 0;
3489 if ! compile_prog "$CFLAGS" "$LIBS" ; then
3490 error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
3491 "You probably need to set PKG_CONFIG_LIBDIR"\
3492 "to point to the right pkg-config files for your"\
3493 "build target"
3496 # g_test_trap_subprocess added in 2.38. Used by some tests.
3497 glib_subprocess=yes
3498 if ! $pkg_config --atleast-version=2.38 glib-2.0; then
3499 glib_subprocess=no
3502 # Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage
3503 cat > $TMPC << EOF
3504 #include <glib.h>
3505 int main(void) { return 0; }
3507 if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
3508 if cc_has_warning_flag "-Wno-unknown-attributes"; then
3509 glib_cflags="-Wno-unknown-attributes $glib_cflags"
3510 CFLAGS="-Wno-unknown-attributes $CFLAGS"
3514 ##########################################
3515 # SHA command probe for modules
3516 if test "$modules" = yes; then
3517 shacmd_probe="sha1sum sha1 shasum"
3518 for c in $shacmd_probe; do
3519 if has $c; then
3520 shacmd="$c"
3521 break
3523 done
3524 if test "$shacmd" = ""; then
3525 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
3529 ##########################################
3530 # pixman support probe
3532 if test "$want_tools" = "no" -a "$softmmu" = "no"; then
3533 pixman_cflags=
3534 pixman_libs=
3535 elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
3536 pixman_cflags=$($pkg_config --cflags pixman-1)
3537 pixman_libs=$($pkg_config --libs pixman-1)
3538 else
3539 error_exit "pixman >= 0.21.8 not present." \
3540 "Please install the pixman devel package."
3543 ##########################################
3544 # libmpathpersist probe
3546 if test "$mpath" != "no" ; then
3547 cat > $TMPC <<EOF
3548 #include <libudev.h>
3549 #include <mpath_persist.h>
3550 unsigned mpath_mx_alloc_len = 1024;
3551 int logsink;
3552 static struct config *multipath_conf;
3553 extern struct udev *udev;
3554 extern struct config *get_multipath_config(void);
3555 extern void put_multipath_config(struct config *conf);
3556 struct udev *udev;
3557 struct config *get_multipath_config(void) { return multipath_conf; }
3558 void put_multipath_config(struct config *conf) { }
3560 int main(void) {
3561 udev = udev_new();
3562 multipath_conf = mpath_lib_init();
3563 return 0;
3566 if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then
3567 mpathpersist=yes
3568 else
3569 mpathpersist=no
3571 else
3572 mpathpersist=no
3575 ##########################################
3576 # libcap probe
3578 if test "$cap" != "no" ; then
3579 cat > $TMPC <<EOF
3580 #include <stdio.h>
3581 #include <sys/capability.h>
3582 int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
3584 if compile_prog "" "-lcap" ; then
3585 cap=yes
3586 else
3587 cap=no
3591 ##########################################
3592 # pthread probe
3593 PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
3595 pthread=no
3596 cat > $TMPC << EOF
3597 #include <pthread.h>
3598 static void *f(void *p) { return NULL; }
3599 int main(void) {
3600 pthread_t thread;
3601 pthread_create(&thread, 0, f, 0);
3602 return 0;
3605 if compile_prog "" "" ; then
3606 pthread=yes
3607 else
3608 for pthread_lib in $PTHREADLIBS_LIST; do
3609 if compile_prog "" "$pthread_lib" ; then
3610 pthread=yes
3611 found=no
3612 for lib_entry in $LIBS; do
3613 if test "$lib_entry" = "$pthread_lib"; then
3614 found=yes
3615 break
3617 done
3618 if test "$found" = "no"; then
3619 LIBS="$pthread_lib $LIBS"
3620 libs_qga="$pthread_lib $libs_qga"
3622 PTHREAD_LIB="$pthread_lib"
3623 break
3625 done
3628 if test "$mingw32" != yes -a "$pthread" = no; then
3629 error_exit "pthread check failed" \
3630 "Make sure to have the pthread libs and headers installed."
3633 # check for pthread_setname_np
3634 pthread_setname_np=no
3635 cat > $TMPC << EOF
3636 #include <pthread.h>
3638 static void *f(void *p) { return NULL; }
3639 int main(void)
3641 pthread_t thread;
3642 pthread_create(&thread, 0, f, 0);
3643 pthread_setname_np(thread, "QEMU");
3644 return 0;
3647 if compile_prog "" "$pthread_lib" ; then
3648 pthread_setname_np=yes
3651 ##########################################
3652 # rbd probe
3653 if test "$rbd" != "no" ; then
3654 cat > $TMPC <<EOF
3655 #include <stdio.h>
3656 #include <rbd/librbd.h>
3657 int main(void) {
3658 rados_t cluster;
3659 rados_create(&cluster, NULL);
3660 return 0;
3663 rbd_libs="-lrbd -lrados"
3664 if compile_prog "" "$rbd_libs" ; then
3665 rbd=yes
3666 else
3667 if test "$rbd" = "yes" ; then
3668 feature_not_found "rados block device" "Install librbd/ceph devel"
3670 rbd=no
3674 ##########################################
3675 # libssh2 probe
3676 min_libssh2_version=1.2.8
3677 if test "$libssh2" != "no" ; then
3678 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
3679 libssh2_cflags=$($pkg_config libssh2 --cflags)
3680 libssh2_libs=$($pkg_config libssh2 --libs)
3681 libssh2=yes
3682 else
3683 if test "$libssh2" = "yes" ; then
3684 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
3686 libssh2=no
3690 ##########################################
3691 # libssh2_sftp_fsync probe
3693 if test "$libssh2" = "yes"; then
3694 cat > $TMPC <<EOF
3695 #include <stdio.h>
3696 #include <libssh2.h>
3697 #include <libssh2_sftp.h>
3698 int main(void) {
3699 LIBSSH2_SESSION *session;
3700 LIBSSH2_SFTP *sftp;
3701 LIBSSH2_SFTP_HANDLE *sftp_handle;
3702 session = libssh2_session_init ();
3703 sftp = libssh2_sftp_init (session);
3704 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
3705 libssh2_sftp_fsync (sftp_handle);
3706 return 0;
3709 # libssh2_cflags/libssh2_libs defined in previous test.
3710 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
3711 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
3715 ##########################################
3716 # linux-aio probe
3718 if test "$linux_aio" != "no" ; then
3719 cat > $TMPC <<EOF
3720 #include <libaio.h>
3721 #include <sys/eventfd.h>
3722 #include <stddef.h>
3723 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
3725 if compile_prog "" "-laio" ; then
3726 linux_aio=yes
3727 else
3728 if test "$linux_aio" = "yes" ; then
3729 feature_not_found "linux AIO" "Install libaio devel"
3731 linux_aio=no
3735 ##########################################
3736 # TPM passthrough is only on x86 Linux
3738 if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
3739 tpm_passthrough=$tpm
3740 else
3741 tpm_passthrough=no
3744 # TPM emulator is for all posix systems
3745 if test "$mingw32" != "yes"; then
3746 tpm_emulator=$tpm
3747 else
3748 tpm_emulator=no
3750 ##########################################
3751 # attr probe
3753 if test "$attr" != "no" ; then
3754 cat > $TMPC <<EOF
3755 #include <stdio.h>
3756 #include <sys/types.h>
3757 #ifdef CONFIG_LIBATTR
3758 #include <attr/xattr.h>
3759 #else
3760 #include <sys/xattr.h>
3761 #endif
3762 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
3764 if compile_prog "" "" ; then
3765 attr=yes
3766 # Older distros have <attr/xattr.h>, and need -lattr:
3767 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
3768 attr=yes
3769 LIBS="-lattr $LIBS"
3770 libattr=yes
3771 else
3772 if test "$attr" = "yes" ; then
3773 feature_not_found "ATTR" "Install libc6 or libattr devel"
3775 attr=no
3779 ##########################################
3780 # iovec probe
3781 cat > $TMPC <<EOF
3782 #include <sys/types.h>
3783 #include <sys/uio.h>
3784 #include <unistd.h>
3785 int main(void) { return sizeof(struct iovec); }
3787 iovec=no
3788 if compile_prog "" "" ; then
3789 iovec=yes
3792 ##########################################
3793 # preadv probe
3794 cat > $TMPC <<EOF
3795 #include <sys/types.h>
3796 #include <sys/uio.h>
3797 #include <unistd.h>
3798 int main(void) { return preadv(0, 0, 0, 0); }
3800 preadv=no
3801 if compile_prog "" "" ; then
3802 preadv=yes
3805 ##########################################
3806 # fdt probe
3807 # fdt support is mandatory for at least some target architectures,
3808 # so insist on it if we're building those system emulators.
3809 fdt_required=no
3810 for target in $target_list; do
3811 case $target in
3812 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu)
3813 fdt_required=yes
3815 esac
3816 done
3818 if test "$fdt_required" = "yes"; then
3819 if test "$fdt" = "no"; then
3820 error_exit "fdt disabled but some requested targets require it." \
3821 "You can turn off fdt only if you also disable all the system emulation" \
3822 "targets which need it (by specifying a cut down --target-list)."
3824 fdt=yes
3827 if test "$fdt" != "no" ; then
3828 fdt_libs="-lfdt"
3829 # explicitly check for libfdt_env.h as it is missing in some stable installs
3830 # and test for required functions to make sure we are on a version >= 1.4.2
3831 cat > $TMPC << EOF
3832 #include <libfdt.h>
3833 #include <libfdt_env.h>
3834 int main(void) { fdt_first_subnode(0, 0); return 0; }
3836 if compile_prog "" "$fdt_libs" ; then
3837 # system DTC is good - use it
3838 fdt=system
3839 else
3840 # have GIT checkout, so activate dtc submodule
3841 if test -e "${source_path}/.git" ; then
3842 git_submodules="${git_submodules} dtc"
3844 if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
3845 fdt=git
3846 mkdir -p dtc
3847 if [ "$pwd_is_source_path" != "y" ] ; then
3848 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
3849 symlink "$source_path/dtc/scripts" "dtc/scripts"
3851 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
3852 fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt"
3853 fdt_libs="$fdt_libs"
3854 elif test "$fdt" = "yes" ; then
3855 # Not a git build & no libfdt found, prompt for system install
3856 error_exit "DTC (libfdt) version >= 1.4.2 not present." \
3857 "Please install the DTC (libfdt) devel package"
3858 else
3859 # don't have and don't want
3860 fdt_libs=
3861 fdt=no
3866 libs_softmmu="$libs_softmmu $fdt_libs"
3868 ##########################################
3869 # opengl probe (for sdl2, gtk, milkymist-tmu2)
3871 if test "$opengl" != "no" ; then
3872 opengl_pkgs="epoxy libdrm gbm"
3873 if $pkg_config $opengl_pkgs; then
3874 opengl_cflags="$($pkg_config --cflags $opengl_pkgs)"
3875 opengl_libs="$($pkg_config --libs $opengl_pkgs)"
3876 opengl=yes
3877 if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
3878 gtk_gl="yes"
3880 QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
3881 else
3882 if test "$opengl" = "yes" ; then
3883 feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
3885 opengl_cflags=""
3886 opengl_libs=""
3887 opengl=no
3891 if test "$opengl" = "yes"; then
3892 cat > $TMPC << EOF
3893 #include <epoxy/egl.h>
3894 #ifndef EGL_MESA_image_dma_buf_export
3895 # error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
3896 #endif
3897 int main(void) { return 0; }
3899 if compile_prog "" "" ; then
3900 opengl_dmabuf=yes
3904 ##########################################
3905 # libxml2 probe
3906 if test "$libxml2" != "no" ; then
3907 if $pkg_config --exists libxml-2.0; then
3908 libxml2="yes"
3909 libxml2_cflags=$($pkg_config --cflags libxml-2.0)
3910 libxml2_libs=$($pkg_config --libs libxml-2.0)
3911 else
3912 if test "$libxml2" = "yes"; then
3913 feature_not_found "libxml2" "Install libxml2 devel"
3915 libxml2="no"
3919 ##########################################
3920 # glusterfs probe
3921 if test "$glusterfs" != "no" ; then
3922 if $pkg_config --atleast-version=3 glusterfs-api; then
3923 glusterfs="yes"
3924 glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
3925 glusterfs_libs=$($pkg_config --libs glusterfs-api)
3926 if $pkg_config --atleast-version=4 glusterfs-api; then
3927 glusterfs_xlator_opt="yes"
3929 if $pkg_config --atleast-version=5 glusterfs-api; then
3930 glusterfs_discard="yes"
3932 if $pkg_config --atleast-version=6 glusterfs-api; then
3933 glusterfs_fallocate="yes"
3934 glusterfs_zerofill="yes"
3936 else
3937 if test "$glusterfs" = "yes" ; then
3938 feature_not_found "GlusterFS backend support" \
3939 "Install glusterfs-api devel >= 3"
3941 glusterfs="no"
3945 # Check for inotify functions when we are building linux-user
3946 # emulator. This is done because older glibc versions don't
3947 # have syscall stubs for these implemented. In that case we
3948 # don't provide them even if kernel supports them.
3950 inotify=no
3951 cat > $TMPC << EOF
3952 #include <sys/inotify.h>
3955 main(void)
3957 /* try to start inotify */
3958 return inotify_init();
3961 if compile_prog "" "" ; then
3962 inotify=yes
3965 inotify1=no
3966 cat > $TMPC << EOF
3967 #include <sys/inotify.h>
3970 main(void)
3972 /* try to start inotify */
3973 return inotify_init1(0);
3976 if compile_prog "" "" ; then
3977 inotify1=yes
3980 # check if pipe2 is there
3981 pipe2=no
3982 cat > $TMPC << EOF
3983 #include <unistd.h>
3984 #include <fcntl.h>
3986 int main(void)
3988 int pipefd[2];
3989 return pipe2(pipefd, O_CLOEXEC);
3992 if compile_prog "" "" ; then
3993 pipe2=yes
3996 # check if accept4 is there
3997 accept4=no
3998 cat > $TMPC << EOF
3999 #include <sys/socket.h>
4000 #include <stddef.h>
4002 int main(void)
4004 accept4(0, NULL, NULL, SOCK_CLOEXEC);
4005 return 0;
4008 if compile_prog "" "" ; then
4009 accept4=yes
4012 # check if tee/splice is there. vmsplice was added same time.
4013 splice=no
4014 cat > $TMPC << EOF
4015 #include <unistd.h>
4016 #include <fcntl.h>
4017 #include <limits.h>
4019 int main(void)
4021 int len, fd = 0;
4022 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
4023 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
4024 return 0;
4027 if compile_prog "" "" ; then
4028 splice=yes
4031 ##########################################
4032 # libnuma probe
4034 if test "$numa" != "no" ; then
4035 cat > $TMPC << EOF
4036 #include <numa.h>
4037 int main(void) { return numa_available(); }
4040 if compile_prog "" "-lnuma" ; then
4041 numa=yes
4042 libs_softmmu="-lnuma $libs_softmmu"
4043 else
4044 if test "$numa" = "yes" ; then
4045 feature_not_found "numa" "install numactl devel"
4047 numa=no
4051 if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
4052 echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
4053 exit 1
4056 # Even if malloc_trim() is available, these non-libc memory allocators
4057 # do not support it.
4058 if test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then
4059 if test "$malloc_trim" = "yes" ; then
4060 echo "Disabling malloc_trim with non-libc memory allocator"
4062 malloc_trim="no"
4065 #######################################
4066 # malloc_trim
4068 if test "$malloc_trim" != "no" ; then
4069 cat > $TMPC << EOF
4070 #include <malloc.h>
4071 int main(void) { malloc_trim(0); return 0; }
4073 if compile_prog "" "" ; then
4074 malloc_trim="yes"
4075 else
4076 malloc_trim="no"
4080 ##########################################
4081 # tcmalloc probe
4083 if test "$tcmalloc" = "yes" ; then
4084 cat > $TMPC << EOF
4085 #include <stdlib.h>
4086 int main(void) { malloc(1); return 0; }
4089 if compile_prog "" "-ltcmalloc" ; then
4090 LIBS="-ltcmalloc $LIBS"
4091 else
4092 feature_not_found "tcmalloc" "install gperftools devel"
4096 ##########################################
4097 # jemalloc probe
4099 if test "$jemalloc" = "yes" ; then
4100 cat > $TMPC << EOF
4101 #include <stdlib.h>
4102 int main(void) { malloc(1); return 0; }
4105 if compile_prog "" "-ljemalloc" ; then
4106 LIBS="-ljemalloc $LIBS"
4107 else
4108 feature_not_found "jemalloc" "install jemalloc devel"
4112 ##########################################
4113 # signalfd probe
4114 signalfd="no"
4115 cat > $TMPC << EOF
4116 #include <unistd.h>
4117 #include <sys/syscall.h>
4118 #include <signal.h>
4119 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
4122 if compile_prog "" "" ; then
4123 signalfd=yes
4126 # check if eventfd is supported
4127 eventfd=no
4128 cat > $TMPC << EOF
4129 #include <sys/eventfd.h>
4131 int main(void)
4133 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
4136 if compile_prog "" "" ; then
4137 eventfd=yes
4140 # check if memfd is supported
4141 memfd=no
4142 cat > $TMPC << EOF
4143 #include <sys/mman.h>
4145 int main(void)
4147 return memfd_create("foo", MFD_ALLOW_SEALING);
4150 if compile_prog "" "" ; then
4151 memfd=yes
4156 # check for fallocate
4157 fallocate=no
4158 cat > $TMPC << EOF
4159 #include <fcntl.h>
4161 int main(void)
4163 fallocate(0, 0, 0, 0);
4164 return 0;
4167 if compile_prog "" "" ; then
4168 fallocate=yes
4171 # check for fallocate hole punching
4172 fallocate_punch_hole=no
4173 cat > $TMPC << EOF
4174 #include <fcntl.h>
4175 #include <linux/falloc.h>
4177 int main(void)
4179 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
4180 return 0;
4183 if compile_prog "" "" ; then
4184 fallocate_punch_hole=yes
4187 # check that fallocate supports range zeroing inside the file
4188 fallocate_zero_range=no
4189 cat > $TMPC << EOF
4190 #include <fcntl.h>
4191 #include <linux/falloc.h>
4193 int main(void)
4195 fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0);
4196 return 0;
4199 if compile_prog "" "" ; then
4200 fallocate_zero_range=yes
4203 # check for posix_fallocate
4204 posix_fallocate=no
4205 cat > $TMPC << EOF
4206 #include <fcntl.h>
4208 int main(void)
4210 posix_fallocate(0, 0, 0);
4211 return 0;
4214 if compile_prog "" "" ; then
4215 posix_fallocate=yes
4218 # check for sync_file_range
4219 sync_file_range=no
4220 cat > $TMPC << EOF
4221 #include <fcntl.h>
4223 int main(void)
4225 sync_file_range(0, 0, 0, 0);
4226 return 0;
4229 if compile_prog "" "" ; then
4230 sync_file_range=yes
4233 # check for linux/fiemap.h and FS_IOC_FIEMAP
4234 fiemap=no
4235 cat > $TMPC << EOF
4236 #include <sys/ioctl.h>
4237 #include <linux/fs.h>
4238 #include <linux/fiemap.h>
4240 int main(void)
4242 ioctl(0, FS_IOC_FIEMAP, 0);
4243 return 0;
4246 if compile_prog "" "" ; then
4247 fiemap=yes
4250 # check for dup3
4251 dup3=no
4252 cat > $TMPC << EOF
4253 #include <unistd.h>
4255 int main(void)
4257 dup3(0, 0, 0);
4258 return 0;
4261 if compile_prog "" "" ; then
4262 dup3=yes
4265 # check for ppoll support
4266 ppoll=no
4267 cat > $TMPC << EOF
4268 #include <poll.h>
4270 int main(void)
4272 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
4273 ppoll(&pfd, 1, 0, 0);
4274 return 0;
4277 if compile_prog "" "" ; then
4278 ppoll=yes
4281 # check for prctl(PR_SET_TIMERSLACK , ... ) support
4282 prctl_pr_set_timerslack=no
4283 cat > $TMPC << EOF
4284 #include <sys/prctl.h>
4286 int main(void)
4288 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
4289 return 0;
4292 if compile_prog "" "" ; then
4293 prctl_pr_set_timerslack=yes
4296 # check for epoll support
4297 epoll=no
4298 cat > $TMPC << EOF
4299 #include <sys/epoll.h>
4301 int main(void)
4303 epoll_create(0);
4304 return 0;
4307 if compile_prog "" "" ; then
4308 epoll=yes
4311 # epoll_create1 is a later addition
4312 # so we must check separately for its presence
4313 epoll_create1=no
4314 cat > $TMPC << EOF
4315 #include <sys/epoll.h>
4317 int main(void)
4319 /* Note that we use epoll_create1 as a value, not as
4320 * a function being called. This is necessary so that on
4321 * old SPARC glibc versions where the function was present in
4322 * the library but not declared in the header file we will
4323 * fail the configure check. (Otherwise we will get a compiler
4324 * warning but not an error, and will proceed to fail the
4325 * qemu compile where we compile with -Werror.)
4327 return (int)(uintptr_t)&epoll_create1;
4330 if compile_prog "" "" ; then
4331 epoll_create1=yes
4334 # check for sendfile support
4335 sendfile=no
4336 cat > $TMPC << EOF
4337 #include <sys/sendfile.h>
4339 int main(void)
4341 return sendfile(0, 0, 0, 0);
4344 if compile_prog "" "" ; then
4345 sendfile=yes
4348 # check for timerfd support (glibc 2.8 and newer)
4349 timerfd=no
4350 cat > $TMPC << EOF
4351 #include <sys/timerfd.h>
4353 int main(void)
4355 return(timerfd_create(CLOCK_REALTIME, 0));
4358 if compile_prog "" "" ; then
4359 timerfd=yes
4362 # check for setns and unshare support
4363 setns=no
4364 cat > $TMPC << EOF
4365 #include <sched.h>
4367 int main(void)
4369 int ret;
4370 ret = setns(0, 0);
4371 ret = unshare(0);
4372 return ret;
4375 if compile_prog "" "" ; then
4376 setns=yes
4379 # clock_adjtime probe
4380 clock_adjtime=no
4381 cat > $TMPC <<EOF
4382 #include <time.h>
4384 int main(void)
4386 return clock_adjtime(0, 0);
4389 clock_adjtime=no
4390 if compile_prog "" "" ; then
4391 clock_adjtime=yes
4394 # syncfs probe
4395 syncfs=no
4396 cat > $TMPC <<EOF
4397 #include <unistd.h>
4399 int main(void)
4401 return syncfs(0);
4404 syncfs=no
4405 if compile_prog "" "" ; then
4406 syncfs=yes
4409 # Check if tools are available to build documentation.
4410 if test "$docs" != "no" ; then
4411 if has makeinfo && has pod2man; then
4412 docs=yes
4413 else
4414 if test "$docs" = "yes" ; then
4415 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
4417 docs=no
4421 # Search for bswap_32 function
4422 byteswap_h=no
4423 cat > $TMPC << EOF
4424 #include <byteswap.h>
4425 int main(void) { return bswap_32(0); }
4427 if compile_prog "" "" ; then
4428 byteswap_h=yes
4431 # Search for bswap32 function
4432 bswap_h=no
4433 cat > $TMPC << EOF
4434 #include <sys/endian.h>
4435 #include <sys/types.h>
4436 #include <machine/bswap.h>
4437 int main(void) { return bswap32(0); }
4439 if compile_prog "" "" ; then
4440 bswap_h=yes
4443 ##########################################
4444 # Do we have libiscsi >= 1.9.0
4445 if test "$libiscsi" != "no" ; then
4446 if $pkg_config --atleast-version=1.9.0 libiscsi; then
4447 libiscsi="yes"
4448 libiscsi_cflags=$($pkg_config --cflags libiscsi)
4449 libiscsi_libs=$($pkg_config --libs libiscsi)
4450 else
4451 if test "$libiscsi" = "yes" ; then
4452 feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
4454 libiscsi="no"
4458 ##########################################
4459 # Do we need libm
4460 cat > $TMPC << EOF
4461 #include <math.h>
4462 int main(int argc, char **argv) { return isnan(sin((double)argc)); }
4464 if compile_prog "" "" ; then
4466 elif compile_prog "" "-lm" ; then
4467 LIBS="-lm $LIBS"
4468 libs_qga="-lm $libs_qga"
4469 else
4470 error_exit "libm check failed"
4473 ##########################################
4474 # Do we need librt
4475 # uClibc provides 2 versions of clock_gettime(), one with realtime
4476 # support and one without. This means that the clock_gettime() don't
4477 # need -lrt. We still need it for timer_create() so we check for this
4478 # function in addition.
4479 cat > $TMPC <<EOF
4480 #include <signal.h>
4481 #include <time.h>
4482 int main(void) {
4483 timer_create(CLOCK_REALTIME, NULL, NULL);
4484 return clock_gettime(CLOCK_REALTIME, NULL);
4488 if compile_prog "" "" ; then
4490 # we need pthread for static linking. use previous pthread test result
4491 elif compile_prog "" "$pthread_lib -lrt" ; then
4492 LIBS="$LIBS -lrt"
4493 libs_qga="$libs_qga -lrt"
4496 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
4497 "$haiku" != "yes" ; then
4498 libs_softmmu="-lutil $libs_softmmu"
4501 ##########################################
4502 # spice probe
4503 if test "$spice" != "no" ; then
4504 cat > $TMPC << EOF
4505 #include <spice.h>
4506 int main(void) { spice_server_new(); return 0; }
4508 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
4509 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
4510 if $pkg_config --atleast-version=0.12.0 spice-server && \
4511 $pkg_config --atleast-version=0.12.3 spice-protocol && \
4512 compile_prog "$spice_cflags" "$spice_libs" ; then
4513 spice="yes"
4514 libs_softmmu="$libs_softmmu $spice_libs"
4515 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
4516 spice_protocol_version=$($pkg_config --modversion spice-protocol)
4517 spice_server_version=$($pkg_config --modversion spice-server)
4518 else
4519 if test "$spice" = "yes" ; then
4520 feature_not_found "spice" \
4521 "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel"
4523 spice="no"
4527 # check for smartcard support
4528 if test "$smartcard" != "no"; then
4529 if $pkg_config --atleast-version=2.5.1 libcacard; then
4530 libcacard_cflags=$($pkg_config --cflags libcacard)
4531 libcacard_libs=$($pkg_config --libs libcacard)
4532 smartcard="yes"
4533 else
4534 if test "$smartcard" = "yes"; then
4535 feature_not_found "smartcard" "Install libcacard devel"
4537 smartcard="no"
4541 # check for libusb
4542 if test "$libusb" != "no" ; then
4543 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
4544 libusb="yes"
4545 libusb_cflags=$($pkg_config --cflags libusb-1.0)
4546 libusb_libs=$($pkg_config --libs libusb-1.0)
4547 else
4548 if test "$libusb" = "yes"; then
4549 feature_not_found "libusb" "Install libusb devel >= 1.0.13"
4551 libusb="no"
4555 # check for usbredirparser for usb network redirection support
4556 if test "$usb_redir" != "no" ; then
4557 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
4558 usb_redir="yes"
4559 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
4560 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
4561 else
4562 if test "$usb_redir" = "yes"; then
4563 feature_not_found "usb-redir" "Install usbredir devel"
4565 usb_redir="no"
4569 ##########################################
4570 # check if we have VSS SDK headers for win
4572 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
4573 case "$vss_win32_sdk" in
4574 "") vss_win32_include="-isystem $source_path" ;;
4575 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
4576 # handle path with spaces. So we symlink the headers into ".sdk/vss".
4577 vss_win32_include="-isystem $source_path/.sdk/vss"
4578 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
4580 *) vss_win32_include="-isystem $vss_win32_sdk"
4581 esac
4582 cat > $TMPC << EOF
4583 #define __MIDL_user_allocate_free_DEFINED__
4584 #include <inc/win2003/vss.h>
4585 int main(void) { return VSS_CTX_BACKUP; }
4587 if compile_prog "$vss_win32_include" "" ; then
4588 guest_agent_with_vss="yes"
4589 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
4590 libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
4591 qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
4592 else
4593 if test "$vss_win32_sdk" != "" ; then
4594 echo "ERROR: Please download and install Microsoft VSS SDK:"
4595 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
4596 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
4597 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
4598 echo "ERROR: The headers are extracted in the directory \`inc'."
4599 feature_not_found "VSS support"
4601 guest_agent_with_vss="no"
4605 ##########################################
4606 # lookup Windows platform SDK (if not specified)
4607 # The SDK is needed only to build .tlb (type library) file of guest agent
4608 # VSS provider from the source. It is usually unnecessary because the
4609 # pre-compiled .tlb file is included.
4611 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
4612 if test -z "$win_sdk"; then
4613 programfiles="$PROGRAMFILES"
4614 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
4615 if test -n "$programfiles"; then
4616 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
4617 else
4618 feature_not_found "Windows SDK"
4620 elif test "$win_sdk" = "no"; then
4621 win_sdk=""
4625 ##########################################
4626 # check if mingw environment provides a recent ntddscsi.h
4627 if test "$mingw32" = "yes" -a "$guest_agent" != "no"; then
4628 cat > $TMPC << EOF
4629 #include <windows.h>
4630 #include <ntddscsi.h>
4631 int main(void) {
4632 #if !defined(IOCTL_SCSI_GET_ADDRESS)
4633 #error Missing required ioctl definitions
4634 #endif
4635 SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
4636 return addr.Lun;
4639 if compile_prog "" "" ; then
4640 guest_agent_ntddscsi=yes
4641 libs_qga="-lsetupapi $libs_qga"
4645 ##########################################
4646 # virgl renderer probe
4648 if test "$virglrenderer" != "no" ; then
4649 cat > $TMPC << EOF
4650 #include <virglrenderer.h>
4651 int main(void) { virgl_renderer_poll(); return 0; }
4653 virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null)
4654 virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null)
4655 virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null)
4656 if $pkg_config virglrenderer >/dev/null 2>&1 && \
4657 compile_prog "$virgl_cflags" "$virgl_libs" ; then
4658 virglrenderer="yes"
4659 else
4660 if test "$virglrenderer" = "yes" ; then
4661 feature_not_found "virglrenderer"
4663 virglrenderer="no"
4667 ##########################################
4668 # capstone
4670 case "$capstone" in
4671 "" | yes)
4672 if $pkg_config capstone; then
4673 capstone=system
4674 elif test -e "${source_path}/.git" -a $git_update = 'yes' ; then
4675 capstone=git
4676 elif test -e "${source_path}/capstone/Makefile" ; then
4677 capstone=internal
4678 elif test -z "$capstone" ; then
4679 capstone=no
4680 else
4681 feature_not_found "capstone" "Install capstone devel or git submodule"
4685 system)
4686 if ! $pkg_config capstone; then
4687 feature_not_found "capstone" "Install capstone devel"
4690 esac
4692 case "$capstone" in
4693 git | internal)
4694 if test "$capstone" = git; then
4695 git_submodules="${git_submodules} capstone"
4697 mkdir -p capstone
4698 QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include"
4699 if test "$mingw32" = "yes"; then
4700 LIBCAPSTONE=capstone.lib
4701 else
4702 LIBCAPSTONE=libcapstone.a
4704 LIBS="-L\$(BUILD_DIR)/capstone -lcapstone $LIBS"
4707 system)
4708 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)"
4709 LIBS="$($pkg_config --libs capstone) $LIBS"
4715 error_exit "Unknown state for capstone: $capstone"
4717 esac
4719 ##########################################
4720 # check if we have fdatasync
4722 fdatasync=no
4723 cat > $TMPC << EOF
4724 #include <unistd.h>
4725 int main(void) {
4726 #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
4727 return fdatasync(0);
4728 #else
4729 #error Not supported
4730 #endif
4733 if compile_prog "" "" ; then
4734 fdatasync=yes
4737 ##########################################
4738 # check if we have madvise
4740 madvise=no
4741 cat > $TMPC << EOF
4742 #include <sys/types.h>
4743 #include <sys/mman.h>
4744 #include <stddef.h>
4745 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
4747 if compile_prog "" "" ; then
4748 madvise=yes
4751 ##########################################
4752 # check if we have posix_madvise
4754 posix_madvise=no
4755 cat > $TMPC << EOF
4756 #include <sys/mman.h>
4757 #include <stddef.h>
4758 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
4760 if compile_prog "" "" ; then
4761 posix_madvise=yes
4764 ##########################################
4765 # check if we have posix_memalign()
4767 posix_memalign=no
4768 cat > $TMPC << EOF
4769 #include <stdlib.h>
4770 int main(void) {
4771 void *p;
4772 return posix_memalign(&p, 8, 8);
4775 if compile_prog "" "" ; then
4776 posix_memalign=yes
4779 ##########################################
4780 # check if we have posix_syslog
4782 posix_syslog=no
4783 cat > $TMPC << EOF
4784 #include <syslog.h>
4785 int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; }
4787 if compile_prog "" "" ; then
4788 posix_syslog=yes
4791 ##########################################
4792 # check if we have sem_timedwait
4794 sem_timedwait=no
4795 cat > $TMPC << EOF
4796 #include <semaphore.h>
4797 int main(void) { return sem_timedwait(0, 0); }
4799 if compile_prog "" "" ; then
4800 sem_timedwait=yes
4803 ##########################################
4804 # check if trace backend exists
4806 $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
4807 if test "$?" -ne 0 ; then
4808 error_exit "invalid trace backends" \
4809 "Please choose supported trace backends."
4812 ##########################################
4813 # For 'ust' backend, test if ust headers are present
4814 if have_backend "ust"; then
4815 cat > $TMPC << EOF
4816 #include <lttng/tracepoint.h>
4817 int main(void) { return 0; }
4819 if compile_prog "" "-Wl,--no-as-needed -ldl" ; then
4820 if $pkg_config lttng-ust --exists; then
4821 lttng_ust_libs=$($pkg_config --libs lttng-ust)
4822 else
4823 lttng_ust_libs="-llttng-ust -ldl"
4825 if $pkg_config liburcu-bp --exists; then
4826 urcu_bp_libs=$($pkg_config --libs liburcu-bp)
4827 else
4828 urcu_bp_libs="-lurcu-bp"
4831 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
4832 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
4833 else
4834 error_exit "Trace backend 'ust' missing lttng-ust header files"
4838 ##########################################
4839 # For 'dtrace' backend, test if 'dtrace' command is present
4840 if have_backend "dtrace"; then
4841 if ! has 'dtrace' ; then
4842 error_exit "dtrace command is not found in PATH $PATH"
4844 trace_backend_stap="no"
4845 if has 'stap' ; then
4846 trace_backend_stap="yes"
4850 ##########################################
4851 # check and set a backend for coroutine
4853 # We prefer ucontext, but it's not always possible. The fallback
4854 # is sigcontext. On Windows the only valid backend is the Windows
4855 # specific one.
4857 ucontext_works=no
4858 if test "$darwin" != "yes"; then
4859 cat > $TMPC << EOF
4860 #include <ucontext.h>
4861 #ifdef __stub_makecontext
4862 #error Ignoring glibc stub makecontext which will always fail
4863 #endif
4864 int main(void) { makecontext(0, 0, 0); return 0; }
4866 if compile_prog "" "" ; then
4867 ucontext_works=yes
4871 if test "$coroutine" = ""; then
4872 if test "$mingw32" = "yes"; then
4873 coroutine=win32
4874 elif test "$ucontext_works" = "yes"; then
4875 coroutine=ucontext
4876 else
4877 coroutine=sigaltstack
4879 else
4880 case $coroutine in
4881 windows)
4882 if test "$mingw32" != "yes"; then
4883 error_exit "'windows' coroutine backend only valid for Windows"
4885 # Unfortunately the user visible backend name doesn't match the
4886 # coroutine-*.c filename for this case, so we have to adjust it here.
4887 coroutine=win32
4889 ucontext)
4890 if test "$ucontext_works" != "yes"; then
4891 feature_not_found "ucontext"
4894 sigaltstack)
4895 if test "$mingw32" = "yes"; then
4896 error_exit "only the 'windows' coroutine backend is valid for Windows"
4900 error_exit "unknown coroutine backend $coroutine"
4902 esac
4905 if test "$coroutine_pool" = ""; then
4906 coroutine_pool=yes
4909 if test "$debug_stack_usage" = "yes"; then
4910 if test "$coroutine_pool" = "yes"; then
4911 echo "WARN: disabling coroutine pool for stack usage debugging"
4912 coroutine_pool=no
4917 ##########################################
4918 # check if we have open_by_handle_at
4920 open_by_handle_at=no
4921 cat > $TMPC << EOF
4922 #include <fcntl.h>
4923 #if !defined(AT_EMPTY_PATH)
4924 # error missing definition
4925 #else
4926 int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
4927 #endif
4929 if compile_prog "" "" ; then
4930 open_by_handle_at=yes
4933 ########################################
4934 # check if we have linux/magic.h
4936 linux_magic_h=no
4937 cat > $TMPC << EOF
4938 #include <linux/magic.h>
4939 int main(void) {
4940 return 0;
4943 if compile_prog "" "" ; then
4944 linux_magic_h=yes
4947 ########################################
4948 # check whether we can disable warning option with a pragma (this is needed
4949 # to silence warnings in the headers of some versions of external libraries).
4950 # This test has to be compiled with -Werror as otherwise an unknown pragma is
4951 # only a warning.
4953 # If we can't selectively disable warning in the code, disable -Werror so that
4954 # the build doesn't fail anyway.
4956 pragma_disable_unused_but_set=no
4957 cat > $TMPC << EOF
4958 #pragma GCC diagnostic push
4959 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
4960 #pragma GCC diagnostic pop
4962 int main(void) {
4963 return 0;
4966 if compile_prog "-Werror" "" ; then
4967 pragma_diagnostic_available=yes
4968 else
4969 werror=no
4972 ########################################
4973 # check if we have valgrind/valgrind.h
4975 valgrind_h=no
4976 cat > $TMPC << EOF
4977 #include <valgrind/valgrind.h>
4978 int main(void) {
4979 return 0;
4982 if compile_prog "" "" ; then
4983 valgrind_h=yes
4986 ########################################
4987 # check if environ is declared
4989 has_environ=no
4990 cat > $TMPC << EOF
4991 #include <unistd.h>
4992 int main(void) {
4993 environ = 0;
4994 return 0;
4997 if compile_prog "" "" ; then
4998 has_environ=yes
5001 ########################################
5002 # check if cpuid.h is usable.
5004 cat > $TMPC << EOF
5005 #include <cpuid.h>
5006 int main(void) {
5007 unsigned a, b, c, d;
5008 int max = __get_cpuid_max(0, 0);
5010 if (max >= 1) {
5011 __cpuid(1, a, b, c, d);
5014 if (max >= 7) {
5015 __cpuid_count(7, 0, a, b, c, d);
5018 return 0;
5021 if compile_prog "" "" ; then
5022 cpuid_h=yes
5025 ##########################################
5026 # avx2 optimization requirement check
5028 # There is no point enabling this if cpuid.h is not usable,
5029 # since we won't be able to select the new routines.
5031 if test $cpuid_h = yes; then
5032 cat > $TMPC << EOF
5033 #pragma GCC push_options
5034 #pragma GCC target("avx2")
5035 #include <cpuid.h>
5036 #include <immintrin.h>
5037 static int bar(void *a) {
5038 __m256i x = *(__m256i *)a;
5039 return _mm256_testz_si256(x, x);
5041 int main(int argc, char *argv[]) { return bar(argv[0]); }
5043 if compile_object "" ; then
5044 avx2_opt="yes"
5048 ########################################
5049 # check if __[u]int128_t is usable.
5051 int128=no
5052 cat > $TMPC << EOF
5053 #if defined(__clang_major__) && defined(__clang_minor__)
5054 # if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
5055 # error __int128_t does not work in CLANG before 3.2
5056 # endif
5057 #endif
5058 __int128_t a;
5059 __uint128_t b;
5060 int main (void) {
5061 a = a + b;
5062 b = a * b;
5063 a = a * a;
5064 return 0;
5067 if compile_prog "" "" ; then
5068 int128=yes
5071 #########################################
5072 # See if 128-bit atomic operations are supported.
5074 atomic128=no
5075 if test "$int128" = "yes"; then
5076 cat > $TMPC << EOF
5077 int main(void)
5079 unsigned __int128 x = 0, y = 0;
5080 y = __atomic_load_16(&x, 0);
5081 __atomic_store_16(&x, y, 0);
5082 __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0);
5083 return 0;
5086 if compile_prog "" "" ; then
5087 atomic128=yes
5091 #########################################
5092 # See if 64-bit atomic operations are supported.
5093 # Note that without __atomic builtins, we can only
5094 # assume atomic loads/stores max at pointer size.
5096 cat > $TMPC << EOF
5097 #include <stdint.h>
5098 int main(void)
5100 uint64_t x = 0, y = 0;
5101 #ifdef __ATOMIC_RELAXED
5102 y = __atomic_load_8(&x, 0);
5103 __atomic_store_8(&x, y, 0);
5104 __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
5105 __atomic_exchange_8(&x, y, 0);
5106 __atomic_fetch_add_8(&x, y, 0);
5107 #else
5108 typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
5109 __sync_lock_test_and_set(&x, y);
5110 __sync_val_compare_and_swap(&x, y, 0);
5111 __sync_fetch_and_add(&x, y);
5112 #endif
5113 return 0;
5116 if compile_prog "" "" ; then
5117 atomic64=yes
5120 ########################################
5121 # See if 16-byte vector operations are supported.
5122 # Even without a vector unit the compiler may expand these.
5123 # There is a bug in old GCC for PPC that crashes here.
5124 # Unfortunately it's the system compiler for Centos 7.
5126 cat > $TMPC << EOF
5127 typedef unsigned char U1 __attribute__((vector_size(16)));
5128 typedef unsigned short U2 __attribute__((vector_size(16)));
5129 typedef unsigned int U4 __attribute__((vector_size(16)));
5130 typedef unsigned long long U8 __attribute__((vector_size(16)));
5131 typedef signed char S1 __attribute__((vector_size(16)));
5132 typedef signed short S2 __attribute__((vector_size(16)));
5133 typedef signed int S4 __attribute__((vector_size(16)));
5134 typedef signed long long S8 __attribute__((vector_size(16)));
5135 static U1 a1, b1;
5136 static U2 a2, b2;
5137 static U4 a4, b4;
5138 static U8 a8, b8;
5139 static S1 c1;
5140 static S2 c2;
5141 static S4 c4;
5142 static S8 c8;
5143 static int i;
5144 void helper(void *d, void *a, int shift, int i);
5145 void helper(void *d, void *a, int shift, int i)
5147 *(U1 *)(d + i) = *(U1 *)(a + i) << shift;
5148 *(U2 *)(d + i) = *(U2 *)(a + i) << shift;
5149 *(U4 *)(d + i) = *(U4 *)(a + i) << shift;
5150 *(U8 *)(d + i) = *(U8 *)(a + i) << shift;
5152 int main(void)
5154 a1 += b1; a2 += b2; a4 += b4; a8 += b8;
5155 a1 -= b1; a2 -= b2; a4 -= b4; a8 -= b8;
5156 a1 *= b1; a2 *= b2; a4 *= b4; a8 *= b8;
5157 a1 &= b1; a2 &= b2; a4 &= b4; a8 &= b8;
5158 a1 |= b1; a2 |= b2; a4 |= b4; a8 |= b8;
5159 a1 ^= b1; a2 ^= b2; a4 ^= b4; a8 ^= b8;
5160 a1 <<= i; a2 <<= i; a4 <<= i; a8 <<= i;
5161 a1 >>= i; a2 >>= i; a4 >>= i; a8 >>= i;
5162 c1 >>= i; c2 >>= i; c4 >>= i; c8 >>= i;
5163 return 0;
5167 vector16=no
5168 if compile_prog "" "" ; then
5169 vector16=yes
5172 ########################################
5173 # check if getauxval is available.
5175 getauxval=no
5176 cat > $TMPC << EOF
5177 #include <sys/auxv.h>
5178 int main(void) {
5179 return getauxval(AT_HWCAP) == 0;
5182 if compile_prog "" "" ; then
5183 getauxval=yes
5186 ########################################
5187 # check if ccache is interfering with
5188 # semantic analysis of macros
5190 unset CCACHE_CPP2
5191 ccache_cpp2=no
5192 cat > $TMPC << EOF
5193 static const int Z = 1;
5194 #define fn() ({ Z; })
5195 #define TAUT(X) ((X) == Z)
5196 #define PAREN(X, Y) (X == Y)
5197 #define ID(X) (X)
5198 int main(int argc, char *argv[])
5200 int x = 0, y = 0;
5201 x = ID(x);
5202 x = fn();
5203 fn();
5204 if (PAREN(x, y)) return 0;
5205 if (TAUT(Z)) return 0;
5206 return 0;
5210 if ! compile_object "-Werror"; then
5211 ccache_cpp2=yes
5214 #################################################
5215 # clang does not support glibc + FORTIFY_SOURCE.
5217 if test "$fortify_source" != "no"; then
5218 if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
5219 fortify_source="no";
5220 elif test -n "$cxx" && has $cxx &&
5221 echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then
5222 fortify_source="no";
5223 else
5224 fortify_source="yes"
5228 ###############################################
5229 # Check if copy_file_range is provided by glibc
5230 have_copy_file_range=no
5231 cat > $TMPC << EOF
5232 #include <unistd.h>
5233 int main(void) {
5234 copy_file_range(0, NULL, 0, NULL, 0, 0);
5235 return 0;
5238 if compile_prog "" "" ; then
5239 have_copy_file_range=yes
5242 ##########################################
5243 # check if struct fsxattr is available via linux/fs.h
5245 have_fsxattr=no
5246 cat > $TMPC << EOF
5247 #include <linux/fs.h>
5248 struct fsxattr foo;
5249 int main(void) {
5250 return 0;
5253 if compile_prog "" "" ; then
5254 have_fsxattr=yes
5257 ##########################################
5258 # check for usable membarrier system call
5259 if test "$membarrier" = "yes"; then
5260 have_membarrier=no
5261 if test "$mingw32" = "yes" ; then
5262 have_membarrier=yes
5263 elif test "$linux" = "yes" ; then
5264 cat > $TMPC << EOF
5265 #include <linux/membarrier.h>
5266 #include <sys/syscall.h>
5267 #include <unistd.h>
5268 #include <stdlib.h>
5269 int main(void) {
5270 syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0);
5271 syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0);
5272 exit(0);
5275 if compile_prog "" "" ; then
5276 have_membarrier=yes
5279 if test "$have_membarrier" = "no"; then
5280 feature_not_found "membarrier" "membarrier system call not available"
5282 else
5283 # Do not enable it by default even for Mingw32, because it doesn't
5284 # work on Wine.
5285 membarrier=no
5288 ##########################################
5289 # check if rtnetlink.h exists and is useful
5290 have_rtnetlink=no
5291 cat > $TMPC << EOF
5292 #include <linux/rtnetlink.h>
5293 int main(void) {
5294 return IFLA_PROTO_DOWN;
5297 if compile_prog "" "" ; then
5298 have_rtnetlink=yes
5301 ##########################################
5302 # check for usable AF_VSOCK environment
5303 have_af_vsock=no
5304 cat > $TMPC << EOF
5305 #include <errno.h>
5306 #include <sys/types.h>
5307 #include <sys/socket.h>
5308 #if !defined(AF_VSOCK)
5309 # error missing AF_VSOCK flag
5310 #endif
5311 #include <linux/vm_sockets.h>
5312 int main(void) {
5313 int sock, ret;
5314 struct sockaddr_vm svm;
5315 socklen_t len = sizeof(svm);
5316 sock = socket(AF_VSOCK, SOCK_STREAM, 0);
5317 ret = getpeername(sock, (struct sockaddr *)&svm, &len);
5318 if ((ret == -1) && (errno == ENOTCONN)) {
5319 return 0;
5321 return -1;
5324 if compile_prog "" "" ; then
5325 have_af_vsock=yes
5328 ##########################################
5329 # check for usable AF_ALG environment
5330 hava_afalg=no
5331 cat > $TMPC << EOF
5332 #include <errno.h>
5333 #include <sys/types.h>
5334 #include <sys/socket.h>
5335 #include <linux/if_alg.h>
5336 int main(void) {
5337 int sock;
5338 sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
5339 return sock;
5342 if compile_prog "" "" ; then
5343 have_afalg=yes
5345 if test "$crypto_afalg" = "yes"
5346 then
5347 if test "$have_afalg" != "yes"
5348 then
5349 error_exit "AF_ALG requested but could not be detected"
5354 #################################################
5355 # Check to see if we have the Hypervisor framework
5356 if [ "$darwin" = "yes" ] ; then
5357 cat > $TMPC << EOF
5358 #include <Hypervisor/hv.h>
5359 int main() { return 0;}
5361 if ! compile_object ""; then
5362 hvf='no'
5363 else
5364 hvf='yes'
5365 LDFLAGS="-framework Hypervisor $LDFLAGS"
5369 #################################################
5370 # Sparc implicitly links with --relax, which is
5371 # incompatible with -r, so --no-relax should be
5372 # given. It does no harm to give it on other
5373 # platforms too.
5375 # Note: the prototype is needed since QEMU_CFLAGS
5376 # contains -Wmissing-prototypes
5377 cat > $TMPC << EOF
5378 extern int foo(void);
5379 int foo(void) { return 0; }
5381 if ! compile_object ""; then
5382 error_exit "Failed to compile object file for LD_REL_FLAGS test"
5384 for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do
5385 if do_cc -nostdlib $i -o $TMPMO $TMPO; then
5386 LD_REL_FLAGS=$i
5387 break
5389 done
5390 if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then
5391 feature_not_found "modules" "Cannot find how to build relocatable objects"
5394 ##########################################
5395 # check for sysmacros.h
5397 have_sysmacros=no
5398 cat > $TMPC << EOF
5399 #include <sys/sysmacros.h>
5400 int main(void) {
5401 return makedev(0, 0);
5404 if compile_prog "" "" ; then
5405 have_sysmacros=yes
5408 ##########################################
5409 # Veritas HyperScale block driver VxHS
5410 # Check if libvxhs is installed
5412 if test "$vxhs" != "no" ; then
5413 cat > $TMPC <<EOF
5414 #include <stdint.h>
5415 #include <qnio/qnio_api.h>
5417 void *vxhs_callback;
5419 int main(void) {
5420 iio_init(QNIO_VERSION, vxhs_callback);
5421 return 0;
5424 vxhs_libs="-lvxhs -lssl"
5425 if compile_prog "" "$vxhs_libs" ; then
5426 vxhs=yes
5427 else
5428 if test "$vxhs" = "yes" ; then
5429 feature_not_found "vxhs block device" "Install libvxhs See github"
5431 vxhs=no
5435 ##########################################
5436 # check for _Static_assert()
5438 have_static_assert=no
5439 cat > $TMPC << EOF
5440 _Static_assert(1, "success");
5441 int main(void) {
5442 return 0;
5445 if compile_prog "" "" ; then
5446 have_static_assert=yes
5449 ##########################################
5450 # check for utmpx.h, it is missing e.g. on OpenBSD
5452 have_utmpx=no
5453 cat > $TMPC << EOF
5454 #include <utmpx.h>
5455 struct utmpx user_info;
5456 int main(void) {
5457 return 0;
5460 if compile_prog "" "" ; then
5461 have_utmpx=yes
5464 ##########################################
5465 # checks for sanitizers
5467 have_asan=no
5468 have_ubsan=no
5469 have_asan_iface_h=no
5470 have_asan_iface_fiber=no
5472 if test "$sanitizers" = "yes" ; then
5473 write_c_skeleton
5474 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then
5475 have_asan=yes
5478 # we could use a simple skeleton for flags checks, but this also
5479 # detect the static linking issue of ubsan, see also:
5480 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
5481 cat > $TMPC << EOF
5482 #include <stdlib.h>
5483 int main(void) {
5484 void *tmp = malloc(10);
5485 return *(int *)(tmp + 2);
5488 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
5489 have_ubsan=yes
5492 if check_include "sanitizer/asan_interface.h" ; then
5493 have_asan_iface_h=yes
5496 cat > $TMPC << EOF
5497 #include <sanitizer/asan_interface.h>
5498 int main(void) {
5499 __sanitizer_start_switch_fiber(0, 0, 0);
5500 return 0;
5503 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then
5504 have_asan_iface_fiber=yes
5508 ##########################################
5509 # Docker and cross-compiler support
5511 # This is specifically for building test
5512 # cases for foreign architectures, not
5513 # cross-compiling QEMU itself.
5515 if has "docker"; then
5516 docker=$($python $source_path/tests/docker/docker.py probe)
5519 ##########################################
5520 # End of CC checks
5521 # After here, no more $cc or $ld runs
5523 write_c_skeleton
5525 if test "$gcov" = "yes" ; then
5526 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
5527 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
5528 elif test "$fortify_source" = "yes" ; then
5529 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
5530 elif test "$debug" = "no"; then
5531 CFLAGS="-O2 $CFLAGS"
5534 if test "$have_asan" = "yes"; then
5535 CFLAGS="-fsanitize=address $CFLAGS"
5536 if test "$have_asan_iface_h" = "no" ; then
5537 echo "ASAN build enabled, but ASAN header missing." \
5538 "Without code annotation, the report may be inferior."
5539 elif test "$have_asan_iface_fiber" = "no" ; then
5540 echo "ASAN build enabled, but ASAN header is too old." \
5541 "Without code annotation, the report may be inferior."
5544 if test "$have_ubsan" = "yes"; then
5545 CFLAGS="-fsanitize=undefined $CFLAGS"
5548 ##########################################
5549 # Do we have libnfs
5550 if test "$libnfs" != "no" ; then
5551 if $pkg_config --atleast-version=1.9.3 libnfs; then
5552 libnfs="yes"
5553 libnfs_libs=$($pkg_config --libs libnfs)
5554 else
5555 if test "$libnfs" = "yes" ; then
5556 feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
5558 libnfs="no"
5562 # Now we've finished running tests it's OK to add -Werror to the compiler flags
5563 if test "$werror" = "yes"; then
5564 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
5567 if test "$solaris" = "no" ; then
5568 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
5569 LDFLAGS="-Wl,--warn-common $LDFLAGS"
5573 # test if pod2man has --utf8 option
5574 if pod2man --help | grep -q utf8; then
5575 POD2MAN="pod2man --utf8"
5576 else
5577 POD2MAN="pod2man"
5580 # Use ASLR, no-SEH and DEP if available
5581 if test "$mingw32" = "yes" ; then
5582 for flag in --dynamicbase --no-seh --nxcompat; do
5583 if ld_has $flag ; then
5584 LDFLAGS="-Wl,$flag $LDFLAGS"
5586 done
5589 qemu_confdir=$sysconfdir$confsuffix
5590 qemu_moddir=$libdir$confsuffix
5591 qemu_datadir=$datadir$confsuffix
5592 qemu_localedir="$datadir/locale"
5594 # We can only support ivshmem if we have eventfd
5595 if [ "$eventfd" = "yes" ]; then
5596 ivshmem=yes
5599 tools=""
5600 if test "$want_tools" = "yes" ; then
5601 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
5602 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
5603 tools="qemu-nbd\$(EXESUF) $tools"
5605 if [ "$ivshmem" = "yes" ]; then
5606 tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools"
5609 if test "$softmmu" = yes ; then
5610 if test "$linux" = yes; then
5611 if test "$virtfs" != no && test "$cap" = yes && test "$attr" = yes ; then
5612 virtfs=yes
5613 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
5614 else
5615 if test "$virtfs" = yes; then
5616 error_exit "VirtFS requires libcap devel and libattr devel"
5618 virtfs=no
5620 if test "$mpath" != no && test "$mpathpersist" = yes ; then
5621 mpath=yes
5622 else
5623 if test "$mpath" = yes; then
5624 error_exit "Multipath requires libmpathpersist devel"
5626 mpath=no
5628 tools="$tools scsi/qemu-pr-helper\$(EXESUF)"
5629 else
5630 if test "$virtfs" = yes; then
5631 error_exit "VirtFS is supported only on Linux"
5633 virtfs=no
5634 if test "$mpath" = yes; then
5635 error_exit "Multipath is supported only on Linux"
5637 mpath=no
5639 if test "$xkbcommon" = "yes"; then
5640 tools="qemu-keymap\$(EXESUF) $tools"
5644 # Probe for guest agent support/options
5646 if [ "$guest_agent" != "no" ]; then
5647 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
5648 tools="qemu-ga $tools"
5649 guest_agent=yes
5650 elif [ "$guest_agent" != yes ]; then
5651 guest_agent=no
5652 else
5653 error_exit "Guest agent is not supported on this platform"
5657 # Guest agent Window MSI package
5659 if test "$guest_agent" != yes; then
5660 if test "$guest_agent_msi" = yes; then
5661 error_exit "MSI guest agent package requires guest agent enabled"
5663 guest_agent_msi=no
5664 elif test "$mingw32" != "yes"; then
5665 if test "$guest_agent_msi" = "yes"; then
5666 error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation"
5668 guest_agent_msi=no
5669 elif ! has wixl; then
5670 if test "$guest_agent_msi" = "yes"; then
5671 error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )"
5673 guest_agent_msi=no
5674 else
5675 # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't
5676 # disabled explicitly
5677 if test "$guest_agent_msi" != "no"; then
5678 guest_agent_msi=yes
5682 if test "$guest_agent_msi" = "yes"; then
5683 if test "$guest_agent_with_vss" = "yes"; then
5684 QEMU_GA_MSI_WITH_VSS="-D InstallVss"
5687 if test "$QEMU_GA_MANUFACTURER" = ""; then
5688 QEMU_GA_MANUFACTURER=QEMU
5691 if test "$QEMU_GA_DISTRO" = ""; then
5692 QEMU_GA_DISTRO=Linux
5695 if test "$QEMU_GA_VERSION" = ""; then
5696 QEMU_GA_VERSION=$(cat $source_path/VERSION)
5699 QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin"
5701 case "$cpu" in
5702 x86_64)
5703 QEMU_GA_MSI_ARCH="-a x64 -D Arch=64"
5705 i386)
5706 QEMU_GA_MSI_ARCH="-D Arch=32"
5709 error_exit "CPU $cpu not supported for building installation package"
5711 esac
5714 # Mac OS X ships with a broken assembler
5715 roms=
5716 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
5717 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
5718 "$softmmu" = yes ; then
5719 # Different host OS linkers have different ideas about the name of the ELF
5720 # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
5721 # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
5722 for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do
5723 if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
5724 ld_i386_emulation="$emu"
5725 roms="optionrom"
5726 break
5728 done
5730 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
5731 roms="$roms spapr-rtas"
5734 if test "$cpu" = "s390x" ; then
5735 roms="$roms s390-ccw"
5738 # Probe for the need for relocating the user-only binary.
5739 if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
5740 textseg_addr=
5741 case "$cpu" in
5742 arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
5743 # ??? Rationale for choosing this address
5744 textseg_addr=0x60000000
5746 mips)
5747 # A 256M aligned address, high in the address space, with enough
5748 # room for the code_gen_buffer above it before the stack.
5749 textseg_addr=0x60000000
5751 esac
5752 if [ -n "$textseg_addr" ]; then
5753 cat > $TMPC <<EOF
5754 int main(void) { return 0; }
5756 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
5757 if ! compile_prog "" "$textseg_ldflags"; then
5758 # In case ld does not support -Ttext-segment, edit the default linker
5759 # script via sed to set the .text start addr. This is needed on FreeBSD
5760 # at least.
5761 if ! $ld --verbose >/dev/null 2>&1; then
5762 error_exit \
5763 "We need to link the QEMU user mode binaries at a" \
5764 "specific text address. Unfortunately your linker" \
5765 "doesn't support either the -Ttext-segment option or" \
5766 "printing the default linker script with --verbose." \
5767 "If you don't want the user mode binaries, pass the" \
5768 "--disable-user option to configure."
5771 $ld --verbose | sed \
5772 -e '1,/==================================================/d' \
5773 -e '/==================================================/,$d' \
5774 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
5775 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
5776 textseg_ldflags="-Wl,-T../config-host.ld"
5781 # Check that the C++ compiler exists and works with the C compiler.
5782 # All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
5783 if has $cxx; then
5784 cat > $TMPC <<EOF
5785 int c_function(void);
5786 int main(void) { return c_function(); }
5789 compile_object
5791 cat > $TMPCXX <<EOF
5792 extern "C" {
5793 int c_function(void);
5795 int c_function(void) { return 42; }
5798 update_cxxflags
5800 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
5801 # C++ compiler $cxx works ok with C compiler $cc
5803 else
5804 echo "C++ compiler $cxx does not work with C compiler $cc"
5805 echo "Disabling C++ specific optional code"
5806 cxx=
5808 else
5809 echo "No C++ compiler available; disabling C++ specific optional code"
5810 cxx=
5813 echo_version() {
5814 if test "$1" = "yes" ; then
5815 echo "($2)"
5819 # prepend pixman and ftd flags after all config tests are done
5820 QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
5821 QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS"
5822 libs_softmmu="$pixman_libs $libs_softmmu"
5824 echo "Install prefix $prefix"
5825 echo "BIOS directory $(eval echo $qemu_datadir)"
5826 echo "firmware path $(eval echo $firmwarepath)"
5827 echo "binary directory $(eval echo $bindir)"
5828 echo "library directory $(eval echo $libdir)"
5829 echo "module directory $(eval echo $qemu_moddir)"
5830 echo "libexec directory $(eval echo $libexecdir)"
5831 echo "include directory $(eval echo $includedir)"
5832 echo "config directory $(eval echo $sysconfdir)"
5833 if test "$mingw32" = "no" ; then
5834 echo "local state directory $(eval echo $local_statedir)"
5835 echo "Manual directory $(eval echo $mandir)"
5836 echo "ELF interp prefix $interp_prefix"
5837 else
5838 echo "local state directory queried at runtime"
5839 echo "Windows SDK $win_sdk"
5841 echo "Source path $source_path"
5842 echo "GIT binary $git"
5843 echo "GIT submodules $git_submodules"
5844 echo "C compiler $cc"
5845 echo "Host C compiler $host_cc"
5846 echo "C++ compiler $cxx"
5847 echo "Objective-C compiler $objcc"
5848 echo "ARFLAGS $ARFLAGS"
5849 echo "CFLAGS $CFLAGS"
5850 echo "QEMU_CFLAGS $QEMU_CFLAGS"
5851 echo "LDFLAGS $LDFLAGS"
5852 echo "QEMU_LDFLAGS $QEMU_LDFLAGS"
5853 echo "make $make"
5854 echo "install $install"
5855 echo "python $python"
5856 if test "$slirp" = "yes" ; then
5857 echo "smbd $smbd"
5859 echo "module support $modules"
5860 echo "host CPU $cpu"
5861 echo "host big endian $bigendian"
5862 echo "target list $target_list"
5863 echo "gprof enabled $gprof"
5864 echo "sparse enabled $sparse"
5865 echo "strip binaries $strip_opt"
5866 echo "profiler $profiler"
5867 echo "static build $static"
5868 if test "$darwin" = "yes" ; then
5869 echo "Cocoa support $cocoa"
5871 echo "SDL support $sdl $(echo_version $sdl $sdlversion)"
5872 echo "GTK support $gtk $(echo_version $gtk $gtk_version)"
5873 echo "GTK GL support $gtk_gl"
5874 echo "VTE support $vte $(echo_version $vte $vteversion)"
5875 echo "TLS priority $tls_priority"
5876 echo "GNUTLS support $gnutls"
5877 echo "GNUTLS rnd $gnutls_rnd"
5878 echo "libgcrypt $gcrypt"
5879 echo "libgcrypt kdf $gcrypt_kdf"
5880 echo "nettle $nettle $(echo_version $nettle $nettle_version)"
5881 echo "nettle kdf $nettle_kdf"
5882 echo "libtasn1 $tasn1"
5883 echo "curses support $curses"
5884 echo "virgl support $virglrenderer $(echo_version $virglrenderer $virgl_version)"
5885 echo "curl support $curl"
5886 echo "mingw32 support $mingw32"
5887 echo "Audio drivers $audio_drv_list"
5888 echo "Block whitelist (rw) $block_drv_rw_whitelist"
5889 echo "Block whitelist (ro) $block_drv_ro_whitelist"
5890 echo "VirtFS support $virtfs"
5891 echo "Multipath support $mpath"
5892 echo "VNC support $vnc"
5893 if test "$vnc" = "yes" ; then
5894 echo "VNC SASL support $vnc_sasl"
5895 echo "VNC JPEG support $vnc_jpeg"
5896 echo "VNC PNG support $vnc_png"
5898 if test -n "$sparc_cpu"; then
5899 echo "Target Sparc Arch $sparc_cpu"
5901 echo "xen support $xen"
5902 if test "$xen" = "yes" ; then
5903 echo "xen ctrl version $xen_ctrl_version"
5904 echo "pv dom build $xen_pv_domain_build"
5906 echo "brlapi support $brlapi"
5907 echo "bluez support $bluez"
5908 echo "Documentation $docs"
5909 echo "PIE $pie"
5910 echo "vde support $vde"
5911 echo "netmap support $netmap"
5912 echo "Linux AIO support $linux_aio"
5913 echo "ATTR/XATTR support $attr"
5914 echo "Install blobs $blobs"
5915 echo "KVM support $kvm"
5916 echo "HAX support $hax"
5917 echo "HVF support $hvf"
5918 echo "WHPX support $whpx"
5919 echo "TCG support $tcg"
5920 if test "$tcg" = "yes" ; then
5921 echo "TCG debug enabled $debug_tcg"
5922 echo "TCG interpreter $tcg_interpreter"
5924 echo "malloc trim support $malloc_trim"
5925 echo "RDMA support $rdma"
5926 echo "fdt support $fdt"
5927 echo "membarrier $membarrier"
5928 echo "preadv support $preadv"
5929 echo "fdatasync $fdatasync"
5930 echo "madvise $madvise"
5931 echo "posix_madvise $posix_madvise"
5932 echo "posix_memalign $posix_memalign"
5933 echo "libcap-ng support $cap_ng"
5934 echo "vhost-net support $vhost_net"
5935 echo "vhost-crypto support $vhost_crypto"
5936 echo "vhost-scsi support $vhost_scsi"
5937 echo "vhost-vsock support $vhost_vsock"
5938 echo "vhost-user support $vhost_user"
5939 echo "Trace backends $trace_backends"
5940 if have_backend "simple"; then
5941 echo "Trace output file $trace_file-<pid>"
5943 echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)"
5944 echo "rbd support $rbd"
5945 echo "xfsctl support $xfs"
5946 echo "smartcard support $smartcard"
5947 echo "libusb $libusb"
5948 echo "usb net redir $usb_redir"
5949 echo "OpenGL support $opengl"
5950 echo "OpenGL dmabufs $opengl_dmabuf"
5951 echo "libiscsi support $libiscsi"
5952 echo "libnfs support $libnfs"
5953 echo "build guest agent $guest_agent"
5954 echo "QGA VSS support $guest_agent_with_vss"
5955 echo "QGA w32 disk info $guest_agent_ntddscsi"
5956 echo "QGA MSI support $guest_agent_msi"
5957 echo "seccomp support $seccomp"
5958 echo "coroutine backend $coroutine"
5959 echo "coroutine pool $coroutine_pool"
5960 echo "debug stack usage $debug_stack_usage"
5961 echo "mutex debugging $debug_mutex"
5962 echo "crypto afalg $crypto_afalg"
5963 echo "GlusterFS support $glusterfs"
5964 echo "gcov $gcov_tool"
5965 echo "gcov enabled $gcov"
5966 echo "TPM support $tpm"
5967 echo "libssh2 support $libssh2"
5968 echo "TPM passthrough $tpm_passthrough"
5969 echo "TPM emulator $tpm_emulator"
5970 echo "QOM debugging $qom_cast_debug"
5971 echo "Live block migration $live_block_migration"
5972 echo "lzo support $lzo"
5973 echo "snappy support $snappy"
5974 echo "bzip2 support $bzip2"
5975 echo "NUMA host support $numa"
5976 echo "libxml2 $libxml2"
5977 echo "tcmalloc support $tcmalloc"
5978 echo "jemalloc support $jemalloc"
5979 echo "avx2 optimization $avx2_opt"
5980 echo "replication support $replication"
5981 echo "VxHS block device $vxhs"
5982 echo "capstone $capstone"
5983 echo "docker $docker"
5985 if test "$sdl_too_old" = "yes"; then
5986 echo "-> Your SDL version is too old - please upgrade to have SDL support"
5989 if test "$gtkabi" = "2.0"; then
5990 echo
5991 echo "WARNING: Use of GTK 2.0 is deprecated and will be removed in"
5992 echo "WARNING: future releases. Please switch to using GTK 3.0"
5995 if test "$sdlabi" = "1.2"; then
5996 echo
5997 echo "WARNING: Use of SDL 1.2 is deprecated and will be removed in"
5998 echo "WARNING: future releases. Please switch to using SDL 2.0"
6001 if test "$supported_cpu" = "no"; then
6002 echo
6003 echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
6004 echo
6005 echo "CPU host architecture $cpu support is not currently maintained."
6006 echo "The QEMU project intends to remove support for this host CPU in"
6007 echo "a future release if nobody volunteers to maintain it and to"
6008 echo "provide a build host for our continuous integration setup."
6009 echo "configure has succeeded and you can continue to build, but"
6010 echo "if you care about QEMU on this platform you should contact"
6011 echo "us upstream at qemu-devel@nongnu.org."
6014 if test "$supported_os" = "no"; then
6015 echo
6016 echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!"
6017 echo
6018 echo "Host OS $targetos support is not currently maintained."
6019 echo "The QEMU project intends to remove support for this host OS in"
6020 echo "a future release if nobody volunteers to maintain it and to"
6021 echo "provide a build host for our continuous integration setup."
6022 echo "configure has succeeded and you can continue to build, but"
6023 echo "if you care about QEMU on this platform you should contact"
6024 echo "us upstream at qemu-devel@nongnu.org."
6027 config_host_mak="config-host.mak"
6029 echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
6031 echo "# Automatically generated by configure - do not modify" > $config_host_mak
6032 echo >> $config_host_mak
6034 echo all: >> $config_host_mak
6035 echo "prefix=$prefix" >> $config_host_mak
6036 echo "bindir=$bindir" >> $config_host_mak
6037 echo "libdir=$libdir" >> $config_host_mak
6038 echo "libexecdir=$libexecdir" >> $config_host_mak
6039 echo "includedir=$includedir" >> $config_host_mak
6040 echo "mandir=$mandir" >> $config_host_mak
6041 echo "sysconfdir=$sysconfdir" >> $config_host_mak
6042 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
6043 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
6044 echo "qemu_firmwarepath=$firmwarepath" >> $config_host_mak
6045 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
6046 echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
6047 if test "$mingw32" = "no" ; then
6048 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
6050 echo "qemu_helperdir=$libexecdir" >> $config_host_mak
6051 echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
6052 echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
6053 echo "GIT=$git" >> $config_host_mak
6054 echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
6055 echo "GIT_UPDATE=$git_update" >> $config_host_mak
6057 echo "ARCH=$ARCH" >> $config_host_mak
6059 if test "$debug_tcg" = "yes" ; then
6060 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
6062 if test "$strip_opt" = "yes" ; then
6063 echo "STRIP=${strip}" >> $config_host_mak
6065 if test "$bigendian" = "yes" ; then
6066 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
6068 if test "$mingw32" = "yes" ; then
6069 echo "CONFIG_WIN32=y" >> $config_host_mak
6070 rc_version=$(cat $source_path/VERSION)
6071 version_major=${rc_version%%.*}
6072 rc_version=${rc_version#*.}
6073 version_minor=${rc_version%%.*}
6074 rc_version=${rc_version#*.}
6075 version_subminor=${rc_version%%.*}
6076 version_micro=0
6077 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
6078 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
6079 if test "$guest_agent_with_vss" = "yes" ; then
6080 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
6081 echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak
6082 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
6084 if test "$guest_agent_ntddscsi" = "yes" ; then
6085 echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak
6087 if test "$guest_agent_msi" = "yes"; then
6088 echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
6089 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
6090 echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
6091 echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
6092 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
6093 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
6094 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
6096 else
6097 echo "CONFIG_POSIX=y" >> $config_host_mak
6100 if test "$linux" = "yes" ; then
6101 echo "CONFIG_LINUX=y" >> $config_host_mak
6104 if test "$darwin" = "yes" ; then
6105 echo "CONFIG_DARWIN=y" >> $config_host_mak
6108 if test "$solaris" = "yes" ; then
6109 echo "CONFIG_SOLARIS=y" >> $config_host_mak
6111 if test "$haiku" = "yes" ; then
6112 echo "CONFIG_HAIKU=y" >> $config_host_mak
6114 if test "$static" = "yes" ; then
6115 echo "CONFIG_STATIC=y" >> $config_host_mak
6117 if test "$profiler" = "yes" ; then
6118 echo "CONFIG_PROFILER=y" >> $config_host_mak
6120 if test "$slirp" = "yes" ; then
6121 echo "CONFIG_SLIRP=y" >> $config_host_mak
6122 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
6124 if test "$vde" = "yes" ; then
6125 echo "CONFIG_VDE=y" >> $config_host_mak
6126 echo "VDE_LIBS=$vde_libs" >> $config_host_mak
6128 if test "$netmap" = "yes" ; then
6129 echo "CONFIG_NETMAP=y" >> $config_host_mak
6131 if test "$l2tpv3" = "yes" ; then
6132 echo "CONFIG_L2TPV3=y" >> $config_host_mak
6134 if test "$cap_ng" = "yes" ; then
6135 echo "CONFIG_LIBCAP=y" >> $config_host_mak
6137 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
6138 for drv in $audio_drv_list; do
6139 def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
6140 case "$drv" in
6141 alsa | oss | pa | sdl)
6142 echo "$def=m" >> $config_host_mak ;;
6144 echo "$def=y" >> $config_host_mak ;;
6145 esac
6146 done
6147 echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak
6148 echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak
6149 echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak
6150 echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak
6151 echo "OSS_LIBS=$oss_libs" >> $config_host_mak
6152 if test "$audio_pt_int" = "yes" ; then
6153 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
6155 if test "$audio_win_int" = "yes" ; then
6156 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
6158 echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
6159 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
6160 if test "$vnc" = "yes" ; then
6161 echo "CONFIG_VNC=y" >> $config_host_mak
6163 if test "$vnc_sasl" = "yes" ; then
6164 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
6166 if test "$vnc_jpeg" = "yes" ; then
6167 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
6169 if test "$vnc_png" = "yes" ; then
6170 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
6172 if test "$xkbcommon" = "yes" ; then
6173 echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak
6174 echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak
6176 if test "$fnmatch" = "yes" ; then
6177 echo "CONFIG_FNMATCH=y" >> $config_host_mak
6179 if test "$xfs" = "yes" ; then
6180 echo "CONFIG_XFS=y" >> $config_host_mak
6182 qemu_version=$(head $source_path/VERSION)
6183 echo "VERSION=$qemu_version" >>$config_host_mak
6184 echo "PKGVERSION=$pkgversion" >>$config_host_mak
6185 echo "SRC_PATH=$source_path" >> $config_host_mak
6186 echo "TARGET_LIST=$target_list" >> $config_host_mak
6187 if [ "$docs" = "yes" ] ; then
6188 echo "BUILD_DOCS=yes" >> $config_host_mak
6190 if test "$modules" = "yes"; then
6191 # $shacmd can generate a hash started with digit, which the compiler doesn't
6192 # like as an symbol. So prefix it with an underscore
6193 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
6194 echo "CONFIG_MODULES=y" >> $config_host_mak
6196 if test "$have_x11" = "yes" -a "$need_x11" = "yes"; then
6197 echo "CONFIG_X11=y" >> $config_host_mak
6198 echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak
6199 echo "X11_LIBS=$x11_libs" >> $config_host_mak
6201 if test "$sdl" = "yes" ; then
6202 echo "CONFIG_SDL=m" >> $config_host_mak
6203 echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
6204 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
6205 echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
6207 if test "$cocoa" = "yes" ; then
6208 echo "CONFIG_COCOA=y" >> $config_host_mak
6210 if test "$curses" = "yes" ; then
6211 echo "CONFIG_CURSES=m" >> $config_host_mak
6212 echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak
6213 echo "CURSES_LIBS=$curses_lib" >> $config_host_mak
6215 if test "$pipe2" = "yes" ; then
6216 echo "CONFIG_PIPE2=y" >> $config_host_mak
6218 if test "$accept4" = "yes" ; then
6219 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
6221 if test "$splice" = "yes" ; then
6222 echo "CONFIG_SPLICE=y" >> $config_host_mak
6224 if test "$eventfd" = "yes" ; then
6225 echo "CONFIG_EVENTFD=y" >> $config_host_mak
6227 if test "$memfd" = "yes" ; then
6228 echo "CONFIG_MEMFD=y" >> $config_host_mak
6230 if test "$fallocate" = "yes" ; then
6231 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
6233 if test "$fallocate_punch_hole" = "yes" ; then
6234 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
6236 if test "$fallocate_zero_range" = "yes" ; then
6237 echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak
6239 if test "$posix_fallocate" = "yes" ; then
6240 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
6242 if test "$sync_file_range" = "yes" ; then
6243 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
6245 if test "$fiemap" = "yes" ; then
6246 echo "CONFIG_FIEMAP=y" >> $config_host_mak
6248 if test "$dup3" = "yes" ; then
6249 echo "CONFIG_DUP3=y" >> $config_host_mak
6251 if test "$ppoll" = "yes" ; then
6252 echo "CONFIG_PPOLL=y" >> $config_host_mak
6254 if test "$prctl_pr_set_timerslack" = "yes" ; then
6255 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
6257 if test "$epoll" = "yes" ; then
6258 echo "CONFIG_EPOLL=y" >> $config_host_mak
6260 if test "$epoll_create1" = "yes" ; then
6261 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
6263 if test "$sendfile" = "yes" ; then
6264 echo "CONFIG_SENDFILE=y" >> $config_host_mak
6266 if test "$timerfd" = "yes" ; then
6267 echo "CONFIG_TIMERFD=y" >> $config_host_mak
6269 if test "$setns" = "yes" ; then
6270 echo "CONFIG_SETNS=y" >> $config_host_mak
6272 if test "$clock_adjtime" = "yes" ; then
6273 echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak
6275 if test "$syncfs" = "yes" ; then
6276 echo "CONFIG_SYNCFS=y" >> $config_host_mak
6278 if test "$inotify" = "yes" ; then
6279 echo "CONFIG_INOTIFY=y" >> $config_host_mak
6281 if test "$inotify1" = "yes" ; then
6282 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
6284 if test "$sem_timedwait" = "yes" ; then
6285 echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak
6287 if test "$byteswap_h" = "yes" ; then
6288 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
6290 if test "$bswap_h" = "yes" ; then
6291 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
6293 if test "$curl" = "yes" ; then
6294 echo "CONFIG_CURL=m" >> $config_host_mak
6295 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
6296 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
6298 if test "$brlapi" = "yes" ; then
6299 echo "CONFIG_BRLAPI=y" >> $config_host_mak
6300 echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
6302 if test "$bluez" = "yes" ; then
6303 echo "CONFIG_BLUEZ=y" >> $config_host_mak
6304 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
6306 if test "$glib_subprocess" = "yes" ; then
6307 echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak
6309 if test "$gtk" = "yes" ; then
6310 echo "CONFIG_GTK=m" >> $config_host_mak
6311 echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
6312 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
6313 echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
6314 if test "$gtk_gl" = "yes" ; then
6315 echo "CONFIG_GTK_GL=y" >> $config_host_mak
6318 echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
6319 if test "$gnutls" = "yes" ; then
6320 echo "CONFIG_GNUTLS=y" >> $config_host_mak
6322 if test "$gnutls_rnd" = "yes" ; then
6323 echo "CONFIG_GNUTLS_RND=y" >> $config_host_mak
6325 if test "$gcrypt" = "yes" ; then
6326 echo "CONFIG_GCRYPT=y" >> $config_host_mak
6327 if test "$gcrypt_hmac" = "yes" ; then
6328 echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak
6330 if test "$gcrypt_kdf" = "yes" ; then
6331 echo "CONFIG_GCRYPT_KDF=y" >> $config_host_mak
6334 if test "$nettle" = "yes" ; then
6335 echo "CONFIG_NETTLE=y" >> $config_host_mak
6336 echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak
6337 if test "$nettle_kdf" = "yes" ; then
6338 echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak
6341 if test "$tasn1" = "yes" ; then
6342 echo "CONFIG_TASN1=y" >> $config_host_mak
6344 if test "$have_ifaddrs_h" = "yes" ; then
6345 echo "HAVE_IFADDRS_H=y" >> $config_host_mak
6347 if test "$have_broken_size_max" = "yes" ; then
6348 echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
6351 # Work around a system header bug with some kernel/XFS header
6352 # versions where they both try to define 'struct fsxattr':
6353 # xfs headers will not try to redefine structs from linux headers
6354 # if this macro is set.
6355 if test "$have_fsxattr" = "yes" ; then
6356 echo "HAVE_FSXATTR=y" >> $config_host_mak
6358 if test "$have_copy_file_range" = "yes" ; then
6359 echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak
6361 if test "$vte" = "yes" ; then
6362 echo "CONFIG_VTE=y" >> $config_host_mak
6363 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
6364 echo "VTE_LIBS=$vte_libs" >> $config_host_mak
6366 if test "$virglrenderer" = "yes" ; then
6367 echo "CONFIG_VIRGL=y" >> $config_host_mak
6368 echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak
6369 echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak
6371 if test "$xen" = "yes" ; then
6372 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
6373 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
6374 if test "$xen_pv_domain_build" = "yes" ; then
6375 echo "CONFIG_XEN_PV_DOMAIN_BUILD=y" >> $config_host_mak
6378 if test "$linux_aio" = "yes" ; then
6379 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
6381 if test "$attr" = "yes" ; then
6382 echo "CONFIG_ATTR=y" >> $config_host_mak
6384 if test "$libattr" = "yes" ; then
6385 echo "CONFIG_LIBATTR=y" >> $config_host_mak
6387 if test "$virtfs" = "yes" ; then
6388 echo "CONFIG_VIRTFS=y" >> $config_host_mak
6390 if test "$mpath" = "yes" ; then
6391 echo "CONFIG_MPATH=y" >> $config_host_mak
6393 if test "$vhost_scsi" = "yes" ; then
6394 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
6396 if test "$vhost_net" = "yes" -a "$vhost_user" = "yes"; then
6397 echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
6399 if test "$vhost_crypto" = "yes" ; then
6400 echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
6402 if test "$vhost_vsock" = "yes" ; then
6403 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
6405 if test "$vhost_user" = "yes" ; then
6406 echo "CONFIG_VHOST_USER=y" >> $config_host_mak
6408 if test "$blobs" = "yes" ; then
6409 echo "INSTALL_BLOBS=yes" >> $config_host_mak
6411 if test "$iovec" = "yes" ; then
6412 echo "CONFIG_IOVEC=y" >> $config_host_mak
6414 if test "$preadv" = "yes" ; then
6415 echo "CONFIG_PREADV=y" >> $config_host_mak
6417 if test "$fdt" != "no" ; then
6418 echo "CONFIG_FDT=y" >> $config_host_mak
6420 if test "$membarrier" = "yes" ; then
6421 echo "CONFIG_MEMBARRIER=y" >> $config_host_mak
6423 if test "$signalfd" = "yes" ; then
6424 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
6426 if test "$tcg" = "yes"; then
6427 echo "CONFIG_TCG=y" >> $config_host_mak
6428 if test "$tcg_interpreter" = "yes" ; then
6429 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
6432 if test "$fdatasync" = "yes" ; then
6433 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
6435 if test "$madvise" = "yes" ; then
6436 echo "CONFIG_MADVISE=y" >> $config_host_mak
6438 if test "$posix_madvise" = "yes" ; then
6439 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
6441 if test "$posix_memalign" = "yes" ; then
6442 echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak
6445 if test "$spice" = "yes" ; then
6446 echo "CONFIG_SPICE=y" >> $config_host_mak
6449 if test "$smartcard" = "yes" ; then
6450 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
6451 echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak
6452 echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak
6455 if test "$libusb" = "yes" ; then
6456 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
6457 echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak
6458 echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak
6461 if test "$usb_redir" = "yes" ; then
6462 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
6463 echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak
6464 echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak
6467 if test "$opengl" = "yes" ; then
6468 echo "CONFIG_OPENGL=y" >> $config_host_mak
6469 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
6470 if test "$opengl_dmabuf" = "yes" ; then
6471 echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
6475 if test "$malloc_trim" = "yes" ; then
6476 echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak
6479 if test "$avx2_opt" = "yes" ; then
6480 echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
6483 if test "$lzo" = "yes" ; then
6484 echo "CONFIG_LZO=y" >> $config_host_mak
6487 if test "$snappy" = "yes" ; then
6488 echo "CONFIG_SNAPPY=y" >> $config_host_mak
6491 if test "$bzip2" = "yes" ; then
6492 echo "CONFIG_BZIP2=y" >> $config_host_mak
6493 echo "BZIP2_LIBS=-lbz2" >> $config_host_mak
6496 if test "$libiscsi" = "yes" ; then
6497 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
6498 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
6499 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
6502 if test "$libnfs" = "yes" ; then
6503 echo "CONFIG_LIBNFS=m" >> $config_host_mak
6504 echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
6507 if test "$seccomp" = "yes"; then
6508 echo "CONFIG_SECCOMP=y" >> $config_host_mak
6509 echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
6510 echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak
6513 # XXX: suppress that
6514 if [ "$bsd" = "yes" ] ; then
6515 echo "CONFIG_BSD=y" >> $config_host_mak
6518 if test "$localtime_r" = "yes" ; then
6519 echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
6521 if test "$qom_cast_debug" = "yes" ; then
6522 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
6524 if test "$rbd" = "yes" ; then
6525 echo "CONFIG_RBD=m" >> $config_host_mak
6526 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
6527 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
6530 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
6531 if test "$coroutine_pool" = "yes" ; then
6532 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
6533 else
6534 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
6537 if test "$debug_stack_usage" = "yes" ; then
6538 echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
6541 if test "$crypto_afalg" = "yes" ; then
6542 echo "CONFIG_AF_ALG=y" >> $config_host_mak
6545 if test "$open_by_handle_at" = "yes" ; then
6546 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
6549 if test "$linux_magic_h" = "yes" ; then
6550 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
6553 if test "$pragma_diagnostic_available" = "yes" ; then
6554 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
6557 if test "$valgrind_h" = "yes" ; then
6558 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
6561 if test "$have_asan_iface_fiber" = "yes" ; then
6562 echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak
6565 if test "$has_environ" = "yes" ; then
6566 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
6569 if test "$cpuid_h" = "yes" ; then
6570 echo "CONFIG_CPUID_H=y" >> $config_host_mak
6573 if test "$int128" = "yes" ; then
6574 echo "CONFIG_INT128=y" >> $config_host_mak
6577 if test "$atomic128" = "yes" ; then
6578 echo "CONFIG_ATOMIC128=y" >> $config_host_mak
6581 if test "$atomic64" = "yes" ; then
6582 echo "CONFIG_ATOMIC64=y" >> $config_host_mak
6585 if test "$vector16" = "yes" ; then
6586 echo "CONFIG_VECTOR16=y" >> $config_host_mak
6589 if test "$getauxval" = "yes" ; then
6590 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
6593 if test "$glusterfs" = "yes" ; then
6594 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
6595 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
6596 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
6599 if test "$glusterfs_xlator_opt" = "yes" ; then
6600 echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
6603 if test "$glusterfs_discard" = "yes" ; then
6604 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
6607 if test "$glusterfs_fallocate" = "yes" ; then
6608 echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
6611 if test "$glusterfs_zerofill" = "yes" ; then
6612 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
6615 if test "$libssh2" = "yes" ; then
6616 echo "CONFIG_LIBSSH2=m" >> $config_host_mak
6617 echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
6618 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
6621 if test "$live_block_migration" = "yes" ; then
6622 echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
6625 if test "$tpm" = "yes"; then
6626 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
6627 # TPM passthrough support?
6628 if test "$tpm_passthrough" = "yes"; then
6629 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
6631 # TPM emulator support?
6632 if test "$tpm_emulator" = "yes"; then
6633 echo "CONFIG_TPM_EMULATOR=y" >> $config_host_mak
6637 echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
6638 if have_backend "nop"; then
6639 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
6641 if have_backend "simple"; then
6642 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
6643 # Set the appropriate trace file.
6644 trace_file="\"$trace_file-\" FMT_pid"
6646 if have_backend "log"; then
6647 echo "CONFIG_TRACE_LOG=y" >> $config_host_mak
6649 if have_backend "ust"; then
6650 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
6652 if have_backend "dtrace"; then
6653 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
6654 if test "$trace_backend_stap" = "yes" ; then
6655 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
6658 if have_backend "ftrace"; then
6659 if test "$linux" = "yes" ; then
6660 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
6661 else
6662 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
6665 if have_backend "syslog"; then
6666 if test "$posix_syslog" = "yes" ; then
6667 echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak
6668 else
6669 feature_not_found "syslog(trace backend)" "syslog not available"
6672 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
6674 if test "$rdma" = "yes" ; then
6675 echo "CONFIG_RDMA=y" >> $config_host_mak
6676 echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
6679 if test "$have_rtnetlink" = "yes" ; then
6680 echo "CONFIG_RTNETLINK=y" >> $config_host_mak
6683 if test "$libxml2" = "yes" ; then
6684 echo "CONFIG_LIBXML2=y" >> $config_host_mak
6685 echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak
6686 echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak
6689 if test "$replication" = "yes" ; then
6690 echo "CONFIG_REPLICATION=y" >> $config_host_mak
6693 if test "$have_af_vsock" = "yes" ; then
6694 echo "CONFIG_AF_VSOCK=y" >> $config_host_mak
6697 if test "$have_sysmacros" = "yes" ; then
6698 echo "CONFIG_SYSMACROS=y" >> $config_host_mak
6701 if test "$have_static_assert" = "yes" ; then
6702 echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak
6705 if test "$have_utmpx" = "yes" ; then
6706 echo "HAVE_UTMPX=y" >> $config_host_mak
6709 if test "$ivshmem" = "yes" ; then
6710 echo "CONFIG_IVSHMEM=y" >> $config_host_mak
6712 if test "$capstone" != "no" ; then
6713 echo "CONFIG_CAPSTONE=y" >> $config_host_mak
6715 if test "$debug_mutex" = "yes" ; then
6716 echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak
6719 # Hold two types of flag:
6720 # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
6721 # a thread we have a handle to
6722 # CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
6723 # platform
6724 if test "$pthread_setname_np" = "yes" ; then
6725 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
6726 echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
6729 if test "$vxhs" = "yes" ; then
6730 echo "CONFIG_VXHS=y" >> $config_host_mak
6731 echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
6734 if test "$tcg_interpreter" = "yes"; then
6735 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
6736 elif test "$ARCH" = "sparc64" ; then
6737 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
6738 elif test "$ARCH" = "s390x" ; then
6739 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
6740 elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
6741 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
6742 elif test "$ARCH" = "ppc64" ; then
6743 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
6744 else
6745 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
6747 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg $QEMU_INCLUDES"
6749 echo "TOOLS=$tools" >> $config_host_mak
6750 echo "ROMS=$roms" >> $config_host_mak
6751 echo "MAKE=$make" >> $config_host_mak
6752 echo "INSTALL=$install" >> $config_host_mak
6753 echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
6754 echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
6755 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
6756 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
6757 echo "PYTHON=$python" >> $config_host_mak
6758 echo "CC=$cc" >> $config_host_mak
6759 if $iasl -h > /dev/null 2>&1; then
6760 echo "IASL=$iasl" >> $config_host_mak
6762 echo "HOST_CC=$host_cc" >> $config_host_mak
6763 echo "CXX=$cxx" >> $config_host_mak
6764 echo "OBJCC=$objcc" >> $config_host_mak
6765 echo "AR=$ar" >> $config_host_mak
6766 echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
6767 echo "AS=$as" >> $config_host_mak
6768 echo "CCAS=$ccas" >> $config_host_mak
6769 echo "CPP=$cpp" >> $config_host_mak
6770 echo "OBJCOPY=$objcopy" >> $config_host_mak
6771 echo "LD=$ld" >> $config_host_mak
6772 echo "RANLIB=$ranlib" >> $config_host_mak
6773 echo "NM=$nm" >> $config_host_mak
6774 echo "WINDRES=$windres" >> $config_host_mak
6775 echo "CFLAGS=$CFLAGS" >> $config_host_mak
6776 echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
6777 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
6778 echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
6779 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
6780 if test "$sparse" = "yes" ; then
6781 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
6782 echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak
6783 echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
6784 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
6785 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
6787 if test "$cross_prefix" != ""; then
6788 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
6789 else
6790 echo "AUTOCONF_HOST := " >> $config_host_mak
6792 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
6793 echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
6794 echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
6795 echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
6796 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
6797 echo "LIBS+=$LIBS" >> $config_host_mak
6798 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
6799 echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak
6800 echo "EXESUF=$EXESUF" >> $config_host_mak
6801 echo "DSOSUF=$DSOSUF" >> $config_host_mak
6802 echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
6803 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
6804 echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
6805 echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
6806 echo "POD2MAN=$POD2MAN" >> $config_host_mak
6807 echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
6808 if test "$gcov" = "yes" ; then
6809 echo "CONFIG_GCOV=y" >> $config_host_mak
6810 echo "GCOV=$gcov_tool" >> $config_host_mak
6813 if test "$docker" != "no"; then
6814 echo "HAVE_USER_DOCKER=y" >> $config_host_mak
6817 # use included Linux headers
6818 if test "$linux" = "yes" ; then
6819 mkdir -p linux-headers
6820 case "$cpu" in
6821 i386|x86_64|x32)
6822 linux_arch=x86
6824 ppcemb|ppc|ppc64)
6825 linux_arch=powerpc
6827 s390x)
6828 linux_arch=s390
6830 aarch64)
6831 linux_arch=arm64
6833 mips64)
6834 linux_arch=mips
6837 # For most CPUs the kernel architecture name and QEMU CPU name match.
6838 linux_arch="$cpu"
6840 esac
6841 # For non-KVM architectures we will not have asm headers
6842 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
6843 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
6847 for target in $target_list; do
6848 target_dir="$target"
6849 config_target_mak=$target_dir/config-target.mak
6850 target_name=$(echo $target | cut -d '-' -f 1)
6851 target_bigendian="no"
6853 case "$target_name" in
6854 armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
6855 target_bigendian=yes
6857 esac
6858 target_softmmu="no"
6859 target_user_only="no"
6860 target_linux_user="no"
6861 target_bsd_user="no"
6862 case "$target" in
6863 ${target_name}-softmmu)
6864 target_softmmu="yes"
6866 ${target_name}-linux-user)
6867 target_user_only="yes"
6868 target_linux_user="yes"
6870 ${target_name}-bsd-user)
6871 target_user_only="yes"
6872 target_bsd_user="yes"
6875 error_exit "Target '$target' not recognised"
6876 exit 1
6878 esac
6880 target_compiler=""
6881 target_compiler_static=""
6882 target_compiler_cflags=""
6884 mkdir -p $target_dir
6885 echo "# Automatically generated by configure - do not modify" > $config_target_mak
6887 bflt="no"
6888 mttcg="no"
6889 interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g")
6890 gdb_xml_files=""
6892 TARGET_ARCH="$target_name"
6893 TARGET_BASE_ARCH=""
6894 TARGET_ABI_DIR=""
6896 case "$target_name" in
6897 i386)
6898 gdb_xml_files="i386-32bit.xml i386-32bit-core.xml i386-32bit-sse.xml"
6899 target_compiler=$cross_cc_i386
6900 target_compiler_cflags=$cross_cc_ccflags_i386
6902 x86_64)
6903 TARGET_BASE_ARCH=i386
6904 gdb_xml_files="i386-64bit.xml i386-64bit-core.xml i386-64bit-sse.xml"
6905 target_compiler=$cross_cc_x86_64
6907 alpha)
6908 mttcg="yes"
6909 target_compiler=$cross_cc_alpha
6911 arm|armeb)
6912 TARGET_ARCH=arm
6913 bflt="yes"
6914 mttcg="yes"
6915 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
6916 target_compiler=$cross_cc_arm
6917 eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}"
6919 aarch64|aarch64_be)
6920 TARGET_ARCH=aarch64
6921 TARGET_BASE_ARCH=arm
6922 bflt="yes"
6923 mttcg="yes"
6924 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
6925 target_compiler=$cross_cc_aarch64
6926 eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}"
6928 cris)
6929 target_compiler=$cross_cc_cris
6931 hppa)
6932 mttcg="yes"
6933 target_compiler=$cross_cc_hppa
6935 lm32)
6936 target_compiler=$cross_cc_lm32
6938 m68k)
6939 bflt="yes"
6940 gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml"
6941 target_compiler=$cross_cc_m68k
6943 microblaze|microblazeel)
6944 TARGET_ARCH=microblaze
6945 bflt="yes"
6946 echo "TARGET_ABI32=y" >> $config_target_mak
6947 target_compiler=$cross_cc_microblaze
6949 mips|mipsel)
6950 TARGET_ARCH=mips
6951 target_compiler=$cross_cc_mips
6952 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
6954 mipsn32|mipsn32el)
6955 TARGET_ARCH=mips64
6956 TARGET_BASE_ARCH=mips
6957 target_compiler=$cross_cc_mipsn32
6958 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
6959 echo "TARGET_ABI32=y" >> $config_target_mak
6961 mips64|mips64el)
6962 TARGET_ARCH=mips64
6963 TARGET_BASE_ARCH=mips
6964 target_compiler=$cross_cc_mips64
6965 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
6967 moxie)
6968 target_compiler=$cross_cc_moxie
6970 nios2)
6971 target_compiler=$cross_cc_nios2
6973 or1k)
6974 target_compiler=$cross_cc_or1k
6975 TARGET_ARCH=openrisc
6976 TARGET_BASE_ARCH=openrisc
6978 ppc)
6979 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
6980 target_compiler=$cross_cc_powerpc
6982 ppcemb)
6983 TARGET_BASE_ARCH=ppc
6984 TARGET_ABI_DIR=ppc
6985 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
6986 target_compiler=$cross_cc_ppcemb
6988 ppc64)
6989 TARGET_BASE_ARCH=ppc
6990 TARGET_ABI_DIR=ppc
6991 mttcg=yes
6992 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6993 target_compiler=$cross_cc_ppc64
6995 ppc64le)
6996 TARGET_ARCH=ppc64
6997 TARGET_BASE_ARCH=ppc
6998 TARGET_ABI_DIR=ppc
6999 mttcg=yes
7000 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
7001 target_compiler=$cross_cc_ppc64le
7003 ppc64abi32)
7004 TARGET_ARCH=ppc64
7005 TARGET_BASE_ARCH=ppc
7006 TARGET_ABI_DIR=ppc
7007 echo "TARGET_ABI32=y" >> $config_target_mak
7008 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
7009 target_compiler=$cross_cc_ppc64abi32
7011 riscv32)
7012 TARGET_BASE_ARCH=riscv
7013 TARGET_ABI_DIR=riscv
7014 mttcg=yes
7015 target_compiler=$cross_cc_riscv32
7017 riscv64)
7018 TARGET_BASE_ARCH=riscv
7019 TARGET_ABI_DIR=riscv
7020 mttcg=yes
7021 target_compiler=$cross_cc_riscv64
7023 sh4|sh4eb)
7024 TARGET_ARCH=sh4
7025 bflt="yes"
7026 target_compiler=$cross_cc_sh4
7028 sparc)
7029 target_compiler=$cross_cc_sparc
7031 sparc64)
7032 TARGET_BASE_ARCH=sparc
7033 target_compiler=$cross_cc_sparc64
7035 sparc32plus)
7036 TARGET_ARCH=sparc64
7037 TARGET_BASE_ARCH=sparc
7038 TARGET_ABI_DIR=sparc
7039 target_compiler=$cross_cc_sparc32plus
7040 echo "TARGET_ABI32=y" >> $config_target_mak
7042 s390x)
7043 mttcg=yes
7044 gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml"
7045 target_compiler=$cross_cc_s390x
7047 tilegx)
7048 target_compiler=$cross_cc_tilegx
7050 tricore)
7051 target_compiler=$cross_cc_tricore
7053 unicore32)
7054 target_compiler=$cross_cc_unicore32
7056 xtensa|xtensaeb)
7057 TARGET_ARCH=xtensa
7058 mttcg="yes"
7059 target_compiler=$cross_cc_xtensa
7062 error_exit "Unsupported target CPU"
7064 esac
7065 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
7066 if [ "$TARGET_BASE_ARCH" = "" ]; then
7067 TARGET_BASE_ARCH=$TARGET_ARCH
7070 # Do we have a cross compiler for this target?
7071 if has $target_compiler; then
7073 write_c_skeleton
7075 if ! do_compiler "$target_compiler" $target_compiler_cflags -o $TMPE $TMPC -static ; then
7076 # For host systems we might get away with building without -static
7077 if ! do_compiler "$target_compiler" $target_compiler_cflags -o $TMPE $TMPC ; then
7078 target_compiler=""
7079 else
7080 enabled_cross_compilers="${enabled_cross_compilers} '${target_compiler}'"
7081 target_compiler_static="n"
7083 else
7084 enabled_cross_compilers="${enabled_cross_compilers} '${target_compiler}'"
7085 target_compiler_static="y"
7087 else
7088 target_compiler=""
7091 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
7093 upper() {
7094 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
7097 target_arch_name="$(upper $TARGET_ARCH)"
7098 echo "TARGET_$target_arch_name=y" >> $config_target_mak
7099 echo "TARGET_NAME=$target_name" >> $config_target_mak
7100 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
7101 if [ "$TARGET_ABI_DIR" = "" ]; then
7102 TARGET_ABI_DIR=$TARGET_ARCH
7104 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
7105 if [ "$HOST_VARIANT_DIR" != "" ]; then
7106 echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
7109 if supported_xen_target $target; then
7110 echo "CONFIG_XEN=y" >> $config_target_mak
7111 if test "$xen_pci_passthrough" = yes; then
7112 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
7115 if supported_kvm_target $target; then
7116 echo "CONFIG_KVM=y" >> $config_target_mak
7117 if test "$vhost_net" = "yes" ; then
7118 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
7119 if test "$vhost_user" = "yes" ; then
7120 echo "CONFIG_VHOST_USER_NET_TEST_$target_name=y" >> $config_host_mak
7124 if supported_hax_target $target; then
7125 echo "CONFIG_HAX=y" >> $config_target_mak
7127 if supported_hvf_target $target; then
7128 echo "CONFIG_HVF=y" >> $config_target_mak
7130 if supported_whpx_target $target; then
7131 echo "CONFIG_WHPX=y" >> $config_target_mak
7133 if test "$target_bigendian" = "yes" ; then
7134 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
7136 if test "$target_softmmu" = "yes" ; then
7137 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
7138 if test "$mttcg" = "yes" ; then
7139 echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak
7142 if test "$target_user_only" = "yes" ; then
7143 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
7144 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
7146 if test "$target_linux_user" = "yes" ; then
7147 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
7149 list=""
7150 if test ! -z "$gdb_xml_files" ; then
7151 for x in $gdb_xml_files; do
7152 list="$list $source_path/gdb-xml/$x"
7153 done
7154 echo "TARGET_XML_FILES=$list" >> $config_target_mak
7157 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
7158 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
7160 if test "$target_bsd_user" = "yes" ; then
7161 echo "CONFIG_BSD_USER=y" >> $config_target_mak
7164 if test -n "$target_compiler"; then
7165 echo "CROSS_CC_GUEST=\"$target_compiler\"" >> $config_target_mak
7167 if test -n "$target_compiler_static"; then
7168 echo "CROSS_CC_GUEST_STATIC=$target_compiler_static" >> $config_target_mak
7171 if test -n "$target_compiler_cflags"; then
7172 echo "CROSS_CC_GUEST_CFLAGS=$target_compiler_cflags" >> $config_target_mak
7177 # generate QEMU_CFLAGS/LDFLAGS for targets
7179 cflags=""
7180 ldflags=""
7182 disas_config() {
7183 echo "CONFIG_${1}_DIS=y" >> $config_target_mak
7184 echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak
7187 for i in $ARCH $TARGET_BASE_ARCH ; do
7188 case "$i" in
7189 alpha)
7190 disas_config "ALPHA"
7192 aarch64)
7193 if test -n "${cxx}"; then
7194 disas_config "ARM_A64"
7197 arm)
7198 disas_config "ARM"
7199 if test -n "${cxx}"; then
7200 disas_config "ARM_A64"
7203 cris)
7204 disas_config "CRIS"
7206 hppa)
7207 disas_config "HPPA"
7209 i386|x86_64|x32)
7210 disas_config "I386"
7212 lm32)
7213 disas_config "LM32"
7215 m68k)
7216 disas_config "M68K"
7218 microblaze*)
7219 disas_config "MICROBLAZE"
7221 mips*)
7222 disas_config "MIPS"
7224 moxie*)
7225 disas_config "MOXIE"
7227 nios2)
7228 disas_config "NIOS2"
7230 or1k)
7231 disas_config "OPENRISC"
7233 ppc*)
7234 disas_config "PPC"
7236 riscv)
7237 disas_config "RISCV"
7239 s390*)
7240 disas_config "S390"
7242 sh4)
7243 disas_config "SH4"
7245 sparc*)
7246 disas_config "SPARC"
7248 xtensa*)
7249 disas_config "XTENSA"
7251 esac
7252 done
7253 if test "$tcg_interpreter" = "yes" ; then
7254 disas_config "TCI"
7257 case "$ARCH" in
7258 alpha)
7259 # Ensure there's only a single GP
7260 cflags="-msmall-data $cflags"
7262 esac
7264 if test "$gprof" = "yes" ; then
7265 echo "TARGET_GPROF=yes" >> $config_target_mak
7266 if test "$target_linux_user" = "yes" ; then
7267 cflags="-p $cflags"
7268 ldflags="-p $ldflags"
7270 if test "$target_softmmu" = "yes" ; then
7271 ldflags="-p $ldflags"
7272 echo "GPROF_CFLAGS=-p" >> $config_target_mak
7276 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
7277 ldflags="$ldflags $textseg_ldflags"
7280 # Newer kernels on s390 check for an S390_PGSTE program header and
7281 # enable the pgste page table extensions in that case. This makes
7282 # the vm.allocate_pgste sysctl unnecessary. We enable this program
7283 # header if
7284 # - we build on s390x
7285 # - we build the system emulation for s390x (qemu-system-s390x)
7286 # - KVM is enabled
7287 # - the linker supports --s390-pgste
7288 if test "$TARGET_ARCH" = "s390x" -a "$target_softmmu" = "yes" -a "$ARCH" = "s390x" -a "$kvm" = "yes"; then
7289 if ld_has --s390-pgste ; then
7290 ldflags="-Wl,--s390-pgste $ldflags"
7294 echo "LDFLAGS+=$ldflags" >> $config_target_mak
7295 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
7297 done # for target in $targets
7299 if test -n "$enabled_cross_compilers"; then
7300 echo
7301 echo "NOTE: cross-compilers enabled: $enabled_cross_compilers"
7304 if [ "$fdt" = "git" ]; then
7305 echo "config-host.h: subdir-dtc" >> $config_host_mak
7307 if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then
7308 echo "config-host.h: subdir-capstone" >> $config_host_mak
7310 if test -n "$LIBCAPSTONE"; then
7311 echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak
7314 if test "$numa" = "yes"; then
7315 echo "CONFIG_NUMA=y" >> $config_host_mak
7318 if test "$ccache_cpp2" = "yes"; then
7319 echo "export CCACHE_CPP2=y" >> $config_host_mak
7322 # build tree in object directory in case the source is not in the current directory
7323 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm"
7324 DIRS="$DIRS docs docs/interop fsdev scsi"
7325 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
7326 DIRS="$DIRS roms/seabios roms/vgabios"
7327 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
7328 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
7329 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
7330 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
7331 FILES="$FILES pc-bios/spapr-rtas/Makefile"
7332 FILES="$FILES pc-bios/s390-ccw/Makefile"
7333 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
7334 FILES="$FILES pc-bios/qemu-icon.bmp"
7335 FILES="$FILES .gdbinit scripts" # scripts needed by relative path in .gdbinit
7336 for bios_file in \
7337 $source_path/pc-bios/*.bin \
7338 $source_path/pc-bios/*.lid \
7339 $source_path/pc-bios/*.aml \
7340 $source_path/pc-bios/*.rom \
7341 $source_path/pc-bios/*.dtb \
7342 $source_path/pc-bios/*.img \
7343 $source_path/pc-bios/openbios-* \
7344 $source_path/pc-bios/u-boot.* \
7345 $source_path/pc-bios/palcode-*
7347 FILES="$FILES pc-bios/$(basename $bios_file)"
7348 done
7349 for test_file in $(find $source_path/tests/acpi-test-data -type f)
7351 FILES="$FILES tests/acpi-test-data$(echo $test_file | sed -e 's/.*acpi-test-data//')"
7352 done
7353 mkdir -p $DIRS
7354 for f in $FILES ; do
7355 if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
7356 symlink "$source_path/$f" "$f"
7358 done
7360 # temporary config to build submodules
7361 for rom in seabios vgabios ; do
7362 config_mak=roms/$rom/config.mak
7363 echo "# Automatically generated by configure - do not modify" > $config_mak
7364 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
7365 echo "AS=$as" >> $config_mak
7366 echo "CCAS=$ccas" >> $config_mak
7367 echo "CC=$cc" >> $config_mak
7368 echo "BCC=bcc" >> $config_mak
7369 echo "CPP=$cpp" >> $config_mak
7370 echo "OBJCOPY=objcopy" >> $config_mak
7371 echo "IASL=$iasl" >> $config_mak
7372 echo "LD=$ld" >> $config_mak
7373 echo "RANLIB=$ranlib" >> $config_mak
7374 done
7376 # set up tests data directory
7377 for tests_subdir in acceptance data; do
7378 if [ ! -e tests/$tests_subdir ]; then
7379 symlink "$source_path/tests/$tests_subdir" tests/$tests_subdir
7381 done
7383 # set up qemu-iotests in this build directory
7384 iotests_common_env="tests/qemu-iotests/common.env"
7385 iotests_check="tests/qemu-iotests/check"
7387 echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
7388 echo >> "$iotests_common_env"
7389 echo "export PYTHON='$python'" >> "$iotests_common_env"
7391 if [ ! -e "$iotests_check" ]; then
7392 symlink "$source_path/$iotests_check" "$iotests_check"
7395 # Save the configure command line for later reuse.
7396 cat <<EOD >config.status
7397 #!/bin/sh
7398 # Generated by configure.
7399 # Run this file to recreate the current configuration.
7400 # Compiler output produced by configure, useful for debugging
7401 # configure, is in config.log if it exists.
7403 printf "exec" >>config.status
7404 printf " '%s'" "$0" "$@" >>config.status
7405 echo ' "$@"' >>config.status
7406 chmod +x config.status
7408 rm -r "$TMPDIR1"