ppc: Support Capstone in disas_set_info
[qemu/kevin.git] / configure
blobd06ad64058be0aec3eb682449888013a98948783
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_submodules="ui/keycodemapdb"
271 else
272 git_submodules=""
275 # Don't accept a target_list environment variable.
276 unset target_list
278 # Default value for a variable defining feature "foo".
279 # * foo="no" feature will only be used if --enable-foo arg is given
280 # * foo="" feature will be searched for, and if found, will be used
281 # unless --disable-foo is given
282 # * foo="yes" this value will only be set by --enable-foo flag.
283 # feature will searched for,
284 # if not found, configure exits with error
286 # Always add --enable-foo and --disable-foo command line args.
287 # Distributions want to ensure that several features are compiled in, and it
288 # is impossible without a --enable-foo that exits if a feature is not found.
290 bluez=""
291 brlapi=""
292 curl=""
293 curses=""
294 docs=""
295 fdt=""
296 netmap="no"
297 sdl=""
298 sdlabi=""
299 virtfs=""
300 mpath=""
301 vnc="yes"
302 sparse="no"
303 vde=""
304 vnc_sasl=""
305 vnc_jpeg=""
306 vnc_png=""
307 xkbcommon=""
308 xen=""
309 xen_ctrl_version=""
310 xen_pv_domain_build="no"
311 xen_pci_passthrough=""
312 linux_aio=""
313 cap_ng=""
314 attr=""
315 libattr=""
316 xfs=""
317 tcg="yes"
319 vhost_net="no"
320 vhost_scsi="no"
321 vhost_vsock="no"
322 vhost_user=""
323 kvm="no"
324 hax="no"
325 rdma=""
326 gprof="no"
327 debug_tcg="no"
328 debug="no"
329 fortify_source=""
330 strip_opt="yes"
331 tcg_interpreter="no"
332 bigendian="no"
333 mingw32="no"
334 gcov="no"
335 gcov_tool="gcov"
336 EXESUF=""
337 DSOSUF=".so"
338 LDFLAGS_SHARED="-shared"
339 modules="no"
340 prefix="/usr/local"
341 mandir="\${prefix}/share/man"
342 datadir="\${prefix}/share"
343 firmwarepath="\${prefix}/share/qemu-firmware"
344 qemu_docdir="\${prefix}/share/doc/qemu"
345 bindir="\${prefix}/bin"
346 libdir="\${prefix}/lib"
347 libexecdir="\${prefix}/libexec"
348 includedir="\${prefix}/include"
349 sysconfdir="\${prefix}/etc"
350 local_statedir="\${prefix}/var"
351 confsuffix="/qemu"
352 slirp="yes"
353 oss_lib=""
354 bsd="no"
355 linux="no"
356 solaris="no"
357 profiler="no"
358 cocoa="no"
359 softmmu="yes"
360 linux_user="no"
361 bsd_user="no"
362 blobs="yes"
363 pkgversion=""
364 pie=""
365 qom_cast_debug="yes"
366 trace_backends="log"
367 trace_file="trace"
368 spice=""
369 rbd=""
370 smartcard=""
371 libusb=""
372 usb_redir=""
373 opengl=""
374 opengl_dmabuf="no"
375 cpuid_h="no"
376 avx2_opt="no"
377 zlib="yes"
378 capstone=""
379 lzo=""
380 snappy=""
381 bzip2=""
382 guest_agent=""
383 guest_agent_with_vss="no"
384 guest_agent_ntddscsi="no"
385 guest_agent_msi=""
386 vss_win32_sdk=""
387 win_sdk="no"
388 want_tools="yes"
389 libiscsi=""
390 libnfs=""
391 coroutine=""
392 coroutine_pool=""
393 debug_stack_usage="no"
394 crypto_afalg="no"
395 seccomp=""
396 glusterfs=""
397 glusterfs_xlator_opt="no"
398 glusterfs_discard="no"
399 glusterfs_fallocate="no"
400 glusterfs_zerofill="no"
401 gtk=""
402 gtkabi=""
403 gtk_gl="no"
404 tls_priority="NORMAL"
405 gnutls=""
406 gnutls_rnd=""
407 nettle=""
408 nettle_kdf="no"
409 gcrypt=""
410 gcrypt_hmac="no"
411 gcrypt_kdf="no"
412 vte=""
413 virglrenderer=""
414 tpm="yes"
415 libssh2=""
416 live_block_migration="yes"
417 numa=""
418 tcmalloc="no"
419 jemalloc="no"
420 replication="yes"
421 vxhs=""
423 supported_cpu="no"
424 supported_os="no"
425 bogus_os="no"
427 # parse CC options first
428 for opt do
429 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
430 case "$opt" in
431 --cross-prefix=*) cross_prefix="$optarg"
433 --cc=*) CC="$optarg"
435 --cxx=*) CXX="$optarg"
437 --source-path=*) source_path="$optarg"
439 --cpu=*) cpu="$optarg"
441 --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
442 EXTRA_CFLAGS="$optarg"
444 --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
445 EXTRA_CXXFLAGS="$optarg"
447 --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
448 EXTRA_LDFLAGS="$optarg"
450 --enable-debug-info) debug_info="yes"
452 --disable-debug-info) debug_info="no"
454 esac
455 done
456 # OS specific
457 # Using uname is really, really broken. Once we have the right set of checks
458 # we can eliminate its usage altogether.
460 # Preferred compiler:
461 # ${CC} (if set)
462 # ${cross_prefix}gcc (if cross-prefix specified)
463 # system compiler
464 if test -z "${CC}${cross_prefix}"; then
465 cc="$host_cc"
466 else
467 cc="${CC-${cross_prefix}gcc}"
470 if test -z "${CXX}${cross_prefix}"; then
471 cxx="c++"
472 else
473 cxx="${CXX-${cross_prefix}g++}"
476 ar="${AR-${cross_prefix}ar}"
477 as="${AS-${cross_prefix}as}"
478 ccas="${CCAS-$cc}"
479 cpp="${CPP-$cc -E}"
480 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
481 ld="${LD-${cross_prefix}ld}"
482 nm="${NM-${cross_prefix}nm}"
483 strip="${STRIP-${cross_prefix}strip}"
484 windres="${WINDRES-${cross_prefix}windres}"
485 pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
486 query_pkg_config() {
487 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
489 pkg_config=query_pkg_config
490 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
491 sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
493 # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
494 ARFLAGS="${ARFLAGS-rv}"
496 # default flags for all hosts
497 # We use -fwrapv to tell the compiler that we require a C dialect where
498 # left shift of signed integers is well defined and has the expected
499 # 2s-complement style results. (Both clang and gcc agree that it
500 # provides these semantics.)
501 QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
502 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
503 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
504 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
505 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/accel/tcg -I\$(SRC_PATH)/include"
506 if test "$debug_info" = "yes"; then
507 CFLAGS="-g $CFLAGS"
508 LDFLAGS="-g $LDFLAGS"
511 # make source path absolute
512 source_path=$(cd "$source_path"; pwd)
514 # running configure in the source tree?
515 # we know that's the case if configure is there.
516 if test -f "./configure"; then
517 pwd_is_source_path="y"
518 else
519 pwd_is_source_path="n"
522 check_define() {
523 cat > $TMPC <<EOF
524 #if !defined($1)
525 #error $1 not defined
526 #endif
527 int main(void) { return 0; }
529 compile_object
532 check_include() {
533 cat > $TMPC <<EOF
534 #include <$1>
535 int main(void) { return 0; }
537 compile_object
540 write_c_skeleton() {
541 cat > $TMPC <<EOF
542 int main(void) { return 0; }
546 if check_define __linux__ ; then
547 targetos="Linux"
548 elif check_define _WIN32 ; then
549 targetos='MINGW32'
550 elif check_define __OpenBSD__ ; then
551 targetos='OpenBSD'
552 elif check_define __sun__ ; then
553 targetos='SunOS'
554 elif check_define __HAIKU__ ; then
555 targetos='Haiku'
556 elif check_define __FreeBSD__ ; then
557 targetos='FreeBSD'
558 elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then
559 targetos='GNU/kFreeBSD'
560 elif check_define __DragonFly__ ; then
561 targetos='DragonFly'
562 elif check_define __NetBSD__; then
563 targetos='NetBSD'
564 elif check_define __APPLE__; then
565 targetos='Darwin'
566 else
567 # This is a fatal error, but don't report it yet, because we
568 # might be going to just print the --help text, or it might
569 # be the result of a missing compiler.
570 targetos='bogus'
571 bogus_os='yes'
574 # Some host OSes need non-standard checks for which CPU to use.
575 # Note that these checks are broken for cross-compilation: if you're
576 # cross-compiling to one of these OSes then you'll need to specify
577 # the correct CPU with the --cpu option.
578 case $targetos in
579 Darwin)
580 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
581 # run 64-bit userspace code.
582 # If the user didn't specify a CPU explicitly and the kernel says this is
583 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
584 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
585 cpu="x86_64"
588 SunOS)
589 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
590 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
591 cpu="x86_64"
593 esac
595 if test ! -z "$cpu" ; then
596 # command line argument
598 elif check_define __i386__ ; then
599 cpu="i386"
600 elif check_define __x86_64__ ; then
601 if check_define __ILP32__ ; then
602 cpu="x32"
603 else
604 cpu="x86_64"
606 elif check_define __sparc__ ; then
607 if check_define __arch64__ ; then
608 cpu="sparc64"
609 else
610 cpu="sparc"
612 elif check_define _ARCH_PPC ; then
613 if check_define _ARCH_PPC64 ; then
614 cpu="ppc64"
615 else
616 cpu="ppc"
618 elif check_define __mips__ ; then
619 cpu="mips"
620 elif check_define __ia64__ ; then
621 cpu="ia64"
622 elif check_define __s390__ ; then
623 if check_define __s390x__ ; then
624 cpu="s390x"
625 else
626 cpu="s390"
628 elif check_define __arm__ ; then
629 cpu="arm"
630 elif check_define __aarch64__ ; then
631 cpu="aarch64"
632 else
633 cpu=$(uname -m)
636 ARCH=
637 # Normalise host CPU name and set ARCH.
638 # Note that this case should only have supported host CPUs, not guests.
639 case "$cpu" in
640 ppc|ppc64|s390|s390x|sparc64|x32)
641 cpu="$cpu"
642 supported_cpu="yes"
644 i386|i486|i586|i686|i86pc|BePC)
645 cpu="i386"
646 supported_cpu="yes"
648 x86_64|amd64)
649 cpu="x86_64"
650 supported_cpu="yes"
652 armv*b|armv*l|arm)
653 cpu="arm"
654 supported_cpu="yes"
656 aarch64)
657 cpu="aarch64"
658 supported_cpu="yes"
660 mips*)
661 cpu="mips"
662 supported_cpu="yes"
664 sparc|sun4[cdmuv])
665 cpu="sparc"
666 supported_cpu="yes"
669 # This will result in either an error or falling back to TCI later
670 ARCH=unknown
672 esac
673 if test -z "$ARCH"; then
674 ARCH="$cpu"
677 # OS specific
679 # host *BSD for user mode
680 HOST_VARIANT_DIR=""
682 case $targetos in
683 MINGW32*)
684 mingw32="yes"
685 hax="yes"
686 audio_possible_drivers="dsound sdl"
687 if check_include dsound.h; then
688 audio_drv_list="dsound"
689 else
690 audio_drv_list=""
692 supported_os="yes"
694 GNU/kFreeBSD)
695 bsd="yes"
696 audio_drv_list="oss"
697 audio_possible_drivers="oss sdl pa"
699 FreeBSD)
700 bsd="yes"
701 make="${MAKE-gmake}"
702 audio_drv_list="oss"
703 audio_possible_drivers="oss sdl pa"
704 # needed for kinfo_getvmmap(3) in libutil.h
705 LIBS="-lutil $LIBS"
706 # needed for kinfo_getproc
707 libs_qga="-lutil $libs_qga"
708 netmap="" # enable netmap autodetect
709 HOST_VARIANT_DIR="freebsd"
710 supported_os="yes"
712 DragonFly)
713 bsd="yes"
714 make="${MAKE-gmake}"
715 audio_drv_list="oss"
716 audio_possible_drivers="oss sdl pa"
717 HOST_VARIANT_DIR="dragonfly"
719 NetBSD)
720 bsd="yes"
721 make="${MAKE-gmake}"
722 audio_drv_list="oss"
723 audio_possible_drivers="oss sdl"
724 oss_lib="-lossaudio"
725 HOST_VARIANT_DIR="netbsd"
726 supported_os="yes"
728 OpenBSD)
729 bsd="yes"
730 make="${MAKE-gmake}"
731 audio_drv_list="sdl"
732 audio_possible_drivers="sdl"
733 HOST_VARIANT_DIR="openbsd"
735 Darwin)
736 bsd="yes"
737 darwin="yes"
738 hax="yes"
739 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
740 if [ "$cpu" = "x86_64" ] ; then
741 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
742 LDFLAGS="-arch x86_64 $LDFLAGS"
744 cocoa="yes"
745 audio_drv_list="coreaudio"
746 audio_possible_drivers="coreaudio sdl"
747 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
748 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
749 # Disable attempts to use ObjectiveC features in os/object.h since they
750 # won't work when we're compiling with gcc as a C compiler.
751 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
752 HOST_VARIANT_DIR="darwin"
753 supported_os="yes"
755 SunOS)
756 solaris="yes"
757 make="${MAKE-gmake}"
758 install="${INSTALL-ginstall}"
759 smbd="${SMBD-/usr/sfw/sbin/smbd}"
760 if test -f /usr/include/sys/soundcard.h ; then
761 audio_drv_list="oss"
763 audio_possible_drivers="oss sdl"
764 # needed for CMSG_ macros in sys/socket.h
765 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
766 # needed for TIOCWIN* defines in termios.h
767 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
768 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
769 solarisnetlibs="-lsocket -lnsl -lresolv"
770 LIBS="$solarisnetlibs $LIBS"
771 libs_qga="$solarisnetlibs $libs_qga"
773 Haiku)
774 haiku="yes"
775 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
776 LIBS="-lposix_error_mapper -lnetwork $LIBS"
778 Linux)
779 audio_drv_list="oss"
780 audio_possible_drivers="oss alsa sdl pa"
781 linux="yes"
782 linux_user="yes"
783 kvm="yes"
784 vhost_net="yes"
785 vhost_scsi="yes"
786 vhost_vsock="yes"
787 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
788 supported_os="yes"
790 esac
792 if [ "$bsd" = "yes" ] ; then
793 if [ "$darwin" != "yes" ] ; then
794 bsd_user="yes"
798 : ${make=${MAKE-make}}
799 : ${install=${INSTALL-install}}
800 : ${python=${PYTHON-python}}
801 : ${smbd=${SMBD-/usr/sbin/smbd}}
803 # Default objcc to clang if available, otherwise use CC
804 if has clang; then
805 objcc=clang
806 else
807 objcc="$cc"
810 if test "$mingw32" = "yes" ; then
811 EXESUF=".exe"
812 DSOSUF=".dll"
813 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
814 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
815 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
816 # MinGW needs -mthreads for TLS and macro _MT.
817 QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
818 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
819 write_c_skeleton;
820 if compile_prog "" "-liberty" ; then
821 LIBS="-liberty $LIBS"
823 prefix="c:/Program Files/QEMU"
824 mandir="\${prefix}"
825 datadir="\${prefix}"
826 qemu_docdir="\${prefix}"
827 bindir="\${prefix}"
828 sysconfdir="\${prefix}"
829 local_statedir=
830 confsuffix=""
831 libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -liphlpapi -lnetapi32 $libs_qga"
834 werror=""
836 for opt do
837 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
838 case "$opt" in
839 --help|-h) show_help=yes
841 --version|-V) exec cat $source_path/VERSION
843 --prefix=*) prefix="$optarg"
845 --interp-prefix=*) interp_prefix="$optarg"
847 --source-path=*)
849 --cross-prefix=*)
851 --cc=*)
853 --host-cc=*) host_cc="$optarg"
855 --cxx=*)
857 --iasl=*) iasl="$optarg"
859 --objcc=*) objcc="$optarg"
861 --make=*) make="$optarg"
863 --install=*) install="$optarg"
865 --python=*) python="$optarg"
867 --gcov=*) gcov_tool="$optarg"
869 --smbd=*) smbd="$optarg"
871 --extra-cflags=*)
873 --extra-cxxflags=*)
875 --extra-ldflags=*)
877 --enable-debug-info)
879 --disable-debug-info)
881 --enable-modules)
882 modules="yes"
884 --disable-modules)
885 modules="no"
887 --cpu=*)
889 --target-list=*) target_list="$optarg"
891 --enable-trace-backends=*) trace_backends="$optarg"
893 # XXX: backwards compatibility
894 --enable-trace-backend=*) trace_backends="$optarg"
896 --with-trace-file=*) trace_file="$optarg"
898 --enable-gprof) gprof="yes"
900 --enable-gcov) gcov="yes"
902 --static)
903 static="yes"
904 LDFLAGS="-static $LDFLAGS"
905 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
907 --mandir=*) mandir="$optarg"
909 --bindir=*) bindir="$optarg"
911 --libdir=*) libdir="$optarg"
913 --libexecdir=*) libexecdir="$optarg"
915 --includedir=*) includedir="$optarg"
917 --datadir=*) datadir="$optarg"
919 --with-confsuffix=*) confsuffix="$optarg"
921 --docdir=*) qemu_docdir="$optarg"
923 --sysconfdir=*) sysconfdir="$optarg"
925 --localstatedir=*) local_statedir="$optarg"
927 --firmwarepath=*) firmwarepath="$optarg"
929 --sbindir=*|--sharedstatedir=*|\
930 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
931 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
932 # These switches are silently ignored, for compatibility with
933 # autoconf-generated configure scripts. This allows QEMU's
934 # configure to be used by RPM and similar macros that set
935 # lots of directory switches by default.
937 --disable-sdl) sdl="no"
939 --enable-sdl) sdl="yes"
941 --with-sdlabi=*) sdlabi="$optarg"
943 --disable-qom-cast-debug) qom_cast_debug="no"
945 --enable-qom-cast-debug) qom_cast_debug="yes"
947 --disable-virtfs) virtfs="no"
949 --enable-virtfs) virtfs="yes"
951 --disable-mpath) mpath="no"
953 --enable-mpath) mpath="yes"
955 --disable-vnc) vnc="no"
957 --enable-vnc) vnc="yes"
959 --oss-lib=*) oss_lib="$optarg"
961 --audio-drv-list=*) audio_drv_list="$optarg"
963 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
965 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
967 --enable-debug-tcg) debug_tcg="yes"
969 --disable-debug-tcg) debug_tcg="no"
971 --enable-debug)
972 # Enable debugging options that aren't excessively noisy
973 debug_tcg="yes"
974 debug="yes"
975 strip_opt="no"
976 fortify_source="no"
978 --enable-sparse) sparse="yes"
980 --disable-sparse) sparse="no"
982 --disable-strip) strip_opt="no"
984 --disable-vnc-sasl) vnc_sasl="no"
986 --enable-vnc-sasl) vnc_sasl="yes"
988 --disable-vnc-jpeg) vnc_jpeg="no"
990 --enable-vnc-jpeg) vnc_jpeg="yes"
992 --disable-vnc-png) vnc_png="no"
994 --enable-vnc-png) vnc_png="yes"
996 --disable-slirp) slirp="no"
998 --disable-vde) vde="no"
1000 --enable-vde) vde="yes"
1002 --disable-netmap) netmap="no"
1004 --enable-netmap) netmap="yes"
1006 --disable-xen) xen="no"
1008 --enable-xen) xen="yes"
1010 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
1012 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
1014 --disable-xen-pv-domain-build) xen_pv_domain_build="no"
1016 --enable-xen-pv-domain-build) xen_pv_domain_build="yes"
1018 --disable-brlapi) brlapi="no"
1020 --enable-brlapi) brlapi="yes"
1022 --disable-bluez) bluez="no"
1024 --enable-bluez) bluez="yes"
1026 --disable-kvm) kvm="no"
1028 --enable-kvm) kvm="yes"
1030 --disable-hax) hax="no"
1032 --enable-hax) hax="yes"
1034 --disable-tcg-interpreter) tcg_interpreter="no"
1036 --enable-tcg-interpreter) tcg_interpreter="yes"
1038 --disable-cap-ng) cap_ng="no"
1040 --enable-cap-ng) cap_ng="yes"
1042 --disable-tcg) tcg="no"
1044 --enable-tcg) tcg="yes"
1046 --disable-spice) spice="no"
1048 --enable-spice) spice="yes"
1050 --disable-libiscsi) libiscsi="no"
1052 --enable-libiscsi) libiscsi="yes"
1054 --disable-libnfs) libnfs="no"
1056 --enable-libnfs) libnfs="yes"
1058 --enable-profiler) profiler="yes"
1060 --disable-cocoa) cocoa="no"
1062 --enable-cocoa)
1063 cocoa="yes" ;
1064 audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
1066 --disable-system) softmmu="no"
1068 --enable-system) softmmu="yes"
1070 --disable-user)
1071 linux_user="no" ;
1072 bsd_user="no" ;
1074 --enable-user) ;;
1075 --disable-linux-user) linux_user="no"
1077 --enable-linux-user) linux_user="yes"
1079 --disable-bsd-user) bsd_user="no"
1081 --enable-bsd-user) bsd_user="yes"
1083 --enable-pie) pie="yes"
1085 --disable-pie) pie="no"
1087 --enable-werror) werror="yes"
1089 --disable-werror) werror="no"
1091 --enable-stack-protector) stack_protector="yes"
1093 --disable-stack-protector) stack_protector="no"
1095 --disable-curses) curses="no"
1097 --enable-curses) curses="yes"
1099 --disable-curl) curl="no"
1101 --enable-curl) curl="yes"
1103 --disable-fdt) fdt="no"
1105 --enable-fdt) fdt="yes"
1107 --disable-linux-aio) linux_aio="no"
1109 --enable-linux-aio) linux_aio="yes"
1111 --disable-attr) attr="no"
1113 --enable-attr) attr="yes"
1115 --disable-blobs) blobs="no"
1117 --with-pkgversion=*) pkgversion=" ($optarg)"
1119 --with-coroutine=*) coroutine="$optarg"
1121 --disable-coroutine-pool) coroutine_pool="no"
1123 --enable-coroutine-pool) coroutine_pool="yes"
1125 --enable-debug-stack-usage) debug_stack_usage="yes"
1127 --enable-crypto-afalg) crypto_afalg="yes"
1129 --disable-crypto-afalg) crypto_afalg="no"
1131 --disable-docs) docs="no"
1133 --enable-docs) docs="yes"
1135 --disable-vhost-net) vhost_net="no"
1137 --enable-vhost-net) vhost_net="yes"
1139 --disable-vhost-scsi) vhost_scsi="no"
1141 --enable-vhost-scsi) vhost_scsi="yes"
1143 --disable-vhost-vsock) vhost_vsock="no"
1145 --enable-vhost-vsock) vhost_vsock="yes"
1147 --disable-opengl) opengl="no"
1149 --enable-opengl) opengl="yes"
1151 --disable-rbd) rbd="no"
1153 --enable-rbd) rbd="yes"
1155 --disable-xfsctl) xfs="no"
1157 --enable-xfsctl) xfs="yes"
1159 --disable-smartcard) smartcard="no"
1161 --enable-smartcard) smartcard="yes"
1163 --disable-libusb) libusb="no"
1165 --enable-libusb) libusb="yes"
1167 --disable-usb-redir) usb_redir="no"
1169 --enable-usb-redir) usb_redir="yes"
1171 --disable-zlib-test) zlib="no"
1173 --disable-lzo) lzo="no"
1175 --enable-lzo) lzo="yes"
1177 --disable-snappy) snappy="no"
1179 --enable-snappy) snappy="yes"
1181 --disable-bzip2) bzip2="no"
1183 --enable-bzip2) bzip2="yes"
1185 --enable-guest-agent) guest_agent="yes"
1187 --disable-guest-agent) guest_agent="no"
1189 --enable-guest-agent-msi) guest_agent_msi="yes"
1191 --disable-guest-agent-msi) guest_agent_msi="no"
1193 --with-vss-sdk) vss_win32_sdk=""
1195 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1197 --without-vss-sdk) vss_win32_sdk="no"
1199 --with-win-sdk) win_sdk=""
1201 --with-win-sdk=*) win_sdk="$optarg"
1203 --without-win-sdk) win_sdk="no"
1205 --enable-tools) want_tools="yes"
1207 --disable-tools) want_tools="no"
1209 --enable-seccomp) seccomp="yes"
1211 --disable-seccomp) seccomp="no"
1213 --disable-glusterfs) glusterfs="no"
1215 --enable-glusterfs) glusterfs="yes"
1217 --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
1218 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
1220 --enable-vhdx|--disable-vhdx)
1221 echo "$0: $opt is obsolete, VHDX driver is always built" >&2
1223 --enable-uuid|--disable-uuid)
1224 echo "$0: $opt is obsolete, UUID support is always built" >&2
1226 --disable-gtk) gtk="no"
1228 --enable-gtk) gtk="yes"
1230 --tls-priority=*) tls_priority="$optarg"
1232 --disable-gnutls) gnutls="no"
1234 --enable-gnutls) gnutls="yes"
1236 --disable-nettle) nettle="no"
1238 --enable-nettle) nettle="yes"
1240 --disable-gcrypt) gcrypt="no"
1242 --enable-gcrypt) gcrypt="yes"
1244 --enable-rdma) rdma="yes"
1246 --disable-rdma) rdma="no"
1248 --with-gtkabi=*) gtkabi="$optarg"
1250 --disable-vte) vte="no"
1252 --enable-vte) vte="yes"
1254 --disable-virglrenderer) virglrenderer="no"
1256 --enable-virglrenderer) virglrenderer="yes"
1258 --disable-tpm) tpm="no"
1260 --enable-tpm) tpm="yes"
1262 --disable-libssh2) libssh2="no"
1264 --enable-libssh2) libssh2="yes"
1266 --disable-live-block-migration) live_block_migration="no"
1268 --enable-live-block-migration) live_block_migration="yes"
1270 --disable-numa) numa="no"
1272 --enable-numa) numa="yes"
1274 --disable-tcmalloc) tcmalloc="no"
1276 --enable-tcmalloc) tcmalloc="yes"
1278 --disable-jemalloc) jemalloc="no"
1280 --enable-jemalloc) jemalloc="yes"
1282 --disable-replication) replication="no"
1284 --enable-replication) replication="yes"
1286 --disable-vxhs) vxhs="no"
1288 --enable-vxhs) vxhs="yes"
1290 --disable-vhost-user) vhost_user="no"
1292 --enable-vhost-user)
1293 vhost_user="yes"
1294 if test "$mingw32" = "yes"; then
1295 error_exit "vhost-user isn't available on win32"
1298 --disable-capstone) capstone="no"
1300 --enable-capstone) capstone="yes"
1303 echo "ERROR: unknown option $opt"
1304 echo "Try '$0 --help' for more information"
1305 exit 1
1307 esac
1308 done
1310 if test "$vhost_user" = ""; then
1311 if test "$mingw32" = "yes"; then
1312 vhost_user="no"
1313 else
1314 vhost_user="yes"
1318 case "$cpu" in
1319 ppc)
1320 CPU_CFLAGS="-m32"
1321 LDFLAGS="-m32 $LDFLAGS"
1323 ppc64)
1324 CPU_CFLAGS="-m64"
1325 LDFLAGS="-m64 $LDFLAGS"
1327 sparc)
1328 CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc"
1329 LDFLAGS="-m32 -mv8plus $LDFLAGS"
1331 sparc64)
1332 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
1333 LDFLAGS="-m64 $LDFLAGS"
1335 s390)
1336 CPU_CFLAGS="-m31"
1337 LDFLAGS="-m31 $LDFLAGS"
1339 s390x)
1340 CPU_CFLAGS="-m64"
1341 LDFLAGS="-m64 $LDFLAGS"
1343 i386)
1344 CPU_CFLAGS="-m32"
1345 LDFLAGS="-m32 $LDFLAGS"
1346 cc_i386='$(CC) -m32'
1348 x86_64)
1349 # ??? Only extremely old AMD cpus do not have cmpxchg16b.
1350 # If we truly care, we should simply detect this case at
1351 # runtime and generate the fallback to serial emulation.
1352 CPU_CFLAGS="-m64 -mcx16"
1353 LDFLAGS="-m64 $LDFLAGS"
1354 cc_i386='$(CC) -m32'
1356 x32)
1357 CPU_CFLAGS="-mx32"
1358 LDFLAGS="-mx32 $LDFLAGS"
1359 cc_i386='$(CC) -m32'
1361 # No special flags required for other host CPUs
1362 esac
1364 QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1365 EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1367 # For user-mode emulation the host arch has to be one we explicitly
1368 # support, even if we're using TCI.
1369 if [ "$ARCH" = "unknown" ]; then
1370 bsd_user="no"
1371 linux_user="no"
1374 default_target_list=""
1376 mak_wilds=""
1378 if [ "$softmmu" = "yes" ]; then
1379 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
1381 if [ "$linux_user" = "yes" ]; then
1382 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
1384 if [ "$bsd_user" = "yes" ]; then
1385 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
1388 for config in $mak_wilds; do
1389 default_target_list="${default_target_list} $(basename "$config" .mak)"
1390 done
1392 # Enumerate public trace backends for --help output
1393 trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/'))
1395 if test x"$show_help" = x"yes" ; then
1396 cat << EOF
1398 Usage: configure [options]
1399 Options: [defaults in brackets after descriptions]
1401 Standard options:
1402 --help print this message
1403 --prefix=PREFIX install in PREFIX [$prefix]
1404 --interp-prefix=PREFIX where to find shared libraries, etc.
1405 use %M for cpu name [$interp_prefix]
1406 --target-list=LIST set target list (default: build everything)
1407 $(echo Available targets: $default_target_list | \
1408 fold -s -w 53 | sed -e 's/^/ /')
1410 Advanced options (experts only):
1411 --source-path=PATH path of source code [$source_path]
1412 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1413 --cc=CC use C compiler CC [$cc]
1414 --iasl=IASL use ACPI compiler IASL [$iasl]
1415 --host-cc=CC use C compiler CC [$host_cc] for code run at
1416 build time
1417 --cxx=CXX use C++ compiler CXX [$cxx]
1418 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1419 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
1420 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS
1421 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1422 --make=MAKE use specified make [$make]
1423 --install=INSTALL use specified install [$install]
1424 --python=PYTHON use specified python [$python]
1425 --smbd=SMBD use specified smbd [$smbd]
1426 --static enable static build [$static]
1427 --mandir=PATH install man pages in PATH
1428 --datadir=PATH install firmware in PATH$confsuffix
1429 --docdir=PATH install documentation in PATH$confsuffix
1430 --bindir=PATH install binaries in PATH
1431 --libdir=PATH install libraries in PATH
1432 --sysconfdir=PATH install config in PATH$confsuffix
1433 --localstatedir=PATH install local state in PATH (set at runtime on win32)
1434 --firmwarepath=PATH search PATH for firmware files
1435 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
1436 --enable-debug enable common debug build options
1437 --disable-strip disable stripping binaries
1438 --disable-werror disable compilation abort on warning
1439 --disable-stack-protector disable compiler-provided stack protection
1440 --audio-drv-list=LIST set audio drivers list:
1441 Available drivers: $audio_possible_drivers
1442 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1443 --block-drv-rw-whitelist=L
1444 set block driver read-write whitelist
1445 (affects only QEMU, not qemu-img)
1446 --block-drv-ro-whitelist=L
1447 set block driver read-only whitelist
1448 (affects only QEMU, not qemu-img)
1449 --enable-trace-backends=B Set trace backend
1450 Available backends: $trace_backend_list
1451 --with-trace-file=NAME Full PATH,NAME of file to store traces
1452 Default:trace-<pid>
1453 --disable-slirp disable SLIRP userspace network connectivity
1454 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1455 --oss-lib path to OSS library
1456 --cpu=CPU Build for host CPU [$cpu]
1457 --with-coroutine=BACKEND coroutine backend. Supported options:
1458 ucontext, sigaltstack, windows
1459 --enable-gcov enable test coverage analysis with gcov
1460 --gcov=GCOV use specified gcov [$gcov_tool]
1461 --disable-blobs disable installing provided firmware blobs
1462 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1463 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1464 --tls-priority default TLS protocol/cipher priority string
1465 --enable-gprof QEMU profiling with gprof
1466 --enable-profiler profiler support
1467 --enable-xen-pv-domain-build
1468 xen pv domain builder
1469 --enable-debug-stack-usage
1470 track the maximum stack usage of stacks created by qemu_alloc_stack
1472 Optional features, enabled with --enable-FEATURE and
1473 disabled with --disable-FEATURE, default is enabled if available:
1475 system all system emulation targets
1476 user supported user emulation targets
1477 linux-user all linux usermode emulation targets
1478 bsd-user all BSD usermode emulation targets
1479 docs build documentation
1480 guest-agent build the QEMU Guest Agent
1481 guest-agent-msi build guest agent Windows MSI installation package
1482 pie Position Independent Executables
1483 modules modules support
1484 debug-tcg TCG debugging (default is disabled)
1485 debug-info debugging information
1486 sparse sparse checker
1488 gnutls GNUTLS cryptography support
1489 nettle nettle cryptography support
1490 gcrypt libgcrypt cryptography support
1491 sdl SDL UI
1492 --with-sdlabi select preferred SDL ABI 1.2 or 2.0
1493 gtk gtk UI
1494 --with-gtkabi select preferred GTK ABI 2.0 or 3.0
1495 vte vte support for the gtk UI
1496 curses curses UI
1497 vnc VNC UI support
1498 vnc-sasl SASL encryption for VNC server
1499 vnc-jpeg JPEG lossy compression for VNC server
1500 vnc-png PNG compression for VNC server
1501 cocoa Cocoa UI (Mac OS X only)
1502 virtfs VirtFS
1503 mpath Multipath persistent reservation passthrough
1504 xen xen backend driver support
1505 xen-pci-passthrough
1506 brlapi BrlAPI (Braile)
1507 curl curl connectivity
1508 fdt fdt device tree
1509 bluez bluez stack connectivity
1510 kvm KVM acceleration support
1511 hax HAX acceleration support
1512 rdma RDMA-based migration support
1513 vde support for vde network
1514 netmap support for netmap network
1515 linux-aio Linux AIO support
1516 cap-ng libcap-ng support
1517 attr attr and xattr support
1518 vhost-net vhost-net acceleration support
1519 spice spice
1520 rbd rados block device (rbd)
1521 libiscsi iscsi support
1522 libnfs nfs support
1523 smartcard smartcard support (libcacard)
1524 libusb libusb (for usb passthrough)
1525 live-block-migration Block migration in the main migration stream
1526 usb-redir usb network redirection support
1527 lzo support of lzo compression library
1528 snappy support of snappy compression library
1529 bzip2 support of bzip2 compression library
1530 (for reading bzip2-compressed dmg images)
1531 seccomp seccomp support
1532 coroutine-pool coroutine freelist (better performance)
1533 glusterfs GlusterFS backend
1534 tpm TPM support
1535 libssh2 ssh block device support
1536 numa libnuma support
1537 tcmalloc tcmalloc support
1538 jemalloc jemalloc support
1539 replication replication support
1540 vhost-vsock virtio sockets device support
1541 opengl opengl support
1542 virglrenderer virgl rendering support
1543 xfsctl xfsctl support
1544 qom-cast-debug cast debugging support
1545 tools build qemu-io, qemu-nbd and qemu-image tools
1546 vxhs Veritas HyperScale vDisk backend support
1547 crypto-afalg Linux AF_ALG crypto backend driver
1548 vhost-user vhost-user support
1549 capstone capstone disassembler support
1551 NOTE: The object files are built at the place where configure is launched
1553 exit 0
1556 if ! has $python; then
1557 error_exit "Python not found. Use --python=/path/to/python"
1560 # Note that if the Python conditional here evaluates True we will exit
1561 # with status 1 which is a shell 'false' value.
1562 if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then
1563 error_exit "Cannot use '$python', Python 2.6 or later is required." \
1564 "Note that Python 3 or later is not yet supported." \
1565 "Use --python=/path/to/python to specify a supported Python."
1568 # Suppress writing compiled files
1569 python="$python -B"
1571 # Now we have handled --enable-tcg-interpreter and know we're not just
1572 # printing the help message, bail out if the host CPU isn't supported.
1573 if test "$ARCH" = "unknown"; then
1574 if test "$tcg_interpreter" = "yes" ; then
1575 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1576 else
1577 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1581 # Consult white-list to determine whether to enable werror
1582 # by default. Only enable by default for git builds
1583 if test -z "$werror" ; then
1584 if test -d "$source_path/.git" -a \
1585 \( "$linux" = "yes" -o "$mingw32" = "yes" \) ; then
1586 werror="yes"
1587 else
1588 werror="no"
1592 # check that the C compiler works.
1593 write_c_skeleton;
1594 if compile_object ; then
1595 : C compiler works ok
1596 else
1597 error_exit "\"$cc\" either does not exist or does not work"
1599 if ! compile_prog ; then
1600 error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
1603 if test "$bogus_os" = "yes"; then
1604 # Now that we know that we're not printing the help and that
1605 # the compiler works (so the results of the check_defines we used
1606 # to identify the OS are reliable), if we didn't recognize the
1607 # host OS we should stop now.
1608 error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
1611 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1612 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1613 gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1614 gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
1615 gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags"
1616 gcc_flags="-Wno-string-plus-int $gcc_flags"
1617 # Note that we do not add -Werror to gcc_flags here, because that would
1618 # enable it for all configure tests. If a configure test failed due
1619 # to -Werror this would just silently disable some features,
1620 # so it's too error prone.
1622 cc_has_warning_flag() {
1623 write_c_skeleton;
1625 # Use the positive sense of the flag when testing for -Wno-wombat
1626 # support (gcc will happily accept the -Wno- form of unknown
1627 # warning options).
1628 optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
1629 compile_prog "-Werror $optflag" ""
1632 for flag in $gcc_flags; do
1633 if cc_has_warning_flag $flag ; then
1634 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1636 done
1638 if test "$stack_protector" != "no"; then
1639 cat > $TMPC << EOF
1640 int main(int argc, char *argv[])
1642 char arr[64], *p = arr, *c = argv[0];
1643 while (*c) {
1644 *p++ = *c++;
1646 return 0;
1649 gcc_flags="-fstack-protector-strong -fstack-protector-all"
1650 sp_on=0
1651 for flag in $gcc_flags; do
1652 # We need to check both a compile and a link, since some compiler
1653 # setups fail only on a .c->.o compile and some only at link time
1654 if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
1655 compile_prog "-Werror $flag" ""; then
1656 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1657 sp_on=1
1658 break
1660 done
1661 if test "$stack_protector" = yes; then
1662 if test $sp_on = 0; then
1663 error_exit "Stack protector not supported"
1668 # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1669 # large functions that use global variables. The bug is in all releases of
1670 # GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1671 # 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1672 cat > $TMPC << EOF
1673 #if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1674 int main(void) { return 0; }
1675 #else
1676 #error No bug in this compiler.
1677 #endif
1679 if compile_prog "-Werror -fno-gcse" "" ; then
1680 TRANSLATE_OPT_CFLAGS=-fno-gcse
1683 if test "$static" = "yes" ; then
1684 if test "$modules" = "yes" ; then
1685 error_exit "static and modules are mutually incompatible"
1687 if test "$pie" = "yes" ; then
1688 error_exit "static and pie are mutually incompatible"
1689 else
1690 pie="no"
1694 # Unconditional check for compiler __thread support
1695 cat > $TMPC << EOF
1696 static __thread int tls_var;
1697 int main(void) { return tls_var; }
1700 if ! compile_prog "-Werror" "" ; then
1701 error_exit "Your compiler does not support the __thread specifier for " \
1702 "Thread-Local Storage (TLS). Please upgrade to a version that does."
1705 if test "$pie" = ""; then
1706 case "$cpu-$targetos" in
1707 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
1710 pie="no"
1712 esac
1715 if test "$pie" != "no" ; then
1716 cat > $TMPC << EOF
1718 #ifdef __linux__
1719 # define THREAD __thread
1720 #else
1721 # define THREAD
1722 #endif
1724 static THREAD int tls_var;
1726 int main(void) { return tls_var; }
1729 if compile_prog "-fPIE -DPIE" "-pie"; then
1730 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1731 LDFLAGS="-pie $LDFLAGS"
1732 pie="yes"
1733 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1734 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1736 else
1737 if test "$pie" = "yes"; then
1738 error_exit "PIE not available due to missing toolchain support"
1739 else
1740 echo "Disabling PIE due to missing toolchain support"
1741 pie="no"
1745 if compile_prog "-Werror -fno-pie" "-nopie"; then
1746 CFLAGS_NOPIE="-fno-pie"
1747 LDFLAGS_NOPIE="-nopie"
1751 ##########################################
1752 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
1753 # use i686 as default anyway, but for those that don't, an explicit
1754 # specification is necessary
1756 if test "$cpu" = "i386"; then
1757 cat > $TMPC << EOF
1758 static int sfaa(int *ptr)
1760 return __sync_fetch_and_and(ptr, 0);
1763 int main(void)
1765 int val = 42;
1766 val = __sync_val_compare_and_swap(&val, 0, 1);
1767 sfaa(&val);
1768 return val;
1771 if ! compile_prog "" "" ; then
1772 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1776 #########################################
1777 # Solaris specific configure tool chain decisions
1779 if test "$solaris" = "yes" ; then
1780 if has $install; then
1782 else
1783 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1784 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1785 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1787 if test "$(path_of $install)" = "/usr/sbin/install" ; then
1788 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1789 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1790 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1792 if has ar; then
1794 else
1795 if test -f /usr/ccs/bin/ar ; then
1796 error_exit "No path includes ar" \
1797 "Add /usr/ccs/bin to your path and rerun configure"
1799 error_exit "No path includes ar"
1803 if test -z "${target_list+xxx}" ; then
1804 for target in $default_target_list; do
1805 supported_target $target 2>/dev/null && \
1806 target_list="$target_list $target"
1807 done
1808 target_list="${target_list# }"
1809 else
1810 target_list=$(echo "$target_list" | sed -e 's/,/ /g')
1811 for target in $target_list; do
1812 # Check that we recognised the target name; this allows a more
1813 # friendly error message than if we let it fall through.
1814 case " $default_target_list " in
1815 *" $target "*)
1818 error_exit "Unknown target name '$target'"
1820 esac
1821 supported_target $target || exit 1
1822 done
1825 # see if system emulation was really requested
1826 case " $target_list " in
1827 *"-softmmu "*) softmmu=yes
1829 *) softmmu=no
1831 esac
1833 feature_not_found() {
1834 feature=$1
1835 remedy=$2
1837 error_exit "User requested feature $feature" \
1838 "configure was not able to find it." \
1839 "$remedy"
1842 # ---
1843 # big/little endian test
1844 cat > $TMPC << EOF
1845 short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1846 short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1847 extern int foo(short *, short *);
1848 int main(int argc, char *argv[]) {
1849 return foo(big_endian, little_endian);
1853 if compile_object ; then
1854 if grep -q BiGeNdIaN $TMPO ; then
1855 bigendian="yes"
1856 elif grep -q LiTtLeEnDiAn $TMPO ; then
1857 bigendian="no"
1858 else
1859 echo big/little test failed
1861 else
1862 echo big/little test failed
1865 ##########################################
1866 # cocoa implies not SDL or GTK
1867 # (the cocoa UI code currently assumes it is always the active UI
1868 # and doesn't interact well with other UI frontend code)
1869 if test "$cocoa" = "yes"; then
1870 if test "$sdl" = "yes"; then
1871 error_exit "Cocoa and SDL UIs cannot both be enabled at once"
1873 if test "$gtk" = "yes"; then
1874 error_exit "Cocoa and GTK UIs cannot both be enabled at once"
1876 gtk=no
1877 sdl=no
1880 # Some versions of Mac OS X incorrectly define SIZE_MAX
1881 cat > $TMPC << EOF
1882 #include <stdint.h>
1883 #include <stdio.h>
1884 int main(int argc, char *argv[]) {
1885 return printf("%zu", SIZE_MAX);
1888 have_broken_size_max=no
1889 if ! compile_object -Werror ; then
1890 have_broken_size_max=yes
1893 ##########################################
1894 # L2TPV3 probe
1896 cat > $TMPC <<EOF
1897 #include <sys/socket.h>
1898 #include <linux/ip.h>
1899 int main(void) { return sizeof(struct mmsghdr); }
1901 if compile_prog "" "" ; then
1902 l2tpv3=yes
1903 else
1904 l2tpv3=no
1907 ##########################################
1908 # MinGW / Mingw-w64 localtime_r/gmtime_r check
1910 if test "$mingw32" = "yes"; then
1911 # Some versions of MinGW / Mingw-w64 lack localtime_r
1912 # and gmtime_r entirely.
1914 # Some versions of Mingw-w64 define a macro for
1915 # localtime_r/gmtime_r.
1917 # Some versions of Mingw-w64 will define functions
1918 # for localtime_r/gmtime_r, but only if you have
1919 # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
1920 # though, unistd.h and pthread.h both define
1921 # that for you.
1923 # So this #undef localtime_r and #include <unistd.h>
1924 # are not in fact redundant.
1925 cat > $TMPC << EOF
1926 #include <unistd.h>
1927 #include <time.h>
1928 #undef localtime_r
1929 int main(void) { localtime_r(NULL, NULL); return 0; }
1931 if compile_prog "" "" ; then
1932 localtime_r="yes"
1933 else
1934 localtime_r="no"
1938 ##########################################
1939 # pkg-config probe
1941 if ! has "$pkg_config_exe"; then
1942 error_exit "pkg-config binary '$pkg_config_exe' not found"
1945 ##########################################
1946 # NPTL probe
1948 if test "$linux_user" = "yes"; then
1949 cat > $TMPC <<EOF
1950 #include <sched.h>
1951 #include <linux/futex.h>
1952 int main(void) {
1953 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1954 #error bork
1955 #endif
1956 return 0;
1959 if ! compile_object ; then
1960 feature_not_found "nptl" "Install glibc and linux kernel headers."
1964 #########################################
1965 # zlib check
1967 if test "$zlib" != "no" ; then
1968 cat > $TMPC << EOF
1969 #include <zlib.h>
1970 int main(void) { zlibVersion(); return 0; }
1972 if compile_prog "" "-lz" ; then
1974 else
1975 error_exit "zlib check failed" \
1976 "Make sure to have the zlib libs and headers installed."
1979 LIBS="$LIBS -lz"
1981 ##########################################
1982 # lzo check
1984 if test "$lzo" != "no" ; then
1985 cat > $TMPC << EOF
1986 #include <lzo/lzo1x.h>
1987 int main(void) { lzo_version(); return 0; }
1989 if compile_prog "" "-llzo2" ; then
1990 libs_softmmu="$libs_softmmu -llzo2"
1991 lzo="yes"
1992 else
1993 if test "$lzo" = "yes"; then
1994 feature_not_found "liblzo2" "Install liblzo2 devel"
1996 lzo="no"
2000 ##########################################
2001 # snappy check
2003 if test "$snappy" != "no" ; then
2004 cat > $TMPC << EOF
2005 #include <snappy-c.h>
2006 int main(void) { snappy_max_compressed_length(4096); return 0; }
2008 if compile_prog "" "-lsnappy" ; then
2009 libs_softmmu="$libs_softmmu -lsnappy"
2010 snappy="yes"
2011 else
2012 if test "$snappy" = "yes"; then
2013 feature_not_found "libsnappy" "Install libsnappy devel"
2015 snappy="no"
2019 ##########################################
2020 # bzip2 check
2022 if test "$bzip2" != "no" ; then
2023 cat > $TMPC << EOF
2024 #include <bzlib.h>
2025 int main(void) { BZ2_bzlibVersion(); return 0; }
2027 if compile_prog "" "-lbz2" ; then
2028 bzip2="yes"
2029 else
2030 if test "$bzip2" = "yes"; then
2031 feature_not_found "libbzip2" "Install libbzip2 devel"
2033 bzip2="no"
2037 ##########################################
2038 # libseccomp check
2040 if test "$seccomp" != "no" ; then
2041 case "$cpu" in
2042 i386|x86_64)
2043 libseccomp_minver="2.1.0"
2045 mips)
2046 libseccomp_minver="2.2.0"
2048 arm|aarch64)
2049 libseccomp_minver="2.2.3"
2051 ppc|ppc64|s390x)
2052 libseccomp_minver="2.3.0"
2055 libseccomp_minver=""
2057 esac
2059 if test "$libseccomp_minver" != "" &&
2060 $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
2061 seccomp_cflags="$($pkg_config --cflags libseccomp)"
2062 seccomp_libs="$($pkg_config --libs libseccomp)"
2063 seccomp="yes"
2064 else
2065 if test "$seccomp" = "yes" ; then
2066 if test "$libseccomp_minver" != "" ; then
2067 feature_not_found "libseccomp" \
2068 "Install libseccomp devel >= $libseccomp_minver"
2069 else
2070 feature_not_found "libseccomp" \
2071 "libseccomp is not supported for host cpu $cpu"
2074 seccomp="no"
2077 ##########################################
2078 # xen probe
2080 if test "$xen" != "no" ; then
2081 # Check whether Xen library path is specified via --extra-ldflags to avoid
2082 # overriding this setting with pkg-config output. If not, try pkg-config
2083 # to obtain all needed flags.
2085 if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \
2086 $pkg_config --exists xencontrol ; then
2087 xen_ctrl_version="$(printf '%d%02d%02d' \
2088 $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
2089 xen=yes
2090 xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
2091 xen_pc="$xen_pc xenevtchn xendevicemodel"
2092 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
2093 libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
2094 LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS"
2095 else
2097 xen_libs="-lxenstore -lxenctrl -lxenguest"
2098 xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
2100 # First we test whether Xen headers and libraries are available.
2101 # If no, we are done and there is no Xen support.
2102 # If yes, more tests are run to detect the Xen version.
2104 # Xen (any)
2105 cat > $TMPC <<EOF
2106 #include <xenctrl.h>
2107 int main(void) {
2108 return 0;
2111 if ! compile_prog "" "$xen_libs" ; then
2112 # Xen not found
2113 if test "$xen" = "yes" ; then
2114 feature_not_found "xen" "Install xen devel"
2116 xen=no
2118 # Xen unstable
2119 elif
2120 cat > $TMPC <<EOF &&
2121 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2122 #include <xenforeignmemory.h>
2123 int main(void) {
2124 xenforeignmemory_handle *xfmem;
2126 xfmem = xenforeignmemory_open(0, 0);
2127 xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0);
2129 return 0;
2132 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
2133 then
2134 xen_stable_libs="-lxendevicemodel $xen_stable_libs"
2135 xen_ctrl_version=41000
2136 xen=yes
2137 elif
2138 cat > $TMPC <<EOF &&
2139 #undef XC_WANT_COMPAT_DEVICEMODEL_API
2140 #define __XEN_TOOLS__
2141 #include <xendevicemodel.h>
2142 int main(void) {
2143 xendevicemodel_handle *xd;
2145 xd = xendevicemodel_open(0, 0);
2146 xendevicemodel_close(xd);
2148 return 0;
2151 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
2152 then
2153 xen_stable_libs="-lxendevicemodel $xen_stable_libs"
2154 xen_ctrl_version=40900
2155 xen=yes
2156 elif
2157 cat > $TMPC <<EOF &&
2159 * If we have stable libs the we don't want the libxc compat
2160 * layers, regardless of what CFLAGS we may have been given.
2162 * Also, check if xengnttab_grant_copy_segment_t is defined and
2163 * grant copy operation is implemented.
2165 #undef XC_WANT_COMPAT_EVTCHN_API
2166 #undef XC_WANT_COMPAT_GNTTAB_API
2167 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2168 #include <xenctrl.h>
2169 #include <xenstore.h>
2170 #include <xenevtchn.h>
2171 #include <xengnttab.h>
2172 #include <xenforeignmemory.h>
2173 #include <stdint.h>
2174 #include <xen/hvm/hvm_info_table.h>
2175 #if !defined(HVM_MAX_VCPUS)
2176 # error HVM_MAX_VCPUS not defined
2177 #endif
2178 int main(void) {
2179 xc_interface *xc = NULL;
2180 xenforeignmemory_handle *xfmem;
2181 xenevtchn_handle *xe;
2182 xengnttab_handle *xg;
2183 xen_domain_handle_t handle;
2184 xengnttab_grant_copy_segment_t* seg = NULL;
2186 xs_daemon_open();
2188 xc = xc_interface_open(0, 0, 0);
2189 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2190 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2191 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2192 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2193 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2195 xfmem = xenforeignmemory_open(0, 0);
2196 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2198 xe = xenevtchn_open(0, 0);
2199 xenevtchn_fd(xe);
2201 xg = xengnttab_open(0, 0);
2202 xengnttab_grant_copy(xg, 0, seg);
2204 return 0;
2207 compile_prog "" "$xen_libs $xen_stable_libs"
2208 then
2209 xen_ctrl_version=40800
2210 xen=yes
2211 elif
2212 cat > $TMPC <<EOF &&
2214 * If we have stable libs the we don't want the libxc compat
2215 * layers, regardless of what CFLAGS we may have been given.
2217 #undef XC_WANT_COMPAT_EVTCHN_API
2218 #undef XC_WANT_COMPAT_GNTTAB_API
2219 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2220 #include <xenctrl.h>
2221 #include <xenstore.h>
2222 #include <xenevtchn.h>
2223 #include <xengnttab.h>
2224 #include <xenforeignmemory.h>
2225 #include <stdint.h>
2226 #include <xen/hvm/hvm_info_table.h>
2227 #if !defined(HVM_MAX_VCPUS)
2228 # error HVM_MAX_VCPUS not defined
2229 #endif
2230 int main(void) {
2231 xc_interface *xc = NULL;
2232 xenforeignmemory_handle *xfmem;
2233 xenevtchn_handle *xe;
2234 xengnttab_handle *xg;
2235 xen_domain_handle_t handle;
2237 xs_daemon_open();
2239 xc = xc_interface_open(0, 0, 0);
2240 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2241 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2242 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2243 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2244 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2246 xfmem = xenforeignmemory_open(0, 0);
2247 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2249 xe = xenevtchn_open(0, 0);
2250 xenevtchn_fd(xe);
2252 xg = xengnttab_open(0, 0);
2253 xengnttab_map_grant_ref(xg, 0, 0, 0);
2255 return 0;
2258 compile_prog "" "$xen_libs $xen_stable_libs"
2259 then
2260 xen_ctrl_version=40701
2261 xen=yes
2262 elif
2263 cat > $TMPC <<EOF &&
2264 #include <xenctrl.h>
2265 #include <stdint.h>
2266 int main(void) {
2267 xc_interface *xc = NULL;
2268 xen_domain_handle_t handle;
2269 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2270 return 0;
2273 compile_prog "" "$xen_libs"
2274 then
2275 xen_ctrl_version=40700
2276 xen=yes
2278 # Xen 4.6
2279 elif
2280 cat > $TMPC <<EOF &&
2281 #include <xenctrl.h>
2282 #include <xenstore.h>
2283 #include <stdint.h>
2284 #include <xen/hvm/hvm_info_table.h>
2285 #if !defined(HVM_MAX_VCPUS)
2286 # error HVM_MAX_VCPUS not defined
2287 #endif
2288 int main(void) {
2289 xc_interface *xc;
2290 xs_daemon_open();
2291 xc = xc_interface_open(0, 0, 0);
2292 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2293 xc_gnttab_open(NULL, 0);
2294 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2295 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2296 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2297 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
2298 return 0;
2301 compile_prog "" "$xen_libs"
2302 then
2303 xen_ctrl_version=40600
2304 xen=yes
2306 # Xen 4.5
2307 elif
2308 cat > $TMPC <<EOF &&
2309 #include <xenctrl.h>
2310 #include <xenstore.h>
2311 #include <stdint.h>
2312 #include <xen/hvm/hvm_info_table.h>
2313 #if !defined(HVM_MAX_VCPUS)
2314 # error HVM_MAX_VCPUS not defined
2315 #endif
2316 int main(void) {
2317 xc_interface *xc;
2318 xs_daemon_open();
2319 xc = xc_interface_open(0, 0, 0);
2320 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2321 xc_gnttab_open(NULL, 0);
2322 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2323 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2324 xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
2325 return 0;
2328 compile_prog "" "$xen_libs"
2329 then
2330 xen_ctrl_version=40500
2331 xen=yes
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 return 0;
2353 compile_prog "" "$xen_libs"
2354 then
2355 xen_ctrl_version=40200
2356 xen=yes
2358 else
2359 if test "$xen" = "yes" ; then
2360 feature_not_found "xen (unsupported version)" \
2361 "Install a supported xen (xen 4.2 or newer)"
2363 xen=no
2366 if test "$xen" = yes; then
2367 if test $xen_ctrl_version -ge 40701 ; then
2368 libs_softmmu="$xen_stable_libs $libs_softmmu"
2370 libs_softmmu="$xen_libs $libs_softmmu"
2375 if test "$xen_pci_passthrough" != "no"; then
2376 if test "$xen" = "yes" && test "$linux" = "yes"; then
2377 xen_pci_passthrough=yes
2378 else
2379 if test "$xen_pci_passthrough" = "yes"; then
2380 error_exit "User requested feature Xen PCI Passthrough" \
2381 " but this feature requires /sys from Linux"
2383 xen_pci_passthrough=no
2387 if test "$xen_pv_domain_build" = "yes" &&
2388 test "$xen" != "yes"; then
2389 error_exit "User requested Xen PV domain builder support" \
2390 "which requires Xen support."
2393 ##########################################
2394 # Sparse probe
2395 if test "$sparse" != "no" ; then
2396 if has cgcc; then
2397 sparse=yes
2398 else
2399 if test "$sparse" = "yes" ; then
2400 feature_not_found "sparse" "Install sparse binary"
2402 sparse=no
2406 ##########################################
2407 # X11 probe
2408 x11_cflags=
2409 x11_libs=-lX11
2410 if $pkg_config --exists "x11"; then
2411 x11_cflags=$($pkg_config --cflags x11)
2412 x11_libs=$($pkg_config --libs x11)
2415 ##########################################
2416 # GTK probe
2418 if test "$gtkabi" = ""; then
2419 # The GTK ABI was not specified explicitly, so try whether 3.0 is available.
2420 # Use 2.0 as a fallback if that is available.
2421 if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
2422 gtkabi=3.0
2423 elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
2424 gtkabi=2.0
2425 else
2426 gtkabi=3.0
2430 if test "$gtk" != "no"; then
2431 gtkpackage="gtk+-$gtkabi"
2432 gtkx11package="gtk+-x11-$gtkabi"
2433 if test "$gtkabi" = "3.0" ; then
2434 gtkversion="3.0.0"
2435 else
2436 gtkversion="2.18.0"
2438 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
2439 gtk_cflags=$($pkg_config --cflags $gtkpackage)
2440 gtk_libs=$($pkg_config --libs $gtkpackage)
2441 gtk_version=$($pkg_config --modversion $gtkpackage)
2442 if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
2443 gtk_cflags="$gtk_cflags $x11_cflags"
2444 gtk_libs="$gtk_libs $x11_libs"
2446 libs_softmmu="$gtk_libs $libs_softmmu"
2447 gtk="yes"
2448 elif test "$gtk" = "yes"; then
2449 feature_not_found "gtk" "Install gtk3-devel"
2450 else
2451 gtk="no"
2456 ##########################################
2457 # GNUTLS probe
2459 gnutls_works() {
2460 # Unfortunately some distros have bad pkg-config information for gnutls
2461 # such that it claims to exist but you get a compiler error if you try
2462 # to use the options returned by --libs. Specifically, Ubuntu for --static
2463 # builds doesn't work:
2464 # https://bugs.launchpad.net/ubuntu/+source/gnutls26/+bug/1478035
2466 # So sanity check the cflags/libs before assuming gnutls can be used.
2467 if ! $pkg_config --exists "gnutls"; then
2468 return 1
2471 write_c_skeleton
2472 compile_prog "$($pkg_config --cflags gnutls)" "$($pkg_config --libs gnutls)"
2475 gnutls_gcrypt=no
2476 gnutls_nettle=no
2477 if test "$gnutls" != "no"; then
2478 if gnutls_works; then
2479 gnutls_cflags=$($pkg_config --cflags gnutls)
2480 gnutls_libs=$($pkg_config --libs gnutls)
2481 libs_softmmu="$gnutls_libs $libs_softmmu"
2482 libs_tools="$gnutls_libs $libs_tools"
2483 QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
2484 gnutls="yes"
2486 # gnutls_rnd requires >= 2.11.0
2487 if $pkg_config --exists "gnutls >= 2.11.0"; then
2488 gnutls_rnd="yes"
2489 else
2490 gnutls_rnd="no"
2493 if $pkg_config --exists 'gnutls >= 3.0'; then
2494 gnutls_gcrypt=no
2495 gnutls_nettle=yes
2496 elif $pkg_config --exists 'gnutls >= 2.12'; then
2497 case $($pkg_config --libs --static gnutls) in
2498 *gcrypt*)
2499 gnutls_gcrypt=yes
2500 gnutls_nettle=no
2502 *nettle*)
2503 gnutls_gcrypt=no
2504 gnutls_nettle=yes
2507 gnutls_gcrypt=yes
2508 gnutls_nettle=no
2510 esac
2511 else
2512 gnutls_gcrypt=yes
2513 gnutls_nettle=no
2515 elif test "$gnutls" = "yes"; then
2516 feature_not_found "gnutls" "Install gnutls devel"
2517 else
2518 gnutls="no"
2519 gnutls_rnd="no"
2521 else
2522 gnutls_rnd="no"
2526 # If user didn't give a --disable/enable-gcrypt flag,
2527 # then mark as disabled if user requested nettle
2528 # explicitly, or if gnutls links to nettle
2529 if test -z "$gcrypt"
2530 then
2531 if test "$nettle" = "yes" || test "$gnutls_nettle" = "yes"
2532 then
2533 gcrypt="no"
2537 # If user didn't give a --disable/enable-nettle flag,
2538 # then mark as disabled if user requested gcrypt
2539 # explicitly, or if gnutls links to gcrypt
2540 if test -z "$nettle"
2541 then
2542 if test "$gcrypt" = "yes" || test "$gnutls_gcrypt" = "yes"
2543 then
2544 nettle="no"
2548 has_libgcrypt_config() {
2549 if ! has "libgcrypt-config"
2550 then
2551 return 1
2554 if test -n "$cross_prefix"
2555 then
2556 host=$(libgcrypt-config --host)
2557 if test "$host-" != $cross_prefix
2558 then
2559 return 1
2563 return 0
2566 if test "$gcrypt" != "no"; then
2567 if has_libgcrypt_config; then
2568 gcrypt_cflags=$(libgcrypt-config --cflags)
2569 gcrypt_libs=$(libgcrypt-config --libs)
2570 # Debian has remove -lgpg-error from libgcrypt-config
2571 # as it "spreads unnecessary dependencies" which in
2572 # turn breaks static builds...
2573 if test "$static" = "yes"
2574 then
2575 gcrypt_libs="$gcrypt_libs -lgpg-error"
2577 libs_softmmu="$gcrypt_libs $libs_softmmu"
2578 libs_tools="$gcrypt_libs $libs_tools"
2579 QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
2580 gcrypt="yes"
2581 if test -z "$nettle"; then
2582 nettle="no"
2585 cat > $TMPC << EOF
2586 #include <gcrypt.h>
2587 int main(void) {
2588 gcry_kdf_derive(NULL, 0, GCRY_KDF_PBKDF2,
2589 GCRY_MD_SHA256,
2590 NULL, 0, 0, 0, NULL);
2591 return 0;
2594 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2595 gcrypt_kdf=yes
2598 cat > $TMPC << EOF
2599 #include <gcrypt.h>
2600 int main(void) {
2601 gcry_mac_hd_t handle;
2602 gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5,
2603 GCRY_MAC_FLAG_SECURE, NULL);
2604 return 0;
2607 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2608 gcrypt_hmac=yes
2610 else
2611 if test "$gcrypt" = "yes"; then
2612 feature_not_found "gcrypt" "Install gcrypt devel"
2613 else
2614 gcrypt="no"
2620 if test "$nettle" != "no"; then
2621 if $pkg_config --exists "nettle"; then
2622 nettle_cflags=$($pkg_config --cflags nettle)
2623 nettle_libs=$($pkg_config --libs nettle)
2624 nettle_version=$($pkg_config --modversion nettle)
2625 libs_softmmu="$nettle_libs $libs_softmmu"
2626 libs_tools="$nettle_libs $libs_tools"
2627 QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
2628 nettle="yes"
2630 cat > $TMPC << EOF
2631 #include <stddef.h>
2632 #include <nettle/pbkdf2.h>
2633 int main(void) {
2634 pbkdf2_hmac_sha256(8, NULL, 1000, 8, NULL, 8, NULL);
2635 return 0;
2638 if compile_prog "$nettle_cflags" "$nettle_libs" ; then
2639 nettle_kdf=yes
2641 else
2642 if test "$nettle" = "yes"; then
2643 feature_not_found "nettle" "Install nettle devel"
2644 else
2645 nettle="no"
2650 if test "$gcrypt" = "yes" && test "$nettle" = "yes"
2651 then
2652 error_exit "Only one of gcrypt & nettle can be enabled"
2655 ##########################################
2656 # libtasn1 - only for the TLS creds/session test suite
2658 tasn1=yes
2659 tasn1_cflags=""
2660 tasn1_libs=""
2661 if $pkg_config --exists "libtasn1"; then
2662 tasn1_cflags=$($pkg_config --cflags libtasn1)
2663 tasn1_libs=$($pkg_config --libs libtasn1)
2664 else
2665 tasn1=no
2669 ##########################################
2670 # getifaddrs (for tests/test-io-channel-socket )
2672 have_ifaddrs_h=yes
2673 if ! check_include "ifaddrs.h" ; then
2674 have_ifaddrs_h=no
2677 ##########################################
2678 # VTE probe
2680 if test "$vte" != "no"; then
2681 if test "$gtkabi" = "3.0"; then
2682 vteminversion="0.32.0"
2683 if $pkg_config --exists "vte-2.91"; then
2684 vtepackage="vte-2.91"
2685 else
2686 vtepackage="vte-2.90"
2688 else
2689 vtepackage="vte"
2690 vteminversion="0.24.0"
2692 if $pkg_config --exists "$vtepackage >= $vteminversion"; then
2693 vte_cflags=$($pkg_config --cflags $vtepackage)
2694 vte_libs=$($pkg_config --libs $vtepackage)
2695 vteversion=$($pkg_config --modversion $vtepackage)
2696 libs_softmmu="$vte_libs $libs_softmmu"
2697 vte="yes"
2698 elif test "$vte" = "yes"; then
2699 if test "$gtkabi" = "3.0"; then
2700 feature_not_found "vte" "Install libvte-2.90/2.91 devel"
2701 else
2702 feature_not_found "vte" "Install libvte devel"
2704 else
2705 vte="no"
2709 ##########################################
2710 # SDL probe
2712 # Look for sdl configuration program (pkg-config or sdl-config). Try
2713 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
2715 if test "$sdlabi" = ""; then
2716 if $pkg_config --exists "sdl2"; then
2717 sdlabi=2.0
2718 elif $pkg_config --exists "sdl"; then
2719 sdlabi=1.2
2720 else
2721 sdlabi=2.0
2725 if test $sdlabi = "2.0"; then
2726 sdl_config=$sdl2_config
2727 sdlname=sdl2
2728 sdlconfigname=sdl2_config
2729 elif test $sdlabi = "1.2"; then
2730 sdlname=sdl
2731 sdlconfigname=sdl_config
2732 else
2733 error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0"
2736 if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then
2737 sdl_config=$sdlconfigname
2740 if $pkg_config $sdlname --exists; then
2741 sdlconfig="$pkg_config $sdlname"
2742 sdlversion=$($sdlconfig --modversion 2>/dev/null)
2743 elif has ${sdl_config}; then
2744 sdlconfig="$sdl_config"
2745 sdlversion=$($sdlconfig --version)
2746 else
2747 if test "$sdl" = "yes" ; then
2748 feature_not_found "sdl" "Install SDL2-devel"
2750 sdl=no
2752 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
2753 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
2756 sdl_too_old=no
2757 if test "$sdl" != "no" ; then
2758 cat > $TMPC << EOF
2759 #include <SDL.h>
2760 #undef main /* We don't want SDL to override our main() */
2761 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
2763 sdl_cflags=$($sdlconfig --cflags 2>/dev/null)
2764 if test "$static" = "yes" ; then
2765 if $pkg_config $sdlname --exists; then
2766 sdl_libs=$($pkg_config $sdlname --static --libs 2>/dev/null)
2767 else
2768 sdl_libs=$($sdlconfig --static-libs 2>/dev/null)
2770 else
2771 sdl_libs=$($sdlconfig --libs 2>/dev/null)
2773 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2774 if test $(echo $sdlversion | sed 's/[^0-9]//g') -lt 121 ; then
2775 sdl_too_old=yes
2776 else
2777 sdl=yes
2780 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
2781 if test "$sdl" = "yes" -a "$static" = "yes" ; then
2782 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
2783 sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)"
2784 sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)"
2786 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2788 else
2789 sdl=no
2791 fi # static link
2792 else # sdl not found
2793 if test "$sdl" = "yes" ; then
2794 feature_not_found "sdl" "Install SDL devel"
2796 sdl=no
2797 fi # sdl compile test
2800 if test "$sdl" = "yes" ; then
2801 cat > $TMPC <<EOF
2802 #include <SDL.h>
2803 #if defined(SDL_VIDEO_DRIVER_X11)
2804 #include <X11/XKBlib.h>
2805 #else
2806 #error No x11 support
2807 #endif
2808 int main(void) { return 0; }
2810 if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then
2811 sdl_cflags="$sdl_cflags $x11_cflags"
2812 sdl_libs="$sdl_libs $x11_libs"
2816 ##########################################
2817 # RDMA needs OpenFabrics libraries
2818 if test "$rdma" != "no" ; then
2819 cat > $TMPC <<EOF
2820 #include <rdma/rdma_cma.h>
2821 int main(void) { return 0; }
2823 rdma_libs="-lrdmacm -libverbs"
2824 if compile_prog "" "$rdma_libs" ; then
2825 rdma="yes"
2826 else
2827 if test "$rdma" = "yes" ; then
2828 error_exit \
2829 " OpenFabrics librdmacm/libibverbs not present." \
2830 " Your options:" \
2831 " (1) Fast: Install infiniband packages from your distro." \
2832 " (2) Cleanest: Install libraries from www.openfabrics.org" \
2833 " (3) Also: Install softiwarp if you don't have RDMA hardware"
2835 rdma="no"
2840 ##########################################
2841 # VNC SASL detection
2842 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
2843 cat > $TMPC <<EOF
2844 #include <sasl/sasl.h>
2845 #include <stdio.h>
2846 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
2848 # Assuming Cyrus-SASL installed in /usr prefix
2849 vnc_sasl_cflags=""
2850 vnc_sasl_libs="-lsasl2"
2851 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
2852 vnc_sasl=yes
2853 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
2854 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
2855 else
2856 if test "$vnc_sasl" = "yes" ; then
2857 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
2859 vnc_sasl=no
2863 ##########################################
2864 # VNC JPEG detection
2865 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
2866 cat > $TMPC <<EOF
2867 #include <stdio.h>
2868 #include <jpeglib.h>
2869 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2871 vnc_jpeg_cflags=""
2872 vnc_jpeg_libs="-ljpeg"
2873 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2874 vnc_jpeg=yes
2875 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
2876 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
2877 else
2878 if test "$vnc_jpeg" = "yes" ; then
2879 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
2881 vnc_jpeg=no
2885 ##########################################
2886 # VNC PNG detection
2887 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
2888 cat > $TMPC <<EOF
2889 //#include <stdio.h>
2890 #include <png.h>
2891 #include <stddef.h>
2892 int main(void) {
2893 png_structp png_ptr;
2894 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
2895 return png_ptr != 0;
2898 if $pkg_config libpng --exists; then
2899 vnc_png_cflags=$($pkg_config libpng --cflags)
2900 vnc_png_libs=$($pkg_config libpng --libs)
2901 else
2902 vnc_png_cflags=""
2903 vnc_png_libs="-lpng"
2905 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2906 vnc_png=yes
2907 libs_softmmu="$vnc_png_libs $libs_softmmu"
2908 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
2909 else
2910 if test "$vnc_png" = "yes" ; then
2911 feature_not_found "vnc-png" "Install libpng devel"
2913 vnc_png=no
2917 ##########################################
2918 # xkbcommon probe
2919 if test "$xkbcommon" != "no" ; then
2920 if $pkg_config xkbcommon --exists; then
2921 xkbcommon_cflags=$($pkg_config xkbcommon --cflags)
2922 xkbcommon_libs=$($pkg_config xkbcommon --libs)
2923 xkbcommon=yes
2924 else
2925 if test "$xkbcommon" = "yes" ; then
2926 feature_not_found "xkbcommon" "Install libxkbcommon-devel"
2928 xkbcommon=no
2932 ##########################################
2933 # fnmatch() probe, used for ACL routines
2934 fnmatch="no"
2935 cat > $TMPC << EOF
2936 #include <fnmatch.h>
2937 int main(void)
2939 fnmatch("foo", "foo", 0);
2940 return 0;
2943 if compile_prog "" "" ; then
2944 fnmatch="yes"
2947 ##########################################
2948 # xfsctl() probe, used for file-posix.c
2949 if test "$xfs" != "no" ; then
2950 cat > $TMPC << EOF
2951 #include <stddef.h> /* NULL */
2952 #include <xfs/xfs.h>
2953 int main(void)
2955 xfsctl(NULL, 0, 0, NULL);
2956 return 0;
2959 if compile_prog "" "" ; then
2960 xfs="yes"
2961 else
2962 if test "$xfs" = "yes" ; then
2963 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
2965 xfs=no
2969 ##########################################
2970 # vde libraries probe
2971 if test "$vde" != "no" ; then
2972 vde_libs="-lvdeplug"
2973 cat > $TMPC << EOF
2974 #include <libvdeplug.h>
2975 int main(void)
2977 struct vde_open_args a = {0, 0, 0};
2978 char s[] = "";
2979 vde_open(s, s, &a);
2980 return 0;
2983 if compile_prog "" "$vde_libs" ; then
2984 vde=yes
2985 else
2986 if test "$vde" = "yes" ; then
2987 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
2989 vde=no
2993 ##########################################
2994 # netmap support probe
2995 # Apart from looking for netmap headers, we make sure that the host API version
2996 # supports the netmap backend (>=11). The upper bound (15) is meant to simulate
2997 # a minor/major version number. Minor new features will be marked with values up
2998 # to 15, and if something happens that requires a change to the backend we will
2999 # move above 15, submit the backend fixes and modify this two bounds.
3000 if test "$netmap" != "no" ; then
3001 cat > $TMPC << EOF
3002 #include <inttypes.h>
3003 #include <net/if.h>
3004 #include <net/netmap.h>
3005 #include <net/netmap_user.h>
3006 #if (NETMAP_API < 11) || (NETMAP_API > 15)
3007 #error
3008 #endif
3009 int main(void) { return 0; }
3011 if compile_prog "" "" ; then
3012 netmap=yes
3013 else
3014 if test "$netmap" = "yes" ; then
3015 feature_not_found "netmap"
3017 netmap=no
3021 ##########################################
3022 # libcap-ng library probe
3023 if test "$cap_ng" != "no" ; then
3024 cap_libs="-lcap-ng"
3025 cat > $TMPC << EOF
3026 #include <cap-ng.h>
3027 int main(void)
3029 capng_capability_to_name(CAPNG_EFFECTIVE);
3030 return 0;
3033 if compile_prog "" "$cap_libs" ; then
3034 cap_ng=yes
3035 libs_tools="$cap_libs $libs_tools"
3036 else
3037 if test "$cap_ng" = "yes" ; then
3038 feature_not_found "cap_ng" "Install libcap-ng devel"
3040 cap_ng=no
3044 ##########################################
3045 # Sound support libraries probe
3047 audio_drv_probe()
3049 drv=$1
3050 hdr=$2
3051 lib=$3
3052 exp=$4
3053 cfl=$5
3054 cat > $TMPC << EOF
3055 #include <$hdr>
3056 int main(void) { $exp }
3058 if compile_prog "$cfl" "$lib" ; then
3060 else
3061 error_exit "$drv check failed" \
3062 "Make sure to have the $drv libs and headers installed."
3066 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g')
3067 for drv in $audio_drv_list; do
3068 case $drv in
3069 alsa)
3070 audio_drv_probe $drv alsa/asoundlib.h -lasound \
3071 "return snd_pcm_close((snd_pcm_t *)0);"
3072 alsa_libs="-lasound"
3076 audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \
3077 "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;"
3078 pulse_libs="-lpulse"
3079 audio_pt_int="yes"
3082 sdl)
3083 if test "$sdl" = "no"; then
3084 error_exit "sdl not found or disabled, can not use sdl audio driver"
3088 coreaudio)
3089 coreaudio_libs="-framework CoreAudio"
3092 dsound)
3093 dsound_libs="-lole32 -ldxguid"
3094 audio_win_int="yes"
3097 oss)
3098 oss_libs="$oss_lib"
3101 wav)
3102 # XXX: Probes for CoreAudio, DirectSound
3106 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
3107 error_exit "Unknown driver '$drv' selected" \
3108 "Possible drivers are: $audio_possible_drivers"
3111 esac
3112 done
3114 ##########################################
3115 # BrlAPI probe
3117 if test "$brlapi" != "no" ; then
3118 brlapi_libs="-lbrlapi"
3119 cat > $TMPC << EOF
3120 #include <brlapi.h>
3121 #include <stddef.h>
3122 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
3124 if compile_prog "" "$brlapi_libs" ; then
3125 brlapi=yes
3126 else
3127 if test "$brlapi" = "yes" ; then
3128 feature_not_found "brlapi" "Install brlapi devel"
3130 brlapi=no
3134 ##########################################
3135 # curses probe
3136 if test "$curses" != "no" ; then
3137 if test "$mingw32" = "yes" ; then
3138 curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
3139 curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
3140 else
3141 curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
3142 curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
3144 curses_found=no
3145 cat > $TMPC << EOF
3146 #include <locale.h>
3147 #include <curses.h>
3148 #include <wchar.h>
3149 int main(void) {
3150 wchar_t wch = L'w';
3151 setlocale(LC_ALL, "");
3152 resize_term(0, 0);
3153 addwstr(L"wide chars\n");
3154 addnwstr(&wch, 1);
3155 add_wch(WACS_DEGREE);
3156 return 0;
3159 IFS=:
3160 for curses_inc in $curses_inc_list; do
3161 # Make sure we get the wide character prototypes
3162 curses_inc="-DNCURSES_WIDECHAR $curses_inc"
3163 IFS=:
3164 for curses_lib in $curses_lib_list; do
3165 unset IFS
3166 if compile_prog "$curses_inc" "$curses_lib" ; then
3167 curses_found=yes
3168 QEMU_CFLAGS="$curses_inc $QEMU_CFLAGS"
3169 libs_softmmu="$curses_lib $libs_softmmu"
3170 break
3172 done
3173 if test "$curses_found" = yes ; then
3174 break
3176 done
3177 unset IFS
3178 if test "$curses_found" = "yes" ; then
3179 curses=yes
3180 else
3181 if test "$curses" = "yes" ; then
3182 feature_not_found "curses" "Install ncurses devel"
3184 curses=no
3188 ##########################################
3189 # curl probe
3190 if test "$curl" != "no" ; then
3191 if $pkg_config libcurl --exists; then
3192 curlconfig="$pkg_config libcurl"
3193 else
3194 curlconfig=curl-config
3196 cat > $TMPC << EOF
3197 #include <curl/curl.h>
3198 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
3200 curl_cflags=$($curlconfig --cflags 2>/dev/null)
3201 curl_libs=$($curlconfig --libs 2>/dev/null)
3202 if compile_prog "$curl_cflags" "$curl_libs" ; then
3203 curl=yes
3204 else
3205 if test "$curl" = "yes" ; then
3206 feature_not_found "curl" "Install libcurl devel"
3208 curl=no
3210 fi # test "$curl"
3212 ##########################################
3213 # bluez support probe
3214 if test "$bluez" != "no" ; then
3215 cat > $TMPC << EOF
3216 #include <bluetooth/bluetooth.h>
3217 int main(void) { return bt_error(0); }
3219 bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null)
3220 bluez_libs=$($pkg_config --libs bluez 2>/dev/null)
3221 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
3222 bluez=yes
3223 libs_softmmu="$bluez_libs $libs_softmmu"
3224 else
3225 if test "$bluez" = "yes" ; then
3226 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
3228 bluez="no"
3232 ##########################################
3233 # glib support probe
3235 if test "$mingw32" = yes; then
3236 glib_req_ver=2.30
3237 else
3238 glib_req_ver=2.22
3240 glib_modules=gthread-2.0
3241 if test "$modules" = yes; then
3242 glib_modules="$glib_modules gmodule-2.0"
3245 # This workaround is required due to a bug in pkg-config file for glib as it
3246 # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
3248 if test "$static" = yes -a "$mingw32" = yes; then
3249 QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS"
3252 for i in $glib_modules; do
3253 if $pkg_config --atleast-version=$glib_req_ver $i; then
3254 glib_cflags=$($pkg_config --cflags $i)
3255 glib_libs=$($pkg_config --libs $i)
3256 QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
3257 LIBS="$glib_libs $LIBS"
3258 libs_qga="$glib_libs $libs_qga"
3259 else
3260 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
3262 done
3264 # Sanity check that the current size_t matches the
3265 # size that glib thinks it should be. This catches
3266 # problems on multi-arch where people try to build
3267 # 32-bit QEMU while pointing at 64-bit glib headers
3268 cat > $TMPC <<EOF
3269 #include <glib.h>
3270 #include <unistd.h>
3272 #define QEMU_BUILD_BUG_ON(x) \
3273 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
3275 int main(void) {
3276 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
3277 return 0;
3281 if ! compile_prog "$CFLAGS" "$LIBS" ; then
3282 error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
3283 "You probably need to set PKG_CONFIG_LIBDIR"\
3284 "to point to the right pkg-config files for your"\
3285 "build target"
3288 # g_test_trap_subprocess added in 2.38. Used by some tests.
3289 glib_subprocess=yes
3290 if ! $pkg_config --atleast-version=2.38 glib-2.0; then
3291 glib_subprocess=no
3294 # Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage
3295 cat > $TMPC << EOF
3296 #include <glib.h>
3297 int main(void) { return 0; }
3299 if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
3300 if cc_has_warning_flag "-Wno-unknown-attributes"; then
3301 glib_cflags="-Wno-unknown-attributes $glib_cflags"
3302 CFLAGS="-Wno-unknown-attributes $CFLAGS"
3306 ##########################################
3307 # SHA command probe for modules
3308 if test "$modules" = yes; then
3309 shacmd_probe="sha1sum sha1 shasum"
3310 for c in $shacmd_probe; do
3311 if has $c; then
3312 shacmd="$c"
3313 break
3315 done
3316 if test "$shacmd" = ""; then
3317 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
3321 ##########################################
3322 # pixman support probe
3324 if test "$want_tools" = "no" -a "$softmmu" = "no"; then
3325 pixman_cflags=
3326 pixman_libs=
3327 elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
3328 pixman_cflags=$($pkg_config --cflags pixman-1)
3329 pixman_libs=$($pkg_config --libs pixman-1)
3330 else
3331 error_exit "pixman >= 0.21.8 not present." \
3332 "Please install the pixman devel package."
3335 ##########################################
3336 # libmpathpersist probe
3338 if test "$mpath" != "no" ; then
3339 cat > $TMPC <<EOF
3340 #include <libudev.h>
3341 #include <mpath_persist.h>
3342 unsigned mpath_mx_alloc_len = 1024;
3343 int logsink;
3344 static struct config *multipath_conf;
3345 extern struct udev *udev;
3346 extern struct config *get_multipath_config(void);
3347 extern void put_multipath_config(struct config *conf);
3348 struct udev *udev;
3349 struct config *get_multipath_config(void) { return multipath_conf; }
3350 void put_multipath_config(struct config *conf) { }
3352 int main(void) {
3353 udev = udev_new();
3354 multipath_conf = mpath_lib_init();
3355 return 0;
3358 if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then
3359 mpathpersist=yes
3360 else
3361 mpathpersist=no
3363 else
3364 mpathpersist=no
3367 ##########################################
3368 # libcap probe
3370 if test "$cap" != "no" ; then
3371 cat > $TMPC <<EOF
3372 #include <stdio.h>
3373 #include <sys/capability.h>
3374 int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
3376 if compile_prog "" "-lcap" ; then
3377 cap=yes
3378 else
3379 cap=no
3383 ##########################################
3384 # pthread probe
3385 PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
3387 pthread=no
3388 cat > $TMPC << EOF
3389 #include <pthread.h>
3390 static void *f(void *p) { return NULL; }
3391 int main(void) {
3392 pthread_t thread;
3393 pthread_create(&thread, 0, f, 0);
3394 return 0;
3397 if compile_prog "" "" ; then
3398 pthread=yes
3399 else
3400 for pthread_lib in $PTHREADLIBS_LIST; do
3401 if compile_prog "" "$pthread_lib" ; then
3402 pthread=yes
3403 found=no
3404 for lib_entry in $LIBS; do
3405 if test "$lib_entry" = "$pthread_lib"; then
3406 found=yes
3407 break
3409 done
3410 if test "$found" = "no"; then
3411 LIBS="$pthread_lib $LIBS"
3413 PTHREAD_LIB="$pthread_lib"
3414 break
3416 done
3419 if test "$mingw32" != yes -a "$pthread" = no; then
3420 error_exit "pthread check failed" \
3421 "Make sure to have the pthread libs and headers installed."
3424 # check for pthread_setname_np
3425 pthread_setname_np=no
3426 cat > $TMPC << EOF
3427 #include <pthread.h>
3429 static void *f(void *p) { return NULL; }
3430 int main(void)
3432 pthread_t thread;
3433 pthread_create(&thread, 0, f, 0);
3434 pthread_setname_np(thread, "QEMU");
3435 return 0;
3438 if compile_prog "" "$pthread_lib" ; then
3439 pthread_setname_np=yes
3442 ##########################################
3443 # rbd probe
3444 if test "$rbd" != "no" ; then
3445 cat > $TMPC <<EOF
3446 #include <stdio.h>
3447 #include <rbd/librbd.h>
3448 int main(void) {
3449 rados_t cluster;
3450 rados_create(&cluster, NULL);
3451 return 0;
3454 rbd_libs="-lrbd -lrados"
3455 if compile_prog "" "$rbd_libs" ; then
3456 rbd=yes
3457 else
3458 if test "$rbd" = "yes" ; then
3459 feature_not_found "rados block device" "Install librbd/ceph devel"
3461 rbd=no
3465 ##########################################
3466 # libssh2 probe
3467 min_libssh2_version=1.2.8
3468 if test "$libssh2" != "no" ; then
3469 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
3470 libssh2_cflags=$($pkg_config libssh2 --cflags)
3471 libssh2_libs=$($pkg_config libssh2 --libs)
3472 libssh2=yes
3473 else
3474 if test "$libssh2" = "yes" ; then
3475 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
3477 libssh2=no
3481 ##########################################
3482 # libssh2_sftp_fsync probe
3484 if test "$libssh2" = "yes"; then
3485 cat > $TMPC <<EOF
3486 #include <stdio.h>
3487 #include <libssh2.h>
3488 #include <libssh2_sftp.h>
3489 int main(void) {
3490 LIBSSH2_SESSION *session;
3491 LIBSSH2_SFTP *sftp;
3492 LIBSSH2_SFTP_HANDLE *sftp_handle;
3493 session = libssh2_session_init ();
3494 sftp = libssh2_sftp_init (session);
3495 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
3496 libssh2_sftp_fsync (sftp_handle);
3497 return 0;
3500 # libssh2_cflags/libssh2_libs defined in previous test.
3501 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
3502 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
3506 ##########################################
3507 # linux-aio probe
3509 if test "$linux_aio" != "no" ; then
3510 cat > $TMPC <<EOF
3511 #include <libaio.h>
3512 #include <sys/eventfd.h>
3513 #include <stddef.h>
3514 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
3516 if compile_prog "" "-laio" ; then
3517 linux_aio=yes
3518 else
3519 if test "$linux_aio" = "yes" ; then
3520 feature_not_found "linux AIO" "Install libaio devel"
3522 linux_aio=no
3526 ##########################################
3527 # TPM passthrough is only on x86 Linux
3529 if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
3530 tpm_passthrough=$tpm
3531 else
3532 tpm_passthrough=no
3535 # TPM emulator is for all posix systems
3536 if test "$mingw32" != "yes"; then
3537 tpm_emulator=$tpm
3538 else
3539 tpm_emulator=no
3541 ##########################################
3542 # attr probe
3544 if test "$attr" != "no" ; then
3545 cat > $TMPC <<EOF
3546 #include <stdio.h>
3547 #include <sys/types.h>
3548 #ifdef CONFIG_LIBATTR
3549 #include <attr/xattr.h>
3550 #else
3551 #include <sys/xattr.h>
3552 #endif
3553 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
3555 if compile_prog "" "" ; then
3556 attr=yes
3557 # Older distros have <attr/xattr.h>, and need -lattr:
3558 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
3559 attr=yes
3560 LIBS="-lattr $LIBS"
3561 libattr=yes
3562 else
3563 if test "$attr" = "yes" ; then
3564 feature_not_found "ATTR" "Install libc6 or libattr devel"
3566 attr=no
3570 ##########################################
3571 # iovec probe
3572 cat > $TMPC <<EOF
3573 #include <sys/types.h>
3574 #include <sys/uio.h>
3575 #include <unistd.h>
3576 int main(void) { return sizeof(struct iovec); }
3578 iovec=no
3579 if compile_prog "" "" ; then
3580 iovec=yes
3583 ##########################################
3584 # preadv probe
3585 cat > $TMPC <<EOF
3586 #include <sys/types.h>
3587 #include <sys/uio.h>
3588 #include <unistd.h>
3589 int main(void) { return preadv(0, 0, 0, 0); }
3591 preadv=no
3592 if compile_prog "" "" ; then
3593 preadv=yes
3596 ##########################################
3597 # fdt probe
3598 # fdt support is mandatory for at least some target architectures,
3599 # so insist on it if we're building those system emulators.
3600 fdt_required=no
3601 for target in $target_list; do
3602 case $target in
3603 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu)
3604 fdt_required=yes
3606 esac
3607 done
3609 if test "$fdt_required" = "yes"; then
3610 if test "$fdt" = "no"; then
3611 error_exit "fdt disabled but some requested targets require it." \
3612 "You can turn off fdt only if you also disable all the system emulation" \
3613 "targets which need it (by specifying a cut down --target-list)."
3615 fdt=yes
3618 if test "$fdt" != "no" ; then
3619 fdt_libs="-lfdt"
3620 # explicitly check for libfdt_env.h as it is missing in some stable installs
3621 # and test for required functions to make sure we are on a version >= 1.4.2
3622 cat > $TMPC << EOF
3623 #include <libfdt.h>
3624 #include <libfdt_env.h>
3625 int main(void) { fdt_first_subnode(0, 0); return 0; }
3627 if compile_prog "" "$fdt_libs" ; then
3628 # system DTC is good - use it
3629 fdt=yes
3630 else
3631 # have GIT checkout, so activate dtc submodule
3632 if test -e "${source_path}/.git" ; then
3633 git_submodules="${git_submodules} dtc"
3635 if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
3636 fdt=yes
3637 dtc_internal="yes"
3638 mkdir -p dtc
3639 if [ "$pwd_is_source_path" != "y" ] ; then
3640 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
3641 symlink "$source_path/dtc/scripts" "dtc/scripts"
3643 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
3644 fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
3645 elif test "$fdt" = "yes" ; then
3646 # Not a git build & no libfdt found, prompt for system install
3647 error_exit "DTC (libfdt) version >= 1.4.2 not present." \
3648 "Please install the DTC (libfdt) devel package"
3649 else
3650 # don't have and don't want
3651 fdt_libs=
3652 fdt=no
3657 libs_softmmu="$libs_softmmu $fdt_libs"
3659 ##########################################
3660 # opengl probe (for sdl2, gtk, milkymist-tmu2)
3662 if test "$opengl" != "no" ; then
3663 opengl_pkgs="epoxy libdrm gbm"
3664 if $pkg_config $opengl_pkgs x11; then
3665 opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
3666 opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
3667 opengl=yes
3668 if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
3669 gtk_gl="yes"
3671 QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
3672 else
3673 if test "$opengl" = "yes" ; then
3674 feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
3676 opengl_cflags=""
3677 opengl_libs=""
3678 opengl=no
3682 if test "$opengl" = "yes"; then
3683 cat > $TMPC << EOF
3684 #include <epoxy/egl.h>
3685 #ifndef EGL_MESA_image_dma_buf_export
3686 # error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
3687 #endif
3688 int main(void) { return 0; }
3690 if compile_prog "" "" ; then
3691 opengl_dmabuf=yes
3696 ##########################################
3697 # glusterfs probe
3698 if test "$glusterfs" != "no" ; then
3699 if $pkg_config --atleast-version=3 glusterfs-api; then
3700 glusterfs="yes"
3701 glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
3702 glusterfs_libs=$($pkg_config --libs glusterfs-api)
3703 if $pkg_config --atleast-version=4 glusterfs-api; then
3704 glusterfs_xlator_opt="yes"
3706 if $pkg_config --atleast-version=5 glusterfs-api; then
3707 glusterfs_discard="yes"
3709 if $pkg_config --atleast-version=6 glusterfs-api; then
3710 glusterfs_fallocate="yes"
3711 glusterfs_zerofill="yes"
3713 else
3714 if test "$glusterfs" = "yes" ; then
3715 feature_not_found "GlusterFS backend support" \
3716 "Install glusterfs-api devel >= 3"
3718 glusterfs="no"
3722 # Check for inotify functions when we are building linux-user
3723 # emulator. This is done because older glibc versions don't
3724 # have syscall stubs for these implemented. In that case we
3725 # don't provide them even if kernel supports them.
3727 inotify=no
3728 cat > $TMPC << EOF
3729 #include <sys/inotify.h>
3732 main(void)
3734 /* try to start inotify */
3735 return inotify_init();
3738 if compile_prog "" "" ; then
3739 inotify=yes
3742 inotify1=no
3743 cat > $TMPC << EOF
3744 #include <sys/inotify.h>
3747 main(void)
3749 /* try to start inotify */
3750 return inotify_init1(0);
3753 if compile_prog "" "" ; then
3754 inotify1=yes
3757 # check if pipe2 is there
3758 pipe2=no
3759 cat > $TMPC << EOF
3760 #include <unistd.h>
3761 #include <fcntl.h>
3763 int main(void)
3765 int pipefd[2];
3766 return pipe2(pipefd, O_CLOEXEC);
3769 if compile_prog "" "" ; then
3770 pipe2=yes
3773 # check if accept4 is there
3774 accept4=no
3775 cat > $TMPC << EOF
3776 #include <sys/socket.h>
3777 #include <stddef.h>
3779 int main(void)
3781 accept4(0, NULL, NULL, SOCK_CLOEXEC);
3782 return 0;
3785 if compile_prog "" "" ; then
3786 accept4=yes
3789 # check if tee/splice is there. vmsplice was added same time.
3790 splice=no
3791 cat > $TMPC << EOF
3792 #include <unistd.h>
3793 #include <fcntl.h>
3794 #include <limits.h>
3796 int main(void)
3798 int len, fd = 0;
3799 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
3800 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
3801 return 0;
3804 if compile_prog "" "" ; then
3805 splice=yes
3808 ##########################################
3809 # libnuma probe
3811 if test "$numa" != "no" ; then
3812 cat > $TMPC << EOF
3813 #include <numa.h>
3814 int main(void) { return numa_available(); }
3817 if compile_prog "" "-lnuma" ; then
3818 numa=yes
3819 libs_softmmu="-lnuma $libs_softmmu"
3820 else
3821 if test "$numa" = "yes" ; then
3822 feature_not_found "numa" "install numactl devel"
3824 numa=no
3828 if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
3829 echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
3830 exit 1
3833 ##########################################
3834 # tcmalloc probe
3836 if test "$tcmalloc" = "yes" ; then
3837 cat > $TMPC << EOF
3838 #include <stdlib.h>
3839 int main(void) { malloc(1); return 0; }
3842 if compile_prog "" "-ltcmalloc" ; then
3843 LIBS="-ltcmalloc $LIBS"
3844 else
3845 feature_not_found "tcmalloc" "install gperftools devel"
3849 ##########################################
3850 # jemalloc probe
3852 if test "$jemalloc" = "yes" ; then
3853 cat > $TMPC << EOF
3854 #include <stdlib.h>
3855 int main(void) { malloc(1); return 0; }
3858 if compile_prog "" "-ljemalloc" ; then
3859 LIBS="-ljemalloc $LIBS"
3860 else
3861 feature_not_found "jemalloc" "install jemalloc devel"
3865 ##########################################
3866 # signalfd probe
3867 signalfd="no"
3868 cat > $TMPC << EOF
3869 #include <unistd.h>
3870 #include <sys/syscall.h>
3871 #include <signal.h>
3872 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
3875 if compile_prog "" "" ; then
3876 signalfd=yes
3879 # check if eventfd is supported
3880 eventfd=no
3881 cat > $TMPC << EOF
3882 #include <sys/eventfd.h>
3884 int main(void)
3886 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
3889 if compile_prog "" "" ; then
3890 eventfd=yes
3893 # check if memfd is supported
3894 memfd=no
3895 cat > $TMPC << EOF
3896 #include <sys/memfd.h>
3898 int main(void)
3900 return memfd_create("foo", MFD_ALLOW_SEALING);
3903 if compile_prog "" "" ; then
3904 memfd=yes
3909 # check for fallocate
3910 fallocate=no
3911 cat > $TMPC << EOF
3912 #include <fcntl.h>
3914 int main(void)
3916 fallocate(0, 0, 0, 0);
3917 return 0;
3920 if compile_prog "" "" ; then
3921 fallocate=yes
3924 # check for fallocate hole punching
3925 fallocate_punch_hole=no
3926 cat > $TMPC << EOF
3927 #include <fcntl.h>
3928 #include <linux/falloc.h>
3930 int main(void)
3932 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
3933 return 0;
3936 if compile_prog "" "" ; then
3937 fallocate_punch_hole=yes
3940 # check that fallocate supports range zeroing inside the file
3941 fallocate_zero_range=no
3942 cat > $TMPC << EOF
3943 #include <fcntl.h>
3944 #include <linux/falloc.h>
3946 int main(void)
3948 fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0);
3949 return 0;
3952 if compile_prog "" "" ; then
3953 fallocate_zero_range=yes
3956 # check for posix_fallocate
3957 posix_fallocate=no
3958 cat > $TMPC << EOF
3959 #include <fcntl.h>
3961 int main(void)
3963 posix_fallocate(0, 0, 0);
3964 return 0;
3967 if compile_prog "" "" ; then
3968 posix_fallocate=yes
3971 # check for sync_file_range
3972 sync_file_range=no
3973 cat > $TMPC << EOF
3974 #include <fcntl.h>
3976 int main(void)
3978 sync_file_range(0, 0, 0, 0);
3979 return 0;
3982 if compile_prog "" "" ; then
3983 sync_file_range=yes
3986 # check for linux/fiemap.h and FS_IOC_FIEMAP
3987 fiemap=no
3988 cat > $TMPC << EOF
3989 #include <sys/ioctl.h>
3990 #include <linux/fs.h>
3991 #include <linux/fiemap.h>
3993 int main(void)
3995 ioctl(0, FS_IOC_FIEMAP, 0);
3996 return 0;
3999 if compile_prog "" "" ; then
4000 fiemap=yes
4003 # check for dup3
4004 dup3=no
4005 cat > $TMPC << EOF
4006 #include <unistd.h>
4008 int main(void)
4010 dup3(0, 0, 0);
4011 return 0;
4014 if compile_prog "" "" ; then
4015 dup3=yes
4018 # check for ppoll support
4019 ppoll=no
4020 cat > $TMPC << EOF
4021 #include <poll.h>
4023 int main(void)
4025 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
4026 ppoll(&pfd, 1, 0, 0);
4027 return 0;
4030 if compile_prog "" "" ; then
4031 ppoll=yes
4034 # check for prctl(PR_SET_TIMERSLACK , ... ) support
4035 prctl_pr_set_timerslack=no
4036 cat > $TMPC << EOF
4037 #include <sys/prctl.h>
4039 int main(void)
4041 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
4042 return 0;
4045 if compile_prog "" "" ; then
4046 prctl_pr_set_timerslack=yes
4049 # check for epoll support
4050 epoll=no
4051 cat > $TMPC << EOF
4052 #include <sys/epoll.h>
4054 int main(void)
4056 epoll_create(0);
4057 return 0;
4060 if compile_prog "" "" ; then
4061 epoll=yes
4064 # epoll_create1 is a later addition
4065 # so we must check separately for its presence
4066 epoll_create1=no
4067 cat > $TMPC << EOF
4068 #include <sys/epoll.h>
4070 int main(void)
4072 /* Note that we use epoll_create1 as a value, not as
4073 * a function being called. This is necessary so that on
4074 * old SPARC glibc versions where the function was present in
4075 * the library but not declared in the header file we will
4076 * fail the configure check. (Otherwise we will get a compiler
4077 * warning but not an error, and will proceed to fail the
4078 * qemu compile where we compile with -Werror.)
4080 return (int)(uintptr_t)&epoll_create1;
4083 if compile_prog "" "" ; then
4084 epoll_create1=yes
4087 # check for sendfile support
4088 sendfile=no
4089 cat > $TMPC << EOF
4090 #include <sys/sendfile.h>
4092 int main(void)
4094 return sendfile(0, 0, 0, 0);
4097 if compile_prog "" "" ; then
4098 sendfile=yes
4101 # check for timerfd support (glibc 2.8 and newer)
4102 timerfd=no
4103 cat > $TMPC << EOF
4104 #include <sys/timerfd.h>
4106 int main(void)
4108 return(timerfd_create(CLOCK_REALTIME, 0));
4111 if compile_prog "" "" ; then
4112 timerfd=yes
4115 # check for setns and unshare support
4116 setns=no
4117 cat > $TMPC << EOF
4118 #include <sched.h>
4120 int main(void)
4122 int ret;
4123 ret = setns(0, 0);
4124 ret = unshare(0);
4125 return ret;
4128 if compile_prog "" "" ; then
4129 setns=yes
4132 # clock_adjtime probe
4133 clock_adjtime=no
4134 cat > $TMPC <<EOF
4135 #include <time.h>
4137 int main(void)
4139 return clock_adjtime(0, 0);
4142 clock_adjtime=no
4143 if compile_prog "" "" ; then
4144 clock_adjtime=yes
4147 # syncfs probe
4148 syncfs=no
4149 cat > $TMPC <<EOF
4150 #include <unistd.h>
4152 int main(void)
4154 return syncfs(0);
4157 syncfs=no
4158 if compile_prog "" "" ; then
4159 syncfs=yes
4162 # Check if tools are available to build documentation.
4163 if test "$docs" != "no" ; then
4164 if has makeinfo && has pod2man; then
4165 docs=yes
4166 else
4167 if test "$docs" = "yes" ; then
4168 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
4170 docs=no
4174 # Search for bswap_32 function
4175 byteswap_h=no
4176 cat > $TMPC << EOF
4177 #include <byteswap.h>
4178 int main(void) { return bswap_32(0); }
4180 if compile_prog "" "" ; then
4181 byteswap_h=yes
4184 # Search for bswap32 function
4185 bswap_h=no
4186 cat > $TMPC << EOF
4187 #include <sys/endian.h>
4188 #include <sys/types.h>
4189 #include <machine/bswap.h>
4190 int main(void) { return bswap32(0); }
4192 if compile_prog "" "" ; then
4193 bswap_h=yes
4196 ##########################################
4197 # Do we have libiscsi >= 1.9.0
4198 if test "$libiscsi" != "no" ; then
4199 if $pkg_config --atleast-version=1.9.0 libiscsi; then
4200 libiscsi="yes"
4201 libiscsi_cflags=$($pkg_config --cflags libiscsi)
4202 libiscsi_libs=$($pkg_config --libs libiscsi)
4203 else
4204 if test "$libiscsi" = "yes" ; then
4205 feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
4207 libiscsi="no"
4211 ##########################################
4212 # Do we need libm
4213 cat > $TMPC << EOF
4214 #include <math.h>
4215 int main(int argc, char **argv) { return isnan(sin((double)argc)); }
4217 if compile_prog "" "" ; then
4219 elif compile_prog "" "-lm" ; then
4220 LIBS="-lm $LIBS"
4221 libs_qga="-lm $libs_qga"
4222 else
4223 error_exit "libm check failed"
4226 ##########################################
4227 # Do we need librt
4228 # uClibc provides 2 versions of clock_gettime(), one with realtime
4229 # support and one without. This means that the clock_gettime() don't
4230 # need -lrt. We still need it for timer_create() so we check for this
4231 # function in addition.
4232 cat > $TMPC <<EOF
4233 #include <signal.h>
4234 #include <time.h>
4235 int main(void) {
4236 timer_create(CLOCK_REALTIME, NULL, NULL);
4237 return clock_gettime(CLOCK_REALTIME, NULL);
4241 if compile_prog "" "" ; then
4243 # we need pthread for static linking. use previous pthread test result
4244 elif compile_prog "" "$pthread_lib -lrt" ; then
4245 LIBS="$LIBS -lrt"
4246 libs_qga="$libs_qga -lrt"
4249 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
4250 "$haiku" != "yes" ; then
4251 libs_softmmu="-lutil $libs_softmmu"
4254 ##########################################
4255 # spice probe
4256 if test "$spice" != "no" ; then
4257 cat > $TMPC << EOF
4258 #include <spice.h>
4259 int main(void) { spice_server_new(); return 0; }
4261 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
4262 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
4263 if $pkg_config --atleast-version=0.12.0 spice-server && \
4264 $pkg_config --atleast-version=0.12.3 spice-protocol && \
4265 compile_prog "$spice_cflags" "$spice_libs" ; then
4266 spice="yes"
4267 libs_softmmu="$libs_softmmu $spice_libs"
4268 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
4269 spice_protocol_version=$($pkg_config --modversion spice-protocol)
4270 spice_server_version=$($pkg_config --modversion spice-server)
4271 else
4272 if test "$spice" = "yes" ; then
4273 feature_not_found "spice" \
4274 "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel"
4276 spice="no"
4280 # check for smartcard support
4281 if test "$smartcard" != "no"; then
4282 if $pkg_config libcacard; then
4283 libcacard_cflags=$($pkg_config --cflags libcacard)
4284 libcacard_libs=$($pkg_config --libs libcacard)
4285 smartcard="yes"
4286 else
4287 if test "$smartcard" = "yes"; then
4288 feature_not_found "smartcard" "Install libcacard devel"
4290 smartcard="no"
4294 # check for libusb
4295 if test "$libusb" != "no" ; then
4296 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
4297 libusb="yes"
4298 libusb_cflags=$($pkg_config --cflags libusb-1.0)
4299 libusb_libs=$($pkg_config --libs libusb-1.0)
4300 else
4301 if test "$libusb" = "yes"; then
4302 feature_not_found "libusb" "Install libusb devel >= 1.0.13"
4304 libusb="no"
4308 # check for usbredirparser for usb network redirection support
4309 if test "$usb_redir" != "no" ; then
4310 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
4311 usb_redir="yes"
4312 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
4313 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
4314 else
4315 if test "$usb_redir" = "yes"; then
4316 feature_not_found "usb-redir" "Install usbredir devel"
4318 usb_redir="no"
4322 ##########################################
4323 # check if we have VSS SDK headers for win
4325 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
4326 case "$vss_win32_sdk" in
4327 "") vss_win32_include="-isystem $source_path" ;;
4328 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
4329 # handle path with spaces. So we symlink the headers into ".sdk/vss".
4330 vss_win32_include="-isystem $source_path/.sdk/vss"
4331 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
4333 *) vss_win32_include="-isystem $vss_win32_sdk"
4334 esac
4335 cat > $TMPC << EOF
4336 #define __MIDL_user_allocate_free_DEFINED__
4337 #include <inc/win2003/vss.h>
4338 int main(void) { return VSS_CTX_BACKUP; }
4340 if compile_prog "$vss_win32_include" "" ; then
4341 guest_agent_with_vss="yes"
4342 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
4343 libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
4344 qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
4345 else
4346 if test "$vss_win32_sdk" != "" ; then
4347 echo "ERROR: Please download and install Microsoft VSS SDK:"
4348 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
4349 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
4350 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
4351 echo "ERROR: The headers are extracted in the directory \`inc'."
4352 feature_not_found "VSS support"
4354 guest_agent_with_vss="no"
4358 ##########################################
4359 # lookup Windows platform SDK (if not specified)
4360 # The SDK is needed only to build .tlb (type library) file of guest agent
4361 # VSS provider from the source. It is usually unnecessary because the
4362 # pre-compiled .tlb file is included.
4364 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
4365 if test -z "$win_sdk"; then
4366 programfiles="$PROGRAMFILES"
4367 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
4368 if test -n "$programfiles"; then
4369 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
4370 else
4371 feature_not_found "Windows SDK"
4373 elif test "$win_sdk" = "no"; then
4374 win_sdk=""
4378 ##########################################
4379 # check if mingw environment provides a recent ntddscsi.h
4380 if test "$mingw32" = "yes" -a "$guest_agent" != "no"; then
4381 cat > $TMPC << EOF
4382 #include <windows.h>
4383 #include <ntddscsi.h>
4384 int main(void) {
4385 #if !defined(IOCTL_SCSI_GET_ADDRESS)
4386 #error Missing required ioctl definitions
4387 #endif
4388 SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
4389 return addr.Lun;
4392 if compile_prog "" "" ; then
4393 guest_agent_ntddscsi=yes
4394 libs_qga="-lsetupapi $libs_qga"
4398 ##########################################
4399 # virgl renderer probe
4401 if test "$virglrenderer" != "no" ; then
4402 cat > $TMPC << EOF
4403 #include <virglrenderer.h>
4404 int main(void) { virgl_renderer_poll(); return 0; }
4406 virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null)
4407 virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null)
4408 if $pkg_config virglrenderer >/dev/null 2>&1 && \
4409 compile_prog "$virgl_cflags" "$virgl_libs" ; then
4410 virglrenderer="yes"
4411 else
4412 if test "$virglrenderer" = "yes" ; then
4413 feature_not_found "virglrenderer"
4415 virglrenderer="no"
4419 ##########################################
4420 # capstone
4422 if test "$capstone" != no; then
4423 if $pkg_config capstone; then
4424 capstone=yes
4425 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)"
4426 LIBS="$($pkg_config --libs capstone) $LIBS"
4427 else
4428 if test "$capstone" = yes; then
4429 feature_not_found capstone
4431 capstone=no
4435 ##########################################
4436 # check if we have fdatasync
4438 fdatasync=no
4439 cat > $TMPC << EOF
4440 #include <unistd.h>
4441 int main(void) {
4442 #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
4443 return fdatasync(0);
4444 #else
4445 #error Not supported
4446 #endif
4449 if compile_prog "" "" ; then
4450 fdatasync=yes
4453 ##########################################
4454 # check if we have madvise
4456 madvise=no
4457 cat > $TMPC << EOF
4458 #include <sys/types.h>
4459 #include <sys/mman.h>
4460 #include <stddef.h>
4461 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
4463 if compile_prog "" "" ; then
4464 madvise=yes
4467 ##########################################
4468 # check if we have posix_madvise
4470 posix_madvise=no
4471 cat > $TMPC << EOF
4472 #include <sys/mman.h>
4473 #include <stddef.h>
4474 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
4476 if compile_prog "" "" ; then
4477 posix_madvise=yes
4480 ##########################################
4481 # check if we have posix_syslog
4483 posix_syslog=no
4484 cat > $TMPC << EOF
4485 #include <syslog.h>
4486 int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; }
4488 if compile_prog "" "" ; then
4489 posix_syslog=yes
4492 ##########################################
4493 # check if we have sem_timedwait
4495 sem_timedwait=no
4496 cat > $TMPC << EOF
4497 #include <semaphore.h>
4498 int main(void) { return sem_timedwait(0, 0); }
4500 if compile_prog "" "" ; then
4501 sem_timedwait=yes
4504 ##########################################
4505 # check if trace backend exists
4507 $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
4508 if test "$?" -ne 0 ; then
4509 error_exit "invalid trace backends" \
4510 "Please choose supported trace backends."
4513 ##########################################
4514 # For 'ust' backend, test if ust headers are present
4515 if have_backend "ust"; then
4516 cat > $TMPC << EOF
4517 #include <lttng/tracepoint.h>
4518 int main(void) { return 0; }
4520 if compile_prog "" "-Wl,--no-as-needed -ldl" ; then
4521 if $pkg_config lttng-ust --exists; then
4522 lttng_ust_libs=$($pkg_config --libs lttng-ust)
4523 else
4524 lttng_ust_libs="-llttng-ust -ldl"
4526 if $pkg_config liburcu-bp --exists; then
4527 urcu_bp_libs=$($pkg_config --libs liburcu-bp)
4528 else
4529 urcu_bp_libs="-lurcu-bp"
4532 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
4533 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
4534 else
4535 error_exit "Trace backend 'ust' missing lttng-ust header files"
4539 ##########################################
4540 # For 'dtrace' backend, test if 'dtrace' command is present
4541 if have_backend "dtrace"; then
4542 if ! has 'dtrace' ; then
4543 error_exit "dtrace command is not found in PATH $PATH"
4545 trace_backend_stap="no"
4546 if has 'stap' ; then
4547 trace_backend_stap="yes"
4551 ##########################################
4552 # check and set a backend for coroutine
4554 # We prefer ucontext, but it's not always possible. The fallback
4555 # is sigcontext. On Windows the only valid backend is the Windows
4556 # specific one.
4558 ucontext_works=no
4559 if test "$darwin" != "yes"; then
4560 cat > $TMPC << EOF
4561 #include <ucontext.h>
4562 #ifdef __stub_makecontext
4563 #error Ignoring glibc stub makecontext which will always fail
4564 #endif
4565 int main(void) { makecontext(0, 0, 0); return 0; }
4567 if compile_prog "" "" ; then
4568 ucontext_works=yes
4572 if test "$coroutine" = ""; then
4573 if test "$mingw32" = "yes"; then
4574 coroutine=win32
4575 elif test "$ucontext_works" = "yes"; then
4576 coroutine=ucontext
4577 else
4578 coroutine=sigaltstack
4580 else
4581 case $coroutine in
4582 windows)
4583 if test "$mingw32" != "yes"; then
4584 error_exit "'windows' coroutine backend only valid for Windows"
4586 # Unfortunately the user visible backend name doesn't match the
4587 # coroutine-*.c filename for this case, so we have to adjust it here.
4588 coroutine=win32
4590 ucontext)
4591 if test "$ucontext_works" != "yes"; then
4592 feature_not_found "ucontext"
4595 sigaltstack)
4596 if test "$mingw32" = "yes"; then
4597 error_exit "only the 'windows' coroutine backend is valid for Windows"
4601 error_exit "unknown coroutine backend $coroutine"
4603 esac
4606 if test "$coroutine_pool" = ""; then
4607 coroutine_pool=yes
4610 if test "$debug_stack_usage" = "yes"; then
4611 if test "$cpu" = "ia64" -o "$cpu" = "hppa"; then
4612 error_exit "stack usage debugging is not supported for $cpu"
4614 if test "$coroutine_pool" = "yes"; then
4615 echo "WARN: disabling coroutine pool for stack usage debugging"
4616 coroutine_pool=no
4621 ##########################################
4622 # check if we have open_by_handle_at
4624 open_by_handle_at=no
4625 cat > $TMPC << EOF
4626 #include <fcntl.h>
4627 #if !defined(AT_EMPTY_PATH)
4628 # error missing definition
4629 #else
4630 int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
4631 #endif
4633 if compile_prog "" "" ; then
4634 open_by_handle_at=yes
4637 ########################################
4638 # check if we have linux/magic.h
4640 linux_magic_h=no
4641 cat > $TMPC << EOF
4642 #include <linux/magic.h>
4643 int main(void) {
4644 return 0;
4647 if compile_prog "" "" ; then
4648 linux_magic_h=yes
4651 ########################################
4652 # check whether we can disable warning option with a pragma (this is needed
4653 # to silence warnings in the headers of some versions of external libraries).
4654 # This test has to be compiled with -Werror as otherwise an unknown pragma is
4655 # only a warning.
4657 # If we can't selectively disable warning in the code, disable -Werror so that
4658 # the build doesn't fail anyway.
4660 pragma_disable_unused_but_set=no
4661 cat > $TMPC << EOF
4662 #pragma GCC diagnostic push
4663 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
4664 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
4665 #pragma GCC diagnostic pop
4667 int main(void) {
4668 return 0;
4671 if compile_prog "-Werror" "" ; then
4672 pragma_diagnostic_available=yes
4673 else
4674 werror=no
4677 ########################################
4678 # check if we have valgrind/valgrind.h
4680 valgrind_h=no
4681 cat > $TMPC << EOF
4682 #include <valgrind/valgrind.h>
4683 int main(void) {
4684 return 0;
4687 if compile_prog "" "" ; then
4688 valgrind_h=yes
4691 ########################################
4692 # check if environ is declared
4694 has_environ=no
4695 cat > $TMPC << EOF
4696 #include <unistd.h>
4697 int main(void) {
4698 environ = 0;
4699 return 0;
4702 if compile_prog "" "" ; then
4703 has_environ=yes
4706 ########################################
4707 # check if cpuid.h is usable.
4709 cat > $TMPC << EOF
4710 #include <cpuid.h>
4711 int main(void) {
4712 unsigned a, b, c, d;
4713 int max = __get_cpuid_max(0, 0);
4715 if (max >= 1) {
4716 __cpuid(1, a, b, c, d);
4719 if (max >= 7) {
4720 __cpuid_count(7, 0, a, b, c, d);
4723 return 0;
4726 if compile_prog "" "" ; then
4727 cpuid_h=yes
4730 ##########################################
4731 # avx2 optimization requirement check
4733 # There is no point enabling this if cpuid.h is not usable,
4734 # since we won't be able to select the new routines.
4736 if test $cpuid_h = yes; then
4737 cat > $TMPC << EOF
4738 #pragma GCC push_options
4739 #pragma GCC target("avx2")
4740 #include <cpuid.h>
4741 #include <immintrin.h>
4742 static int bar(void *a) {
4743 __m256i x = *(__m256i *)a;
4744 return _mm256_testz_si256(x, x);
4746 int main(int argc, char *argv[]) { return bar(argv[0]); }
4748 if compile_object "" ; then
4749 avx2_opt="yes"
4753 ########################################
4754 # check if __[u]int128_t is usable.
4756 int128=no
4757 cat > $TMPC << EOF
4758 #if defined(__clang_major__) && defined(__clang_minor__)
4759 # if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
4760 # error __int128_t does not work in CLANG before 3.2
4761 # endif
4762 #endif
4763 __int128_t a;
4764 __uint128_t b;
4765 int main (void) {
4766 a = a + b;
4767 b = a * b;
4768 a = a * a;
4769 return 0;
4772 if compile_prog "" "" ; then
4773 int128=yes
4776 #########################################
4777 # See if 128-bit atomic operations are supported.
4779 atomic128=no
4780 if test "$int128" = "yes"; then
4781 cat > $TMPC << EOF
4782 int main(void)
4784 unsigned __int128 x = 0, y = 0;
4785 y = __atomic_load_16(&x, 0);
4786 __atomic_store_16(&x, y, 0);
4787 __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0);
4788 return 0;
4791 if compile_prog "" "" ; then
4792 atomic128=yes
4796 #########################################
4797 # See if 64-bit atomic operations are supported.
4798 # Note that without __atomic builtins, we can only
4799 # assume atomic loads/stores max at pointer size.
4801 cat > $TMPC << EOF
4802 #include <stdint.h>
4803 int main(void)
4805 uint64_t x = 0, y = 0;
4806 #ifdef __ATOMIC_RELAXED
4807 y = __atomic_load_8(&x, 0);
4808 __atomic_store_8(&x, y, 0);
4809 __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
4810 __atomic_exchange_8(&x, y, 0);
4811 __atomic_fetch_add_8(&x, y, 0);
4812 #else
4813 typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
4814 __sync_lock_test_and_set(&x, y);
4815 __sync_val_compare_and_swap(&x, y, 0);
4816 __sync_fetch_and_add(&x, y);
4817 #endif
4818 return 0;
4821 if compile_prog "" "" ; then
4822 atomic64=yes
4825 ########################################
4826 # check if getauxval is available.
4828 getauxval=no
4829 cat > $TMPC << EOF
4830 #include <sys/auxv.h>
4831 int main(void) {
4832 return getauxval(AT_HWCAP) == 0;
4835 if compile_prog "" "" ; then
4836 getauxval=yes
4839 ########################################
4840 # check if ccache is interfering with
4841 # semantic analysis of macros
4843 unset CCACHE_CPP2
4844 ccache_cpp2=no
4845 cat > $TMPC << EOF
4846 static const int Z = 1;
4847 #define fn() ({ Z; })
4848 #define TAUT(X) ((X) == Z)
4849 #define PAREN(X, Y) (X == Y)
4850 #define ID(X) (X)
4851 int main(int argc, char *argv[])
4853 int x = 0, y = 0;
4854 x = ID(x);
4855 x = fn();
4856 fn();
4857 if (PAREN(x, y)) return 0;
4858 if (TAUT(Z)) return 0;
4859 return 0;
4863 if ! compile_object "-Werror"; then
4864 ccache_cpp2=yes
4867 #################################################
4868 # clang does not support glibc + FORTIFY_SOURCE.
4870 if test "$fortify_source" != "no"; then
4871 if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
4872 fortify_source="no";
4873 elif test -n "$cxx" && has $cxx &&
4874 echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then
4875 fortify_source="no";
4876 else
4877 fortify_source="yes"
4881 ##########################################
4882 # check if struct fsxattr is available via linux/fs.h
4884 have_fsxattr=no
4885 cat > $TMPC << EOF
4886 #include <linux/fs.h>
4887 struct fsxattr foo;
4888 int main(void) {
4889 return 0;
4892 if compile_prog "" "" ; then
4893 have_fsxattr=yes
4896 ##########################################
4897 # check if rtnetlink.h exists and is useful
4898 have_rtnetlink=no
4899 cat > $TMPC << EOF
4900 #include <linux/rtnetlink.h>
4901 int main(void) {
4902 return IFLA_PROTO_DOWN;
4905 if compile_prog "" "" ; then
4906 have_rtnetlink=yes
4909 ##########################################
4910 # check for usable AF_VSOCK environment
4911 have_af_vsock=no
4912 cat > $TMPC << EOF
4913 #include <errno.h>
4914 #include <sys/types.h>
4915 #include <sys/socket.h>
4916 #if !defined(AF_VSOCK)
4917 # error missing AF_VSOCK flag
4918 #endif
4919 #include <linux/vm_sockets.h>
4920 int main(void) {
4921 int sock, ret;
4922 struct sockaddr_vm svm;
4923 socklen_t len = sizeof(svm);
4924 sock = socket(AF_VSOCK, SOCK_STREAM, 0);
4925 ret = getpeername(sock, (struct sockaddr *)&svm, &len);
4926 if ((ret == -1) && (errno == ENOTCONN)) {
4927 return 0;
4929 return -1;
4932 if compile_prog "" "" ; then
4933 have_af_vsock=yes
4936 ##########################################
4937 # check for usable AF_ALG environment
4938 hava_afalg=no
4939 cat > $TMPC << EOF
4940 #include <errno.h>
4941 #include <sys/types.h>
4942 #include <sys/socket.h>
4943 #include <linux/if_alg.h>
4944 int main(void) {
4945 int sock;
4946 sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
4947 return sock;
4950 if compile_prog "" "" ; then
4951 have_afalg=yes
4953 if test "$crypto_afalg" = "yes"
4954 then
4955 if test "$have_afalg" != "yes"
4956 then
4957 error_exit "AF_ALG requested but could not be detected"
4962 #################################################
4963 # Sparc implicitly links with --relax, which is
4964 # incompatible with -r, so --no-relax should be
4965 # given. It does no harm to give it on other
4966 # platforms too.
4968 # Note: the prototype is needed since QEMU_CFLAGS
4969 # contains -Wmissing-prototypes
4970 cat > $TMPC << EOF
4971 extern int foo(void);
4972 int foo(void) { return 0; }
4974 if ! compile_object ""; then
4975 error_exit "Failed to compile object file for LD_REL_FLAGS test"
4977 for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do
4978 if do_cc -nostdlib $i -o $TMPMO $TMPO; then
4979 LD_REL_FLAGS=$i
4980 break
4982 done
4983 if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then
4984 feature_not_found "modules" "Cannot find how to build relocatable objects"
4987 ##########################################
4988 # check for sysmacros.h
4990 have_sysmacros=no
4991 cat > $TMPC << EOF
4992 #include <sys/sysmacros.h>
4993 int main(void) {
4994 return makedev(0, 0);
4997 if compile_prog "" "" ; then
4998 have_sysmacros=yes
5001 ##########################################
5002 # Veritas HyperScale block driver VxHS
5003 # Check if libvxhs is installed
5005 if test "$vxhs" != "no" ; then
5006 cat > $TMPC <<EOF
5007 #include <stdint.h>
5008 #include <qnio/qnio_api.h>
5010 void *vxhs_callback;
5012 int main(void) {
5013 iio_init(QNIO_VERSION, vxhs_callback);
5014 return 0;
5017 vxhs_libs="-lvxhs -lssl"
5018 if compile_prog "" "$vxhs_libs" ; then
5019 vxhs=yes
5020 else
5021 if test "$vxhs" = "yes" ; then
5022 feature_not_found "vxhs block device" "Install libvxhs See github"
5024 vxhs=no
5028 ##########################################
5029 # check for _Static_assert()
5031 have_static_assert=no
5032 cat > $TMPC << EOF
5033 _Static_assert(1, "success");
5034 int main(void) {
5035 return 0;
5038 if compile_prog "" "" ; then
5039 have_static_assert=yes
5042 ##########################################
5043 # check for utmpx.h, it is missing e.g. on OpenBSD
5045 have_utmpx=no
5046 cat > $TMPC << EOF
5047 #include <utmpx.h>
5048 struct utmpx user_info;
5049 int main(void) {
5050 return 0;
5053 if compile_prog "" "" ; then
5054 have_utmpx=yes
5057 ##########################################
5058 # End of CC checks
5059 # After here, no more $cc or $ld runs
5061 if test "$gcov" = "yes" ; then
5062 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
5063 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
5064 elif test "$fortify_source" = "yes" ; then
5065 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
5066 elif test "$debug" = "no"; then
5067 CFLAGS="-O2 $CFLAGS"
5070 ##########################################
5071 # Do we have libnfs
5072 if test "$libnfs" != "no" ; then
5073 if $pkg_config --atleast-version=1.9.3 libnfs; then
5074 libnfs="yes"
5075 libnfs_libs=$($pkg_config --libs libnfs)
5076 else
5077 if test "$libnfs" = "yes" ; then
5078 feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
5080 libnfs="no"
5084 # Now we've finished running tests it's OK to add -Werror to the compiler flags
5085 if test "$werror" = "yes"; then
5086 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
5089 if test "$solaris" = "no" ; then
5090 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
5091 LDFLAGS="-Wl,--warn-common $LDFLAGS"
5095 # test if pod2man has --utf8 option
5096 if pod2man --help | grep -q utf8; then
5097 POD2MAN="pod2man --utf8"
5098 else
5099 POD2MAN="pod2man"
5102 # Use ASLR, no-SEH and DEP if available
5103 if test "$mingw32" = "yes" ; then
5104 for flag in --dynamicbase --no-seh --nxcompat; do
5105 if ld_has $flag ; then
5106 LDFLAGS="-Wl,$flag $LDFLAGS"
5108 done
5111 qemu_confdir=$sysconfdir$confsuffix
5112 qemu_moddir=$libdir$confsuffix
5113 qemu_datadir=$datadir$confsuffix
5114 qemu_localedir="$datadir/locale"
5116 # We can only support ivshmem if we have eventfd
5117 if [ "$eventfd" = "yes" ]; then
5118 ivshmem=yes
5121 tools=""
5122 if test "$want_tools" = "yes" ; then
5123 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
5124 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
5125 tools="qemu-nbd\$(EXESUF) $tools"
5127 if [ "$ivshmem" = "yes" ]; then
5128 tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools"
5131 if test "$softmmu" = yes ; then
5132 if test "$linux" = yes; then
5133 if test "$virtfs" != no && test "$cap" = yes && test "$attr" = yes ; then
5134 virtfs=yes
5135 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
5136 else
5137 if test "$virtfs" = yes; then
5138 error_exit "VirtFS requires libcap devel and libattr devel"
5140 virtfs=no
5142 if test "$mpath" != no && test "$mpathpersist" = yes ; then
5143 mpath=yes
5144 else
5145 if test "$mpath" = yes; then
5146 error_exit "Multipath requires libmpathpersist devel"
5148 mpath=no
5150 tools="$tools scsi/qemu-pr-helper\$(EXESUF)"
5151 else
5152 if test "$virtfs" = yes; then
5153 error_exit "VirtFS is supported only on Linux"
5155 virtfs=no
5156 if test "$mpath" = yes; then
5157 error_exit "Multipath is supported only on Linux"
5159 mpath=no
5161 if test "$xkbcommon" = "yes"; then
5162 tools="qemu-keymap\$(EXESUF) $tools"
5166 # Probe for guest agent support/options
5168 if [ "$guest_agent" != "no" ]; then
5169 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
5170 tools="qemu-ga $tools"
5171 guest_agent=yes
5172 elif [ "$guest_agent" != yes ]; then
5173 guest_agent=no
5174 else
5175 error_exit "Guest agent is not supported on this platform"
5179 # Guest agent Window MSI package
5181 if test "$guest_agent" != yes; then
5182 if test "$guest_agent_msi" = yes; then
5183 error_exit "MSI guest agent package requires guest agent enabled"
5185 guest_agent_msi=no
5186 elif test "$mingw32" != "yes"; then
5187 if test "$guest_agent_msi" = "yes"; then
5188 error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation"
5190 guest_agent_msi=no
5191 elif ! has wixl; then
5192 if test "$guest_agent_msi" = "yes"; then
5193 error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )"
5195 guest_agent_msi=no
5196 else
5197 # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't
5198 # disabled explicitly
5199 if test "$guest_agent_msi" != "no"; then
5200 guest_agent_msi=yes
5204 if test "$guest_agent_msi" = "yes"; then
5205 if test "$guest_agent_with_vss" = "yes"; then
5206 QEMU_GA_MSI_WITH_VSS="-D InstallVss"
5209 if test "$QEMU_GA_MANUFACTURER" = ""; then
5210 QEMU_GA_MANUFACTURER=QEMU
5213 if test "$QEMU_GA_DISTRO" = ""; then
5214 QEMU_GA_DISTRO=Linux
5217 if test "$QEMU_GA_VERSION" = ""; then
5218 QEMU_GA_VERSION=$(cat $source_path/VERSION)
5221 QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin"
5223 case "$cpu" in
5224 x86_64)
5225 QEMU_GA_MSI_ARCH="-a x64 -D Arch=64"
5227 i386)
5228 QEMU_GA_MSI_ARCH="-D Arch=32"
5231 error_exit "CPU $cpu not supported for building installation package"
5233 esac
5236 # Mac OS X ships with a broken assembler
5237 roms=
5238 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
5239 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
5240 "$softmmu" = yes ; then
5241 # Different host OS linkers have different ideas about the name of the ELF
5242 # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd
5243 # variant; and Windows uses i386pe.
5244 for emu in elf_i386 elf_i386_fbsd i386pe; do
5245 if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
5246 ld_i386_emulation="$emu"
5247 roms="optionrom"
5248 break
5250 done
5252 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
5253 roms="$roms spapr-rtas"
5256 if test "$cpu" = "s390x" ; then
5257 roms="$roms s390-ccw"
5260 # Probe for the need for relocating the user-only binary.
5261 if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
5262 textseg_addr=
5263 case "$cpu" in
5264 arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
5265 # ??? Rationale for choosing this address
5266 textseg_addr=0x60000000
5268 mips)
5269 # A 256M aligned address, high in the address space, with enough
5270 # room for the code_gen_buffer above it before the stack.
5271 textseg_addr=0x60000000
5273 esac
5274 if [ -n "$textseg_addr" ]; then
5275 cat > $TMPC <<EOF
5276 int main(void) { return 0; }
5278 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
5279 if ! compile_prog "" "$textseg_ldflags"; then
5280 # In case ld does not support -Ttext-segment, edit the default linker
5281 # script via sed to set the .text start addr. This is needed on FreeBSD
5282 # at least.
5283 if ! $ld --verbose >/dev/null 2>&1; then
5284 error_exit \
5285 "We need to link the QEMU user mode binaries at a" \
5286 "specific text address. Unfortunately your linker" \
5287 "doesn't support either the -Ttext-segment option or" \
5288 "printing the default linker script with --verbose." \
5289 "If you don't want the user mode binaries, pass the" \
5290 "--disable-user option to configure."
5293 $ld --verbose | sed \
5294 -e '1,/==================================================/d' \
5295 -e '/==================================================/,$d' \
5296 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
5297 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
5298 textseg_ldflags="-Wl,-T../config-host.ld"
5303 # Check that the C++ compiler exists and works with the C compiler.
5304 # All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
5305 if has $cxx; then
5306 cat > $TMPC <<EOF
5307 int c_function(void);
5308 int main(void) { return c_function(); }
5311 compile_object
5313 cat > $TMPCXX <<EOF
5314 extern "C" {
5315 int c_function(void);
5317 int c_function(void) { return 42; }
5320 update_cxxflags
5322 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
5323 # C++ compiler $cxx works ok with C compiler $cc
5325 else
5326 echo "C++ compiler $cxx does not work with C compiler $cc"
5327 echo "Disabling C++ specific optional code"
5328 cxx=
5330 else
5331 echo "No C++ compiler available; disabling C++ specific optional code"
5332 cxx=
5335 echo_version() {
5336 if test "$1" = "yes" ; then
5337 echo "($2)"
5341 # prepend pixman and ftd flags after all config tests are done
5342 QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
5343 libs_softmmu="$pixman_libs $libs_softmmu"
5345 echo "Install prefix $prefix"
5346 echo "BIOS directory $(eval echo $qemu_datadir)"
5347 echo "firmware path $(eval echo $firmwarepath)"
5348 echo "binary directory $(eval echo $bindir)"
5349 echo "library directory $(eval echo $libdir)"
5350 echo "module directory $(eval echo $qemu_moddir)"
5351 echo "libexec directory $(eval echo $libexecdir)"
5352 echo "include directory $(eval echo $includedir)"
5353 echo "config directory $(eval echo $sysconfdir)"
5354 if test "$mingw32" = "no" ; then
5355 echo "local state directory $(eval echo $local_statedir)"
5356 echo "Manual directory $(eval echo $mandir)"
5357 echo "ELF interp prefix $interp_prefix"
5358 else
5359 echo "local state directory queried at runtime"
5360 echo "Windows SDK $win_sdk"
5362 echo "Source path $source_path"
5363 echo "GIT submodules $git_submodules"
5364 echo "C compiler $cc"
5365 echo "Host C compiler $host_cc"
5366 echo "C++ compiler $cxx"
5367 echo "Objective-C compiler $objcc"
5368 echo "ARFLAGS $ARFLAGS"
5369 echo "CFLAGS $CFLAGS"
5370 echo "QEMU_CFLAGS $QEMU_CFLAGS"
5371 echo "LDFLAGS $LDFLAGS"
5372 echo "make $make"
5373 echo "install $install"
5374 echo "python $python"
5375 if test "$slirp" = "yes" ; then
5376 echo "smbd $smbd"
5378 echo "module support $modules"
5379 echo "host CPU $cpu"
5380 echo "host big endian $bigendian"
5381 echo "target list $target_list"
5382 echo "gprof enabled $gprof"
5383 echo "sparse enabled $sparse"
5384 echo "strip binaries $strip_opt"
5385 echo "profiler $profiler"
5386 echo "static build $static"
5387 if test "$darwin" = "yes" ; then
5388 echo "Cocoa support $cocoa"
5390 echo "SDL support $sdl $(echo_version $sdl $sdlversion)"
5391 echo "GTK support $gtk $(echo_version $gtk $gtk_version)"
5392 echo "GTK GL support $gtk_gl"
5393 echo "VTE support $vte $(echo_version $vte $vteversion)"
5394 echo "TLS priority $tls_priority"
5395 echo "GNUTLS support $gnutls"
5396 echo "GNUTLS rnd $gnutls_rnd"
5397 echo "libgcrypt $gcrypt"
5398 echo "libgcrypt kdf $gcrypt_kdf"
5399 echo "nettle $nettle $(echo_version $nettle $nettle_version)"
5400 echo "nettle kdf $nettle_kdf"
5401 echo "libtasn1 $tasn1"
5402 echo "curses support $curses"
5403 echo "virgl support $virglrenderer"
5404 echo "curl support $curl"
5405 echo "mingw32 support $mingw32"
5406 echo "Audio drivers $audio_drv_list"
5407 echo "Block whitelist (rw) $block_drv_rw_whitelist"
5408 echo "Block whitelist (ro) $block_drv_ro_whitelist"
5409 echo "VirtFS support $virtfs"
5410 echo "Multipath support $mpath"
5411 echo "VNC support $vnc"
5412 if test "$vnc" = "yes" ; then
5413 echo "VNC SASL support $vnc_sasl"
5414 echo "VNC JPEG support $vnc_jpeg"
5415 echo "VNC PNG support $vnc_png"
5417 if test -n "$sparc_cpu"; then
5418 echo "Target Sparc Arch $sparc_cpu"
5420 echo "xen support $xen"
5421 if test "$xen" = "yes" ; then
5422 echo "xen ctrl version $xen_ctrl_version"
5423 echo "pv dom build $xen_pv_domain_build"
5425 echo "brlapi support $brlapi"
5426 echo "bluez support $bluez"
5427 echo "Documentation $docs"
5428 echo "PIE $pie"
5429 echo "vde support $vde"
5430 echo "netmap support $netmap"
5431 echo "Linux AIO support $linux_aio"
5432 echo "ATTR/XATTR support $attr"
5433 echo "Install blobs $blobs"
5434 echo "KVM support $kvm"
5435 echo "HAX support $hax"
5436 echo "TCG support $tcg"
5437 if test "$tcg" = "yes" ; then
5438 echo "TCG debug enabled $debug_tcg"
5439 echo "TCG interpreter $tcg_interpreter"
5441 echo "RDMA support $rdma"
5442 echo "fdt support $fdt"
5443 echo "preadv support $preadv"
5444 echo "fdatasync $fdatasync"
5445 echo "madvise $madvise"
5446 echo "posix_madvise $posix_madvise"
5447 echo "libcap-ng support $cap_ng"
5448 echo "vhost-net support $vhost_net"
5449 echo "vhost-scsi support $vhost_scsi"
5450 echo "vhost-vsock support $vhost_vsock"
5451 echo "vhost-user support $vhost_user"
5452 echo "Trace backends $trace_backends"
5453 if have_backend "simple"; then
5454 echo "Trace output file $trace_file-<pid>"
5456 echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)"
5457 echo "rbd support $rbd"
5458 echo "xfsctl support $xfs"
5459 echo "smartcard support $smartcard"
5460 echo "libusb $libusb"
5461 echo "usb net redir $usb_redir"
5462 echo "OpenGL support $opengl"
5463 echo "OpenGL dmabufs $opengl_dmabuf"
5464 echo "libiscsi support $libiscsi"
5465 echo "libnfs support $libnfs"
5466 echo "build guest agent $guest_agent"
5467 echo "QGA VSS support $guest_agent_with_vss"
5468 echo "QGA w32 disk info $guest_agent_ntddscsi"
5469 echo "QGA MSI support $guest_agent_msi"
5470 echo "seccomp support $seccomp"
5471 echo "coroutine backend $coroutine"
5472 echo "coroutine pool $coroutine_pool"
5473 echo "debug stack usage $debug_stack_usage"
5474 echo "crypto afalg $crypto_afalg"
5475 echo "GlusterFS support $glusterfs"
5476 echo "gcov $gcov_tool"
5477 echo "gcov enabled $gcov"
5478 echo "TPM support $tpm"
5479 echo "libssh2 support $libssh2"
5480 echo "TPM passthrough $tpm_passthrough"
5481 echo "TPM emulator $tpm_emulator"
5482 echo "QOM debugging $qom_cast_debug"
5483 echo "Live block migration $live_block_migration"
5484 echo "lzo support $lzo"
5485 echo "snappy support $snappy"
5486 echo "bzip2 support $bzip2"
5487 echo "NUMA host support $numa"
5488 echo "tcmalloc support $tcmalloc"
5489 echo "jemalloc support $jemalloc"
5490 echo "avx2 optimization $avx2_opt"
5491 echo "replication support $replication"
5492 echo "VxHS block device $vxhs"
5493 echo "capstone $capstone"
5495 if test "$sdl_too_old" = "yes"; then
5496 echo "-> Your SDL version is too old - please upgrade to have SDL support"
5499 if test "$supported_cpu" = "no"; then
5500 echo
5501 echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
5502 echo
5503 echo "CPU host architecture $cpu support is not currently maintained."
5504 echo "The QEMU project intends to remove support for this host CPU in"
5505 echo "a future release if nobody volunteers to maintain it and to"
5506 echo "provide a build host for our continuous integration setup."
5507 echo "configure has succeeded and you can continue to build, but"
5508 echo "if you care about QEMU on this platform you should contact"
5509 echo "us upstream at qemu-devel@nongnu.org."
5512 if test "$supported_os" = "no"; then
5513 echo
5514 echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!"
5515 echo
5516 echo "Host OS $targetos support is not currently maintained."
5517 echo "The QEMU project intends to remove support for this host OS in"
5518 echo "a future release if nobody volunteers to maintain it and to"
5519 echo "provide a build host for our continuous integration setup."
5520 echo "configure has succeeded and you can continue to build, but"
5521 echo "if you care about QEMU on this platform you should contact"
5522 echo "us upstream at qemu-devel@nongnu.org."
5525 config_host_mak="config-host.mak"
5527 echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
5529 echo "# Automatically generated by configure - do not modify" > $config_host_mak
5530 echo >> $config_host_mak
5532 echo all: >> $config_host_mak
5533 echo "prefix=$prefix" >> $config_host_mak
5534 echo "bindir=$bindir" >> $config_host_mak
5535 echo "libdir=$libdir" >> $config_host_mak
5536 echo "libexecdir=$libexecdir" >> $config_host_mak
5537 echo "includedir=$includedir" >> $config_host_mak
5538 echo "mandir=$mandir" >> $config_host_mak
5539 echo "sysconfdir=$sysconfdir" >> $config_host_mak
5540 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
5541 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
5542 echo "qemu_firmwarepath=$firmwarepath" >> $config_host_mak
5543 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
5544 echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
5545 if test "$mingw32" = "no" ; then
5546 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
5548 echo "qemu_helperdir=$libexecdir" >> $config_host_mak
5549 echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
5550 echo "extra_cxxflags=$EXTRA_CXXFLAGS" >> $config_host_mak
5551 echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
5552 echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
5553 echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
5554 echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
5556 echo "ARCH=$ARCH" >> $config_host_mak
5558 if test "$debug_tcg" = "yes" ; then
5559 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
5561 if test "$strip_opt" = "yes" ; then
5562 echo "STRIP=${strip}" >> $config_host_mak
5564 if test "$bigendian" = "yes" ; then
5565 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
5567 if test "$mingw32" = "yes" ; then
5568 echo "CONFIG_WIN32=y" >> $config_host_mak
5569 rc_version=$(cat $source_path/VERSION)
5570 version_major=${rc_version%%.*}
5571 rc_version=${rc_version#*.}
5572 version_minor=${rc_version%%.*}
5573 rc_version=${rc_version#*.}
5574 version_subminor=${rc_version%%.*}
5575 version_micro=0
5576 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
5577 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
5578 if test "$guest_agent_with_vss" = "yes" ; then
5579 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
5580 echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak
5581 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
5583 if test "$guest_agent_ntddscsi" = "yes" ; then
5584 echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak
5586 if test "$guest_agent_msi" = "yes"; then
5587 echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
5588 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
5589 echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
5590 echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
5591 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
5592 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
5593 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
5595 else
5596 echo "CONFIG_POSIX=y" >> $config_host_mak
5599 if test "$linux" = "yes" ; then
5600 echo "CONFIG_LINUX=y" >> $config_host_mak
5603 if test "$darwin" = "yes" ; then
5604 echo "CONFIG_DARWIN=y" >> $config_host_mak
5607 if test "$solaris" = "yes" ; then
5608 echo "CONFIG_SOLARIS=y" >> $config_host_mak
5610 if test "$haiku" = "yes" ; then
5611 echo "CONFIG_HAIKU=y" >> $config_host_mak
5613 if test "$static" = "yes" ; then
5614 echo "CONFIG_STATIC=y" >> $config_host_mak
5616 if test "$profiler" = "yes" ; then
5617 echo "CONFIG_PROFILER=y" >> $config_host_mak
5619 if test "$slirp" = "yes" ; then
5620 echo "CONFIG_SLIRP=y" >> $config_host_mak
5621 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
5623 if test "$vde" = "yes" ; then
5624 echo "CONFIG_VDE=y" >> $config_host_mak
5625 echo "VDE_LIBS=$vde_libs" >> $config_host_mak
5627 if test "$netmap" = "yes" ; then
5628 echo "CONFIG_NETMAP=y" >> $config_host_mak
5630 if test "$l2tpv3" = "yes" ; then
5631 echo "CONFIG_L2TPV3=y" >> $config_host_mak
5633 if test "$cap_ng" = "yes" ; then
5634 echo "CONFIG_LIBCAP=y" >> $config_host_mak
5636 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
5637 for drv in $audio_drv_list; do
5638 def=CONFIG_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
5639 echo "$def=y" >> $config_host_mak
5640 done
5641 echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak
5642 echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak
5643 echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak
5644 echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak
5645 echo "OSS_LIBS=$oss_libs" >> $config_host_mak
5646 if test "$audio_pt_int" = "yes" ; then
5647 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
5649 if test "$audio_win_int" = "yes" ; then
5650 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
5652 echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
5653 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
5654 if test "$vnc" = "yes" ; then
5655 echo "CONFIG_VNC=y" >> $config_host_mak
5657 if test "$vnc_sasl" = "yes" ; then
5658 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
5660 if test "$vnc_jpeg" = "yes" ; then
5661 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
5663 if test "$vnc_png" = "yes" ; then
5664 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
5666 if test "$xkbcommon" = "yes" ; then
5667 echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak
5668 echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak
5670 if test "$fnmatch" = "yes" ; then
5671 echo "CONFIG_FNMATCH=y" >> $config_host_mak
5673 if test "$xfs" = "yes" ; then
5674 echo "CONFIG_XFS=y" >> $config_host_mak
5676 qemu_version=$(head $source_path/VERSION)
5677 echo "VERSION=$qemu_version" >>$config_host_mak
5678 echo "PKGVERSION=$pkgversion" >>$config_host_mak
5679 echo "SRC_PATH=$source_path" >> $config_host_mak
5680 echo "TARGET_DIRS=$target_list" >> $config_host_mak
5681 if [ "$docs" = "yes" ] ; then
5682 echo "BUILD_DOCS=yes" >> $config_host_mak
5684 if test "$modules" = "yes"; then
5685 # $shacmd can generate a hash started with digit, which the compiler doesn't
5686 # like as an symbol. So prefix it with an underscore
5687 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
5688 echo "CONFIG_MODULES=y" >> $config_host_mak
5690 if test "$sdl" = "yes" ; then
5691 echo "CONFIG_SDL=y" >> $config_host_mak
5692 echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
5693 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
5694 echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
5696 if test "$cocoa" = "yes" ; then
5697 echo "CONFIG_COCOA=y" >> $config_host_mak
5699 if test "$curses" = "yes" ; then
5700 echo "CONFIG_CURSES=y" >> $config_host_mak
5702 if test "$pipe2" = "yes" ; then
5703 echo "CONFIG_PIPE2=y" >> $config_host_mak
5705 if test "$accept4" = "yes" ; then
5706 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
5708 if test "$splice" = "yes" ; then
5709 echo "CONFIG_SPLICE=y" >> $config_host_mak
5711 if test "$eventfd" = "yes" ; then
5712 echo "CONFIG_EVENTFD=y" >> $config_host_mak
5714 if test "$memfd" = "yes" ; then
5715 echo "CONFIG_MEMFD=y" >> $config_host_mak
5717 if test "$fallocate" = "yes" ; then
5718 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
5720 if test "$fallocate_punch_hole" = "yes" ; then
5721 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
5723 if test "$fallocate_zero_range" = "yes" ; then
5724 echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak
5726 if test "$posix_fallocate" = "yes" ; then
5727 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
5729 if test "$sync_file_range" = "yes" ; then
5730 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
5732 if test "$fiemap" = "yes" ; then
5733 echo "CONFIG_FIEMAP=y" >> $config_host_mak
5735 if test "$dup3" = "yes" ; then
5736 echo "CONFIG_DUP3=y" >> $config_host_mak
5738 if test "$ppoll" = "yes" ; then
5739 echo "CONFIG_PPOLL=y" >> $config_host_mak
5741 if test "$prctl_pr_set_timerslack" = "yes" ; then
5742 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
5744 if test "$epoll" = "yes" ; then
5745 echo "CONFIG_EPOLL=y" >> $config_host_mak
5747 if test "$epoll_create1" = "yes" ; then
5748 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
5750 if test "$sendfile" = "yes" ; then
5751 echo "CONFIG_SENDFILE=y" >> $config_host_mak
5753 if test "$timerfd" = "yes" ; then
5754 echo "CONFIG_TIMERFD=y" >> $config_host_mak
5756 if test "$setns" = "yes" ; then
5757 echo "CONFIG_SETNS=y" >> $config_host_mak
5759 if test "$clock_adjtime" = "yes" ; then
5760 echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak
5762 if test "$syncfs" = "yes" ; then
5763 echo "CONFIG_SYNCFS=y" >> $config_host_mak
5765 if test "$inotify" = "yes" ; then
5766 echo "CONFIG_INOTIFY=y" >> $config_host_mak
5768 if test "$inotify1" = "yes" ; then
5769 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
5771 if test "$sem_timedwait" = "yes" ; then
5772 echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak
5774 if test "$byteswap_h" = "yes" ; then
5775 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
5777 if test "$bswap_h" = "yes" ; then
5778 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
5780 if test "$curl" = "yes" ; then
5781 echo "CONFIG_CURL=m" >> $config_host_mak
5782 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
5783 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
5785 if test "$brlapi" = "yes" ; then
5786 echo "CONFIG_BRLAPI=y" >> $config_host_mak
5787 echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
5789 if test "$bluez" = "yes" ; then
5790 echo "CONFIG_BLUEZ=y" >> $config_host_mak
5791 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
5793 if test "$glib_subprocess" = "yes" ; then
5794 echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak
5796 if test "$gtk" = "yes" ; then
5797 echo "CONFIG_GTK=y" >> $config_host_mak
5798 echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
5799 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
5800 echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
5801 if test "$gtk_gl" = "yes" ; then
5802 echo "CONFIG_GTK_GL=y" >> $config_host_mak
5805 echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
5806 if test "$gnutls" = "yes" ; then
5807 echo "CONFIG_GNUTLS=y" >> $config_host_mak
5809 if test "$gnutls_rnd" = "yes" ; then
5810 echo "CONFIG_GNUTLS_RND=y" >> $config_host_mak
5812 if test "$gcrypt" = "yes" ; then
5813 echo "CONFIG_GCRYPT=y" >> $config_host_mak
5814 if test "$gcrypt_hmac" = "yes" ; then
5815 echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak
5817 if test "$gcrypt_kdf" = "yes" ; then
5818 echo "CONFIG_GCRYPT_KDF=y" >> $config_host_mak
5821 if test "$nettle" = "yes" ; then
5822 echo "CONFIG_NETTLE=y" >> $config_host_mak
5823 echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak
5824 if test "$nettle_kdf" = "yes" ; then
5825 echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak
5828 if test "$tasn1" = "yes" ; then
5829 echo "CONFIG_TASN1=y" >> $config_host_mak
5831 if test "$have_ifaddrs_h" = "yes" ; then
5832 echo "HAVE_IFADDRS_H=y" >> $config_host_mak
5834 if test "$have_broken_size_max" = "yes" ; then
5835 echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
5838 # Work around a system header bug with some kernel/XFS header
5839 # versions where they both try to define 'struct fsxattr':
5840 # xfs headers will not try to redefine structs from linux headers
5841 # if this macro is set.
5842 if test "$have_fsxattr" = "yes" ; then
5843 echo "HAVE_FSXATTR=y" >> $config_host_mak
5845 if test "$vte" = "yes" ; then
5846 echo "CONFIG_VTE=y" >> $config_host_mak
5847 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
5849 if test "$virglrenderer" = "yes" ; then
5850 echo "CONFIG_VIRGL=y" >> $config_host_mak
5851 echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak
5852 echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak
5854 if test "$xen" = "yes" ; then
5855 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
5856 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
5857 if test "$xen_pv_domain_build" = "yes" ; then
5858 echo "CONFIG_XEN_PV_DOMAIN_BUILD=y" >> $config_host_mak
5861 if test "$linux_aio" = "yes" ; then
5862 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
5864 if test "$attr" = "yes" ; then
5865 echo "CONFIG_ATTR=y" >> $config_host_mak
5867 if test "$libattr" = "yes" ; then
5868 echo "CONFIG_LIBATTR=y" >> $config_host_mak
5870 if test "$virtfs" = "yes" ; then
5871 echo "CONFIG_VIRTFS=y" >> $config_host_mak
5873 if test "$mpath" = "yes" ; then
5874 echo "CONFIG_MPATH=y" >> $config_host_mak
5876 if test "$vhost_scsi" = "yes" ; then
5877 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
5879 if test "$vhost_net" = "yes" -a "$vhost_user" = "yes"; then
5880 echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
5882 if test "$vhost_vsock" = "yes" ; then
5883 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
5885 if test "$vhost_user" = "yes" ; then
5886 echo "CONFIG_VHOST_USER=y" >> $config_host_mak
5888 if test "$blobs" = "yes" ; then
5889 echo "INSTALL_BLOBS=yes" >> $config_host_mak
5891 if test "$iovec" = "yes" ; then
5892 echo "CONFIG_IOVEC=y" >> $config_host_mak
5894 if test "$preadv" = "yes" ; then
5895 echo "CONFIG_PREADV=y" >> $config_host_mak
5897 if test "$fdt" = "yes" ; then
5898 echo "CONFIG_FDT=y" >> $config_host_mak
5900 if test "$signalfd" = "yes" ; then
5901 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
5903 if test "$tcg" = "yes"; then
5904 echo "CONFIG_TCG=y" >> $config_host_mak
5905 if test "$tcg_interpreter" = "yes" ; then
5906 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
5909 if test "$fdatasync" = "yes" ; then
5910 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
5912 if test "$madvise" = "yes" ; then
5913 echo "CONFIG_MADVISE=y" >> $config_host_mak
5915 if test "$posix_madvise" = "yes" ; then
5916 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
5919 if test "$spice" = "yes" ; then
5920 echo "CONFIG_SPICE=y" >> $config_host_mak
5923 if test "$smartcard" = "yes" ; then
5924 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
5925 echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak
5926 echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak
5929 if test "$libusb" = "yes" ; then
5930 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
5931 echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak
5932 echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak
5935 if test "$usb_redir" = "yes" ; then
5936 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
5937 echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak
5938 echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak
5941 if test "$opengl" = "yes" ; then
5942 echo "CONFIG_OPENGL=y" >> $config_host_mak
5943 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
5944 if test "$opengl_dmabuf" = "yes" ; then
5945 echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
5949 if test "$avx2_opt" = "yes" ; then
5950 echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
5953 if test "$lzo" = "yes" ; then
5954 echo "CONFIG_LZO=y" >> $config_host_mak
5957 if test "$snappy" = "yes" ; then
5958 echo "CONFIG_SNAPPY=y" >> $config_host_mak
5961 if test "$bzip2" = "yes" ; then
5962 echo "CONFIG_BZIP2=y" >> $config_host_mak
5963 echo "BZIP2_LIBS=-lbz2" >> $config_host_mak
5966 if test "$libiscsi" = "yes" ; then
5967 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
5968 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
5969 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
5972 if test "$libnfs" = "yes" ; then
5973 echo "CONFIG_LIBNFS=m" >> $config_host_mak
5974 echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
5977 if test "$seccomp" = "yes"; then
5978 echo "CONFIG_SECCOMP=y" >> $config_host_mak
5979 echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
5980 echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak
5983 # XXX: suppress that
5984 if [ "$bsd" = "yes" ] ; then
5985 echo "CONFIG_BSD=y" >> $config_host_mak
5988 if test "$localtime_r" = "yes" ; then
5989 echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
5991 if test "$qom_cast_debug" = "yes" ; then
5992 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
5994 if test "$rbd" = "yes" ; then
5995 echo "CONFIG_RBD=m" >> $config_host_mak
5996 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
5997 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
6000 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
6001 if test "$coroutine_pool" = "yes" ; then
6002 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
6003 else
6004 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
6007 if test "$debug_stack_usage" = "yes" ; then
6008 echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
6011 if test "$crypto_afalg" = "yes" ; then
6012 echo "CONFIG_AF_ALG=y" >> $config_host_mak
6015 if test "$open_by_handle_at" = "yes" ; then
6016 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
6019 if test "$linux_magic_h" = "yes" ; then
6020 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
6023 if test "$pragma_diagnostic_available" = "yes" ; then
6024 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
6027 if test "$valgrind_h" = "yes" ; then
6028 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
6031 if test "$has_environ" = "yes" ; then
6032 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
6035 if test "$cpuid_h" = "yes" ; then
6036 echo "CONFIG_CPUID_H=y" >> $config_host_mak
6039 if test "$int128" = "yes" ; then
6040 echo "CONFIG_INT128=y" >> $config_host_mak
6043 if test "$atomic128" = "yes" ; then
6044 echo "CONFIG_ATOMIC128=y" >> $config_host_mak
6047 if test "$atomic64" = "yes" ; then
6048 echo "CONFIG_ATOMIC64=y" >> $config_host_mak
6051 if test "$getauxval" = "yes" ; then
6052 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
6055 if test "$glusterfs" = "yes" ; then
6056 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
6057 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
6058 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
6061 if test "$glusterfs_xlator_opt" = "yes" ; then
6062 echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
6065 if test "$glusterfs_discard" = "yes" ; then
6066 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
6069 if test "$glusterfs_fallocate" = "yes" ; then
6070 echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
6073 if test "$glusterfs_zerofill" = "yes" ; then
6074 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
6077 if test "$libssh2" = "yes" ; then
6078 echo "CONFIG_LIBSSH2=m" >> $config_host_mak
6079 echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
6080 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
6083 if test "$live_block_migration" = "yes" ; then
6084 echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
6087 if test "$tpm" = "yes"; then
6088 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
6089 # TPM passthrough support?
6090 if test "$tpm_passthrough" = "yes"; then
6091 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
6093 # TPM emulator support?
6094 if test "$tpm_emulator" = "yes"; then
6095 echo "CONFIG_TPM_EMULATOR=y" >> $config_host_mak
6099 echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
6100 if have_backend "nop"; then
6101 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
6103 if have_backend "simple"; then
6104 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
6105 # Set the appropriate trace file.
6106 trace_file="\"$trace_file-\" FMT_pid"
6108 if have_backend "log"; then
6109 echo "CONFIG_TRACE_LOG=y" >> $config_host_mak
6111 if have_backend "ust"; then
6112 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
6114 if have_backend "dtrace"; then
6115 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
6116 if test "$trace_backend_stap" = "yes" ; then
6117 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
6120 if have_backend "ftrace"; then
6121 if test "$linux" = "yes" ; then
6122 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
6123 else
6124 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
6127 if have_backend "syslog"; then
6128 if test "$posix_syslog" = "yes" ; then
6129 echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak
6130 else
6131 feature_not_found "syslog(trace backend)" "syslog not available"
6134 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
6136 if test "$rdma" = "yes" ; then
6137 echo "CONFIG_RDMA=y" >> $config_host_mak
6138 echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
6141 if test "$have_rtnetlink" = "yes" ; then
6142 echo "CONFIG_RTNETLINK=y" >> $config_host_mak
6145 if test "$replication" = "yes" ; then
6146 echo "CONFIG_REPLICATION=y" >> $config_host_mak
6149 if test "$have_af_vsock" = "yes" ; then
6150 echo "CONFIG_AF_VSOCK=y" >> $config_host_mak
6153 if test "$have_sysmacros" = "yes" ; then
6154 echo "CONFIG_SYSMACROS=y" >> $config_host_mak
6157 if test "$have_static_assert" = "yes" ; then
6158 echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak
6161 if test "$have_utmpx" = "yes" ; then
6162 echo "HAVE_UTMPX=y" >> $config_host_mak
6165 if test "$ivshmem" = "yes" ; then
6166 echo "CONFIG_IVSHMEM=y" >> $config_host_mak
6168 if test "$capstone" = "yes" ; then
6169 echo "CONFIG_CAPSTONE=y" >> $config_host_mak
6172 # Hold two types of flag:
6173 # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
6174 # a thread we have a handle to
6175 # CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
6176 # platform
6177 if test "$pthread_setname_np" = "yes" ; then
6178 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
6179 echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
6182 if test "$vxhs" = "yes" ; then
6183 echo "CONFIG_VXHS=y" >> $config_host_mak
6184 echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
6187 if test "$tcg_interpreter" = "yes"; then
6188 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
6189 elif test "$ARCH" = "sparc64" ; then
6190 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
6191 elif test "$ARCH" = "s390x" ; then
6192 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
6193 elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
6194 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
6195 elif test "$ARCH" = "ppc64" ; then
6196 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
6197 else
6198 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
6200 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
6202 echo "TOOLS=$tools" >> $config_host_mak
6203 echo "ROMS=$roms" >> $config_host_mak
6204 echo "MAKE=$make" >> $config_host_mak
6205 echo "INSTALL=$install" >> $config_host_mak
6206 echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
6207 echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
6208 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
6209 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
6210 echo "PYTHON=$python" >> $config_host_mak
6211 echo "CC=$cc" >> $config_host_mak
6212 if $iasl -h > /dev/null 2>&1; then
6213 echo "IASL=$iasl" >> $config_host_mak
6215 echo "CC_I386=$cc_i386" >> $config_host_mak
6216 echo "HOST_CC=$host_cc" >> $config_host_mak
6217 echo "CXX=$cxx" >> $config_host_mak
6218 echo "OBJCC=$objcc" >> $config_host_mak
6219 echo "AR=$ar" >> $config_host_mak
6220 echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
6221 echo "AS=$as" >> $config_host_mak
6222 echo "CCAS=$ccas" >> $config_host_mak
6223 echo "CPP=$cpp" >> $config_host_mak
6224 echo "OBJCOPY=$objcopy" >> $config_host_mak
6225 echo "LD=$ld" >> $config_host_mak
6226 echo "NM=$nm" >> $config_host_mak
6227 echo "WINDRES=$windres" >> $config_host_mak
6228 echo "CFLAGS=$CFLAGS" >> $config_host_mak
6229 echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
6230 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
6231 echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
6232 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
6233 if test "$sparse" = "yes" ; then
6234 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
6235 echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak
6236 echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
6237 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
6238 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
6240 if test "$cross_prefix" != ""; then
6241 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
6242 else
6243 echo "AUTOCONF_HOST := " >> $config_host_mak
6245 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
6246 echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
6247 echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
6248 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
6249 echo "LIBS+=$LIBS" >> $config_host_mak
6250 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
6251 echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak
6252 echo "EXESUF=$EXESUF" >> $config_host_mak
6253 echo "DSOSUF=$DSOSUF" >> $config_host_mak
6254 echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
6255 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
6256 echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
6257 echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
6258 echo "POD2MAN=$POD2MAN" >> $config_host_mak
6259 echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
6260 if test "$gcov" = "yes" ; then
6261 echo "CONFIG_GCOV=y" >> $config_host_mak
6262 echo "GCOV=$gcov_tool" >> $config_host_mak
6265 # use included Linux headers
6266 if test "$linux" = "yes" ; then
6267 mkdir -p linux-headers
6268 case "$cpu" in
6269 i386|x86_64|x32)
6270 linux_arch=x86
6272 ppcemb|ppc|ppc64)
6273 linux_arch=powerpc
6275 s390x)
6276 linux_arch=s390
6278 aarch64)
6279 linux_arch=arm64
6281 mips64)
6282 linux_arch=mips
6285 # For most CPUs the kernel architecture name and QEMU CPU name match.
6286 linux_arch="$cpu"
6288 esac
6289 # For non-KVM architectures we will not have asm headers
6290 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
6291 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
6295 for target in $target_list; do
6296 target_dir="$target"
6297 config_target_mak=$target_dir/config-target.mak
6298 target_name=$(echo $target | cut -d '-' -f 1)
6299 target_bigendian="no"
6301 case "$target_name" in
6302 armeb|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
6303 target_bigendian=yes
6305 esac
6306 target_softmmu="no"
6307 target_user_only="no"
6308 target_linux_user="no"
6309 target_bsd_user="no"
6310 case "$target" in
6311 ${target_name}-softmmu)
6312 target_softmmu="yes"
6314 ${target_name}-linux-user)
6315 target_user_only="yes"
6316 target_linux_user="yes"
6318 ${target_name}-bsd-user)
6319 target_user_only="yes"
6320 target_bsd_user="yes"
6323 error_exit "Target '$target' not recognised"
6324 exit 1
6326 esac
6328 mkdir -p $target_dir
6329 echo "# Automatically generated by configure - do not modify" > $config_target_mak
6331 bflt="no"
6332 mttcg="no"
6333 interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g")
6334 gdb_xml_files=""
6336 TARGET_ARCH="$target_name"
6337 TARGET_BASE_ARCH=""
6338 TARGET_ABI_DIR=""
6340 case "$target_name" in
6341 i386)
6342 gdb_xml_files="i386-32bit.xml i386-32bit-core.xml i386-32bit-sse.xml"
6344 x86_64)
6345 TARGET_BASE_ARCH=i386
6346 gdb_xml_files="i386-64bit.xml i386-64bit-core.xml i386-64bit-sse.xml"
6348 alpha)
6349 mttcg="yes"
6351 arm|armeb)
6352 TARGET_ARCH=arm
6353 bflt="yes"
6354 mttcg="yes"
6355 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
6357 aarch64)
6358 TARGET_BASE_ARCH=arm
6359 bflt="yes"
6360 mttcg="yes"
6361 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
6363 cris)
6365 hppa)
6367 lm32)
6369 m68k)
6370 bflt="yes"
6371 gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml"
6373 microblaze|microblazeel)
6374 TARGET_ARCH=microblaze
6375 bflt="yes"
6377 mips|mipsel)
6378 TARGET_ARCH=mips
6379 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
6381 mipsn32|mipsn32el)
6382 TARGET_ARCH=mips64
6383 TARGET_BASE_ARCH=mips
6384 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
6385 echo "TARGET_ABI32=y" >> $config_target_mak
6387 mips64|mips64el)
6388 TARGET_ARCH=mips64
6389 TARGET_BASE_ARCH=mips
6390 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
6392 moxie)
6394 nios2)
6396 or1k)
6397 TARGET_ARCH=openrisc
6398 TARGET_BASE_ARCH=openrisc
6400 ppc)
6401 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
6403 ppcemb)
6404 TARGET_BASE_ARCH=ppc
6405 TARGET_ABI_DIR=ppc
6406 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
6408 ppc64)
6409 TARGET_BASE_ARCH=ppc
6410 TARGET_ABI_DIR=ppc
6411 mttcg=yes
6412 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6414 ppc64le)
6415 TARGET_ARCH=ppc64
6416 TARGET_BASE_ARCH=ppc
6417 TARGET_ABI_DIR=ppc
6418 mttcg=yes
6419 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6421 ppc64abi32)
6422 TARGET_ARCH=ppc64
6423 TARGET_BASE_ARCH=ppc
6424 TARGET_ABI_DIR=ppc
6425 echo "TARGET_ABI32=y" >> $config_target_mak
6426 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6428 sh4|sh4eb)
6429 TARGET_ARCH=sh4
6430 bflt="yes"
6432 sparc)
6434 sparc64)
6435 TARGET_BASE_ARCH=sparc
6437 sparc32plus)
6438 TARGET_ARCH=sparc64
6439 TARGET_BASE_ARCH=sparc
6440 TARGET_ABI_DIR=sparc
6441 echo "TARGET_ABI32=y" >> $config_target_mak
6443 s390x)
6444 gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml"
6446 tilegx)
6448 tricore)
6450 unicore32)
6452 xtensa|xtensaeb)
6453 TARGET_ARCH=xtensa
6456 error_exit "Unsupported target CPU"
6458 esac
6459 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
6460 if [ "$TARGET_BASE_ARCH" = "" ]; then
6461 TARGET_BASE_ARCH=$TARGET_ARCH
6464 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
6466 upper() {
6467 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
6470 target_arch_name="$(upper $TARGET_ARCH)"
6471 echo "TARGET_$target_arch_name=y" >> $config_target_mak
6472 echo "TARGET_NAME=$target_name" >> $config_target_mak
6473 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
6474 if [ "$TARGET_ABI_DIR" = "" ]; then
6475 TARGET_ABI_DIR=$TARGET_ARCH
6477 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
6478 if [ "$HOST_VARIANT_DIR" != "" ]; then
6479 echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
6482 if supported_xen_target $target; then
6483 echo "CONFIG_XEN=y" >> $config_target_mak
6484 if test "$xen_pci_passthrough" = yes; then
6485 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
6488 if supported_kvm_target $target; then
6489 echo "CONFIG_KVM=y" >> $config_target_mak
6490 if test "$vhost_net" = "yes" ; then
6491 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
6492 if test "$vhost_user" = "yes" ; then
6493 echo "CONFIG_VHOST_USER_NET_TEST_$target_name=y" >> $config_host_mak
6497 if supported_hax_target $target; then
6498 echo "CONFIG_HAX=y" >> $config_target_mak
6500 if test "$target_bigendian" = "yes" ; then
6501 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
6503 if test "$target_softmmu" = "yes" ; then
6504 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
6505 if test "$mttcg" = "yes" ; then
6506 echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak
6509 if test "$target_user_only" = "yes" ; then
6510 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
6511 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
6513 if test "$target_linux_user" = "yes" ; then
6514 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
6516 list=""
6517 if test ! -z "$gdb_xml_files" ; then
6518 for x in $gdb_xml_files; do
6519 list="$list $source_path/gdb-xml/$x"
6520 done
6521 echo "TARGET_XML_FILES=$list" >> $config_target_mak
6524 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
6525 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
6527 if test "$target_bsd_user" = "yes" ; then
6528 echo "CONFIG_BSD_USER=y" >> $config_target_mak
6531 # generate QEMU_CFLAGS/LDFLAGS for targets
6533 cflags=""
6534 ldflags=""
6536 disas_config() {
6537 echo "CONFIG_${1}_DIS=y" >> $config_target_mak
6538 echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak
6541 for i in $ARCH $TARGET_BASE_ARCH ; do
6542 case "$i" in
6543 alpha)
6544 disas_config "ALPHA"
6546 aarch64)
6547 if test -n "${cxx}"; then
6548 disas_config "ARM_A64"
6551 arm)
6552 disas_config "ARM"
6553 if test -n "${cxx}"; then
6554 disas_config "ARM_A64"
6557 cris)
6558 disas_config "CRIS"
6560 hppa)
6561 disas_config "HPPA"
6563 i386|x86_64|x32)
6564 disas_config "I386"
6566 lm32)
6567 disas_config "LM32"
6569 m68k)
6570 disas_config "M68K"
6572 microblaze*)
6573 disas_config "MICROBLAZE"
6575 mips*)
6576 disas_config "MIPS"
6578 moxie*)
6579 disas_config "MOXIE"
6581 nios2)
6582 disas_config "NIOS2"
6584 or1k)
6585 disas_config "OPENRISC"
6587 ppc*)
6588 disas_config "PPC"
6590 s390*)
6591 disas_config "S390"
6593 sh4)
6594 disas_config "SH4"
6596 sparc*)
6597 disas_config "SPARC"
6599 xtensa*)
6600 disas_config "XTENSA"
6602 esac
6603 done
6604 if test "$tcg_interpreter" = "yes" ; then
6605 disas_config "TCI"
6608 case "$ARCH" in
6609 alpha)
6610 # Ensure there's only a single GP
6611 cflags="-msmall-data $cflags"
6613 esac
6615 if test "$gprof" = "yes" ; then
6616 echo "TARGET_GPROF=yes" >> $config_target_mak
6617 if test "$target_linux_user" = "yes" ; then
6618 cflags="-p $cflags"
6619 ldflags="-p $ldflags"
6621 if test "$target_softmmu" = "yes" ; then
6622 ldflags="-p $ldflags"
6623 echo "GPROF_CFLAGS=-p" >> $config_target_mak
6627 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
6628 ldflags="$ldflags $textseg_ldflags"
6631 # Newer kernels on s390 check for an S390_PGSTE program header and
6632 # enable the pgste page table extensions in that case. This makes
6633 # the vm.allocate_pgste sysctl unnecessary. We enable this program
6634 # header if
6635 # - we build on s390x
6636 # - we build the system emulation for s390x (qemu-system-s390x)
6637 # - KVM is enabled
6638 # - the linker supports --s390-pgste
6639 if test "$TARGET_ARCH" = "s390x" -a "$target_softmmu" = "yes" -a "$ARCH" = "s390x" -a "$kvm" = "yes"; then
6640 if ld_has --s390-pgste ; then
6641 ldflags="-Wl,--s390-pgste $ldflags"
6645 echo "LDFLAGS+=$ldflags" >> $config_target_mak
6646 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
6648 done # for target in $targets
6650 if [ "$dtc_internal" = "yes" ]; then
6651 echo "config-host.h: subdir-dtc" >> $config_host_mak
6654 if test "$numa" = "yes"; then
6655 echo "CONFIG_NUMA=y" >> $config_host_mak
6658 if test "$ccache_cpp2" = "yes"; then
6659 echo "export CCACHE_CPP2=y" >> $config_host_mak
6662 # build tree in object directory in case the source is not in the current directory
6663 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm"
6664 DIRS="$DIRS docs docs/interop fsdev scsi"
6665 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
6666 DIRS="$DIRS roms/seabios roms/vgabios"
6667 DIRS="$DIRS qapi-generated"
6668 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
6669 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
6670 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
6671 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
6672 FILES="$FILES pc-bios/spapr-rtas/Makefile"
6673 FILES="$FILES pc-bios/s390-ccw/Makefile"
6674 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
6675 FILES="$FILES pc-bios/qemu-icon.bmp"
6676 FILES="$FILES .gdbinit scripts" # scripts needed by relative path in .gdbinit
6677 for bios_file in \
6678 $source_path/pc-bios/*.bin \
6679 $source_path/pc-bios/*.lid \
6680 $source_path/pc-bios/*.aml \
6681 $source_path/pc-bios/*.rom \
6682 $source_path/pc-bios/*.dtb \
6683 $source_path/pc-bios/*.img \
6684 $source_path/pc-bios/openbios-* \
6685 $source_path/pc-bios/u-boot.* \
6686 $source_path/pc-bios/palcode-*
6688 FILES="$FILES pc-bios/$(basename $bios_file)"
6689 done
6690 for test_file in $(find $source_path/tests/acpi-test-data -type f)
6692 FILES="$FILES tests/acpi-test-data$(echo $test_file | sed -e 's/.*acpi-test-data//')"
6693 done
6694 mkdir -p $DIRS
6695 for f in $FILES ; do
6696 if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
6697 symlink "$source_path/$f" "$f"
6699 done
6701 # temporary config to build submodules
6702 for rom in seabios vgabios ; do
6703 config_mak=roms/$rom/config.mak
6704 echo "# Automatically generated by configure - do not modify" > $config_mak
6705 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
6706 echo "AS=$as" >> $config_mak
6707 echo "CCAS=$ccas" >> $config_mak
6708 echo "CC=$cc" >> $config_mak
6709 echo "BCC=bcc" >> $config_mak
6710 echo "CPP=$cpp" >> $config_mak
6711 echo "OBJCOPY=objcopy" >> $config_mak
6712 echo "IASL=$iasl" >> $config_mak
6713 echo "LD=$ld" >> $config_mak
6714 done
6716 # set up tests data directory
6717 if [ ! -e tests/data ]; then
6718 symlink "$source_path/tests/data" tests/data
6721 # set up qemu-iotests in this build directory
6722 iotests_common_env="tests/qemu-iotests/common.env"
6723 iotests_check="tests/qemu-iotests/check"
6725 echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
6726 echo >> "$iotests_common_env"
6727 echo "export PYTHON='$python'" >> "$iotests_common_env"
6729 if [ ! -e "$iotests_check" ]; then
6730 symlink "$source_path/$iotests_check" "$iotests_check"
6733 # Save the configure command line for later reuse.
6734 cat <<EOD >config.status
6735 #!/bin/sh
6736 # Generated by configure.
6737 # Run this file to recreate the current configuration.
6738 # Compiler output produced by configure, useful for debugging
6739 # configure, is in config.log if it exists.
6741 printf "exec" >>config.status
6742 printf " '%s'" "$0" "$@" >>config.status
6743 echo ' "$@"' >>config.status
6744 chmod +x config.status
6746 rm -r "$TMPDIR1"