Merge remote-tracking branch 'remotes/berrange/tags/pull-build-2017-11-07-1' into...
[qemu.git] / configure
bloba6055c0710a7b2e13e53a2c60b2fbb15ea230f09
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 echo $compiler "$@" >> config.log
64 $compiler "$@" >> config.log 2>&1 || return $?
65 # Test passed. If this is an --enable-werror build, rerun
66 # the test with -Werror and bail out if it fails. This
67 # makes warning-generating-errors in configure test code
68 # obvious to developers.
69 if test "$werror" != "yes"; then
70 return 0
72 # Don't bother rerunning the compile if we were already using -Werror
73 case "$*" in
74 *-Werror*)
75 return 0
77 esac
78 echo $compiler -Werror "$@" >> config.log
79 $compiler -Werror "$@" >> config.log 2>&1 && return $?
80 error_exit "configure test passed without -Werror but failed with -Werror." \
81 "This is probably a bug in the configure script. The failing command" \
82 "will be at the bottom of config.log." \
83 "You can run configure with --disable-werror to bypass this check."
86 do_cc() {
87 do_compiler "$cc" "$@"
90 do_cxx() {
91 do_compiler "$cxx" "$@"
94 update_cxxflags() {
95 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
96 # options which some versions of GCC's C++ compiler complain about
97 # because they only make sense for C programs.
98 QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS"
100 for arg in $QEMU_CFLAGS; do
101 case $arg in
102 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
103 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
106 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
108 esac
109 done
112 compile_object() {
113 local_cflags="$1"
114 do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
117 compile_prog() {
118 local_cflags="$1"
119 local_ldflags="$2"
120 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
123 # symbolically link $1 to $2. Portable version of "ln -sf".
124 symlink() {
125 rm -rf "$2"
126 mkdir -p "$(dirname "$2")"
127 ln -s "$1" "$2"
130 # check whether a command is available to this shell (may be either an
131 # executable or a builtin)
132 has() {
133 type "$1" >/dev/null 2>&1
136 # search for an executable in PATH
137 path_of() {
138 local_command="$1"
139 local_ifs="$IFS"
140 local_dir=""
142 # pathname has a dir component?
143 if [ "${local_command#*/}" != "$local_command" ]; then
144 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
145 echo "$local_command"
146 return 0
149 if [ -z "$local_command" ]; then
150 return 1
153 IFS=:
154 for local_dir in $PATH; do
155 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
156 echo "$local_dir/$local_command"
157 IFS="${local_ifs:-$(printf ' \t\n')}"
158 return 0
160 done
161 # not found
162 IFS="${local_ifs:-$(printf ' \t\n')}"
163 return 1
166 have_backend () {
167 echo "$trace_backends" | grep "$1" >/dev/null
170 glob() {
171 eval test -z '"${1#'"$2"'}"'
174 supported_hax_target() {
175 test "$hax" = "yes" || return 1
176 glob "$1" "*-softmmu" || return 1
177 case "${1%-softmmu}" in
178 i386|x86_64)
179 return 0
181 esac
182 return 1
185 supported_kvm_target() {
186 test "$kvm" = "yes" || return 1
187 glob "$1" "*-softmmu" || return 1
188 case "${1%-softmmu}:$cpu" in
189 arm:arm | aarch64:aarch64 | \
190 i386:i386 | i386:x86_64 | i386:x32 | \
191 x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \
192 mips:mips | mipsel:mips | \
193 ppc:ppc | ppcemb:ppc | ppc64:ppc | \
194 ppc:ppc64 | ppcemb:ppc64 | ppc64:ppc64 | \
195 s390x:s390x)
196 return 0
198 esac
199 return 1
202 supported_xen_target() {
203 test "$xen" = "yes" || return 1
204 glob "$1" "*-softmmu" || return 1
205 # Only i386 and x86_64 provide the xenpv machine.
206 case "${1%-softmmu}" in
207 i386|x86_64)
208 return 0
210 esac
211 return 1
214 supported_target() {
215 case "$1" in
216 *-softmmu)
218 *-linux-user)
219 if test "$linux" != "yes"; then
220 print_error "Target '$target' is only available on a Linux host"
221 return 1
224 *-bsd-user)
225 if test "$bsd" != "yes"; then
226 print_error "Target '$target' is only available on a BSD host"
227 return 1
231 print_error "Invalid target name '$target'"
232 return 1
234 esac
235 test "$tcg" = "yes" && return 0
236 supported_kvm_target "$1" && return 0
237 supported_xen_target "$1" && return 0
238 supported_hax_target "$1" && return 0
239 print_error "TCG disabled, but hardware accelerator not available for '$target'"
240 return 1
244 ld_has() {
245 $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
248 # default parameters
249 source_path=$(dirname "$0")
250 cpu=""
251 iasl="iasl"
252 interp_prefix="/usr/gnemul/qemu-%M"
253 static="no"
254 cross_prefix=""
255 audio_drv_list=""
256 block_drv_rw_whitelist=""
257 block_drv_ro_whitelist=""
258 host_cc="cc"
259 libs_softmmu=""
260 libs_tools=""
261 audio_pt_int=""
262 audio_win_int=""
263 cc_i386=i386-pc-linux-gnu-gcc
264 libs_qga=""
265 debug_info="yes"
266 stack_protector=""
268 if test -e "$source_path/.git"
269 then
270 git_update=yes
271 git_submodules="ui/keycodemapdb"
272 else
273 git_update=no
274 git_submodules=""
276 git="git"
278 # Don't accept a target_list environment variable.
279 unset target_list
281 # Default value for a variable defining feature "foo".
282 # * foo="no" feature will only be used if --enable-foo arg is given
283 # * foo="" feature will be searched for, and if found, will be used
284 # unless --disable-foo is given
285 # * foo="yes" this value will only be set by --enable-foo flag.
286 # feature will searched for,
287 # if not found, configure exits with error
289 # Always add --enable-foo and --disable-foo command line args.
290 # Distributions want to ensure that several features are compiled in, and it
291 # is impossible without a --enable-foo that exits if a feature is not found.
293 bluez=""
294 brlapi=""
295 curl=""
296 curses=""
297 docs=""
298 fdt=""
299 netmap="no"
300 sdl=""
301 sdlabi=""
302 virtfs=""
303 mpath=""
304 vnc="yes"
305 sparse="no"
306 vde=""
307 vnc_sasl=""
308 vnc_jpeg=""
309 vnc_png=""
310 xkbcommon=""
311 xen=""
312 xen_ctrl_version=""
313 xen_pv_domain_build="no"
314 xen_pci_passthrough=""
315 linux_aio=""
316 cap_ng=""
317 attr=""
318 libattr=""
319 xfs=""
320 tcg="yes"
322 vhost_net="no"
323 vhost_scsi="no"
324 vhost_vsock="no"
325 vhost_user=""
326 kvm="no"
327 hax="no"
328 rdma=""
329 gprof="no"
330 debug_tcg="no"
331 debug="no"
332 fortify_source=""
333 strip_opt="yes"
334 tcg_interpreter="no"
335 bigendian="no"
336 mingw32="no"
337 gcov="no"
338 gcov_tool="gcov"
339 EXESUF=""
340 DSOSUF=".so"
341 LDFLAGS_SHARED="-shared"
342 modules="no"
343 prefix="/usr/local"
344 mandir="\${prefix}/share/man"
345 datadir="\${prefix}/share"
346 firmwarepath="\${prefix}/share/qemu-firmware"
347 qemu_docdir="\${prefix}/share/doc/qemu"
348 bindir="\${prefix}/bin"
349 libdir="\${prefix}/lib"
350 libexecdir="\${prefix}/libexec"
351 includedir="\${prefix}/include"
352 sysconfdir="\${prefix}/etc"
353 local_statedir="\${prefix}/var"
354 confsuffix="/qemu"
355 slirp="yes"
356 oss_lib=""
357 bsd="no"
358 linux="no"
359 solaris="no"
360 profiler="no"
361 cocoa="no"
362 softmmu="yes"
363 linux_user="no"
364 bsd_user="no"
365 blobs="yes"
366 pkgversion=""
367 pie=""
368 qom_cast_debug="yes"
369 trace_backends="log"
370 trace_file="trace"
371 spice=""
372 rbd=""
373 smartcard=""
374 libusb=""
375 usb_redir=""
376 opengl=""
377 opengl_dmabuf="no"
378 cpuid_h="no"
379 avx2_opt="no"
380 zlib="yes"
381 capstone=""
382 lzo=""
383 snappy=""
384 bzip2=""
385 guest_agent=""
386 guest_agent_with_vss="no"
387 guest_agent_ntddscsi="no"
388 guest_agent_msi=""
389 vss_win32_sdk=""
390 win_sdk="no"
391 want_tools="yes"
392 libiscsi=""
393 libnfs=""
394 coroutine=""
395 coroutine_pool=""
396 debug_stack_usage="no"
397 crypto_afalg="no"
398 seccomp=""
399 glusterfs=""
400 glusterfs_xlator_opt="no"
401 glusterfs_discard="no"
402 glusterfs_fallocate="no"
403 glusterfs_zerofill="no"
404 gtk=""
405 gtkabi=""
406 gtk_gl="no"
407 tls_priority="NORMAL"
408 gnutls=""
409 gnutls_rnd=""
410 nettle=""
411 nettle_kdf="no"
412 gcrypt=""
413 gcrypt_hmac="no"
414 gcrypt_kdf="no"
415 vte=""
416 virglrenderer=""
417 tpm="yes"
418 libssh2=""
419 live_block_migration="yes"
420 numa=""
421 tcmalloc="no"
422 jemalloc="no"
423 replication="yes"
424 vxhs=""
426 supported_cpu="no"
427 supported_os="no"
428 bogus_os="no"
430 # parse CC options first
431 for opt do
432 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
433 case "$opt" in
434 --cross-prefix=*) cross_prefix="$optarg"
436 --cc=*) CC="$optarg"
438 --cxx=*) CXX="$optarg"
440 --source-path=*) source_path="$optarg"
442 --cpu=*) cpu="$optarg"
444 --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
445 EXTRA_CFLAGS="$optarg"
447 --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
448 EXTRA_CXXFLAGS="$optarg"
450 --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
451 EXTRA_LDFLAGS="$optarg"
453 --enable-debug-info) debug_info="yes"
455 --disable-debug-info) debug_info="no"
457 esac
458 done
459 # OS specific
460 # Using uname is really, really broken. Once we have the right set of checks
461 # we can eliminate its usage altogether.
463 # Preferred compiler:
464 # ${CC} (if set)
465 # ${cross_prefix}gcc (if cross-prefix specified)
466 # system compiler
467 if test -z "${CC}${cross_prefix}"; then
468 cc="$host_cc"
469 else
470 cc="${CC-${cross_prefix}gcc}"
473 if test -z "${CXX}${cross_prefix}"; then
474 cxx="c++"
475 else
476 cxx="${CXX-${cross_prefix}g++}"
479 ar="${AR-${cross_prefix}ar}"
480 as="${AS-${cross_prefix}as}"
481 ccas="${CCAS-$cc}"
482 cpp="${CPP-$cc -E}"
483 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
484 ld="${LD-${cross_prefix}ld}"
485 nm="${NM-${cross_prefix}nm}"
486 strip="${STRIP-${cross_prefix}strip}"
487 windres="${WINDRES-${cross_prefix}windres}"
488 pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
489 query_pkg_config() {
490 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
492 pkg_config=query_pkg_config
493 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
494 sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
496 # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
497 ARFLAGS="${ARFLAGS-rv}"
499 # default flags for all hosts
500 # We use -fwrapv to tell the compiler that we require a C dialect where
501 # left shift of signed integers is well defined and has the expected
502 # 2s-complement style results. (Both clang and gcc agree that it
503 # provides these semantics.)
504 QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
505 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
506 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
507 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
508 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/accel/tcg -I\$(SRC_PATH)/include"
509 if test "$debug_info" = "yes"; then
510 CFLAGS="-g $CFLAGS"
511 LDFLAGS="-g $LDFLAGS"
514 # make source path absolute
515 source_path=$(cd "$source_path"; pwd)
517 # running configure in the source tree?
518 # we know that's the case if configure is there.
519 if test -f "./configure"; then
520 pwd_is_source_path="y"
521 else
522 pwd_is_source_path="n"
525 check_define() {
526 cat > $TMPC <<EOF
527 #if !defined($1)
528 #error $1 not defined
529 #endif
530 int main(void) { return 0; }
532 compile_object
535 check_include() {
536 cat > $TMPC <<EOF
537 #include <$1>
538 int main(void) { return 0; }
540 compile_object
543 write_c_skeleton() {
544 cat > $TMPC <<EOF
545 int main(void) { return 0; }
549 if check_define __linux__ ; then
550 targetos="Linux"
551 elif check_define _WIN32 ; then
552 targetos='MINGW32'
553 elif check_define __OpenBSD__ ; then
554 targetos='OpenBSD'
555 elif check_define __sun__ ; then
556 targetos='SunOS'
557 elif check_define __HAIKU__ ; then
558 targetos='Haiku'
559 elif check_define __FreeBSD__ ; then
560 targetos='FreeBSD'
561 elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then
562 targetos='GNU/kFreeBSD'
563 elif check_define __DragonFly__ ; then
564 targetos='DragonFly'
565 elif check_define __NetBSD__; then
566 targetos='NetBSD'
567 elif check_define __APPLE__; then
568 targetos='Darwin'
569 else
570 # This is a fatal error, but don't report it yet, because we
571 # might be going to just print the --help text, or it might
572 # be the result of a missing compiler.
573 targetos='bogus'
574 bogus_os='yes'
577 # Some host OSes need non-standard checks for which CPU to use.
578 # Note that these checks are broken for cross-compilation: if you're
579 # cross-compiling to one of these OSes then you'll need to specify
580 # the correct CPU with the --cpu option.
581 case $targetos in
582 Darwin)
583 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
584 # run 64-bit userspace code.
585 # If the user didn't specify a CPU explicitly and the kernel says this is
586 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
587 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
588 cpu="x86_64"
591 SunOS)
592 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
593 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
594 cpu="x86_64"
596 esac
598 if test ! -z "$cpu" ; then
599 # command line argument
601 elif check_define __i386__ ; then
602 cpu="i386"
603 elif check_define __x86_64__ ; then
604 if check_define __ILP32__ ; then
605 cpu="x32"
606 else
607 cpu="x86_64"
609 elif check_define __sparc__ ; then
610 if check_define __arch64__ ; then
611 cpu="sparc64"
612 else
613 cpu="sparc"
615 elif check_define _ARCH_PPC ; then
616 if check_define _ARCH_PPC64 ; then
617 cpu="ppc64"
618 else
619 cpu="ppc"
621 elif check_define __mips__ ; then
622 cpu="mips"
623 elif check_define __ia64__ ; then
624 cpu="ia64"
625 elif check_define __s390__ ; then
626 if check_define __s390x__ ; then
627 cpu="s390x"
628 else
629 cpu="s390"
631 elif check_define __arm__ ; then
632 cpu="arm"
633 elif check_define __aarch64__ ; then
634 cpu="aarch64"
635 else
636 cpu=$(uname -m)
639 ARCH=
640 # Normalise host CPU name and set ARCH.
641 # Note that this case should only have supported host CPUs, not guests.
642 case "$cpu" in
643 ppc|ppc64|s390|s390x|sparc64|x32)
644 cpu="$cpu"
645 supported_cpu="yes"
647 i386|i486|i586|i686|i86pc|BePC)
648 cpu="i386"
649 supported_cpu="yes"
651 x86_64|amd64)
652 cpu="x86_64"
653 supported_cpu="yes"
655 armv*b|armv*l|arm)
656 cpu="arm"
657 supported_cpu="yes"
659 aarch64)
660 cpu="aarch64"
661 supported_cpu="yes"
663 mips*)
664 cpu="mips"
665 supported_cpu="yes"
667 sparc|sun4[cdmuv])
668 cpu="sparc"
669 supported_cpu="yes"
672 # This will result in either an error or falling back to TCI later
673 ARCH=unknown
675 esac
676 if test -z "$ARCH"; then
677 ARCH="$cpu"
680 # OS specific
682 # host *BSD for user mode
683 HOST_VARIANT_DIR=""
685 case $targetos in
686 MINGW32*)
687 mingw32="yes"
688 hax="yes"
689 audio_possible_drivers="dsound sdl"
690 if check_include dsound.h; then
691 audio_drv_list="dsound"
692 else
693 audio_drv_list=""
695 supported_os="yes"
697 GNU/kFreeBSD)
698 bsd="yes"
699 audio_drv_list="oss"
700 audio_possible_drivers="oss sdl pa"
702 FreeBSD)
703 bsd="yes"
704 make="${MAKE-gmake}"
705 audio_drv_list="oss"
706 audio_possible_drivers="oss sdl pa"
707 # needed for kinfo_getvmmap(3) in libutil.h
708 LIBS="-lutil $LIBS"
709 # needed for kinfo_getproc
710 libs_qga="-lutil $libs_qga"
711 netmap="" # enable netmap autodetect
712 HOST_VARIANT_DIR="freebsd"
713 supported_os="yes"
715 DragonFly)
716 bsd="yes"
717 make="${MAKE-gmake}"
718 audio_drv_list="oss"
719 audio_possible_drivers="oss sdl pa"
720 HOST_VARIANT_DIR="dragonfly"
722 NetBSD)
723 bsd="yes"
724 make="${MAKE-gmake}"
725 audio_drv_list="oss"
726 audio_possible_drivers="oss sdl"
727 oss_lib="-lossaudio"
728 HOST_VARIANT_DIR="netbsd"
729 supported_os="yes"
731 OpenBSD)
732 bsd="yes"
733 make="${MAKE-gmake}"
734 audio_drv_list="sdl"
735 audio_possible_drivers="sdl"
736 HOST_VARIANT_DIR="openbsd"
738 Darwin)
739 bsd="yes"
740 darwin="yes"
741 hax="yes"
742 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
743 if [ "$cpu" = "x86_64" ] ; then
744 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
745 LDFLAGS="-arch x86_64 $LDFLAGS"
747 cocoa="yes"
748 audio_drv_list="coreaudio"
749 audio_possible_drivers="coreaudio sdl"
750 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
751 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
752 # Disable attempts to use ObjectiveC features in os/object.h since they
753 # won't work when we're compiling with gcc as a C compiler.
754 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
755 HOST_VARIANT_DIR="darwin"
756 supported_os="yes"
758 SunOS)
759 solaris="yes"
760 make="${MAKE-gmake}"
761 install="${INSTALL-ginstall}"
762 smbd="${SMBD-/usr/sfw/sbin/smbd}"
763 if test -f /usr/include/sys/soundcard.h ; then
764 audio_drv_list="oss"
766 audio_possible_drivers="oss sdl"
767 # needed for CMSG_ macros in sys/socket.h
768 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
769 # needed for TIOCWIN* defines in termios.h
770 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
771 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
772 solarisnetlibs="-lsocket -lnsl -lresolv"
773 LIBS="$solarisnetlibs $LIBS"
774 libs_qga="$solarisnetlibs $libs_qga"
776 Haiku)
777 haiku="yes"
778 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
779 LIBS="-lposix_error_mapper -lnetwork $LIBS"
781 Linux)
782 audio_drv_list="oss"
783 audio_possible_drivers="oss alsa sdl pa"
784 linux="yes"
785 linux_user="yes"
786 kvm="yes"
787 vhost_net="yes"
788 vhost_scsi="yes"
789 vhost_vsock="yes"
790 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
791 supported_os="yes"
793 esac
795 if [ "$bsd" = "yes" ] ; then
796 if [ "$darwin" != "yes" ] ; then
797 bsd_user="yes"
801 : ${make=${MAKE-make}}
802 : ${install=${INSTALL-install}}
803 : ${python=${PYTHON-python}}
804 : ${smbd=${SMBD-/usr/sbin/smbd}}
806 # Default objcc to clang if available, otherwise use CC
807 if has clang; then
808 objcc=clang
809 else
810 objcc="$cc"
813 if test "$mingw32" = "yes" ; then
814 EXESUF=".exe"
815 DSOSUF=".dll"
816 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
817 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
818 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
819 # MinGW needs -mthreads for TLS and macro _MT.
820 QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
821 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
822 write_c_skeleton;
823 if compile_prog "" "-liberty" ; then
824 LIBS="-liberty $LIBS"
826 prefix="c:/Program Files/QEMU"
827 mandir="\${prefix}"
828 datadir="\${prefix}"
829 qemu_docdir="\${prefix}"
830 bindir="\${prefix}"
831 sysconfdir="\${prefix}"
832 local_statedir=
833 confsuffix=""
834 libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga"
837 werror=""
839 for opt do
840 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
841 case "$opt" in
842 --help|-h) show_help=yes
844 --version|-V) exec cat $source_path/VERSION
846 --prefix=*) prefix="$optarg"
848 --interp-prefix=*) interp_prefix="$optarg"
850 --source-path=*)
852 --cross-prefix=*)
854 --cc=*)
856 --host-cc=*) host_cc="$optarg"
858 --cxx=*)
860 --iasl=*) iasl="$optarg"
862 --objcc=*) objcc="$optarg"
864 --make=*) make="$optarg"
866 --install=*) install="$optarg"
868 --python=*) python="$optarg"
870 --gcov=*) gcov_tool="$optarg"
872 --smbd=*) smbd="$optarg"
874 --extra-cflags=*)
876 --extra-cxxflags=*)
878 --extra-ldflags=*)
880 --enable-debug-info)
882 --disable-debug-info)
884 --enable-modules)
885 modules="yes"
887 --disable-modules)
888 modules="no"
890 --cpu=*)
892 --target-list=*) target_list="$optarg"
894 --enable-trace-backends=*) trace_backends="$optarg"
896 # XXX: backwards compatibility
897 --enable-trace-backend=*) trace_backends="$optarg"
899 --with-trace-file=*) trace_file="$optarg"
901 --enable-gprof) gprof="yes"
903 --enable-gcov) gcov="yes"
905 --static)
906 static="yes"
907 LDFLAGS="-static $LDFLAGS"
908 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
910 --mandir=*) mandir="$optarg"
912 --bindir=*) bindir="$optarg"
914 --libdir=*) libdir="$optarg"
916 --libexecdir=*) libexecdir="$optarg"
918 --includedir=*) includedir="$optarg"
920 --datadir=*) datadir="$optarg"
922 --with-confsuffix=*) confsuffix="$optarg"
924 --docdir=*) qemu_docdir="$optarg"
926 --sysconfdir=*) sysconfdir="$optarg"
928 --localstatedir=*) local_statedir="$optarg"
930 --firmwarepath=*) firmwarepath="$optarg"
932 --sbindir=*|--sharedstatedir=*|\
933 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
934 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
935 # These switches are silently ignored, for compatibility with
936 # autoconf-generated configure scripts. This allows QEMU's
937 # configure to be used by RPM and similar macros that set
938 # lots of directory switches by default.
940 --disable-sdl) sdl="no"
942 --enable-sdl) sdl="yes"
944 --with-sdlabi=*) sdlabi="$optarg"
946 --disable-qom-cast-debug) qom_cast_debug="no"
948 --enable-qom-cast-debug) qom_cast_debug="yes"
950 --disable-virtfs) virtfs="no"
952 --enable-virtfs) virtfs="yes"
954 --disable-mpath) mpath="no"
956 --enable-mpath) mpath="yes"
958 --disable-vnc) vnc="no"
960 --enable-vnc) vnc="yes"
962 --oss-lib=*) oss_lib="$optarg"
964 --audio-drv-list=*) audio_drv_list="$optarg"
966 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
968 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
970 --enable-debug-tcg) debug_tcg="yes"
972 --disable-debug-tcg) debug_tcg="no"
974 --enable-debug)
975 # Enable debugging options that aren't excessively noisy
976 debug_tcg="yes"
977 debug="yes"
978 strip_opt="no"
979 fortify_source="no"
981 --enable-sparse) sparse="yes"
983 --disable-sparse) sparse="no"
985 --disable-strip) strip_opt="no"
987 --disable-vnc-sasl) vnc_sasl="no"
989 --enable-vnc-sasl) vnc_sasl="yes"
991 --disable-vnc-jpeg) vnc_jpeg="no"
993 --enable-vnc-jpeg) vnc_jpeg="yes"
995 --disable-vnc-png) vnc_png="no"
997 --enable-vnc-png) vnc_png="yes"
999 --disable-slirp) slirp="no"
1001 --disable-vde) vde="no"
1003 --enable-vde) vde="yes"
1005 --disable-netmap) netmap="no"
1007 --enable-netmap) netmap="yes"
1009 --disable-xen) xen="no"
1011 --enable-xen) xen="yes"
1013 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
1015 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
1017 --disable-xen-pv-domain-build) xen_pv_domain_build="no"
1019 --enable-xen-pv-domain-build) xen_pv_domain_build="yes"
1021 --disable-brlapi) brlapi="no"
1023 --enable-brlapi) brlapi="yes"
1025 --disable-bluez) bluez="no"
1027 --enable-bluez) bluez="yes"
1029 --disable-kvm) kvm="no"
1031 --enable-kvm) kvm="yes"
1033 --disable-hax) hax="no"
1035 --enable-hax) hax="yes"
1037 --disable-tcg-interpreter) tcg_interpreter="no"
1039 --enable-tcg-interpreter) tcg_interpreter="yes"
1041 --disable-cap-ng) cap_ng="no"
1043 --enable-cap-ng) cap_ng="yes"
1045 --disable-tcg) tcg="no"
1047 --enable-tcg) tcg="yes"
1049 --disable-spice) spice="no"
1051 --enable-spice) spice="yes"
1053 --disable-libiscsi) libiscsi="no"
1055 --enable-libiscsi) libiscsi="yes"
1057 --disable-libnfs) libnfs="no"
1059 --enable-libnfs) libnfs="yes"
1061 --enable-profiler) profiler="yes"
1063 --disable-cocoa) cocoa="no"
1065 --enable-cocoa)
1066 cocoa="yes" ;
1067 audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
1069 --disable-system) softmmu="no"
1071 --enable-system) softmmu="yes"
1073 --disable-user)
1074 linux_user="no" ;
1075 bsd_user="no" ;
1077 --enable-user) ;;
1078 --disable-linux-user) linux_user="no"
1080 --enable-linux-user) linux_user="yes"
1082 --disable-bsd-user) bsd_user="no"
1084 --enable-bsd-user) bsd_user="yes"
1086 --enable-pie) pie="yes"
1088 --disable-pie) pie="no"
1090 --enable-werror) werror="yes"
1092 --disable-werror) werror="no"
1094 --enable-stack-protector) stack_protector="yes"
1096 --disable-stack-protector) stack_protector="no"
1098 --disable-curses) curses="no"
1100 --enable-curses) curses="yes"
1102 --disable-curl) curl="no"
1104 --enable-curl) curl="yes"
1106 --disable-fdt) fdt="no"
1108 --enable-fdt) fdt="yes"
1110 --disable-linux-aio) linux_aio="no"
1112 --enable-linux-aio) linux_aio="yes"
1114 --disable-attr) attr="no"
1116 --enable-attr) attr="yes"
1118 --disable-blobs) blobs="no"
1120 --with-pkgversion=*) pkgversion=" ($optarg)"
1122 --with-coroutine=*) coroutine="$optarg"
1124 --disable-coroutine-pool) coroutine_pool="no"
1126 --enable-coroutine-pool) coroutine_pool="yes"
1128 --enable-debug-stack-usage) debug_stack_usage="yes"
1130 --enable-crypto-afalg) crypto_afalg="yes"
1132 --disable-crypto-afalg) crypto_afalg="no"
1134 --disable-docs) docs="no"
1136 --enable-docs) docs="yes"
1138 --disable-vhost-net) vhost_net="no"
1140 --enable-vhost-net) vhost_net="yes"
1142 --disable-vhost-scsi) vhost_scsi="no"
1144 --enable-vhost-scsi) vhost_scsi="yes"
1146 --disable-vhost-vsock) vhost_vsock="no"
1148 --enable-vhost-vsock) vhost_vsock="yes"
1150 --disable-opengl) opengl="no"
1152 --enable-opengl) opengl="yes"
1154 --disable-rbd) rbd="no"
1156 --enable-rbd) rbd="yes"
1158 --disable-xfsctl) xfs="no"
1160 --enable-xfsctl) xfs="yes"
1162 --disable-smartcard) smartcard="no"
1164 --enable-smartcard) smartcard="yes"
1166 --disable-libusb) libusb="no"
1168 --enable-libusb) libusb="yes"
1170 --disable-usb-redir) usb_redir="no"
1172 --enable-usb-redir) usb_redir="yes"
1174 --disable-zlib-test) zlib="no"
1176 --disable-lzo) lzo="no"
1178 --enable-lzo) lzo="yes"
1180 --disable-snappy) snappy="no"
1182 --enable-snappy) snappy="yes"
1184 --disable-bzip2) bzip2="no"
1186 --enable-bzip2) bzip2="yes"
1188 --enable-guest-agent) guest_agent="yes"
1190 --disable-guest-agent) guest_agent="no"
1192 --enable-guest-agent-msi) guest_agent_msi="yes"
1194 --disable-guest-agent-msi) guest_agent_msi="no"
1196 --with-vss-sdk) vss_win32_sdk=""
1198 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1200 --without-vss-sdk) vss_win32_sdk="no"
1202 --with-win-sdk) win_sdk=""
1204 --with-win-sdk=*) win_sdk="$optarg"
1206 --without-win-sdk) win_sdk="no"
1208 --enable-tools) want_tools="yes"
1210 --disable-tools) want_tools="no"
1212 --enable-seccomp) seccomp="yes"
1214 --disable-seccomp) seccomp="no"
1216 --disable-glusterfs) glusterfs="no"
1218 --enable-glusterfs) glusterfs="yes"
1220 --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
1221 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
1223 --enable-vhdx|--disable-vhdx)
1224 echo "$0: $opt is obsolete, VHDX driver is always built" >&2
1226 --enable-uuid|--disable-uuid)
1227 echo "$0: $opt is obsolete, UUID support is always built" >&2
1229 --disable-gtk) gtk="no"
1231 --enable-gtk) gtk="yes"
1233 --tls-priority=*) tls_priority="$optarg"
1235 --disable-gnutls) gnutls="no"
1237 --enable-gnutls) gnutls="yes"
1239 --disable-nettle) nettle="no"
1241 --enable-nettle) nettle="yes"
1243 --disable-gcrypt) gcrypt="no"
1245 --enable-gcrypt) gcrypt="yes"
1247 --enable-rdma) rdma="yes"
1249 --disable-rdma) rdma="no"
1251 --with-gtkabi=*) gtkabi="$optarg"
1253 --disable-vte) vte="no"
1255 --enable-vte) vte="yes"
1257 --disable-virglrenderer) virglrenderer="no"
1259 --enable-virglrenderer) virglrenderer="yes"
1261 --disable-tpm) tpm="no"
1263 --enable-tpm) tpm="yes"
1265 --disable-libssh2) libssh2="no"
1267 --enable-libssh2) libssh2="yes"
1269 --disable-live-block-migration) live_block_migration="no"
1271 --enable-live-block-migration) live_block_migration="yes"
1273 --disable-numa) numa="no"
1275 --enable-numa) numa="yes"
1277 --disable-tcmalloc) tcmalloc="no"
1279 --enable-tcmalloc) tcmalloc="yes"
1281 --disable-jemalloc) jemalloc="no"
1283 --enable-jemalloc) jemalloc="yes"
1285 --disable-replication) replication="no"
1287 --enable-replication) replication="yes"
1289 --disable-vxhs) vxhs="no"
1291 --enable-vxhs) vxhs="yes"
1293 --disable-vhost-user) vhost_user="no"
1295 --enable-vhost-user)
1296 vhost_user="yes"
1297 if test "$mingw32" = "yes"; then
1298 error_exit "vhost-user isn't available on win32"
1301 --disable-capstone) capstone="no"
1303 --enable-capstone) capstone="yes"
1305 --enable-capstone=git) capstone="git"
1307 --enable-capstone=system) capstone="system"
1309 --with-git=*) git="$optarg"
1311 --enable-git-update) git_update=yes
1313 --disable-git-update) git_update=no
1316 echo "ERROR: unknown option $opt"
1317 echo "Try '$0 --help' for more information"
1318 exit 1
1320 esac
1321 done
1323 if test "$vhost_user" = ""; then
1324 if test "$mingw32" = "yes"; then
1325 vhost_user="no"
1326 else
1327 vhost_user="yes"
1331 case "$cpu" in
1332 ppc)
1333 CPU_CFLAGS="-m32"
1334 LDFLAGS="-m32 $LDFLAGS"
1336 ppc64)
1337 CPU_CFLAGS="-m64"
1338 LDFLAGS="-m64 $LDFLAGS"
1340 sparc)
1341 CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc"
1342 LDFLAGS="-m32 -mv8plus $LDFLAGS"
1344 sparc64)
1345 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
1346 LDFLAGS="-m64 $LDFLAGS"
1348 s390)
1349 CPU_CFLAGS="-m31"
1350 LDFLAGS="-m31 $LDFLAGS"
1352 s390x)
1353 CPU_CFLAGS="-m64"
1354 LDFLAGS="-m64 $LDFLAGS"
1356 i386)
1357 CPU_CFLAGS="-m32"
1358 LDFLAGS="-m32 $LDFLAGS"
1359 cc_i386='$(CC) -m32'
1361 x86_64)
1362 # ??? Only extremely old AMD cpus do not have cmpxchg16b.
1363 # If we truly care, we should simply detect this case at
1364 # runtime and generate the fallback to serial emulation.
1365 CPU_CFLAGS="-m64 -mcx16"
1366 LDFLAGS="-m64 $LDFLAGS"
1367 cc_i386='$(CC) -m32'
1369 x32)
1370 CPU_CFLAGS="-mx32"
1371 LDFLAGS="-mx32 $LDFLAGS"
1372 cc_i386='$(CC) -m32'
1374 # No special flags required for other host CPUs
1375 esac
1377 QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1378 EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1380 # For user-mode emulation the host arch has to be one we explicitly
1381 # support, even if we're using TCI.
1382 if [ "$ARCH" = "unknown" ]; then
1383 bsd_user="no"
1384 linux_user="no"
1387 default_target_list=""
1389 mak_wilds=""
1391 if [ "$softmmu" = "yes" ]; then
1392 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
1394 if [ "$linux_user" = "yes" ]; then
1395 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
1397 if [ "$bsd_user" = "yes" ]; then
1398 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
1401 for config in $mak_wilds; do
1402 default_target_list="${default_target_list} $(basename "$config" .mak)"
1403 done
1405 # Enumerate public trace backends for --help output
1406 trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/'))
1408 if test x"$show_help" = x"yes" ; then
1409 cat << EOF
1411 Usage: configure [options]
1412 Options: [defaults in brackets after descriptions]
1414 Standard options:
1415 --help print this message
1416 --prefix=PREFIX install in PREFIX [$prefix]
1417 --interp-prefix=PREFIX where to find shared libraries, etc.
1418 use %M for cpu name [$interp_prefix]
1419 --target-list=LIST set target list (default: build everything)
1420 $(echo Available targets: $default_target_list | \
1421 fold -s -w 53 | sed -e 's/^/ /')
1423 Advanced options (experts only):
1424 --source-path=PATH path of source code [$source_path]
1425 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1426 --cc=CC use C compiler CC [$cc]
1427 --iasl=IASL use ACPI compiler IASL [$iasl]
1428 --host-cc=CC use C compiler CC [$host_cc] for code run at
1429 build time
1430 --cxx=CXX use C++ compiler CXX [$cxx]
1431 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1432 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
1433 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS
1434 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1435 --make=MAKE use specified make [$make]
1436 --install=INSTALL use specified install [$install]
1437 --python=PYTHON use specified python [$python]
1438 --smbd=SMBD use specified smbd [$smbd]
1439 --static enable static build [$static]
1440 --mandir=PATH install man pages in PATH
1441 --datadir=PATH install firmware in PATH$confsuffix
1442 --docdir=PATH install documentation in PATH$confsuffix
1443 --bindir=PATH install binaries in PATH
1444 --libdir=PATH install libraries in PATH
1445 --sysconfdir=PATH install config in PATH$confsuffix
1446 --localstatedir=PATH install local state in PATH (set at runtime on win32)
1447 --firmwarepath=PATH search PATH for firmware files
1448 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
1449 --enable-debug enable common debug build options
1450 --disable-strip disable stripping binaries
1451 --disable-werror disable compilation abort on warning
1452 --disable-stack-protector disable compiler-provided stack protection
1453 --audio-drv-list=LIST set audio drivers list:
1454 Available drivers: $audio_possible_drivers
1455 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1456 --block-drv-rw-whitelist=L
1457 set block driver read-write whitelist
1458 (affects only QEMU, not qemu-img)
1459 --block-drv-ro-whitelist=L
1460 set block driver read-only whitelist
1461 (affects only QEMU, not qemu-img)
1462 --enable-trace-backends=B Set trace backend
1463 Available backends: $trace_backend_list
1464 --with-trace-file=NAME Full PATH,NAME of file to store traces
1465 Default:trace-<pid>
1466 --disable-slirp disable SLIRP userspace network connectivity
1467 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1468 --oss-lib path to OSS library
1469 --cpu=CPU Build for host CPU [$cpu]
1470 --with-coroutine=BACKEND coroutine backend. Supported options:
1471 ucontext, sigaltstack, windows
1472 --enable-gcov enable test coverage analysis with gcov
1473 --gcov=GCOV use specified gcov [$gcov_tool]
1474 --disable-blobs disable installing provided firmware blobs
1475 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1476 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1477 --tls-priority default TLS protocol/cipher priority string
1478 --enable-gprof QEMU profiling with gprof
1479 --enable-profiler profiler support
1480 --enable-xen-pv-domain-build
1481 xen pv domain builder
1482 --enable-debug-stack-usage
1483 track the maximum stack usage of stacks created by qemu_alloc_stack
1485 Optional features, enabled with --enable-FEATURE and
1486 disabled with --disable-FEATURE, default is enabled if available:
1488 system all system emulation targets
1489 user supported user emulation targets
1490 linux-user all linux usermode emulation targets
1491 bsd-user all BSD usermode emulation targets
1492 docs build documentation
1493 guest-agent build the QEMU Guest Agent
1494 guest-agent-msi build guest agent Windows MSI installation package
1495 pie Position Independent Executables
1496 modules modules support
1497 debug-tcg TCG debugging (default is disabled)
1498 debug-info debugging information
1499 sparse sparse checker
1501 gnutls GNUTLS cryptography support
1502 nettle nettle cryptography support
1503 gcrypt libgcrypt cryptography support
1504 sdl SDL UI
1505 --with-sdlabi select preferred SDL ABI 1.2 or 2.0
1506 gtk gtk UI
1507 --with-gtkabi select preferred GTK ABI 2.0 or 3.0
1508 vte vte support for the gtk UI
1509 curses curses UI
1510 vnc VNC UI support
1511 vnc-sasl SASL encryption for VNC server
1512 vnc-jpeg JPEG lossy compression for VNC server
1513 vnc-png PNG compression for VNC server
1514 cocoa Cocoa UI (Mac OS X only)
1515 virtfs VirtFS
1516 mpath Multipath persistent reservation passthrough
1517 xen xen backend driver support
1518 xen-pci-passthrough
1519 brlapi BrlAPI (Braile)
1520 curl curl connectivity
1521 fdt fdt device tree
1522 bluez bluez stack connectivity
1523 kvm KVM acceleration support
1524 hax HAX acceleration support
1525 rdma RDMA-based migration support
1526 vde support for vde network
1527 netmap support for netmap network
1528 linux-aio Linux AIO support
1529 cap-ng libcap-ng support
1530 attr attr and xattr support
1531 vhost-net vhost-net acceleration support
1532 spice spice
1533 rbd rados block device (rbd)
1534 libiscsi iscsi support
1535 libnfs nfs support
1536 smartcard smartcard support (libcacard)
1537 libusb libusb (for usb passthrough)
1538 live-block-migration Block migration in the main migration stream
1539 usb-redir usb network redirection support
1540 lzo support of lzo compression library
1541 snappy support of snappy compression library
1542 bzip2 support of bzip2 compression library
1543 (for reading bzip2-compressed dmg images)
1544 seccomp seccomp support
1545 coroutine-pool coroutine freelist (better performance)
1546 glusterfs GlusterFS backend
1547 tpm TPM support
1548 libssh2 ssh block device support
1549 numa libnuma support
1550 tcmalloc tcmalloc support
1551 jemalloc jemalloc support
1552 replication replication support
1553 vhost-vsock virtio sockets device support
1554 opengl opengl support
1555 virglrenderer virgl rendering support
1556 xfsctl xfsctl support
1557 qom-cast-debug cast debugging support
1558 tools build qemu-io, qemu-nbd and qemu-image tools
1559 vxhs Veritas HyperScale vDisk backend support
1560 crypto-afalg Linux AF_ALG crypto backend driver
1561 vhost-user vhost-user support
1562 capstone capstone disassembler support
1564 NOTE: The object files are built at the place where configure is launched
1566 exit 0
1569 if ! has $python; then
1570 error_exit "Python not found. Use --python=/path/to/python"
1573 # Note that if the Python conditional here evaluates True we will exit
1574 # with status 1 which is a shell 'false' value.
1575 if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then
1576 error_exit "Cannot use '$python', Python 2.6 or later is required." \
1577 "Note that Python 3 or later is not yet supported." \
1578 "Use --python=/path/to/python to specify a supported Python."
1581 # Suppress writing compiled files
1582 python="$python -B"
1584 # Now we have handled --enable-tcg-interpreter and know we're not just
1585 # printing the help message, bail out if the host CPU isn't supported.
1586 if test "$ARCH" = "unknown"; then
1587 if test "$tcg_interpreter" = "yes" ; then
1588 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1589 else
1590 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1594 # Consult white-list to determine whether to enable werror
1595 # by default. Only enable by default for git builds
1596 if test -z "$werror" ; then
1597 if test -d "$source_path/.git" -a \
1598 \( "$linux" = "yes" -o "$mingw32" = "yes" \) ; then
1599 werror="yes"
1600 else
1601 werror="no"
1605 # check that the C compiler works.
1606 write_c_skeleton;
1607 if compile_object ; then
1608 : C compiler works ok
1609 else
1610 error_exit "\"$cc\" either does not exist or does not work"
1612 if ! compile_prog ; then
1613 error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
1616 if test "$bogus_os" = "yes"; then
1617 # Now that we know that we're not printing the help and that
1618 # the compiler works (so the results of the check_defines we used
1619 # to identify the OS are reliable), if we didn't recognize the
1620 # host OS we should stop now.
1621 error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
1624 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1625 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1626 gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1627 gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
1628 gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags"
1629 gcc_flags="-Wno-string-plus-int $gcc_flags"
1630 # Note that we do not add -Werror to gcc_flags here, because that would
1631 # enable it for all configure tests. If a configure test failed due
1632 # to -Werror this would just silently disable some features,
1633 # so it's too error prone.
1635 cc_has_warning_flag() {
1636 write_c_skeleton;
1638 # Use the positive sense of the flag when testing for -Wno-wombat
1639 # support (gcc will happily accept the -Wno- form of unknown
1640 # warning options).
1641 optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
1642 compile_prog "-Werror $optflag" ""
1645 for flag in $gcc_flags; do
1646 if cc_has_warning_flag $flag ; then
1647 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1649 done
1651 if test "$stack_protector" != "no"; then
1652 cat > $TMPC << EOF
1653 int main(int argc, char *argv[])
1655 char arr[64], *p = arr, *c = argv[0];
1656 while (*c) {
1657 *p++ = *c++;
1659 return 0;
1662 gcc_flags="-fstack-protector-strong -fstack-protector-all"
1663 sp_on=0
1664 for flag in $gcc_flags; do
1665 # We need to check both a compile and a link, since some compiler
1666 # setups fail only on a .c->.o compile and some only at link time
1667 if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
1668 compile_prog "-Werror $flag" ""; then
1669 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1670 sp_on=1
1671 break
1673 done
1674 if test "$stack_protector" = yes; then
1675 if test $sp_on = 0; then
1676 error_exit "Stack protector not supported"
1681 # Disable -Wmissing-braces on older compilers that warn even for
1682 # the "universal" C zero initializer {0}.
1683 cat > $TMPC << EOF
1684 struct {
1685 int a[2];
1686 } x = {0};
1688 if compile_object "-Werror" "" ; then
1690 else
1691 QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces"
1694 # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1695 # large functions that use global variables. The bug is in all releases of
1696 # GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1697 # 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1698 cat > $TMPC << EOF
1699 #if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1700 int main(void) { return 0; }
1701 #else
1702 #error No bug in this compiler.
1703 #endif
1705 if compile_prog "-Werror -fno-gcse" "" ; then
1706 TRANSLATE_OPT_CFLAGS=-fno-gcse
1709 if test "$static" = "yes" ; then
1710 if test "$modules" = "yes" ; then
1711 error_exit "static and modules are mutually incompatible"
1713 if test "$pie" = "yes" ; then
1714 error_exit "static and pie are mutually incompatible"
1715 else
1716 pie="no"
1720 # Unconditional check for compiler __thread support
1721 cat > $TMPC << EOF
1722 static __thread int tls_var;
1723 int main(void) { return tls_var; }
1726 if ! compile_prog "-Werror" "" ; then
1727 error_exit "Your compiler does not support the __thread specifier for " \
1728 "Thread-Local Storage (TLS). Please upgrade to a version that does."
1731 if test "$pie" = ""; then
1732 case "$cpu-$targetos" in
1733 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
1736 pie="no"
1738 esac
1741 if test "$pie" != "no" ; then
1742 cat > $TMPC << EOF
1744 #ifdef __linux__
1745 # define THREAD __thread
1746 #else
1747 # define THREAD
1748 #endif
1750 static THREAD int tls_var;
1752 int main(void) { return tls_var; }
1755 if compile_prog "-fPIE -DPIE" "-pie"; then
1756 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1757 LDFLAGS="-pie $LDFLAGS"
1758 pie="yes"
1759 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1760 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1762 else
1763 if test "$pie" = "yes"; then
1764 error_exit "PIE not available due to missing toolchain support"
1765 else
1766 echo "Disabling PIE due to missing toolchain support"
1767 pie="no"
1771 if compile_prog "-Werror -fno-pie" "-nopie"; then
1772 CFLAGS_NOPIE="-fno-pie"
1773 LDFLAGS_NOPIE="-nopie"
1777 ##########################################
1778 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
1779 # use i686 as default anyway, but for those that don't, an explicit
1780 # specification is necessary
1782 if test "$cpu" = "i386"; then
1783 cat > $TMPC << EOF
1784 static int sfaa(int *ptr)
1786 return __sync_fetch_and_and(ptr, 0);
1789 int main(void)
1791 int val = 42;
1792 val = __sync_val_compare_and_swap(&val, 0, 1);
1793 sfaa(&val);
1794 return val;
1797 if ! compile_prog "" "" ; then
1798 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1802 #########################################
1803 # Solaris specific configure tool chain decisions
1805 if test "$solaris" = "yes" ; then
1806 if has $install; then
1808 else
1809 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1810 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1811 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1813 if test "$(path_of $install)" = "/usr/sbin/install" ; then
1814 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1815 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1816 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1818 if has ar; then
1820 else
1821 if test -f /usr/ccs/bin/ar ; then
1822 error_exit "No path includes ar" \
1823 "Add /usr/ccs/bin to your path and rerun configure"
1825 error_exit "No path includes ar"
1829 if test -z "${target_list+xxx}" ; then
1830 for target in $default_target_list; do
1831 supported_target $target 2>/dev/null && \
1832 target_list="$target_list $target"
1833 done
1834 target_list="${target_list# }"
1835 else
1836 target_list=$(echo "$target_list" | sed -e 's/,/ /g')
1837 for target in $target_list; do
1838 # Check that we recognised the target name; this allows a more
1839 # friendly error message than if we let it fall through.
1840 case " $default_target_list " in
1841 *" $target "*)
1844 error_exit "Unknown target name '$target'"
1846 esac
1847 supported_target $target || exit 1
1848 done
1851 # see if system emulation was really requested
1852 case " $target_list " in
1853 *"-softmmu "*) softmmu=yes
1855 *) softmmu=no
1857 esac
1859 feature_not_found() {
1860 feature=$1
1861 remedy=$2
1863 error_exit "User requested feature $feature" \
1864 "configure was not able to find it." \
1865 "$remedy"
1868 # ---
1869 # big/little endian test
1870 cat > $TMPC << EOF
1871 short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1872 short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1873 extern int foo(short *, short *);
1874 int main(int argc, char *argv[]) {
1875 return foo(big_endian, little_endian);
1879 if compile_object ; then
1880 if grep -q BiGeNdIaN $TMPO ; then
1881 bigendian="yes"
1882 elif grep -q LiTtLeEnDiAn $TMPO ; then
1883 bigendian="no"
1884 else
1885 echo big/little test failed
1887 else
1888 echo big/little test failed
1891 ##########################################
1892 # cocoa implies not SDL or GTK
1893 # (the cocoa UI code currently assumes it is always the active UI
1894 # and doesn't interact well with other UI frontend code)
1895 if test "$cocoa" = "yes"; then
1896 if test "$sdl" = "yes"; then
1897 error_exit "Cocoa and SDL UIs cannot both be enabled at once"
1899 if test "$gtk" = "yes"; then
1900 error_exit "Cocoa and GTK UIs cannot both be enabled at once"
1902 gtk=no
1903 sdl=no
1906 # Some versions of Mac OS X incorrectly define SIZE_MAX
1907 cat > $TMPC << EOF
1908 #include <stdint.h>
1909 #include <stdio.h>
1910 int main(int argc, char *argv[]) {
1911 return printf("%zu", SIZE_MAX);
1914 have_broken_size_max=no
1915 if ! compile_object -Werror ; then
1916 have_broken_size_max=yes
1919 ##########################################
1920 # L2TPV3 probe
1922 cat > $TMPC <<EOF
1923 #include <sys/socket.h>
1924 #include <linux/ip.h>
1925 int main(void) { return sizeof(struct mmsghdr); }
1927 if compile_prog "" "" ; then
1928 l2tpv3=yes
1929 else
1930 l2tpv3=no
1933 ##########################################
1934 # MinGW / Mingw-w64 localtime_r/gmtime_r check
1936 if test "$mingw32" = "yes"; then
1937 # Some versions of MinGW / Mingw-w64 lack localtime_r
1938 # and gmtime_r entirely.
1940 # Some versions of Mingw-w64 define a macro for
1941 # localtime_r/gmtime_r.
1943 # Some versions of Mingw-w64 will define functions
1944 # for localtime_r/gmtime_r, but only if you have
1945 # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
1946 # though, unistd.h and pthread.h both define
1947 # that for you.
1949 # So this #undef localtime_r and #include <unistd.h>
1950 # are not in fact redundant.
1951 cat > $TMPC << EOF
1952 #include <unistd.h>
1953 #include <time.h>
1954 #undef localtime_r
1955 int main(void) { localtime_r(NULL, NULL); return 0; }
1957 if compile_prog "" "" ; then
1958 localtime_r="yes"
1959 else
1960 localtime_r="no"
1964 ##########################################
1965 # pkg-config probe
1967 if ! has "$pkg_config_exe"; then
1968 error_exit "pkg-config binary '$pkg_config_exe' not found"
1971 ##########################################
1972 # NPTL probe
1974 if test "$linux_user" = "yes"; then
1975 cat > $TMPC <<EOF
1976 #include <sched.h>
1977 #include <linux/futex.h>
1978 int main(void) {
1979 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1980 #error bork
1981 #endif
1982 return 0;
1985 if ! compile_object ; then
1986 feature_not_found "nptl" "Install glibc and linux kernel headers."
1990 #########################################
1991 # zlib check
1993 if test "$zlib" != "no" ; then
1994 cat > $TMPC << EOF
1995 #include <zlib.h>
1996 int main(void) { zlibVersion(); return 0; }
1998 if compile_prog "" "-lz" ; then
2000 else
2001 error_exit "zlib check failed" \
2002 "Make sure to have the zlib libs and headers installed."
2005 LIBS="$LIBS -lz"
2007 ##########################################
2008 # lzo check
2010 if test "$lzo" != "no" ; then
2011 cat > $TMPC << EOF
2012 #include <lzo/lzo1x.h>
2013 int main(void) { lzo_version(); return 0; }
2015 if compile_prog "" "-llzo2" ; then
2016 libs_softmmu="$libs_softmmu -llzo2"
2017 lzo="yes"
2018 else
2019 if test "$lzo" = "yes"; then
2020 feature_not_found "liblzo2" "Install liblzo2 devel"
2022 lzo="no"
2026 ##########################################
2027 # snappy check
2029 if test "$snappy" != "no" ; then
2030 cat > $TMPC << EOF
2031 #include <snappy-c.h>
2032 int main(void) { snappy_max_compressed_length(4096); return 0; }
2034 if compile_prog "" "-lsnappy" ; then
2035 libs_softmmu="$libs_softmmu -lsnappy"
2036 snappy="yes"
2037 else
2038 if test "$snappy" = "yes"; then
2039 feature_not_found "libsnappy" "Install libsnappy devel"
2041 snappy="no"
2045 ##########################################
2046 # bzip2 check
2048 if test "$bzip2" != "no" ; then
2049 cat > $TMPC << EOF
2050 #include <bzlib.h>
2051 int main(void) { BZ2_bzlibVersion(); return 0; }
2053 if compile_prog "" "-lbz2" ; then
2054 bzip2="yes"
2055 else
2056 if test "$bzip2" = "yes"; then
2057 feature_not_found "libbzip2" "Install libbzip2 devel"
2059 bzip2="no"
2063 ##########################################
2064 # libseccomp check
2066 if test "$seccomp" != "no" ; then
2067 case "$cpu" in
2068 i386|x86_64)
2069 libseccomp_minver="2.1.0"
2071 mips)
2072 libseccomp_minver="2.2.0"
2074 arm|aarch64)
2075 libseccomp_minver="2.2.3"
2077 ppc|ppc64|s390x)
2078 libseccomp_minver="2.3.0"
2081 libseccomp_minver=""
2083 esac
2085 if test "$libseccomp_minver" != "" &&
2086 $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
2087 seccomp_cflags="$($pkg_config --cflags libseccomp)"
2088 seccomp_libs="$($pkg_config --libs libseccomp)"
2089 seccomp="yes"
2090 else
2091 if test "$seccomp" = "yes" ; then
2092 if test "$libseccomp_minver" != "" ; then
2093 feature_not_found "libseccomp" \
2094 "Install libseccomp devel >= $libseccomp_minver"
2095 else
2096 feature_not_found "libseccomp" \
2097 "libseccomp is not supported for host cpu $cpu"
2100 seccomp="no"
2103 ##########################################
2104 # xen probe
2106 if test "$xen" != "no" ; then
2107 # Check whether Xen library path is specified via --extra-ldflags to avoid
2108 # overriding this setting with pkg-config output. If not, try pkg-config
2109 # to obtain all needed flags.
2111 if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \
2112 $pkg_config --exists xencontrol ; then
2113 xen_ctrl_version="$(printf '%d%02d%02d' \
2114 $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
2115 xen=yes
2116 xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
2117 xen_pc="$xen_pc xenevtchn xendevicemodel"
2118 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
2119 libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
2120 LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS"
2121 else
2123 xen_libs="-lxenstore -lxenctrl -lxenguest"
2124 xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
2126 # First we test whether Xen headers and libraries are available.
2127 # If no, we are done and there is no Xen support.
2128 # If yes, more tests are run to detect the Xen version.
2130 # Xen (any)
2131 cat > $TMPC <<EOF
2132 #include <xenctrl.h>
2133 int main(void) {
2134 return 0;
2137 if ! compile_prog "" "$xen_libs" ; then
2138 # Xen not found
2139 if test "$xen" = "yes" ; then
2140 feature_not_found "xen" "Install xen devel"
2142 xen=no
2144 # Xen unstable
2145 elif
2146 cat > $TMPC <<EOF &&
2147 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2148 #include <xenforeignmemory.h>
2149 int main(void) {
2150 xenforeignmemory_handle *xfmem;
2152 xfmem = xenforeignmemory_open(0, 0);
2153 xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0);
2155 return 0;
2158 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
2159 then
2160 xen_stable_libs="-lxendevicemodel $xen_stable_libs"
2161 xen_ctrl_version=41000
2162 xen=yes
2163 elif
2164 cat > $TMPC <<EOF &&
2165 #undef XC_WANT_COMPAT_DEVICEMODEL_API
2166 #define __XEN_TOOLS__
2167 #include <xendevicemodel.h>
2168 int main(void) {
2169 xendevicemodel_handle *xd;
2171 xd = xendevicemodel_open(0, 0);
2172 xendevicemodel_close(xd);
2174 return 0;
2177 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
2178 then
2179 xen_stable_libs="-lxendevicemodel $xen_stable_libs"
2180 xen_ctrl_version=40900
2181 xen=yes
2182 elif
2183 cat > $TMPC <<EOF &&
2185 * If we have stable libs the we don't want the libxc compat
2186 * layers, regardless of what CFLAGS we may have been given.
2188 * Also, check if xengnttab_grant_copy_segment_t is defined and
2189 * grant copy operation is implemented.
2191 #undef XC_WANT_COMPAT_EVTCHN_API
2192 #undef XC_WANT_COMPAT_GNTTAB_API
2193 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2194 #include <xenctrl.h>
2195 #include <xenstore.h>
2196 #include <xenevtchn.h>
2197 #include <xengnttab.h>
2198 #include <xenforeignmemory.h>
2199 #include <stdint.h>
2200 #include <xen/hvm/hvm_info_table.h>
2201 #if !defined(HVM_MAX_VCPUS)
2202 # error HVM_MAX_VCPUS not defined
2203 #endif
2204 int main(void) {
2205 xc_interface *xc = NULL;
2206 xenforeignmemory_handle *xfmem;
2207 xenevtchn_handle *xe;
2208 xengnttab_handle *xg;
2209 xen_domain_handle_t handle;
2210 xengnttab_grant_copy_segment_t* seg = NULL;
2212 xs_daemon_open();
2214 xc = xc_interface_open(0, 0, 0);
2215 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2216 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2217 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2218 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2219 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2221 xfmem = xenforeignmemory_open(0, 0);
2222 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2224 xe = xenevtchn_open(0, 0);
2225 xenevtchn_fd(xe);
2227 xg = xengnttab_open(0, 0);
2228 xengnttab_grant_copy(xg, 0, seg);
2230 return 0;
2233 compile_prog "" "$xen_libs $xen_stable_libs"
2234 then
2235 xen_ctrl_version=40800
2236 xen=yes
2237 elif
2238 cat > $TMPC <<EOF &&
2240 * If we have stable libs the we don't want the libxc compat
2241 * layers, regardless of what CFLAGS we may have been given.
2243 #undef XC_WANT_COMPAT_EVTCHN_API
2244 #undef XC_WANT_COMPAT_GNTTAB_API
2245 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2246 #include <xenctrl.h>
2247 #include <xenstore.h>
2248 #include <xenevtchn.h>
2249 #include <xengnttab.h>
2250 #include <xenforeignmemory.h>
2251 #include <stdint.h>
2252 #include <xen/hvm/hvm_info_table.h>
2253 #if !defined(HVM_MAX_VCPUS)
2254 # error HVM_MAX_VCPUS not defined
2255 #endif
2256 int main(void) {
2257 xc_interface *xc = NULL;
2258 xenforeignmemory_handle *xfmem;
2259 xenevtchn_handle *xe;
2260 xengnttab_handle *xg;
2261 xen_domain_handle_t handle;
2263 xs_daemon_open();
2265 xc = xc_interface_open(0, 0, 0);
2266 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2267 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2268 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2269 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2270 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2272 xfmem = xenforeignmemory_open(0, 0);
2273 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2275 xe = xenevtchn_open(0, 0);
2276 xenevtchn_fd(xe);
2278 xg = xengnttab_open(0, 0);
2279 xengnttab_map_grant_ref(xg, 0, 0, 0);
2281 return 0;
2284 compile_prog "" "$xen_libs $xen_stable_libs"
2285 then
2286 xen_ctrl_version=40701
2287 xen=yes
2288 elif
2289 cat > $TMPC <<EOF &&
2290 #include <xenctrl.h>
2291 #include <stdint.h>
2292 int main(void) {
2293 xc_interface *xc = NULL;
2294 xen_domain_handle_t handle;
2295 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2296 return 0;
2299 compile_prog "" "$xen_libs"
2300 then
2301 xen_ctrl_version=40700
2302 xen=yes
2304 # Xen 4.6
2305 elif
2306 cat > $TMPC <<EOF &&
2307 #include <xenctrl.h>
2308 #include <xenstore.h>
2309 #include <stdint.h>
2310 #include <xen/hvm/hvm_info_table.h>
2311 #if !defined(HVM_MAX_VCPUS)
2312 # error HVM_MAX_VCPUS not defined
2313 #endif
2314 int main(void) {
2315 xc_interface *xc;
2316 xs_daemon_open();
2317 xc = xc_interface_open(0, 0, 0);
2318 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2319 xc_gnttab_open(NULL, 0);
2320 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2321 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2322 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2323 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
2324 return 0;
2327 compile_prog "" "$xen_libs"
2328 then
2329 xen_ctrl_version=40600
2330 xen=yes
2332 # Xen 4.5
2333 elif
2334 cat > $TMPC <<EOF &&
2335 #include <xenctrl.h>
2336 #include <xenstore.h>
2337 #include <stdint.h>
2338 #include <xen/hvm/hvm_info_table.h>
2339 #if !defined(HVM_MAX_VCPUS)
2340 # error HVM_MAX_VCPUS not defined
2341 #endif
2342 int main(void) {
2343 xc_interface *xc;
2344 xs_daemon_open();
2345 xc = xc_interface_open(0, 0, 0);
2346 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2347 xc_gnttab_open(NULL, 0);
2348 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2349 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2350 xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
2351 return 0;
2354 compile_prog "" "$xen_libs"
2355 then
2356 xen_ctrl_version=40500
2357 xen=yes
2359 elif
2360 cat > $TMPC <<EOF &&
2361 #include <xenctrl.h>
2362 #include <xenstore.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;
2370 xs_daemon_open();
2371 xc = xc_interface_open(0, 0, 0);
2372 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2373 xc_gnttab_open(NULL, 0);
2374 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2375 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2376 return 0;
2379 compile_prog "" "$xen_libs"
2380 then
2381 xen_ctrl_version=40200
2382 xen=yes
2384 else
2385 if test "$xen" = "yes" ; then
2386 feature_not_found "xen (unsupported version)" \
2387 "Install a supported xen (xen 4.2 or newer)"
2389 xen=no
2392 if test "$xen" = yes; then
2393 if test $xen_ctrl_version -ge 40701 ; then
2394 libs_softmmu="$xen_stable_libs $libs_softmmu"
2396 libs_softmmu="$xen_libs $libs_softmmu"
2401 if test "$xen_pci_passthrough" != "no"; then
2402 if test "$xen" = "yes" && test "$linux" = "yes"; then
2403 xen_pci_passthrough=yes
2404 else
2405 if test "$xen_pci_passthrough" = "yes"; then
2406 error_exit "User requested feature Xen PCI Passthrough" \
2407 " but this feature requires /sys from Linux"
2409 xen_pci_passthrough=no
2413 if test "$xen_pv_domain_build" = "yes" &&
2414 test "$xen" != "yes"; then
2415 error_exit "User requested Xen PV domain builder support" \
2416 "which requires Xen support."
2419 ##########################################
2420 # Sparse probe
2421 if test "$sparse" != "no" ; then
2422 if has cgcc; then
2423 sparse=yes
2424 else
2425 if test "$sparse" = "yes" ; then
2426 feature_not_found "sparse" "Install sparse binary"
2428 sparse=no
2432 ##########################################
2433 # X11 probe
2434 x11_cflags=
2435 x11_libs=-lX11
2436 if $pkg_config --exists "x11"; then
2437 x11_cflags=$($pkg_config --cflags x11)
2438 x11_libs=$($pkg_config --libs x11)
2441 ##########################################
2442 # GTK probe
2444 if test "$gtkabi" = ""; then
2445 # The GTK ABI was not specified explicitly, so try whether 3.0 is available.
2446 # Use 2.0 as a fallback if that is available.
2447 if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
2448 gtkabi=3.0
2449 elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
2450 gtkabi=2.0
2451 else
2452 gtkabi=3.0
2456 if test "$gtk" != "no"; then
2457 gtkpackage="gtk+-$gtkabi"
2458 gtkx11package="gtk+-x11-$gtkabi"
2459 if test "$gtkabi" = "3.0" ; then
2460 gtkversion="3.0.0"
2461 else
2462 gtkversion="2.18.0"
2464 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
2465 gtk_cflags=$($pkg_config --cflags $gtkpackage)
2466 gtk_libs=$($pkg_config --libs $gtkpackage)
2467 gtk_version=$($pkg_config --modversion $gtkpackage)
2468 if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
2469 gtk_cflags="$gtk_cflags $x11_cflags"
2470 gtk_libs="$gtk_libs $x11_libs"
2472 libs_softmmu="$gtk_libs $libs_softmmu"
2473 gtk="yes"
2474 elif test "$gtk" = "yes"; then
2475 feature_not_found "gtk" "Install gtk3-devel"
2476 else
2477 gtk="no"
2482 ##########################################
2483 # GNUTLS probe
2485 gnutls_works() {
2486 # Unfortunately some distros have bad pkg-config information for gnutls
2487 # such that it claims to exist but you get a compiler error if you try
2488 # to use the options returned by --libs. Specifically, Ubuntu for --static
2489 # builds doesn't work:
2490 # https://bugs.launchpad.net/ubuntu/+source/gnutls26/+bug/1478035
2492 # So sanity check the cflags/libs before assuming gnutls can be used.
2493 if ! $pkg_config --exists "gnutls"; then
2494 return 1
2497 write_c_skeleton
2498 compile_prog "$($pkg_config --cflags gnutls)" "$($pkg_config --libs gnutls)"
2501 gnutls_gcrypt=no
2502 gnutls_nettle=no
2503 if test "$gnutls" != "no"; then
2504 if gnutls_works; then
2505 gnutls_cflags=$($pkg_config --cflags gnutls)
2506 gnutls_libs=$($pkg_config --libs gnutls)
2507 libs_softmmu="$gnutls_libs $libs_softmmu"
2508 libs_tools="$gnutls_libs $libs_tools"
2509 QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
2510 gnutls="yes"
2512 # gnutls_rnd requires >= 2.11.0
2513 if $pkg_config --exists "gnutls >= 2.11.0"; then
2514 gnutls_rnd="yes"
2515 else
2516 gnutls_rnd="no"
2519 if $pkg_config --exists 'gnutls >= 3.0'; then
2520 gnutls_gcrypt=no
2521 gnutls_nettle=yes
2522 elif $pkg_config --exists 'gnutls >= 2.12'; then
2523 case $($pkg_config --libs --static gnutls) in
2524 *gcrypt*)
2525 gnutls_gcrypt=yes
2526 gnutls_nettle=no
2528 *nettle*)
2529 gnutls_gcrypt=no
2530 gnutls_nettle=yes
2533 gnutls_gcrypt=yes
2534 gnutls_nettle=no
2536 esac
2537 else
2538 gnutls_gcrypt=yes
2539 gnutls_nettle=no
2541 elif test "$gnutls" = "yes"; then
2542 feature_not_found "gnutls" "Install gnutls devel"
2543 else
2544 gnutls="no"
2545 gnutls_rnd="no"
2547 else
2548 gnutls_rnd="no"
2552 # If user didn't give a --disable/enable-gcrypt flag,
2553 # then mark as disabled if user requested nettle
2554 # explicitly, or if gnutls links to nettle
2555 if test -z "$gcrypt"
2556 then
2557 if test "$nettle" = "yes" || test "$gnutls_nettle" = "yes"
2558 then
2559 gcrypt="no"
2563 # If user didn't give a --disable/enable-nettle flag,
2564 # then mark as disabled if user requested gcrypt
2565 # explicitly, or if gnutls links to gcrypt
2566 if test -z "$nettle"
2567 then
2568 if test "$gcrypt" = "yes" || test "$gnutls_gcrypt" = "yes"
2569 then
2570 nettle="no"
2574 has_libgcrypt_config() {
2575 if ! has "libgcrypt-config"
2576 then
2577 return 1
2580 if test -n "$cross_prefix"
2581 then
2582 host=$(libgcrypt-config --host)
2583 if test "$host-" != $cross_prefix
2584 then
2585 return 1
2589 return 0
2592 if test "$gcrypt" != "no"; then
2593 if has_libgcrypt_config; then
2594 gcrypt_cflags=$(libgcrypt-config --cflags)
2595 gcrypt_libs=$(libgcrypt-config --libs)
2596 # Debian has remove -lgpg-error from libgcrypt-config
2597 # as it "spreads unnecessary dependencies" which in
2598 # turn breaks static builds...
2599 if test "$static" = "yes"
2600 then
2601 gcrypt_libs="$gcrypt_libs -lgpg-error"
2603 libs_softmmu="$gcrypt_libs $libs_softmmu"
2604 libs_tools="$gcrypt_libs $libs_tools"
2605 QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
2606 gcrypt="yes"
2607 if test -z "$nettle"; then
2608 nettle="no"
2611 cat > $TMPC << EOF
2612 #include <gcrypt.h>
2613 int main(void) {
2614 gcry_kdf_derive(NULL, 0, GCRY_KDF_PBKDF2,
2615 GCRY_MD_SHA256,
2616 NULL, 0, 0, 0, NULL);
2617 return 0;
2620 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2621 gcrypt_kdf=yes
2624 cat > $TMPC << EOF
2625 #include <gcrypt.h>
2626 int main(void) {
2627 gcry_mac_hd_t handle;
2628 gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5,
2629 GCRY_MAC_FLAG_SECURE, NULL);
2630 return 0;
2633 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2634 gcrypt_hmac=yes
2636 else
2637 if test "$gcrypt" = "yes"; then
2638 feature_not_found "gcrypt" "Install gcrypt devel"
2639 else
2640 gcrypt="no"
2646 if test "$nettle" != "no"; then
2647 if $pkg_config --exists "nettle"; then
2648 nettle_cflags=$($pkg_config --cflags nettle)
2649 nettle_libs=$($pkg_config --libs nettle)
2650 nettle_version=$($pkg_config --modversion nettle)
2651 libs_softmmu="$nettle_libs $libs_softmmu"
2652 libs_tools="$nettle_libs $libs_tools"
2653 QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
2654 nettle="yes"
2656 cat > $TMPC << EOF
2657 #include <stddef.h>
2658 #include <nettle/pbkdf2.h>
2659 int main(void) {
2660 pbkdf2_hmac_sha256(8, NULL, 1000, 8, NULL, 8, NULL);
2661 return 0;
2664 if compile_prog "$nettle_cflags" "$nettle_libs" ; then
2665 nettle_kdf=yes
2667 else
2668 if test "$nettle" = "yes"; then
2669 feature_not_found "nettle" "Install nettle devel"
2670 else
2671 nettle="no"
2676 if test "$gcrypt" = "yes" && test "$nettle" = "yes"
2677 then
2678 error_exit "Only one of gcrypt & nettle can be enabled"
2681 ##########################################
2682 # libtasn1 - only for the TLS creds/session test suite
2684 tasn1=yes
2685 tasn1_cflags=""
2686 tasn1_libs=""
2687 if $pkg_config --exists "libtasn1"; then
2688 tasn1_cflags=$($pkg_config --cflags libtasn1)
2689 tasn1_libs=$($pkg_config --libs libtasn1)
2690 else
2691 tasn1=no
2695 ##########################################
2696 # getifaddrs (for tests/test-io-channel-socket )
2698 have_ifaddrs_h=yes
2699 if ! check_include "ifaddrs.h" ; then
2700 have_ifaddrs_h=no
2703 ##########################################
2704 # VTE probe
2706 if test "$vte" != "no"; then
2707 if test "$gtkabi" = "3.0"; then
2708 vteminversion="0.32.0"
2709 if $pkg_config --exists "vte-2.91"; then
2710 vtepackage="vte-2.91"
2711 else
2712 vtepackage="vte-2.90"
2714 else
2715 vtepackage="vte"
2716 vteminversion="0.24.0"
2718 if $pkg_config --exists "$vtepackage >= $vteminversion"; then
2719 vte_cflags=$($pkg_config --cflags $vtepackage)
2720 vte_libs=$($pkg_config --libs $vtepackage)
2721 vteversion=$($pkg_config --modversion $vtepackage)
2722 libs_softmmu="$vte_libs $libs_softmmu"
2723 vte="yes"
2724 elif test "$vte" = "yes"; then
2725 if test "$gtkabi" = "3.0"; then
2726 feature_not_found "vte" "Install libvte-2.90/2.91 devel"
2727 else
2728 feature_not_found "vte" "Install libvte devel"
2730 else
2731 vte="no"
2735 ##########################################
2736 # SDL probe
2738 # Look for sdl configuration program (pkg-config or sdl-config). Try
2739 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
2741 if test "$sdlabi" = ""; then
2742 if $pkg_config --exists "sdl2"; then
2743 sdlabi=2.0
2744 elif $pkg_config --exists "sdl"; then
2745 sdlabi=1.2
2746 else
2747 sdlabi=2.0
2751 if test $sdlabi = "2.0"; then
2752 sdl_config=$sdl2_config
2753 sdlname=sdl2
2754 sdlconfigname=sdl2_config
2755 elif test $sdlabi = "1.2"; then
2756 sdlname=sdl
2757 sdlconfigname=sdl_config
2758 else
2759 error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0"
2762 if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then
2763 sdl_config=$sdlconfigname
2766 if $pkg_config $sdlname --exists; then
2767 sdlconfig="$pkg_config $sdlname"
2768 sdlversion=$($sdlconfig --modversion 2>/dev/null)
2769 elif has ${sdl_config}; then
2770 sdlconfig="$sdl_config"
2771 sdlversion=$($sdlconfig --version)
2772 else
2773 if test "$sdl" = "yes" ; then
2774 feature_not_found "sdl" "Install SDL2-devel"
2776 sdl=no
2778 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
2779 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
2782 sdl_too_old=no
2783 if test "$sdl" != "no" ; then
2784 cat > $TMPC << EOF
2785 #include <SDL.h>
2786 #undef main /* We don't want SDL to override our main() */
2787 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
2789 sdl_cflags=$($sdlconfig --cflags 2>/dev/null)
2790 if test "$static" = "yes" ; then
2791 if $pkg_config $sdlname --exists; then
2792 sdl_libs=$($pkg_config $sdlname --static --libs 2>/dev/null)
2793 else
2794 sdl_libs=$($sdlconfig --static-libs 2>/dev/null)
2796 else
2797 sdl_libs=$($sdlconfig --libs 2>/dev/null)
2799 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2800 if test $(echo $sdlversion | sed 's/[^0-9]//g') -lt 121 ; then
2801 sdl_too_old=yes
2802 else
2803 sdl=yes
2806 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
2807 if test "$sdl" = "yes" -a "$static" = "yes" ; then
2808 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
2809 sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)"
2810 sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)"
2812 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2814 else
2815 sdl=no
2817 fi # static link
2818 else # sdl not found
2819 if test "$sdl" = "yes" ; then
2820 feature_not_found "sdl" "Install SDL devel"
2822 sdl=no
2823 fi # sdl compile test
2826 if test "$sdl" = "yes" ; then
2827 cat > $TMPC <<EOF
2828 #include <SDL.h>
2829 #if defined(SDL_VIDEO_DRIVER_X11)
2830 #include <X11/XKBlib.h>
2831 #else
2832 #error No x11 support
2833 #endif
2834 int main(void) { return 0; }
2836 if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then
2837 sdl_cflags="$sdl_cflags $x11_cflags"
2838 sdl_libs="$sdl_libs $x11_libs"
2842 ##########################################
2843 # RDMA needs OpenFabrics libraries
2844 if test "$rdma" != "no" ; then
2845 cat > $TMPC <<EOF
2846 #include <rdma/rdma_cma.h>
2847 int main(void) { return 0; }
2849 rdma_libs="-lrdmacm -libverbs"
2850 if compile_prog "" "$rdma_libs" ; then
2851 rdma="yes"
2852 else
2853 if test "$rdma" = "yes" ; then
2854 error_exit \
2855 " OpenFabrics librdmacm/libibverbs not present." \
2856 " Your options:" \
2857 " (1) Fast: Install infiniband packages from your distro." \
2858 " (2) Cleanest: Install libraries from www.openfabrics.org" \
2859 " (3) Also: Install softiwarp if you don't have RDMA hardware"
2861 rdma="no"
2866 ##########################################
2867 # VNC SASL detection
2868 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
2869 cat > $TMPC <<EOF
2870 #include <sasl/sasl.h>
2871 #include <stdio.h>
2872 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
2874 # Assuming Cyrus-SASL installed in /usr prefix
2875 vnc_sasl_cflags=""
2876 vnc_sasl_libs="-lsasl2"
2877 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
2878 vnc_sasl=yes
2879 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
2880 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
2881 else
2882 if test "$vnc_sasl" = "yes" ; then
2883 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
2885 vnc_sasl=no
2889 ##########################################
2890 # VNC JPEG detection
2891 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
2892 cat > $TMPC <<EOF
2893 #include <stdio.h>
2894 #include <jpeglib.h>
2895 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2897 vnc_jpeg_cflags=""
2898 vnc_jpeg_libs="-ljpeg"
2899 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2900 vnc_jpeg=yes
2901 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
2902 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
2903 else
2904 if test "$vnc_jpeg" = "yes" ; then
2905 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
2907 vnc_jpeg=no
2911 ##########################################
2912 # VNC PNG detection
2913 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
2914 cat > $TMPC <<EOF
2915 //#include <stdio.h>
2916 #include <png.h>
2917 #include <stddef.h>
2918 int main(void) {
2919 png_structp png_ptr;
2920 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
2921 return png_ptr != 0;
2924 if $pkg_config libpng --exists; then
2925 vnc_png_cflags=$($pkg_config libpng --cflags)
2926 vnc_png_libs=$($pkg_config libpng --libs)
2927 else
2928 vnc_png_cflags=""
2929 vnc_png_libs="-lpng"
2931 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2932 vnc_png=yes
2933 libs_softmmu="$vnc_png_libs $libs_softmmu"
2934 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
2935 else
2936 if test "$vnc_png" = "yes" ; then
2937 feature_not_found "vnc-png" "Install libpng devel"
2939 vnc_png=no
2943 ##########################################
2944 # xkbcommon probe
2945 if test "$xkbcommon" != "no" ; then
2946 if $pkg_config xkbcommon --exists; then
2947 xkbcommon_cflags=$($pkg_config xkbcommon --cflags)
2948 xkbcommon_libs=$($pkg_config xkbcommon --libs)
2949 xkbcommon=yes
2950 else
2951 if test "$xkbcommon" = "yes" ; then
2952 feature_not_found "xkbcommon" "Install libxkbcommon-devel"
2954 xkbcommon=no
2958 ##########################################
2959 # fnmatch() probe, used for ACL routines
2960 fnmatch="no"
2961 cat > $TMPC << EOF
2962 #include <fnmatch.h>
2963 int main(void)
2965 fnmatch("foo", "foo", 0);
2966 return 0;
2969 if compile_prog "" "" ; then
2970 fnmatch="yes"
2973 ##########################################
2974 # xfsctl() probe, used for file-posix.c
2975 if test "$xfs" != "no" ; then
2976 cat > $TMPC << EOF
2977 #include <stddef.h> /* NULL */
2978 #include <xfs/xfs.h>
2979 int main(void)
2981 xfsctl(NULL, 0, 0, NULL);
2982 return 0;
2985 if compile_prog "" "" ; then
2986 xfs="yes"
2987 else
2988 if test "$xfs" = "yes" ; then
2989 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
2991 xfs=no
2995 ##########################################
2996 # vde libraries probe
2997 if test "$vde" != "no" ; then
2998 vde_libs="-lvdeplug"
2999 cat > $TMPC << EOF
3000 #include <libvdeplug.h>
3001 int main(void)
3003 struct vde_open_args a = {0, 0, 0};
3004 char s[] = "";
3005 vde_open(s, s, &a);
3006 return 0;
3009 if compile_prog "" "$vde_libs" ; then
3010 vde=yes
3011 else
3012 if test "$vde" = "yes" ; then
3013 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
3015 vde=no
3019 ##########################################
3020 # netmap support probe
3021 # Apart from looking for netmap headers, we make sure that the host API version
3022 # supports the netmap backend (>=11). The upper bound (15) is meant to simulate
3023 # a minor/major version number. Minor new features will be marked with values up
3024 # to 15, and if something happens that requires a change to the backend we will
3025 # move above 15, submit the backend fixes and modify this two bounds.
3026 if test "$netmap" != "no" ; then
3027 cat > $TMPC << EOF
3028 #include <inttypes.h>
3029 #include <net/if.h>
3030 #include <net/netmap.h>
3031 #include <net/netmap_user.h>
3032 #if (NETMAP_API < 11) || (NETMAP_API > 15)
3033 #error
3034 #endif
3035 int main(void) { return 0; }
3037 if compile_prog "" "" ; then
3038 netmap=yes
3039 else
3040 if test "$netmap" = "yes" ; then
3041 feature_not_found "netmap"
3043 netmap=no
3047 ##########################################
3048 # libcap-ng library probe
3049 if test "$cap_ng" != "no" ; then
3050 cap_libs="-lcap-ng"
3051 cat > $TMPC << EOF
3052 #include <cap-ng.h>
3053 int main(void)
3055 capng_capability_to_name(CAPNG_EFFECTIVE);
3056 return 0;
3059 if compile_prog "" "$cap_libs" ; then
3060 cap_ng=yes
3061 libs_tools="$cap_libs $libs_tools"
3062 else
3063 if test "$cap_ng" = "yes" ; then
3064 feature_not_found "cap_ng" "Install libcap-ng devel"
3066 cap_ng=no
3070 ##########################################
3071 # Sound support libraries probe
3073 audio_drv_probe()
3075 drv=$1
3076 hdr=$2
3077 lib=$3
3078 exp=$4
3079 cfl=$5
3080 cat > $TMPC << EOF
3081 #include <$hdr>
3082 int main(void) { $exp }
3084 if compile_prog "$cfl" "$lib" ; then
3086 else
3087 error_exit "$drv check failed" \
3088 "Make sure to have the $drv libs and headers installed."
3092 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g')
3093 for drv in $audio_drv_list; do
3094 case $drv in
3095 alsa)
3096 audio_drv_probe $drv alsa/asoundlib.h -lasound \
3097 "return snd_pcm_close((snd_pcm_t *)0);"
3098 alsa_libs="-lasound"
3102 audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \
3103 "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;"
3104 pulse_libs="-lpulse"
3105 audio_pt_int="yes"
3108 sdl)
3109 if test "$sdl" = "no"; then
3110 error_exit "sdl not found or disabled, can not use sdl audio driver"
3114 coreaudio)
3115 coreaudio_libs="-framework CoreAudio"
3118 dsound)
3119 dsound_libs="-lole32 -ldxguid"
3120 audio_win_int="yes"
3123 oss)
3124 oss_libs="$oss_lib"
3127 wav)
3128 # XXX: Probes for CoreAudio, DirectSound
3132 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
3133 error_exit "Unknown driver '$drv' selected" \
3134 "Possible drivers are: $audio_possible_drivers"
3137 esac
3138 done
3140 ##########################################
3141 # BrlAPI probe
3143 if test "$brlapi" != "no" ; then
3144 brlapi_libs="-lbrlapi"
3145 cat > $TMPC << EOF
3146 #include <brlapi.h>
3147 #include <stddef.h>
3148 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
3150 if compile_prog "" "$brlapi_libs" ; then
3151 brlapi=yes
3152 else
3153 if test "$brlapi" = "yes" ; then
3154 feature_not_found "brlapi" "Install brlapi devel"
3156 brlapi=no
3160 ##########################################
3161 # curses probe
3162 if test "$curses" != "no" ; then
3163 if test "$mingw32" = "yes" ; then
3164 curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
3165 curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
3166 else
3167 curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
3168 curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
3170 curses_found=no
3171 cat > $TMPC << EOF
3172 #include <locale.h>
3173 #include <curses.h>
3174 #include <wchar.h>
3175 int main(void) {
3176 wchar_t wch = L'w';
3177 setlocale(LC_ALL, "");
3178 resize_term(0, 0);
3179 addwstr(L"wide chars\n");
3180 addnwstr(&wch, 1);
3181 add_wch(WACS_DEGREE);
3182 return 0;
3185 IFS=:
3186 for curses_inc in $curses_inc_list; do
3187 # Make sure we get the wide character prototypes
3188 curses_inc="-DNCURSES_WIDECHAR $curses_inc"
3189 IFS=:
3190 for curses_lib in $curses_lib_list; do
3191 unset IFS
3192 if compile_prog "$curses_inc" "$curses_lib" ; then
3193 curses_found=yes
3194 QEMU_CFLAGS="$curses_inc $QEMU_CFLAGS"
3195 libs_softmmu="$curses_lib $libs_softmmu"
3196 break
3198 done
3199 if test "$curses_found" = yes ; then
3200 break
3202 done
3203 unset IFS
3204 if test "$curses_found" = "yes" ; then
3205 curses=yes
3206 else
3207 if test "$curses" = "yes" ; then
3208 feature_not_found "curses" "Install ncurses devel"
3210 curses=no
3214 ##########################################
3215 # curl probe
3216 if test "$curl" != "no" ; then
3217 if $pkg_config libcurl --exists; then
3218 curlconfig="$pkg_config libcurl"
3219 else
3220 curlconfig=curl-config
3222 cat > $TMPC << EOF
3223 #include <curl/curl.h>
3224 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
3226 curl_cflags=$($curlconfig --cflags 2>/dev/null)
3227 curl_libs=$($curlconfig --libs 2>/dev/null)
3228 if compile_prog "$curl_cflags" "$curl_libs" ; then
3229 curl=yes
3230 else
3231 if test "$curl" = "yes" ; then
3232 feature_not_found "curl" "Install libcurl devel"
3234 curl=no
3236 fi # test "$curl"
3238 ##########################################
3239 # bluez support probe
3240 if test "$bluez" != "no" ; then
3241 cat > $TMPC << EOF
3242 #include <bluetooth/bluetooth.h>
3243 int main(void) { return bt_error(0); }
3245 bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null)
3246 bluez_libs=$($pkg_config --libs bluez 2>/dev/null)
3247 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
3248 bluez=yes
3249 libs_softmmu="$bluez_libs $libs_softmmu"
3250 else
3251 if test "$bluez" = "yes" ; then
3252 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
3254 bluez="no"
3258 ##########################################
3259 # glib support probe
3261 if test "$mingw32" = yes; then
3262 glib_req_ver=2.30
3263 else
3264 glib_req_ver=2.22
3266 glib_modules=gthread-2.0
3267 if test "$modules" = yes; then
3268 glib_modules="$glib_modules gmodule-2.0"
3271 # This workaround is required due to a bug in pkg-config file for glib as it
3272 # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
3274 if test "$static" = yes -a "$mingw32" = yes; then
3275 QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS"
3278 for i in $glib_modules; do
3279 if $pkg_config --atleast-version=$glib_req_ver $i; then
3280 glib_cflags=$($pkg_config --cflags $i)
3281 glib_libs=$($pkg_config --libs $i)
3282 QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
3283 LIBS="$glib_libs $LIBS"
3284 libs_qga="$glib_libs $libs_qga"
3285 else
3286 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
3288 done
3290 # Sanity check that the current size_t matches the
3291 # size that glib thinks it should be. This catches
3292 # problems on multi-arch where people try to build
3293 # 32-bit QEMU while pointing at 64-bit glib headers
3294 cat > $TMPC <<EOF
3295 #include <glib.h>
3296 #include <unistd.h>
3298 #define QEMU_BUILD_BUG_ON(x) \
3299 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
3301 int main(void) {
3302 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
3303 return 0;
3307 if ! compile_prog "$CFLAGS" "$LIBS" ; then
3308 error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
3309 "You probably need to set PKG_CONFIG_LIBDIR"\
3310 "to point to the right pkg-config files for your"\
3311 "build target"
3314 # g_test_trap_subprocess added in 2.38. Used by some tests.
3315 glib_subprocess=yes
3316 if ! $pkg_config --atleast-version=2.38 glib-2.0; then
3317 glib_subprocess=no
3320 # Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage
3321 cat > $TMPC << EOF
3322 #include <glib.h>
3323 int main(void) { return 0; }
3325 if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
3326 if cc_has_warning_flag "-Wno-unknown-attributes"; then
3327 glib_cflags="-Wno-unknown-attributes $glib_cflags"
3328 CFLAGS="-Wno-unknown-attributes $CFLAGS"
3332 ##########################################
3333 # SHA command probe for modules
3334 if test "$modules" = yes; then
3335 shacmd_probe="sha1sum sha1 shasum"
3336 for c in $shacmd_probe; do
3337 if has $c; then
3338 shacmd="$c"
3339 break
3341 done
3342 if test "$shacmd" = ""; then
3343 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
3347 ##########################################
3348 # pixman support probe
3350 if test "$want_tools" = "no" -a "$softmmu" = "no"; then
3351 pixman_cflags=
3352 pixman_libs=
3353 elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
3354 pixman_cflags=$($pkg_config --cflags pixman-1)
3355 pixman_libs=$($pkg_config --libs pixman-1)
3356 else
3357 error_exit "pixman >= 0.21.8 not present." \
3358 "Please install the pixman devel package."
3361 ##########################################
3362 # libmpathpersist probe
3364 if test "$mpath" != "no" ; then
3365 cat > $TMPC <<EOF
3366 #include <libudev.h>
3367 #include <mpath_persist.h>
3368 unsigned mpath_mx_alloc_len = 1024;
3369 int logsink;
3370 static struct config *multipath_conf;
3371 extern struct udev *udev;
3372 extern struct config *get_multipath_config(void);
3373 extern void put_multipath_config(struct config *conf);
3374 struct udev *udev;
3375 struct config *get_multipath_config(void) { return multipath_conf; }
3376 void put_multipath_config(struct config *conf) { }
3378 int main(void) {
3379 udev = udev_new();
3380 multipath_conf = mpath_lib_init();
3381 return 0;
3384 if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then
3385 mpathpersist=yes
3386 else
3387 mpathpersist=no
3389 else
3390 mpathpersist=no
3393 ##########################################
3394 # libcap probe
3396 if test "$cap" != "no" ; then
3397 cat > $TMPC <<EOF
3398 #include <stdio.h>
3399 #include <sys/capability.h>
3400 int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
3402 if compile_prog "" "-lcap" ; then
3403 cap=yes
3404 else
3405 cap=no
3409 ##########################################
3410 # pthread probe
3411 PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
3413 pthread=no
3414 cat > $TMPC << EOF
3415 #include <pthread.h>
3416 static void *f(void *p) { return NULL; }
3417 int main(void) {
3418 pthread_t thread;
3419 pthread_create(&thread, 0, f, 0);
3420 return 0;
3423 if compile_prog "" "" ; then
3424 pthread=yes
3425 else
3426 for pthread_lib in $PTHREADLIBS_LIST; do
3427 if compile_prog "" "$pthread_lib" ; then
3428 pthread=yes
3429 found=no
3430 for lib_entry in $LIBS; do
3431 if test "$lib_entry" = "$pthread_lib"; then
3432 found=yes
3433 break
3435 done
3436 if test "$found" = "no"; then
3437 LIBS="$pthread_lib $LIBS"
3439 PTHREAD_LIB="$pthread_lib"
3440 break
3442 done
3445 if test "$mingw32" != yes -a "$pthread" = no; then
3446 error_exit "pthread check failed" \
3447 "Make sure to have the pthread libs and headers installed."
3450 # check for pthread_setname_np
3451 pthread_setname_np=no
3452 cat > $TMPC << EOF
3453 #include <pthread.h>
3455 static void *f(void *p) { return NULL; }
3456 int main(void)
3458 pthread_t thread;
3459 pthread_create(&thread, 0, f, 0);
3460 pthread_setname_np(thread, "QEMU");
3461 return 0;
3464 if compile_prog "" "$pthread_lib" ; then
3465 pthread_setname_np=yes
3468 ##########################################
3469 # rbd probe
3470 if test "$rbd" != "no" ; then
3471 cat > $TMPC <<EOF
3472 #include <stdio.h>
3473 #include <rbd/librbd.h>
3474 int main(void) {
3475 rados_t cluster;
3476 rados_create(&cluster, NULL);
3477 return 0;
3480 rbd_libs="-lrbd -lrados"
3481 if compile_prog "" "$rbd_libs" ; then
3482 rbd=yes
3483 else
3484 if test "$rbd" = "yes" ; then
3485 feature_not_found "rados block device" "Install librbd/ceph devel"
3487 rbd=no
3491 ##########################################
3492 # libssh2 probe
3493 min_libssh2_version=1.2.8
3494 if test "$libssh2" != "no" ; then
3495 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
3496 libssh2_cflags=$($pkg_config libssh2 --cflags)
3497 libssh2_libs=$($pkg_config libssh2 --libs)
3498 libssh2=yes
3499 else
3500 if test "$libssh2" = "yes" ; then
3501 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
3503 libssh2=no
3507 ##########################################
3508 # libssh2_sftp_fsync probe
3510 if test "$libssh2" = "yes"; then
3511 cat > $TMPC <<EOF
3512 #include <stdio.h>
3513 #include <libssh2.h>
3514 #include <libssh2_sftp.h>
3515 int main(void) {
3516 LIBSSH2_SESSION *session;
3517 LIBSSH2_SFTP *sftp;
3518 LIBSSH2_SFTP_HANDLE *sftp_handle;
3519 session = libssh2_session_init ();
3520 sftp = libssh2_sftp_init (session);
3521 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
3522 libssh2_sftp_fsync (sftp_handle);
3523 return 0;
3526 # libssh2_cflags/libssh2_libs defined in previous test.
3527 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
3528 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
3532 ##########################################
3533 # linux-aio probe
3535 if test "$linux_aio" != "no" ; then
3536 cat > $TMPC <<EOF
3537 #include <libaio.h>
3538 #include <sys/eventfd.h>
3539 #include <stddef.h>
3540 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
3542 if compile_prog "" "-laio" ; then
3543 linux_aio=yes
3544 else
3545 if test "$linux_aio" = "yes" ; then
3546 feature_not_found "linux AIO" "Install libaio devel"
3548 linux_aio=no
3552 ##########################################
3553 # TPM passthrough is only on x86 Linux
3555 if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
3556 tpm_passthrough=$tpm
3557 else
3558 tpm_passthrough=no
3561 # TPM emulator is for all posix systems
3562 if test "$mingw32" != "yes"; then
3563 tpm_emulator=$tpm
3564 else
3565 tpm_emulator=no
3567 ##########################################
3568 # attr probe
3570 if test "$attr" != "no" ; then
3571 cat > $TMPC <<EOF
3572 #include <stdio.h>
3573 #include <sys/types.h>
3574 #ifdef CONFIG_LIBATTR
3575 #include <attr/xattr.h>
3576 #else
3577 #include <sys/xattr.h>
3578 #endif
3579 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
3581 if compile_prog "" "" ; then
3582 attr=yes
3583 # Older distros have <attr/xattr.h>, and need -lattr:
3584 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
3585 attr=yes
3586 LIBS="-lattr $LIBS"
3587 libattr=yes
3588 else
3589 if test "$attr" = "yes" ; then
3590 feature_not_found "ATTR" "Install libc6 or libattr devel"
3592 attr=no
3596 ##########################################
3597 # iovec probe
3598 cat > $TMPC <<EOF
3599 #include <sys/types.h>
3600 #include <sys/uio.h>
3601 #include <unistd.h>
3602 int main(void) { return sizeof(struct iovec); }
3604 iovec=no
3605 if compile_prog "" "" ; then
3606 iovec=yes
3609 ##########################################
3610 # preadv probe
3611 cat > $TMPC <<EOF
3612 #include <sys/types.h>
3613 #include <sys/uio.h>
3614 #include <unistd.h>
3615 int main(void) { return preadv(0, 0, 0, 0); }
3617 preadv=no
3618 if compile_prog "" "" ; then
3619 preadv=yes
3622 ##########################################
3623 # fdt probe
3624 # fdt support is mandatory for at least some target architectures,
3625 # so insist on it if we're building those system emulators.
3626 fdt_required=no
3627 for target in $target_list; do
3628 case $target in
3629 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu)
3630 fdt_required=yes
3632 esac
3633 done
3635 if test "$fdt_required" = "yes"; then
3636 if test "$fdt" = "no"; then
3637 error_exit "fdt disabled but some requested targets require it." \
3638 "You can turn off fdt only if you also disable all the system emulation" \
3639 "targets which need it (by specifying a cut down --target-list)."
3641 fdt=yes
3644 if test "$fdt" != "no" ; then
3645 fdt_libs="-lfdt"
3646 # explicitly check for libfdt_env.h as it is missing in some stable installs
3647 # and test for required functions to make sure we are on a version >= 1.4.2
3648 cat > $TMPC << EOF
3649 #include <libfdt.h>
3650 #include <libfdt_env.h>
3651 int main(void) { fdt_first_subnode(0, 0); return 0; }
3653 if compile_prog "" "$fdt_libs" ; then
3654 # system DTC is good - use it
3655 fdt=yes
3656 else
3657 # have GIT checkout, so activate dtc submodule
3658 if test -e "${source_path}/.git" ; then
3659 git_submodules="${git_submodules} dtc"
3661 if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
3662 fdt=yes
3663 dtc_internal="yes"
3664 mkdir -p dtc
3665 if [ "$pwd_is_source_path" != "y" ] ; then
3666 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
3667 symlink "$source_path/dtc/scripts" "dtc/scripts"
3669 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
3670 fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
3671 elif test "$fdt" = "yes" ; then
3672 # Not a git build & no libfdt found, prompt for system install
3673 error_exit "DTC (libfdt) version >= 1.4.2 not present." \
3674 "Please install the DTC (libfdt) devel package"
3675 else
3676 # don't have and don't want
3677 fdt_libs=
3678 fdt=no
3683 libs_softmmu="$libs_softmmu $fdt_libs"
3685 ##########################################
3686 # opengl probe (for sdl2, gtk, milkymist-tmu2)
3688 if test "$opengl" != "no" ; then
3689 opengl_pkgs="epoxy libdrm gbm"
3690 if $pkg_config $opengl_pkgs x11; then
3691 opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
3692 opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
3693 opengl=yes
3694 if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
3695 gtk_gl="yes"
3697 QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
3698 else
3699 if test "$opengl" = "yes" ; then
3700 feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
3702 opengl_cflags=""
3703 opengl_libs=""
3704 opengl=no
3708 if test "$opengl" = "yes"; then
3709 cat > $TMPC << EOF
3710 #include <epoxy/egl.h>
3711 #ifndef EGL_MESA_image_dma_buf_export
3712 # error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
3713 #endif
3714 int main(void) { return 0; }
3716 if compile_prog "" "" ; then
3717 opengl_dmabuf=yes
3722 ##########################################
3723 # glusterfs probe
3724 if test "$glusterfs" != "no" ; then
3725 if $pkg_config --atleast-version=3 glusterfs-api; then
3726 glusterfs="yes"
3727 glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
3728 glusterfs_libs=$($pkg_config --libs glusterfs-api)
3729 if $pkg_config --atleast-version=4 glusterfs-api; then
3730 glusterfs_xlator_opt="yes"
3732 if $pkg_config --atleast-version=5 glusterfs-api; then
3733 glusterfs_discard="yes"
3735 if $pkg_config --atleast-version=6 glusterfs-api; then
3736 glusterfs_fallocate="yes"
3737 glusterfs_zerofill="yes"
3739 else
3740 if test "$glusterfs" = "yes" ; then
3741 feature_not_found "GlusterFS backend support" \
3742 "Install glusterfs-api devel >= 3"
3744 glusterfs="no"
3748 # Check for inotify functions when we are building linux-user
3749 # emulator. This is done because older glibc versions don't
3750 # have syscall stubs for these implemented. In that case we
3751 # don't provide them even if kernel supports them.
3753 inotify=no
3754 cat > $TMPC << EOF
3755 #include <sys/inotify.h>
3758 main(void)
3760 /* try to start inotify */
3761 return inotify_init();
3764 if compile_prog "" "" ; then
3765 inotify=yes
3768 inotify1=no
3769 cat > $TMPC << EOF
3770 #include <sys/inotify.h>
3773 main(void)
3775 /* try to start inotify */
3776 return inotify_init1(0);
3779 if compile_prog "" "" ; then
3780 inotify1=yes
3783 # check if pipe2 is there
3784 pipe2=no
3785 cat > $TMPC << EOF
3786 #include <unistd.h>
3787 #include <fcntl.h>
3789 int main(void)
3791 int pipefd[2];
3792 return pipe2(pipefd, O_CLOEXEC);
3795 if compile_prog "" "" ; then
3796 pipe2=yes
3799 # check if accept4 is there
3800 accept4=no
3801 cat > $TMPC << EOF
3802 #include <sys/socket.h>
3803 #include <stddef.h>
3805 int main(void)
3807 accept4(0, NULL, NULL, SOCK_CLOEXEC);
3808 return 0;
3811 if compile_prog "" "" ; then
3812 accept4=yes
3815 # check if tee/splice is there. vmsplice was added same time.
3816 splice=no
3817 cat > $TMPC << EOF
3818 #include <unistd.h>
3819 #include <fcntl.h>
3820 #include <limits.h>
3822 int main(void)
3824 int len, fd = 0;
3825 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
3826 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
3827 return 0;
3830 if compile_prog "" "" ; then
3831 splice=yes
3834 ##########################################
3835 # libnuma probe
3837 if test "$numa" != "no" ; then
3838 cat > $TMPC << EOF
3839 #include <numa.h>
3840 int main(void) { return numa_available(); }
3843 if compile_prog "" "-lnuma" ; then
3844 numa=yes
3845 libs_softmmu="-lnuma $libs_softmmu"
3846 else
3847 if test "$numa" = "yes" ; then
3848 feature_not_found "numa" "install numactl devel"
3850 numa=no
3854 if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
3855 echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
3856 exit 1
3859 ##########################################
3860 # tcmalloc probe
3862 if test "$tcmalloc" = "yes" ; then
3863 cat > $TMPC << EOF
3864 #include <stdlib.h>
3865 int main(void) { malloc(1); return 0; }
3868 if compile_prog "" "-ltcmalloc" ; then
3869 LIBS="-ltcmalloc $LIBS"
3870 else
3871 feature_not_found "tcmalloc" "install gperftools devel"
3875 ##########################################
3876 # jemalloc probe
3878 if test "$jemalloc" = "yes" ; then
3879 cat > $TMPC << EOF
3880 #include <stdlib.h>
3881 int main(void) { malloc(1); return 0; }
3884 if compile_prog "" "-ljemalloc" ; then
3885 LIBS="-ljemalloc $LIBS"
3886 else
3887 feature_not_found "jemalloc" "install jemalloc devel"
3891 ##########################################
3892 # signalfd probe
3893 signalfd="no"
3894 cat > $TMPC << EOF
3895 #include <unistd.h>
3896 #include <sys/syscall.h>
3897 #include <signal.h>
3898 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
3901 if compile_prog "" "" ; then
3902 signalfd=yes
3905 # check if eventfd is supported
3906 eventfd=no
3907 cat > $TMPC << EOF
3908 #include <sys/eventfd.h>
3910 int main(void)
3912 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
3915 if compile_prog "" "" ; then
3916 eventfd=yes
3919 # check if memfd is supported
3920 memfd=no
3921 cat > $TMPC << EOF
3922 #include <sys/memfd.h>
3924 int main(void)
3926 return memfd_create("foo", MFD_ALLOW_SEALING);
3929 if compile_prog "" "" ; then
3930 memfd=yes
3935 # check for fallocate
3936 fallocate=no
3937 cat > $TMPC << EOF
3938 #include <fcntl.h>
3940 int main(void)
3942 fallocate(0, 0, 0, 0);
3943 return 0;
3946 if compile_prog "" "" ; then
3947 fallocate=yes
3950 # check for fallocate hole punching
3951 fallocate_punch_hole=no
3952 cat > $TMPC << EOF
3953 #include <fcntl.h>
3954 #include <linux/falloc.h>
3956 int main(void)
3958 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
3959 return 0;
3962 if compile_prog "" "" ; then
3963 fallocate_punch_hole=yes
3966 # check that fallocate supports range zeroing inside the file
3967 fallocate_zero_range=no
3968 cat > $TMPC << EOF
3969 #include <fcntl.h>
3970 #include <linux/falloc.h>
3972 int main(void)
3974 fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0);
3975 return 0;
3978 if compile_prog "" "" ; then
3979 fallocate_zero_range=yes
3982 # check for posix_fallocate
3983 posix_fallocate=no
3984 cat > $TMPC << EOF
3985 #include <fcntl.h>
3987 int main(void)
3989 posix_fallocate(0, 0, 0);
3990 return 0;
3993 if compile_prog "" "" ; then
3994 posix_fallocate=yes
3997 # check for sync_file_range
3998 sync_file_range=no
3999 cat > $TMPC << EOF
4000 #include <fcntl.h>
4002 int main(void)
4004 sync_file_range(0, 0, 0, 0);
4005 return 0;
4008 if compile_prog "" "" ; then
4009 sync_file_range=yes
4012 # check for linux/fiemap.h and FS_IOC_FIEMAP
4013 fiemap=no
4014 cat > $TMPC << EOF
4015 #include <sys/ioctl.h>
4016 #include <linux/fs.h>
4017 #include <linux/fiemap.h>
4019 int main(void)
4021 ioctl(0, FS_IOC_FIEMAP, 0);
4022 return 0;
4025 if compile_prog "" "" ; then
4026 fiemap=yes
4029 # check for dup3
4030 dup3=no
4031 cat > $TMPC << EOF
4032 #include <unistd.h>
4034 int main(void)
4036 dup3(0, 0, 0);
4037 return 0;
4040 if compile_prog "" "" ; then
4041 dup3=yes
4044 # check for ppoll support
4045 ppoll=no
4046 cat > $TMPC << EOF
4047 #include <poll.h>
4049 int main(void)
4051 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
4052 ppoll(&pfd, 1, 0, 0);
4053 return 0;
4056 if compile_prog "" "" ; then
4057 ppoll=yes
4060 # check for prctl(PR_SET_TIMERSLACK , ... ) support
4061 prctl_pr_set_timerslack=no
4062 cat > $TMPC << EOF
4063 #include <sys/prctl.h>
4065 int main(void)
4067 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
4068 return 0;
4071 if compile_prog "" "" ; then
4072 prctl_pr_set_timerslack=yes
4075 # check for epoll support
4076 epoll=no
4077 cat > $TMPC << EOF
4078 #include <sys/epoll.h>
4080 int main(void)
4082 epoll_create(0);
4083 return 0;
4086 if compile_prog "" "" ; then
4087 epoll=yes
4090 # epoll_create1 is a later addition
4091 # so we must check separately for its presence
4092 epoll_create1=no
4093 cat > $TMPC << EOF
4094 #include <sys/epoll.h>
4096 int main(void)
4098 /* Note that we use epoll_create1 as a value, not as
4099 * a function being called. This is necessary so that on
4100 * old SPARC glibc versions where the function was present in
4101 * the library but not declared in the header file we will
4102 * fail the configure check. (Otherwise we will get a compiler
4103 * warning but not an error, and will proceed to fail the
4104 * qemu compile where we compile with -Werror.)
4106 return (int)(uintptr_t)&epoll_create1;
4109 if compile_prog "" "" ; then
4110 epoll_create1=yes
4113 # check for sendfile support
4114 sendfile=no
4115 cat > $TMPC << EOF
4116 #include <sys/sendfile.h>
4118 int main(void)
4120 return sendfile(0, 0, 0, 0);
4123 if compile_prog "" "" ; then
4124 sendfile=yes
4127 # check for timerfd support (glibc 2.8 and newer)
4128 timerfd=no
4129 cat > $TMPC << EOF
4130 #include <sys/timerfd.h>
4132 int main(void)
4134 return(timerfd_create(CLOCK_REALTIME, 0));
4137 if compile_prog "" "" ; then
4138 timerfd=yes
4141 # check for setns and unshare support
4142 setns=no
4143 cat > $TMPC << EOF
4144 #include <sched.h>
4146 int main(void)
4148 int ret;
4149 ret = setns(0, 0);
4150 ret = unshare(0);
4151 return ret;
4154 if compile_prog "" "" ; then
4155 setns=yes
4158 # clock_adjtime probe
4159 clock_adjtime=no
4160 cat > $TMPC <<EOF
4161 #include <time.h>
4163 int main(void)
4165 return clock_adjtime(0, 0);
4168 clock_adjtime=no
4169 if compile_prog "" "" ; then
4170 clock_adjtime=yes
4173 # syncfs probe
4174 syncfs=no
4175 cat > $TMPC <<EOF
4176 #include <unistd.h>
4178 int main(void)
4180 return syncfs(0);
4183 syncfs=no
4184 if compile_prog "" "" ; then
4185 syncfs=yes
4188 # Check if tools are available to build documentation.
4189 if test "$docs" != "no" ; then
4190 if has makeinfo && has pod2man; then
4191 docs=yes
4192 else
4193 if test "$docs" = "yes" ; then
4194 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
4196 docs=no
4200 # Search for bswap_32 function
4201 byteswap_h=no
4202 cat > $TMPC << EOF
4203 #include <byteswap.h>
4204 int main(void) { return bswap_32(0); }
4206 if compile_prog "" "" ; then
4207 byteswap_h=yes
4210 # Search for bswap32 function
4211 bswap_h=no
4212 cat > $TMPC << EOF
4213 #include <sys/endian.h>
4214 #include <sys/types.h>
4215 #include <machine/bswap.h>
4216 int main(void) { return bswap32(0); }
4218 if compile_prog "" "" ; then
4219 bswap_h=yes
4222 ##########################################
4223 # Do we have libiscsi >= 1.9.0
4224 if test "$libiscsi" != "no" ; then
4225 if $pkg_config --atleast-version=1.9.0 libiscsi; then
4226 libiscsi="yes"
4227 libiscsi_cflags=$($pkg_config --cflags libiscsi)
4228 libiscsi_libs=$($pkg_config --libs libiscsi)
4229 else
4230 if test "$libiscsi" = "yes" ; then
4231 feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
4233 libiscsi="no"
4237 ##########################################
4238 # Do we need libm
4239 cat > $TMPC << EOF
4240 #include <math.h>
4241 int main(int argc, char **argv) { return isnan(sin((double)argc)); }
4243 if compile_prog "" "" ; then
4245 elif compile_prog "" "-lm" ; then
4246 LIBS="-lm $LIBS"
4247 libs_qga="-lm $libs_qga"
4248 else
4249 error_exit "libm check failed"
4252 ##########################################
4253 # Do we need librt
4254 # uClibc provides 2 versions of clock_gettime(), one with realtime
4255 # support and one without. This means that the clock_gettime() don't
4256 # need -lrt. We still need it for timer_create() so we check for this
4257 # function in addition.
4258 cat > $TMPC <<EOF
4259 #include <signal.h>
4260 #include <time.h>
4261 int main(void) {
4262 timer_create(CLOCK_REALTIME, NULL, NULL);
4263 return clock_gettime(CLOCK_REALTIME, NULL);
4267 if compile_prog "" "" ; then
4269 # we need pthread for static linking. use previous pthread test result
4270 elif compile_prog "" "$pthread_lib -lrt" ; then
4271 LIBS="$LIBS -lrt"
4272 libs_qga="$libs_qga -lrt"
4275 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
4276 "$haiku" != "yes" ; then
4277 libs_softmmu="-lutil $libs_softmmu"
4280 ##########################################
4281 # spice probe
4282 if test "$spice" != "no" ; then
4283 cat > $TMPC << EOF
4284 #include <spice.h>
4285 int main(void) { spice_server_new(); return 0; }
4287 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
4288 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
4289 if $pkg_config --atleast-version=0.12.0 spice-server && \
4290 $pkg_config --atleast-version=0.12.3 spice-protocol && \
4291 compile_prog "$spice_cflags" "$spice_libs" ; then
4292 spice="yes"
4293 libs_softmmu="$libs_softmmu $spice_libs"
4294 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
4295 spice_protocol_version=$($pkg_config --modversion spice-protocol)
4296 spice_server_version=$($pkg_config --modversion spice-server)
4297 else
4298 if test "$spice" = "yes" ; then
4299 feature_not_found "spice" \
4300 "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel"
4302 spice="no"
4306 # check for smartcard support
4307 if test "$smartcard" != "no"; then
4308 if $pkg_config libcacard; then
4309 libcacard_cflags=$($pkg_config --cflags libcacard)
4310 libcacard_libs=$($pkg_config --libs libcacard)
4311 smartcard="yes"
4312 else
4313 if test "$smartcard" = "yes"; then
4314 feature_not_found "smartcard" "Install libcacard devel"
4316 smartcard="no"
4320 # check for libusb
4321 if test "$libusb" != "no" ; then
4322 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
4323 libusb="yes"
4324 libusb_cflags=$($pkg_config --cflags libusb-1.0)
4325 libusb_libs=$($pkg_config --libs libusb-1.0)
4326 else
4327 if test "$libusb" = "yes"; then
4328 feature_not_found "libusb" "Install libusb devel >= 1.0.13"
4330 libusb="no"
4334 # check for usbredirparser for usb network redirection support
4335 if test "$usb_redir" != "no" ; then
4336 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
4337 usb_redir="yes"
4338 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
4339 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
4340 else
4341 if test "$usb_redir" = "yes"; then
4342 feature_not_found "usb-redir" "Install usbredir devel"
4344 usb_redir="no"
4348 ##########################################
4349 # check if we have VSS SDK headers for win
4351 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
4352 case "$vss_win32_sdk" in
4353 "") vss_win32_include="-isystem $source_path" ;;
4354 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
4355 # handle path with spaces. So we symlink the headers into ".sdk/vss".
4356 vss_win32_include="-isystem $source_path/.sdk/vss"
4357 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
4359 *) vss_win32_include="-isystem $vss_win32_sdk"
4360 esac
4361 cat > $TMPC << EOF
4362 #define __MIDL_user_allocate_free_DEFINED__
4363 #include <inc/win2003/vss.h>
4364 int main(void) { return VSS_CTX_BACKUP; }
4366 if compile_prog "$vss_win32_include" "" ; then
4367 guest_agent_with_vss="yes"
4368 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
4369 libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
4370 qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
4371 else
4372 if test "$vss_win32_sdk" != "" ; then
4373 echo "ERROR: Please download and install Microsoft VSS SDK:"
4374 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
4375 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
4376 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
4377 echo "ERROR: The headers are extracted in the directory \`inc'."
4378 feature_not_found "VSS support"
4380 guest_agent_with_vss="no"
4384 ##########################################
4385 # lookup Windows platform SDK (if not specified)
4386 # The SDK is needed only to build .tlb (type library) file of guest agent
4387 # VSS provider from the source. It is usually unnecessary because the
4388 # pre-compiled .tlb file is included.
4390 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
4391 if test -z "$win_sdk"; then
4392 programfiles="$PROGRAMFILES"
4393 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
4394 if test -n "$programfiles"; then
4395 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
4396 else
4397 feature_not_found "Windows SDK"
4399 elif test "$win_sdk" = "no"; then
4400 win_sdk=""
4404 ##########################################
4405 # check if mingw environment provides a recent ntddscsi.h
4406 if test "$mingw32" = "yes" -a "$guest_agent" != "no"; then
4407 cat > $TMPC << EOF
4408 #include <windows.h>
4409 #include <ntddscsi.h>
4410 int main(void) {
4411 #if !defined(IOCTL_SCSI_GET_ADDRESS)
4412 #error Missing required ioctl definitions
4413 #endif
4414 SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
4415 return addr.Lun;
4418 if compile_prog "" "" ; then
4419 guest_agent_ntddscsi=yes
4420 libs_qga="-lsetupapi $libs_qga"
4424 ##########################################
4425 # virgl renderer probe
4427 if test "$virglrenderer" != "no" ; then
4428 cat > $TMPC << EOF
4429 #include <virglrenderer.h>
4430 int main(void) { virgl_renderer_poll(); return 0; }
4432 virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null)
4433 virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null)
4434 if $pkg_config virglrenderer >/dev/null 2>&1 && \
4435 compile_prog "$virgl_cflags" "$virgl_libs" ; then
4436 virglrenderer="yes"
4437 else
4438 if test "$virglrenderer" = "yes" ; then
4439 feature_not_found "virglrenderer"
4441 virglrenderer="no"
4445 ##########################################
4446 # capstone
4448 case "$capstone" in
4449 "" | yes)
4450 if $pkg_config capstone; then
4451 capstone=system
4452 elif test -e "${source_path}/.git" ; then
4453 capstone=git
4454 elif test -e "${source_path}/capstone/Makefile" ; then
4455 capstone=internal
4456 elif test -z "$capstone" ; then
4457 capstone=no
4458 else
4459 feature_not_found "capstone" "Install capstone devel or git submodule"
4463 system)
4464 if ! $pkg_config capstone; then
4465 feature_not_found "capstone" "Install capstone devel"
4468 esac
4470 case "$capstone" in
4471 git | internal)
4472 if test "$capstone" = git; then
4473 git_submodules="${git_submodules} capstone"
4475 mkdir -p capstone
4476 QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include"
4477 if test "$mingw32" = "yes"; then
4478 LIBCAPSTONE=capstone.lib
4479 else
4480 LIBCAPSTONE=libcapstone.a
4482 LIBS="-L\$(BUILD_DIR)/capstone -lcapstone $LIBS"
4485 system)
4486 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)"
4487 LIBS="$($pkg_config --libs capstone) $LIBS"
4493 error_exit "Unknown state for capstone: $capstone"
4495 esac
4497 ##########################################
4498 # check if we have fdatasync
4500 fdatasync=no
4501 cat > $TMPC << EOF
4502 #include <unistd.h>
4503 int main(void) {
4504 #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
4505 return fdatasync(0);
4506 #else
4507 #error Not supported
4508 #endif
4511 if compile_prog "" "" ; then
4512 fdatasync=yes
4515 ##########################################
4516 # check if we have madvise
4518 madvise=no
4519 cat > $TMPC << EOF
4520 #include <sys/types.h>
4521 #include <sys/mman.h>
4522 #include <stddef.h>
4523 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
4525 if compile_prog "" "" ; then
4526 madvise=yes
4529 ##########################################
4530 # check if we have posix_madvise
4532 posix_madvise=no
4533 cat > $TMPC << EOF
4534 #include <sys/mman.h>
4535 #include <stddef.h>
4536 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
4538 if compile_prog "" "" ; then
4539 posix_madvise=yes
4542 ##########################################
4543 # check if we have posix_syslog
4545 posix_syslog=no
4546 cat > $TMPC << EOF
4547 #include <syslog.h>
4548 int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; }
4550 if compile_prog "" "" ; then
4551 posix_syslog=yes
4554 ##########################################
4555 # check if we have sem_timedwait
4557 sem_timedwait=no
4558 cat > $TMPC << EOF
4559 #include <semaphore.h>
4560 int main(void) { return sem_timedwait(0, 0); }
4562 if compile_prog "" "" ; then
4563 sem_timedwait=yes
4566 ##########################################
4567 # check if trace backend exists
4569 $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
4570 if test "$?" -ne 0 ; then
4571 error_exit "invalid trace backends" \
4572 "Please choose supported trace backends."
4575 ##########################################
4576 # For 'ust' backend, test if ust headers are present
4577 if have_backend "ust"; then
4578 cat > $TMPC << EOF
4579 #include <lttng/tracepoint.h>
4580 int main(void) { return 0; }
4582 if compile_prog "" "-Wl,--no-as-needed -ldl" ; then
4583 if $pkg_config lttng-ust --exists; then
4584 lttng_ust_libs=$($pkg_config --libs lttng-ust)
4585 else
4586 lttng_ust_libs="-llttng-ust -ldl"
4588 if $pkg_config liburcu-bp --exists; then
4589 urcu_bp_libs=$($pkg_config --libs liburcu-bp)
4590 else
4591 urcu_bp_libs="-lurcu-bp"
4594 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
4595 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
4596 else
4597 error_exit "Trace backend 'ust' missing lttng-ust header files"
4601 ##########################################
4602 # For 'dtrace' backend, test if 'dtrace' command is present
4603 if have_backend "dtrace"; then
4604 if ! has 'dtrace' ; then
4605 error_exit "dtrace command is not found in PATH $PATH"
4607 trace_backend_stap="no"
4608 if has 'stap' ; then
4609 trace_backend_stap="yes"
4613 ##########################################
4614 # check and set a backend for coroutine
4616 # We prefer ucontext, but it's not always possible. The fallback
4617 # is sigcontext. On Windows the only valid backend is the Windows
4618 # specific one.
4620 ucontext_works=no
4621 if test "$darwin" != "yes"; then
4622 cat > $TMPC << EOF
4623 #include <ucontext.h>
4624 #ifdef __stub_makecontext
4625 #error Ignoring glibc stub makecontext which will always fail
4626 #endif
4627 int main(void) { makecontext(0, 0, 0); return 0; }
4629 if compile_prog "" "" ; then
4630 ucontext_works=yes
4634 if test "$coroutine" = ""; then
4635 if test "$mingw32" = "yes"; then
4636 coroutine=win32
4637 elif test "$ucontext_works" = "yes"; then
4638 coroutine=ucontext
4639 else
4640 coroutine=sigaltstack
4642 else
4643 case $coroutine in
4644 windows)
4645 if test "$mingw32" != "yes"; then
4646 error_exit "'windows' coroutine backend only valid for Windows"
4648 # Unfortunately the user visible backend name doesn't match the
4649 # coroutine-*.c filename for this case, so we have to adjust it here.
4650 coroutine=win32
4652 ucontext)
4653 if test "$ucontext_works" != "yes"; then
4654 feature_not_found "ucontext"
4657 sigaltstack)
4658 if test "$mingw32" = "yes"; then
4659 error_exit "only the 'windows' coroutine backend is valid for Windows"
4663 error_exit "unknown coroutine backend $coroutine"
4665 esac
4668 if test "$coroutine_pool" = ""; then
4669 coroutine_pool=yes
4672 if test "$debug_stack_usage" = "yes"; then
4673 if test "$cpu" = "ia64" -o "$cpu" = "hppa"; then
4674 error_exit "stack usage debugging is not supported for $cpu"
4676 if test "$coroutine_pool" = "yes"; then
4677 echo "WARN: disabling coroutine pool for stack usage debugging"
4678 coroutine_pool=no
4683 ##########################################
4684 # check if we have open_by_handle_at
4686 open_by_handle_at=no
4687 cat > $TMPC << EOF
4688 #include <fcntl.h>
4689 #if !defined(AT_EMPTY_PATH)
4690 # error missing definition
4691 #else
4692 int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
4693 #endif
4695 if compile_prog "" "" ; then
4696 open_by_handle_at=yes
4699 ########################################
4700 # check if we have linux/magic.h
4702 linux_magic_h=no
4703 cat > $TMPC << EOF
4704 #include <linux/magic.h>
4705 int main(void) {
4706 return 0;
4709 if compile_prog "" "" ; then
4710 linux_magic_h=yes
4713 ########################################
4714 # check whether we can disable warning option with a pragma (this is needed
4715 # to silence warnings in the headers of some versions of external libraries).
4716 # This test has to be compiled with -Werror as otherwise an unknown pragma is
4717 # only a warning.
4719 # If we can't selectively disable warning in the code, disable -Werror so that
4720 # the build doesn't fail anyway.
4722 pragma_disable_unused_but_set=no
4723 cat > $TMPC << EOF
4724 #pragma GCC diagnostic push
4725 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
4726 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
4727 #pragma GCC diagnostic pop
4729 int main(void) {
4730 return 0;
4733 if compile_prog "-Werror" "" ; then
4734 pragma_diagnostic_available=yes
4735 else
4736 werror=no
4739 ########################################
4740 # check if we have valgrind/valgrind.h
4742 valgrind_h=no
4743 cat > $TMPC << EOF
4744 #include <valgrind/valgrind.h>
4745 int main(void) {
4746 return 0;
4749 if compile_prog "" "" ; then
4750 valgrind_h=yes
4753 ########################################
4754 # check if environ is declared
4756 has_environ=no
4757 cat > $TMPC << EOF
4758 #include <unistd.h>
4759 int main(void) {
4760 environ = 0;
4761 return 0;
4764 if compile_prog "" "" ; then
4765 has_environ=yes
4768 ########################################
4769 # check if cpuid.h is usable.
4771 cat > $TMPC << EOF
4772 #include <cpuid.h>
4773 int main(void) {
4774 unsigned a, b, c, d;
4775 int max = __get_cpuid_max(0, 0);
4777 if (max >= 1) {
4778 __cpuid(1, a, b, c, d);
4781 if (max >= 7) {
4782 __cpuid_count(7, 0, a, b, c, d);
4785 return 0;
4788 if compile_prog "" "" ; then
4789 cpuid_h=yes
4792 ##########################################
4793 # avx2 optimization requirement check
4795 # There is no point enabling this if cpuid.h is not usable,
4796 # since we won't be able to select the new routines.
4798 if test $cpuid_h = yes; then
4799 cat > $TMPC << EOF
4800 #pragma GCC push_options
4801 #pragma GCC target("avx2")
4802 #include <cpuid.h>
4803 #include <immintrin.h>
4804 static int bar(void *a) {
4805 __m256i x = *(__m256i *)a;
4806 return _mm256_testz_si256(x, x);
4808 int main(int argc, char *argv[]) { return bar(argv[0]); }
4810 if compile_object "" ; then
4811 avx2_opt="yes"
4815 ########################################
4816 # check if __[u]int128_t is usable.
4818 int128=no
4819 cat > $TMPC << EOF
4820 #if defined(__clang_major__) && defined(__clang_minor__)
4821 # if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
4822 # error __int128_t does not work in CLANG before 3.2
4823 # endif
4824 #endif
4825 __int128_t a;
4826 __uint128_t b;
4827 int main (void) {
4828 a = a + b;
4829 b = a * b;
4830 a = a * a;
4831 return 0;
4834 if compile_prog "" "" ; then
4835 int128=yes
4838 #########################################
4839 # See if 128-bit atomic operations are supported.
4841 atomic128=no
4842 if test "$int128" = "yes"; then
4843 cat > $TMPC << EOF
4844 int main(void)
4846 unsigned __int128 x = 0, y = 0;
4847 y = __atomic_load_16(&x, 0);
4848 __atomic_store_16(&x, y, 0);
4849 __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0);
4850 return 0;
4853 if compile_prog "" "" ; then
4854 atomic128=yes
4858 #########################################
4859 # See if 64-bit atomic operations are supported.
4860 # Note that without __atomic builtins, we can only
4861 # assume atomic loads/stores max at pointer size.
4863 cat > $TMPC << EOF
4864 #include <stdint.h>
4865 int main(void)
4867 uint64_t x = 0, y = 0;
4868 #ifdef __ATOMIC_RELAXED
4869 y = __atomic_load_8(&x, 0);
4870 __atomic_store_8(&x, y, 0);
4871 __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
4872 __atomic_exchange_8(&x, y, 0);
4873 __atomic_fetch_add_8(&x, y, 0);
4874 #else
4875 typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
4876 __sync_lock_test_and_set(&x, y);
4877 __sync_val_compare_and_swap(&x, y, 0);
4878 __sync_fetch_and_add(&x, y);
4879 #endif
4880 return 0;
4883 if compile_prog "" "" ; then
4884 atomic64=yes
4887 ########################################
4888 # check if getauxval is available.
4890 getauxval=no
4891 cat > $TMPC << EOF
4892 #include <sys/auxv.h>
4893 int main(void) {
4894 return getauxval(AT_HWCAP) == 0;
4897 if compile_prog "" "" ; then
4898 getauxval=yes
4901 ########################################
4902 # check if ccache is interfering with
4903 # semantic analysis of macros
4905 unset CCACHE_CPP2
4906 ccache_cpp2=no
4907 cat > $TMPC << EOF
4908 static const int Z = 1;
4909 #define fn() ({ Z; })
4910 #define TAUT(X) ((X) == Z)
4911 #define PAREN(X, Y) (X == Y)
4912 #define ID(X) (X)
4913 int main(int argc, char *argv[])
4915 int x = 0, y = 0;
4916 x = ID(x);
4917 x = fn();
4918 fn();
4919 if (PAREN(x, y)) return 0;
4920 if (TAUT(Z)) return 0;
4921 return 0;
4925 if ! compile_object "-Werror"; then
4926 ccache_cpp2=yes
4929 #################################################
4930 # clang does not support glibc + FORTIFY_SOURCE.
4932 if test "$fortify_source" != "no"; then
4933 if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
4934 fortify_source="no";
4935 elif test -n "$cxx" && has $cxx &&
4936 echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then
4937 fortify_source="no";
4938 else
4939 fortify_source="yes"
4943 ##########################################
4944 # check if struct fsxattr is available via linux/fs.h
4946 have_fsxattr=no
4947 cat > $TMPC << EOF
4948 #include <linux/fs.h>
4949 struct fsxattr foo;
4950 int main(void) {
4951 return 0;
4954 if compile_prog "" "" ; then
4955 have_fsxattr=yes
4958 ##########################################
4959 # check if rtnetlink.h exists and is useful
4960 have_rtnetlink=no
4961 cat > $TMPC << EOF
4962 #include <linux/rtnetlink.h>
4963 int main(void) {
4964 return IFLA_PROTO_DOWN;
4967 if compile_prog "" "" ; then
4968 have_rtnetlink=yes
4971 ##########################################
4972 # check for usable AF_VSOCK environment
4973 have_af_vsock=no
4974 cat > $TMPC << EOF
4975 #include <errno.h>
4976 #include <sys/types.h>
4977 #include <sys/socket.h>
4978 #if !defined(AF_VSOCK)
4979 # error missing AF_VSOCK flag
4980 #endif
4981 #include <linux/vm_sockets.h>
4982 int main(void) {
4983 int sock, ret;
4984 struct sockaddr_vm svm;
4985 socklen_t len = sizeof(svm);
4986 sock = socket(AF_VSOCK, SOCK_STREAM, 0);
4987 ret = getpeername(sock, (struct sockaddr *)&svm, &len);
4988 if ((ret == -1) && (errno == ENOTCONN)) {
4989 return 0;
4991 return -1;
4994 if compile_prog "" "" ; then
4995 have_af_vsock=yes
4998 ##########################################
4999 # check for usable AF_ALG environment
5000 hava_afalg=no
5001 cat > $TMPC << EOF
5002 #include <errno.h>
5003 #include <sys/types.h>
5004 #include <sys/socket.h>
5005 #include <linux/if_alg.h>
5006 int main(void) {
5007 int sock;
5008 sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
5009 return sock;
5012 if compile_prog "" "" ; then
5013 have_afalg=yes
5015 if test "$crypto_afalg" = "yes"
5016 then
5017 if test "$have_afalg" != "yes"
5018 then
5019 error_exit "AF_ALG requested but could not be detected"
5024 #################################################
5025 # Sparc implicitly links with --relax, which is
5026 # incompatible with -r, so --no-relax should be
5027 # given. It does no harm to give it on other
5028 # platforms too.
5030 # Note: the prototype is needed since QEMU_CFLAGS
5031 # contains -Wmissing-prototypes
5032 cat > $TMPC << EOF
5033 extern int foo(void);
5034 int foo(void) { return 0; }
5036 if ! compile_object ""; then
5037 error_exit "Failed to compile object file for LD_REL_FLAGS test"
5039 for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do
5040 if do_cc -nostdlib $i -o $TMPMO $TMPO; then
5041 LD_REL_FLAGS=$i
5042 break
5044 done
5045 if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then
5046 feature_not_found "modules" "Cannot find how to build relocatable objects"
5049 ##########################################
5050 # check for sysmacros.h
5052 have_sysmacros=no
5053 cat > $TMPC << EOF
5054 #include <sys/sysmacros.h>
5055 int main(void) {
5056 return makedev(0, 0);
5059 if compile_prog "" "" ; then
5060 have_sysmacros=yes
5063 ##########################################
5064 # Veritas HyperScale block driver VxHS
5065 # Check if libvxhs is installed
5067 if test "$vxhs" != "no" ; then
5068 cat > $TMPC <<EOF
5069 #include <stdint.h>
5070 #include <qnio/qnio_api.h>
5072 void *vxhs_callback;
5074 int main(void) {
5075 iio_init(QNIO_VERSION, vxhs_callback);
5076 return 0;
5079 vxhs_libs="-lvxhs -lssl"
5080 if compile_prog "" "$vxhs_libs" ; then
5081 vxhs=yes
5082 else
5083 if test "$vxhs" = "yes" ; then
5084 feature_not_found "vxhs block device" "Install libvxhs See github"
5086 vxhs=no
5090 ##########################################
5091 # check for _Static_assert()
5093 have_static_assert=no
5094 cat > $TMPC << EOF
5095 _Static_assert(1, "success");
5096 int main(void) {
5097 return 0;
5100 if compile_prog "" "" ; then
5101 have_static_assert=yes
5104 ##########################################
5105 # check for utmpx.h, it is missing e.g. on OpenBSD
5107 have_utmpx=no
5108 cat > $TMPC << EOF
5109 #include <utmpx.h>
5110 struct utmpx user_info;
5111 int main(void) {
5112 return 0;
5115 if compile_prog "" "" ; then
5116 have_utmpx=yes
5119 ##########################################
5120 # End of CC checks
5121 # After here, no more $cc or $ld runs
5123 if test "$gcov" = "yes" ; then
5124 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
5125 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
5126 elif test "$fortify_source" = "yes" ; then
5127 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
5128 elif test "$debug" = "no"; then
5129 CFLAGS="-O2 $CFLAGS"
5132 ##########################################
5133 # Do we have libnfs
5134 if test "$libnfs" != "no" ; then
5135 if $pkg_config --atleast-version=1.9.3 libnfs; then
5136 libnfs="yes"
5137 libnfs_libs=$($pkg_config --libs libnfs)
5138 else
5139 if test "$libnfs" = "yes" ; then
5140 feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
5142 libnfs="no"
5146 # Now we've finished running tests it's OK to add -Werror to the compiler flags
5147 if test "$werror" = "yes"; then
5148 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
5151 if test "$solaris" = "no" ; then
5152 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
5153 LDFLAGS="-Wl,--warn-common $LDFLAGS"
5157 # test if pod2man has --utf8 option
5158 if pod2man --help | grep -q utf8; then
5159 POD2MAN="pod2man --utf8"
5160 else
5161 POD2MAN="pod2man"
5164 # Use ASLR, no-SEH and DEP if available
5165 if test "$mingw32" = "yes" ; then
5166 for flag in --dynamicbase --no-seh --nxcompat; do
5167 if ld_has $flag ; then
5168 LDFLAGS="-Wl,$flag $LDFLAGS"
5170 done
5173 qemu_confdir=$sysconfdir$confsuffix
5174 qemu_moddir=$libdir$confsuffix
5175 qemu_datadir=$datadir$confsuffix
5176 qemu_localedir="$datadir/locale"
5178 # We can only support ivshmem if we have eventfd
5179 if [ "$eventfd" = "yes" ]; then
5180 ivshmem=yes
5183 tools=""
5184 if test "$want_tools" = "yes" ; then
5185 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
5186 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
5187 tools="qemu-nbd\$(EXESUF) $tools"
5189 if [ "$ivshmem" = "yes" ]; then
5190 tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools"
5193 if test "$softmmu" = yes ; then
5194 if test "$linux" = yes; then
5195 if test "$virtfs" != no && test "$cap" = yes && test "$attr" = yes ; then
5196 virtfs=yes
5197 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
5198 else
5199 if test "$virtfs" = yes; then
5200 error_exit "VirtFS requires libcap devel and libattr devel"
5202 virtfs=no
5204 if test "$mpath" != no && test "$mpathpersist" = yes ; then
5205 mpath=yes
5206 else
5207 if test "$mpath" = yes; then
5208 error_exit "Multipath requires libmpathpersist devel"
5210 mpath=no
5212 tools="$tools scsi/qemu-pr-helper\$(EXESUF)"
5213 else
5214 if test "$virtfs" = yes; then
5215 error_exit "VirtFS is supported only on Linux"
5217 virtfs=no
5218 if test "$mpath" = yes; then
5219 error_exit "Multipath is supported only on Linux"
5221 mpath=no
5223 if test "$xkbcommon" = "yes"; then
5224 tools="qemu-keymap\$(EXESUF) $tools"
5228 # Probe for guest agent support/options
5230 if [ "$guest_agent" != "no" ]; then
5231 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
5232 tools="qemu-ga $tools"
5233 guest_agent=yes
5234 elif [ "$guest_agent" != yes ]; then
5235 guest_agent=no
5236 else
5237 error_exit "Guest agent is not supported on this platform"
5241 # Guest agent Window MSI package
5243 if test "$guest_agent" != yes; then
5244 if test "$guest_agent_msi" = yes; then
5245 error_exit "MSI guest agent package requires guest agent enabled"
5247 guest_agent_msi=no
5248 elif test "$mingw32" != "yes"; then
5249 if test "$guest_agent_msi" = "yes"; then
5250 error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation"
5252 guest_agent_msi=no
5253 elif ! has wixl; then
5254 if test "$guest_agent_msi" = "yes"; then
5255 error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )"
5257 guest_agent_msi=no
5258 else
5259 # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't
5260 # disabled explicitly
5261 if test "$guest_agent_msi" != "no"; then
5262 guest_agent_msi=yes
5266 if test "$guest_agent_msi" = "yes"; then
5267 if test "$guest_agent_with_vss" = "yes"; then
5268 QEMU_GA_MSI_WITH_VSS="-D InstallVss"
5271 if test "$QEMU_GA_MANUFACTURER" = ""; then
5272 QEMU_GA_MANUFACTURER=QEMU
5275 if test "$QEMU_GA_DISTRO" = ""; then
5276 QEMU_GA_DISTRO=Linux
5279 if test "$QEMU_GA_VERSION" = ""; then
5280 QEMU_GA_VERSION=$(cat $source_path/VERSION)
5283 QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin"
5285 case "$cpu" in
5286 x86_64)
5287 QEMU_GA_MSI_ARCH="-a x64 -D Arch=64"
5289 i386)
5290 QEMU_GA_MSI_ARCH="-D Arch=32"
5293 error_exit "CPU $cpu not supported for building installation package"
5295 esac
5298 # Mac OS X ships with a broken assembler
5299 roms=
5300 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
5301 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
5302 "$softmmu" = yes ; then
5303 # Different host OS linkers have different ideas about the name of the ELF
5304 # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd
5305 # variant; and Windows uses i386pe.
5306 for emu in elf_i386 elf_i386_fbsd i386pe; do
5307 if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
5308 ld_i386_emulation="$emu"
5309 roms="optionrom"
5310 break
5312 done
5314 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
5315 roms="$roms spapr-rtas"
5318 if test "$cpu" = "s390x" ; then
5319 roms="$roms s390-ccw"
5322 # Probe for the need for relocating the user-only binary.
5323 if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
5324 textseg_addr=
5325 case "$cpu" in
5326 arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
5327 # ??? Rationale for choosing this address
5328 textseg_addr=0x60000000
5330 mips)
5331 # A 256M aligned address, high in the address space, with enough
5332 # room for the code_gen_buffer above it before the stack.
5333 textseg_addr=0x60000000
5335 esac
5336 if [ -n "$textseg_addr" ]; then
5337 cat > $TMPC <<EOF
5338 int main(void) { return 0; }
5340 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
5341 if ! compile_prog "" "$textseg_ldflags"; then
5342 # In case ld does not support -Ttext-segment, edit the default linker
5343 # script via sed to set the .text start addr. This is needed on FreeBSD
5344 # at least.
5345 if ! $ld --verbose >/dev/null 2>&1; then
5346 error_exit \
5347 "We need to link the QEMU user mode binaries at a" \
5348 "specific text address. Unfortunately your linker" \
5349 "doesn't support either the -Ttext-segment option or" \
5350 "printing the default linker script with --verbose." \
5351 "If you don't want the user mode binaries, pass the" \
5352 "--disable-user option to configure."
5355 $ld --verbose | sed \
5356 -e '1,/==================================================/d' \
5357 -e '/==================================================/,$d' \
5358 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
5359 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
5360 textseg_ldflags="-Wl,-T../config-host.ld"
5365 # Check that the C++ compiler exists and works with the C compiler.
5366 # All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
5367 if has $cxx; then
5368 cat > $TMPC <<EOF
5369 int c_function(void);
5370 int main(void) { return c_function(); }
5373 compile_object
5375 cat > $TMPCXX <<EOF
5376 extern "C" {
5377 int c_function(void);
5379 int c_function(void) { return 42; }
5382 update_cxxflags
5384 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
5385 # C++ compiler $cxx works ok with C compiler $cc
5387 else
5388 echo "C++ compiler $cxx does not work with C compiler $cc"
5389 echo "Disabling C++ specific optional code"
5390 cxx=
5392 else
5393 echo "No C++ compiler available; disabling C++ specific optional code"
5394 cxx=
5397 echo_version() {
5398 if test "$1" = "yes" ; then
5399 echo "($2)"
5403 # prepend pixman and ftd flags after all config tests are done
5404 QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
5405 libs_softmmu="$pixman_libs $libs_softmmu"
5407 echo "Install prefix $prefix"
5408 echo "BIOS directory $(eval echo $qemu_datadir)"
5409 echo "firmware path $(eval echo $firmwarepath)"
5410 echo "binary directory $(eval echo $bindir)"
5411 echo "library directory $(eval echo $libdir)"
5412 echo "module directory $(eval echo $qemu_moddir)"
5413 echo "libexec directory $(eval echo $libexecdir)"
5414 echo "include directory $(eval echo $includedir)"
5415 echo "config directory $(eval echo $sysconfdir)"
5416 if test "$mingw32" = "no" ; then
5417 echo "local state directory $(eval echo $local_statedir)"
5418 echo "Manual directory $(eval echo $mandir)"
5419 echo "ELF interp prefix $interp_prefix"
5420 else
5421 echo "local state directory queried at runtime"
5422 echo "Windows SDK $win_sdk"
5424 echo "Source path $source_path"
5425 echo "GIT binary $git"
5426 echo "GIT submodules $git_submodules"
5427 echo "C compiler $cc"
5428 echo "Host C compiler $host_cc"
5429 echo "C++ compiler $cxx"
5430 echo "Objective-C compiler $objcc"
5431 echo "ARFLAGS $ARFLAGS"
5432 echo "CFLAGS $CFLAGS"
5433 echo "QEMU_CFLAGS $QEMU_CFLAGS"
5434 echo "LDFLAGS $LDFLAGS"
5435 echo "make $make"
5436 echo "install $install"
5437 echo "python $python"
5438 if test "$slirp" = "yes" ; then
5439 echo "smbd $smbd"
5441 echo "module support $modules"
5442 echo "host CPU $cpu"
5443 echo "host big endian $bigendian"
5444 echo "target list $target_list"
5445 echo "gprof enabled $gprof"
5446 echo "sparse enabled $sparse"
5447 echo "strip binaries $strip_opt"
5448 echo "profiler $profiler"
5449 echo "static build $static"
5450 if test "$darwin" = "yes" ; then
5451 echo "Cocoa support $cocoa"
5453 echo "SDL support $sdl $(echo_version $sdl $sdlversion)"
5454 echo "GTK support $gtk $(echo_version $gtk $gtk_version)"
5455 echo "GTK GL support $gtk_gl"
5456 echo "VTE support $vte $(echo_version $vte $vteversion)"
5457 echo "TLS priority $tls_priority"
5458 echo "GNUTLS support $gnutls"
5459 echo "GNUTLS rnd $gnutls_rnd"
5460 echo "libgcrypt $gcrypt"
5461 echo "libgcrypt kdf $gcrypt_kdf"
5462 echo "nettle $nettle $(echo_version $nettle $nettle_version)"
5463 echo "nettle kdf $nettle_kdf"
5464 echo "libtasn1 $tasn1"
5465 echo "curses support $curses"
5466 echo "virgl support $virglrenderer"
5467 echo "curl support $curl"
5468 echo "mingw32 support $mingw32"
5469 echo "Audio drivers $audio_drv_list"
5470 echo "Block whitelist (rw) $block_drv_rw_whitelist"
5471 echo "Block whitelist (ro) $block_drv_ro_whitelist"
5472 echo "VirtFS support $virtfs"
5473 echo "Multipath support $mpath"
5474 echo "VNC support $vnc"
5475 if test "$vnc" = "yes" ; then
5476 echo "VNC SASL support $vnc_sasl"
5477 echo "VNC JPEG support $vnc_jpeg"
5478 echo "VNC PNG support $vnc_png"
5480 if test -n "$sparc_cpu"; then
5481 echo "Target Sparc Arch $sparc_cpu"
5483 echo "xen support $xen"
5484 if test "$xen" = "yes" ; then
5485 echo "xen ctrl version $xen_ctrl_version"
5486 echo "pv dom build $xen_pv_domain_build"
5488 echo "brlapi support $brlapi"
5489 echo "bluez support $bluez"
5490 echo "Documentation $docs"
5491 echo "PIE $pie"
5492 echo "vde support $vde"
5493 echo "netmap support $netmap"
5494 echo "Linux AIO support $linux_aio"
5495 echo "ATTR/XATTR support $attr"
5496 echo "Install blobs $blobs"
5497 echo "KVM support $kvm"
5498 echo "HAX support $hax"
5499 echo "TCG support $tcg"
5500 if test "$tcg" = "yes" ; then
5501 echo "TCG debug enabled $debug_tcg"
5502 echo "TCG interpreter $tcg_interpreter"
5504 echo "RDMA support $rdma"
5505 echo "fdt support $fdt"
5506 echo "preadv support $preadv"
5507 echo "fdatasync $fdatasync"
5508 echo "madvise $madvise"
5509 echo "posix_madvise $posix_madvise"
5510 echo "libcap-ng support $cap_ng"
5511 echo "vhost-net support $vhost_net"
5512 echo "vhost-scsi support $vhost_scsi"
5513 echo "vhost-vsock support $vhost_vsock"
5514 echo "vhost-user support $vhost_user"
5515 echo "Trace backends $trace_backends"
5516 if have_backend "simple"; then
5517 echo "Trace output file $trace_file-<pid>"
5519 echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)"
5520 echo "rbd support $rbd"
5521 echo "xfsctl support $xfs"
5522 echo "smartcard support $smartcard"
5523 echo "libusb $libusb"
5524 echo "usb net redir $usb_redir"
5525 echo "OpenGL support $opengl"
5526 echo "OpenGL dmabufs $opengl_dmabuf"
5527 echo "libiscsi support $libiscsi"
5528 echo "libnfs support $libnfs"
5529 echo "build guest agent $guest_agent"
5530 echo "QGA VSS support $guest_agent_with_vss"
5531 echo "QGA w32 disk info $guest_agent_ntddscsi"
5532 echo "QGA MSI support $guest_agent_msi"
5533 echo "seccomp support $seccomp"
5534 echo "coroutine backend $coroutine"
5535 echo "coroutine pool $coroutine_pool"
5536 echo "debug stack usage $debug_stack_usage"
5537 echo "crypto afalg $crypto_afalg"
5538 echo "GlusterFS support $glusterfs"
5539 echo "gcov $gcov_tool"
5540 echo "gcov enabled $gcov"
5541 echo "TPM support $tpm"
5542 echo "libssh2 support $libssh2"
5543 echo "TPM passthrough $tpm_passthrough"
5544 echo "TPM emulator $tpm_emulator"
5545 echo "QOM debugging $qom_cast_debug"
5546 echo "Live block migration $live_block_migration"
5547 echo "lzo support $lzo"
5548 echo "snappy support $snappy"
5549 echo "bzip2 support $bzip2"
5550 echo "NUMA host support $numa"
5551 echo "tcmalloc support $tcmalloc"
5552 echo "jemalloc support $jemalloc"
5553 echo "avx2 optimization $avx2_opt"
5554 echo "replication support $replication"
5555 echo "VxHS block device $vxhs"
5556 echo "capstone $capstone"
5558 if test "$sdl_too_old" = "yes"; then
5559 echo "-> Your SDL version is too old - please upgrade to have SDL support"
5562 if test "$supported_cpu" = "no"; then
5563 echo
5564 echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
5565 echo
5566 echo "CPU host architecture $cpu support is not currently maintained."
5567 echo "The QEMU project intends to remove support for this host CPU in"
5568 echo "a future release if nobody volunteers to maintain it and to"
5569 echo "provide a build host for our continuous integration setup."
5570 echo "configure has succeeded and you can continue to build, but"
5571 echo "if you care about QEMU on this platform you should contact"
5572 echo "us upstream at qemu-devel@nongnu.org."
5575 if test "$supported_os" = "no"; then
5576 echo
5577 echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!"
5578 echo
5579 echo "Host OS $targetos support is not currently maintained."
5580 echo "The QEMU project intends to remove support for this host OS in"
5581 echo "a future release if nobody volunteers to maintain it and to"
5582 echo "provide a build host for our continuous integration setup."
5583 echo "configure has succeeded and you can continue to build, but"
5584 echo "if you care about QEMU on this platform you should contact"
5585 echo "us upstream at qemu-devel@nongnu.org."
5588 config_host_mak="config-host.mak"
5590 echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
5592 echo "# Automatically generated by configure - do not modify" > $config_host_mak
5593 echo >> $config_host_mak
5595 echo all: >> $config_host_mak
5596 echo "prefix=$prefix" >> $config_host_mak
5597 echo "bindir=$bindir" >> $config_host_mak
5598 echo "libdir=$libdir" >> $config_host_mak
5599 echo "libexecdir=$libexecdir" >> $config_host_mak
5600 echo "includedir=$includedir" >> $config_host_mak
5601 echo "mandir=$mandir" >> $config_host_mak
5602 echo "sysconfdir=$sysconfdir" >> $config_host_mak
5603 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
5604 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
5605 echo "qemu_firmwarepath=$firmwarepath" >> $config_host_mak
5606 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
5607 echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
5608 if test "$mingw32" = "no" ; then
5609 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
5611 echo "qemu_helperdir=$libexecdir" >> $config_host_mak
5612 echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
5613 echo "extra_cxxflags=$EXTRA_CXXFLAGS" >> $config_host_mak
5614 echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
5615 echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
5616 echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
5617 echo "GIT=$git" >> $config_host_mak
5618 echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
5619 echo "GIT_UPDATE=$git_update" >> $config_host_mak
5621 echo "ARCH=$ARCH" >> $config_host_mak
5623 if test "$debug_tcg" = "yes" ; then
5624 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
5626 if test "$strip_opt" = "yes" ; then
5627 echo "STRIP=${strip}" >> $config_host_mak
5629 if test "$bigendian" = "yes" ; then
5630 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
5632 if test "$mingw32" = "yes" ; then
5633 echo "CONFIG_WIN32=y" >> $config_host_mak
5634 rc_version=$(cat $source_path/VERSION)
5635 version_major=${rc_version%%.*}
5636 rc_version=${rc_version#*.}
5637 version_minor=${rc_version%%.*}
5638 rc_version=${rc_version#*.}
5639 version_subminor=${rc_version%%.*}
5640 version_micro=0
5641 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
5642 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
5643 if test "$guest_agent_with_vss" = "yes" ; then
5644 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
5645 echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak
5646 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
5648 if test "$guest_agent_ntddscsi" = "yes" ; then
5649 echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak
5651 if test "$guest_agent_msi" = "yes"; then
5652 echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
5653 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
5654 echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
5655 echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
5656 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
5657 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
5658 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
5660 else
5661 echo "CONFIG_POSIX=y" >> $config_host_mak
5664 if test "$linux" = "yes" ; then
5665 echo "CONFIG_LINUX=y" >> $config_host_mak
5668 if test "$darwin" = "yes" ; then
5669 echo "CONFIG_DARWIN=y" >> $config_host_mak
5672 if test "$solaris" = "yes" ; then
5673 echo "CONFIG_SOLARIS=y" >> $config_host_mak
5675 if test "$haiku" = "yes" ; then
5676 echo "CONFIG_HAIKU=y" >> $config_host_mak
5678 if test "$static" = "yes" ; then
5679 echo "CONFIG_STATIC=y" >> $config_host_mak
5681 if test "$profiler" = "yes" ; then
5682 echo "CONFIG_PROFILER=y" >> $config_host_mak
5684 if test "$slirp" = "yes" ; then
5685 echo "CONFIG_SLIRP=y" >> $config_host_mak
5686 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
5688 if test "$vde" = "yes" ; then
5689 echo "CONFIG_VDE=y" >> $config_host_mak
5690 echo "VDE_LIBS=$vde_libs" >> $config_host_mak
5692 if test "$netmap" = "yes" ; then
5693 echo "CONFIG_NETMAP=y" >> $config_host_mak
5695 if test "$l2tpv3" = "yes" ; then
5696 echo "CONFIG_L2TPV3=y" >> $config_host_mak
5698 if test "$cap_ng" = "yes" ; then
5699 echo "CONFIG_LIBCAP=y" >> $config_host_mak
5701 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
5702 for drv in $audio_drv_list; do
5703 def=CONFIG_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
5704 echo "$def=y" >> $config_host_mak
5705 done
5706 echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak
5707 echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak
5708 echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak
5709 echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak
5710 echo "OSS_LIBS=$oss_libs" >> $config_host_mak
5711 if test "$audio_pt_int" = "yes" ; then
5712 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
5714 if test "$audio_win_int" = "yes" ; then
5715 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
5717 echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
5718 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
5719 if test "$vnc" = "yes" ; then
5720 echo "CONFIG_VNC=y" >> $config_host_mak
5722 if test "$vnc_sasl" = "yes" ; then
5723 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
5725 if test "$vnc_jpeg" = "yes" ; then
5726 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
5728 if test "$vnc_png" = "yes" ; then
5729 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
5731 if test "$xkbcommon" = "yes" ; then
5732 echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak
5733 echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak
5735 if test "$fnmatch" = "yes" ; then
5736 echo "CONFIG_FNMATCH=y" >> $config_host_mak
5738 if test "$xfs" = "yes" ; then
5739 echo "CONFIG_XFS=y" >> $config_host_mak
5741 qemu_version=$(head $source_path/VERSION)
5742 echo "VERSION=$qemu_version" >>$config_host_mak
5743 echo "PKGVERSION=$pkgversion" >>$config_host_mak
5744 echo "SRC_PATH=$source_path" >> $config_host_mak
5745 echo "TARGET_DIRS=$target_list" >> $config_host_mak
5746 if [ "$docs" = "yes" ] ; then
5747 echo "BUILD_DOCS=yes" >> $config_host_mak
5749 if test "$modules" = "yes"; then
5750 # $shacmd can generate a hash started with digit, which the compiler doesn't
5751 # like as an symbol. So prefix it with an underscore
5752 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
5753 echo "CONFIG_MODULES=y" >> $config_host_mak
5755 if test "$sdl" = "yes" ; then
5756 echo "CONFIG_SDL=y" >> $config_host_mak
5757 echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
5758 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
5759 echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
5761 if test "$cocoa" = "yes" ; then
5762 echo "CONFIG_COCOA=y" >> $config_host_mak
5764 if test "$curses" = "yes" ; then
5765 echo "CONFIG_CURSES=y" >> $config_host_mak
5767 if test "$pipe2" = "yes" ; then
5768 echo "CONFIG_PIPE2=y" >> $config_host_mak
5770 if test "$accept4" = "yes" ; then
5771 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
5773 if test "$splice" = "yes" ; then
5774 echo "CONFIG_SPLICE=y" >> $config_host_mak
5776 if test "$eventfd" = "yes" ; then
5777 echo "CONFIG_EVENTFD=y" >> $config_host_mak
5779 if test "$memfd" = "yes" ; then
5780 echo "CONFIG_MEMFD=y" >> $config_host_mak
5782 if test "$fallocate" = "yes" ; then
5783 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
5785 if test "$fallocate_punch_hole" = "yes" ; then
5786 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
5788 if test "$fallocate_zero_range" = "yes" ; then
5789 echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak
5791 if test "$posix_fallocate" = "yes" ; then
5792 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
5794 if test "$sync_file_range" = "yes" ; then
5795 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
5797 if test "$fiemap" = "yes" ; then
5798 echo "CONFIG_FIEMAP=y" >> $config_host_mak
5800 if test "$dup3" = "yes" ; then
5801 echo "CONFIG_DUP3=y" >> $config_host_mak
5803 if test "$ppoll" = "yes" ; then
5804 echo "CONFIG_PPOLL=y" >> $config_host_mak
5806 if test "$prctl_pr_set_timerslack" = "yes" ; then
5807 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
5809 if test "$epoll" = "yes" ; then
5810 echo "CONFIG_EPOLL=y" >> $config_host_mak
5812 if test "$epoll_create1" = "yes" ; then
5813 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
5815 if test "$sendfile" = "yes" ; then
5816 echo "CONFIG_SENDFILE=y" >> $config_host_mak
5818 if test "$timerfd" = "yes" ; then
5819 echo "CONFIG_TIMERFD=y" >> $config_host_mak
5821 if test "$setns" = "yes" ; then
5822 echo "CONFIG_SETNS=y" >> $config_host_mak
5824 if test "$clock_adjtime" = "yes" ; then
5825 echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak
5827 if test "$syncfs" = "yes" ; then
5828 echo "CONFIG_SYNCFS=y" >> $config_host_mak
5830 if test "$inotify" = "yes" ; then
5831 echo "CONFIG_INOTIFY=y" >> $config_host_mak
5833 if test "$inotify1" = "yes" ; then
5834 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
5836 if test "$sem_timedwait" = "yes" ; then
5837 echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak
5839 if test "$byteswap_h" = "yes" ; then
5840 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
5842 if test "$bswap_h" = "yes" ; then
5843 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
5845 if test "$curl" = "yes" ; then
5846 echo "CONFIG_CURL=m" >> $config_host_mak
5847 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
5848 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
5850 if test "$brlapi" = "yes" ; then
5851 echo "CONFIG_BRLAPI=y" >> $config_host_mak
5852 echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
5854 if test "$bluez" = "yes" ; then
5855 echo "CONFIG_BLUEZ=y" >> $config_host_mak
5856 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
5858 if test "$glib_subprocess" = "yes" ; then
5859 echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak
5861 if test "$gtk" = "yes" ; then
5862 echo "CONFIG_GTK=y" >> $config_host_mak
5863 echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
5864 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
5865 echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
5866 if test "$gtk_gl" = "yes" ; then
5867 echo "CONFIG_GTK_GL=y" >> $config_host_mak
5870 echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
5871 if test "$gnutls" = "yes" ; then
5872 echo "CONFIG_GNUTLS=y" >> $config_host_mak
5874 if test "$gnutls_rnd" = "yes" ; then
5875 echo "CONFIG_GNUTLS_RND=y" >> $config_host_mak
5877 if test "$gcrypt" = "yes" ; then
5878 echo "CONFIG_GCRYPT=y" >> $config_host_mak
5879 if test "$gcrypt_hmac" = "yes" ; then
5880 echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak
5882 if test "$gcrypt_kdf" = "yes" ; then
5883 echo "CONFIG_GCRYPT_KDF=y" >> $config_host_mak
5886 if test "$nettle" = "yes" ; then
5887 echo "CONFIG_NETTLE=y" >> $config_host_mak
5888 echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak
5889 if test "$nettle_kdf" = "yes" ; then
5890 echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak
5893 if test "$tasn1" = "yes" ; then
5894 echo "CONFIG_TASN1=y" >> $config_host_mak
5896 if test "$have_ifaddrs_h" = "yes" ; then
5897 echo "HAVE_IFADDRS_H=y" >> $config_host_mak
5899 if test "$have_broken_size_max" = "yes" ; then
5900 echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
5903 # Work around a system header bug with some kernel/XFS header
5904 # versions where they both try to define 'struct fsxattr':
5905 # xfs headers will not try to redefine structs from linux headers
5906 # if this macro is set.
5907 if test "$have_fsxattr" = "yes" ; then
5908 echo "HAVE_FSXATTR=y" >> $config_host_mak
5910 if test "$vte" = "yes" ; then
5911 echo "CONFIG_VTE=y" >> $config_host_mak
5912 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
5914 if test "$virglrenderer" = "yes" ; then
5915 echo "CONFIG_VIRGL=y" >> $config_host_mak
5916 echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak
5917 echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak
5919 if test "$xen" = "yes" ; then
5920 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
5921 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
5922 if test "$xen_pv_domain_build" = "yes" ; then
5923 echo "CONFIG_XEN_PV_DOMAIN_BUILD=y" >> $config_host_mak
5926 if test "$linux_aio" = "yes" ; then
5927 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
5929 if test "$attr" = "yes" ; then
5930 echo "CONFIG_ATTR=y" >> $config_host_mak
5932 if test "$libattr" = "yes" ; then
5933 echo "CONFIG_LIBATTR=y" >> $config_host_mak
5935 if test "$virtfs" = "yes" ; then
5936 echo "CONFIG_VIRTFS=y" >> $config_host_mak
5938 if test "$mpath" = "yes" ; then
5939 echo "CONFIG_MPATH=y" >> $config_host_mak
5941 if test "$vhost_scsi" = "yes" ; then
5942 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
5944 if test "$vhost_net" = "yes" -a "$vhost_user" = "yes"; then
5945 echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
5947 if test "$vhost_vsock" = "yes" ; then
5948 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
5950 if test "$vhost_user" = "yes" ; then
5951 echo "CONFIG_VHOST_USER=y" >> $config_host_mak
5953 if test "$blobs" = "yes" ; then
5954 echo "INSTALL_BLOBS=yes" >> $config_host_mak
5956 if test "$iovec" = "yes" ; then
5957 echo "CONFIG_IOVEC=y" >> $config_host_mak
5959 if test "$preadv" = "yes" ; then
5960 echo "CONFIG_PREADV=y" >> $config_host_mak
5962 if test "$fdt" = "yes" ; then
5963 echo "CONFIG_FDT=y" >> $config_host_mak
5965 if test "$signalfd" = "yes" ; then
5966 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
5968 if test "$tcg" = "yes"; then
5969 echo "CONFIG_TCG=y" >> $config_host_mak
5970 if test "$tcg_interpreter" = "yes" ; then
5971 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
5974 if test "$fdatasync" = "yes" ; then
5975 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
5977 if test "$madvise" = "yes" ; then
5978 echo "CONFIG_MADVISE=y" >> $config_host_mak
5980 if test "$posix_madvise" = "yes" ; then
5981 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
5984 if test "$spice" = "yes" ; then
5985 echo "CONFIG_SPICE=y" >> $config_host_mak
5988 if test "$smartcard" = "yes" ; then
5989 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
5990 echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak
5991 echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak
5994 if test "$libusb" = "yes" ; then
5995 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
5996 echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak
5997 echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak
6000 if test "$usb_redir" = "yes" ; then
6001 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
6002 echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak
6003 echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak
6006 if test "$opengl" = "yes" ; then
6007 echo "CONFIG_OPENGL=y" >> $config_host_mak
6008 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
6009 if test "$opengl_dmabuf" = "yes" ; then
6010 echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
6014 if test "$avx2_opt" = "yes" ; then
6015 echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
6018 if test "$lzo" = "yes" ; then
6019 echo "CONFIG_LZO=y" >> $config_host_mak
6022 if test "$snappy" = "yes" ; then
6023 echo "CONFIG_SNAPPY=y" >> $config_host_mak
6026 if test "$bzip2" = "yes" ; then
6027 echo "CONFIG_BZIP2=y" >> $config_host_mak
6028 echo "BZIP2_LIBS=-lbz2" >> $config_host_mak
6031 if test "$libiscsi" = "yes" ; then
6032 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
6033 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
6034 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
6037 if test "$libnfs" = "yes" ; then
6038 echo "CONFIG_LIBNFS=m" >> $config_host_mak
6039 echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
6042 if test "$seccomp" = "yes"; then
6043 echo "CONFIG_SECCOMP=y" >> $config_host_mak
6044 echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
6045 echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak
6048 # XXX: suppress that
6049 if [ "$bsd" = "yes" ] ; then
6050 echo "CONFIG_BSD=y" >> $config_host_mak
6053 if test "$localtime_r" = "yes" ; then
6054 echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
6056 if test "$qom_cast_debug" = "yes" ; then
6057 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
6059 if test "$rbd" = "yes" ; then
6060 echo "CONFIG_RBD=m" >> $config_host_mak
6061 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
6062 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
6065 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
6066 if test "$coroutine_pool" = "yes" ; then
6067 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
6068 else
6069 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
6072 if test "$debug_stack_usage" = "yes" ; then
6073 echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
6076 if test "$crypto_afalg" = "yes" ; then
6077 echo "CONFIG_AF_ALG=y" >> $config_host_mak
6080 if test "$open_by_handle_at" = "yes" ; then
6081 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
6084 if test "$linux_magic_h" = "yes" ; then
6085 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
6088 if test "$pragma_diagnostic_available" = "yes" ; then
6089 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
6092 if test "$valgrind_h" = "yes" ; then
6093 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
6096 if test "$has_environ" = "yes" ; then
6097 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
6100 if test "$cpuid_h" = "yes" ; then
6101 echo "CONFIG_CPUID_H=y" >> $config_host_mak
6104 if test "$int128" = "yes" ; then
6105 echo "CONFIG_INT128=y" >> $config_host_mak
6108 if test "$atomic128" = "yes" ; then
6109 echo "CONFIG_ATOMIC128=y" >> $config_host_mak
6112 if test "$atomic64" = "yes" ; then
6113 echo "CONFIG_ATOMIC64=y" >> $config_host_mak
6116 if test "$getauxval" = "yes" ; then
6117 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
6120 if test "$glusterfs" = "yes" ; then
6121 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
6122 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
6123 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
6126 if test "$glusterfs_xlator_opt" = "yes" ; then
6127 echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
6130 if test "$glusterfs_discard" = "yes" ; then
6131 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
6134 if test "$glusterfs_fallocate" = "yes" ; then
6135 echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
6138 if test "$glusterfs_zerofill" = "yes" ; then
6139 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
6142 if test "$libssh2" = "yes" ; then
6143 echo "CONFIG_LIBSSH2=m" >> $config_host_mak
6144 echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
6145 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
6148 if test "$live_block_migration" = "yes" ; then
6149 echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
6152 if test "$tpm" = "yes"; then
6153 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
6154 # TPM passthrough support?
6155 if test "$tpm_passthrough" = "yes"; then
6156 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
6158 # TPM emulator support?
6159 if test "$tpm_emulator" = "yes"; then
6160 echo "CONFIG_TPM_EMULATOR=y" >> $config_host_mak
6164 echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
6165 if have_backend "nop"; then
6166 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
6168 if have_backend "simple"; then
6169 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
6170 # Set the appropriate trace file.
6171 trace_file="\"$trace_file-\" FMT_pid"
6173 if have_backend "log"; then
6174 echo "CONFIG_TRACE_LOG=y" >> $config_host_mak
6176 if have_backend "ust"; then
6177 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
6179 if have_backend "dtrace"; then
6180 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
6181 if test "$trace_backend_stap" = "yes" ; then
6182 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
6185 if have_backend "ftrace"; then
6186 if test "$linux" = "yes" ; then
6187 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
6188 else
6189 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
6192 if have_backend "syslog"; then
6193 if test "$posix_syslog" = "yes" ; then
6194 echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak
6195 else
6196 feature_not_found "syslog(trace backend)" "syslog not available"
6199 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
6201 if test "$rdma" = "yes" ; then
6202 echo "CONFIG_RDMA=y" >> $config_host_mak
6203 echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
6206 if test "$have_rtnetlink" = "yes" ; then
6207 echo "CONFIG_RTNETLINK=y" >> $config_host_mak
6210 if test "$replication" = "yes" ; then
6211 echo "CONFIG_REPLICATION=y" >> $config_host_mak
6214 if test "$have_af_vsock" = "yes" ; then
6215 echo "CONFIG_AF_VSOCK=y" >> $config_host_mak
6218 if test "$have_sysmacros" = "yes" ; then
6219 echo "CONFIG_SYSMACROS=y" >> $config_host_mak
6222 if test "$have_static_assert" = "yes" ; then
6223 echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak
6226 if test "$have_utmpx" = "yes" ; then
6227 echo "HAVE_UTMPX=y" >> $config_host_mak
6230 if test "$ivshmem" = "yes" ; then
6231 echo "CONFIG_IVSHMEM=y" >> $config_host_mak
6233 if test "$capstone" != "no" ; then
6234 echo "CONFIG_CAPSTONE=y" >> $config_host_mak
6237 # Hold two types of flag:
6238 # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
6239 # a thread we have a handle to
6240 # CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
6241 # platform
6242 if test "$pthread_setname_np" = "yes" ; then
6243 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
6244 echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
6247 if test "$vxhs" = "yes" ; then
6248 echo "CONFIG_VXHS=y" >> $config_host_mak
6249 echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
6252 if test "$tcg_interpreter" = "yes"; then
6253 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
6254 elif test "$ARCH" = "sparc64" ; then
6255 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
6256 elif test "$ARCH" = "s390x" ; then
6257 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
6258 elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
6259 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
6260 elif test "$ARCH" = "ppc64" ; then
6261 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
6262 else
6263 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
6265 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
6267 echo "TOOLS=$tools" >> $config_host_mak
6268 echo "ROMS=$roms" >> $config_host_mak
6269 echo "MAKE=$make" >> $config_host_mak
6270 echo "INSTALL=$install" >> $config_host_mak
6271 echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
6272 echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
6273 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
6274 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
6275 echo "PYTHON=$python" >> $config_host_mak
6276 echo "CC=$cc" >> $config_host_mak
6277 if $iasl -h > /dev/null 2>&1; then
6278 echo "IASL=$iasl" >> $config_host_mak
6280 echo "CC_I386=$cc_i386" >> $config_host_mak
6281 echo "HOST_CC=$host_cc" >> $config_host_mak
6282 echo "CXX=$cxx" >> $config_host_mak
6283 echo "OBJCC=$objcc" >> $config_host_mak
6284 echo "AR=$ar" >> $config_host_mak
6285 echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
6286 echo "AS=$as" >> $config_host_mak
6287 echo "CCAS=$ccas" >> $config_host_mak
6288 echo "CPP=$cpp" >> $config_host_mak
6289 echo "OBJCOPY=$objcopy" >> $config_host_mak
6290 echo "LD=$ld" >> $config_host_mak
6291 echo "NM=$nm" >> $config_host_mak
6292 echo "WINDRES=$windres" >> $config_host_mak
6293 echo "CFLAGS=$CFLAGS" >> $config_host_mak
6294 echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
6295 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
6296 echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
6297 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
6298 if test "$sparse" = "yes" ; then
6299 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
6300 echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak
6301 echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
6302 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
6303 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
6305 if test "$cross_prefix" != ""; then
6306 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
6307 else
6308 echo "AUTOCONF_HOST := " >> $config_host_mak
6310 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
6311 echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
6312 echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
6313 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
6314 echo "LIBS+=$LIBS" >> $config_host_mak
6315 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
6316 echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak
6317 echo "EXESUF=$EXESUF" >> $config_host_mak
6318 echo "DSOSUF=$DSOSUF" >> $config_host_mak
6319 echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
6320 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
6321 echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
6322 echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
6323 echo "POD2MAN=$POD2MAN" >> $config_host_mak
6324 echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
6325 if test "$gcov" = "yes" ; then
6326 echo "CONFIG_GCOV=y" >> $config_host_mak
6327 echo "GCOV=$gcov_tool" >> $config_host_mak
6330 # use included Linux headers
6331 if test "$linux" = "yes" ; then
6332 mkdir -p linux-headers
6333 case "$cpu" in
6334 i386|x86_64|x32)
6335 linux_arch=x86
6337 ppcemb|ppc|ppc64)
6338 linux_arch=powerpc
6340 s390x)
6341 linux_arch=s390
6343 aarch64)
6344 linux_arch=arm64
6346 mips64)
6347 linux_arch=mips
6350 # For most CPUs the kernel architecture name and QEMU CPU name match.
6351 linux_arch="$cpu"
6353 esac
6354 # For non-KVM architectures we will not have asm headers
6355 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
6356 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
6360 for target in $target_list; do
6361 target_dir="$target"
6362 config_target_mak=$target_dir/config-target.mak
6363 target_name=$(echo $target | cut -d '-' -f 1)
6364 target_bigendian="no"
6366 case "$target_name" in
6367 armeb|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
6368 target_bigendian=yes
6370 esac
6371 target_softmmu="no"
6372 target_user_only="no"
6373 target_linux_user="no"
6374 target_bsd_user="no"
6375 case "$target" in
6376 ${target_name}-softmmu)
6377 target_softmmu="yes"
6379 ${target_name}-linux-user)
6380 target_user_only="yes"
6381 target_linux_user="yes"
6383 ${target_name}-bsd-user)
6384 target_user_only="yes"
6385 target_bsd_user="yes"
6388 error_exit "Target '$target' not recognised"
6389 exit 1
6391 esac
6393 mkdir -p $target_dir
6394 echo "# Automatically generated by configure - do not modify" > $config_target_mak
6396 bflt="no"
6397 mttcg="no"
6398 interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g")
6399 gdb_xml_files=""
6401 TARGET_ARCH="$target_name"
6402 TARGET_BASE_ARCH=""
6403 TARGET_ABI_DIR=""
6405 case "$target_name" in
6406 i386)
6407 gdb_xml_files="i386-32bit.xml i386-32bit-core.xml i386-32bit-sse.xml"
6409 x86_64)
6410 TARGET_BASE_ARCH=i386
6411 gdb_xml_files="i386-64bit.xml i386-64bit-core.xml i386-64bit-sse.xml"
6413 alpha)
6414 mttcg="yes"
6416 arm|armeb)
6417 TARGET_ARCH=arm
6418 bflt="yes"
6419 mttcg="yes"
6420 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
6422 aarch64)
6423 TARGET_BASE_ARCH=arm
6424 bflt="yes"
6425 mttcg="yes"
6426 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
6428 cris)
6430 hppa)
6432 lm32)
6434 m68k)
6435 bflt="yes"
6436 gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml"
6438 microblaze|microblazeel)
6439 TARGET_ARCH=microblaze
6440 bflt="yes"
6442 mips|mipsel)
6443 TARGET_ARCH=mips
6444 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
6446 mipsn32|mipsn32el)
6447 TARGET_ARCH=mips64
6448 TARGET_BASE_ARCH=mips
6449 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
6450 echo "TARGET_ABI32=y" >> $config_target_mak
6452 mips64|mips64el)
6453 TARGET_ARCH=mips64
6454 TARGET_BASE_ARCH=mips
6455 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
6457 moxie)
6459 nios2)
6461 or1k)
6462 TARGET_ARCH=openrisc
6463 TARGET_BASE_ARCH=openrisc
6465 ppc)
6466 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
6468 ppcemb)
6469 TARGET_BASE_ARCH=ppc
6470 TARGET_ABI_DIR=ppc
6471 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
6473 ppc64)
6474 TARGET_BASE_ARCH=ppc
6475 TARGET_ABI_DIR=ppc
6476 mttcg=yes
6477 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6479 ppc64le)
6480 TARGET_ARCH=ppc64
6481 TARGET_BASE_ARCH=ppc
6482 TARGET_ABI_DIR=ppc
6483 mttcg=yes
6484 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6486 ppc64abi32)
6487 TARGET_ARCH=ppc64
6488 TARGET_BASE_ARCH=ppc
6489 TARGET_ABI_DIR=ppc
6490 echo "TARGET_ABI32=y" >> $config_target_mak
6491 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6493 sh4|sh4eb)
6494 TARGET_ARCH=sh4
6495 bflt="yes"
6497 sparc)
6499 sparc64)
6500 TARGET_BASE_ARCH=sparc
6502 sparc32plus)
6503 TARGET_ARCH=sparc64
6504 TARGET_BASE_ARCH=sparc
6505 TARGET_ABI_DIR=sparc
6506 echo "TARGET_ABI32=y" >> $config_target_mak
6508 s390x)
6509 gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml"
6511 tilegx)
6513 tricore)
6515 unicore32)
6517 xtensa|xtensaeb)
6518 TARGET_ARCH=xtensa
6521 error_exit "Unsupported target CPU"
6523 esac
6524 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
6525 if [ "$TARGET_BASE_ARCH" = "" ]; then
6526 TARGET_BASE_ARCH=$TARGET_ARCH
6529 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
6531 upper() {
6532 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
6535 target_arch_name="$(upper $TARGET_ARCH)"
6536 echo "TARGET_$target_arch_name=y" >> $config_target_mak
6537 echo "TARGET_NAME=$target_name" >> $config_target_mak
6538 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
6539 if [ "$TARGET_ABI_DIR" = "" ]; then
6540 TARGET_ABI_DIR=$TARGET_ARCH
6542 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
6543 if [ "$HOST_VARIANT_DIR" != "" ]; then
6544 echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
6547 if supported_xen_target $target; then
6548 echo "CONFIG_XEN=y" >> $config_target_mak
6549 if test "$xen_pci_passthrough" = yes; then
6550 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
6553 if supported_kvm_target $target; then
6554 echo "CONFIG_KVM=y" >> $config_target_mak
6555 if test "$vhost_net" = "yes" ; then
6556 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
6557 if test "$vhost_user" = "yes" ; then
6558 echo "CONFIG_VHOST_USER_NET_TEST_$target_name=y" >> $config_host_mak
6562 if supported_hax_target $target; then
6563 echo "CONFIG_HAX=y" >> $config_target_mak
6565 if test "$target_bigendian" = "yes" ; then
6566 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
6568 if test "$target_softmmu" = "yes" ; then
6569 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
6570 if test "$mttcg" = "yes" ; then
6571 echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak
6574 if test "$target_user_only" = "yes" ; then
6575 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
6576 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
6578 if test "$target_linux_user" = "yes" ; then
6579 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
6581 list=""
6582 if test ! -z "$gdb_xml_files" ; then
6583 for x in $gdb_xml_files; do
6584 list="$list $source_path/gdb-xml/$x"
6585 done
6586 echo "TARGET_XML_FILES=$list" >> $config_target_mak
6589 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
6590 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
6592 if test "$target_bsd_user" = "yes" ; then
6593 echo "CONFIG_BSD_USER=y" >> $config_target_mak
6596 # generate QEMU_CFLAGS/LDFLAGS for targets
6598 cflags=""
6599 ldflags=""
6601 disas_config() {
6602 echo "CONFIG_${1}_DIS=y" >> $config_target_mak
6603 echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak
6606 for i in $ARCH $TARGET_BASE_ARCH ; do
6607 case "$i" in
6608 alpha)
6609 disas_config "ALPHA"
6611 aarch64)
6612 if test -n "${cxx}"; then
6613 disas_config "ARM_A64"
6616 arm)
6617 disas_config "ARM"
6618 if test -n "${cxx}"; then
6619 disas_config "ARM_A64"
6622 cris)
6623 disas_config "CRIS"
6625 hppa)
6626 disas_config "HPPA"
6628 i386|x86_64|x32)
6629 disas_config "I386"
6631 lm32)
6632 disas_config "LM32"
6634 m68k)
6635 disas_config "M68K"
6637 microblaze*)
6638 disas_config "MICROBLAZE"
6640 mips*)
6641 disas_config "MIPS"
6643 moxie*)
6644 disas_config "MOXIE"
6646 nios2)
6647 disas_config "NIOS2"
6649 or1k)
6650 disas_config "OPENRISC"
6652 ppc*)
6653 disas_config "PPC"
6655 s390*)
6656 disas_config "S390"
6658 sh4)
6659 disas_config "SH4"
6661 sparc*)
6662 disas_config "SPARC"
6664 xtensa*)
6665 disas_config "XTENSA"
6667 esac
6668 done
6669 if test "$tcg_interpreter" = "yes" ; then
6670 disas_config "TCI"
6673 case "$ARCH" in
6674 alpha)
6675 # Ensure there's only a single GP
6676 cflags="-msmall-data $cflags"
6678 esac
6680 if test "$gprof" = "yes" ; then
6681 echo "TARGET_GPROF=yes" >> $config_target_mak
6682 if test "$target_linux_user" = "yes" ; then
6683 cflags="-p $cflags"
6684 ldflags="-p $ldflags"
6686 if test "$target_softmmu" = "yes" ; then
6687 ldflags="-p $ldflags"
6688 echo "GPROF_CFLAGS=-p" >> $config_target_mak
6692 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
6693 ldflags="$ldflags $textseg_ldflags"
6696 # Newer kernels on s390 check for an S390_PGSTE program header and
6697 # enable the pgste page table extensions in that case. This makes
6698 # the vm.allocate_pgste sysctl unnecessary. We enable this program
6699 # header if
6700 # - we build on s390x
6701 # - we build the system emulation for s390x (qemu-system-s390x)
6702 # - KVM is enabled
6703 # - the linker supports --s390-pgste
6704 if test "$TARGET_ARCH" = "s390x" -a "$target_softmmu" = "yes" -a "$ARCH" = "s390x" -a "$kvm" = "yes"; then
6705 if ld_has --s390-pgste ; then
6706 ldflags="-Wl,--s390-pgste $ldflags"
6710 echo "LDFLAGS+=$ldflags" >> $config_target_mak
6711 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
6713 done # for target in $targets
6715 if [ "$dtc_internal" = "yes" ]; then
6716 echo "config-host.h: subdir-dtc" >> $config_host_mak
6718 if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then
6719 echo "config-host.h: subdir-capstone" >> $config_host_mak
6721 if test -n "$LIBCAPSTONE"; then
6722 echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak
6725 if test "$numa" = "yes"; then
6726 echo "CONFIG_NUMA=y" >> $config_host_mak
6729 if test "$ccache_cpp2" = "yes"; then
6730 echo "export CCACHE_CPP2=y" >> $config_host_mak
6733 # build tree in object directory in case the source is not in the current directory
6734 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm"
6735 DIRS="$DIRS docs docs/interop fsdev scsi"
6736 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
6737 DIRS="$DIRS roms/seabios roms/vgabios"
6738 DIRS="$DIRS qapi-generated"
6739 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
6740 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
6741 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
6742 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
6743 FILES="$FILES pc-bios/spapr-rtas/Makefile"
6744 FILES="$FILES pc-bios/s390-ccw/Makefile"
6745 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
6746 FILES="$FILES pc-bios/qemu-icon.bmp"
6747 FILES="$FILES .gdbinit scripts" # scripts needed by relative path in .gdbinit
6748 for bios_file in \
6749 $source_path/pc-bios/*.bin \
6750 $source_path/pc-bios/*.lid \
6751 $source_path/pc-bios/*.aml \
6752 $source_path/pc-bios/*.rom \
6753 $source_path/pc-bios/*.dtb \
6754 $source_path/pc-bios/*.img \
6755 $source_path/pc-bios/openbios-* \
6756 $source_path/pc-bios/u-boot.* \
6757 $source_path/pc-bios/palcode-*
6759 FILES="$FILES pc-bios/$(basename $bios_file)"
6760 done
6761 for test_file in $(find $source_path/tests/acpi-test-data -type f)
6763 FILES="$FILES tests/acpi-test-data$(echo $test_file | sed -e 's/.*acpi-test-data//')"
6764 done
6765 mkdir -p $DIRS
6766 for f in $FILES ; do
6767 if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
6768 symlink "$source_path/$f" "$f"
6770 done
6772 # temporary config to build submodules
6773 for rom in seabios vgabios ; do
6774 config_mak=roms/$rom/config.mak
6775 echo "# Automatically generated by configure - do not modify" > $config_mak
6776 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
6777 echo "AS=$as" >> $config_mak
6778 echo "CCAS=$ccas" >> $config_mak
6779 echo "CC=$cc" >> $config_mak
6780 echo "BCC=bcc" >> $config_mak
6781 echo "CPP=$cpp" >> $config_mak
6782 echo "OBJCOPY=objcopy" >> $config_mak
6783 echo "IASL=$iasl" >> $config_mak
6784 echo "LD=$ld" >> $config_mak
6785 done
6787 # set up tests data directory
6788 if [ ! -e tests/data ]; then
6789 symlink "$source_path/tests/data" tests/data
6792 # set up qemu-iotests in this build directory
6793 iotests_common_env="tests/qemu-iotests/common.env"
6794 iotests_check="tests/qemu-iotests/check"
6796 echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
6797 echo >> "$iotests_common_env"
6798 echo "export PYTHON='$python'" >> "$iotests_common_env"
6800 if [ ! -e "$iotests_check" ]; then
6801 symlink "$source_path/$iotests_check" "$iotests_check"
6804 # Save the configure command line for later reuse.
6805 cat <<EOD >config.status
6806 #!/bin/sh
6807 # Generated by configure.
6808 # Run this file to recreate the current configuration.
6809 # Compiler output produced by configure, useful for debugging
6810 # configure, is in config.log if it exists.
6812 printf "exec" >>config.status
6813 printf " '%s'" "$0" "$@" >>config.status
6814 echo ' "$@"' >>config.status
6815 chmod +x config.status
6817 rm -r "$TMPDIR1"