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 # Temporary directory used for files created while
12 # configure runs. Since it is in the build directory
13 # we can safely blow away any previous version of it
14 # (and we need not jump through hoops to try to delete
15 # it when configure exits.)
20 echo "ERROR: failed to create temporary directory"
25 TMPC="${TMPDIR1}/${TMPB}.c"
26 TMPO="${TMPDIR1}/${TMPB}.o"
27 TMPCXX="${TMPDIR1}/${TMPB}.cxx"
28 TMPL="${TMPDIR1}/${TMPB}.lo"
29 TMPA="${TMPDIR1}/lib${TMPB}.la"
30 TMPE="${TMPDIR1}/${TMPB}.exe"
34 # Print a helpful header at the top of config.log
35 echo "# QEMU configure log $(date)" >> config.log
36 printf "# Configured with:" >> config.log
37 printf " '%s'" "$0" "$@" >> config.log
39 echo "#" >> config.log
44 while test -n "$2"; do
53 # Run the compiler, capturing its output to the log. First argument
54 # is compiler binary to execute.
57 echo $compiler "$@" >> config.log
58 $compiler "$@" >> config.log 2>&1 || return $?
59 # Test passed. If this is an --enable-werror build, rerun
60 # the test with -Werror and bail out if it fails. This
61 # makes warning-generating-errors in configure test code
62 # obvious to developers.
63 if test "$werror" != "yes"; then
66 # Don't bother rerunning the compile if we were already using -Werror
72 echo $compiler -Werror "$@" >> config.log
73 $compiler -Werror "$@" >> config.log 2>&1 && return $?
74 error_exit "configure test passed without -Werror but failed with -Werror." \
75 "This is probably a bug in the configure script. The failing command" \
76 "will be at the bottom of config.log." \
77 "You can run configure with --disable-werror to bypass this check."
81 do_compiler "$cc" "$@"
85 do_compiler "$cxx" "$@"
89 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
90 # options which some versions of GCC's C++ compiler complain about
91 # because they only make sense for C programs.
93 for arg in $QEMU_CFLAGS; do
95 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
96 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
99 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
106 do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
112 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
118 # Run the compiler, capturing its output to the log.
119 echo $libtool $mode --tag=CC $cc "$@" >> config.log
120 $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $?
121 # Test passed. If this is an --enable-werror build, rerun
122 # the test with -Werror and bail out if it fails. This
123 # makes warning-generating-errors in configure test code
124 # obvious to developers.
125 if test "$werror" != "yes"; then
128 # Don't bother rerunning the compile if we were already using -Werror
134 echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log
135 $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $?
136 error_exit "configure test passed without -Werror but failed with -Werror." \
137 "This is probably a bug in the configure script. The failing command" \
138 "will be at the bottom of config.log." \
139 "You can run configure with --disable-werror to bypass this check."
143 do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $?
144 do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib
147 # symbolically link $1 to $2. Portable version of "ln -sf".
150 mkdir -p "$(dirname "$2")"
154 # check whether a command is available to this shell (may be either an
155 # executable or a builtin)
157 type "$1" >/dev/null 2>&1
160 # search for an executable in PATH
166 # pathname has a dir component?
167 if [ "${local_command#*/}" != "$local_command" ]; then
168 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
169 echo "$local_command"
173 if [ -z "$local_command" ]; then
178 for local_dir in $PATH; do
179 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
180 echo "$local_dir/$local_command"
181 IFS="${local_ifs:-$(printf ' \t\n')}"
186 IFS="${local_ifs:-$(printf ' \t\n')}"
191 echo "$trace_backends" | grep "$1" >/dev/null
195 source_path=`dirname "$0"`
198 interp_prefix="/usr/gnemul/qemu-%M"
202 block_drv_rw_whitelist=""
203 block_drv_ro_whitelist=""
209 cc_i386=i386-pc-linux-gnu-gcc
214 # Don't accept a target_list environment variable.
217 # Default value for a variable defining feature "foo".
218 # * foo="no" feature will only be used if --enable-foo arg is given
219 # * foo="" feature will be searched for, and if found, will be used
220 # unless --disable-foo is given
221 # * foo="yes" this value will only be set by --enable-foo flag.
222 # feature will searched for,
223 # if not found, configure exits with error
225 # Always add --enable-foo and --disable-foo command line args.
226 # Distributions want to ensure that several features are compiled in, and it
227 # is impossible without a --enable-foo that exits if a feature is not found.
251 xen_pci_passthrough=""
274 LDFLAGS_SHARED="-shared"
277 mandir="\${prefix}/share/man"
278 datadir="\${prefix}/share"
279 qemu_docdir="\${prefix}/share/doc/qemu"
280 bindir="\${prefix}/bin"
281 libdir="\${prefix}/lib"
282 libexecdir="\${prefix}/libexec"
283 includedir="\${prefix}/include"
284 sysconfdir="\${prefix}/etc"
285 local_statedir="\${prefix}/var"
324 guest_agent_with_vss="no"
347 glusterfs_discard="no"
348 glusterfs_zerofill="no"
359 # parse CC options first
361 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
363 --cross-prefix=*) cross_prefix="$optarg"
367 --cxx=*) CXX="$optarg"
369 --source-path=*) source_path="$optarg"
371 --cpu=*) cpu="$optarg"
373 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
374 EXTRA_CFLAGS="$optarg"
376 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
377 EXTRA_LDFLAGS="$optarg"
379 --enable-debug-info) debug_info="yes"
381 --disable-debug-info) debug_info="no"
386 # Using uname is really, really broken. Once we have the right set of checks
387 # we can eliminate its usage altogether.
389 # Preferred compiler:
391 # ${cross_prefix}gcc (if cross-prefix specified)
393 if test -z "${CC}${cross_prefix}"; then
396 cc="${CC-${cross_prefix}gcc}"
399 if test -z "${CXX}${cross_prefix}"; then
402 cxx="${CXX-${cross_prefix}g++}"
405 ar="${AR-${cross_prefix}ar}"
406 as="${AS-${cross_prefix}as}"
408 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
409 ld="${LD-${cross_prefix}ld}"
410 libtool="${LIBTOOL-${cross_prefix}libtool}"
411 nm="${NM-${cross_prefix}nm}"
412 strip="${STRIP-${cross_prefix}strip}"
413 windres="${WINDRES-${cross_prefix}windres}"
414 pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
416 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
418 pkg_config=query_pkg_config
419 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
420 sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
422 # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
423 ARFLAGS="${ARFLAGS-rv}"
425 # default flags for all hosts
426 QEMU_CFLAGS="-fno-strict-aliasing -fno-common $QEMU_CFLAGS"
427 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
428 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
429 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
430 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
431 if test "$debug_info" = "yes"; then
433 LDFLAGS="-g $LDFLAGS"
436 # make source path absolute
437 source_path=`cd "$source_path"; pwd`
439 # running configure in the source tree?
440 # we know that's the case if configure is there.
441 if test -f "./configure"; then
442 pwd_is_source_path="y"
444 pwd_is_source_path="n"
450 #error $1 not defined
452 int main(void) { return 0; }
457 if check_define __linux__ ; then
459 elif check_define _WIN32 ; then
461 elif check_define __OpenBSD__ ; then
463 elif check_define __sun__ ; then
465 elif check_define __HAIKU__ ; then
471 # Some host OSes need non-standard checks for which CPU to use.
472 # Note that these checks are broken for cross-compilation: if you're
473 # cross-compiling to one of these OSes then you'll need to specify
474 # the correct CPU with the --cpu option.
477 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
478 # run 64-bit userspace code.
479 # If the user didn't specify a CPU explicitly and the kernel says this is
480 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
481 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
486 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
487 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
492 if test ! -z "$cpu" ; then
493 # command line argument
495 elif check_define __i386__ ; then
497 elif check_define __x86_64__ ; then
498 if check_define __ILP32__ ; then
503 elif check_define __sparc__ ; then
504 if check_define __arch64__ ; then
509 elif check_define _ARCH_PPC ; then
510 if check_define _ARCH_PPC64 ; then
515 elif check_define __mips__ ; then
517 elif check_define __ia64__ ; then
519 elif check_define __s390__ ; then
520 if check_define __s390x__ ; then
525 elif check_define __arm__ ; then
527 elif check_define __aarch64__ ; then
529 elif check_define __hppa__ ; then
536 # Normalise host CPU name and set ARCH.
537 # Note that this case should only have supported host CPUs, not guests.
539 ia64|ppc|ppc64|s390|s390x|sparc64|x32)
542 i386|i486|i586|i686|i86pc|BePC)
561 # This will result in either an error or falling back to TCI later
565 if test -z "$ARCH"; then
571 # host *BSD for user mode
577 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
578 audio_possible_drivers="winwave sdl"
579 audio_drv_list="winwave"
583 audio_possible_drivers="winwave dsound sdl fmod"
584 audio_drv_list="winwave"
589 audio_possible_drivers="oss sdl esd pa"
595 audio_possible_drivers="oss sdl esd pa"
596 # needed for kinfo_getvmmap(3) in libutil.h
598 netmap="" # enable netmap autodetect
599 HOST_VARIANT_DIR="freebsd"
605 audio_possible_drivers="oss sdl esd pa"
606 HOST_VARIANT_DIR="dragonfly"
612 audio_possible_drivers="oss sdl esd"
614 HOST_VARIANT_DIR="netbsd"
620 audio_possible_drivers="sdl esd"
621 HOST_VARIANT_DIR="openbsd"
626 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
627 if [ "$cpu" = "x86_64" ] ; then
628 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
629 LDFLAGS="-arch x86_64 $LDFLAGS"
632 audio_drv_list="coreaudio"
633 audio_possible_drivers="coreaudio sdl fmod"
634 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
635 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
636 # Disable attempts to use ObjectiveC features in os/object.h since they
637 # won't work when we're compiling with gcc as a C compiler.
638 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
639 HOST_VARIANT_DIR="darwin"
644 install="${INSTALL-ginstall}"
646 smbd="${SMBD-/usr/sfw/sbin/smbd}"
647 needs_libsunmath="no"
648 solarisrev=`uname -r | cut -f2 -d.`
649 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
650 if test "$solarisrev" -le 9 ; then
651 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
652 needs_libsunmath="yes"
653 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
654 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
655 LIBS="-lsunmath $LIBS"
657 error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
658 "libsunmath from the Sun Studio compilers tools, due to a lack of" \
659 "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
660 "Studio 11 can be downloaded from www.sun.com."
664 if test -f /usr/include/sys/soundcard.h ; then
667 audio_possible_drivers="oss sdl"
668 # needed for CMSG_ macros in sys/socket.h
669 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
670 # needed for TIOCWIN* defines in termios.h
671 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
672 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
673 solarisnetlibs="-lsocket -lnsl -lresolv"
674 LIBS="$solarisnetlibs $LIBS"
675 libs_qga="$solarisnetlibs $libs_qga"
683 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
684 LIBS="-lposix_error_mapper -lnetwork $LIBS"
688 audio_possible_drivers="oss alsa sdl esd pa"
694 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
695 audio_possible_drivers="$audio_possible_drivers fmod"
698 # fix linking error on Ubuntu 13.04
699 # libs_qga="-lrt $libs_qga"
700 # QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers $QEMU_INCLUDES"
701 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
705 if [ "$bsd" = "yes" ] ; then
706 if [ "$darwin" != "yes" ] ; then
711 : ${make=${MAKE-make}}
712 : ${install=${INSTALL-install}}
713 : ${python=${PYTHON-python}}
714 : ${smbd=${SMBD-/usr/sbin/smbd}}
716 # Default objcc to clang if available, otherwise use CC
723 if test "$mingw32" = "yes" ; then
726 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
727 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
728 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
729 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
731 int main(void) { return 0; }
733 if compile_prog "" "-liberty" ; then
734 LIBS="-liberty $LIBS"
736 prefix="c:/Program Files/QEMU"
739 qemu_docdir="\${prefix}"
741 sysconfdir="\${prefix}"
744 libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
750 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
752 --help|-h) show_help=yes
754 --version|-V) exec cat $source_path/VERSION
756 --prefix=*) prefix="$optarg"
758 --interp-prefix=*) interp_prefix="$optarg"
766 --host-cc=*) host_cc="$optarg"
770 --iasl=*) iasl="$optarg"
772 --objcc=*) objcc="$optarg"
774 --make=*) make="$optarg"
776 --install=*) install="$optarg"
778 --python=*) python="$optarg"
780 --gcov=*) gcov_tool="$optarg"
782 --smbd=*) smbd="$optarg"
790 --disable-debug-info)
797 --target-list=*) target_list="$optarg"
799 --enable-trace-backends=*) trace_backends="$optarg"
801 # XXX: backwards compatibility
802 --enable-trace-backend=*) trace_backends="$optarg"
804 --with-trace-file=*) trace_file="$optarg"
806 --enable-gprof) gprof="yes"
808 --enable-gcov) gcov="yes"
812 LDFLAGS="-static $LDFLAGS"
813 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
815 --mandir=*) mandir="$optarg"
817 --bindir=*) bindir="$optarg"
819 --libdir=*) libdir="$optarg"
821 --libexecdir=*) libexecdir="$optarg"
823 --includedir=*) includedir="$optarg"
825 --datadir=*) datadir="$optarg"
827 --with-confsuffix=*) confsuffix="$optarg"
829 --docdir=*) qemu_docdir="$optarg"
831 --sysconfdir=*) sysconfdir="$optarg"
833 --localstatedir=*) local_statedir="$optarg"
835 --sbindir=*|--sharedstatedir=*|\
836 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
837 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
838 # These switches are silently ignored, for compatibility with
839 # autoconf-generated configure scripts. This allows QEMU's
840 # configure to be used by RPM and similar macros that set
841 # lots of directory switches by default.
843 --with-system-pixman) pixman="system"
845 --without-system-pixman) pixman="internal"
847 --without-pixman) pixman="none"
849 --disable-sdl) sdl="no"
851 --enable-sdl) sdl="yes"
853 --with-sdlabi=*) sdlabi="$optarg"
855 --disable-qom-cast-debug) qom_cast_debug="no"
857 --enable-qom-cast-debug) qom_cast_debug="yes"
859 --disable-virtfs) virtfs="no"
861 --enable-virtfs) virtfs="yes"
863 --disable-vnc) vnc="no"
865 --enable-vnc) vnc="yes"
867 --fmod-lib=*) fmod_lib="$optarg"
869 --fmod-inc=*) fmod_inc="$optarg"
871 --oss-lib=*) oss_lib="$optarg"
873 --audio-drv-list=*) audio_drv_list="$optarg"
875 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
877 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
879 --enable-debug-tcg) debug_tcg="yes"
881 --disable-debug-tcg) debug_tcg="no"
884 # Enable debugging options that aren't excessively noisy
889 --enable-sparse) sparse="yes"
891 --disable-sparse) sparse="no"
893 --disable-strip) strip_opt="no"
895 --disable-vnc-tls) vnc_tls="no"
897 --enable-vnc-tls) vnc_tls="yes"
899 --disable-vnc-sasl) vnc_sasl="no"
901 --enable-vnc-sasl) vnc_sasl="yes"
903 --disable-vnc-jpeg) vnc_jpeg="no"
905 --enable-vnc-jpeg) vnc_jpeg="yes"
907 --disable-vnc-png) vnc_png="no"
909 --enable-vnc-png) vnc_png="yes"
911 --disable-vnc-ws) vnc_ws="no"
913 --enable-vnc-ws) vnc_ws="yes"
915 --disable-slirp) slirp="no"
917 --disable-uuid) uuid="no"
919 --enable-uuid) uuid="yes"
921 --disable-vde) vde="no"
923 --enable-vde) vde="yes"
925 --disable-netmap) netmap="no"
927 --enable-netmap) netmap="yes"
929 --disable-xen) xen="no"
931 --enable-xen) xen="yes"
933 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
935 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
937 --disable-brlapi) brlapi="no"
939 --enable-brlapi) brlapi="yes"
941 --disable-bluez) bluez="no"
943 --enable-bluez) bluez="yes"
945 --disable-kvm) kvm="no"
947 --enable-kvm) kvm="yes"
949 --disable-hax) hax="no"
951 --enable-hax) hax="yes"
953 --disable-tcg-interpreter) tcg_interpreter="no"
955 --enable-tcg-interpreter) tcg_interpreter="yes"
957 --disable-cap-ng) cap_ng="no"
959 --enable-cap-ng) cap_ng="yes"
961 --disable-spice) spice="no"
963 --enable-spice) spice="yes"
965 --disable-libiscsi) libiscsi="no"
967 --enable-libiscsi) libiscsi="yes"
969 --disable-libnfs) libnfs="no"
971 --enable-libnfs) libnfs="yes"
973 --enable-profiler) profiler="yes"
975 --disable-cocoa) cocoa="no"
980 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
982 --disable-system) softmmu="no"
984 --enable-system) softmmu="yes"
991 --disable-linux-user) linux_user="no"
993 --enable-linux-user) linux_user="yes"
995 --disable-bsd-user) bsd_user="no"
997 --enable-bsd-user) bsd_user="yes"
999 --enable-guest-base) guest_base="yes"
1001 --disable-guest-base) guest_base="no"
1003 --enable-pie) pie="yes"
1005 --disable-pie) pie="no"
1009 force_werror="yes" ;
1011 --disable-werror) werror="no"
1013 --enable-stack-protector) stack_protector="yes"
1015 --disable-stack-protector) stack_protector="no"
1017 --disable-curses) curses="no"
1019 --enable-curses) curses="yes"
1021 --disable-curl) curl="no"
1023 --enable-curl) curl="yes"
1025 --disable-fdt) fdt="no"
1027 --enable-fdt) fdt="yes"
1029 --disable-linux-aio) linux_aio="no"
1031 --enable-linux-aio) linux_aio="yes"
1033 --disable-attr) attr="no"
1035 --enable-attr) attr="yes"
1037 --disable-blobs) blobs="no"
1039 --with-pkgversion=*) pkgversion=" ($optarg)"
1041 --with-coroutine=*) coroutine="$optarg"
1043 --disable-coroutine-pool) coroutine_pool="no"
1045 --enable-coroutine-pool) coroutine_pool="yes"
1047 --disable-docs) docs="no"
1049 --enable-docs) docs="yes"
1051 --disable-vhost-net) vhost_net="no"
1053 --enable-vhost-net) vhost_net="yes"
1055 --enable-efence) efence="yes"
1057 --disable-efence) efence="no"
1059 --enable-yagl) yagl="yes"
1061 --disable-yagl) yagl="no"
1063 --enable-yagl-stats) yagl_stats="yes"
1065 --disable-yagl-stats) yagl_stats="no"
1067 --enable-opengl) opengl="yes"
1069 --enable-vigs) vigs="yes"
1071 --disable-vigs) vigs="no"
1073 --disable-opengl) opengl="no"
1075 --disable-vhost-scsi) vhost_scsi="no"
1077 --enable-vhost-scsi) vhost_scsi="yes"
1079 --disable-glx) glx="no"
1081 --enable-glx) glx="yes"
1083 --disable-rbd) rbd="no"
1085 --enable-rbd) rbd="yes"
1087 --disable-xfsctl) xfs="no"
1089 --enable-xfsctl) xfs="yes"
1091 --disable-smartcard-nss) smartcard_nss="no"
1093 --enable-smartcard-nss) smartcard_nss="yes"
1095 --disable-libusb) libusb="no"
1097 --enable-libusb) libusb="yes"
1099 --disable-libtizenusb) libtizenusb="no"
1101 --enable-libtizenusb) libtizenusb="yes"
1103 --disable-usb-redir) usb_redir="no"
1105 --enable-usb-redir) usb_redir="yes"
1107 --disable-zlib-test) zlib="no"
1109 --disable-lzo) lzo="no"
1111 --enable-lzo) lzo="yes"
1113 --disable-snappy) snappy="no"
1115 --enable-snappy) snappy="yes"
1117 --enable-guest-agent) guest_agent="yes"
1119 --disable-guest-agent) guest_agent="no"
1121 --with-vss-sdk) vss_win32_sdk=""
1123 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1125 --without-vss-sdk) vss_win32_sdk="no"
1127 --with-win-sdk) win_sdk=""
1129 --with-win-sdk=*) win_sdk="$optarg"
1131 --without-win-sdk) win_sdk="no"
1133 --enable-tools) want_tools="yes"
1135 --disable-tools) want_tools="no"
1137 --enable-seccomp) seccomp="yes"
1139 --disable-seccomp) seccomp="no"
1142 --enable-maru) maru="yes"
1144 --enable-java-ui) java_ui="yes"
1146 --enable-shm) shm="yes"
1148 --enable-libav) libav="yes"
1150 --disable-libav) libav="no"
1152 --enable-libpng) libpng="yes"
1154 --enable-dxva2) dxva2="yes"
1156 --disable-dxva2) dxva2="no"
1158 --enable-vaapi) vaapi="yes"
1160 --disable-vaapi) vaapi="no"
1162 --disable-qt) qt="no"
1164 --enable-qt) qt="yes"
1166 --extension-path=*) extension_path="$optarg"
1169 --disable-glusterfs) glusterfs="no"
1171 --enable-glusterfs) glusterfs="yes"
1173 --disable-archipelago) archipelago="no"
1175 --enable-archipelago) archipelago="yes"
1177 --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
1178 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
1180 --disable-gtk) gtk="no"
1182 --enable-gtk) gtk="yes"
1184 --enable-rdma) rdma="yes"
1186 --disable-rdma) rdma="no"
1188 --with-gtkabi=*) gtkabi="$optarg"
1190 --disable-vte) vte="no"
1192 --enable-vte) vte="yes"
1194 --disable-tpm) tpm="no"
1196 --enable-tpm) tpm="yes"
1198 --disable-libssh2) libssh2="no"
1200 --enable-libssh2) libssh2="yes"
1202 --enable-vhdx) vhdx="yes"
1204 --disable-vhdx) vhdx="no"
1206 --disable-quorum) quorum="no"
1208 --enable-quorum) quorum="yes"
1210 --disable-numa) numa="no"
1212 --enable-numa) numa="yes"
1215 echo "ERROR: unknown option $opt"
1216 echo "Try '$0 --help' for more information"
1222 if ! has $python; then
1223 error_exit "Python not found. Use --python=/path/to/python"
1226 # Note that if the Python conditional here evaluates True we will exit
1227 # with status 1 which is a shell 'false' value.
1228 if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1229 error_exit "Cannot use '$python', Python 2.4 or later is required." \
1230 "Note that Python 3 or later is not yet supported." \
1231 "Use --python=/path/to/python to specify a supported Python."
1234 # The -B switch was added in Python 2.6.
1235 # If it is supplied, compiled files are not written.
1236 # Use it for Python versions which support it.
1237 if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
1244 LDFLAGS="-m32 $LDFLAGS"
1248 LDFLAGS="-m64 $LDFLAGS"
1251 LDFLAGS="-m32 $LDFLAGS"
1252 CPU_CFLAGS="-m32 -mcpu=ultrasparc"
1255 LDFLAGS="-m64 $LDFLAGS"
1256 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
1260 LDFLAGS="-m31 $LDFLAGS"
1264 LDFLAGS="-m64 $LDFLAGS"
1268 LDFLAGS="-m32 $LDFLAGS"
1269 cc_i386='$(CC) -m32'
1273 LDFLAGS="-m64 $LDFLAGS"
1274 cc_i386='$(CC) -m32'
1278 LDFLAGS="-mx32 $LDFLAGS"
1279 cc_i386='$(CC) -m32'
1281 # No special flags required for other host CPUs
1284 QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1285 EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1287 default_target_list=""
1291 if [ "$softmmu" = "yes" ]; then
1292 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
1294 if [ "$linux_user" = "yes" ]; then
1295 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
1297 if [ "$bsd_user" = "yes" ]; then
1298 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
1301 for config in $mak_wilds; do
1302 default_target_list="${default_target_list} $(basename "$config" .mak)"
1305 if test x"$show_help" = x"yes" ; then
1308 Usage: configure [options]
1309 Options: [defaults in brackets after descriptions]
1312 --help print this message
1313 --prefix=PREFIX install in PREFIX [$prefix]
1314 --interp-prefix=PREFIX where to find shared libraries, etc.
1315 use %M for cpu name [$interp_prefix]
1316 --target-list=LIST set target list (default: build everything)
1317 $(echo Available targets: $default_target_list | \
1318 fold -s -w 53 | sed -e 's/^/ /')
1320 Advanced options (experts only):
1321 --source-path=PATH path of source code [$source_path]
1322 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1323 --cc=CC use C compiler CC [$cc]
1324 --iasl=IASL use ACPI compiler IASL [$iasl]
1325 --host-cc=CC use C compiler CC [$host_cc] for code run at
1327 --cxx=CXX use C++ compiler CXX [$cxx]
1328 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1329 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
1330 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1331 --make=MAKE use specified make [$make]
1332 --install=INSTALL use specified install [$install]
1333 --python=PYTHON use specified python [$python]
1334 --smbd=SMBD use specified smbd [$smbd]
1335 --static enable static build [$static]
1336 --mandir=PATH install man pages in PATH
1337 --datadir=PATH install firmware in PATH$confsuffix
1338 --docdir=PATH install documentation in PATH$confsuffix
1339 --bindir=PATH install binaries in PATH
1340 --libdir=PATH install libraries in PATH
1341 --sysconfdir=PATH install config in PATH$confsuffix
1342 --localstatedir=PATH install local state in PATH (set at runtime on win32)
1343 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
1344 --enable-modules enable modules support
1345 --enable-debug-tcg enable TCG debugging
1346 --disable-debug-tcg disable TCG debugging (default)
1347 --enable-debug-info enable debugging information (default)
1348 --disable-debug-info disable debugging information
1349 --enable-debug enable common debug build options
1350 --enable-sparse enable sparse checker
1351 --disable-sparse disable sparse checker (default)
1352 --disable-strip disable stripping binaries
1353 --disable-werror disable compilation abort on warning
1354 --disable-stack-protector disable compiler-provided stack protection
1355 --disable-sdl disable SDL
1356 --enable-sdl enable SDL
1357 --with-sdlabi select preferred SDL ABI 1.2 or 2.0
1358 --disable-gtk disable gtk UI
1359 --enable-gtk enable gtk UI
1360 --with-gtkabi select preferred GTK ABI 2.0 or 3.0
1361 --disable-qt disable Qt5 UI
1362 --enable-qt enable Qt5 UI
1363 --disable-virtfs disable VirtFS
1364 --enable-virtfs enable VirtFS
1365 --disable-vnc disable VNC
1366 --enable-vnc enable VNC
1367 --disable-cocoa disable Cocoa (Mac OS X only)
1368 --enable-cocoa enable Cocoa (default on Mac OS X)
1369 --audio-drv-list=LIST set audio drivers list:
1370 Available drivers: $audio_possible_drivers
1371 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1372 --block-drv-rw-whitelist=L
1373 set block driver read-write whitelist
1374 (affects only QEMU, not qemu-img)
1375 --block-drv-ro-whitelist=L
1376 set block driver read-only whitelist
1377 (affects only QEMU, not qemu-img)
1378 --disable-xen disable xen backend driver support
1379 --enable-xen enable xen backend driver support
1380 --disable-xen-pci-passthrough
1381 --enable-xen-pci-passthrough
1382 --disable-brlapi disable BrlAPI
1383 --enable-brlapi enable BrlAPI
1384 --disable-vnc-tls disable TLS encryption for VNC server
1385 --enable-vnc-tls enable TLS encryption for VNC server
1386 --disable-vnc-sasl disable SASL encryption for VNC server
1387 --enable-vnc-sasl enable SASL encryption for VNC server
1388 --disable-vnc-jpeg disable JPEG lossy compression for VNC server
1389 --enable-vnc-jpeg enable JPEG lossy compression for VNC server
1390 --disable-vnc-png disable PNG compression for VNC server (default)
1391 --enable-vnc-png enable PNG compression for VNC server
1392 --disable-vnc-ws disable Websockets support for VNC server
1393 --enable-vnc-ws enable Websockets support for VNC server
1394 --disable-curses disable curses output
1395 --enable-curses enable curses output
1396 --disable-curl disable curl connectivity
1397 --enable-curl enable curl connectivity
1398 --disable-fdt disable fdt device tree
1399 --enable-fdt enable fdt device tree
1400 --disable-bluez disable bluez stack connectivity
1401 --enable-bluez enable bluez stack connectivity
1402 --disable-slirp disable SLIRP userspace network connectivity
1403 --disable-kvm disable KVM acceleration support
1404 --enable-kvm enable KVM acceleration support
1405 --disable-rdma disable RDMA-based migration support
1406 --enable-rdma enable RDMA-based migration support
1407 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1408 --enable-system enable all system emulation targets
1409 --disable-system disable all system emulation targets
1410 --enable-user enable supported user emulation targets
1411 --disable-user disable all user emulation targets
1412 --enable-linux-user enable all linux usermode emulation targets
1413 --disable-linux-user disable all linux usermode emulation targets
1414 --enable-bsd-user enable all BSD usermode emulation targets
1415 --disable-bsd-user disable all BSD usermode emulation targets
1416 --enable-guest-base enable GUEST_BASE support for usermode
1418 --disable-guest-base disable GUEST_BASE support
1419 --enable-pie build Position Independent Executables
1420 --disable-pie do not build Position Independent Executables
1421 --fmod-lib path to FMOD library
1422 --fmod-inc path to FMOD includes
1423 --oss-lib path to OSS library
1424 --cpu=CPU Build for host CPU [$cpu]
1425 --disable-uuid disable uuid support
1426 --enable-uuid enable uuid support
1427 --disable-vde disable support for vde network
1428 --enable-vde enable support for vde network
1429 --disable-netmap disable support for netmap network
1430 --enable-netmap enable support for netmap network
1431 --disable-linux-aio disable Linux AIO support
1432 --enable-linux-aio enable Linux AIO support
1433 --disable-cap-ng disable libcap-ng support
1434 --enable-cap-ng enable libcap-ng support
1435 --disable-attr disable attr and xattr support
1436 --enable-attr enable attr and xattr support
1437 --disable-blobs disable installing provided firmware blobs
1438 --enable-docs enable documentation build
1439 --disable-docs disable documentation build
1440 --disable-vhost-net disable vhost-net acceleration support
1441 --enable-vhost-net enable vhost-net acceleration support
1442 --enable-trace-backends=B Set trace backend
1443 Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
1444 --with-trace-file=NAME Full PATH,NAME of file to store traces
1446 --disable-spice disable spice
1447 --enable-spice enable spice
1448 --enable-rbd enable building the rados block device (rbd)
1449 --disable-libiscsi disable iscsi support
1450 --enable-libiscsi enable iscsi support
1451 --disable-libnfs disable nfs support
1452 --enable-libnfs enable nfs support
1453 --disable-smartcard-nss disable smartcard nss support
1454 --enable-smartcard-nss enable smartcard nss support
1455 --disable-libusb disable libusb (for usb passthrough)
1456 --enable-libusb enable libusb (for usb passthrough)
1457 --disable-usb-redir disable usb network redirection support
1458 --enable-usb-redir enable usb network redirection support
1459 --enable-lzo enable the support of lzo compression library
1460 --enable-snappy enable the support of snappy compression library
1461 --disable-guest-agent disable building of the QEMU Guest Agent
1462 --enable-guest-agent enable building of the QEMU Guest Agent
1463 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1464 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1465 --disable-seccomp disable seccomp support
1466 --enable-seccomp enable seccomp support
1467 --with-coroutine=BACKEND coroutine backend. Supported options:
1468 gthread, ucontext, sigaltstack, windows
1469 --disable-coroutine-pool disable coroutine freelist (worse performance)
1470 --enable-coroutine-pool enable coroutine freelist (better performance)
1471 --enable-glusterfs enable GlusterFS backend
1472 --disable-glusterfs disable GlusterFS backend
1473 --enable-archipelago enable Archipelago backend
1474 --disable-archipelago disable Archipelago backend
1475 --enable-gcov enable test coverage analysis with gcov
1476 --gcov=GCOV use specified gcov [$gcov_tool]
1477 --disable-tpm disable TPM support
1478 --enable-tpm enable TPM support
1479 --disable-libssh2 disable ssh block device support
1480 --enable-libssh2 enable ssh block device support
1481 --disable-vhdx disable support for the Microsoft VHDX image format
1482 --enable-vhdx enable support for the Microsoft VHDX image format
1483 --disable-quorum disable quorum block filter support
1484 --enable-quorum enable quorum block filter support
1485 --disable-numa disable libnuma support
1486 --enable-numa enable libnuma support
1488 --disable-hax disable HAX acceleration support
1489 --enable-hax enable HAX acceleration support
1490 --enable-yagl enable YaGL device
1491 --disable-yagl disable YaGL device
1492 --enable-yagl-stats enable YaGL stats
1493 --disable-yagl-stats disable YaGL stats
1494 --enable-vigs enable VIGS device
1495 --disable-vigs disable VIGS device
1498 --enable-maru enable maru board
1499 --enable-java-ui enable java UI
1500 --enable-shm enable shared memory for framebuffer
1501 --enable-libav enable libav library
1502 --disable-libav disable libav library
1503 --enable-libpng enable png library
1504 --enable-dxva2 enable dxva2 support
1505 --disable-dxva2 disable dxva2 support
1506 --ensable-vaapi enable vaapi support
1507 --disable-vaapi disable vaapi support
1508 --extension-path=PATH set extension path
1510 NOTE: The object files are built at the place where configure is launched
1515 # Now we have handled --enable-tcg-interpreter and know we're not just
1516 # printing the help message, bail out if the host CPU isn't supported.
1517 if test "$ARCH" = "unknown"; then
1518 if test "$tcg_interpreter" = "yes" ; then
1519 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1522 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1526 # Consult white-list to determine whether to enable werror
1527 # by default. Only enable by default for git builds
1528 z_version=`cut -f3 -d. $source_path/VERSION`
1530 if test -z "$werror" ; then
1531 if test -d "$source_path/.git" -a \
1532 "$linux" = "yes" ; then
1539 # check that the C compiler works.
1541 int main(void) { return 0; }
1544 if compile_object ; then
1545 : C compiler works ok
1547 error_exit "\"$cc\" either does not exist or does not work"
1550 # Check that the C++ compiler exists and works with the C compiler
1553 int c_function(void);
1554 int main(void) { return c_function(); }
1561 int c_function(void);
1563 int c_function(void) { return 42; }
1568 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
1569 # C++ compiler $cxx works ok with C compiler $cc
1572 echo "C++ compiler $cxx does not work with C compiler $cc"
1573 echo "Disabling C++ specific optional code"
1577 echo "No C++ compiler available; disabling C++ specific optional code"
1581 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1582 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1583 gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1584 gcc_flags="-Wendif-labels $gcc_flags"
1585 gcc_flags="-Wno-initializer-overrides $gcc_flags"
1586 gcc_flags="-Wno-string-plus-int $gcc_flags"
1587 # Note that we do not add -Werror to gcc_flags here, because that would
1588 # enable it for all configure tests. If a configure test failed due
1589 # to -Werror this would just silently disable some features,
1590 # so it's too error prone.
1592 int main(void) { return 0; }
1594 for flag in $gcc_flags; do
1595 # Use the positive sense of the flag when testing for -Wno-wombat
1596 # support (gcc will happily accept the -Wno- form of unknown
1598 optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1599 if compile_prog "-Werror $optflag" "" ; then
1600 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1604 if test "$stack_protector" != "no"; then
1605 gcc_flags="-fstack-protector-strong -fstack-protector-all"
1607 for flag in $gcc_flags; do
1608 # We need to check both a compile and a link, since some compiler
1609 # setups fail only on a .c->.o compile and some only at link time
1610 if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
1611 compile_prog "-Werror $flag" ""; then
1612 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1613 LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,$flag"
1618 if test "$stack_protector" = yes; then
1619 if test $sp_on = 0; then
1620 error_exit "Stack protector not supported"
1625 # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1626 # large functions that use global variables. The bug is in all releases of
1627 # GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1628 # 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1630 #if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1631 int main(void) { return 0; }
1633 #error No bug in this compiler.
1636 if compile_prog "-Werror -fno-gcse" "" ; then
1637 TRANSLATE_OPT_CFLAGS=-fno-gcse
1640 if test "$static" = "yes" ; then
1641 if test "$modules" = "yes" ; then
1642 error_exit "static and modules are mutually incompatible"
1644 if test "$pie" = "yes" ; then
1645 error_exit "static and pie are mutually incompatible"
1651 if test "$pie" = ""; then
1652 case "$cpu-$targetos" in
1653 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
1661 if test "$pie" != "no" ; then
1665 # define THREAD __thread
1670 static THREAD int tls_var;
1672 int main(void) { return tls_var; }
1675 if compile_prog "-fPIE -DPIE" "-pie"; then
1676 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1677 LDFLAGS="-pie $LDFLAGS"
1679 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1680 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1683 if test "$pie" = "yes"; then
1684 error_exit "PIE not available due to missing toolchain support"
1686 echo "Disabling PIE due to missing toolchain support"
1691 if compile_prog "-fno-pie" "-nopie"; then
1692 CFLAGS_NOPIE="-fno-pie"
1693 LDFLAGS_NOPIE="-nopie"
1697 # check for broken gcc and libtool in RHEL5
1698 if test -n "$libtool" -a "$pie" != "no" ; then
1701 void *f(unsigned char *buf, int len);
1702 void *g(unsigned char *buf, int len);
1705 f(unsigned char *buf, int len)
1711 g(unsigned char *buf, int len)
1717 if ! libtool_prog; then
1718 echo "Disabling libtool due to broken toolchain support"
1723 ##########################################
1724 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
1725 # use i686 as default anyway, but for those that don't, an explicit
1726 # specification is necessary
1728 if test "$cpu" = "i386"; then
1730 static int sfaa(int *ptr)
1732 return __sync_fetch_and_and(ptr, 0);
1738 val = __sync_val_compare_and_swap(&val, 0, 1);
1743 if ! compile_prog "" "" ; then
1744 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1748 #########################################
1749 # Solaris specific configure tool chain decisions
1751 if test "$solaris" = "yes" ; then
1752 if has $install; then
1755 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1756 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1757 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1759 if test "`path_of $install`" = "/usr/sbin/install" ; then
1760 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1761 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1762 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1767 if test -f /usr/ccs/bin/ar ; then
1768 error_exit "No path includes ar" \
1769 "Add /usr/ccs/bin to your path and rerun configure"
1771 error_exit "No path includes ar"
1775 if test -z "${target_list+xxx}" ; then
1776 target_list="$default_target_list"
1778 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1781 # Check that we recognised the target name; this allows a more
1782 # friendly error message than if we let it fall through.
1783 for target in $target_list; do
1784 case " $default_target_list " in
1788 error_exit "Unknown target name '$target'"
1793 # see if system emulation was really requested
1794 case " $target_list " in
1795 *"-softmmu "*) softmmu=yes
1801 feature_not_found() {
1805 error_exit "User requested feature $feature" \
1806 "configure was not able to find it." \
1811 # big/little endian test
1813 short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1814 short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1815 extern int foo(short *, short *);
1816 int main(int argc, char *argv[]) {
1817 return foo(big_endian, little_endian);
1821 if compile_object ; then
1822 if grep -q BiGeNdIaN $TMPO ; then
1824 elif grep -q LiTtLeEnDiAn $TMPO ; then
1827 echo big/little test failed
1830 echo big/little test failed
1833 ##########################################
1837 #include <sys/socket.h>
1838 #include <linux/ip.h>
1839 int main(void) { return sizeof(struct mmsghdr); }
1841 if compile_prog "" "" ; then
1847 ##########################################
1850 if ! has "$pkg_config_exe"; then
1851 error_exit "pkg-config binary '$pkg_config_exe' not found"
1854 ##########################################
1857 if test "$linux_user" = "yes"; then
1860 #include <linux/futex.h>
1862 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1868 if ! compile_object ; then
1869 feature_not_found "nptl" "Install glibc and linux kernel headers."
1873 ##########################################
1876 if test "$zlib" != "no" ; then
1879 int main(void) { zlibVersion(); return 0; }
1881 if compile_prog "" "-lz" ; then
1884 error_exit "zlib check failed" \
1885 "Make sure to have the zlib libs and headers installed."
1890 ##########################################
1893 if test "$lzo" != "no" ; then
1895 #include <lzo/lzo1x.h>
1896 int main(void) { lzo_version(); return 0; }
1898 if compile_prog "" "-llzo2" ; then
1899 libs_softmmu="$libs_softmmu -llzo2"
1902 if test "$lzo" = "yes"; then
1903 feature_not_found "liblzo2" "Install liblzo2 devel"
1909 ##########################################
1912 if test "$snappy" != "no" ; then
1914 #include <snappy-c.h>
1915 int main(void) { snappy_max_compressed_length(4096); return 0; }
1917 if compile_prog "" "-lsnappy" ; then
1918 libs_softmmu="$libs_softmmu -lsnappy"
1921 if test "$snappy" = "yes"; then
1922 feature_not_found "libsnappy" "Install libsnappy devel"
1928 ##########################################
1931 if test "$seccomp" != "no" ; then
1932 if test "$cpu" = "i386" || test "$cpu" = "x86_64" &&
1933 $pkg_config --atleast-version=2.1.1 libseccomp; then
1934 libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
1935 QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
1938 if test "$seccomp" = "yes"; then
1939 feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
1944 ##########################################
1947 if test "$xen" != "no" ; then
1948 xen_libs="-lxenstore -lxenctrl -lxenguest"
1950 # First we test whether Xen headers and libraries are available.
1951 # If no, we are done and there is no Xen support.
1952 # If yes, more tests are run to detect the Xen version.
1956 #include <xenctrl.h>
1961 if ! compile_prog "" "$xen_libs" ; then
1963 if test "$xen" = "yes" ; then
1964 feature_not_found "xen" "Install xen devel"
1970 cat > $TMPC <<EOF &&
1971 #include <xenctrl.h>
1972 #include <xenstore.h>
1974 #include <xen/hvm/hvm_info_table.h>
1975 #if !defined(HVM_MAX_VCPUS)
1976 # error HVM_MAX_VCPUS not defined
1981 xc = xc_interface_open(0, 0, 0);
1982 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1983 xc_gnttab_open(NULL, 0);
1984 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1985 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1989 compile_prog "" "$xen_libs"
1991 xen_ctrl_version=420
1995 cat > $TMPC <<EOF &&
1996 #include <xenctrl.h>
1999 #include <xen/hvm/hvm_info_table.h>
2000 #if !defined(HVM_MAX_VCPUS)
2001 # error HVM_MAX_VCPUS not defined
2005 xc_interface_open(0, 0, 0);
2006 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2007 xc_gnttab_open(NULL, 0);
2008 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2012 compile_prog "" "$xen_libs"
2014 xen_ctrl_version=410
2019 cat > $TMPC <<EOF &&
2020 #include <xenctrl.h>
2023 #include <xen/hvm/hvm_info_table.h>
2024 #if !defined(HVM_MAX_VCPUS)
2025 # error HVM_MAX_VCPUS not defined
2028 struct xen_add_to_physmap xatp = {
2029 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
2032 xc_interface_open();
2034 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2035 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
2039 compile_prog "" "$xen_libs"
2041 xen_ctrl_version=400
2046 cat > $TMPC <<EOF &&
2047 #include <xenctrl.h>
2050 struct xen_add_to_physmap xatp = {
2051 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
2054 xc_interface_open();
2056 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2057 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
2061 compile_prog "" "$xen_libs"
2063 xen_ctrl_version=340
2068 cat > $TMPC <<EOF &&
2069 #include <xenctrl.h>
2073 xc_interface_open();
2075 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2079 compile_prog "" "$xen_libs"
2081 xen_ctrl_version=330
2084 # Xen version unsupported
2086 if test "$xen" = "yes" ; then
2087 feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
2092 if test "$xen" = yes; then
2093 libs_softmmu="$xen_libs $libs_softmmu"
2097 if test "$xen_pci_passthrough" != "no"; then
2098 if test "$xen" = "yes" && test "$linux" = "yes" &&
2099 test "$xen_ctrl_version" -ge 340; then
2100 xen_pci_passthrough=yes
2102 if test "$xen_pci_passthrough" = "yes"; then
2103 if test "$xen_ctrl_version" -lt 340; then
2104 error_exit "User requested feature Xen PCI Passthrough" \
2105 "This feature does not work with Xen 3.3"
2107 error_exit "User requested feature Xen PCI Passthrough" \
2108 " but this feature requires /sys from Linux"
2110 xen_pci_passthrough=no
2114 ##########################################
2117 if ! has $libtool; then
2121 # MacOSX ships with a libtool which isn't the GNU one; weed this
2122 # out by checking whether libtool supports the --version switch
2123 if test -n "$libtool"; then
2124 if ! "$libtool" --version >/dev/null 2>&1; then
2129 ##########################################
2131 if test "$sparse" != "no" ; then
2135 if test "$sparse" = "yes" ; then
2136 feature_not_found "sparse" "Install sparse binary"
2142 ##########################################
2145 if test "$gtkabi" = ""; then
2146 # The GTK ABI was not specified explicitly, so try whether 2.0 is available.
2147 # Use 3.0 as a fallback if that is available.
2148 if $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
2150 elif $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
2157 if test "$gtk" != "no"; then
2158 gtkpackage="gtk+-$gtkabi"
2159 gtkx11package="gtk+-x11-$gtkabi"
2160 if test "$gtkabi" = "3.0" ; then
2165 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
2166 gtk_cflags=`$pkg_config --cflags $gtkpackage`
2167 gtk_libs=`$pkg_config --libs $gtkpackage`
2168 if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
2169 gtk_libs="$gtk_libs -lX11"
2171 libs_softmmu="$gtk_libs $libs_softmmu"
2173 elif test "$gtk" = "yes"; then
2174 feature_not_found "gtk" "Install gtk2 or gtk3 devel"
2180 ##########################################
2183 if test "$vte" != "no"; then
2184 if test "$gtkabi" = "3.0"; then
2185 vtepackage="vte-2.90"
2191 if $pkg_config --exists "$vtepackage >= $vteversion"; then
2192 vte_cflags=`$pkg_config --cflags $vtepackage`
2193 vte_libs=`$pkg_config --libs $vtepackage`
2194 libs_softmmu="$vte_libs $libs_softmmu"
2196 elif test "$vte" = "yes"; then
2197 if test "$gtkabi" = "3.0"; then
2198 feature_not_found "vte" "Install libvte-2.90 devel"
2200 feature_not_found "vte" "Install libvte devel"
2207 ##########################################
2211 if test "$qt" != "no"; then
2212 if test "$qtabi" = "5.0" ; then
2213 qtpackage="Qt5Widgets Qt5OpenGL Qt5Gui"
2216 if $pkg_config --exists "$qtpackage >= $qtversion"; then
2217 qt_cflags=`$pkg_config --cflags $qtpackage`
2218 qt_libs=`$pkg_config --libs $qtpackage`
2219 libs_softmmu="$qt_libs $libs_softmmu"
2221 qt_cflags_private=`pkg-config --modversion Qt5Gui`
2222 if test "$darwin" = "yes" ; then
2223 qt_cflags_private=`pkg-config --cflags Qt5Gui | sed "s,QtGui.framework/Headers,&/$qt_cflags_private/QtGui,g"`
2225 qt_cflags_private=`pkg-config --cflags Qt5Gui | sed "s,QtGui,&/$qt_cflags_private/QtGui,g"`
2228 qt_cflags="$qt_cflags $qt_cflags_private"
2229 if test "$mingw32" = "no" ; then
2230 qt_cflags="$qt_cflags -fPIC"
2233 elif test "$qt" = "yes"; then
2234 feature_not_found "qt" "Install qt devel"
2243 ##########################################
2246 # Look for sdl configuration program (pkg-config or sdl-config). Try
2247 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
2249 if test $sdlabi = "2.0"; then
2250 sdl_config=$sdl2_config
2252 sdlconfigname=sdl2_config
2255 sdlconfigname=sdl_config
2258 if test "`basename $sdl_config`" != $sdlconfigname && ! has ${sdl_config}; then
2259 sdl_config=$sdlconfigname
2262 if $pkg_config $sdlname --exists; then
2263 sdlconfig="$pkg_config $sdlname"
2264 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
2265 elif has ${sdl_config}; then
2266 sdlconfig="$sdl_config"
2267 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
2269 if test "$sdl" = "yes" ; then
2270 feature_not_found "sdl" "Install SDL devel"
2274 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
2275 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
2279 if test "$sdl" != "no" ; then
2282 #undef main /* We don't want SDL to override our main() */
2283 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
2285 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
2286 if test "$static" = "yes" ; then
2287 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
2289 sdl_libs=`$sdlconfig --libs 2> /dev/null`
2291 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2292 if test "$_sdlversion" -lt 121 ; then
2295 if test "$cocoa" = "no" ; then
2300 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
2301 if test "$sdl" = "yes" -a "$static" = "yes" ; then
2302 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
2303 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
2304 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
2306 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2312 else # sdl not found
2313 if test "$sdl" = "yes" ; then
2314 feature_not_found "sdl" "Install SDL devel"
2317 fi # sdl compile test
2320 if test "$sdl" = "yes" ; then
2323 #if defined(SDL_VIDEO_DRIVER_X11)
2324 #include <X11/XKBlib.h>
2326 #error No x11 support
2328 int main(void) { return 0; }
2330 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2331 sdl_libs="$sdl_libs -lX11"
2333 libs_softmmu="$sdl_libs $libs_softmmu"
2336 ##########################################
2337 # RDMA needs OpenFabrics libraries
2338 if test "$rdma" != "no" ; then
2340 #include <rdma/rdma_cma.h>
2341 int main(void) { return 0; }
2343 rdma_libs="-lrdmacm -libverbs"
2344 if compile_prog "" "$rdma_libs" ; then
2346 libs_softmmu="$libs_softmmu $rdma_libs"
2348 if test "$rdma" = "yes" ; then
2350 " OpenFabrics librdmacm/libibverbs not present." \
2352 " (1) Fast: Install infiniband packages from your distro." \
2353 " (2) Cleanest: Install libraries from www.openfabrics.org" \
2354 " (3) Also: Install softiwarp if you don't have RDMA hardware"
2360 ##########################################
2361 # VNC TLS/WS detection
2362 if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
2364 #include <gnutls/gnutls.h>
2365 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
2367 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2368 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
2369 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
2370 if test "$vnc_tls" != "no" ; then
2373 if test "$vnc_ws" != "no" ; then
2376 libs_softmmu="$vnc_tls_libs $libs_softmmu"
2377 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
2379 if test "$vnc_tls" = "yes" ; then
2380 feature_not_found "vnc-tls" "Install gnutls devel"
2382 if test "$vnc_ws" = "yes" ; then
2383 feature_not_found "vnc-ws" "Install gnutls devel"
2390 ##########################################
2391 # Quorum probe (check for gnutls)
2392 if test "$quorum" != "no" ; then
2394 #include <gnutls/gnutls.h>
2395 #include <gnutls/crypto.h>
2396 int main(void) {char data[4096], digest[32];
2397 gnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest);
2401 quorum_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2402 quorum_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
2403 if compile_prog "$quorum_tls_cflags" "$quorum_tls_libs" ; then
2405 libs_softmmu="$quorum_tls_libs $libs_softmmu"
2406 libs_tools="$quorum_tls_libs $libs_softmmu"
2407 QEMU_CFLAGS="$QEMU_CFLAGS $quorum_tls_cflags"
2410 if test "$quorum" = "yes"; then
2411 feature_not_found "gnutls" "gnutls > 2.10.0 required to compile Quorum"
2417 ##########################################
2418 # VNC SASL detection
2419 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
2421 #include <sasl/sasl.h>
2423 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
2425 # Assuming Cyrus-SASL installed in /usr prefix
2427 vnc_sasl_libs="-lsasl2"
2428 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
2430 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
2431 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
2433 if test "$vnc_sasl" = "yes" ; then
2434 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
2440 ##########################################
2441 # VNC JPEG detection
2442 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
2445 #include <jpeglib.h>
2446 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2449 vnc_jpeg_libs="-ljpeg"
2450 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2452 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
2453 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
2455 if test "$vnc_jpeg" = "yes" ; then
2456 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
2462 ##########################################
2464 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
2466 //#include <stdio.h>
2470 png_structp png_ptr;
2471 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
2472 return png_ptr != 0;
2475 if $pkg_config libpng --exists; then
2476 vnc_png_cflags=`$pkg_config libpng --cflags`
2477 vnc_png_libs=`$pkg_config libpng --libs`
2480 vnc_png_libs="-lpng"
2482 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2484 libs_softmmu="$vnc_png_libs $libs_softmmu"
2485 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
2487 if test "$vnc_png" = "yes" ; then
2488 feature_not_found "vnc-png" "Install libpng devel"
2494 ##########################################
2495 # fnmatch() probe, used for ACL routines
2498 #include <fnmatch.h>
2501 fnmatch("foo", "foo", 0);
2505 if compile_prog "" "" ; then
2509 ##########################################
2510 # uuid_generate() probe, used for vdi block driver
2511 # Note that on some systems (notably MacOSX) no extra library
2512 # need be linked to get the uuid functions.
2513 if test "$uuid" != "no" ; then
2516 #include <uuid/uuid.h>
2520 uuid_generate(my_uuid);
2524 if compile_prog "" "" ; then
2526 elif compile_prog "" "$uuid_libs" ; then
2528 libs_softmmu="$uuid_libs $libs_softmmu"
2529 libs_tools="$uuid_libs $libs_tools"
2531 if test "$uuid" = "yes" ; then
2532 feature_not_found "uuid" "Install libuuid devel"
2538 if test "$vhdx" = "yes" ; then
2539 if test "$uuid" = "no" ; then
2540 error_exit "uuid required for VHDX support"
2542 elif test "$vhdx" != "no" ; then
2543 if test "$uuid" = "yes" ; then
2550 ##########################################
2551 # xfsctl() probe, used for raw-posix
2552 if test "$xfs" != "no" ; then
2554 #include <stddef.h> /* NULL */
2555 #include <xfs/xfs.h>
2558 xfsctl(NULL, 0, 0, NULL);
2562 if compile_prog "" "" ; then
2565 if test "$xfs" = "yes" ; then
2566 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
2572 ##########################################
2573 # vde libraries probe
2574 if test "$vde" != "no" ; then
2575 vde_libs="-lvdeplug"
2577 #include <libvdeplug.h>
2580 struct vde_open_args a = {0, 0, 0};
2586 if compile_prog "" "$vde_libs" ; then
2588 libs_softmmu="$vde_libs $libs_softmmu"
2589 libs_tools="$vde_libs $libs_tools"
2591 if test "$vde" = "yes" ; then
2592 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
2598 ##########################################
2599 # netmap support probe
2600 # Apart from looking for netmap headers, we make sure that the host API version
2601 # supports the netmap backend (>=11). The upper bound (15) is meant to simulate
2602 # a minor/major version number. Minor new features will be marked with values up
2603 # to 15, and if something happens that requires a change to the backend we will
2604 # move above 15, submit the backend fixes and modify this two bounds.
2605 if test "$netmap" != "no" ; then
2607 #include <inttypes.h>
2609 #include <net/netmap.h>
2610 #include <net/netmap_user.h>
2611 #if (NETMAP_API < 11) || (NETMAP_API > 15)
2614 int main(void) { return 0; }
2616 if compile_prog "" "" ; then
2619 if test "$netmap" = "yes" ; then
2620 feature_not_found "netmap"
2626 ##########################################
2627 # libcap-ng library probe
2628 if test "$cap_ng" != "no" ; then
2634 capng_capability_to_name(CAPNG_EFFECTIVE);
2638 if compile_prog "" "$cap_libs" ; then
2640 libs_tools="$cap_libs $libs_tools"
2642 if test "$cap_ng" = "yes" ; then
2643 feature_not_found "cap_ng" "Install libcap-ng devel"
2649 ##########################################
2650 # Sound support libraries probe
2661 int main(void) { $exp }
2663 if compile_prog "$cfl" "$lib" ; then
2666 error_exit "$drv check failed" \
2667 "Make sure to have the $drv libs and headers installed."
2671 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
2672 for drv in $audio_drv_list; do
2675 audio_drv_probe $drv alsa/asoundlib.h -lasound \
2676 "return snd_pcm_close((snd_pcm_t *)0);"
2677 libs_softmmu="-lasound $libs_softmmu"
2681 if test -z $fmod_lib || test -z $fmod_inc; then
2682 error_exit "You must specify path to FMOD library and headers" \
2683 "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
2685 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
2686 libs_softmmu="$fmod_lib $libs_softmmu"
2690 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
2691 libs_softmmu="-lesd $libs_softmmu"
2696 audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2697 "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2698 libs_softmmu="-lpulse $libs_softmmu"
2703 libs_softmmu="-framework CoreAudio $libs_softmmu"
2707 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
2712 libs_softmmu="$oss_lib $libs_softmmu"
2716 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
2720 libs_softmmu="-lwinmm $libs_softmmu"
2725 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
2726 error_exit "Unknown driver '$drv' selected" \
2727 "Possible drivers are: $audio_possible_drivers"
2733 ##########################################
2736 if test "$brlapi" != "no" ; then
2737 brlapi_libs="-lbrlapi"
2741 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
2743 if compile_prog "" "$brlapi_libs" ; then
2745 libs_softmmu="$brlapi_libs $libs_softmmu"
2747 if test "$brlapi" = "yes" ; then
2748 feature_not_found "brlapi" "Install brlapi devel"
2754 ##########################################
2756 if test "$curses" != "no" ; then
2757 if test "$mingw32" = "yes" ; then
2758 curses_list="-lpdcurses"
2760 curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
2766 const char *s = curses_version();
2772 for curses_lib in $curses_list; do
2774 if compile_prog "" "$curses_lib" ; then
2776 libs_softmmu="$curses_lib $libs_softmmu"
2781 if test "$curses_found" = "yes" ; then
2784 if test "$curses" = "yes" ; then
2785 feature_not_found "curses" "Install ncurses devel"
2791 ##########################################
2793 if test "$curl" != "no" ; then
2794 if $pkg_config libcurl --exists; then
2795 curlconfig="$pkg_config libcurl"
2797 curlconfig=curl-config
2800 #include <curl/curl.h>
2801 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2803 curl_cflags=`$curlconfig --cflags 2>/dev/null`
2804 curl_libs=`$curlconfig --libs 2>/dev/null`
2805 if compile_prog "$curl_cflags" "$curl_libs" ; then
2808 if test "$curl" = "yes" ; then
2809 feature_not_found "curl" "Install libcurl devel"
2815 ##########################################
2816 # bluez support probe
2817 if test "$bluez" != "no" ; then
2819 #include <bluetooth/bluetooth.h>
2820 int main(void) { return bt_error(0); }
2822 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2823 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
2824 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2826 libs_softmmu="$bluez_libs $libs_softmmu"
2828 if test "$bluez" = "yes" ; then
2829 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
2835 ##########################################
2836 # glib support probe
2838 if test "$mingw32" = yes; then
2839 # g_poll is required in order to integrate with the glib main loop.
2844 glib_modules=gthread-2.0
2845 if test "$modules" = yes; then
2846 glib_modules="$glib_modules gmodule-2.0"
2849 for i in $glib_modules; do
2850 if $pkg_config --atleast-version=$glib_req_ver $i; then
2851 glib_cflags=`$pkg_config --cflags $i`
2852 glib_libs=`$pkg_config --libs $i`
2853 CFLAGS="$glib_cflags $CFLAGS"
2854 LIBS="$glib_libs $LIBS"
2855 libs_qga="$glib_libs $libs_qga"
2857 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
2861 # g_test_trap_subprocess added in 2.38. Used by some tests.
2863 if ! $pkg_config --atleast-version=2.38 glib-2.0; then
2867 ##########################################
2868 # SHA command probe for modules
2869 if test "$modules" = yes; then
2870 shacmd_probe="sha1sum sha1 shasum"
2871 for c in $shacmd_probe; do
2872 if which $c >/dev/null 2>&1; then
2877 if test "$shacmd" = ""; then
2878 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
2882 ##########################################
2883 # pixman support probe
2885 if test "$pixman" = ""; then
2886 if test "$want_tools" = "no" -a "$softmmu" = "no"; then
2888 elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
2894 if test "$pixman" = "none"; then
2895 if test "$want_tools" != "no" -o "$softmmu" != "no"; then
2896 error_exit "pixman disabled but system emulation or tools build" \
2897 "enabled. You can turn off pixman only if you also" \
2898 "disable all system emulation targets and the tools" \
2899 "build with '--disable-tools --disable-system'."
2903 elif test "$pixman" = "system"; then
2904 # pixman version has been checked above
2905 pixman_cflags=`$pkg_config --cflags pixman-1`
2906 pixman_libs=`$pkg_config --libs pixman-1`
2908 if test ! -d ${source_path}/pixman/pixman; then
2909 error_exit "pixman >= 0.21.8 not present. Your options:" \
2910 " (1) Preferred: Install the pixman devel package (any recent" \
2911 " distro should have packages as Xorg needs pixman too)." \
2912 " (2) Fetch the pixman submodule, using:" \
2913 " git submodule update --init pixman"
2915 mkdir -p pixman/pixman
2916 pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
2917 pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
2920 ##########################################
2923 if test "$cap" != "no" ; then
2926 #include <sys/capability.h>
2927 int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
2929 if compile_prog "" "-lcap" ; then
2936 ##########################################
2938 PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
2942 #include <pthread.h>
2943 static void *f(void *p) { return NULL; }
2946 pthread_create(&thread, 0, f, 0);
2950 if compile_prog "" "" ; then
2953 for pthread_lib in $PTHREADLIBS_LIST; do
2954 if compile_prog "" "$pthread_lib" ; then
2957 for lib_entry in $LIBS; do
2958 if test "$lib_entry" = "$pthread_lib"; then
2963 if test "$found" = "no"; then
2964 LIBS="$pthread_lib $LIBS"
2971 if test "$mingw32" != yes -a "$pthread" = no; then
2972 error_exit "pthread check failed" \
2973 "Make sure to have the pthread libs and headers installed."
2976 # check for pthread_setname_np
2977 pthread_setname_np=no
2979 #include <pthread.h>
2981 static void *f(void *p) { return NULL; }
2985 pthread_create(&thread, 0, f, 0);
2986 pthread_setname_np(thread, "QEMU");
2990 if compile_prog "" "$pthread_lib" ; then
2991 pthread_setname_np=yes
2994 ##########################################
2996 if test "$rbd" != "no" ; then
2999 #include <rbd/librbd.h>
3002 rados_create(&cluster, NULL);
3006 rbd_libs="-lrbd -lrados"
3007 if compile_prog "" "$rbd_libs" ; then
3010 if test "$rbd" = "yes" ; then
3011 feature_not_found "rados block device" "Install librbd/ceph devel"
3017 ##########################################
3019 min_libssh2_version=1.2.8
3020 if test "$libssh2" != "no" ; then
3021 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
3022 libssh2_cflags=`$pkg_config libssh2 --cflags`
3023 libssh2_libs=`$pkg_config libssh2 --libs`
3026 if test "$libssh2" = "yes" ; then
3027 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
3033 ##########################################
3034 # libssh2_sftp_fsync probe
3036 if test "$libssh2" = "yes"; then
3039 #include <libssh2.h>
3040 #include <libssh2_sftp.h>
3042 LIBSSH2_SESSION *session;
3044 LIBSSH2_SFTP_HANDLE *sftp_handle;
3045 session = libssh2_session_init ();
3046 sftp = libssh2_sftp_init (session);
3047 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
3048 libssh2_sftp_fsync (sftp_handle);
3052 # libssh2_cflags/libssh2_libs defined in previous test.
3053 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
3054 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
3058 ##########################################
3061 if test "$linux_aio" != "no" ; then
3064 #include <sys/eventfd.h>
3066 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
3068 if compile_prog "" "-laio" ; then
3071 if test "$linux_aio" = "yes" ; then
3072 feature_not_found "linux AIO" "Install libaio devel"
3078 ##########################################
3079 # TPM passthrough is only on x86 Linux
3081 if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
3082 tpm_passthrough=$tpm
3087 ##########################################
3090 if test "$attr" != "no" ; then
3093 #include <sys/types.h>
3094 #ifdef CONFIG_LIBATTR
3095 #include <attr/xattr.h>
3097 #include <sys/xattr.h>
3099 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
3101 if compile_prog "" "" ; then
3103 # Older distros have <attr/xattr.h>, and need -lattr:
3104 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
3109 if test "$attr" = "yes" ; then
3110 feature_not_found "ATTR" "Install libc6 or libattr devel"
3116 ##########################################
3119 #include <sys/types.h>
3120 #include <sys/uio.h>
3122 int main(void) { return sizeof(struct iovec); }
3125 if compile_prog "" "" ; then
3129 ##########################################
3132 #include <sys/types.h>
3133 #include <sys/uio.h>
3135 int main(void) { return preadv(0, 0, 0, 0); }
3138 if compile_prog "" "" ; then
3142 ##########################################
3144 # fdt support is mandatory for at least some target architectures,
3145 # so insist on it if we're building those system emulators.
3147 for target in $target_list; do
3149 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
3155 if test "$fdt_required" = "yes"; then
3156 if test "$fdt" = "no"; then
3157 error_exit "fdt disabled but some requested targets require it." \
3158 "You can turn off fdt only if you also disable all the system emulation" \
3159 "targets which need it (by specifying a cut down --target-list)."
3164 if test "$fdt" != "no" ; then
3166 # explicitly check for libfdt_env.h as it is missing in some stable installs
3168 #include <libfdt_env.h>
3169 int main(void) { return 0; }
3171 if compile_prog "" "$fdt_libs" ; then
3172 # system DTC is good - use it
3174 elif test -d ${source_path}/dtc/libfdt ; then
3175 # have submodule DTC - use it
3179 if [ "$pwd_is_source_path" != "y" ] ; then
3180 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
3181 symlink "$source_path/dtc/scripts" "dtc/scripts"
3183 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
3184 fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
3185 elif test "$fdt" = "yes" ; then
3186 # have neither and want - prompt for system/submodule install
3187 error_exit "DTC (libfdt) not present. Your options:" \
3188 " (1) Preferred: Install the DTC (libfdt) devel package" \
3189 " (2) Fetch the DTC submodule, using:" \
3190 " git submodule update --init dtc"
3192 # don't have and don't want
3198 libs_softmmu="$libs_softmmu $fdt_libs"
3200 ##########################################
3201 # GLX probe, used by milkymist-tmu2
3202 if test "$glx" != "no" ; then
3203 glx_libs="-lGL -lX11"
3205 #include <X11/Xlib.h>
3208 int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
3210 if compile_prog "" "-lGL -lX11" ; then
3213 if test "$glx" = "yes" ; then
3214 feature_not_found "glx" "Install GL devel (e.g. MESA)"
3222 ##########################################
3224 if test "$archipelago" != "no" ; then
3227 #include <xseg/xseg.h>
3228 #include <xseg/protocol.h>
3234 archipelago_libs=-lxseg
3235 if compile_prog "" "$archipelago_libs"; then
3237 libs_tools="$archipelago_libs $libs_tools"
3238 libs_softmmu="$archipelago_libs $libs_softmmu"
3240 if test "$archipelago" = "yes" ; then
3241 feature_not_found "Archipelago backend support" "Install libxseg devel"
3248 ##########################################
3250 if test "$glusterfs" != "no" ; then
3251 if $pkg_config --atleast-version=3 glusterfs-api; then
3253 glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
3254 glusterfs_libs=`$pkg_config --libs glusterfs-api`
3255 if $pkg_config --atleast-version=5 glusterfs-api; then
3256 glusterfs_discard="yes"
3258 if $pkg_config --atleast-version=6 glusterfs-api; then
3259 glusterfs_zerofill="yes"
3262 if test "$glusterfs" = "yes" ; then
3263 feature_not_found "GlusterFS backend support" \
3264 "Install glusterfs-api devel >= 3"
3270 # Check for inotify functions when we are building linux-user
3271 # emulator. This is done because older glibc versions don't
3272 # have syscall stubs for these implemented. In that case we
3273 # don't provide them even if kernel supports them.
3277 #include <sys/inotify.h>
3282 /* try to start inotify */
3283 return inotify_init();
3286 if compile_prog "" "" ; then
3292 #include <sys/inotify.h>
3297 /* try to start inotify */
3298 return inotify_init1(0);
3301 if compile_prog "" "" ; then
3305 # check if utimensat and futimens are supported
3308 #define _ATFILE_SOURCE
3311 #include <sys/stat.h>
3315 utimensat(AT_FDCWD, "foo", NULL, 0);
3320 if compile_prog "" "" ; then
3324 # check if pipe2 is there
3333 return pipe2(pipefd, O_CLOEXEC);
3336 if compile_prog "" "" ; then
3340 # check if accept4 is there
3343 #include <sys/socket.h>
3348 accept4(0, NULL, NULL, SOCK_CLOEXEC);
3352 if compile_prog "" "" ; then
3356 # check if tee/splice is there. vmsplice was added same time.
3366 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
3367 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
3371 if compile_prog "" "" ; then
3375 ##########################################
3378 if test "$numa" != "no" ; then
3381 int main(void) { return numa_available(); }
3384 if compile_prog "" "-lnuma" ; then
3386 libs_softmmu="-lnuma $libs_softmmu"
3388 if test "$numa" = "yes" ; then
3389 feature_not_found "numa" "install numactl devel"
3395 ##########################################
3400 #include <sys/syscall.h>
3402 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
3405 if compile_prog "" "" ; then
3409 # check if eventfd is supported
3412 #include <sys/eventfd.h>
3416 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
3419 if compile_prog "" "" ; then
3423 # check for fallocate
3430 fallocate(0, 0, 0, 0);
3434 if compile_prog "" "" ; then
3438 # check for fallocate hole punching
3439 fallocate_punch_hole=no
3442 #include <linux/falloc.h>
3446 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
3450 if compile_prog "" "" ; then
3451 fallocate_punch_hole=yes
3454 # check for posix_fallocate
3461 posix_fallocate(0, 0, 0);
3465 if compile_prog "" "" ; then
3469 # check for sync_file_range
3476 sync_file_range(0, 0, 0, 0);
3480 if compile_prog "" "" ; then
3484 # check for linux/fiemap.h and FS_IOC_FIEMAP
3487 #include <sys/ioctl.h>
3488 #include <linux/fs.h>
3489 #include <linux/fiemap.h>
3493 ioctl(0, FS_IOC_FIEMAP, 0);
3497 if compile_prog "" "" ; then
3512 if compile_prog "" "" ; then
3516 # check for ppoll support
3523 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
3524 ppoll(&pfd, 1, 0, 0);
3528 if compile_prog "" "" ; then
3532 # check for prctl(PR_SET_TIMERSLACK , ... ) support
3533 prctl_pr_set_timerslack=no
3535 #include <sys/prctl.h>
3539 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
3543 if compile_prog "" "" ; then
3544 prctl_pr_set_timerslack=yes
3547 # check for epoll support
3550 #include <sys/epoll.h>
3558 if compile_prog "" "" ; then
3562 # epoll_create1 and epoll_pwait are later additions
3563 # so we must check separately for their presence
3566 #include <sys/epoll.h>
3570 /* Note that we use epoll_create1 as a value, not as
3571 * a function being called. This is necessary so that on
3572 * old SPARC glibc versions where the function was present in
3573 * the library but not declared in the header file we will
3574 * fail the configure check. (Otherwise we will get a compiler
3575 * warning but not an error, and will proceed to fail the
3576 * qemu compile where we compile with -Werror.)
3578 return (int)(uintptr_t)&epoll_create1;
3581 if compile_prog "" "" ; then
3587 #include <sys/epoll.h>
3591 epoll_pwait(0, 0, 0, 0, 0);
3595 if compile_prog "" "" ; then
3599 # check for sendfile support
3602 #include <sys/sendfile.h>
3606 return sendfile(0, 0, 0, 0);
3609 if compile_prog "" "" ; then
3613 # check for timerfd support (glibc 2.8 and newer)
3616 #include <sys/timerfd.h>
3620 return(timerfd_create(CLOCK_REALTIME, 0));
3623 if compile_prog "" "" ; then
3627 # check for setns and unshare support
3640 if compile_prog "" "" ; then
3644 # Check if tools are available to build documentation.
3645 if test "$docs" != "no" ; then
3646 if has makeinfo && has pod2man; then
3649 if test "$docs" = "yes" ; then
3650 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
3656 # Search for bswap_32 function
3659 #include <byteswap.h>
3660 int main(void) { return bswap_32(0); }
3662 if compile_prog "" "" ; then
3666 # Search for bswap32 function
3669 #include <sys/endian.h>
3670 #include <sys/types.h>
3671 #include <machine/bswap.h>
3672 int main(void) { return bswap32(0); }
3674 if compile_prog "" "" ; then
3678 ##########################################
3679 # Do we have libiscsi >= 1.9.0
3680 if test "$libiscsi" != "no" ; then
3681 if $pkg_config --atleast-version=1.9.0 libiscsi; then
3683 libiscsi_cflags=$($pkg_config --cflags libiscsi)
3684 libiscsi_libs=$($pkg_config --libs libiscsi)
3686 if test "$libiscsi" = "yes" ; then
3687 feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
3693 ##########################################
3697 int main(int argc, char **argv) { return isnan(sin((double)argc)); }
3699 if compile_prog "" "" ; then
3701 elif compile_prog "" "-lm" ; then
3703 libs_qga="-lm $libs_qga"
3705 error_exit "libm check failed"
3708 ##########################################
3710 # uClibc provides 2 versions of clock_gettime(), one with realtime
3711 # support and one without. This means that the clock_gettime() don't
3712 # need -lrt. We still need it for timer_create() so we check for this
3713 # function in addition.
3718 timer_create(CLOCK_REALTIME, NULL, NULL);
3719 return clock_gettime(CLOCK_REALTIME, NULL);
3723 if compile_prog "" "" ; then
3725 # we need pthread for static linking. use previous pthread test result
3726 elif compile_prog "" "$pthread_lib -lrt" ; then
3728 libs_qga="$libs_qga -lrt"
3731 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
3732 "$aix" != "yes" -a "$haiku" != "yes" ; then
3733 libs_softmmu="-lutil $libs_softmmu"
3736 ##########################################
3738 if test "$spice" != "no" ; then
3741 int main(void) { spice_server_new(); return 0; }
3743 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3744 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
3745 if $pkg_config --atleast-version=0.12.0 spice-server && \
3746 $pkg_config --atleast-version=0.12.3 spice-protocol && \
3747 compile_prog "$spice_cflags" "$spice_libs" ; then
3749 libs_softmmu="$libs_softmmu $spice_libs"
3750 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
3751 spice_protocol_version=$($pkg_config --modversion spice-protocol)
3752 spice_server_version=$($pkg_config --modversion spice-server)
3754 if test "$spice" = "yes" ; then
3755 feature_not_found "spice" \
3756 "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel"
3762 # check for libcacard for smartcard support
3764 # TODO - what's the minimal nss version we support?
3765 if test "$smartcard_nss" != "no"; then
3767 #include <pk11pub.h>
3768 int main(void) { PK11_FreeSlot(0); return 0; }
3770 # FIXME: do not include $glib_* in here
3771 nss_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
3772 nss_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
3773 test_cflags="$nss_cflags"
3774 # The header files in nss < 3.13.3 have a bug which causes them to
3775 # emit a warning. If we're going to compile QEMU with -Werror, then
3776 # test that the headers don't have this bug. Otherwise we would pass
3777 # the configure test but fail to compile QEMU later.
3778 if test "$werror" = "yes"; then
3779 test_cflags="-Werror $test_cflags"
3781 if test -n "$libtool" &&
3782 $pkg_config --atleast-version=3.12.8 nss && \
3783 compile_prog "$test_cflags" "$nss_libs"; then
3786 if test "$smartcard_nss" = "yes"; then
3787 feature_not_found "nss" "Install nss devel >= 3.12.8"
3793 # check for libtizenusb
3794 if test "$libtizenusb" != "no" ; then
3798 echo $PKG_CONFIG_PATH
3799 if $pkg_config --modversion libtizenusb >/dev/null 2>&1 ; then
3800 libtizenusb_cflags=$($pkg_config --cflags libtizenusb 2>/dev/null)
3801 libtizenusb_libs=$($pkg_config --libs libtizenusb 2>/dev/null)
3803 echo "libtizenusb found"
3804 echo "cflags = $libtizenusb_cflags"
3805 echo "libs = $libtizenusb_libs"
3807 error_exit "libtizenusb not found (you might not be set PKG_CONFIG_PATH"
3809 QEMU_CFLAGS="$QEMU_CFLAGS $libtizenusb_cflags"
3810 libs_softmmu="$libs_softmmu $libtizenusb_libs"
3814 if test "$libusb" != "no" ; then
3815 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
3817 libusb_cflags=$($pkg_config --cflags libusb-1.0)
3818 libusb_libs=$($pkg_config --libs libusb-1.0)
3819 QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
3820 libs_softmmu="$libs_softmmu $libusb_libs"
3822 if test "$libusb" = "yes"; then
3823 feature_not_found "libusb" "Install libusb devel >= 1.0.13"
3829 # check for usbredirparser for usb network redirection support
3830 if test "$usb_redir" != "no" ; then
3831 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
3833 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3834 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
3835 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
3836 libs_softmmu="$libs_softmmu $usb_redir_libs"
3838 if test "$usb_redir" = "yes"; then
3839 feature_not_found "usb-redir" "Install usbredir devel"
3845 ##########################################
3846 # check if we have VSS SDK headers for win
3848 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3849 case "$vss_win32_sdk" in
3850 "") vss_win32_include="-I$source_path" ;;
3851 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3852 # handle path with spaces. So we symlink the headers into ".sdk/vss".
3853 vss_win32_include="-I$source_path/.sdk/vss"
3854 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3856 *) vss_win32_include="-I$vss_win32_sdk"
3859 #define __MIDL_user_allocate_free_DEFINED__
3860 #include <inc/win2003/vss.h>
3861 int main(void) { return VSS_CTX_BACKUP; }
3863 if compile_prog "$vss_win32_include" "" ; then
3864 guest_agent_with_vss="yes"
3865 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3866 libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3868 if test "$vss_win32_sdk" != "" ; then
3869 echo "ERROR: Please download and install Microsoft VSS SDK:"
3870 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3871 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3872 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
3873 echo "ERROR: The headers are extracted in the directory \`inc'."
3874 feature_not_found "VSS support"
3876 guest_agent_with_vss="no"
3880 ##########################################
3881 # lookup Windows platform SDK (if not specified)
3882 # The SDK is needed only to build .tlb (type library) file of guest agent
3883 # VSS provider from the source. It is usually unnecessary because the
3884 # pre-compiled .tlb file is included.
3886 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3887 if test -z "$win_sdk"; then
3888 programfiles="$PROGRAMFILES"
3889 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3890 if test -n "$programfiles"; then
3891 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3893 feature_not_found "Windows SDK"
3895 elif test "$win_sdk" = "no"; then
3900 ##########################################
3902 ##########################################
3903 # check if we have fdatasync
3909 #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3910 return fdatasync(0);
3912 #error Not supported
3916 if compile_prog "" "" ; then
3920 ##########################################
3921 # check if we have madvise
3925 #include <sys/types.h>
3926 #include <sys/mman.h>
3928 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3930 if compile_prog "" "" ; then
3934 ##########################################
3935 # check if we have posix_madvise
3939 #include <sys/mman.h>
3941 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3943 if compile_prog "" "" ; then
3947 ##########################################
3948 # check if we have usable SIGEV_THREAD_ID
3955 ev.sigev_notify = SIGEV_THREAD_ID;
3956 ev._sigev_un._tid = 0;
3957 asm volatile("" : : "g"(&ev));
3961 if compile_prog "" "" ; then
3965 ##########################################
3966 # check if trace backend exists
3968 $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
3969 if test "$?" -ne 0 ; then
3970 error_exit "invalid trace backends" \
3971 "Please choose supported trace backends."
3974 ##########################################
3975 # For 'ust' backend, test if ust headers are present
3976 if have_backend "ust"; then
3978 #include <lttng/tracepoint.h>
3979 int main(void) { return 0; }
3981 if compile_prog "" "" ; then
3982 if $pkg_config lttng-ust --exists; then
3983 lttng_ust_libs=`$pkg_config --libs lttng-ust`
3985 lttng_ust_libs="-llttng-ust"
3987 if $pkg_config liburcu-bp --exists; then
3988 urcu_bp_libs=`$pkg_config --libs liburcu-bp`
3990 urcu_bp_libs="-lurcu-bp"
3993 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
3994 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
3996 error_exit "Trace backend 'ust' missing lttng-ust header files"
4000 ##########################################
4001 # For 'dtrace' backend, test if 'dtrace' command is present
4002 if have_backend "dtrace"; then
4003 if ! has 'dtrace' ; then
4004 error_exit "dtrace command is not found in PATH $PATH"
4006 trace_backend_stap="no"
4007 if has 'stap' ; then
4008 trace_backend_stap="yes"
4012 ##########################################
4013 # check and set a backend for coroutine
4015 # We prefer ucontext, but it's not always possible. The fallback
4016 # is sigcontext. gthread is not selectable except explicitly, because
4017 # it is not functional enough to run QEMU proper. (It is occasionally
4018 # useful for debugging purposes.) On Windows the only valid backend
4019 # is the Windows-specific one.
4022 if test "$darwin" != "yes"; then
4024 #include <ucontext.h>
4025 #ifdef __stub_makecontext
4026 #error Ignoring glibc stub makecontext which will always fail
4028 int main(void) { makecontext(0, 0, 0); return 0; }
4030 if compile_prog "" "" ; then
4035 if test "$coroutine" = ""; then
4036 if test "$mingw32" = "yes"; then
4038 elif test "$ucontext_works" = "yes"; then
4041 coroutine=sigaltstack
4046 if test "$mingw32" != "yes"; then
4047 error_exit "'windows' coroutine backend only valid for Windows"
4049 # Unfortunately the user visible backend name doesn't match the
4050 # coroutine-*.c filename for this case, so we have to adjust it here.
4054 if test "$ucontext_works" != "yes"; then
4055 feature_not_found "ucontext"
4058 gthread|sigaltstack)
4059 if test "$mingw32" = "yes"; then
4060 error_exit "only the 'windows' coroutine backend is valid for Windows"
4064 error_exit "unknown coroutine backend $coroutine"
4069 if test "$coroutine_pool" = ""; then
4070 if test "$coroutine" = "gthread"; then
4076 if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
4077 error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
4080 ##########################################
4081 # check if we have open_by_handle_at
4083 open_by_handle_at=no
4086 #if !defined(AT_EMPTY_PATH)
4087 # error missing definition
4089 int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
4092 if compile_prog "" "" ; then
4093 open_by_handle_at=yes
4096 ########################################
4097 # check if we have linux/magic.h
4101 #include <linux/magic.h>
4106 if compile_prog "" "" ; then
4110 ########################################
4111 # check whether we can disable warning option with a pragma (this is needed
4112 # to silence warnings in the headers of some versions of external libraries).
4113 # This test has to be compiled with -Werror as otherwise an unknown pragma is
4116 # If we can't selectively disable warning in the code, disable -Werror so that
4117 # the build doesn't fail anyway.
4119 pragma_disable_unused_but_set=no
4121 #pragma GCC diagnostic push
4122 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
4123 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
4124 #pragma GCC diagnostic pop
4130 if test "$force_werror" != "yes"; then
4131 if compile_prog "-Werror" "" ; then
4132 pragma_diagnostic_available=yes
4138 ########################################
4139 # check if we have valgrind/valgrind.h
4143 #include <valgrind/valgrind.h>
4148 if compile_prog "" "" ; then
4152 ########################################
4153 # check if environ is declared
4163 if compile_prog "" "" ; then
4167 ########################################
4168 # check if cpuid.h is usable.
4174 unsigned a, b, c, d;
4175 int max = __get_cpuid_max(0, 0);
4178 __cpuid(1, a, b, c, d);
4182 __cpuid_count(7, 0, a, b, c, d);
4188 if compile_prog "" "" ; then
4192 ########################################
4193 # check if __[u]int128_t is usable.
4197 #if defined(__clang_major__) && defined(__clang_minor__)
4198 # if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
4199 # error __int128_t does not work in CLANG before 3.2
4211 if compile_prog "" "" ; then
4215 ########################################
4216 # check if getauxval is available.
4220 #include <sys/auxv.h>
4222 return getauxval(AT_HWCAP) == 0;
4225 if compile_prog "" "" ; then
4229 ########################################
4230 # check if dxva2 is available.
4236 #include <dxva2api.h>
4238 #if !defined(IDirect3D9_CreateDevice) || \
4239 !defined(IDirect3DDeviceManager9_ResetDevice)
4240 #error No DXVA2 support
4245 if compile_prog "" "" ; then
4253 if test "$dxva2" = "yes" ; then
4254 if test "$mingw32" = "yes" ; then
4256 if test "$dxva2" != "yes" ; then
4257 feature_not_found "dxva2"
4260 error_exit "DXVA2 is supported only on Windows"
4263 if test "$dxva2" != "no" ; then
4268 ########################################
4269 # check if vaapi is available.
4273 if $pkg_config libva --exists; then
4274 libva_cflags=`$pkg_config --cflags libva`
4275 libva_libs=`$pkg_config --libs libva`
4281 if $pkg_config libva-x11 --exists; then
4282 libva_x11_cflags=`$pkg_config --cflags libva-x11`
4283 libva_x11_libs=`$pkg_config --libs libva-x11`
4284 libs_softmmu="$libva_libs $libva_x11_libs $libs_softmmu"
4292 if test "$vaapi" = "yes" ; then
4293 if test "$linux" = "yes" ; then
4295 if test "$vaapi" != "yes" ; then
4296 feature_not_found "vaapi"
4299 error_exit "VAAPI is supported only on Linux"
4302 if test "$vaapi" != "no" ; then
4307 ########################################
4308 # check extension path
4310 if [ ! -d "$source_path/tizen/src/$extension_path" ] ; then
4311 error_exit "Extension path is not valid $source_path/tizen/src/$extension_path"
4314 ##########################################
4317 libavcodec_package="libavcodec"
4318 libavcodec_version="54.35.0"
4319 libavutil_package="libavutil"
4320 libavutil_version="52.3.0"
4321 libavformat_package="libavformat"
4322 libavformat_version="54.20.3"
4323 libavresample_package="libavresample"
4324 libavresample_version="1.0.1"
4325 libx264_package="x264"
4330 if $pkg_config --exists "$1 >= $2" ; then
4331 libav_cflags=`$pkg_config --cflags $1`
4332 libav_libs=`$pkg_config --libs $1`
4333 libs_softmmu="$libav_libs $libs_softmmu"
4341 if test "$libav" = "yes"; then
4342 check_libav $libavcodec_package $libavcodec_version
4343 if test "$libav" != "yes"; then
4344 feature_not_found "libav"
4347 check_libav $libavformat_package $libavformat_version
4348 if test "$libav" != "yes"; then
4349 feature_not_found "libav"
4352 check_libav $libavutil_package $libavutil_version
4353 if test "$libav" != "yes"; then
4354 feature_not_found "libav"
4357 check_libav $libavresample_package $libavresample_version
4358 if test "$libav" != "yes"; then
4359 feature_not_found "libav"
4362 if test "$libav" != "no"; then
4363 check_libav $libavcodec_package $libavcodec_version
4365 check_libav $libavformat_package $libavformat_version
4367 check_libav $libavutil_package $libavutil_version
4369 check_libav $libavresample_package $libavresample_version
4372 if $pkg_config --exists "$libx264_package" ; then
4373 libav_libs="$libav_libs `$pkg_config --libs $libx264_package`"
4379 ##########################################
4382 if test "$libpng" != "no"; then
4383 libpng_package="libpng"
4385 if $pkg_config --exists "$libpng_package" ; then
4386 libpng_cflags=`$pkg_config --cflags $libpng_package`
4387 libpng_libs=`$pkg_config --libs $libpng_package`
4388 libs_softmmu="$libpng_libs $libs_softmmu"
4391 if test "$libpng" = "yes" ; then
4392 feature_not_found "libpng"
4398 ##########################################
4400 # After here, no more $cc or $ld runs
4402 if test "$gcov" = "yes" ; then
4403 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
4404 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
4405 elif test "$debug" = "no" ; then
4406 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
4409 ##########################################
4411 if test "$libnfs" != "no" ; then
4412 if $pkg_config --atleast-version=1.9.3 libnfs; then
4414 libnfs_libs=$($pkg_config --libs libnfs)
4415 LIBS="$LIBS $libnfs_libs"
4417 if test "$libnfs" = "yes" ; then
4418 feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
4424 # Disable zero malloc errors for official releases unless explicitly told to
4426 if test -z "$zero_malloc" ; then
4427 if test "$z_version" = "50" ; then
4434 # Now we've finished running tests it's OK to add -Werror to the compiler flags
4435 if test "$werror" = "yes"; then
4436 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
4439 if test "$solaris" = "no" ; then
4440 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
4441 LDFLAGS="-Wl,--warn-common $LDFLAGS"
4445 # test if pod2man has --utf8 option
4446 if pod2man --help | grep -q utf8; then
4447 POD2MAN="pod2man --utf8"
4452 # Use ASLR, no-SEH and DEP if available
4453 if test "$mingw32" = "yes" ; then
4454 for flag in --dynamicbase --no-seh --nxcompat; do
4455 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
4456 LDFLAGS="-Wl,$flag $LDFLAGS"
4461 qemu_confdir=$sysconfdir$confsuffix
4462 qemu_moddir=$libdir$confsuffix
4463 qemu_datadir=$datadir$confsuffix
4464 qemu_localedir="$datadir/locale"
4467 if test "$want_tools" = "yes" ; then
4468 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
4469 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
4470 tools="qemu-nbd\$(EXESUF) $tools"
4473 if test "$softmmu" = yes ; then
4474 if test "$virtfs" != no ; then
4475 if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
4477 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
4478 elif test "$darwin" = yes ; then
4479 echo "Enable VirtFS on Darwin"
4481 elif test "$mingw32" = yes ; then
4482 echo "Enable VirtFS on Windows"
4485 if test "$virtfs" = yes; then
4486 error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
4492 if [ "$guest_agent" != "no" ]; then
4493 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
4494 tools="qemu-ga\$(EXESUF) $tools"
4495 if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
4496 tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
4499 elif [ "$guest_agent" != yes ]; then
4502 error_exit "Guest agent is not supported on this platform"
4506 # Mac OS X ships with a broken assembler
4508 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
4509 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
4510 "$softmmu" = yes ; then
4513 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
4514 roms="$roms spapr-rtas"
4517 if test "$cpu" = "s390x" ; then
4518 roms="$roms s390-ccw"
4521 # Probe for the need for relocating the user-only binary.
4522 if test "$pie" = "no" ; then
4525 arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
4526 # ??? Rationale for choosing this address
4527 textseg_addr=0x60000000
4530 # A 256M aligned address, high in the address space, with enough
4531 # room for the code_gen_buffer above it before the stack.
4532 textseg_addr=0x60000000
4535 if [ -n "$textseg_addr" ]; then
4537 int main(void) { return 0; }
4539 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
4540 if ! compile_prog "" "$textseg_ldflags"; then
4541 # In case ld does not support -Ttext-segment, edit the default linker
4542 # script via sed to set the .text start addr. This is needed on FreeBSD
4544 $ld --verbose | sed \
4545 -e '1,/==================================================/d' \
4546 -e '/==================================================/,$d' \
4547 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
4548 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
4549 textseg_ldflags="-Wl,-T../config-host.ld"
4554 # prepend pixman and ftd flags after all config tests are done
4555 QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
4556 libs_softmmu="$pixman_libs $libs_softmmu"
4558 echo "Install prefix $prefix"
4559 echo "BIOS directory `eval echo $qemu_datadir`"
4560 echo "binary directory `eval echo $bindir`"
4561 echo "library directory `eval echo $libdir`"
4562 echo "module directory `eval echo $qemu_moddir`"
4563 echo "libexec directory `eval echo $libexecdir`"
4564 echo "include directory `eval echo $includedir`"
4565 echo "config directory `eval echo $sysconfdir`"
4566 if test "$mingw32" = "no" ; then
4567 echo "local state directory `eval echo $local_statedir`"
4568 echo "Manual directory `eval echo $mandir`"
4569 echo "ELF interp prefix $interp_prefix"
4571 echo "local state directory queried at runtime"
4572 echo "Windows SDK $win_sdk"
4574 echo "Source path $source_path"
4575 echo "C compiler $cc"
4576 echo "Host C compiler $host_cc"
4577 echo "C++ compiler $cxx"
4578 echo "Objective-C compiler $objcc"
4579 echo "ARFLAGS $ARFLAGS"
4580 echo "CFLAGS $CFLAGS"
4581 echo "QEMU_CFLAGS $QEMU_CFLAGS"
4582 echo "LDFLAGS $LDFLAGS"
4584 echo "install $install"
4585 echo "python $python"
4586 if test "$slirp" = "yes" ; then
4589 echo "module support $modules"
4590 echo "host CPU $cpu"
4591 echo "host big endian $bigendian"
4592 echo "target list $target_list"
4593 echo "tcg debug enabled $debug_tcg"
4594 echo "gprof enabled $gprof"
4595 echo "sparse enabled $sparse"
4596 echo "strip binaries $strip_opt"
4597 echo "profiler $profiler"
4598 echo "static build $static"
4599 if test "$darwin" = "yes" ; then
4600 echo "Cocoa support $cocoa"
4602 echo "pixman $pixman"
4603 echo "SDL support $sdl"
4604 echo "GTK support $gtk"
4605 echo "Qt support $qt"
4606 echo "VTE support $vte"
4607 echo "curses support $curses"
4608 echo "curl support $curl"
4609 echo "mingw32 support $mingw32"
4610 echo "Audio drivers $audio_drv_list"
4611 echo "Block whitelist (rw) $block_drv_rw_whitelist"
4612 echo "Block whitelist (ro) $block_drv_ro_whitelist"
4613 echo "VirtFS support $virtfs"
4614 echo "VNC support $vnc"
4615 if test "$vnc" = "yes" ; then
4616 echo "VNC TLS support $vnc_tls"
4617 echo "VNC SASL support $vnc_sasl"
4618 echo "VNC JPEG support $vnc_jpeg"
4619 echo "VNC PNG support $vnc_png"
4620 echo "VNC WS support $vnc_ws"
4622 if test -n "$sparc_cpu"; then
4623 echo "Target Sparc Arch $sparc_cpu"
4625 echo "xen support $xen"
4626 echo "brlapi support $brlapi"
4627 echo "bluez support $bluez"
4628 echo "Documentation $docs"
4629 echo "GUEST_BASE $guest_base"
4631 echo "vde support $vde"
4632 echo "netmap support $netmap"
4633 echo "Linux AIO support $linux_aio"
4634 echo "ATTR/XATTR support $attr"
4635 echo "Install blobs $blobs"
4636 echo "KVM support $kvm"
4637 echo "RDMA support $rdma"
4638 echo "TCG interpreter $tcg_interpreter"
4639 echo "fdt support $fdt"
4640 echo "preadv support $preadv"
4641 echo "fdatasync $fdatasync"
4642 echo "madvise $madvise"
4643 echo "posix_madvise $posix_madvise"
4644 echo "sigev_thread_id $sigev_thread_id"
4645 echo "uuid support $uuid"
4646 echo "libcap-ng support $cap_ng"
4647 echo "vhost-net support $vhost_net"
4648 echo "vhost-scsi support $vhost_scsi"
4649 echo "Trace backends $trace_backends"
4650 if test "$trace_backend" = "simple"; then
4651 echo "Trace output file $trace_file-<pid>"
4653 if test "$spice" = "yes"; then
4654 echo "spice support $spice ($spice_protocol_version/$spice_server_version)"
4656 echo "spice support $spice"
4658 echo "rbd support $rbd"
4659 echo "xfsctl support $xfs"
4660 echo "nss used $smartcard_nss"
4661 echo "libusb $libusb"
4662 echo "usb net redir $usb_redir"
4663 echo "EFence support $efence"
4664 echo "GLX support $glx"
4665 echo "libiscsi support $libiscsi"
4666 echo "libnfs support $libnfs"
4667 echo "build guest agent $guest_agent"
4668 echo "QGA VSS support $guest_agent_with_vss"
4669 echo "seccomp support $seccomp"
4670 echo "coroutine backend $coroutine"
4671 echo "coroutine pool $coroutine_pool"
4672 echo "GlusterFS support $glusterfs"
4673 echo "Archipelago support $archipelago"
4674 echo "gcov $gcov_tool"
4675 echo "gcov enabled $gcov"
4676 echo "TPM support $tpm"
4677 echo "libssh2 support $libssh2"
4678 echo "TPM passthrough $tpm_passthrough"
4679 echo "QOM debugging $qom_cast_debug"
4681 echo "Quorum $quorum"
4682 echo "lzo support $lzo"
4683 echo "snappy support $snappy"
4684 echo "NUMA host support $numa"
4686 echo "HAX support $hax"
4687 echo "YaGL support $yagl"
4688 echo "YaGL stats $yagl_stats"
4689 echo "OpenGL support $opengl"
4690 echo "VIGS support $vigs"
4693 echo "TIZEN-maru support $maru"
4694 echo "TIZEN-maru Java UI support $java_ui"
4695 echo "TIZEN-maru shared framebuffer support $shm"
4696 echo "TIZEN-maru libav support $libav"
4697 echo "TIZEN-maru libpng support $libpng"
4698 echo "TIZEN-maru DXVA2 support $dxva2"
4699 echo "TIZEN-maru vaapi support $vaapi"
4700 echo "TIZEN-maru libtizenusb support $libtizenusb"
4701 echo "TIZEN-maru extension path $extension_path"
4704 if test "$sdl_too_old" = "yes"; then
4705 echo "-> Your SDL version is too old - please upgrade to have SDL support"
4708 config_host_mak="config-host.mak"
4710 echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
4712 echo "# Automatically generated by configure - do not modify" > $config_host_mak
4713 echo >> $config_host_mak
4715 echo all: >> $config_host_mak
4716 echo "prefix=$prefix" >> $config_host_mak
4717 echo "bindir=$bindir" >> $config_host_mak
4718 echo "libdir=$libdir" >> $config_host_mak
4719 echo "libexecdir=$libexecdir" >> $config_host_mak
4720 echo "includedir=$includedir" >> $config_host_mak
4721 echo "mandir=$mandir" >> $config_host_mak
4722 echo "sysconfdir=$sysconfdir" >> $config_host_mak
4723 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
4724 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
4725 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
4726 echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
4727 if test "$mingw32" = "no" ; then
4728 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
4730 echo "qemu_helperdir=$libexecdir" >> $config_host_mak
4731 echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
4732 echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
4733 echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
4734 echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
4736 echo "ARCH=$ARCH" >> $config_host_mak
4738 if test "$debug_tcg" = "yes" ; then
4739 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
4741 if test "$strip_opt" = "yes" ; then
4742 echo "STRIP=${strip}" >> $config_host_mak
4744 if test "$bigendian" = "yes" ; then
4745 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
4747 if test "$mingw32" = "yes" ; then
4748 echo "CONFIG_WIN32=y" >> $config_host_mak
4749 rc_version=`cat $source_path/VERSION`
4750 version_major=${rc_version%%.*}
4751 rc_version=${rc_version#*.}
4752 version_minor=${rc_version%%.*}
4753 rc_version=${rc_version#*.}
4754 version_subminor=${rc_version%%.*}
4756 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
4757 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
4758 if test "$guest_agent_with_vss" = "yes" ; then
4759 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
4760 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
4763 echo "CONFIG_POSIX=y" >> $config_host_mak
4766 if test "$linux" = "yes" ; then
4767 echo "CONFIG_LINUX=y" >> $config_host_mak
4770 if test "$darwin" = "yes" ; then
4771 echo "CONFIG_DARWIN=y" >> $config_host_mak
4774 if test "$aix" = "yes" ; then
4775 echo "CONFIG_AIX=y" >> $config_host_mak
4778 if test "$solaris" = "yes" ; then
4779 echo "CONFIG_SOLARIS=y" >> $config_host_mak
4780 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
4781 if test "$needs_libsunmath" = "yes" ; then
4782 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
4785 if test "$haiku" = "yes" ; then
4786 echo "CONFIG_HAIKU=y" >> $config_host_mak
4788 if test "$static" = "yes" ; then
4789 echo "CONFIG_STATIC=y" >> $config_host_mak
4791 if test "$profiler" = "yes" ; then
4792 echo "CONFIG_PROFILER=y" >> $config_host_mak
4794 if test "$slirp" = "yes" ; then
4795 echo "CONFIG_SLIRP=y" >> $config_host_mak
4796 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
4798 if test "$vde" = "yes" ; then
4799 echo "CONFIG_VDE=y" >> $config_host_mak
4801 if test "$netmap" = "yes" ; then
4802 echo "CONFIG_NETMAP=y" >> $config_host_mak
4804 if test "$l2tpv3" = "yes" ; then
4805 echo "CONFIG_L2TPV3=y" >> $config_host_mak
4807 if test "$cap_ng" = "yes" ; then
4808 echo "CONFIG_LIBCAP=y" >> $config_host_mak
4810 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
4811 for drv in $audio_drv_list; do
4812 def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
4813 echo "$def=y" >> $config_host_mak
4814 if test "$drv" = "fmod"; then
4815 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
4818 if test "$audio_pt_int" = "yes" ; then
4819 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
4821 if test "$audio_win_int" = "yes" ; then
4822 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
4824 echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
4825 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
4826 if test "$vnc" = "yes" ; then
4827 echo "CONFIG_VNC=y" >> $config_host_mak
4829 if test "$vnc_tls" = "yes" ; then
4830 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
4832 if test "$vnc_sasl" = "yes" ; then
4833 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
4835 if test "$vnc_jpeg" = "yes" ; then
4836 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
4838 if test "$vnc_png" = "yes" ; then
4839 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
4841 if test "$vnc_ws" = "yes" ; then
4842 echo "CONFIG_VNC_WS=y" >> $config_host_mak
4843 echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
4845 if test "$fnmatch" = "yes" ; then
4846 echo "CONFIG_FNMATCH=y" >> $config_host_mak
4848 if test "$uuid" = "yes" ; then
4849 echo "CONFIG_UUID=y" >> $config_host_mak
4851 if test "$xfs" = "yes" ; then
4852 echo "CONFIG_XFS=y" >> $config_host_mak
4854 qemu_version=`head $source_path/VERSION`
4855 echo "VERSION=$qemu_version" >>$config_host_mak
4856 echo "PKGVERSION=$pkgversion" >>$config_host_mak
4857 echo "SRC_PATH=$source_path" >> $config_host_mak
4858 echo "TARGET_DIRS=$target_list" >> $config_host_mak
4859 if [ "$docs" = "yes" ] ; then
4860 echo "BUILD_DOCS=yes" >> $config_host_mak
4862 if test "$modules" = "yes"; then
4863 # $shacmd can generate a hash started with digit, which the compiler doesn't
4864 # like as an symbol. So prefix it with an underscore
4865 echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak
4866 echo "CONFIG_MODULES=y" >> $config_host_mak
4868 if test "$sdl" = "yes" ; then
4869 echo "CONFIG_SDL=y" >> $config_host_mak
4870 echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
4871 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
4873 if test "$cocoa" = "yes" ; then
4874 echo "CONFIG_COCOA=y" >> $config_host_mak
4876 if test "$curses" = "yes" ; then
4877 echo "CONFIG_CURSES=y" >> $config_host_mak
4879 if test "$utimens" = "yes" ; then
4880 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
4882 if test "$pipe2" = "yes" ; then
4883 echo "CONFIG_PIPE2=y" >> $config_host_mak
4885 if test "$accept4" = "yes" ; then
4886 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
4888 if test "$splice" = "yes" ; then
4889 echo "CONFIG_SPLICE=y" >> $config_host_mak
4891 if test "$eventfd" = "yes" ; then
4892 echo "CONFIG_EVENTFD=y" >> $config_host_mak
4894 if test "$fallocate" = "yes" ; then
4895 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
4897 if test "$fallocate_punch_hole" = "yes" ; then
4898 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
4900 if test "$posix_fallocate" = "yes" ; then
4901 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
4903 if test "$sync_file_range" = "yes" ; then
4904 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
4906 if test "$fiemap" = "yes" ; then
4907 echo "CONFIG_FIEMAP=y" >> $config_host_mak
4909 if test "$dup3" = "yes" ; then
4910 echo "CONFIG_DUP3=y" >> $config_host_mak
4912 if test "$ppoll" = "yes" ; then
4913 echo "CONFIG_PPOLL=y" >> $config_host_mak
4915 if test "$prctl_pr_set_timerslack" = "yes" ; then
4916 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
4918 if test "$epoll" = "yes" ; then
4919 echo "CONFIG_EPOLL=y" >> $config_host_mak
4921 if test "$epoll_create1" = "yes" ; then
4922 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
4924 if test "$epoll_pwait" = "yes" ; then
4925 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
4927 if test "$sendfile" = "yes" ; then
4928 echo "CONFIG_SENDFILE=y" >> $config_host_mak
4930 if test "$timerfd" = "yes" ; then
4931 echo "CONFIG_TIMERFD=y" >> $config_host_mak
4933 if test "$setns" = "yes" ; then
4934 echo "CONFIG_SETNS=y" >> $config_host_mak
4936 if test "$inotify" = "yes" ; then
4937 echo "CONFIG_INOTIFY=y" >> $config_host_mak
4939 if test "$inotify1" = "yes" ; then
4940 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
4942 if test "$byteswap_h" = "yes" ; then
4943 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
4945 if test "$bswap_h" = "yes" ; then
4946 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
4948 if test "$curl" = "yes" ; then
4949 echo "CONFIG_CURL=m" >> $config_host_mak
4950 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
4951 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
4953 if test "$brlapi" = "yes" ; then
4954 echo "CONFIG_BRLAPI=y" >> $config_host_mak
4956 if test "$bluez" = "yes" ; then
4957 echo "CONFIG_BLUEZ=y" >> $config_host_mak
4958 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
4960 if test "glib_subprocess" = "yes" ; then
4961 echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak
4963 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
4964 if test "$gtk" = "yes" ; then
4965 echo "CONFIG_GTK=y" >> $config_host_mak
4966 echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
4967 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
4969 if test "$vte" = "yes" ; then
4970 echo "CONFIG_VTE=y" >> $config_host_mak
4971 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
4973 if test "$qt" = "yes" ; then
4974 echo "CONFIG_QT=y" >> $config_host_mak
4975 echo "QT_CFLAGS=$qt_cflags" >> $config_host_mak
4977 if test "$xen" = "yes" ; then
4978 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
4979 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
4981 if test "$linux_aio" = "yes" ; then
4982 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
4984 if test "$attr" = "yes" ; then
4985 echo "CONFIG_ATTR=y" >> $config_host_mak
4987 if test "$libattr" = "yes" ; then
4988 echo "CONFIG_LIBATTR=y" >> $config_host_mak
4990 if test "$virtfs" = "yes" ; then
4991 echo "CONFIG_VIRTFS=y" >> $config_host_mak
4993 if test "$vhost_scsi" = "yes" ; then
4994 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
4996 if test "$vhost_net" = "yes" ; then
4997 echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
4999 if test "$blobs" = "yes" ; then
5000 echo "INSTALL_BLOBS=yes" >> $config_host_mak
5002 if test "$iovec" = "yes" ; then
5003 echo "CONFIG_IOVEC=y" >> $config_host_mak
5005 if test "$preadv" = "yes" ; then
5006 echo "CONFIG_PREADV=y" >> $config_host_mak
5008 if test "$fdt" = "yes" ; then
5009 echo "CONFIG_FDT=y" >> $config_host_mak
5011 if test "$signalfd" = "yes" ; then
5012 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
5014 if test "$tcg_interpreter" = "yes" ; then
5015 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
5017 if test "$fdatasync" = "yes" ; then
5018 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
5020 if test "$madvise" = "yes" ; then
5021 echo "CONFIG_MADVISE=y" >> $config_host_mak
5023 if test "$posix_madvise" = "yes" ; then
5024 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
5026 if test "$sigev_thread_id" = "yes" ; then
5027 echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
5030 if test "$spice" = "yes" ; then
5031 echo "CONFIG_SPICE=y" >> $config_host_mak
5034 if test "$efence" = "yes" ; then
5035 echo "CONFIG_EFENCE=y" >> $config_host_mak
5038 if test "$yagl" = "yes" ; then
5039 echo "CONFIG_YAGL=y" >> $config_host_mak
5040 if test "$linux" = "yes" ; then
5041 LIBS="-lGLU -ldl $LIBS"
5042 elif test "$mingw32" = "yes" ; then
5043 LIBS="-lopengl32 -lglu32 $LIBS"
5044 elif test "$darwin" = "yes" ; then
5045 LIBS="-framework OpenGL -framework AGL -framework GLUT $LIBS"
5047 echo "ERROR: YaGL is not available on $targetos"
5052 if test "$yagl_stats" = "yes" ; then
5053 echo "CONFIG_YAGL_STATS=y" >> $config_host_mak
5056 if test "$vigs" = "yes" ; then
5057 echo "CONFIG_VIGS=y" >> $config_host_mak
5060 if test "$smartcard" = "yes" ; then
5061 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
5064 if test "$smartcard_nss" = "yes" ; then
5065 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
5066 echo "NSS_LIBS=$nss_libs" >> $config_host_mak
5067 echo "NSS_CFLAGS=$nss_cflags" >> $config_host_mak
5070 if test "$libusb" = "yes" ; then
5071 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
5074 if test "$usb_redir" = "yes" ; then
5075 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
5078 if test "$glx" = "yes" ; then
5079 echo "CONFIG_GLX=y" >> $config_host_mak
5080 echo "GLX_LIBS=$glx_libs" >> $config_host_mak
5083 if test "$lzo" = "yes" ; then
5084 echo "CONFIG_LZO=y" >> $config_host_mak
5087 if test "$snappy" = "yes" ; then
5088 echo "CONFIG_SNAPPY=y" >> $config_host_mak
5091 if test "$libiscsi" = "yes" ; then
5092 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
5093 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
5094 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
5097 if test "$libnfs" = "yes" ; then
5098 echo "CONFIG_LIBNFS=y" >> $config_host_mak
5101 if test "$seccomp" = "yes"; then
5102 echo "CONFIG_SECCOMP=y" >> $config_host_mak
5105 # XXX: suppress that
5106 if [ "$bsd" = "yes" ] ; then
5107 echo "CONFIG_BSD=y" >> $config_host_mak
5110 if test "$zero_malloc" = "yes" ; then
5111 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
5113 if test "$qom_cast_debug" = "yes" ; then
5114 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
5116 if test "$rbd" = "yes" ; then
5117 echo "CONFIG_RBD=m" >> $config_host_mak
5118 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
5119 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
5122 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
5123 if test "$coroutine_pool" = "yes" ; then
5124 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
5126 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
5129 if test "$open_by_handle_at" = "yes" ; then
5130 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
5133 if test "$linux_magic_h" = "yes" ; then
5134 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
5137 if test "$pragma_diagnostic_available" = "yes" ; then
5138 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
5141 if test "$valgrind_h" = "yes" ; then
5142 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
5145 if test "$has_environ" = "yes" ; then
5146 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
5149 if test "$cpuid_h" = "yes" ; then
5150 echo "CONFIG_CPUID_H=y" >> $config_host_mak
5153 if test "$int128" = "yes" ; then
5154 echo "CONFIG_INT128=y" >> $config_host_mak
5157 if test "$getauxval" = "yes" ; then
5158 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
5161 if test "$glusterfs" = "yes" ; then
5162 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
5163 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
5164 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
5167 if test "$glusterfs_discard" = "yes" ; then
5168 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
5171 if test "$glusterfs_zerofill" = "yes" ; then
5172 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
5175 if test "$archipelago" = "yes" ; then
5176 echo "CONFIG_ARCHIPELAGO=m" >> $config_host_mak
5177 echo "ARCHIPELAGO_LIBS=$archipelago_libs" >> $config_host_mak
5180 if test "$libssh2" = "yes" ; then
5181 echo "CONFIG_LIBSSH2=m" >> $config_host_mak
5182 echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
5183 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
5186 if test "$quorum" = "yes" ; then
5187 echo "CONFIG_QUORUM=y" >> $config_host_mak
5190 if test "$vhdx" = "yes" ; then
5191 echo "CONFIG_VHDX=y" >> $config_host_mak
5195 if test "$libusb" = "yes"; then
5196 echo "HOST_USB=libusb legacy" >> $config_host_mak
5197 elif test "$libtizenusb" = "yes"; then
5198 echo "HOST_USB=tizenusb legacy" >> $config_host_mak
5200 echo "HOST_USB=stub" >> $config_host_mak
5204 if test "$maru" = "yes" ; then
5205 echo "CONFIG_MARU=y" >> $config_host_mak
5207 # java ui is deprecated
5208 if test "$java_ui" = "yes" ; then
5209 if test "$shm" = "yes" || test "$sdl" = "yes" ; then
5210 echo "CONFIG_JAVA_UI=y" >> $config_host_mak
5212 error_exit "Java UI is only available with SDL or SHM"
5215 if test "$shm" = "yes" ; then
5216 if test "$java_ui" = "yes" ; then
5217 echo "CONFIG_USE_SHM=y" >> $config_host_mak
5219 error_exit "SHM is only available whith Java UI"
5222 if test "$libav" = "yes" ; then
5223 echo "CONFIG_LIBAV=y" >> $config_host_mak
5224 echo "LIBAV_CFLAGS=$libav_cflags" >> $config_host_mak
5225 echo "LIBAV_LIBS=$libav_libs" >> $config_host_mak
5227 if test "$libpng" = "yes" ; then
5228 echo "CONFIG_PNG=y" >> $config_host_mak
5229 echo "LIBPNG_CFLAGS=$libpng_cflags" >> $config_host_mak
5231 if test "$dxva2" = "yes" ; then
5232 echo "CONFIG_DXVA2=y" >> $config_host_mak
5234 if test "$vaapi" = "yes" ; then
5235 echo "CONFIG_VAAPI=y" >> $config_host_mak
5236 echo "LIBVA_CFLAGS=$libva_cflags $libva_x11_cflags" >> $config_host_mak
5238 if test "$libtizenusb" = "yes" ; then
5239 echo "CONFIG_TIZENUSB=y" >> $config_host_mak
5241 if [ ! -z "$extension_path" ] ; then
5242 echo "CONFIG_EXTENSION_PATH=$extension_path" >> $config_host_mak
5245 # TPM passthrough support?
5246 if test "$tpm" = "yes"; then
5247 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
5248 if test "$tpm_passthrough" = "yes"; then
5249 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
5253 echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
5254 if have_backend "nop"; then
5255 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
5257 if have_backend "simple"; then
5258 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
5259 # Set the appropriate trace file.
5260 trace_file="\"$trace_file-\" FMT_pid"
5262 if have_backend "stderr"; then
5263 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
5265 if have_backend "ust"; then
5266 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
5268 if have_backend "dtrace"; then
5269 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
5270 if test "$trace_backend_stap" = "yes" ; then
5271 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
5274 if have_backend "ftrace"; then
5275 if test "$linux" = "yes" ; then
5276 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
5278 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
5281 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
5283 if test "$rdma" = "yes" ; then
5284 echo "CONFIG_RDMA=y" >> $config_host_mak
5287 # Hold two types of flag:
5288 # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
5289 # a thread we have a handle to
5290 # CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
5292 if test "$pthread_setname_np" = "yes" ; then
5293 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
5294 echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
5297 if test "$tcg_interpreter" = "yes"; then
5298 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
5299 elif test "$ARCH" = "sparc64" ; then
5300 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
5301 elif test "$ARCH" = "s390x" ; then
5302 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
5303 elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
5304 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
5305 elif test "$ARCH" = "ppc64" ; then
5306 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
5308 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
5310 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
5312 echo "TOOLS=$tools" >> $config_host_mak
5313 echo "ROMS=$roms" >> $config_host_mak
5314 echo "MAKE=$make" >> $config_host_mak
5315 echo "INSTALL=$install" >> $config_host_mak
5316 echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
5317 echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
5318 if test -n "$libtool"; then
5319 echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
5320 echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
5322 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
5323 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
5325 echo "PYTHON=$python" >> $config_host_mak
5326 echo "CC=$cc" >> $config_host_mak
5327 if $iasl -h > /dev/null 2>&1; then
5328 echo "IASL=$iasl" >> $config_host_mak
5330 echo "CC_I386=$cc_i386" >> $config_host_mak
5331 echo "HOST_CC=$host_cc" >> $config_host_mak
5332 echo "CXX=$cxx" >> $config_host_mak
5333 echo "OBJCC=$objcc" >> $config_host_mak
5334 echo "AR=$ar" >> $config_host_mak
5335 echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
5336 echo "AS=$as" >> $config_host_mak
5337 echo "CPP=$cpp" >> $config_host_mak
5338 echo "OBJCOPY=$objcopy" >> $config_host_mak
5339 echo "LD=$ld" >> $config_host_mak
5340 echo "NM=$nm" >> $config_host_mak
5341 echo "WINDRES=$windres" >> $config_host_mak
5342 echo "LIBTOOL=$libtool" >> $config_host_mak
5343 echo "CFLAGS=$CFLAGS" >> $config_host_mak
5344 echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
5345 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
5346 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
5347 if test "$sparse" = "yes" ; then
5348 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
5349 echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
5350 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
5351 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
5353 if test "$cross_prefix" != ""; then
5354 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
5356 echo "AUTOCONF_HOST := " >> $config_host_mak
5358 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
5359 echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
5360 echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
5361 echo "LIBS+=$LIBS" >> $config_host_mak
5362 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
5363 echo "EXESUF=$EXESUF" >> $config_host_mak
5364 echo "DSOSUF=$DSOSUF" >> $config_host_mak
5365 echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
5366 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
5367 echo "POD2MAN=$POD2MAN" >> $config_host_mak
5368 echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
5369 if test "$gcov" = "yes" ; then
5370 echo "CONFIG_GCOV=y" >> $config_host_mak
5371 echo "GCOV=$gcov_tool" >> $config_host_mak
5374 # use included Linux headers
5375 if test "$linux" = "yes" ; then
5376 mkdir -p linux-headers
5394 # For most CPUs the kernel architecture name and QEMU CPU name match.
5398 # For non-KVM architectures we will not have asm headers
5399 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
5400 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
5404 for target in $target_list; do
5405 target_dir="$target"
5406 config_target_mak=$target_dir/config-target.mak
5407 target_name=`echo $target | cut -d '-' -f 1`
5408 target_bigendian="no"
5410 case "$target_name" in
5411 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
5412 target_bigendian=yes
5416 target_user_only="no"
5417 target_linux_user="no"
5418 target_bsd_user="no"
5420 ${target_name}-softmmu)
5421 target_softmmu="yes"
5423 ${target_name}-linux-user)
5424 if test "$linux" != "yes" ; then
5425 error_exit "Target '$target' is only available on a Linux host"
5427 target_user_only="yes"
5428 target_linux_user="yes"
5430 ${target_name}-bsd-user)
5431 if test "$bsd" != "yes" ; then
5432 error_exit "Target '$target' is only available on a BSD host"
5434 target_user_only="yes"
5435 target_bsd_user="yes"
5438 error_exit "Target '$target' not recognised"
5443 mkdir -p $target_dir
5444 echo "# Automatically generated by configure - do not modify" > $config_target_mak
5447 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
5450 TARGET_ARCH="$target_name"
5454 case "$target_name" in
5458 TARGET_BASE_ARCH=i386
5465 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
5468 TARGET_BASE_ARCH=arm
5470 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
5478 gdb_xml_files="cf-core.xml cf-fp.xml"
5480 microblaze|microblazeel)
5481 TARGET_ARCH=microblaze
5486 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
5490 TARGET_BASE_ARCH=mips
5491 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
5492 echo "TARGET_ABI32=y" >> $config_target_mak
5496 TARGET_BASE_ARCH=mips
5497 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
5504 TARGET_ARCH=openrisc
5505 TARGET_BASE_ARCH=openrisc
5508 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
5511 TARGET_BASE_ARCH=ppc
5513 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
5516 TARGET_BASE_ARCH=ppc
5518 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
5522 TARGET_BASE_ARCH=ppc
5524 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
5528 TARGET_BASE_ARCH=ppc
5530 echo "TARGET_ABI32=y" >> $config_target_mak
5531 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
5540 TARGET_BASE_ARCH=sparc
5544 TARGET_BASE_ARCH=sparc
5545 TARGET_ABI_DIR=sparc
5546 echo "TARGET_ABI32=y" >> $config_target_mak
5549 gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml"
5557 error_exit "Unsupported target CPU"
5560 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
5561 if [ "$TARGET_BASE_ARCH" = "" ]; then
5562 TARGET_BASE_ARCH=$TARGET_ARCH
5565 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
5568 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
5571 target_arch_name="`upper $TARGET_ARCH`"
5572 echo "TARGET_$target_arch_name=y" >> $config_target_mak
5573 echo "TARGET_NAME=$target_name" >> $config_target_mak
5574 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
5575 if [ "$TARGET_ABI_DIR" = "" ]; then
5576 TARGET_ABI_DIR=$TARGET_ARCH
5578 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
5579 if [ "$HOST_VARIANT_DIR" != "" ]; then
5580 echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
5582 case "$target_name" in
5584 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
5585 echo "CONFIG_XEN=y" >> $config_target_mak
5586 if test "$xen_pci_passthrough" = yes; then
5587 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
5593 case "$target_name" in
5594 aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x|mipsel|mips)
5595 # Make sure the target and host cpus are compatible
5596 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
5597 \( "$target_name" = "$cpu" -o \
5598 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
5599 \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
5600 \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
5601 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
5602 \( "$target_name" = "mipsel" -a "$cpu" = "mips" \) -o \
5603 \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
5604 \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then
5605 echo "CONFIG_KVM=y" >> $config_target_mak
5606 if test "$vhost_net" = "yes" ; then
5607 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
5611 case "$target_name" in
5613 echo "CONFIG_HAVE_GET_MEMORY_MAPPING=y" >> $config_target_mak
5615 if test "$hax" = "yes" ; then
5616 if test "$target_softmmu" = "yes" ; then
5617 case "$target_name" in
5619 echo "CONFIG_HAX=y" >> $config_target_mak
5622 echo "CONFIG_NO_HAX=y" >> $config_target_mak
5626 echo "CONFIG_NO_HAX=y" >> $config_target_mak
5629 if test "$target_bigendian" = "yes" ; then
5630 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
5632 if test "$target_softmmu" = "yes" ; then
5633 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
5635 if test "$target_user_only" = "yes" ; then
5636 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
5637 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
5639 if test "$target_linux_user" = "yes" ; then
5640 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
5643 if test ! -z "$gdb_xml_files" ; then
5644 for x in $gdb_xml_files; do
5645 list="$list $source_path/gdb-xml/$x"
5647 echo "TARGET_XML_FILES=$list" >> $config_target_mak
5650 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
5651 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
5653 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
5654 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
5656 if test "$target_bsd_user" = "yes" ; then
5657 echo "CONFIG_BSD_USER=y" >> $config_target_mak
5660 # generate QEMU_CFLAGS/LDFLAGS for targets
5665 if test "$tcg_interpreter" = "yes"; then
5666 includes="-I\$(SRC_PATH)/tcg/tci $includes"
5667 elif test "$ARCH" = "sparc64" ; then
5668 includes="-I\$(SRC_PATH)/tcg/sparc $includes"
5669 elif test "$ARCH" = "s390x" ; then
5670 includes="-I\$(SRC_PATH)/tcg/s390 $includes"
5671 elif test "$ARCH" = "x86_64" ; then
5672 includes="-I\$(SRC_PATH)/tcg/i386 $includes"
5674 includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
5676 includes="-I\$(SRC_PATH)/tcg $includes"
5678 if test "$linux" = "yes" ; then
5679 includes="-I\$(SRC_PATH)/linux-headers $includes"
5682 if test "$target_user_only" = "yes" ; then
5683 libdis_config_mak=libdis-user/config.mak
5685 libdis_config_mak=libdis/config.mak
5688 if test "$efence" = "yes" ; then
5689 echo "CONFIG_BUILD_WITH_EFENCE=y" >> $config_target_mak
5690 echo "LIBS+=-lefence" >> $config_target_mak
5693 if test "$yagl" = "yes" ; then
5694 echo "CONFIG_BUILD_YAGL=y" >> $config_target_mak
5697 if test "$vigs" = "yes" ; then
5698 echo "CONFIG_BUILD_VIGS=y" >> $config_target_mak
5701 for i in $ARCH $TARGET_BASE_ARCH ; do
5704 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
5705 echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak
5708 if test -n "${cxx}"; then
5709 echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
5710 echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
5714 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
5715 echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak
5716 if test -n "${cxx}"; then
5717 echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
5718 echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
5722 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
5723 echo "CONFIG_CRIS_DIS=y" >> config-all-disas.mak
5726 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
5727 echo "CONFIG_HPPA_DIS=y" >> config-all-disas.mak
5730 echo "CONFIG_I386_DIS=y" >> $config_target_mak
5731 echo "CONFIG_I386_DIS=y" >> config-all-disas.mak
5734 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
5735 echo "CONFIG_IA64_DIS=y" >> config-all-disas.mak
5738 echo "CONFIG_LM32_DIS=y" >> $config_target_mak
5739 echo "CONFIG_LM32_DIS=y" >> config-all-disas.mak
5742 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
5743 echo "CONFIG_M68K_DIS=y" >> config-all-disas.mak
5746 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
5747 echo "CONFIG_MICROBLAZE_DIS=y" >> config-all-disas.mak
5750 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
5751 echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak
5754 echo "CONFIG_MOXIE_DIS=y" >> $config_target_mak
5755 echo "CONFIG_MOXIE_DIS=y" >> config-all-disas.mak
5758 echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak
5759 echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak
5762 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
5763 echo "CONFIG_PPC_DIS=y" >> config-all-disas.mak
5766 echo "CONFIG_S390_DIS=y" >> $config_target_mak
5767 echo "CONFIG_S390_DIS=y" >> config-all-disas.mak
5770 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
5771 echo "CONFIG_SH4_DIS=y" >> config-all-disas.mak
5774 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
5775 echo "CONFIG_SPARC_DIS=y" >> config-all-disas.mak
5778 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
5779 echo "CONFIG_XTENSA_DIS=y" >> config-all-disas.mak
5783 if test "$tcg_interpreter" = "yes" ; then
5784 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
5785 echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak
5790 # Ensure there's only a single GP
5791 cflags="-msmall-data $cflags"
5795 if test "$target_softmmu" = "yes" ; then
5796 case "$TARGET_BASE_ARCH" in
5798 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
5801 cflags="-DHAS_AUDIO $cflags"
5804 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
5809 if test "$gprof" = "yes" ; then
5810 echo "TARGET_GPROF=yes" >> $config_target_mak
5811 if test "$target_linux_user" = "yes" ; then
5813 ldflags="-p $ldflags"
5815 if test "$target_softmmu" = "yes" ; then
5816 ldflags="-p $ldflags"
5817 echo "GPROF_CFLAGS=-p" >> $config_target_mak
5821 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
5822 ldflags="$ldflags $textseg_ldflags"
5825 echo "LDFLAGS+=$ldflags" >> $config_target_mak
5826 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
5828 done # for target in $targets
5830 if [ "$pixman" = "internal" ]; then
5831 echo "config-host.h: subdir-pixman" >> $config_host_mak
5834 if test "$rdma" = "yes" ; then
5835 echo "CONFIG_RDMA=y" >> $config_host_mak
5838 if [ "$dtc_internal" = "yes" ]; then
5839 echo "config-host.h: subdir-dtc" >> $config_host_mak
5842 if test "$numa" = "yes"; then
5843 echo "CONFIG_NUMA=y" >> $config_host_mak
5846 # build tree in object directory in case the source is not in the current directory
5847 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
5849 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
5850 DIRS="$DIRS roms/seabios roms/vgabios"
5851 DIRS="$DIRS qapi-generated"
5852 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
5853 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
5854 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
5855 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
5856 FILES="$FILES pc-bios/spapr-rtas/Makefile"
5857 FILES="$FILES pc-bios/s390-ccw/Makefile"
5858 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
5859 FILES="$FILES pc-bios/qemu-icon.bmp"
5861 $source_path/pc-bios/*.bin \
5862 $source_path/pc-bios/*.aml \
5863 $source_path/pc-bios/*.rom \
5864 $source_path/pc-bios/*.dtb \
5865 $source_path/pc-bios/*.img \
5866 $source_path/pc-bios/openbios-* \
5867 $source_path/pc-bios/u-boot.* \
5868 $source_path/pc-bios/palcode-*
5870 FILES="$FILES pc-bios/`basename $bios_file`"
5872 for test_file in `find $source_path/tests/acpi-test-data -type f`
5874 FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`"
5877 for f in $FILES ; do
5878 if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
5879 symlink "$source_path/$f" "$f"
5883 # temporary config to build submodules
5884 for rom in seabios vgabios ; do
5885 config_mak=roms/$rom/config.mak
5886 echo "# Automatically generated by configure - do not modify" > $config_mak
5887 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
5888 echo "AS=$as" >> $config_mak
5889 echo "CC=$cc" >> $config_mak
5890 echo "BCC=bcc" >> $config_mak
5891 echo "CPP=$cpp" >> $config_mak
5892 echo "OBJCOPY=objcopy" >> $config_mak
5893 echo "IASL=$iasl" >> $config_mak
5894 echo "LD=$ld" >> $config_mak
5897 # set up qemu-iotests in this build directory
5898 iotests_common_env="tests/qemu-iotests/common.env"
5899 iotests_check="tests/qemu-iotests/check"
5901 echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
5902 echo >> "$iotests_common_env"
5903 echo "export PYTHON='$python'" >> "$iotests_common_env"
5905 if [ ! -e "$iotests_check" ]; then
5906 symlink "$source_path/$iotests_check" "$iotests_check"
5909 # Save the configure command line for later reuse.
5910 cat <<EOD >config.status
5912 # Generated by configure.
5913 # Run this file to recreate the current configuration.
5914 # Compiler output produced by configure, useful for debugging
5915 # configure, is in config.log if it exists.
5917 printf "exec" >>config.status
5918 printf " '%s'" "$0" "$@" >>config.status
5919 echo >>config.status
5920 chmod +x config.status