Merge remote-tracking branch 'qemu/master'
[qemu/ar7.git] / configure
blobc26555280a46b2b6d172eda247d06c7d70f16780
1 #!/bin/sh
3 # qemu configure script (c) 2003 Fabrice Bellard
6 # Unset some variables known to interfere with behavior of common tools,
7 # just as autoconf does.
8 CLICOLOR_FORCE= GREP_OPTIONS=
9 unset CLICOLOR_FORCE GREP_OPTIONS
11 # Don't allow CCACHE, if present, to use cached results of compile tests!
12 export CCACHE_RECACHE=yes
14 # Temporary directory used for files created while
15 # configure runs. Since it is in the build directory
16 # we can safely blow away any previous version of it
17 # (and we need not jump through hoops to try to delete
18 # it when configure exits.)
19 TMPDIR1="config-temp"
20 rm -rf "${TMPDIR1}"
21 mkdir -p "${TMPDIR1}"
22 if [ $? -ne 0 ]; then
23 echo "ERROR: failed to create temporary directory"
24 exit 1
27 TMPB="qemu-conf"
28 TMPC="${TMPDIR1}/${TMPB}.c"
29 TMPO="${TMPDIR1}/${TMPB}.o"
30 TMPCXX="${TMPDIR1}/${TMPB}.cxx"
31 TMPE="${TMPDIR1}/${TMPB}.exe"
32 TMPMO="${TMPDIR1}/${TMPB}.mo"
34 rm -f config.log
36 # Print a helpful header at the top of config.log
37 echo "# QEMU configure log $(date)" >> config.log
38 printf "# Configured with:" >> config.log
39 printf " '%s'" "$0" "$@" >> config.log
40 echo >> config.log
41 echo "#" >> config.log
43 error_exit() {
44 echo
45 echo "ERROR: $1"
46 while test -n "$2"; do
47 echo " $2"
48 shift
49 done
50 echo
51 exit 1
54 do_compiler() {
55 # Run the compiler, capturing its output to the log. First argument
56 # is compiler binary to execute.
57 local compiler="$1"
58 shift
59 echo $compiler "$@" >> config.log
60 $compiler "$@" >> config.log 2>&1 || return $?
61 # Test passed. If this is an --enable-werror build, rerun
62 # the test with -Werror and bail out if it fails. This
63 # makes warning-generating-errors in configure test code
64 # obvious to developers.
65 if test "$werror" != "yes"; then
66 return 0
68 # Don't bother rerunning the compile if we were already using -Werror
69 case "$*" in
70 *-Werror*)
71 return 0
73 esac
74 echo $compiler -Werror "$@" >> config.log
75 $compiler -Werror "$@" >> config.log 2>&1 && return $?
76 error_exit "configure test passed without -Werror but failed with -Werror." \
77 "This is probably a bug in the configure script. The failing command" \
78 "will be at the bottom of config.log." \
79 "You can run configure with --disable-werror to bypass this check."
82 do_cc() {
83 do_compiler "$cc" "$@"
86 do_cxx() {
87 do_compiler "$cxx" "$@"
90 update_cxxflags() {
91 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
92 # options which some versions of GCC's C++ compiler complain about
93 # because they only make sense for C programs.
94 QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS"
96 for arg in $QEMU_CFLAGS; do
97 case $arg in
98 -Wno-override-init|\
99 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
100 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
103 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
105 esac
106 done
109 compile_object() {
110 local_cflags="$1"
111 do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
114 compile_prog() {
115 local_cflags="$1"
116 local_ldflags="$2"
117 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
120 # symbolically link $1 to $2. Portable version of "ln -sf".
121 symlink() {
122 rm -rf "$2"
123 mkdir -p "$(dirname "$2")"
124 ln -s "$1" "$2"
127 # check whether a command is available to this shell (may be either an
128 # executable or a builtin)
129 has() {
130 type "$1" >/dev/null 2>&1
133 # search for an executable in PATH
134 path_of() {
135 local_command="$1"
136 local_ifs="$IFS"
137 local_dir=""
139 # pathname has a dir component?
140 if [ "${local_command#*/}" != "$local_command" ]; then
141 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
142 echo "$local_command"
143 return 0
146 if [ -z "$local_command" ]; then
147 return 1
150 IFS=:
151 for local_dir in $PATH; do
152 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
153 echo "$local_dir/$local_command"
154 IFS="${local_ifs:-$(printf ' \t\n')}"
155 return 0
157 done
158 # not found
159 IFS="${local_ifs:-$(printf ' \t\n')}"
160 return 1
163 have_backend () {
164 echo "$trace_backends" | grep "$1" >/dev/null
167 # default parameters
168 source_path=$(dirname "$0")
169 cpu=""
170 iasl="iasl"
171 interp_prefix="/usr/gnemul/qemu-%M"
172 static="no"
173 cross_prefix=""
174 audio_drv_list=""
175 block_drv_rw_whitelist=""
176 block_drv_ro_whitelist=""
177 host_cc="cc"
178 libs_softmmu=""
179 libs_tools=""
180 audio_pt_int=""
181 audio_win_int=""
182 cc_i386=i386-pc-linux-gnu-gcc
183 libs_qga=""
184 debug_info="yes"
185 stack_protector=""
187 # Don't accept a target_list environment variable.
188 unset target_list
190 # Default value for a variable defining feature "foo".
191 # * foo="no" feature will only be used if --enable-foo arg is given
192 # * foo="" feature will be searched for, and if found, will be used
193 # unless --disable-foo is given
194 # * foo="yes" this value will only be set by --enable-foo flag.
195 # feature will searched for,
196 # if not found, configure exits with error
198 # Always add --enable-foo and --disable-foo command line args.
199 # Distributions want to ensure that several features are compiled in, and it
200 # is impossible without a --enable-foo that exits if a feature is not found.
202 bluez=""
203 brlapi=""
204 curl=""
205 curses=""
206 docs=""
207 fdt=""
208 netmap="no"
209 pixman=""
210 sdl=""
211 sdlabi=""
212 virtfs=""
213 vnc="yes"
214 sparse="no"
215 vde=""
216 vnc_sasl=""
217 vnc_jpeg=""
218 vnc_png=""
219 xen=""
220 xen_ctrl_version=""
221 xen_pv_domain_build="no"
222 xen_pci_passthrough=""
223 linux_aio=""
224 cap_ng=""
225 attr=""
226 libattr=""
227 xfs=""
229 vhost_net="no"
230 vhost_scsi="no"
231 vhost_vsock="no"
232 kvm="no"
233 hax="no"
234 rdma=""
235 gprof="no"
236 debug_tcg="no"
237 debug="no"
238 fortify_source=""
239 strip_opt="yes"
240 tcg_interpreter="no"
241 bigendian="no"
242 mingw32="no"
243 gcov="no"
244 gcov_tool="gcov"
245 EXESUF=""
246 DSOSUF=".so"
247 LDFLAGS_SHARED="-shared"
248 modules="no"
249 prefix="/usr/local"
250 mandir="\${prefix}/share/man"
251 datadir="\${prefix}/share"
252 qemu_docdir="\${prefix}/share/doc/qemu"
253 bindir="\${prefix}/bin"
254 libdir="\${prefix}/lib"
255 libexecdir="\${prefix}/libexec"
256 includedir="\${prefix}/include"
257 sysconfdir="\${prefix}/etc"
258 local_statedir="\${prefix}/var"
259 confsuffix="/qemu"
260 slirp="yes"
261 oss_lib=""
262 bsd="no"
263 haiku="no"
264 linux="no"
265 solaris="no"
266 profiler="no"
267 cocoa="no"
268 softmmu="yes"
269 linux_user="no"
270 bsd_user="no"
271 aix="no"
272 blobs="yes"
273 pkgversion=""
274 pie=""
275 qom_cast_debug="yes"
276 trace_backends="log"
277 trace_file="trace"
278 spice=""
279 rbd=""
280 smartcard=""
281 libusb=""
282 usb_redir=""
283 opengl=""
284 opengl_dmabuf="no"
285 avx2_opt="no"
286 zlib="yes"
287 lzo=""
288 snappy=""
289 bzip2=""
290 guest_agent=""
291 guest_agent_with_vss="no"
292 guest_agent_ntddscsi="no"
293 guest_agent_msi=""
294 vss_win32_sdk=""
295 win_sdk="no"
296 want_tools="yes"
297 libiscsi=""
298 libnfs=""
299 coroutine=""
300 coroutine_pool=""
301 debug_stack_usage="no"
302 seccomp=""
303 glusterfs=""
304 glusterfs_xlator_opt="no"
305 glusterfs_discard="no"
306 glusterfs_fallocate="no"
307 glusterfs_zerofill="no"
308 gtk=""
309 gtkabi=""
310 gtk_gl="no"
311 tls_priority="NORMAL"
312 gnutls=""
313 gnutls_rnd=""
314 nettle=""
315 nettle_kdf="no"
316 gcrypt=""
317 gcrypt_hmac="no"
318 gcrypt_kdf="no"
319 vte=""
320 virglrenderer=""
321 tpm="yes"
322 libssh2=""
323 live_block_migration="yes"
324 numa=""
325 tcmalloc="no"
326 jemalloc="no"
327 replication="yes"
328 vxhs=""
330 supported_cpu="no"
331 supported_os="no"
332 bogus_os="no"
334 # parse CC options first
335 for opt do
336 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
337 case "$opt" in
338 --cross-prefix=*) cross_prefix="$optarg"
340 --cc=*) CC="$optarg"
342 --cxx=*) CXX="$optarg"
344 --source-path=*) source_path="$optarg"
346 --cpu=*) cpu="$optarg"
348 --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
349 EXTRA_CFLAGS="$optarg"
351 --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
352 EXTRA_CXXFLAGS="$optarg"
354 --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
355 EXTRA_LDFLAGS="$optarg"
357 --enable-debug-info) debug_info="yes"
359 --disable-debug-info) debug_info="no"
361 esac
362 done
363 # OS specific
364 # Using uname is really, really broken. Once we have the right set of checks
365 # we can eliminate its usage altogether.
367 # Preferred compiler:
368 # ${CC} (if set)
369 # ${cross_prefix}gcc (if cross-prefix specified)
370 # system compiler
371 if test -z "${CC}${cross_prefix}"; then
372 cc="$host_cc"
373 else
374 cc="${CC-${cross_prefix}gcc}"
377 if test -z "${CXX}${cross_prefix}"; then
378 cxx="c++"
379 else
380 cxx="${CXX-${cross_prefix}g++}"
383 ar="${AR-${cross_prefix}ar}"
384 as="${AS-${cross_prefix}as}"
385 ccas="${CCAS-$cc}"
386 cpp="${CPP-$cc -E}"
387 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
388 ld="${LD-${cross_prefix}ld}"
389 nm="${NM-${cross_prefix}nm}"
390 strip="${STRIP-${cross_prefix}strip}"
391 windres="${WINDRES-${cross_prefix}windres}"
392 pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
393 query_pkg_config() {
394 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
396 pkg_config=query_pkg_config
397 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
398 sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
400 # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
401 ARFLAGS="${ARFLAGS-rv}"
403 # default flags for all hosts
404 # We use -fwrapv to tell the compiler that we require a C dialect where
405 # left shift of signed integers is well defined and has the expected
406 # 2s-complement style results. (Both clang and gcc agree that it
407 # provides these semantics.)
408 QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
409 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
410 QEMU_CFLAGS="-Wmissing-format-attribute $QEMU_CFLAGS"
411 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
412 QEMU_CFLAGS="-Wno-unused-parameter $QEMU_CFLAGS"
413 QEMU_CFLAGS="-Wno-missing-field-initializers $QEMU_CFLAGS"
414 QEMU_CFLAGS="-Wno-sign-compare $QEMU_CFLAGS"
415 QEMU_CFLAGS="-Wno-override-init $QEMU_CFLAGS"
416 QEMU_CFLAGS="-Wno-error=format $QEMU_CFLAGS"
417 QEMU_CFLAGS="-Wno-error=format-extra-args $QEMU_CFLAGS"
418 QEMU_CFLAGS="-Wno-error=parentheses $QEMU_CFLAGS"
419 QEMU_CFLAGS="-Wextra $QEMU_CFLAGS"
420 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
421 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/accel/tcg -I\$(SRC_PATH)/include"
422 if test "$debug_info" = "yes"; then
423 CFLAGS="-g $CFLAGS"
424 LDFLAGS="-g $LDFLAGS"
427 # make source path absolute
428 source_path=$(cd "$source_path"; pwd)
430 cc_macros=$($cc $QEMU_CFLAGS -E -dD - </dev/null)
432 # running configure in the source tree?
433 # we know that's the case if configure is there.
434 if test -f "./configure"; then
435 pwd_is_source_path="y"
436 else
437 pwd_is_source_path="n"
440 check_define() {
441 rm -f $TMPC
442 cat > $TMPC <<EOF
443 #if !defined($1)
444 #error $1 not defined
445 #endif
446 int main(void) { return 0; }
448 compile_object
451 check_include() {
452 cat > $TMPC <<EOF
453 #include <$1>
454 int main(void) { return 0; }
456 compile_object
459 write_c_skeleton() {
460 cat > $TMPC <<EOF
461 int main(void) { return 0; }
465 if check_define __linux__ ; then
466 targetos="Linux"
467 elif check_define _WIN32 ; then
468 targetos='MINGW32'
469 elif check_define __OpenBSD__ ; then
470 targetos='OpenBSD'
471 elif check_define __sun__ ; then
472 targetos='SunOS'
473 elif check_define __HAIKU__ ; then
474 targetos='Haiku'
475 else
476 targetos=$(uname -s)
479 # Some host OSes need non-standard checks for which CPU to use.
480 # Note that these checks are broken for cross-compilation: if you're
481 # cross-compiling to one of these OSes then you'll need to specify
482 # the correct CPU with the --cpu option.
483 case $targetos in
484 Darwin)
485 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
486 # run 64-bit userspace code.
487 # If the user didn't specify a CPU explicitly and the kernel says this is
488 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
489 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
490 cpu="x86_64"
493 SunOS)
494 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
495 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
496 cpu="x86_64"
498 esac
500 if test ! -z "$cpu" ; then
501 # command line argument
503 elif check_define __i386__ ; then
504 cpu="i386"
505 elif check_define __x86_64__ ; then
506 if check_define __ILP32__ ; then
507 cpu="x32"
508 else
509 cpu="x86_64"
511 elif check_define __sparc__ ; then
512 if check_define __arch64__ ; then
513 cpu="sparc64"
514 else
515 cpu="sparc"
517 elif check_define _ARCH_PPC ; then
518 if check_define _ARCH_PPC64 ; then
519 cpu="ppc64"
520 else
521 cpu="ppc"
523 elif check_define __mips__ ; then
524 if check_define __mips64 ; then
525 cpu="mips64"
526 else
527 cpu="mips"
529 elif check_define __ia64__ ; then
530 cpu="ia64"
531 elif check_define __s390__ ; then
532 if check_define __s390x__ ; then
533 cpu="s390x"
534 else
535 cpu="s390"
537 elif check_define __arm__ ; then
538 cpu="arm"
539 elif check_define __aarch64__ ; then
540 cpu="aarch64"
541 else
542 cpu=$(uname -m)
545 ARCH=
546 # Normalise host CPU name and set ARCH.
547 # Note that this case should only have supported host CPUs, not guests.
548 case "$cpu" in
549 ppc|ppc64|s390|s390x|sparc64|x32)
550 cpu="$cpu"
551 supported_cpu="yes"
553 ia64)
554 cpu="$cpu"
556 i386|i486|i586|i686|i86pc|BePC)
557 cpu="i386"
558 supported_cpu="yes"
560 x86_64|amd64)
561 cpu="x86_64"
562 supported_cpu="yes"
564 armv*b|armv*l|arm)
565 cpu="arm"
566 supported_cpu="yes"
568 aarch64)
569 cpu="aarch64"
570 supported_cpu="yes"
572 mips*)
573 cpu="mips"
574 if check_define __MIPSEL__ ; then
575 cpu="${cpu}el"
577 supported_cpu="yes"
579 sparc|sun4[cdmuv])
580 cpu="sparc"
581 supported_cpu="yes"
583 sh4)
584 cpu="sh4"
587 # This will result in either an error or falling back to TCI later
588 ARCH=unknown
590 esac
591 if test -z "$ARCH"; then
592 ARCH="$cpu"
595 # OS specific
597 # host *BSD for user mode
598 HOST_VARIANT_DIR=""
600 case $targetos in
601 MINGW32*)
602 mingw32="yes"
603 hax="yes"
604 audio_possible_drivers="dsound sdl"
605 if check_include dsound.h; then
606 audio_drv_list="dsound"
607 else
608 audio_drv_list=""
610 supported_os="yes"
612 GNU/kFreeBSD)
613 bsd="yes"
614 audio_drv_list="oss"
615 audio_possible_drivers="oss sdl pa"
617 FreeBSD)
618 bsd="yes"
619 make="${MAKE-gmake}"
620 audio_drv_list="oss"
621 audio_possible_drivers="oss sdl pa"
622 # needed for kinfo_getvmmap(3) in libutil.h
623 LIBS="-lutil $LIBS"
624 # needed for kinfo_getproc
625 libs_qga="-lutil $libs_qga"
626 netmap="" # enable netmap autodetect
627 HOST_VARIANT_DIR="freebsd"
628 supported_os="yes"
630 DragonFly)
631 bsd="yes"
632 make="${MAKE-gmake}"
633 audio_drv_list="oss"
634 audio_possible_drivers="oss sdl pa"
635 HOST_VARIANT_DIR="dragonfly"
637 NetBSD)
638 bsd="yes"
639 make="${MAKE-gmake}"
640 audio_drv_list="oss"
641 audio_possible_drivers="oss sdl"
642 oss_lib="-lossaudio"
643 HOST_VARIANT_DIR="netbsd"
644 supported_os="yes"
646 OpenBSD)
647 bsd="yes"
648 make="${MAKE-gmake}"
649 audio_drv_list="sdl"
650 audio_possible_drivers="sdl"
651 HOST_VARIANT_DIR="openbsd"
653 Darwin)
654 bsd="yes"
655 darwin="yes"
656 hax="yes"
657 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
658 if [ "$cpu" = "x86_64" ] ; then
659 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
660 LDFLAGS="-arch x86_64 $LDFLAGS"
662 cocoa="yes"
663 audio_drv_list="coreaudio"
664 audio_possible_drivers="coreaudio sdl"
665 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
666 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
667 # Disable attempts to use ObjectiveC features in os/object.h since they
668 # won't work when we're compiling with gcc as a C compiler.
669 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
670 HOST_VARIANT_DIR="darwin"
671 supported_os="yes"
673 SunOS)
674 solaris="yes"
675 make="${MAKE-gmake}"
676 install="${INSTALL-ginstall}"
677 ld="gld"
678 smbd="${SMBD-/usr/sfw/sbin/smbd}"
679 needs_libsunmath="no"
680 solarisrev=$(uname -r | cut -f2 -d.)
681 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
682 if test "$solarisrev" -le 9 ; then
683 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
684 needs_libsunmath="yes"
685 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
686 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
687 LIBS="-lsunmath $LIBS"
688 else
689 error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
690 "libsunmath from the Sun Studio compilers tools, due to a lack of" \
691 "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
692 "Studio 11 can be downloaded from www.sun.com."
696 if test -f /usr/include/sys/soundcard.h ; then
697 audio_drv_list="oss"
699 audio_possible_drivers="oss sdl"
700 # needed for CMSG_ macros in sys/socket.h
701 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
702 # needed for TIOCWIN* defines in termios.h
703 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
704 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
705 solarisnetlibs="-lsocket -lnsl -lresolv"
706 LIBS="$solarisnetlibs $LIBS"
707 libs_qga="$solarisnetlibs $libs_qga"
709 AIX)
710 aix="yes"
711 make="${MAKE-gmake}"
713 Haiku)
714 haiku="yes"
715 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
716 LIBS="-lposix_error_mapper -lnetwork $LIBS"
718 Linux)
719 audio_drv_list="oss"
720 audio_possible_drivers="oss alsa sdl pa"
721 linux="yes"
722 linux_user="yes"
723 kvm="yes"
724 vhost_net="yes"
725 vhost_scsi="yes"
726 vhost_vsock="yes"
727 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
728 supported_os="yes"
731 # This is a fatal error, but don't report it yet, because we
732 # might be going to just print the --help text, or it might
733 # be the result of a missing compiler.
734 bogus_os="yes"
736 esac
738 if [ "$bsd" = "yes" ] ; then
739 if [ "$darwin" != "yes" ] ; then
740 bsd_user="yes"
744 : ${make=${MAKE-make}}
745 : ${install=${INSTALL-install}}
746 : ${python=${PYTHON-python}}
747 : ${smbd=${SMBD-/usr/sbin/smbd}}
749 # Default objcc to clang if available, otherwise use CC
750 if has clang; then
751 objcc=clang
752 else
753 objcc="$cc"
756 if test "$mingw32" = "yes" ; then
757 EXESUF=".exe"
758 DSOSUF=".dll"
759 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
760 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
761 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
762 # MinGW-w64 needs _POSIX defined.
763 QEMU_CFLAGS="-D_POSIX=1 $QEMU_CFLAGS"
764 # MinGW needs -mthreads for TLS and macro _MT.
765 QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
766 QEMU_CFLAGS="-I\$(SRC_PATH)/hosts/w32/include $QEMU_CFLAGS"
767 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
768 write_c_skeleton;
769 if compile_prog "" "-liberty" ; then
770 LIBS="-liberty $LIBS"
772 prefix="c:/Program Files/QEMU"
773 mandir="\${prefix}"
774 datadir="\${prefix}"
775 qemu_docdir="\${prefix}"
776 bindir="\${prefix}"
777 sysconfdir="\${prefix}"
778 local_statedir=
779 confsuffix=""
780 libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -liphlpapi -lnetapi32 $libs_qga"
783 werror=""
785 for opt do
786 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
787 case "$opt" in
788 --help|-h) show_help=yes
790 --version|-V) exec cat $source_path/VERSION
792 --prefix=*) prefix="$optarg"
794 --interp-prefix=*) interp_prefix="$optarg"
796 --source-path=*)
798 --cross-prefix=*)
800 --cc=*)
802 --host-cc=*) host_cc="$optarg"
804 --cxx=*)
806 --iasl=*) iasl="$optarg"
808 --objcc=*) objcc="$optarg"
810 --make=*) make="$optarg"
812 --install=*) install="$optarg"
814 --python=*) python="$optarg"
816 --gcov=*) gcov_tool="$optarg"
818 --smbd=*) smbd="$optarg"
820 --extra-cflags=*)
822 --extra-cxxflags=*)
824 --extra-ldflags=*)
826 --enable-debug-info)
828 --disable-debug-info)
830 --enable-modules)
831 modules="yes"
833 --disable-modules)
834 modules="no"
836 --cpu=*)
838 --target-list=*) target_list="$optarg"
840 --enable-trace-backends=*) trace_backends="$optarg"
842 # XXX: backwards compatibility
843 --enable-trace-backend=*) trace_backends="$optarg"
845 --with-trace-file=*) trace_file="$optarg"
847 --enable-gprof) gprof="yes"
849 --enable-gcov) gcov="yes"
851 --static)
852 static="yes"
853 LDFLAGS="-static $LDFLAGS"
854 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
856 --mandir=*) mandir="$optarg"
858 --bindir=*) bindir="$optarg"
860 --libdir=*) libdir="$optarg"
862 --libexecdir=*) libexecdir="$optarg"
864 --includedir=*) includedir="$optarg"
866 --datadir=*) datadir="$optarg"
868 --with-confsuffix=*) confsuffix="$optarg"
870 --docdir=*) qemu_docdir="$optarg"
872 --sysconfdir=*) sysconfdir="$optarg"
874 --localstatedir=*) local_statedir="$optarg"
876 --sbindir=*|--sharedstatedir=*|\
877 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
878 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
879 # These switches are silently ignored, for compatibility with
880 # autoconf-generated configure scripts. This allows QEMU's
881 # configure to be used by RPM and similar macros that set
882 # lots of directory switches by default.
884 --with-system-pixman) pixman="system"
886 --without-system-pixman) pixman="internal"
888 --without-pixman) pixman="none"
890 --disable-sdl) sdl="no"
892 --enable-sdl) sdl="yes"
894 --with-sdlabi=*) sdlabi="$optarg"
896 --disable-qom-cast-debug) qom_cast_debug="no"
898 --enable-qom-cast-debug) qom_cast_debug="yes"
900 --disable-virtfs) virtfs="no"
902 --enable-virtfs) virtfs="yes"
904 --disable-vnc) vnc="no"
906 --enable-vnc) vnc="yes"
908 --oss-lib=*) oss_lib="$optarg"
910 --audio-drv-list=*) audio_drv_list="$optarg"
912 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
914 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
916 --enable-debug-tcg) debug_tcg="yes"
918 --disable-debug-tcg) debug_tcg="no"
920 --enable-debug)
921 # Enable debugging options that aren't excessively noisy
922 debug_tcg="yes"
923 debug="yes"
924 strip_opt="no"
925 fortify_source="no"
927 --enable-sparse) sparse="yes"
929 --disable-sparse) sparse="no"
931 --disable-strip) strip_opt="no"
933 --disable-vnc-sasl) vnc_sasl="no"
935 --enable-vnc-sasl) vnc_sasl="yes"
937 --disable-vnc-jpeg) vnc_jpeg="no"
939 --enable-vnc-jpeg) vnc_jpeg="yes"
941 --disable-vnc-png) vnc_png="no"
943 --enable-vnc-png) vnc_png="yes"
945 --disable-slirp) slirp="no"
947 --disable-vde) vde="no"
949 --enable-vde) vde="yes"
951 --disable-netmap) netmap="no"
953 --enable-netmap) netmap="yes"
955 --disable-xen) xen="no"
957 --enable-xen) xen="yes"
959 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
961 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
963 --disable-xen-pv-domain-build) xen_pv_domain_build="no"
965 --enable-xen-pv-domain-build) xen_pv_domain_build="yes"
967 --disable-brlapi) brlapi="no"
969 --enable-brlapi) brlapi="yes"
971 --disable-bluez) bluez="no"
973 --enable-bluez) bluez="yes"
975 --disable-kvm) kvm="no"
977 --enable-kvm) kvm="yes"
979 --disable-hax) hax="no"
981 --enable-hax) hax="yes"
983 --disable-tcg-interpreter) tcg_interpreter="no"
985 --enable-tcg-interpreter) tcg_interpreter="yes"
987 --disable-cap-ng) cap_ng="no"
989 --enable-cap-ng) cap_ng="yes"
991 --disable-spice) spice="no"
993 --enable-spice) spice="yes"
995 --disable-libiscsi) libiscsi="no"
997 --enable-libiscsi) libiscsi="yes"
999 --disable-libnfs) libnfs="no"
1001 --enable-libnfs) libnfs="yes"
1003 --enable-profiler) profiler="yes"
1005 --disable-cocoa) cocoa="no"
1007 --enable-cocoa)
1008 cocoa="yes" ;
1009 audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
1011 --disable-system) softmmu="no"
1013 --enable-system) softmmu="yes"
1015 --disable-user)
1016 linux_user="no" ;
1017 bsd_user="no" ;
1019 --enable-user) ;;
1020 --disable-linux-user) linux_user="no"
1022 --enable-linux-user) linux_user="yes"
1024 --disable-bsd-user) bsd_user="no"
1026 --enable-bsd-user) bsd_user="yes"
1028 --enable-pie) pie="yes"
1030 --disable-pie) pie="no"
1032 --enable-werror) werror="yes"
1034 --disable-werror) werror="no"
1036 --enable-stack-protector) stack_protector="yes"
1038 --disable-stack-protector) stack_protector="no"
1040 --disable-curses) curses="no"
1042 --enable-curses) curses="yes"
1044 --disable-curl) curl="no"
1046 --enable-curl) curl="yes"
1048 --disable-fdt) fdt="no"
1050 --enable-fdt) fdt="yes"
1052 --disable-linux-aio) linux_aio="no"
1054 --enable-linux-aio) linux_aio="yes"
1056 --disable-attr) attr="no"
1058 --enable-attr) attr="yes"
1060 --disable-blobs) blobs="no"
1062 --with-pkgversion=*) pkgversion=" ($optarg)"
1064 --with-coroutine=*) coroutine="$optarg"
1066 --disable-coroutine-pool) coroutine_pool="no"
1068 --enable-coroutine-pool) coroutine_pool="yes"
1070 --enable-debug-stack-usage) debug_stack_usage="yes"
1072 --disable-docs) docs="no"
1074 --enable-docs) docs="yes"
1076 --disable-vhost-net) vhost_net="no"
1078 --enable-vhost-net) vhost_net="yes"
1080 --disable-vhost-scsi) vhost_scsi="no"
1082 --enable-vhost-scsi) vhost_scsi="yes"
1084 --disable-vhost-vsock) vhost_vsock="no"
1086 --enable-vhost-vsock) vhost_vsock="yes"
1088 --disable-opengl) opengl="no"
1090 --enable-opengl) opengl="yes"
1092 --disable-rbd) rbd="no"
1094 --enable-rbd) rbd="yes"
1096 --disable-xfsctl) xfs="no"
1098 --enable-xfsctl) xfs="yes"
1100 --disable-smartcard) smartcard="no"
1102 --enable-smartcard) smartcard="yes"
1104 --disable-libusb) libusb="no"
1106 --enable-libusb) libusb="yes"
1108 --disable-usb-redir) usb_redir="no"
1110 --enable-usb-redir) usb_redir="yes"
1112 --disable-zlib-test) zlib="no"
1114 --disable-lzo) lzo="no"
1116 --enable-lzo) lzo="yes"
1118 --disable-snappy) snappy="no"
1120 --enable-snappy) snappy="yes"
1122 --disable-bzip2) bzip2="no"
1124 --enable-bzip2) bzip2="yes"
1126 --enable-guest-agent) guest_agent="yes"
1128 --disable-guest-agent) guest_agent="no"
1130 --enable-guest-agent-msi) guest_agent_msi="yes"
1132 --disable-guest-agent-msi) guest_agent_msi="no"
1134 --with-vss-sdk) vss_win32_sdk=""
1136 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1138 --without-vss-sdk) vss_win32_sdk="no"
1140 --with-win-sdk) win_sdk=""
1142 --with-win-sdk=*) win_sdk="$optarg"
1144 --without-win-sdk) win_sdk="no"
1146 --enable-tools) want_tools="yes"
1148 --disable-tools) want_tools="no"
1150 --enable-seccomp) seccomp="yes"
1152 --disable-seccomp) seccomp="no"
1154 --disable-glusterfs) glusterfs="no"
1156 --enable-glusterfs) glusterfs="yes"
1158 --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
1159 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
1161 --enable-vhdx|--disable-vhdx)
1162 echo "$0: $opt is obsolete, VHDX driver is always built" >&2
1164 --enable-uuid|--disable-uuid)
1165 echo "$0: $opt is obsolete, UUID support is always built" >&2
1167 --disable-gtk) gtk="no"
1169 --enable-gtk) gtk="yes"
1171 --tls-priority=*) tls_priority="$optarg"
1173 --disable-gnutls) gnutls="no"
1175 --enable-gnutls) gnutls="yes"
1177 --disable-nettle) nettle="no"
1179 --enable-nettle) nettle="yes"
1181 --disable-gcrypt) gcrypt="no"
1183 --enable-gcrypt) gcrypt="yes"
1185 --enable-rdma) rdma="yes"
1187 --disable-rdma) rdma="no"
1189 --with-gtkabi=*) gtkabi="$optarg"
1191 --disable-vte) vte="no"
1193 --enable-vte) vte="yes"
1195 --disable-virglrenderer) virglrenderer="no"
1197 --enable-virglrenderer) virglrenderer="yes"
1199 --disable-tpm) tpm="no"
1201 --enable-tpm) tpm="yes"
1203 --disable-libssh2) libssh2="no"
1205 --enable-libssh2) libssh2="yes"
1207 --disable-live-block-migration) live_block_migration="no"
1209 --enable-live-block-migration) live_block_migration="yes"
1211 --disable-numa) numa="no"
1213 --enable-numa) numa="yes"
1215 --disable-tcmalloc) tcmalloc="no"
1217 --enable-tcmalloc) tcmalloc="yes"
1219 --disable-jemalloc) jemalloc="no"
1221 --enable-jemalloc) jemalloc="yes"
1223 --disable-replication) replication="no"
1225 --enable-replication) replication="yes"
1227 --disable-vxhs) vxhs="no"
1229 --enable-vxhs) vxhs="yes"
1232 echo "ERROR: unknown option $opt"
1233 echo "Try '$0 --help' for more information"
1234 exit 1
1236 esac
1237 done
1239 case "$cpu" in
1240 ppc)
1241 CPU_CFLAGS="-m32"
1242 LDFLAGS="-m32 $LDFLAGS"
1244 ppc64)
1245 CPU_CFLAGS="-m64"
1246 LDFLAGS="-m64 $LDFLAGS"
1248 sparc)
1249 CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc"
1250 LDFLAGS="-m32 -mv8plus $LDFLAGS"
1252 sparc64)
1253 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
1254 LDFLAGS="-m64 $LDFLAGS"
1256 s390)
1257 CPU_CFLAGS="-m31"
1258 LDFLAGS="-m31 $LDFLAGS"
1260 s390x)
1261 CPU_CFLAGS="-m64"
1262 LDFLAGS="-m64 $LDFLAGS"
1264 i386)
1265 CPU_CFLAGS="-m32"
1266 LDFLAGS="-m32 $LDFLAGS"
1267 cc_i386='$(CC) -m32'
1269 x86_64)
1270 # ??? Only extremely old AMD cpus do not have cmpxchg16b.
1271 # If we truly care, we should simply detect this case at
1272 # runtime and generate the fallback to serial emulation.
1273 CPU_CFLAGS="-m64 -mcx16"
1274 LDFLAGS="-m64 $LDFLAGS"
1275 cc_i386='$(CC) -m32'
1277 x32)
1278 CPU_CFLAGS="-mx32"
1279 LDFLAGS="-mx32 $LDFLAGS"
1280 cc_i386='$(CC) -m32'
1282 # No special flags required for other host CPUs
1283 esac
1285 QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1286 EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1288 # For user-mode emulation the host arch has to be one we explicitly
1289 # support, even if we're using TCI.
1290 if [ "$ARCH" = "unknown" ]; then
1291 bsd_user="no"
1292 linux_user="no"
1295 default_target_list=""
1297 mak_wilds=""
1299 if [ "$softmmu" = "yes" ]; then
1300 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
1302 if [ "$linux_user" = "yes" ]; then
1303 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
1305 if [ "$bsd_user" = "yes" ]; then
1306 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
1309 for config in $mak_wilds; do
1310 default_target_list="${default_target_list} $(basename "$config" .mak)"
1311 done
1313 # Enumerate public trace backends for --help output
1314 trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/'))
1316 if test x"$show_help" = x"yes" ; then
1317 cat << EOF
1319 Usage: configure [options]
1320 Options: [defaults in brackets after descriptions]
1322 Standard options:
1323 --help print this message
1324 --prefix=PREFIX install in PREFIX [$prefix]
1325 --interp-prefix=PREFIX where to find shared libraries, etc.
1326 use %M for cpu name [$interp_prefix]
1327 --target-list=LIST set target list (default: build everything)
1328 $(echo Available targets: $default_target_list | \
1329 fold -s -w 53 | sed -e 's/^/ /')
1331 Advanced options (experts only):
1332 --source-path=PATH path of source code [$source_path]
1333 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1334 --cc=CC use C compiler CC [$cc]
1335 --iasl=IASL use ACPI compiler IASL [$iasl]
1336 --host-cc=CC use C compiler CC [$host_cc] for code run at
1337 build time
1338 --cxx=CXX use C++ compiler CXX [$cxx]
1339 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1340 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
1341 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS
1342 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1343 --make=MAKE use specified make [$make]
1344 --install=INSTALL use specified install [$install]
1345 --python=PYTHON use specified python [$python]
1346 --smbd=SMBD use specified smbd [$smbd]
1347 --static enable static build [$static]
1348 --mandir=PATH install man pages in PATH
1349 --datadir=PATH install firmware in PATH$confsuffix
1350 --docdir=PATH install documentation in PATH$confsuffix
1351 --bindir=PATH install binaries in PATH
1352 --libdir=PATH install libraries in PATH
1353 --sysconfdir=PATH install config in PATH$confsuffix
1354 --localstatedir=PATH install local state in PATH (set at runtime on win32)
1355 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
1356 --enable-debug enable common debug build options
1357 --disable-strip disable stripping binaries
1358 --disable-werror disable compilation abort on warning
1359 --disable-stack-protector disable compiler-provided stack protection
1360 --audio-drv-list=LIST set audio drivers list:
1361 Available drivers: $audio_possible_drivers
1362 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1363 --block-drv-rw-whitelist=L
1364 set block driver read-write whitelist
1365 (affects only QEMU, not qemu-img)
1366 --block-drv-ro-whitelist=L
1367 set block driver read-only whitelist
1368 (affects only QEMU, not qemu-img)
1369 --enable-trace-backends=B Set trace backend
1370 Available backends: $trace_backend_list
1371 --with-trace-file=NAME Full PATH,NAME of file to store traces
1372 Default:trace-<pid>
1373 --disable-slirp disable SLIRP userspace network connectivity
1374 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1375 --oss-lib path to OSS library
1376 --cpu=CPU Build for host CPU [$cpu]
1377 --with-coroutine=BACKEND coroutine backend. Supported options:
1378 ucontext, sigaltstack, windows
1379 --enable-gcov enable test coverage analysis with gcov
1380 --gcov=GCOV use specified gcov [$gcov_tool]
1381 --disable-blobs disable installing provided firmware blobs
1382 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1383 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1384 --tls-priority default TLS protocol/cipher priority string
1385 --enable-gprof QEMU profiling with gprof
1386 --enable-profiler profiler support
1387 --enable-xen-pv-domain-build
1388 xen pv domain builder
1389 --enable-debug-stack-usage
1390 track the maximum stack usage of stacks created by qemu_alloc_stack
1392 Optional features, enabled with --enable-FEATURE and
1393 disabled with --disable-FEATURE, default is enabled if available:
1395 system all system emulation targets
1396 user supported user emulation targets
1397 linux-user all linux usermode emulation targets
1398 bsd-user all BSD usermode emulation targets
1399 docs build documentation
1400 guest-agent build the QEMU Guest Agent
1401 guest-agent-msi build guest agent Windows MSI installation package
1402 pie Position Independent Executables
1403 modules modules support
1404 debug-tcg TCG debugging (default is disabled)
1405 debug-info debugging information
1406 sparse sparse checker
1408 gnutls GNUTLS cryptography support
1409 nettle nettle cryptography support
1410 gcrypt libgcrypt cryptography support
1411 sdl SDL UI
1412 --with-sdlabi select preferred SDL ABI 1.2 or 2.0
1413 gtk gtk UI
1414 --with-gtkabi select preferred GTK ABI 2.0 or 3.0
1415 vte vte support for the gtk UI
1416 curses curses UI
1417 vnc VNC UI support
1418 vnc-sasl SASL encryption for VNC server
1419 vnc-jpeg JPEG lossy compression for VNC server
1420 vnc-png PNG compression for VNC server
1421 cocoa Cocoa UI (Mac OS X only)
1422 virtfs VirtFS
1423 xen xen backend driver support
1424 xen-pci-passthrough
1425 brlapi BrlAPI (Braile)
1426 curl curl connectivity
1427 fdt fdt device tree
1428 bluez bluez stack connectivity
1429 kvm KVM acceleration support
1430 hax HAX acceleration support
1431 rdma RDMA-based migration support
1432 vde support for vde network
1433 netmap support for netmap network
1434 linux-aio Linux AIO support
1435 cap-ng libcap-ng support
1436 attr attr and xattr support
1437 vhost-net vhost-net acceleration support
1438 spice spice
1439 rbd rados block device (rbd)
1440 libiscsi iscsi support
1441 libnfs nfs support
1442 smartcard smartcard support (libcacard)
1443 libusb libusb (for usb passthrough)
1444 live-block-migration Block migration in the main migration stream
1445 usb-redir usb network redirection support
1446 lzo support of lzo compression library
1447 snappy support of snappy compression library
1448 bzip2 support of bzip2 compression library
1449 (for reading bzip2-compressed dmg images)
1450 seccomp seccomp support
1451 coroutine-pool coroutine freelist (better performance)
1452 glusterfs GlusterFS backend
1453 tpm TPM support
1454 libssh2 ssh block device support
1455 numa libnuma support
1456 tcmalloc tcmalloc support
1457 jemalloc jemalloc support
1458 replication replication support
1459 vhost-vsock virtio sockets device support
1460 opengl opengl support
1461 virglrenderer virgl rendering support
1462 xfsctl xfsctl support
1463 qom-cast-debug cast debugging support
1464 tools build qemu-io, qemu-nbd and qemu-image tools
1465 vxhs Veritas HyperScale vDisk backend support
1467 NOTE: The object files are built at the place where configure is launched
1469 exit 0
1472 if ! has $python; then
1473 error_exit "Python not found. Use --python=/path/to/python"
1476 # Note that if the Python conditional here evaluates True we will exit
1477 # with status 1 which is a shell 'false' value.
1478 if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then
1479 error_exit "Cannot use '$python', Python 2.6 or later is required." \
1480 "Note that Python 3 or later is not yet supported." \
1481 "Use --python=/path/to/python to specify a supported Python."
1484 # Suppress writing compiled files
1485 python="$python -B"
1487 # Now we have handled --enable-tcg-interpreter and know we're not just
1488 # printing the help message, bail out if the host CPU isn't supported.
1489 if test "$ARCH" = "unknown"; then
1490 if test "$tcg_interpreter" = "yes" ; then
1491 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1492 else
1493 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1497 # Consult white-list to determine whether to enable werror
1498 # by default. Only enable by default for git builds
1499 if test -z "$werror" ; then
1500 if test -d "$source_path/.git" -a \
1501 \( "$linux" = "yes" -o "$mingw32" = "yes" \) ; then
1502 werror="yes"
1503 else
1504 werror="no"
1508 # check that the C compiler works.
1509 write_c_skeleton;
1510 if compile_object ; then
1511 : C compiler works ok
1512 else
1513 error_exit "\"$cc\" either does not exist or does not work"
1515 if ! compile_prog ; then
1516 error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
1519 if test "$bogus_os" = "yes"; then
1520 # Now that we know that we're not printing the help and that
1521 # the compiler works (so the results of the check_defines we used
1522 # to identify the OS are reliable), if we didn't recognize the
1523 # host OS we should stop now.
1524 error_exit "Unrecognized host OS $targetos"
1527 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1528 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1529 gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1530 gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
1531 gcc_flags="-Wno-initializer-overrides $gcc_flags"
1532 gcc_flags="-Wno-string-plus-int $gcc_flags"
1533 # Note that we do not add -Werror to gcc_flags here, because that would
1534 # enable it for all configure tests. If a configure test failed due
1535 # to -Werror this would just silently disable some features,
1536 # so it's too error prone.
1538 cc_has_warning_flag() {
1539 write_c_skeleton;
1541 # Use the positive sense of the flag when testing for -Wno-wombat
1542 # support (gcc will happily accept the -Wno- form of unknown
1543 # warning options).
1544 optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
1545 compile_prog "-Werror $optflag" ""
1548 for flag in $gcc_flags; do
1549 if cc_has_warning_flag $flag ; then
1550 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1552 done
1554 if test "$mingw32" = "yes"; then
1555 stack_protector="no"
1557 if test "$stack_protector" != "no"; then
1558 cat > $TMPC << EOF
1559 int main(int argc, char *argv[])
1561 char arr[64], *p = arr, *c = argv[0];
1562 while (*c) {
1563 *p++ = *c++;
1565 return 0;
1568 gcc_flags="-fstack-protector-strong -fstack-protector-all"
1569 sp_on=0
1570 for flag in $gcc_flags; do
1571 # We need to check both a compile and a link, since some compiler
1572 # setups fail only on a .c->.o compile and some only at link time
1573 if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
1574 compile_prog "-Werror $flag" ""; then
1575 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1576 sp_on=1
1577 break
1579 done
1580 if test "$stack_protector" = yes; then
1581 if test $sp_on = 0; then
1582 error_exit "Stack protector not supported"
1587 # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1588 # large functions that use global variables. The bug is in all releases of
1589 # GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1590 # 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1591 cat > $TMPC << EOF
1592 #if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1593 int main(void) { return 0; }
1594 #else
1595 #error No bug in this compiler.
1596 #endif
1598 if compile_prog "-Werror -fno-gcse" "" ; then
1599 TRANSLATE_OPT_CFLAGS=-fno-gcse
1602 if test "$static" = "yes" ; then
1603 if test "$modules" = "yes" ; then
1604 error_exit "static and modules are mutually incompatible"
1606 if test "$pie" = "yes" ; then
1607 error_exit "static and pie are mutually incompatible"
1608 else
1609 pie="no"
1613 # Unconditional check for compiler __thread support
1614 cat > $TMPC << EOF
1615 static __thread int tls_var;
1616 int main(void) { return tls_var; }
1619 if ! compile_prog "-Werror" "" ; then
1620 error_exit "Your compiler does not support the __thread specifier for " \
1621 "Thread-Local Storage (TLS). Please upgrade to a version that does."
1624 if test "$pie" = ""; then
1625 case "$cpu-$targetos" in
1626 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
1629 pie="no"
1631 esac
1634 if test "$pie" != "no" ; then
1635 cat > $TMPC << EOF
1637 #ifdef __linux__
1638 # define THREAD __thread
1639 #else
1640 # define THREAD
1641 #endif
1643 static THREAD int tls_var;
1645 int main(void) { return tls_var; }
1648 if compile_prog "-fPIE -DPIE" "-pie"; then
1649 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1650 LDFLAGS="-pie $LDFLAGS"
1651 pie="yes"
1652 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1653 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1655 else
1656 if test "$pie" = "yes"; then
1657 error_exit "PIE not available due to missing toolchain support"
1658 else
1659 echo "Disabling PIE due to missing toolchain support"
1660 pie="no"
1664 if compile_prog "-Werror -fno-pie" "-nopie"; then
1665 CFLAGS_NOPIE="-fno-pie"
1666 LDFLAGS_NOPIE="-nopie"
1670 ##########################################
1671 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
1672 # use i686 as default anyway, but for those that don't, an explicit
1673 # specification is necessary
1675 if test "$cpu" = "i386"; then
1676 cat > $TMPC << EOF
1677 static int sfaa(int *ptr)
1679 return __sync_fetch_and_and(ptr, 0);
1682 int main(void)
1684 int val = 42;
1685 val = __sync_val_compare_and_swap(&val, 0, 1);
1686 sfaa(&val);
1687 return val;
1690 if ! compile_prog "" "" ; then
1691 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1695 #########################################
1696 # Solaris specific configure tool chain decisions
1698 if test "$solaris" = "yes" ; then
1699 if has $install; then
1701 else
1702 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1703 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1704 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1706 if test "$(path_of $install)" = "/usr/sbin/install" ; then
1707 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1708 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1709 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1711 if has ar; then
1713 else
1714 if test -f /usr/ccs/bin/ar ; then
1715 error_exit "No path includes ar" \
1716 "Add /usr/ccs/bin to your path and rerun configure"
1718 error_exit "No path includes ar"
1722 if test -z "${target_list+xxx}" ; then
1723 target_list="$default_target_list"
1724 else
1725 target_list=$(echo "$target_list" | sed -e 's/,/ /g')
1728 # Check that we recognised the target name; this allows a more
1729 # friendly error message than if we let it fall through.
1730 for target in $target_list; do
1731 case " $default_target_list " in
1732 *" $target "*)
1735 error_exit "Unknown target name '$target'"
1737 esac
1738 done
1740 # see if system emulation was really requested
1741 case " $target_list " in
1742 *"-softmmu "*) softmmu=yes
1744 *) softmmu=no
1746 esac
1748 feature_not_found() {
1749 feature=$1
1750 remedy=$2
1752 error_exit "User requested feature $feature" \
1753 "configure was not able to find it." \
1754 "$remedy"
1757 # ---
1758 # big/little endian test
1759 cat > $TMPC << EOF
1760 short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1761 short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1762 extern int foo(short *, short *);
1763 int main(int argc, char *argv[]) {
1764 return foo(big_endian, little_endian);
1768 if compile_object ; then
1769 if grep -q BiGeNdIaN $TMPO ; then
1770 bigendian="yes"
1771 elif grep -q LiTtLeEnDiAn $TMPO ; then
1772 bigendian="no"
1773 else
1774 echo big/little test failed
1776 else
1777 echo big/little test failed
1780 ##########################################
1781 # cocoa implies not SDL or GTK
1782 # (the cocoa UI code currently assumes it is always the active UI
1783 # and doesn't interact well with other UI frontend code)
1784 if test "$cocoa" = "yes"; then
1785 if test "$sdl" = "yes"; then
1786 error_exit "Cocoa and SDL UIs cannot both be enabled at once"
1788 if test "$gtk" = "yes"; then
1789 error_exit "Cocoa and GTK UIs cannot both be enabled at once"
1791 gtk=no
1792 sdl=no
1795 # Some versions of Mac OS X incorrectly define SIZE_MAX
1796 cat > $TMPC << EOF
1797 #include <stdint.h>
1798 #include <stdio.h>
1799 int main(int argc, char *argv[]) {
1800 return printf("%zu", SIZE_MAX);
1803 have_broken_size_max=no
1804 if ! compile_object -Werror ; then
1805 have_broken_size_max=yes
1808 ##########################################
1809 # L2TPV3 probe
1811 cat > $TMPC <<EOF
1812 #include <sys/socket.h>
1813 #include <linux/ip.h>
1814 int main(void) { return sizeof(struct mmsghdr); }
1816 if compile_prog "" "" ; then
1817 l2tpv3=yes
1818 else
1819 l2tpv3=no
1822 ##########################################
1823 # MinGW / Mingw-w64 localtime_r/gmtime_r check
1825 if test "$mingw32" = "yes"; then
1826 # Some versions of MinGW / Mingw-w64 lack localtime_r
1827 # and gmtime_r entirely.
1829 # Some versions of Mingw-w64 define a macro for
1830 # localtime_r/gmtime_r.
1832 # Some versions of Mingw-w64 will define functions
1833 # for localtime_r/gmtime_r, but only if you have
1834 # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
1835 # though, unistd.h and pthread.h both define
1836 # that for you.
1838 # So this #undef localtime_r and #include <unistd.h>
1839 # are not in fact redundant.
1840 cat > $TMPC << EOF
1841 #include <unistd.h>
1842 #include <time.h>
1843 #undef localtime_r
1844 int main(void) { localtime_r(NULL, NULL); return 0; }
1846 if compile_prog "" "" ; then
1847 localtime_r="yes"
1848 else
1849 localtime_r="no"
1853 ##########################################
1854 # pkg-config probe
1856 if ! has "$pkg_config_exe"; then
1857 error_exit "pkg-config binary '$pkg_config_exe' not found"
1860 ##########################################
1861 # NPTL probe
1863 if test "$linux_user" = "yes"; then
1864 cat > $TMPC <<EOF
1865 #include <sched.h>
1866 #include <linux/futex.h>
1867 int main(void) {
1868 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1869 #error bork
1870 #endif
1871 return 0;
1874 if ! compile_object ; then
1875 feature_not_found "nptl" "Install glibc and linux kernel headers."
1879 ##########################################
1880 # avx2 optimization requirement check
1882 cat > $TMPC << EOF
1883 #pragma GCC push_options
1884 #pragma GCC target("avx2")
1885 #include <cpuid.h>
1886 #include <immintrin.h>
1887 static int bar(void *a) {
1888 __m256i x = *(__m256i *)a;
1889 return _mm256_testz_si256(x, x);
1891 int main(int argc, char *argv[]) { return bar(argv[0]); }
1893 if compile_object "" ; then
1894 avx2_opt="yes"
1897 ##########################################
1898 # lzo check
1900 if test "$lzo" != "no" ; then
1901 cat > $TMPC << EOF
1902 #include <lzo/lzo1x.h>
1903 int main(void) { lzo_version(); return 0; }
1905 if compile_prog "" "-llzo2" ; then
1906 libs_softmmu="$libs_softmmu -llzo2"
1907 lzo="yes"
1908 else
1909 if test "$lzo" = "yes"; then
1910 feature_not_found "liblzo2" "Install liblzo2 devel"
1912 lzo="no"
1916 ##########################################
1917 # snappy check
1919 if test "$snappy" != "no" ; then
1920 cat > $TMPC << EOF
1921 #include <snappy-c.h>
1922 int main(void) { snappy_max_compressed_length(4096); return 0; }
1924 if compile_prog "" "-lsnappy" ; then
1925 libs_softmmu="$libs_softmmu -lsnappy"
1926 snappy="yes"
1927 else
1928 if test "$snappy" = "yes"; then
1929 feature_not_found "libsnappy" "Install libsnappy devel"
1931 snappy="no"
1935 ##########################################
1936 # bzip2 check
1938 if test "$bzip2" != "no" ; then
1939 cat > $TMPC << EOF
1940 #include <bzlib.h>
1941 int main(void) { BZ2_bzlibVersion(); return 0; }
1943 if compile_prog "" "-lbz2" ; then
1944 bzip2="yes"
1945 else
1946 if test "$bzip2" = "yes"; then
1947 feature_not_found "libbzip2" "Install libbzip2 devel"
1949 bzip2="no"
1953 ##########################################
1954 # libseccomp check
1956 if test "$seccomp" != "no" ; then
1957 case "$cpu" in
1958 i386|x86_64)
1959 libseccomp_minver="2.1.0"
1961 mips)
1962 libseccomp_minver="2.2.0"
1964 arm|aarch64)
1965 libseccomp_minver="2.2.3"
1967 ppc|ppc64)
1968 libseccomp_minver="2.3.0"
1971 libseccomp_minver=""
1973 esac
1975 if test "$libseccomp_minver" != "" &&
1976 $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
1977 libs_softmmu="$libs_softmmu $($pkg_config --libs libseccomp)"
1978 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags libseccomp)"
1979 seccomp="yes"
1980 else
1981 if test "$seccomp" = "yes" ; then
1982 if test "$libseccomp_minver" != "" ; then
1983 feature_not_found "libseccomp" \
1984 "Install libseccomp devel >= $libseccomp_minver"
1985 else
1986 feature_not_found "libseccomp" \
1987 "libseccomp is not supported for host cpu $cpu"
1990 seccomp="no"
1993 ##########################################
1994 # xen probe
1996 if test "$xen" != "no" ; then
1997 # Check whether Xen library path is specified via --extra-ldflags to avoid
1998 # overriding this setting with pkg-config output. If not, try pkg-config
1999 # to obtain all needed flags.
2001 if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \
2002 $pkg_config --exists xencontrol ; then
2003 xen_ctrl_version="$(printf '%d%02d%02d' \
2004 $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
2005 xen=yes
2006 xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
2007 xen_pc="$xen_pc xenevtchn xendevicemodel"
2008 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
2009 libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
2010 LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS"
2011 else
2013 xen_libs="-lxenstore -lxenctrl -lxenguest"
2014 xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
2016 # First we test whether Xen headers and libraries are available.
2017 # If no, we are done and there is no Xen support.
2018 # If yes, more tests are run to detect the Xen version.
2020 # Xen (any)
2021 cat > $TMPC <<EOF
2022 #include <xenctrl.h>
2023 int main(void) {
2024 return 0;
2027 if ! compile_prog "" "$xen_libs" ; then
2028 # Xen not found
2029 if test "$xen" = "yes" ; then
2030 feature_not_found "xen" "Install xen devel"
2032 xen=no
2034 # Xen unstable
2035 elif
2036 cat > $TMPC <<EOF &&
2037 #undef XC_WANT_COMPAT_DEVICEMODEL_API
2038 #define __XEN_TOOLS__
2039 #include <xendevicemodel.h>
2040 int main(void) {
2041 xendevicemodel_handle *xd;
2043 xd = xendevicemodel_open(0, 0);
2044 xendevicemodel_close(xd);
2046 return 0;
2049 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
2050 then
2051 xen_stable_libs="-lxendevicemodel $xen_stable_libs"
2052 xen_ctrl_version=40900
2053 xen=yes
2054 elif
2055 cat > $TMPC <<EOF &&
2057 * If we have stable libs the we don't want the libxc compat
2058 * layers, regardless of what CFLAGS we may have been given.
2060 * Also, check if xengnttab_grant_copy_segment_t is defined and
2061 * grant copy operation is implemented.
2063 #undef XC_WANT_COMPAT_EVTCHN_API
2064 #undef XC_WANT_COMPAT_GNTTAB_API
2065 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2066 #include <xenctrl.h>
2067 #include <xenstore.h>
2068 #include <xenevtchn.h>
2069 #include <xengnttab.h>
2070 #include <xenforeignmemory.h>
2071 #include <stdint.h>
2072 #include <xen/hvm/hvm_info_table.h>
2073 #if !defined(HVM_MAX_VCPUS)
2074 # error HVM_MAX_VCPUS not defined
2075 #endif
2076 int main(void) {
2077 xc_interface *xc = NULL;
2078 xenforeignmemory_handle *xfmem;
2079 xenevtchn_handle *xe;
2080 xengnttab_handle *xg;
2081 xen_domain_handle_t handle;
2082 xengnttab_grant_copy_segment_t* seg = NULL;
2084 xs_daemon_open();
2086 xc = xc_interface_open(0, 0, 0);
2087 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2088 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2089 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2090 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2091 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2093 xfmem = xenforeignmemory_open(0, 0);
2094 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2096 xe = xenevtchn_open(0, 0);
2097 xenevtchn_fd(xe);
2099 xg = xengnttab_open(0, 0);
2100 xengnttab_grant_copy(xg, 0, seg);
2102 return 0;
2105 compile_prog "" "$xen_libs $xen_stable_libs"
2106 then
2107 xen_ctrl_version=40800
2108 xen=yes
2109 elif
2110 cat > $TMPC <<EOF &&
2112 * If we have stable libs the we don't want the libxc compat
2113 * layers, regardless of what CFLAGS we may have been given.
2115 #undef XC_WANT_COMPAT_EVTCHN_API
2116 #undef XC_WANT_COMPAT_GNTTAB_API
2117 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2118 #include <xenctrl.h>
2119 #include <xenstore.h>
2120 #include <xenevtchn.h>
2121 #include <xengnttab.h>
2122 #include <xenforeignmemory.h>
2123 #include <stdint.h>
2124 #include <xen/hvm/hvm_info_table.h>
2125 #if !defined(HVM_MAX_VCPUS)
2126 # error HVM_MAX_VCPUS not defined
2127 #endif
2128 int main(void) {
2129 xc_interface *xc = NULL;
2130 xenforeignmemory_handle *xfmem;
2131 xenevtchn_handle *xe;
2132 xengnttab_handle *xg;
2133 xen_domain_handle_t handle;
2135 xs_daemon_open();
2137 xc = xc_interface_open(0, 0, 0);
2138 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2139 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2140 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2141 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2142 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2144 xfmem = xenforeignmemory_open(0, 0);
2145 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2147 xe = xenevtchn_open(0, 0);
2148 xenevtchn_fd(xe);
2150 xg = xengnttab_open(0, 0);
2151 xengnttab_map_grant_ref(xg, 0, 0, 0);
2153 return 0;
2156 compile_prog "" "$xen_libs $xen_stable_libs"
2157 then
2158 xen_ctrl_version=40701
2159 xen=yes
2160 elif
2161 cat > $TMPC <<EOF &&
2162 #include <xenctrl.h>
2163 #include <stdint.h>
2164 int main(void) {
2165 xc_interface *xc = NULL;
2166 xen_domain_handle_t handle;
2167 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2168 return 0;
2171 compile_prog "" "$xen_libs"
2172 then
2173 xen_ctrl_version=40700
2174 xen=yes
2176 # Xen 4.6
2177 elif
2178 cat > $TMPC <<EOF &&
2179 #include <xenctrl.h>
2180 #include <xenstore.h>
2181 #include <stdint.h>
2182 #include <xen/hvm/hvm_info_table.h>
2183 #if !defined(HVM_MAX_VCPUS)
2184 # error HVM_MAX_VCPUS not defined
2185 #endif
2186 int main(void) {
2187 xc_interface *xc;
2188 xs_daemon_open();
2189 xc = xc_interface_open(0, 0, 0);
2190 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2191 xc_gnttab_open(NULL, 0);
2192 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2193 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2194 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2195 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
2196 return 0;
2199 compile_prog "" "$xen_libs"
2200 then
2201 xen_ctrl_version=40600
2202 xen=yes
2204 # Xen 4.5
2205 elif
2206 cat > $TMPC <<EOF &&
2207 #include <xenctrl.h>
2208 #include <xenstore.h>
2209 #include <stdint.h>
2210 #include <xen/hvm/hvm_info_table.h>
2211 #if !defined(HVM_MAX_VCPUS)
2212 # error HVM_MAX_VCPUS not defined
2213 #endif
2214 int main(void) {
2215 xc_interface *xc;
2216 xs_daemon_open();
2217 xc = xc_interface_open(0, 0, 0);
2218 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2219 xc_gnttab_open(NULL, 0);
2220 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2221 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2222 xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
2223 return 0;
2226 compile_prog "" "$xen_libs"
2227 then
2228 xen_ctrl_version=40500
2229 xen=yes
2231 elif
2232 cat > $TMPC <<EOF &&
2233 #include <xenctrl.h>
2234 #include <xenstore.h>
2235 #include <stdint.h>
2236 #include <xen/hvm/hvm_info_table.h>
2237 #if !defined(HVM_MAX_VCPUS)
2238 # error HVM_MAX_VCPUS not defined
2239 #endif
2240 int main(void) {
2241 xc_interface *xc;
2242 xs_daemon_open();
2243 xc = xc_interface_open(0, 0, 0);
2244 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2245 xc_gnttab_open(NULL, 0);
2246 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2247 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2248 return 0;
2251 compile_prog "" "$xen_libs"
2252 then
2253 xen_ctrl_version=40200
2254 xen=yes
2256 else
2257 if test "$xen" = "yes" ; then
2258 feature_not_found "xen (unsupported version)" \
2259 "Install a supported xen (xen 4.2 or newer)"
2261 xen=no
2264 if test "$xen" = yes; then
2265 if test $xen_ctrl_version -ge 40701 ; then
2266 libs_softmmu="$xen_stable_libs $libs_softmmu"
2268 libs_softmmu="$xen_libs $libs_softmmu"
2273 if test "$xen_pci_passthrough" != "no"; then
2274 if test "$xen" = "yes" && test "$linux" = "yes"; then
2275 xen_pci_passthrough=yes
2276 else
2277 if test "$xen_pci_passthrough" = "yes"; then
2278 error_exit "User requested feature Xen PCI Passthrough" \
2279 " but this feature requires /sys from Linux"
2281 xen_pci_passthrough=no
2285 if test "$xen_pv_domain_build" = "yes" &&
2286 test "$xen" != "yes"; then
2287 error_exit "User requested Xen PV domain builder support" \
2288 "which requires Xen support."
2291 ##########################################
2292 # Sparse probe
2293 if test "$sparse" != "no" ; then
2294 if has cgcc; then
2295 sparse=yes
2296 else
2297 if test "$sparse" = "yes" ; then
2298 feature_not_found "sparse" "Install sparse binary"
2300 sparse=no
2304 ##########################################
2305 # X11 probe
2306 x11_cflags=
2307 x11_libs=-lX11
2308 if $pkg_config --exists "x11"; then
2309 x11_cflags=$($pkg_config --cflags x11)
2310 x11_libs=$($pkg_config --libs x11)
2313 ##########################################
2314 # GTK probe
2316 if test "$gtkabi" = ""; then
2317 # The GTK ABI was not specified explicitly, so try whether 3.0 is available.
2318 # Use 2.0 as a fallback if that is available.
2319 if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
2320 gtkabi=3.0
2321 elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
2322 gtkabi=2.0
2323 else
2324 gtkabi=3.0
2328 if test "$gtk" != "no"; then
2329 gtkpackage="gtk+-$gtkabi"
2330 gtkx11package="gtk+-x11-$gtkabi"
2331 if test "$gtkabi" = "3.0" ; then
2332 gtkversion="3.0.0"
2333 else
2334 gtkversion="2.18.0"
2336 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
2337 gtk_cflags=$($pkg_config --cflags $gtkpackage)
2338 gtk_libs=$($pkg_config --libs $gtkpackage)
2339 gtk_version=$($pkg_config --modversion $gtkpackage)
2340 if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
2341 gtk_cflags="$gtk_cflags $x11_cflags"
2342 gtk_libs="$gtk_libs $x11_libs"
2344 libs_softmmu="$gtk_libs $libs_softmmu"
2345 gtk="yes"
2346 elif test "$gtk" = "yes"; then
2347 feature_not_found "gtk" "Install gtk3-devel"
2348 else
2349 gtk="no"
2354 ##########################################
2355 # GNUTLS probe
2357 gnutls_works() {
2358 # Unfortunately some distros have bad pkg-config information for gnutls
2359 # such that it claims to exist but you get a compiler error if you try
2360 # to use the options returned by --libs. Specifically, Ubuntu for --static
2361 # builds doesn't work:
2362 # https://bugs.launchpad.net/ubuntu/+source/gnutls26/+bug/1478035
2364 # So sanity check the cflags/libs before assuming gnutls can be used.
2365 if ! $pkg_config --exists "gnutls"; then
2366 return 1
2369 write_c_skeleton
2370 compile_prog "$($pkg_config --cflags gnutls)" "$($pkg_config --libs gnutls)"
2373 gnutls_gcrypt=no
2374 gnutls_nettle=no
2375 if test "$gnutls" != "no"; then
2376 if gnutls_works; then
2377 gnutls_cflags=$($pkg_config --cflags gnutls)
2378 gnutls_libs=$($pkg_config --libs gnutls)
2379 libs_softmmu="$gnutls_libs $libs_softmmu"
2380 libs_tools="$gnutls_libs $libs_tools"
2381 QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
2382 gnutls="yes"
2384 # gnutls_rnd requires >= 2.11.0
2385 if $pkg_config --exists "gnutls >= 2.11.0"; then
2386 gnutls_rnd="yes"
2387 else
2388 gnutls_rnd="no"
2391 if $pkg_config --exists 'gnutls >= 3.0'; then
2392 gnutls_gcrypt=no
2393 gnutls_nettle=yes
2394 elif $pkg_config --exists 'gnutls >= 2.12'; then
2395 case $($pkg_config --libs --static gnutls) in
2396 *gcrypt*)
2397 gnutls_gcrypt=yes
2398 gnutls_nettle=no
2400 *nettle*)
2401 gnutls_gcrypt=no
2402 gnutls_nettle=yes
2405 gnutls_gcrypt=yes
2406 gnutls_nettle=no
2408 esac
2409 else
2410 gnutls_gcrypt=yes
2411 gnutls_nettle=no
2413 elif test "$gnutls" = "yes"; then
2414 feature_not_found "gnutls" "Install gnutls devel"
2415 else
2416 gnutls="no"
2417 gnutls_rnd="no"
2419 else
2420 gnutls_rnd="no"
2424 # If user didn't give a --disable/enable-gcrypt flag,
2425 # then mark as disabled if user requested nettle
2426 # explicitly, or if gnutls links to nettle
2427 if test -z "$gcrypt"
2428 then
2429 if test "$nettle" = "yes" || test "$gnutls_nettle" = "yes"
2430 then
2431 gcrypt="no"
2435 # If user didn't give a --disable/enable-nettle flag,
2436 # then mark as disabled if user requested gcrypt
2437 # explicitly, or if gnutls links to gcrypt
2438 if test -z "$nettle"
2439 then
2440 if test "$gcrypt" = "yes" || test "$gnutls_gcrypt" = "yes"
2441 then
2442 nettle="no"
2446 has_libgcrypt_config() {
2447 if ! has "libgcrypt-config"
2448 then
2449 return 1
2452 if test -n "$cross_prefix"
2453 then
2454 host=$(libgcrypt-config --host)
2455 if test "$host-" != $cross_prefix
2456 then
2457 return 1
2461 return 0
2464 if test "$gcrypt" != "no"; then
2465 if has_libgcrypt_config; then
2466 gcrypt_cflags=$(libgcrypt-config --cflags)
2467 gcrypt_libs=$(libgcrypt-config --libs)
2468 # Debian has remove -lgpg-error from libgcrypt-config
2469 # as it "spreads unnecessary dependencies" which in
2470 # turn breaks static builds...
2471 if test "$static" = "yes"
2472 then
2473 gcrypt_libs="$gcrypt_libs -lgpg-error"
2475 libs_softmmu="$gcrypt_libs $libs_softmmu"
2476 libs_tools="$gcrypt_libs $libs_tools"
2477 QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
2478 gcrypt="yes"
2479 if test -z "$nettle"; then
2480 nettle="no"
2483 cat > $TMPC << EOF
2484 #include <gcrypt.h>
2485 int main(void) {
2486 gcry_kdf_derive(NULL, 0, GCRY_KDF_PBKDF2,
2487 GCRY_MD_SHA256,
2488 NULL, 0, 0, 0, NULL);
2489 return 0;
2492 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2493 gcrypt_kdf=yes
2496 cat > $TMPC << EOF
2497 #include <gcrypt.h>
2498 int main(void) {
2499 gcry_mac_hd_t handle;
2500 gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5,
2501 GCRY_MAC_FLAG_SECURE, NULL);
2502 return 0;
2505 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2506 gcrypt_hmac=yes
2508 else
2509 if test "$gcrypt" = "yes"; then
2510 feature_not_found "gcrypt" "Install gcrypt devel"
2511 else
2512 gcrypt="no"
2518 if test "$nettle" != "no"; then
2519 if $pkg_config --exists "nettle"; then
2520 nettle_cflags=$($pkg_config --cflags nettle)
2521 nettle_libs=$($pkg_config --libs nettle)
2522 nettle_version=$($pkg_config --modversion nettle)
2523 libs_softmmu="$nettle_libs $libs_softmmu"
2524 libs_tools="$nettle_libs $libs_tools"
2525 QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
2526 nettle="yes"
2528 cat > $TMPC << EOF
2529 #include <stddef.h>
2530 #include <nettle/pbkdf2.h>
2531 int main(void) {
2532 pbkdf2_hmac_sha256(8, NULL, 1000, 8, NULL, 8, NULL);
2533 return 0;
2536 if compile_prog "$nettle_cflags" "$nettle_libs" ; then
2537 nettle_kdf=yes
2539 else
2540 if test "$nettle" = "yes"; then
2541 feature_not_found "nettle" "Install nettle devel"
2542 else
2543 nettle="no"
2548 if test "$gcrypt" = "yes" && test "$nettle" = "yes"
2549 then
2550 error_exit "Only one of gcrypt & nettle can be enabled"
2553 ##########################################
2554 # libtasn1 - only for the TLS creds/session test suite
2556 tasn1=yes
2557 tasn1_cflags=""
2558 tasn1_libs=""
2559 if $pkg_config --exists "libtasn1"; then
2560 tasn1_cflags=$($pkg_config --cflags libtasn1)
2561 tasn1_libs=$($pkg_config --libs libtasn1)
2562 else
2563 tasn1=no
2567 ##########################################
2568 # getifaddrs (for tests/test-io-channel-socket )
2570 have_ifaddrs_h=yes
2571 if ! check_include "ifaddrs.h" ; then
2572 have_ifaddrs_h=no
2575 ##########################################
2576 # VTE probe
2578 if test "$vte" != "no"; then
2579 if test "$gtkabi" = "3.0"; then
2580 vteminversion="0.32.0"
2581 if $pkg_config --exists "vte-2.91"; then
2582 vtepackage="vte-2.91"
2583 else
2584 vtepackage="vte-2.90"
2586 else
2587 vtepackage="vte"
2588 vteminversion="0.24.0"
2590 if $pkg_config --exists "$vtepackage >= $vteminversion"; then
2591 vte_cflags=$($pkg_config --cflags $vtepackage)
2592 vte_libs=$($pkg_config --libs $vtepackage)
2593 vteversion=$($pkg_config --modversion $vtepackage)
2594 libs_softmmu="$vte_libs $libs_softmmu"
2595 vte="yes"
2596 elif test "$vte" = "yes"; then
2597 if test "$gtkabi" = "3.0"; then
2598 feature_not_found "vte" "Install libvte-2.90/2.91 devel"
2599 else
2600 feature_not_found "vte" "Install libvte devel"
2602 else
2603 vte="no"
2607 ##########################################
2608 # SDL probe
2610 # Look for sdl configuration program (pkg-config or sdl-config). Try
2611 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
2613 if test "$sdlabi" = ""; then
2614 if $pkg_config --exists "sdl2"; then
2615 sdlabi=2.0
2616 elif $pkg_config --exists "sdl"; then
2617 sdlabi=1.2
2618 else
2619 sdlabi=2.0
2623 if test $sdlabi = "2.0"; then
2624 sdl_config=$sdl2_config
2625 sdlname=sdl2
2626 sdlconfigname=sdl2_config
2627 elif test $sdlabi = "1.2"; then
2628 sdlname=sdl
2629 sdlconfigname=sdl_config
2630 else
2631 error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0"
2634 if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then
2635 sdl_config=$sdlconfigname
2638 if $pkg_config $sdlname --exists; then
2639 sdlconfig="$pkg_config $sdlname"
2640 sdlversion=$($sdlconfig --modversion 2>/dev/null)
2641 elif has ${sdl_config}; then
2642 sdlconfig="$sdl_config"
2643 sdlversion=$($sdlconfig --version)
2644 else
2645 if test "$sdl" = "yes" ; then
2646 feature_not_found "sdl" "Install SDL2-devel"
2648 sdl=no
2650 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
2651 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
2654 sdl_too_old=no
2655 if test "$sdl" != "no" ; then
2656 cat > $TMPC << EOF
2657 #include <SDL.h>
2658 #undef main /* We don't want SDL to override our main() */
2659 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
2661 sdl_cflags=$($sdlconfig --cflags 2>/dev/null)
2662 if test "$static" = "yes" ; then
2663 sdl_libs=$($sdlconfig --static-libs 2>/dev/null)
2664 else
2665 sdl_libs=$($sdlconfig --libs 2>/dev/null)
2667 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2668 if test $(echo $sdlversion | sed 's/[^0-9]//g') -lt 121 ; then
2669 sdl_too_old=yes
2670 else
2671 sdl=yes
2674 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
2675 if test "$sdl" = "yes" -a "$static" = "yes" ; then
2676 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
2677 sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)"
2678 sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)"
2680 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2682 else
2683 sdl=no
2685 fi # static link
2686 else # sdl not found
2687 if test "$sdl" = "yes" ; then
2688 feature_not_found "sdl" "Install SDL devel"
2690 sdl=no
2691 fi # sdl compile test
2694 if test "$sdl" = "yes" ; then
2695 cat > $TMPC <<EOF
2696 #include <SDL.h>
2697 #if defined(SDL_VIDEO_DRIVER_X11)
2698 #include <X11/XKBlib.h>
2699 #else
2700 #error No x11 support
2701 #endif
2702 int main(void) { return 0; }
2704 if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then
2705 sdl_cflags="$sdl_cflags $x11_cflags"
2706 sdl_libs="$sdl_libs $x11_libs"
2708 libs_softmmu="$sdl_libs $libs_softmmu"
2711 ##########################################
2712 # RDMA needs OpenFabrics libraries
2713 if test "$rdma" != "no" ; then
2714 cat > $TMPC <<EOF
2715 #include <rdma/rdma_cma.h>
2716 int main(void) { return 0; }
2718 rdma_libs="-lrdmacm -libverbs"
2719 if compile_prog "" "$rdma_libs" ; then
2720 rdma="yes"
2721 libs_softmmu="$libs_softmmu $rdma_libs"
2722 else
2723 if test "$rdma" = "yes" ; then
2724 error_exit \
2725 " OpenFabrics librdmacm/libibverbs not present." \
2726 " Your options:" \
2727 " (1) Fast: Install infiniband packages from your distro." \
2728 " (2) Cleanest: Install libraries from www.openfabrics.org" \
2729 " (3) Also: Install softiwarp if you don't have RDMA hardware"
2731 rdma="no"
2735 ##########################################
2736 # VNC SASL detection
2737 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
2738 cat > $TMPC <<EOF
2739 #include <sasl/sasl.h>
2740 #include <stdio.h>
2741 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
2743 # Assuming Cyrus-SASL installed in /usr prefix
2744 vnc_sasl_cflags=""
2745 vnc_sasl_libs="-lsasl2"
2746 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
2747 vnc_sasl=yes
2748 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
2749 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
2750 else
2751 if test "$vnc_sasl" = "yes" ; then
2752 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
2754 vnc_sasl=no
2758 ##########################################
2759 # VNC JPEG detection
2760 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
2761 if $pkg_config --exists libjpeg; then
2762 vnc_jpeg=yes
2763 libs_softmmu="$libs_softmmu $($pkg_config --libs libjpeg)"
2764 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags libjpeg)"
2765 else
2766 cat > $TMPC <<EOF
2767 #include <stdio.h>
2768 #include <jpeglib.h>
2769 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2771 vnc_jpeg_cflags=""
2772 vnc_jpeg_libs="-ljpeg"
2773 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2774 vnc_jpeg=yes
2775 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
2776 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
2777 else
2778 if test "$vnc_jpeg" = "yes" ; then
2779 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
2781 vnc_jpeg=no
2786 ##########################################
2787 # VNC PNG detection
2788 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
2789 cat > $TMPC <<EOF
2790 //#include <stdio.h>
2791 #include <png.h>
2792 #include <stddef.h>
2793 int main(void) {
2794 png_structp png_ptr;
2795 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
2796 return png_ptr != 0;
2799 if $pkg_config libpng --exists; then
2800 vnc_png_cflags=$($pkg_config libpng --cflags)
2801 vnc_png_libs=$($pkg_config libpng --libs)
2802 else
2803 vnc_png_cflags=""
2804 vnc_png_libs="-lpng"
2806 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2807 vnc_png=yes
2808 libs_softmmu="$vnc_png_libs $libs_softmmu"
2809 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
2810 else
2811 if test "$vnc_png" = "yes" ; then
2812 feature_not_found "vnc-png" "Install libpng devel"
2814 vnc_png=no
2818 ##########################################
2819 # fnmatch() probe, used for ACL routines
2820 fnmatch="no"
2821 cat > $TMPC << EOF
2822 #include <fnmatch.h>
2823 int main(void)
2825 fnmatch("foo", "foo", 0);
2826 return 0;
2829 if compile_prog "" "" ; then
2830 fnmatch="yes"
2833 ##########################################
2834 # xfsctl() probe, used for file-posix.c
2835 if test "$xfs" != "no" ; then
2836 cat > $TMPC << EOF
2837 #include <stddef.h> /* NULL */
2838 #include <xfs/xfs.h>
2839 int main(void)
2841 xfsctl(NULL, 0, 0, NULL);
2842 return 0;
2845 if compile_prog "" "" ; then
2846 xfs="yes"
2847 else
2848 if test "$xfs" = "yes" ; then
2849 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
2851 xfs=no
2855 ##########################################
2856 # vde libraries probe
2857 if test "$vde" != "no" ; then
2858 vde_libs="-lvdeplug"
2859 cat > $TMPC << EOF
2860 #include <stddef.h>
2861 #include <libvdeplug.h>
2862 int main(void)
2864 struct vde_open_args a = {0, 0, 0};
2865 char s[] = "";
2866 vde_open(s, s, &a);
2867 return 0;
2870 if compile_prog "" "$vde_libs" ; then
2871 vde=yes
2872 libs_softmmu="$vde_libs $libs_softmmu"
2873 libs_tools="$vde_libs $libs_tools"
2874 else
2875 if test "$vde" = "yes" ; then
2876 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
2878 vde=no
2882 ##########################################
2883 # netmap support probe
2884 # Apart from looking for netmap headers, we make sure that the host API version
2885 # supports the netmap backend (>=11). The upper bound (15) is meant to simulate
2886 # a minor/major version number. Minor new features will be marked with values up
2887 # to 15, and if something happens that requires a change to the backend we will
2888 # move above 15, submit the backend fixes and modify this two bounds.
2889 if test "$netmap" != "no" ; then
2890 cat > $TMPC << EOF
2891 #include <inttypes.h>
2892 #include <net/if.h>
2893 #include <net/netmap.h>
2894 #include <net/netmap_user.h>
2895 #if (NETMAP_API < 11) || (NETMAP_API > 15)
2896 #error
2897 #endif
2898 int main(void) { return 0; }
2900 if compile_prog "" "" ; then
2901 netmap=yes
2902 else
2903 if test "$netmap" = "yes" ; then
2904 feature_not_found "netmap"
2906 netmap=no
2910 ##########################################
2911 # libcap-ng library probe
2912 if test "$cap_ng" != "no" ; then
2913 cap_libs="-lcap-ng"
2914 cat > $TMPC << EOF
2915 #include <cap-ng.h>
2916 int main(void)
2918 capng_capability_to_name(CAPNG_EFFECTIVE);
2919 return 0;
2922 if compile_prog "" "$cap_libs" ; then
2923 cap_ng=yes
2924 libs_tools="$cap_libs $libs_tools"
2925 else
2926 if test "$cap_ng" = "yes" ; then
2927 feature_not_found "cap_ng" "Install libcap-ng devel"
2929 cap_ng=no
2933 ##########################################
2934 # Sound support libraries probe
2936 audio_drv_probe()
2938 drv=$1
2939 hdr=$2
2940 lib=$3
2941 exp=$4
2942 cfl=$5
2943 cat > $TMPC << EOF
2944 #include <$hdr>
2945 int main(void) { $exp }
2947 if compile_prog "$cfl" "$lib" ; then
2949 else
2950 error_exit "$drv check failed" \
2951 "Make sure to have the $drv libs and headers installed."
2955 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g')
2956 for drv in $audio_drv_list; do
2957 case $drv in
2958 alsa)
2959 audio_drv_probe $drv alsa/asoundlib.h -lasound \
2960 "return snd_pcm_close((snd_pcm_t *)0);"
2961 libs_softmmu="-lasound $libs_softmmu"
2965 audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \
2966 "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;"
2967 libs_softmmu="-lpulse $libs_softmmu"
2968 audio_pt_int="yes"
2971 sdl)
2972 if test "$sdl" = "no"; then
2973 error_exit "sdl not found or disabled, can not use sdl audio driver"
2977 coreaudio)
2978 libs_softmmu="-framework CoreAudio $libs_softmmu"
2981 dsound)
2982 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
2983 audio_win_int="yes"
2986 oss)
2987 libs_softmmu="$oss_lib $libs_softmmu"
2990 wav)
2991 # XXX: Probes for CoreAudio, DirectSound
2995 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
2996 error_exit "Unknown driver '$drv' selected" \
2997 "Possible drivers are: $audio_possible_drivers"
3000 esac
3001 done
3003 ##########################################
3004 # BrlAPI probe
3006 if test "$brlapi" != "no" ; then
3007 brlapi_libs="-lbrlapi"
3008 cat > $TMPC << EOF
3009 #include <brlapi.h>
3010 #include <stddef.h>
3011 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
3013 if compile_prog "" "$brlapi_libs" ; then
3014 brlapi=yes
3015 libs_softmmu="$brlapi_libs $libs_softmmu"
3016 else
3017 if test "$brlapi" = "yes" ; then
3018 feature_not_found "brlapi" "Install brlapi devel"
3020 brlapi=no
3024 ##########################################
3025 # curses probe
3026 if test "$curses" != "no" ; then
3027 if test "$mingw32" = "yes" ; then
3028 curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
3029 curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
3030 else
3031 curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
3032 curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
3034 curses_found=no
3035 cat > $TMPC << EOF
3036 #include <locale.h>
3037 #include <curses.h>
3038 #include <wchar.h>
3039 int main(void) {
3040 wchar_t wch = L'w';
3041 setlocale(LC_ALL, "");
3042 resize_term(0, 0);
3043 addwstr(L"wide chars\n");
3044 addnwstr(&wch, 1);
3045 add_wch(WACS_DEGREE);
3046 return 0;
3049 IFS=:
3050 for curses_inc in $curses_inc_list; do
3051 # Make sure we get the wide character prototypes
3052 curses_inc="-DNCURSES_WIDECHAR $curses_inc"
3053 IFS=:
3054 for curses_lib in $curses_lib_list; do
3055 unset IFS
3056 if compile_prog "$curses_inc" "$curses_lib" ; then
3057 curses_found=yes
3058 QEMU_CFLAGS="$curses_inc $QEMU_CFLAGS"
3059 libs_softmmu="$curses_lib $libs_softmmu"
3060 break
3062 done
3063 if test "$curses_found" = yes ; then
3064 break
3066 done
3067 unset IFS
3068 if test "$curses_found" = "yes" ; then
3069 curses=yes
3070 else
3071 if test "$curses" = "yes" ; then
3072 feature_not_found "curses" "Install ncurses devel"
3074 curses=no
3078 ##########################################
3079 # curl probe
3080 if test "$curl" != "no" ; then
3081 if $pkg_config libcurl --exists; then
3082 curlconfig="$pkg_config libcurl"
3083 else
3084 curlconfig=curl-config
3086 cat > $TMPC << EOF
3087 #include <curl/curl.h>
3088 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
3090 curl_cflags=$($curlconfig --cflags 2>/dev/null)
3091 curl_libs=$($curlconfig --libs 2>/dev/null)
3092 if compile_prog "$curl_cflags" "$curl_libs" ; then
3093 curl=yes
3094 else
3095 if test "$curl" = "yes" ; then
3096 feature_not_found "curl" "Install libcurl devel"
3098 curl=no
3100 fi # test "$curl"
3102 ##########################################
3103 # bluez support probe
3104 if test "$bluez" != "no" ; then
3105 cat > $TMPC << EOF
3106 #include <bluetooth/bluetooth.h>
3107 int main(void) { return bt_error(0); }
3109 bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null)
3110 bluez_libs=$($pkg_config --libs bluez 2>/dev/null)
3111 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
3112 bluez=yes
3113 libs_softmmu="$bluez_libs $libs_softmmu"
3114 else
3115 if test "$bluez" = "yes" ; then
3116 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
3118 bluez="no"
3122 ##########################################
3123 # glib support probe
3125 if test "$mingw32" = yes; then
3126 glib_req_ver=2.30
3127 else
3128 glib_req_ver=2.22
3130 glib_modules=gthread-2.0
3131 if test "$modules" = yes; then
3132 glib_modules="$glib_modules gmodule-2.0"
3135 # This workaround is required due to a bug in pkg-config file for glib as it
3136 # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
3138 if test "$static" = yes -a "$mingw32" = yes; then
3139 QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS"
3142 for i in $glib_modules; do
3143 if $pkg_config --atleast-version=$glib_req_ver $i; then
3144 glib_cflags=$($pkg_config --cflags $i)
3145 glib_libs=$($pkg_config --libs $i)
3146 QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
3147 LIBS="$glib_libs $LIBS"
3148 libs_qga="$glib_libs $libs_qga"
3149 else
3150 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
3152 done
3154 # Sanity check that the current size_t matches the
3155 # size that glib thinks it should be. This catches
3156 # problems on multi-arch where people try to build
3157 # 32-bit QEMU while pointing at 64-bit glib headers
3158 cat > $TMPC <<EOF
3159 #include <glib.h>
3160 #include <unistd.h>
3162 #define QEMU_BUILD_BUG_ON(x) \
3163 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
3165 int main(void) {
3166 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
3167 return 0;
3171 if ! compile_prog "$CFLAGS" "$LIBS" ; then
3172 error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
3173 "You probably need to set PKG_CONFIG_LIBDIR"\
3174 "to point to the right pkg-config files for your"\
3175 "build target"
3178 # g_test_trap_subprocess added in 2.38. Used by some tests.
3179 glib_subprocess=yes
3180 if ! $pkg_config --atleast-version=2.38 glib-2.0; then
3181 glib_subprocess=no
3184 # Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage
3185 cat > $TMPC << EOF
3186 #include <glib.h>
3187 int main(void) { return 0; }
3189 if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
3190 if cc_has_warning_flag "-Wno-unknown-attributes"; then
3191 glib_cflags="-Wno-unknown-attributes $glib_cflags"
3192 CFLAGS="-Wno-unknown-attributes $CFLAGS"
3196 #########################################
3197 # zlib check
3199 if test "$zlib" != "no" ; then
3200 if $pkg_config --exists zlib; then
3201 zlib_cflags=$($pkg_config --cflags zlib)
3202 zlib_libs=$($pkg_config --libs zlib)
3203 QEMU_CFLAGS="$zlib_cflags $QEMU_CFLAGS"
3204 LIBS="$zlib_libs $LIBS"
3205 else
3206 cat > $TMPC << EOF
3207 #include <zlib.h>
3208 int main(void) { zlibVersion(); return 0; }
3210 if compile_prog "" "-lz" ; then
3211 LIBS="$LIBS -lz"
3212 else
3213 error_exit "zlib check failed" \
3214 "Make sure to have the zlib libs and headers installed."
3219 ##########################################
3220 # SHA command probe for modules
3221 if test "$modules" = yes; then
3222 shacmd_probe="sha1sum sha1 shasum"
3223 for c in $shacmd_probe; do
3224 if has $c; then
3225 shacmd="$c"
3226 break
3228 done
3229 if test "$shacmd" = ""; then
3230 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
3234 ##########################################
3235 # pixman support probe
3237 if test "$pixman" = ""; then
3238 if test "$want_tools" = "no" -a "$softmmu" = "no"; then
3239 pixman="none"
3240 elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
3241 pixman="system"
3242 else
3243 pixman="internal"
3246 if test "$pixman" = "none"; then
3247 if test "$want_tools" != "no" -o "$softmmu" != "no"; then
3248 error_exit "pixman disabled but system emulation or tools build" \
3249 "enabled. You can turn off pixman only if you also" \
3250 "disable all system emulation targets and the tools" \
3251 "build with '--disable-tools --disable-system'."
3253 pixman_cflags=
3254 pixman_libs=
3255 elif test "$pixman" = "system"; then
3256 # pixman version has been checked above
3257 pixman_cflags=$($pkg_config --cflags pixman-1)
3258 pixman_libs=$($pkg_config --libs pixman-1)
3259 else
3260 if test ! -d ${source_path}/pixman/pixman; then
3261 error_exit "pixman >= 0.21.8 not present. Your options:" \
3262 " (1) Preferred: Install the pixman devel package (any recent" \
3263 " distro should have packages as Xorg needs pixman too)." \
3264 " (2) Fetch the pixman submodule, using:" \
3265 " git submodule update --init pixman"
3267 mkdir -p pixman/pixman
3268 pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
3269 pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
3272 ##########################################
3273 # libcap probe
3275 if test "$cap" != "no" ; then
3276 cat > $TMPC <<EOF
3277 #include <stdio.h>
3278 #include <sys/capability.h>
3279 int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
3281 if compile_prog "" "-lcap" ; then
3282 cap=yes
3283 else
3284 cap=no
3288 ##########################################
3289 # pthread probe
3290 PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
3292 pthread=no
3293 cat > $TMPC << EOF
3294 #include <pthread.h>
3295 static void *f(void *p) { return NULL; }
3296 int main(void) {
3297 pthread_t thread;
3298 pthread_create(&thread, 0, f, 0);
3299 return 0;
3302 if compile_prog "" "" ; then
3303 pthread=yes
3304 else
3305 for pthread_lib in $PTHREADLIBS_LIST; do
3306 if compile_prog "" "$pthread_lib" ; then
3307 pthread=yes
3308 found=no
3309 for lib_entry in $LIBS; do
3310 if test "$lib_entry" = "$pthread_lib"; then
3311 found=yes
3312 break
3314 done
3315 if test "$found" = "no"; then
3316 LIBS="$pthread_lib $LIBS"
3318 PTHREAD_LIB="$pthread_lib"
3319 break
3321 done
3324 if test "$mingw32" != yes -a "$pthread" = no; then
3325 error_exit "pthread check failed" \
3326 "Make sure to have the pthread libs and headers installed."
3329 # check for pthread_setname_np
3330 pthread_setname_np=no
3331 cat > $TMPC << EOF
3332 #include <pthread.h>
3334 static void *f(void *p) { return NULL; }
3335 int main(void)
3337 pthread_t thread;
3338 pthread_create(&thread, 0, f, 0);
3339 pthread_setname_np(thread, "QEMU");
3340 return 0;
3343 if compile_prog "" "$pthread_lib" ; then
3344 pthread_setname_np=yes
3347 ##########################################
3348 # rbd probe
3349 if test "$rbd" != "no" ; then
3350 cat > $TMPC <<EOF
3351 #include <stdio.h>
3352 #include <rbd/librbd.h>
3353 int main(void) {
3354 rados_t cluster;
3355 rados_create(&cluster, NULL);
3356 return 0;
3359 rbd_libs="-lrbd -lrados"
3360 if compile_prog "" "$rbd_libs" ; then
3361 rbd=yes
3362 else
3363 if test "$rbd" = "yes" ; then
3364 feature_not_found "rados block device" "Install librbd/ceph devel"
3366 rbd=no
3370 ##########################################
3371 # libssh2 probe
3372 min_libssh2_version=1.2.8
3373 if test "$libssh2" != "no" ; then
3374 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
3375 libssh2_cflags=$($pkg_config libssh2 --cflags)
3376 libssh2_libs=$($pkg_config libssh2 --libs)
3377 libssh2=yes
3378 else
3379 if test "$libssh2" = "yes" ; then
3380 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
3382 libssh2=no
3386 ##########################################
3387 # libssh2_sftp_fsync probe
3389 if test "$libssh2" = "yes"; then
3390 cat > $TMPC <<EOF
3391 #include <stdio.h>
3392 #include <libssh2.h>
3393 #include <libssh2_sftp.h>
3394 int main(void) {
3395 LIBSSH2_SESSION *session;
3396 LIBSSH2_SFTP *sftp;
3397 LIBSSH2_SFTP_HANDLE *sftp_handle;
3398 session = libssh2_session_init ();
3399 sftp = libssh2_sftp_init (session);
3400 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
3401 libssh2_sftp_fsync (sftp_handle);
3402 return 0;
3405 # libssh2_cflags/libssh2_libs defined in previous test.
3406 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
3407 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
3411 ##########################################
3412 # linux-aio probe
3414 if test "$linux_aio" != "no" ; then
3415 cat > $TMPC <<EOF
3416 #include <libaio.h>
3417 #include <sys/eventfd.h>
3418 #include <stddef.h>
3419 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
3421 if compile_prog "" "-laio" ; then
3422 linux_aio=yes
3423 else
3424 if test "$linux_aio" = "yes" ; then
3425 feature_not_found "linux AIO" "Install libaio devel"
3427 linux_aio=no
3431 ##########################################
3432 # TPM passthrough is only on x86 Linux
3434 if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
3435 tpm_passthrough=$tpm
3436 else
3437 tpm_passthrough=no
3440 ##########################################
3441 # attr probe
3443 if test "$attr" != "no" ; then
3444 cat > $TMPC <<EOF
3445 #include <stdio.h>
3446 #include <sys/types.h>
3447 #ifdef CONFIG_LIBATTR
3448 #include <attr/xattr.h>
3449 #else
3450 #include <sys/xattr.h>
3451 #endif
3452 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
3454 if compile_prog "" "" ; then
3455 attr=yes
3456 # Older distros have <attr/xattr.h>, and need -lattr:
3457 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
3458 attr=yes
3459 LIBS="-lattr $LIBS"
3460 libattr=yes
3461 else
3462 if test "$attr" = "yes" ; then
3463 feature_not_found "ATTR" "Install libc6 or libattr devel"
3465 attr=no
3469 ##########################################
3470 # iovec probe
3471 cat > $TMPC <<EOF
3472 #include <sys/types.h>
3473 #include <sys/uio.h>
3474 #include <unistd.h>
3475 int main(void) { return sizeof(struct iovec); }
3477 iovec=no
3478 if compile_prog "" "" ; then
3479 iovec=yes
3482 ##########################################
3483 # preadv probe
3484 cat > $TMPC <<EOF
3485 #include <sys/types.h>
3486 #include <sys/uio.h>
3487 #include <unistd.h>
3488 int main(void) { return preadv(0, 0, 0, 0); }
3490 preadv=no
3491 if compile_prog "" "" ; then
3492 preadv=yes
3495 ##########################################
3496 # fdt probe
3497 # fdt support is mandatory for at least some target architectures,
3498 # so insist on it if we're building those system emulators.
3499 fdt_required=no
3500 for target in $target_list; do
3501 case $target in
3502 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu)
3503 fdt_required=yes
3505 esac
3506 done
3508 if test "$fdt_required" = "yes"; then
3509 if test "$fdt" = "no"; then
3510 error_exit "fdt disabled but some requested targets require it." \
3511 "You can turn off fdt only if you also disable all the system emulation" \
3512 "targets which need it (by specifying a cut down --target-list)."
3514 fdt=yes
3517 if test "$fdt" != "no" ; then
3518 fdt_libs="-lfdt"
3519 # explicitly check for libfdt_env.h as it is missing in some stable installs
3520 # and test for required functions to make sure we are on a version >= 1.4.2
3521 cat > $TMPC << EOF
3522 #include <libfdt.h>
3523 #include <libfdt_env.h>
3524 int main(void) { fdt_first_subnode(0, 0); return 0; }
3526 if compile_prog "" "$fdt_libs" ; then
3527 # system DTC is good - use it
3528 fdt=yes
3529 elif test -d ${source_path}/dtc/libfdt ; then
3530 # have submodule DTC - use it
3531 fdt=yes
3532 dtc_internal="yes"
3533 mkdir -p dtc
3534 if [ "$pwd_is_source_path" != "y" ] ; then
3535 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
3536 symlink "$source_path/dtc/scripts" "dtc/scripts"
3538 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
3539 fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
3540 elif test "$fdt" = "yes" ; then
3541 # have neither and want - prompt for system/submodule install
3542 error_exit "DTC (libfdt) version >= 1.4.2 not present. Your options:" \
3543 " (1) Preferred: Install the DTC (libfdt) devel package" \
3544 " (2) Fetch the DTC submodule, using:" \
3545 " git submodule update --init dtc"
3546 else
3547 # don't have and don't want
3548 fdt_libs=
3549 fdt=no
3553 libs_softmmu="$libs_softmmu $fdt_libs"
3555 ##########################################
3556 # opengl probe (for sdl2, gtk, milkymist-tmu2)
3558 if test "$opengl" != "no" ; then
3559 opengl_pkgs="epoxy libdrm gbm"
3560 if $pkg_config $opengl_pkgs x11; then
3561 opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
3562 opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
3563 opengl=yes
3564 if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
3565 gtk_gl="yes"
3567 QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
3568 else
3569 if test "$opengl" = "yes" ; then
3570 feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
3572 opengl_cflags=""
3573 opengl_libs=""
3574 opengl=no
3578 if test "$opengl" = "yes"; then
3579 cat > $TMPC << EOF
3580 #include <epoxy/egl.h>
3581 #ifndef EGL_MESA_image_dma_buf_export
3582 # error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
3583 #endif
3584 int main(void) { return 0; }
3586 if compile_prog "" "" ; then
3587 opengl_dmabuf=yes
3592 ##########################################
3593 # glusterfs probe
3594 if test "$glusterfs" != "no" ; then
3595 if $pkg_config --atleast-version=3 glusterfs-api; then
3596 glusterfs="yes"
3597 glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
3598 glusterfs_libs=$($pkg_config --libs glusterfs-api)
3599 if $pkg_config --atleast-version=4 glusterfs-api; then
3600 glusterfs_xlator_opt="yes"
3602 if $pkg_config --atleast-version=5 glusterfs-api; then
3603 glusterfs_discard="yes"
3605 if $pkg_config --atleast-version=6 glusterfs-api; then
3606 glusterfs_fallocate="yes"
3607 glusterfs_zerofill="yes"
3609 else
3610 if test "$glusterfs" = "yes" ; then
3611 feature_not_found "GlusterFS backend support" \
3612 "Install glusterfs-api devel >= 3"
3614 glusterfs="no"
3618 # Check for inotify functions when we are building linux-user
3619 # emulator. This is done because older glibc versions don't
3620 # have syscall stubs for these implemented. In that case we
3621 # don't provide them even if kernel supports them.
3623 inotify=no
3624 cat > $TMPC << EOF
3625 #include <sys/inotify.h>
3628 main(void)
3630 /* try to start inotify */
3631 return inotify_init();
3634 if compile_prog "" "" ; then
3635 inotify=yes
3638 inotify1=no
3639 cat > $TMPC << EOF
3640 #include <sys/inotify.h>
3643 main(void)
3645 /* try to start inotify */
3646 return inotify_init1(0);
3649 if compile_prog "" "" ; then
3650 inotify1=yes
3653 # check if pipe2 is there
3654 pipe2=no
3655 cat > $TMPC << EOF
3656 #include <unistd.h>
3657 #include <fcntl.h>
3659 int main(void)
3661 int pipefd[2];
3662 return pipe2(pipefd, O_CLOEXEC);
3665 if compile_prog "" "" ; then
3666 pipe2=yes
3669 # check if accept4 is there
3670 accept4=no
3671 cat > $TMPC << EOF
3672 #include <sys/socket.h>
3673 #include <stddef.h>
3675 int main(void)
3677 accept4(0, NULL, NULL, SOCK_CLOEXEC);
3678 return 0;
3681 if compile_prog "" "" ; then
3682 accept4=yes
3685 # check if tee/splice is there. vmsplice was added same time.
3686 splice=no
3687 cat > $TMPC << EOF
3688 #include <unistd.h>
3689 #include <fcntl.h>
3690 #include <limits.h>
3692 int main(void)
3694 int len, fd = 0;
3695 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
3696 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
3697 return 0;
3700 if compile_prog "" "" ; then
3701 splice=yes
3704 ##########################################
3705 # libnuma probe
3707 if test "$numa" != "no" ; then
3708 cat > $TMPC << EOF
3709 #include <numa.h>
3710 int main(void) { return numa_available(); }
3713 if compile_prog "" "-lnuma" ; then
3714 numa=yes
3715 libs_softmmu="-lnuma $libs_softmmu"
3716 else
3717 if test "$numa" = "yes" ; then
3718 feature_not_found "numa" "install numactl devel"
3720 numa=no
3724 if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
3725 echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
3726 exit 1
3729 ##########################################
3730 # tcmalloc probe
3732 if test "$tcmalloc" = "yes" ; then
3733 cat > $TMPC << EOF
3734 #include <stdlib.h>
3735 int main(void) { malloc(1); return 0; }
3738 if compile_prog "" "-ltcmalloc" ; then
3739 LIBS="-ltcmalloc $LIBS"
3740 else
3741 feature_not_found "tcmalloc" "install gperftools devel"
3745 ##########################################
3746 # jemalloc probe
3748 if test "$jemalloc" = "yes" ; then
3749 cat > $TMPC << EOF
3750 #include <stdlib.h>
3751 int main(void) { malloc(1); return 0; }
3754 if compile_prog "" "-ljemalloc" ; then
3755 LIBS="-ljemalloc $LIBS"
3756 else
3757 feature_not_found "jemalloc" "install jemalloc devel"
3761 ##########################################
3762 # signalfd probe
3763 signalfd="no"
3764 cat > $TMPC << EOF
3765 #include <unistd.h>
3766 #include <sys/syscall.h>
3767 #include <signal.h>
3768 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
3771 if compile_prog "" "" ; then
3772 signalfd=yes
3775 # check if eventfd is supported
3776 eventfd=no
3777 cat > $TMPC << EOF
3778 #include <sys/eventfd.h>
3780 int main(void)
3782 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
3785 if compile_prog "" "" ; then
3786 eventfd=yes
3789 # check if memfd is supported
3790 memfd=no
3791 cat > $TMPC << EOF
3792 #include <sys/memfd.h>
3794 int main(void)
3796 return memfd_create("foo", MFD_ALLOW_SEALING);
3799 if compile_prog "" "" ; then
3800 memfd=yes
3805 # check for fallocate
3806 fallocate=no
3807 cat > $TMPC << EOF
3808 #include <fcntl.h>
3810 int main(void)
3812 fallocate(0, 0, 0, 0);
3813 return 0;
3816 if compile_prog "" "" ; then
3817 fallocate=yes
3820 # check for fallocate hole punching
3821 fallocate_punch_hole=no
3822 cat > $TMPC << EOF
3823 #include <fcntl.h>
3824 #include <linux/falloc.h>
3826 int main(void)
3828 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
3829 return 0;
3832 if compile_prog "" "" ; then
3833 fallocate_punch_hole=yes
3836 # check that fallocate supports range zeroing inside the file
3837 fallocate_zero_range=no
3838 cat > $TMPC << EOF
3839 #include <fcntl.h>
3840 #include <linux/falloc.h>
3842 int main(void)
3844 fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0);
3845 return 0;
3848 if compile_prog "" "" ; then
3849 fallocate_zero_range=yes
3852 # check for posix_fallocate
3853 posix_fallocate=no
3854 cat > $TMPC << EOF
3855 #include <fcntl.h>
3857 int main(void)
3859 posix_fallocate(0, 0, 0);
3860 return 0;
3863 if compile_prog "" "" ; then
3864 posix_fallocate=yes
3867 # check for sync_file_range
3868 sync_file_range=no
3869 cat > $TMPC << EOF
3870 #include <fcntl.h>
3872 int main(void)
3874 sync_file_range(0, 0, 0, 0);
3875 return 0;
3878 if compile_prog "" "" ; then
3879 sync_file_range=yes
3882 # check for linux/fiemap.h and FS_IOC_FIEMAP
3883 fiemap=no
3884 cat > $TMPC << EOF
3885 #include <sys/ioctl.h>
3886 #include <linux/fs.h>
3887 #include <linux/fiemap.h>
3889 int main(void)
3891 ioctl(0, FS_IOC_FIEMAP, 0);
3892 return 0;
3895 if compile_prog "" "" ; then
3896 fiemap=yes
3899 # check for dup3
3900 dup3=no
3901 cat > $TMPC << EOF
3902 #include <unistd.h>
3904 int main(void)
3906 dup3(0, 0, 0);
3907 return 0;
3910 if compile_prog "" "" ; then
3911 dup3=yes
3914 # check for ppoll support
3915 ppoll=no
3916 cat > $TMPC << EOF
3917 #include <poll.h>
3919 int main(void)
3921 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
3922 ppoll(&pfd, 1, 0, 0);
3923 return 0;
3926 if compile_prog "" "" ; then
3927 ppoll=yes
3930 # check for prctl(PR_SET_TIMERSLACK , ... ) support
3931 prctl_pr_set_timerslack=no
3932 cat > $TMPC << EOF
3933 #include <sys/prctl.h>
3935 int main(void)
3937 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
3938 return 0;
3941 if compile_prog "" "" ; then
3942 prctl_pr_set_timerslack=yes
3945 # check for epoll support
3946 epoll=no
3947 cat > $TMPC << EOF
3948 #include <sys/epoll.h>
3950 int main(void)
3952 epoll_create(0);
3953 return 0;
3956 if compile_prog "" "" ; then
3957 epoll=yes
3960 # epoll_create1 is a later addition
3961 # so we must check separately for its presence
3962 epoll_create1=no
3963 cat > $TMPC << EOF
3964 #include <sys/epoll.h>
3966 int main(void)
3968 /* Note that we use epoll_create1 as a value, not as
3969 * a function being called. This is necessary so that on
3970 * old SPARC glibc versions where the function was present in
3971 * the library but not declared in the header file we will
3972 * fail the configure check. (Otherwise we will get a compiler
3973 * warning but not an error, and will proceed to fail the
3974 * qemu compile where we compile with -Werror.)
3976 return (int)(uintptr_t)&epoll_create1;
3979 if compile_prog "" "" ; then
3980 epoll_create1=yes
3983 # check for sendfile support
3984 sendfile=no
3985 cat > $TMPC << EOF
3986 #include <sys/sendfile.h>
3988 int main(void)
3990 return sendfile(0, 0, 0, 0);
3993 if compile_prog "" "" ; then
3994 sendfile=yes
3997 # check for timerfd support (glibc 2.8 and newer)
3998 timerfd=no
3999 cat > $TMPC << EOF
4000 #include <sys/timerfd.h>
4002 int main(void)
4004 return(timerfd_create(CLOCK_REALTIME, 0));
4007 if compile_prog "" "" ; then
4008 timerfd=yes
4011 # check for setns and unshare support
4012 setns=no
4013 cat > $TMPC << EOF
4014 #include <sched.h>
4016 int main(void)
4018 int ret;
4019 ret = setns(0, 0);
4020 ret = unshare(0);
4021 return ret;
4024 if compile_prog "" "" ; then
4025 setns=yes
4028 # clock_adjtime probe
4029 clock_adjtime=no
4030 cat > $TMPC <<EOF
4031 #include <time.h>
4033 int main(void)
4035 return clock_adjtime(0, 0);
4038 clock_adjtime=no
4039 if compile_prog "" "" ; then
4040 clock_adjtime=yes
4043 # syncfs probe
4044 syncfs=no
4045 cat > $TMPC <<EOF
4046 #include <unistd.h>
4048 int main(void)
4050 return syncfs(0);
4053 syncfs=no
4054 if compile_prog "" "" ; then
4055 syncfs=yes
4058 # Check if tools are available to build documentation.
4059 if test "$docs" != "no" ; then
4060 if has makeinfo && has pod2man; then
4061 docs=yes
4062 else
4063 if test "$docs" = "yes" ; then
4064 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
4066 docs=no
4070 if test "$want_tools" = ""; then
4071 if test $(expr "$target_list" : ".*softmmu.*") != 0; then
4072 want_tools=yes
4073 else
4074 want_tools=no
4078 # Search for bswap_32 function
4079 byteswap_h=no
4080 cat > $TMPC << EOF
4081 #include <byteswap.h>
4082 int main(void) { return bswap_32(0); }
4084 if compile_prog "" "" ; then
4085 byteswap_h=yes
4088 # Search for bswap32 function
4089 bswap_h=no
4090 cat > $TMPC << EOF
4091 #include <sys/endian.h>
4092 #include <sys/types.h>
4093 #include <machine/bswap.h>
4094 int main(void) { return bswap32(0); }
4096 if compile_prog "" "" ; then
4097 bswap_h=yes
4100 ##########################################
4101 # Do we have libiscsi >= 1.9.0
4102 if test "$libiscsi" != "no" ; then
4103 if $pkg_config --atleast-version=1.9.0 libiscsi; then
4104 libiscsi="yes"
4105 libiscsi_cflags=$($pkg_config --cflags libiscsi)
4106 libiscsi_libs=$($pkg_config --libs libiscsi)
4107 else
4108 if test "$libiscsi" = "yes" ; then
4109 feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
4111 libiscsi="no"
4115 ##########################################
4116 # Do we need libm
4117 cat > $TMPC << EOF
4118 #include <math.h>
4119 int main(int argc, char **argv) { return isnan(sin((double)argc)); }
4121 if compile_prog "" "" ; then
4123 elif compile_prog "" "-lm" ; then
4124 LIBS="-lm $LIBS"
4125 libs_qga="-lm $libs_qga"
4126 else
4127 error_exit "libm check failed"
4130 ##########################################
4131 # Do we need librt
4132 # uClibc provides 2 versions of clock_gettime(), one with realtime
4133 # support and one without. This means that the clock_gettime() don't
4134 # need -lrt. We still need it for timer_create() so we check for this
4135 # function in addition.
4136 cat > $TMPC <<EOF
4137 #include <signal.h>
4138 #include <time.h>
4139 int main(void) {
4140 timer_create(CLOCK_REALTIME, NULL, NULL);
4141 return clock_gettime(CLOCK_REALTIME, NULL);
4145 if compile_prog "" "" ; then
4147 # we need pthread for static linking. use previous pthread test result
4148 elif compile_prog "" "$pthread_lib -lrt" ; then
4149 LIBS="$LIBS -lrt"
4150 libs_qga="$libs_qga -lrt"
4153 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
4154 "$aix" != "yes" -a "$haiku" != "yes" ; then
4155 libs_softmmu="-lutil $libs_softmmu"
4158 ##########################################
4159 # spice probe
4160 if test "$spice" != "no" ; then
4161 cat > $TMPC << EOF
4162 #include <spice.h>
4163 int main(void) { spice_server_new(); return 0; }
4165 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
4166 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
4167 if $pkg_config --atleast-version=0.12.0 spice-server && \
4168 $pkg_config --atleast-version=0.12.3 spice-protocol && \
4169 compile_prog "$spice_cflags" "$spice_libs" ; then
4170 spice="yes"
4171 libs_softmmu="$libs_softmmu $spice_libs"
4172 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
4173 spice_protocol_version=$($pkg_config --modversion spice-protocol)
4174 spice_server_version=$($pkg_config --modversion spice-server)
4175 else
4176 if test "$spice" = "yes" ; then
4177 feature_not_found "spice" \
4178 "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel"
4180 spice="no"
4184 # check for smartcard support
4185 smartcard_cflags=""
4186 if test "$smartcard" != "no"; then
4187 if $pkg_config libcacard; then
4188 libcacard_cflags=$($pkg_config --cflags libcacard)
4189 libcacard_libs=$($pkg_config --libs libcacard)
4190 QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
4191 libs_softmmu="$libs_softmmu $libcacard_libs"
4192 smartcard="yes"
4193 else
4194 if test "$smartcard" = "yes"; then
4195 feature_not_found "smartcard" "Install libcacard devel"
4197 smartcard="no"
4201 # check for libusb
4202 if test "$libusb" != "no" ; then
4203 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
4204 libusb="yes"
4205 libusb_cflags=$($pkg_config --cflags libusb-1.0)
4206 libusb_libs=$($pkg_config --libs libusb-1.0)
4207 QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
4208 libs_softmmu="$libs_softmmu $libusb_libs"
4209 else
4210 if test "$libusb" = "yes"; then
4211 feature_not_found "libusb" "Install libusb devel >= 1.0.13"
4213 libusb="no"
4217 # check for usbredirparser for usb network redirection support
4218 if test "$usb_redir" != "no" ; then
4219 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
4220 usb_redir="yes"
4221 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
4222 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
4223 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
4224 libs_softmmu="$libs_softmmu $usb_redir_libs"
4225 else
4226 if test "$usb_redir" = "yes"; then
4227 feature_not_found "usb-redir" "Install usbredir devel"
4229 usb_redir="no"
4233 ##########################################
4234 # check if we have VSS SDK headers for win
4236 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
4237 case "$vss_win32_sdk" in
4238 "") vss_win32_include="-isystem $source_path" ;;
4239 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
4240 # handle path with spaces. So we symlink the headers into ".sdk/vss".
4241 vss_win32_include="-isystem $source_path/.sdk/vss"
4242 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
4244 *) vss_win32_include="-isystem $vss_win32_sdk"
4245 esac
4246 cat > $TMPC << EOF
4247 #define __MIDL_user_allocate_free_DEFINED__
4248 #include <inc/win2003/vss.h>
4249 int main(void) { return VSS_CTX_BACKUP; }
4251 if compile_prog "$vss_win32_include" "" ; then
4252 guest_agent_with_vss="yes"
4253 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
4254 libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
4255 qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
4256 else
4257 if test "$vss_win32_sdk" != "" ; then
4258 echo "ERROR: Please download and install Microsoft VSS SDK:"
4259 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
4260 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
4261 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
4262 echo "ERROR: The headers are extracted in the directory \`inc'."
4263 feature_not_found "VSS support"
4265 guest_agent_with_vss="no"
4269 ##########################################
4270 # lookup Windows platform SDK (if not specified)
4271 # The SDK is needed only to build .tlb (type library) file of guest agent
4272 # VSS provider from the source. It is usually unnecessary because the
4273 # pre-compiled .tlb file is included.
4275 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
4276 if test -z "$win_sdk"; then
4277 programfiles="$PROGRAMFILES"
4278 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
4279 if test -n "$programfiles"; then
4280 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
4281 else
4282 feature_not_found "Windows SDK"
4284 elif test "$win_sdk" = "no"; then
4285 win_sdk=""
4289 ##########################################
4290 # check if mingw environment provides a recent ntddscsi.h
4291 if test "$mingw32" = "yes" -a "$guest_agent" != "no"; then
4292 cat > $TMPC << EOF
4293 #include <windows.h>
4294 #include <ntddscsi.h>
4295 int main(void) {
4296 #if !defined(IOCTL_SCSI_GET_ADDRESS)
4297 #error Missing required ioctl definitions
4298 #endif
4299 SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
4300 return addr.Lun;
4303 if compile_prog "" "" ; then
4304 guest_agent_ntddscsi=yes
4305 libs_qga="-lsetupapi $libs_qga"
4309 ##########################################
4310 # virgl renderer probe
4312 if test "$virglrenderer" != "no" ; then
4313 cat > $TMPC << EOF
4314 #include <virglrenderer.h>
4315 int main(void) { virgl_renderer_poll(); return 0; }
4317 virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null)
4318 virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null)
4319 if $pkg_config virglrenderer >/dev/null 2>&1 && \
4320 compile_prog "$virgl_cflags" "$virgl_libs" ; then
4321 virglrenderer="yes"
4322 else
4323 if test "$virglrenderer" = "yes" ; then
4324 feature_not_found "virglrenderer"
4326 virglrenderer="no"
4330 ##########################################
4331 # check if we have fdatasync
4333 fdatasync=no
4334 cat > $TMPC << EOF
4335 #include <unistd.h>
4336 int main(void) {
4337 #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
4338 return fdatasync(0);
4339 #else
4340 #error Not supported
4341 #endif
4344 if compile_prog "" "" ; then
4345 fdatasync=yes
4348 ##########################################
4349 # check if we have madvise
4351 madvise=no
4352 cat > $TMPC << EOF
4353 #include <sys/types.h>
4354 #include <sys/mman.h>
4355 #include <stddef.h>
4356 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
4358 if compile_prog "" "" ; then
4359 madvise=yes
4362 ##########################################
4363 # check if we have posix_madvise
4365 posix_madvise=no
4366 cat > $TMPC << EOF
4367 #include <sys/mman.h>
4368 #include <stddef.h>
4369 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
4371 if compile_prog "" "" ; then
4372 posix_madvise=yes
4375 ##########################################
4376 # check if we have posix_syslog
4378 posix_syslog=no
4379 cat > $TMPC << EOF
4380 #include <syslog.h>
4381 int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; }
4383 if compile_prog "" "" ; then
4384 posix_syslog=yes
4387 ##########################################
4388 # check if trace backend exists
4390 $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
4391 if test "$?" -ne 0 ; then
4392 error_exit "invalid trace backends" \
4393 "Please choose supported trace backends."
4396 ##########################################
4397 # For 'ust' backend, test if ust headers are present
4398 if have_backend "ust"; then
4399 cat > $TMPC << EOF
4400 #include <lttng/tracepoint.h>
4401 int main(void) { return 0; }
4403 if compile_prog "" "-Wl,--no-as-needed -ldl" ; then
4404 if $pkg_config lttng-ust --exists; then
4405 lttng_ust_libs=$($pkg_config --libs lttng-ust)
4406 else
4407 lttng_ust_libs="-llttng-ust -ldl"
4409 if $pkg_config liburcu-bp --exists; then
4410 urcu_bp_libs=$($pkg_config --libs liburcu-bp)
4411 else
4412 urcu_bp_libs="-lurcu-bp"
4415 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
4416 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
4417 else
4418 error_exit "Trace backend 'ust' missing lttng-ust header files"
4422 ##########################################
4423 # For 'dtrace' backend, test if 'dtrace' command is present
4424 if have_backend "dtrace"; then
4425 if ! has 'dtrace' ; then
4426 error_exit "dtrace command is not found in PATH $PATH"
4428 trace_backend_stap="no"
4429 if has 'stap' ; then
4430 trace_backend_stap="yes"
4434 ##########################################
4435 # check and set a backend for coroutine
4437 # We prefer ucontext, but it's not always possible. The fallback
4438 # is sigcontext. On Windows the only valid backend is the Windows
4439 # specific one.
4441 ucontext_works=no
4442 if test "$darwin" != "yes"; then
4443 cat > $TMPC << EOF
4444 #include <ucontext.h>
4445 #ifdef __stub_makecontext
4446 #error Ignoring glibc stub makecontext which will always fail
4447 #endif
4448 int main(void) { makecontext(0, 0, 0); return 0; }
4450 if compile_prog "" "" ; then
4451 ucontext_works=yes
4455 if test "$coroutine" = ""; then
4456 if test "$mingw32" = "yes"; then
4457 coroutine=win32
4458 elif test "$ucontext_works" = "yes"; then
4459 coroutine=ucontext
4460 else
4461 coroutine=sigaltstack
4463 else
4464 case $coroutine in
4465 windows)
4466 if test "$mingw32" != "yes"; then
4467 error_exit "'windows' coroutine backend only valid for Windows"
4469 # Unfortunately the user visible backend name doesn't match the
4470 # coroutine-*.c filename for this case, so we have to adjust it here.
4471 coroutine=win32
4473 ucontext)
4474 if test "$ucontext_works" != "yes"; then
4475 feature_not_found "ucontext"
4478 sigaltstack)
4479 if test "$mingw32" = "yes"; then
4480 error_exit "only the 'windows' coroutine backend is valid for Windows"
4484 error_exit "unknown coroutine backend $coroutine"
4486 esac
4489 if test "$coroutine_pool" = ""; then
4490 if test "$coroutine" = "gthread" -o "$coroutine" = "win32"; then
4491 coroutine_pool=no
4492 else
4493 coroutine_pool=yes
4496 if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
4497 error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
4500 if test "$debug_stack_usage" = "yes"; then
4501 if test "$cpu" = "ia64" -o "$cpu" = "hppa"; then
4502 error_exit "stack usage debugging is not supported for $cpu"
4504 if test "$coroutine_pool" = "yes"; then
4505 echo "WARN: disabling coroutine pool for stack usage debugging"
4506 coroutine_pool=no
4511 ##########################################
4512 # check if we have open_by_handle_at
4514 open_by_handle_at=no
4515 cat > $TMPC << EOF
4516 #include <fcntl.h>
4517 #if !defined(AT_EMPTY_PATH)
4518 # error missing definition
4519 #else
4520 int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
4521 #endif
4523 if compile_prog "" "" ; then
4524 open_by_handle_at=yes
4527 ########################################
4528 # check if we have linux/magic.h
4530 linux_magic_h=no
4531 cat > $TMPC << EOF
4532 #include <linux/magic.h>
4533 int main(void) {
4534 return 0;
4537 if compile_prog "" "" ; then
4538 linux_magic_h=yes
4541 ########################################
4542 # check whether we can disable warning option with a pragma (this is needed
4543 # to silence warnings in the headers of some versions of external libraries).
4544 # This test has to be compiled with -Werror as otherwise an unknown pragma is
4545 # only a warning.
4547 # If we can't selectively disable warning in the code, disable -Werror so that
4548 # the build doesn't fail anyway.
4550 pragma_disable_unused_but_set=no
4551 cat > $TMPC << EOF
4552 #pragma GCC diagnostic push
4553 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
4554 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
4555 #pragma GCC diagnostic pop
4557 int main(void) {
4558 return 0;
4561 if compile_prog "-Werror" "" ; then
4562 pragma_diagnostic_available=yes
4565 ########################################
4566 # check if we have valgrind/valgrind.h
4568 valgrind_h=no
4569 cat > $TMPC << EOF
4570 #include <valgrind/valgrind.h>
4571 int main(void) {
4572 return 0;
4575 if compile_prog "" "" ; then
4576 valgrind_h=yes
4579 ########################################
4580 # check if environ is declared
4582 has_environ=no
4583 cat > $TMPC << EOF
4584 #include <unistd.h>
4585 int main(void) {
4586 environ = 0;
4587 return 0;
4590 if compile_prog "" "" ; then
4591 has_environ=yes
4594 ########################################
4595 # check if cpuid.h is usable.
4597 cpuid_h=no
4598 cat > $TMPC << EOF
4599 #include <cpuid.h>
4600 int main(void) {
4601 unsigned a, b, c, d;
4602 int max = __get_cpuid_max(0, 0);
4604 if (max >= 1) {
4605 __cpuid(1, a, b, c, d);
4608 if (max >= 7) {
4609 __cpuid_count(7, 0, a, b, c, d);
4612 return 0;
4615 if compile_prog "" "" ; then
4616 cpuid_h=yes
4619 ########################################
4620 # check if __[u]int128_t is usable.
4622 int128=no
4623 cat > $TMPC << EOF
4624 #if defined(__clang_major__) && defined(__clang_minor__)
4625 # if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
4626 # error __int128_t does not work in CLANG before 3.2
4627 # endif
4628 #endif
4629 __int128_t a;
4630 __uint128_t b;
4631 int main (void) {
4632 a = a + b;
4633 b = a * b;
4634 a = a * a;
4635 return 0;
4638 if compile_prog "" "" ; then
4639 int128=yes
4642 #########################################
4643 # See if 128-bit atomic operations are supported.
4645 atomic128=no
4646 if test "$int128" = "yes"; then
4647 cat > $TMPC << EOF
4648 int main(void)
4650 unsigned __int128 x = 0, y = 0;
4651 y = __atomic_load_16(&x, 0);
4652 __atomic_store_16(&x, y, 0);
4653 __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0);
4654 return 0;
4657 if compile_prog "" "" ; then
4658 atomic128=yes
4662 #########################################
4663 # See if 64-bit atomic operations are supported.
4664 # Note that without __atomic builtins, we can only
4665 # assume atomic loads/stores max at pointer size.
4667 cat > $TMPC << EOF
4668 #include <stdint.h>
4669 int main(void)
4671 uint64_t x = 0, y = 0;
4672 #ifdef __ATOMIC_RELAXED
4673 y = __atomic_load_8(&x, 0);
4674 __atomic_store_8(&x, y, 0);
4675 __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
4676 __atomic_exchange_8(&x, y, 0);
4677 __atomic_fetch_add_8(&x, y, 0);
4678 #else
4679 typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
4680 __sync_lock_test_and_set(&x, y);
4681 __sync_val_compare_and_swap(&x, y, 0);
4682 __sync_fetch_and_add(&x, y);
4683 #endif
4684 return 0;
4687 if compile_prog "" "" ; then
4688 atomic64=yes
4691 ########################################
4692 # check if getauxval is available.
4694 getauxval=no
4695 cat > $TMPC << EOF
4696 #include <sys/auxv.h>
4697 int main(void) {
4698 return getauxval(AT_HWCAP) == 0;
4701 if compile_prog "" "" ; then
4702 getauxval=yes
4705 ########################################
4706 # check if ccache is interfering with
4707 # semantic analysis of macros
4709 unset CCACHE_CPP2
4710 ccache_cpp2=no
4711 cat > $TMPC << EOF
4712 static const int Z = 1;
4713 #define fn() ({ Z; })
4714 #define TAUT(X) ((X) == Z)
4715 #define PAREN(X, Y) (X == Y)
4716 #define ID(X) (X)
4717 int main(int argc, char *argv[])
4719 int x = 0, y = 0;
4720 x = ID(x);
4721 x = fn();
4722 fn();
4723 if (PAREN(x, y)) return 0;
4724 if (TAUT(Z)) return 0;
4725 return 0;
4729 if ! compile_object "-Werror"; then
4730 ccache_cpp2=yes
4733 #################################################
4734 # clang does not support glibc + FORTIFY_SOURCE.
4736 if test "$fortify_source" != "no"; then
4737 if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
4738 fortify_source="no";
4739 elif test -n "$cxx" &&
4740 echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then
4741 fortify_source="no";
4742 else
4743 fortify_source="yes"
4747 ##########################################
4748 # check if struct fsxattr is available via linux/fs.h
4750 have_fsxattr=no
4751 cat > $TMPC << EOF
4752 #include <linux/fs.h>
4753 struct fsxattr foo;
4754 int main(void) {
4755 return 0;
4758 if compile_prog "" "" ; then
4759 have_fsxattr=yes
4762 ##########################################
4763 # check if rtnetlink.h exists and is useful
4764 have_rtnetlink=no
4765 cat > $TMPC << EOF
4766 #include <linux/rtnetlink.h>
4767 int main(void) {
4768 return IFLA_PROTO_DOWN;
4771 if compile_prog "" "" ; then
4772 have_rtnetlink=yes
4775 ##########################################
4776 # check for usable AF_VSOCK environment
4777 have_af_vsock=no
4778 cat > $TMPC << EOF
4779 #include <errno.h>
4780 #include <sys/types.h>
4781 #include <sys/socket.h>
4782 #if !defined(AF_VSOCK)
4783 # error missing AF_VSOCK flag
4784 #endif
4785 #include <linux/vm_sockets.h>
4786 int main(void) {
4787 int sock, ret;
4788 struct sockaddr_vm svm;
4789 socklen_t len = sizeof(svm);
4790 sock = socket(AF_VSOCK, SOCK_STREAM, 0);
4791 ret = getpeername(sock, (struct sockaddr *)&svm, &len);
4792 if ((ret == -1) && (errno == ENOTCONN)) {
4793 return 0;
4795 return -1;
4798 if compile_prog "" "" ; then
4799 have_af_vsock=yes
4802 #################################################
4803 # Sparc implicitly links with --relax, which is
4804 # incompatible with -r, so --no-relax should be
4805 # given. It does no harm to give it on other
4806 # platforms too.
4808 # Note: the prototype is needed since QEMU_CFLAGS
4809 # contains -Wmissing-prototypes
4810 cat > $TMPC << EOF
4811 extern int foo(void);
4812 int foo(void) { return 0; }
4814 if ! compile_object ""; then
4815 error_exit "Failed to compile object file for LD_REL_FLAGS test"
4817 for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do
4818 if do_cc -nostdlib $i -o $TMPMO $TMPO; then
4819 LD_REL_FLAGS=$i
4820 break
4822 done
4823 if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then
4824 feature_not_found "modules" "Cannot find how to build relocatable objects"
4827 ##########################################
4828 # check for sysmacros.h
4830 have_sysmacros=no
4831 cat > $TMPC << EOF
4832 #include <sys/sysmacros.h>
4833 int main(void) {
4834 return makedev(0, 0);
4837 if compile_prog "" "" ; then
4838 have_sysmacros=yes
4841 ##########################################
4842 # Veritas HyperScale block driver VxHS
4843 # Check if libvxhs is installed
4845 if test "$vxhs" != "no" ; then
4846 cat > $TMPC <<EOF
4847 #include <stdint.h>
4848 #include <qnio/qnio_api.h>
4850 void *vxhs_callback;
4852 int main(void) {
4853 iio_init(QNIO_VERSION, vxhs_callback);
4854 return 0;
4857 vxhs_libs="-lvxhs -lssl"
4858 if compile_prog "" "$vxhs_libs" ; then
4859 vxhs=yes
4860 else
4861 if test "$vxhs" = "yes" ; then
4862 feature_not_found "vxhs block device" "Install libvxhs See github"
4864 vxhs=no
4868 ##########################################
4869 # check for _Static_assert()
4871 have_static_assert=no
4872 cat > $TMPC << EOF
4873 _Static_assert(1, "success");
4874 int main(void) {
4875 return 0;
4878 if compile_prog "" "" ; then
4879 have_static_assert=yes
4882 ##########################################
4883 # End of CC checks
4884 # After here, no more $cc or $ld runs
4886 if test "$gcov" = "yes" ; then
4887 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
4888 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
4889 elif test "$fortify_source" = "yes" ; then
4890 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
4891 elif test "$debug" = "no"; then
4892 CFLAGS="-O2 $CFLAGS"
4895 ##########################################
4896 # Do we have libnfs
4897 if test "$libnfs" != "no" ; then
4898 if $pkg_config --atleast-version=1.9.3 libnfs; then
4899 libnfs="yes"
4900 libnfs_libs=$($pkg_config --libs libnfs)
4901 else
4902 if test "$libnfs" = "yes" ; then
4903 feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
4905 libnfs="no"
4909 # Now we've finished running tests it's OK to add -Werror to the compiler flags
4910 if test "$werror" = "yes"; then
4911 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
4914 if test "$solaris" = "no" ; then
4915 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
4916 LDFLAGS="-Wl,--warn-common $LDFLAGS"
4920 # test if pod2man has --utf8 option
4921 if pod2man --help | grep -q utf8; then
4922 POD2MAN="pod2man --utf8"
4923 else
4924 POD2MAN="pod2man"
4927 # Use large addresses, ASLR, no-SEH and DEP if available.
4928 if test "$mingw32" = "yes" ; then
4929 if test "$cpu" = i386; then
4930 LDFLAGS="-Wl,--large-address-aware $LDFLAGS"
4932 for flag in --dynamicbase --no-seh --nxcompat; do
4933 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
4934 LDFLAGS="-Wl,$flag $LDFLAGS"
4936 done
4939 qemu_confdir=$sysconfdir$confsuffix
4940 qemu_moddir=$libdir$confsuffix
4941 qemu_datadir=$datadir$confsuffix
4942 qemu_localedir="$datadir/locale"
4944 tools=""
4945 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
4946 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
4947 tools="qemu-nbd\$(EXESUF) $tools"
4948 tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools"
4950 if test "$softmmu" = yes ; then
4951 if test "$virtfs" != no ; then
4952 if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
4953 virtfs=yes
4954 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
4955 else
4956 if test "$virtfs" = yes; then
4957 error_exit "VirtFS is supported only on Linux and requires libcap devel and libattr devel"
4959 virtfs=no
4964 # Probe for guest agent support/options
4966 if [ "$guest_agent" != "no" ]; then
4967 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
4968 tools="qemu-ga $tools"
4969 guest_agent=yes
4970 elif [ "$guest_agent" != yes ]; then
4971 guest_agent=no
4972 else
4973 error_exit "Guest agent is not supported on this platform"
4977 # Guest agent Window MSI package
4979 if test "$guest_agent" != yes; then
4980 if test "$guest_agent_msi" = yes; then
4981 error_exit "MSI guest agent package requires guest agent enabled"
4983 guest_agent_msi=no
4984 elif test "$mingw32" != "yes"; then
4985 if test "$guest_agent_msi" = "yes"; then
4986 error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation"
4988 guest_agent_msi=no
4989 elif ! has wixl; then
4990 if test "$guest_agent_msi" = "yes"; then
4991 error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )"
4993 guest_agent_msi=no
4994 else
4995 # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't
4996 # disabled explicitly
4997 if test "$guest_agent_msi" != "no"; then
4998 guest_agent_msi=yes
5002 if test "$guest_agent_msi" = "yes"; then
5003 if test "$guest_agent_with_vss" = "yes"; then
5004 QEMU_GA_MSI_WITH_VSS="-D InstallVss"
5007 if test "$QEMU_GA_MANUFACTURER" = ""; then
5008 QEMU_GA_MANUFACTURER=QEMU
5011 if test "$QEMU_GA_DISTRO" = ""; then
5012 QEMU_GA_DISTRO=Linux
5015 if test "$QEMU_GA_VERSION" = ""; then
5016 QEMU_GA_VERSION=$(cat $source_path/VERSION)
5019 QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin"
5021 case "$cpu" in
5022 x86_64)
5023 QEMU_GA_MSI_ARCH="-a x64 -D Arch=64"
5025 i386)
5026 QEMU_GA_MSI_ARCH="-D Arch=32"
5029 error_exit "CPU $cpu not supported for building installation package"
5031 esac
5034 # Mac OS X ships with a broken assembler
5035 roms=
5036 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
5037 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
5038 "$softmmu" = yes ; then
5039 # Different host OS linkers have different ideas about the name of the ELF
5040 # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd
5041 # variant; and Windows uses i386pe.
5042 for emu in elf_i386 elf_i386_fbsd i386pe; do
5043 if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
5044 ld_i386_emulation="$emu"
5045 roms="optionrom"
5046 break
5048 done
5050 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
5051 roms="$roms spapr-rtas"
5054 if test "$cpu" = "s390x" ; then
5055 roms="$roms s390-ccw"
5058 # Probe for the need for relocating the user-only binary.
5059 if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
5060 textseg_addr=
5061 case "$cpu" in
5062 arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
5063 # ??? Rationale for choosing this address
5064 textseg_addr=0x60000000
5066 mips)
5067 # A 256M aligned address, high in the address space, with enough
5068 # room for the code_gen_buffer above it before the stack.
5069 textseg_addr=0x60000000
5071 esac
5072 if [ -n "$textseg_addr" ]; then
5073 cat > $TMPC <<EOF
5074 int main(void) { return 0; }
5076 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
5077 if ! compile_prog "" "$textseg_ldflags"; then
5078 # In case ld does not support -Ttext-segment, edit the default linker
5079 # script via sed to set the .text start addr. This is needed on FreeBSD
5080 # at least.
5081 if ! $ld --verbose >/dev/null 2>&1; then
5082 error_exit \
5083 "We need to link the QEMU user mode binaries at a" \
5084 "specific text address. Unfortunately your linker" \
5085 "doesn't support either the -Ttext-segment option or" \
5086 "printing the default linker script with --verbose." \
5087 "If you don't want the user mode binaries, pass the" \
5088 "--disable-user option to configure."
5091 $ld --verbose | sed \
5092 -e '1,/==================================================/d' \
5093 -e '/==================================================/,$d' \
5094 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
5095 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
5096 textseg_ldflags="-Wl,-T../config-host.ld"
5101 # Check that the C++ compiler exists and works with the C compiler.
5102 # All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
5103 if has $cxx; then
5104 cat > $TMPC <<EOF
5105 int c_function(void);
5106 int main(void) { return c_function(); }
5109 compile_object
5111 cat > $TMPCXX <<EOF
5112 extern "C" {
5113 int c_function(void);
5115 int c_function(void) { return 42; }
5118 update_cxxflags
5120 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
5121 # C++ compiler $cxx works ok with C compiler $cc
5123 else
5124 echo "C++ compiler $cxx does not work with C compiler $cc"
5125 echo "Disabling C++ specific optional code"
5126 cxx=
5128 else
5129 echo "No C++ compiler available; disabling C++ specific optional code"
5130 cxx=
5133 echo_version() {
5134 if test "$1" = "yes" ; then
5135 echo "($2)"
5139 # prepend pixman and ftd flags after all config tests are done
5140 QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
5141 libs_softmmu="$pixman_libs $libs_softmmu"
5143 echo "Install prefix $prefix"
5144 echo "BIOS directory $(eval echo $qemu_datadir)"
5145 echo "binary directory $(eval echo $bindir)"
5146 echo "library directory $(eval echo $libdir)"
5147 echo "module directory $(eval echo $qemu_moddir)"
5148 echo "libexec directory $(eval echo $libexecdir)"
5149 echo "include directory $(eval echo $includedir)"
5150 echo "config directory $(eval echo $sysconfdir)"
5151 if test "$mingw32" = "no" ; then
5152 echo "local state directory $(eval echo $local_statedir)"
5153 echo "Manual directory $(eval echo $mandir)"
5154 echo "ELF interp prefix $interp_prefix"
5155 else
5156 echo "local state directory queried at runtime"
5157 echo "Windows SDK $win_sdk"
5159 echo "Source path $source_path"
5160 echo "C compiler $cc"
5161 echo "Host C compiler $host_cc"
5162 echo "C++ compiler $cxx"
5163 echo "Objective-C compiler $objcc"
5164 echo "ARFLAGS $ARFLAGS"
5165 echo "CFLAGS $CFLAGS"
5166 echo "QEMU_CFLAGS $QEMU_CFLAGS"
5167 echo "LDFLAGS $LDFLAGS"
5168 echo "make $make"
5169 echo "install $install"
5170 echo "python $python"
5171 if test "$slirp" = "yes" ; then
5172 echo "smbd $smbd"
5174 echo "module support $modules"
5175 echo "host CPU $cpu"
5176 echo "host big endian $bigendian"
5177 echo "target list $target_list"
5178 echo "tcg debug enabled $debug_tcg"
5179 echo "gprof enabled $gprof"
5180 echo "sparse enabled $sparse"
5181 echo "strip binaries $strip_opt"
5182 echo "profiler $profiler"
5183 echo "static build $static"
5184 if test "$darwin" = "yes" ; then
5185 echo "Cocoa support $cocoa"
5187 echo "pixman $pixman"
5188 echo "SDL support $sdl $(echo_version $sdl $sdlversion)"
5189 echo "GTK support $gtk $(echo_version $gtk $gtk_version)"
5190 echo "GTK GL support $gtk_gl"
5191 echo "VTE support $vte $(echo_version $vte $vteversion)"
5192 echo "TLS priority $tls_priority"
5193 echo "GNUTLS support $gnutls"
5194 echo "GNUTLS rnd $gnutls_rnd"
5195 if test "$gcrypt" = "yes"; then
5196 echo "encryption libgcrypt"
5197 echo "libgcrypt kdf $gcrypt_kdf"
5198 elif test "$nettle" = "yes"; then
5199 echo "nettle $nettle $(echo_version $nettle $nettle_version)"
5200 else
5201 echo "encryption none"
5203 echo "nettle kdf $nettle_kdf"
5204 echo "libtasn1 $tasn1"
5205 echo "curses support $curses"
5206 echo "virgl support $virglrenderer"
5207 echo "curl support $curl"
5208 echo "mingw32 support $mingw32"
5209 echo "Audio drivers $audio_drv_list"
5210 echo "Block whitelist (rw) $block_drv_rw_whitelist"
5211 echo "Block whitelist (ro) $block_drv_ro_whitelist"
5212 echo "VirtFS support $virtfs"
5213 echo "VNC support $vnc"
5214 if test "$vnc" = "yes" ; then
5215 echo "VNC SASL support $vnc_sasl"
5216 echo "VNC JPEG support $vnc_jpeg"
5217 echo "VNC PNG support $vnc_png"
5219 if test -n "$sparc_cpu"; then
5220 echo "Target Sparc Arch $sparc_cpu"
5222 echo "xen support $xen"
5223 if test "$xen" = "yes" ; then
5224 echo "xen ctrl version $xen_ctrl_version"
5225 echo "pv dom build $xen_pv_domain_build"
5227 echo "brlapi support $brlapi"
5228 echo "bluez support $bluez"
5229 echo "Documentation $docs"
5230 echo "Tools $tools"
5231 echo "PIE $pie"
5232 echo "vde support $vde"
5233 echo "netmap support $netmap"
5234 echo "Linux AIO support $linux_aio"
5235 echo "(X)ATTR support $attr"
5236 echo "Install blobs $blobs"
5237 echo "KVM support $kvm"
5238 echo "HAX support $hax"
5239 echo "RDMA support $rdma"
5240 echo "TCG interpreter $tcg_interpreter"
5241 echo "fdt support $fdt"
5242 echo "preadv support $preadv"
5243 echo "fdatasync $fdatasync"
5244 echo "madvise $madvise"
5245 echo "posix_madvise $posix_madvise"
5246 echo "libcap-ng support $cap_ng"
5247 echo "vhost-net support $vhost_net"
5248 echo "vhost-scsi support $vhost_scsi"
5249 echo "vhost-vsock support $vhost_vsock"
5250 echo "Trace backends $trace_backends"
5251 if have_backend "simple"; then
5252 echo "Trace output file $trace_file-<pid>"
5254 echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)"
5255 echo "rbd support $rbd"
5256 echo "xfsctl support $xfs"
5257 echo "smartcard support $smartcard"
5258 echo "libusb $libusb"
5259 echo "usb net redir $usb_redir"
5260 echo "OpenGL support $opengl"
5261 echo "OpenGL dmabufs $opengl_dmabuf"
5262 echo "libiscsi support $libiscsi"
5263 echo "libnfs support $libnfs"
5264 echo "build guest agent $guest_agent"
5265 echo "QGA VSS support $guest_agent_with_vss"
5266 echo "QGA w32 disk info $guest_agent_ntddscsi"
5267 echo "QGA MSI support $guest_agent_msi"
5268 echo "seccomp support $seccomp"
5269 echo "coroutine backend $coroutine"
5270 echo "coroutine pool $coroutine_pool"
5271 echo "debug stack usage $debug_stack_usage"
5272 echo "GlusterFS support $glusterfs"
5273 echo "gcov $gcov_tool"
5274 echo "gcov enabled $gcov"
5275 echo "TPM support $tpm"
5276 echo "libssh2 support $libssh2"
5277 echo "TPM passthrough $tpm_passthrough"
5278 echo "QOM debugging $qom_cast_debug"
5279 echo "Live block migration $live_block_migration"
5280 echo "lzo support $lzo"
5281 echo "snappy support $snappy"
5282 echo "bzip2 support $bzip2"
5283 echo "NUMA host support $numa"
5284 echo "tcmalloc support $tcmalloc"
5285 echo "jemalloc support $jemalloc"
5286 echo "avx2 optimization $avx2_opt"
5287 echo "replication support $replication"
5288 echo "VxHS block device $vxhs"
5290 if test "$sdl_too_old" = "yes"; then
5291 echo "-> Your SDL version is too old - please upgrade to have SDL support"
5294 if test "$supported_cpu" = "no"; then
5295 echo
5296 echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
5297 echo
5298 echo "CPU host architecture $cpu support is not currently maintained."
5299 echo "The QEMU project intends to remove support for this host CPU in"
5300 echo "a future release if nobody volunteers to maintain it and to"
5301 echo "provide a build host for our continuous integration setup."
5302 echo "configure has succeeded and you can continue to build, but"
5303 echo "if you care about QEMU on this platform you should contact"
5304 echo "us upstream at qemu-devel@nongnu.org."
5307 if test "$supported_os" = "no"; then
5308 echo
5309 echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!"
5310 echo
5311 echo "Host OS $targetos support is not currently maintained."
5312 echo "The QEMU project intends to remove support for this host OS in"
5313 echo "a future release if nobody volunteers to maintain it and to"
5314 echo "provide a build host for our continuous integration setup."
5315 echo "configure has succeeded and you can continue to build, but"
5316 echo "if you care about QEMU on this platform you should contact"
5317 echo "us upstream at qemu-devel@nongnu.org."
5320 config_host_mak="config-host.mak"
5322 echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
5324 echo "# Automatically generated by configure - do not modify" > $config_host_mak
5325 echo >> $config_host_mak
5327 echo all: >> $config_host_mak
5328 echo "prefix=$prefix" >> $config_host_mak
5329 echo "bindir=$bindir" >> $config_host_mak
5330 echo "libdir=$libdir" >> $config_host_mak
5331 echo "libexecdir=$libexecdir" >> $config_host_mak
5332 echo "includedir=$includedir" >> $config_host_mak
5333 echo "mandir=$mandir" >> $config_host_mak
5334 echo "sysconfdir=$sysconfdir" >> $config_host_mak
5335 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
5336 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
5337 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
5338 echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
5339 if test "$mingw32" = "no" ; then
5340 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
5342 echo "qemu_helperdir=$libexecdir" >> $config_host_mak
5343 echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
5344 echo "extra_cxxflags=$EXTRA_CXXFLAGS" >> $config_host_mak
5345 echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
5346 echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
5347 echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
5349 echo "ARCH=$ARCH" >> $config_host_mak
5351 if test "$debug_tcg" = "yes" ; then
5352 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
5354 if test "$strip_opt" = "yes" ; then
5355 echo "STRIP=${strip}" >> $config_host_mak
5357 if test "$bigendian" = "yes" ; then
5358 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
5360 if test "$mingw32" = "yes" ; then
5361 echo "CONFIG_WIN32=y" >> $config_host_mak
5362 echo "CONFIG_INSTALLER=y" >> $config_host_mak
5363 rc_version=$(cat $source_path/VERSION)
5364 version_major=${rc_version%%.*}
5365 rc_version=${rc_version#*.}
5366 version_minor=${rc_version%%.*}
5367 rc_version=${rc_version#*.}
5368 version_subminor=${rc_version%%.*}
5369 version_micro=0
5370 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
5371 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
5372 if test "$guest_agent_with_vss" = "yes" ; then
5373 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
5374 echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak
5375 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
5377 if test "$guest_agent_ntddscsi" = "yes" ; then
5378 echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak
5380 if test "$guest_agent_msi" = "yes"; then
5381 echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
5382 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
5383 echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
5384 echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
5385 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
5386 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
5387 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
5389 else
5390 echo "CONFIG_POSIX=y" >> $config_host_mak
5393 if test "$linux" = "yes" ; then
5394 echo "CONFIG_LINUX=y" >> $config_host_mak
5397 if test "$darwin" = "yes" ; then
5398 echo "CONFIG_DARWIN=y" >> $config_host_mak
5401 if test "$aix" = "yes" ; then
5402 echo "CONFIG_AIX=y" >> $config_host_mak
5405 if test "$solaris" = "yes" ; then
5406 echo "CONFIG_SOLARIS=y" >> $config_host_mak
5407 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
5408 if test "$needs_libsunmath" = "yes" ; then
5409 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
5412 if test "$haiku" = "yes" ; then
5413 echo "CONFIG_HAIKU=y" >> $config_host_mak
5415 if test "$static" = "yes" ; then
5416 echo "CONFIG_STATIC=y" >> $config_host_mak
5418 if test "$profiler" = "yes" ; then
5419 echo "CONFIG_PROFILER=y" >> $config_host_mak
5421 if test "$slirp" = "yes" ; then
5422 echo "CONFIG_SLIRP=y" >> $config_host_mak
5423 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
5425 if test "$vde" = "yes" ; then
5426 echo "CONFIG_VDE=y" >> $config_host_mak
5428 if test "$netmap" = "yes" ; then
5429 echo "CONFIG_NETMAP=y" >> $config_host_mak
5431 if test "$l2tpv3" = "yes" ; then
5432 echo "CONFIG_L2TPV3=y" >> $config_host_mak
5434 if test "$cap_ng" = "yes" ; then
5435 echo "CONFIG_LIBCAP=y" >> $config_host_mak
5437 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
5438 for drv in $audio_drv_list; do
5439 def=CONFIG_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
5440 echo "$def=y" >> $config_host_mak
5441 done
5442 if test "$audio_pt_int" = "yes" ; then
5443 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
5445 if test "$audio_win_int" = "yes" ; then
5446 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
5448 echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
5449 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
5450 if test "$vnc" = "yes" ; then
5451 echo "CONFIG_VNC=y" >> $config_host_mak
5453 if test "$vnc_sasl" = "yes" ; then
5454 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
5456 if test "$vnc_jpeg" = "yes" ; then
5457 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
5459 if test "$vnc_png" = "yes" ; then
5460 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
5462 if test "$fnmatch" = "yes" ; then
5463 echo "CONFIG_FNMATCH=y" >> $config_host_mak
5465 if test "$xfs" = "yes" ; then
5466 echo "CONFIG_XFS=y" >> $config_host_mak
5468 qemu_version=$(head $source_path/VERSION)
5469 echo "VERSION=$qemu_version" >>$config_host_mak
5470 echo "PKGVERSION=$pkgversion" >>$config_host_mak
5471 echo "SRC_PATH=$source_path" >> $config_host_mak
5472 echo "TARGET_DIRS=$target_list" >> $config_host_mak
5473 if [ "$docs" = "yes" ] ; then
5474 echo "BUILD_DOCS=yes" >> $config_host_mak
5476 if [ "$want_tools" = "yes" ] ; then
5477 echo "BUILD_TOOLS=yes" >> $config_host_mak
5479 if test "$modules" = "yes"; then
5480 # $shacmd can generate a hash started with digit, which the compiler doesn't
5481 # like as an symbol. So prefix it with an underscore
5482 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
5483 echo "CONFIG_MODULES=y" >> $config_host_mak
5485 if test "$sdl" = "yes" ; then
5486 echo "CONFIG_SDL=y" >> $config_host_mak
5487 echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
5488 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
5490 if test "$cocoa" = "yes" ; then
5491 echo "CONFIG_COCOA=y" >> $config_host_mak
5493 if test "$curses" = "yes" ; then
5494 echo "CONFIG_CURSES=y" >> $config_host_mak
5496 if test "$pipe2" = "yes" ; then
5497 echo "CONFIG_PIPE2=y" >> $config_host_mak
5499 if test "$accept4" = "yes" ; then
5500 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
5502 if test "$splice" = "yes" ; then
5503 echo "CONFIG_SPLICE=y" >> $config_host_mak
5505 if test "$eventfd" = "yes" ; then
5506 echo "CONFIG_EVENTFD=y" >> $config_host_mak
5508 if test "$memfd" = "yes" ; then
5509 echo "CONFIG_MEMFD=y" >> $config_host_mak
5511 if test "$fallocate" = "yes" ; then
5512 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
5514 if test "$fallocate_punch_hole" = "yes" ; then
5515 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
5517 if test "$fallocate_zero_range" = "yes" ; then
5518 echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak
5520 if test "$posix_fallocate" = "yes" ; then
5521 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
5523 if test "$sync_file_range" = "yes" ; then
5524 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
5526 if test "$fiemap" = "yes" ; then
5527 echo "CONFIG_FIEMAP=y" >> $config_host_mak
5529 if test "$dup3" = "yes" ; then
5530 echo "CONFIG_DUP3=y" >> $config_host_mak
5532 if test "$ppoll" = "yes" ; then
5533 echo "CONFIG_PPOLL=y" >> $config_host_mak
5535 if test "$prctl_pr_set_timerslack" = "yes" ; then
5536 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
5538 if test "$epoll" = "yes" ; then
5539 echo "CONFIG_EPOLL=y" >> $config_host_mak
5541 if test "$epoll_create1" = "yes" ; then
5542 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
5544 if test "$sendfile" = "yes" ; then
5545 echo "CONFIG_SENDFILE=y" >> $config_host_mak
5547 if test "$timerfd" = "yes" ; then
5548 echo "CONFIG_TIMERFD=y" >> $config_host_mak
5550 if test "$setns" = "yes" ; then
5551 echo "CONFIG_SETNS=y" >> $config_host_mak
5553 if test "$clock_adjtime" = "yes" ; then
5554 echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak
5556 if test "$syncfs" = "yes" ; then
5557 echo "CONFIG_SYNCFS=y" >> $config_host_mak
5559 if test "$inotify" = "yes" ; then
5560 echo "CONFIG_INOTIFY=y" >> $config_host_mak
5562 if test "$inotify1" = "yes" ; then
5563 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
5565 if test "$byteswap_h" = "yes" ; then
5566 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
5568 if test "$bswap_h" = "yes" ; then
5569 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
5571 if test "$curl" = "yes" ; then
5572 echo "CONFIG_CURL=m" >> $config_host_mak
5573 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
5574 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
5576 if test "$brlapi" = "yes" ; then
5577 echo "CONFIG_BRLAPI=y" >> $config_host_mak
5579 if test "$bluez" = "yes" ; then
5580 echo "CONFIG_BLUEZ=y" >> $config_host_mak
5581 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
5583 if test "$glib_subprocess" = "yes" ; then
5584 echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak
5586 if test "$gtk" = "yes" ; then
5587 echo "CONFIG_GTK=y" >> $config_host_mak
5588 echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
5589 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
5590 echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
5591 if test "$gtk_gl" = "yes" ; then
5592 echo "CONFIG_GTK_GL=y" >> $config_host_mak
5595 echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
5596 if test "$gnutls" = "yes" ; then
5597 echo "CONFIG_GNUTLS=y" >> $config_host_mak
5599 if test "$gnutls_rnd" = "yes" ; then
5600 echo "CONFIG_GNUTLS_RND=y" >> $config_host_mak
5602 if test "$gcrypt" = "yes" ; then
5603 echo "CONFIG_GCRYPT=y" >> $config_host_mak
5604 if test "$gcrypt_hmac" = "yes" ; then
5605 echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak
5607 if test "$gcrypt_kdf" = "yes" ; then
5608 echo "CONFIG_GCRYPT_KDF=y" >> $config_host_mak
5611 if test "$nettle" = "yes" ; then
5612 echo "CONFIG_NETTLE=y" >> $config_host_mak
5613 echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak
5614 if test "$nettle_kdf" = "yes" ; then
5615 echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak
5618 if test "$tasn1" = "yes" ; then
5619 echo "CONFIG_TASN1=y" >> $config_host_mak
5621 if test "$have_ifaddrs_h" = "yes" ; then
5622 echo "HAVE_IFADDRS_H=y" >> $config_host_mak
5624 if test "$have_broken_size_max" = "yes" ; then
5625 echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
5628 # Work around a system header bug with some kernel/XFS header
5629 # versions where they both try to define 'struct fsxattr':
5630 # xfs headers will not try to redefine structs from linux headers
5631 # if this macro is set.
5632 if test "$have_fsxattr" = "yes" ; then
5633 echo "HAVE_FSXATTR=y" >> $config_host_mak
5635 if test "$vte" = "yes" ; then
5636 echo "CONFIG_VTE=y" >> $config_host_mak
5637 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
5639 if test "$virglrenderer" = "yes" ; then
5640 echo "CONFIG_VIRGL=y" >> $config_host_mak
5641 echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak
5642 echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak
5644 if test "$xen" = "yes" ; then
5645 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
5646 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
5647 if test "$xen_pv_domain_build" = "yes" ; then
5648 echo "CONFIG_XEN_PV_DOMAIN_BUILD=y" >> $config_host_mak
5651 if test "$linux_aio" = "yes" ; then
5652 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
5654 if test "$attr" = "yes" ; then
5655 echo "CONFIG_ATTR=y" >> $config_host_mak
5657 if test "$libattr" = "yes" ; then
5658 echo "CONFIG_LIBATTR=y" >> $config_host_mak
5660 if test "$virtfs" = "yes" ; then
5661 echo "CONFIG_VIRTFS=y" >> $config_host_mak
5663 if test "$vhost_scsi" = "yes" ; then
5664 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
5666 if test "$vhost_net" = "yes" ; then
5667 echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
5669 if test "$vhost_vsock" = "yes" ; then
5670 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
5672 if test "$blobs" = "yes" ; then
5673 echo "INSTALL_BLOBS=yes" >> $config_host_mak
5675 if test "$iovec" = "yes" ; then
5676 echo "CONFIG_IOVEC=y" >> $config_host_mak
5678 if test "$preadv" = "yes" ; then
5679 echo "CONFIG_PREADV=y" >> $config_host_mak
5681 if test "$fdt" = "yes" ; then
5682 echo "CONFIG_FDT=y" >> $config_host_mak
5684 if test "$signalfd" = "yes" ; then
5685 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
5687 if test "$tcg_interpreter" = "yes" ; then
5688 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
5690 if test "$fdatasync" = "yes" ; then
5691 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
5693 if test "$madvise" = "yes" ; then
5694 echo "CONFIG_MADVISE=y" >> $config_host_mak
5696 if test "$posix_madvise" = "yes" ; then
5697 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
5700 if test "$spice" = "yes" ; then
5701 echo "CONFIG_SPICE=y" >> $config_host_mak
5704 if test "$smartcard" = "yes" ; then
5705 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
5708 if test "$libusb" = "yes" ; then
5709 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
5712 if test "$usb_redir" = "yes" ; then
5713 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
5716 if test "$opengl" = "yes" ; then
5717 echo "CONFIG_OPENGL=y" >> $config_host_mak
5718 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
5719 if test "$opengl_dmabuf" = "yes" ; then
5720 echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
5724 if test "$avx2_opt" = "yes" ; then
5725 echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
5728 if test "$lzo" = "yes" ; then
5729 echo "CONFIG_LZO=y" >> $config_host_mak
5732 if test "$snappy" = "yes" ; then
5733 echo "CONFIG_SNAPPY=y" >> $config_host_mak
5736 if test "$bzip2" = "yes" ; then
5737 echo "CONFIG_BZIP2=y" >> $config_host_mak
5738 echo "BZIP2_LIBS=-lbz2" >> $config_host_mak
5741 if test "$libiscsi" = "yes" ; then
5742 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
5743 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
5744 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
5747 if test "$libnfs" = "yes" ; then
5748 echo "CONFIG_LIBNFS=m" >> $config_host_mak
5749 echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
5752 if test "$seccomp" = "yes"; then
5753 echo "CONFIG_SECCOMP=y" >> $config_host_mak
5756 # XXX: suppress that
5757 if [ "$bsd" = "yes" ] ; then
5758 echo "CONFIG_BSD=y" >> $config_host_mak
5761 if test "$localtime_r" = "yes" ; then
5762 echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
5764 if test "$qom_cast_debug" = "yes" ; then
5765 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
5767 if test "$rbd" = "yes" ; then
5768 echo "CONFIG_RBD=m" >> $config_host_mak
5769 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
5770 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
5773 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
5774 if test "$coroutine_pool" = "yes" ; then
5775 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
5776 else
5777 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
5780 if test "$debug_stack_usage" = "yes" ; then
5781 echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
5784 if test "$open_by_handle_at" = "yes" ; then
5785 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
5788 if test "$linux_magic_h" = "yes" ; then
5789 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
5792 if test "$pragma_diagnostic_available" = "yes" ; then
5793 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
5796 if test "$valgrind_h" = "yes" ; then
5797 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
5800 if test "$has_environ" = "yes" ; then
5801 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
5804 if test "$cpuid_h" = "yes" ; then
5805 echo "CONFIG_CPUID_H=y" >> $config_host_mak
5808 if test "$int128" = "yes" ; then
5809 echo "CONFIG_INT128=y" >> $config_host_mak
5812 if test "$atomic128" = "yes" ; then
5813 echo "CONFIG_ATOMIC128=y" >> $config_host_mak
5816 if test "$atomic64" = "yes" ; then
5817 echo "CONFIG_ATOMIC64=y" >> $config_host_mak
5820 if test "$getauxval" = "yes" ; then
5821 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
5824 if test "$glusterfs" = "yes" ; then
5825 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
5826 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
5827 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
5830 if test "$glusterfs_xlator_opt" = "yes" ; then
5831 echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
5834 if test "$glusterfs_discard" = "yes" ; then
5835 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
5838 if test "$glusterfs_fallocate" = "yes" ; then
5839 echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
5842 if test "$glusterfs_zerofill" = "yes" ; then
5843 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
5846 if test "$libssh2" = "yes" ; then
5847 echo "CONFIG_LIBSSH2=m" >> $config_host_mak
5848 echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
5849 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
5852 if test "$live_block_migration" = "yes" ; then
5853 echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
5856 # USB host support
5857 if test "$libusb" = "yes"; then
5858 echo "HOST_USB=libusb legacy" >> $config_host_mak
5859 else
5860 echo "HOST_USB=stub" >> $config_host_mak
5863 # TPM passthrough support?
5864 if test "$tpm" = "yes"; then
5865 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
5866 if test "$tpm_passthrough" = "yes"; then
5867 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
5871 echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
5872 if have_backend "nop"; then
5873 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
5875 if have_backend "simple"; then
5876 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
5877 # Set the appropriate trace file.
5878 trace_file="\"$trace_file-\" FMT_pid"
5880 if have_backend "log"; then
5881 echo "CONFIG_TRACE_LOG=y" >> $config_host_mak
5883 if have_backend "ust"; then
5884 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
5886 if have_backend "dtrace"; then
5887 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
5888 if test "$trace_backend_stap" = "yes" ; then
5889 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
5892 if have_backend "ftrace"; then
5893 if test "$linux" = "yes" ; then
5894 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
5895 else
5896 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
5899 if have_backend "syslog"; then
5900 if test "$posix_syslog" = "yes" ; then
5901 echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak
5902 else
5903 feature_not_found "syslog(trace backend)" "syslog not available"
5906 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
5908 if test "$rdma" = "yes" ; then
5909 echo "CONFIG_RDMA=y" >> $config_host_mak
5912 if test "$have_rtnetlink" = "yes" ; then
5913 echo "CONFIG_RTNETLINK=y" >> $config_host_mak
5916 if test "$replication" = "yes" ; then
5917 echo "CONFIG_REPLICATION=y" >> $config_host_mak
5920 if test "$have_af_vsock" = "yes" ; then
5921 echo "CONFIG_AF_VSOCK=y" >> $config_host_mak
5924 if test "$have_sysmacros" = "yes" ; then
5925 echo "CONFIG_SYSMACROS=y" >> $config_host_mak
5928 if test "$have_static_assert" = "yes" ; then
5929 echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak
5932 # Hold two types of flag:
5933 # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
5934 # a thread we have a handle to
5935 # CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
5936 # platform
5937 if test "$pthread_setname_np" = "yes" ; then
5938 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
5939 echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
5942 if test "$vxhs" = "yes" ; then
5943 echo "CONFIG_VXHS=y" >> $config_host_mak
5944 echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
5947 if test "$tcg_interpreter" = "yes"; then
5948 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
5949 elif test "$ARCH" = "sparc64" ; then
5950 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
5951 elif test "$ARCH" = "s390x" ; then
5952 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
5953 elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
5954 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
5955 elif test "$ARCH" = "ppc64" ; then
5956 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
5957 else
5958 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
5960 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
5962 echo "TOOLS=$tools" >> $config_host_mak
5963 echo "ROMS=$roms" >> $config_host_mak
5964 echo "MAKE=$make" >> $config_host_mak
5965 echo "INSTALL=$install" >> $config_host_mak
5966 echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
5967 echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
5968 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
5969 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
5970 echo "PYTHON=$python" >> $config_host_mak
5971 echo "CC=$cc" >> $config_host_mak
5972 if $iasl -h > /dev/null 2>&1; then
5973 echo "IASL=$iasl" >> $config_host_mak
5975 echo "CC_I386=$cc_i386" >> $config_host_mak
5976 echo "HOST_CC=$host_cc" >> $config_host_mak
5977 echo "CXX=$cxx" >> $config_host_mak
5978 echo "OBJCC=$objcc" >> $config_host_mak
5979 echo "AR=$ar" >> $config_host_mak
5980 echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
5981 echo "AS=$as" >> $config_host_mak
5982 echo "CCAS=$ccas" >> $config_host_mak
5983 echo "CPP=$cpp" >> $config_host_mak
5984 echo "OBJCOPY=$objcopy" >> $config_host_mak
5985 echo "LD=$ld" >> $config_host_mak
5986 echo "NM=$nm" >> $config_host_mak
5987 echo "WINDRES=$windres" >> $config_host_mak
5988 echo "CFLAGS=$CFLAGS" >> $config_host_mak
5989 echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
5990 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
5991 echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
5992 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
5993 if test "$sparse" = "yes" ; then
5994 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
5995 echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak
5996 echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
5997 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
5998 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
6000 if test "$cross_prefix" != ""; then
6001 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
6002 else
6003 echo "AUTOCONF_HOST := " >> $config_host_mak
6005 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
6006 echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
6007 echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
6008 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
6009 echo "LIBS+=$LIBS" >> $config_host_mak
6010 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
6011 echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak
6012 echo "EXESUF=$EXESUF" >> $config_host_mak
6013 echo "DSOSUF=$DSOSUF" >> $config_host_mak
6014 echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
6015 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
6016 echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
6017 echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
6018 echo "POD2MAN=$POD2MAN" >> $config_host_mak
6019 echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
6020 if test "$gcov" = "yes" ; then
6021 echo "CONFIG_GCOV=y" >> $config_host_mak
6022 echo "GCOV=$gcov_tool" >> $config_host_mak
6025 # use included Linux headers
6026 if test "$linux" = "yes" ; then
6027 mkdir -p linux-headers
6028 case "$cpu" in
6029 i386|x86_64|x32)
6030 linux_arch=x86
6032 ppcemb|ppc|ppc64)
6033 linux_arch=powerpc
6035 s390x)
6036 linux_arch=s390
6038 aarch64)
6039 linux_arch=arm64
6041 mips64)
6042 linux_arch=mips
6045 # For most CPUs the kernel architecture name and QEMU CPU name match.
6046 linux_arch="$cpu"
6048 esac
6049 # For non-KVM architectures we will not have asm headers
6050 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
6051 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
6055 for target in $target_list; do
6056 target_dir="$target"
6057 config_target_mak=$target_dir/config-target.mak
6058 target_name=$(echo $target | cut -d '-' -f 1)
6059 target_bigendian="no"
6061 case "$target_name" in
6062 armeb|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
6063 target_bigendian=yes
6065 esac
6066 target_softmmu="no"
6067 target_user_only="no"
6068 target_linux_user="no"
6069 target_bsd_user="no"
6070 case "$target" in
6071 ${target_name}-softmmu)
6072 target_softmmu="yes"
6074 ${target_name}-linux-user)
6075 if test "$linux" != "yes" ; then
6076 error_exit "Target '$target' is only available on a Linux host"
6078 target_user_only="yes"
6079 target_linux_user="yes"
6081 ${target_name}-bsd-user)
6082 if test "$bsd" != "yes" ; then
6083 error_exit "Target '$target' is only available on a BSD host"
6085 target_user_only="yes"
6086 target_bsd_user="yes"
6089 error_exit "Target '$target' not recognised"
6090 exit 1
6092 esac
6094 mkdir -p $target_dir
6095 echo "# Automatically generated by configure - do not modify" > $config_target_mak
6097 bflt="no"
6098 mttcg="no"
6099 interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g")
6100 gdb_xml_files=""
6102 TARGET_ARCH="$target_name"
6103 TARGET_BASE_ARCH=""
6104 TARGET_ABI_DIR=""
6106 case "$target_name" in
6107 i386)
6108 gdb_xml_files="i386-32bit.xml i386-32bit-core.xml i386-32bit-sse.xml"
6110 x86_64)
6111 TARGET_BASE_ARCH=i386
6112 gdb_xml_files="i386-64bit.xml i386-64bit-core.xml i386-64bit-sse.xml"
6114 alpha)
6115 mttcg="yes"
6117 arm|armeb)
6118 TARGET_ARCH=arm
6119 bflt="yes"
6120 mttcg="yes"
6121 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
6123 aarch64)
6124 TARGET_BASE_ARCH=arm
6125 bflt="yes"
6126 mttcg="yes"
6127 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
6129 cris)
6131 hppa)
6133 lm32)
6135 m68k)
6136 bflt="yes"
6137 gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml"
6139 microblaze|microblazeel)
6140 TARGET_ARCH=microblaze
6141 bflt="yes"
6143 mips|mipsel)
6144 TARGET_ARCH=mips
6145 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
6147 mipsn32|mipsn32el)
6148 TARGET_ARCH=mips64
6149 TARGET_BASE_ARCH=mips
6150 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
6151 echo "TARGET_ABI32=y" >> $config_target_mak
6153 mips64|mips64el)
6154 TARGET_ARCH=mips64
6155 TARGET_BASE_ARCH=mips
6156 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
6158 moxie)
6160 nios2)
6162 or1k)
6163 TARGET_ARCH=openrisc
6164 TARGET_BASE_ARCH=openrisc
6166 ppc)
6167 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
6169 ppcemb)
6170 TARGET_BASE_ARCH=ppc
6171 TARGET_ABI_DIR=ppc
6172 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
6174 ppc64)
6175 TARGET_BASE_ARCH=ppc
6176 TARGET_ABI_DIR=ppc
6177 mttcg=yes
6178 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6180 ppc64le)
6181 TARGET_ARCH=ppc64
6182 TARGET_BASE_ARCH=ppc
6183 TARGET_ABI_DIR=ppc
6184 mttcg=yes
6185 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6187 ppc64abi32)
6188 TARGET_ARCH=ppc64
6189 TARGET_BASE_ARCH=ppc
6190 TARGET_ABI_DIR=ppc
6191 echo "TARGET_ABI32=y" >> $config_target_mak
6192 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6194 sh4|sh4eb)
6195 TARGET_ARCH=sh4
6196 bflt="yes"
6198 sparc)
6200 sparc64)
6201 TARGET_BASE_ARCH=sparc
6203 sparc32plus)
6204 TARGET_ARCH=sparc64
6205 TARGET_BASE_ARCH=sparc
6206 TARGET_ABI_DIR=sparc
6207 echo "TARGET_ABI32=y" >> $config_target_mak
6209 s390x)
6210 gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml"
6212 tilegx)
6214 tricore)
6216 unicore32)
6218 xtensa|xtensaeb)
6219 TARGET_ARCH=xtensa
6222 error_exit "Unsupported target CPU"
6224 esac
6225 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
6226 if [ "$TARGET_BASE_ARCH" = "" ]; then
6227 TARGET_BASE_ARCH=$TARGET_ARCH
6230 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
6232 upper() {
6233 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
6236 target_arch_name="$(upper $TARGET_ARCH)"
6237 echo "TARGET_$target_arch_name=y" >> $config_target_mak
6238 echo "TARGET_NAME=$target_name" >> $config_target_mak
6239 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
6240 if [ "$TARGET_ABI_DIR" = "" ]; then
6241 TARGET_ABI_DIR=$TARGET_ARCH
6243 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
6244 if [ "$HOST_VARIANT_DIR" != "" ]; then
6245 echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
6247 case "$target_name" in
6248 i386|x86_64)
6249 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
6250 echo "CONFIG_XEN=y" >> $config_target_mak
6251 if test "$xen_pci_passthrough" = yes; then
6252 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
6257 esac
6258 case "$target_name" in
6259 aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x|mipsel|mips)
6260 # Make sure the target and host cpus are compatible
6261 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
6262 \( "$target_name" = "$cpu" -o \
6263 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
6264 \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
6265 \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
6266 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
6267 \( "$target_name" = "mipsel" -a "$cpu" = "mips" \) -o \
6268 \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
6269 \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) -o \
6270 \( "$target_name" = "x86_64" -a "$cpu" = "x32" \) -o \
6271 \( "$target_name" = "i386" -a "$cpu" = "x32" \) \) ; then
6272 echo "CONFIG_KVM=y" >> $config_target_mak
6273 if test "$vhost_net" = "yes" ; then
6274 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
6275 echo "CONFIG_VHOST_NET_TEST_$target_name=y" >> $config_host_mak
6278 esac
6279 if test "$hax" = "yes" ; then
6280 if test "$target_softmmu" = "yes" ; then
6281 case "$target_name" in
6282 i386|x86_64)
6283 echo "CONFIG_HAX=y" >> $config_target_mak
6285 esac
6288 if test "$target_bigendian" = "yes" ; then
6289 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
6291 if test "$target_softmmu" = "yes" ; then
6292 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
6293 if test "$mttcg" = "yes" ; then
6294 echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak
6297 if test "$target_user_only" = "yes" ; then
6298 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
6299 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
6301 if test "$target_linux_user" = "yes" ; then
6302 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
6304 list=""
6305 if test ! -z "$gdb_xml_files" ; then
6306 for x in $gdb_xml_files; do
6307 list="$list $source_path/gdb-xml/$x"
6308 done
6309 echo "TARGET_XML_FILES=$list" >> $config_target_mak
6312 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
6313 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
6315 if test "$target_bsd_user" = "yes" ; then
6316 echo "CONFIG_BSD_USER=y" >> $config_target_mak
6319 # generate QEMU_CFLAGS/LDFLAGS for targets
6321 cflags=""
6322 ldflags=""
6324 disas_config() {
6325 echo "CONFIG_${1}_DIS=y" >> $config_target_mak
6326 echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak
6329 for i in $ARCH $TARGET_BASE_ARCH ; do
6330 case "$i" in
6331 alpha)
6332 disas_config "ALPHA"
6334 aarch64)
6335 if test -n "${cxx}"; then
6336 disas_config "ARM_A64"
6339 arm)
6340 disas_config "ARM"
6341 if test -n "${cxx}"; then
6342 disas_config "ARM_A64"
6345 cris)
6346 disas_config "CRIS"
6348 hppa)
6349 disas_config "HPPA"
6351 i386|x86_64|x32)
6352 disas_config "I386"
6354 ia64*)
6355 disas_config "IA64"
6357 lm32)
6358 disas_config "LM32"
6360 m68k)
6361 disas_config "M68K"
6363 microblaze*)
6364 disas_config "MICROBLAZE"
6366 mips*)
6367 disas_config "MIPS"
6369 moxie*)
6370 disas_config "MOXIE"
6372 nios2)
6373 disas_config "NIOS2"
6375 or1k)
6376 disas_config "OPENRISC"
6378 ppc*)
6379 disas_config "PPC"
6381 s390*)
6382 disas_config "S390"
6384 sh4)
6385 disas_config "SH4"
6387 sparc*)
6388 disas_config "SPARC"
6390 xtensa*)
6391 disas_config "XTENSA"
6393 esac
6394 done
6395 if test "$tcg_interpreter" = "yes" ; then
6396 disas_config "TCI"
6399 case "$ARCH" in
6400 alpha)
6401 # Ensure there's only a single GP
6402 cflags="-msmall-data $cflags"
6404 esac
6406 if test "$gprof" = "yes" ; then
6407 echo "TARGET_GPROF=yes" >> $config_target_mak
6408 if test "$target_linux_user" = "yes" ; then
6409 cflags="-p $cflags"
6410 ldflags="-p $ldflags"
6412 if test "$target_softmmu" = "yes" ; then
6413 ldflags="-p $ldflags"
6414 echo "GPROF_CFLAGS=-p" >> $config_target_mak
6418 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
6419 ldflags="$ldflags $textseg_ldflags"
6422 echo "LDFLAGS+=$ldflags" >> $config_target_mak
6423 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
6425 done # for target in $targets
6427 if [ "$pixman" = "internal" ]; then
6428 echo "config-host.h: subdir-pixman" >> $config_host_mak
6431 if [ "$dtc_internal" = "yes" ]; then
6432 echo "config-host.h: subdir-dtc" >> $config_host_mak
6435 if test "$numa" = "yes"; then
6436 echo "CONFIG_NUMA=y" >> $config_host_mak
6439 if test "$ccache_cpp2" = "yes"; then
6440 echo "export CCACHE_CPP2=y" >> $config_host_mak
6443 # build tree in object directory in case the source is not in the current directory
6444 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
6445 DIRS="$DIRS docs docs/interop fsdev"
6446 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
6447 DIRS="$DIRS roms/seabios roms/vgabios"
6448 DIRS="$DIRS qapi-generated"
6449 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
6450 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
6451 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
6452 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
6453 FILES="$FILES pc-bios/spapr-rtas/Makefile"
6454 FILES="$FILES pc-bios/s390-ccw/Makefile"
6455 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
6456 FILES="$FILES pc-bios/qemu-icon.bmp"
6457 FILES="$FILES .gdbinit scripts" # scripts needed by relative path in .gdbinit
6458 for bios_file in \
6459 $source_path/pc-bios/*.bin \
6460 $source_path/pc-bios/*.lid \
6461 $source_path/pc-bios/*.aml \
6462 $source_path/pc-bios/*.rom \
6463 $source_path/pc-bios/*.dtb \
6464 $source_path/pc-bios/*.img \
6465 $source_path/pc-bios/openbios-* \
6466 $source_path/pc-bios/u-boot.* \
6467 $source_path/pc-bios/palcode-*
6469 FILES="$FILES pc-bios/$(basename $bios_file)"
6470 done
6471 for test_file in $(find $source_path/tests/acpi-test-data -type f)
6473 FILES="$FILES tests/acpi-test-data$(echo $test_file | sed -e 's/.*acpi-test-data//')"
6474 done
6475 mkdir -p $DIRS
6476 for f in $FILES ; do
6477 if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
6478 symlink "$source_path/$f" "$f"
6480 done
6482 # temporary config to build submodules
6483 for rom in seabios vgabios ; do
6484 config_mak=roms/$rom/config.mak
6485 echo "# Automatically generated by configure - do not modify" > $config_mak
6486 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
6487 echo "AS=$as" >> $config_mak
6488 echo "CCAS=$ccas" >> $config_mak
6489 echo "CC=$cc" >> $config_mak
6490 echo "BCC=bcc" >> $config_mak
6491 echo "CPP=$cpp" >> $config_mak
6492 echo "OBJCOPY=objcopy" >> $config_mak
6493 echo "IASL=$iasl" >> $config_mak
6494 echo "LD=$ld" >> $config_mak
6495 done
6497 # set up tests data directory
6498 if [ ! -e tests/data ]; then
6499 symlink "$source_path/tests/data" tests/data
6502 # set up qemu-iotests in this build directory
6503 iotests_common_env="tests/qemu-iotests/common.env"
6504 iotests_check="tests/qemu-iotests/check"
6506 echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
6507 echo >> "$iotests_common_env"
6508 echo "export PYTHON='$python'" >> "$iotests_common_env"
6510 if [ ! -e "$iotests_check" ]; then
6511 symlink "$source_path/$iotests_check" "$iotests_check"
6514 # Save the configure command line for later reuse.
6515 cat <<EOD >config.status
6516 #!/bin/sh
6517 # Generated by configure.
6518 # Run this file to recreate the current configuration.
6519 # Compiler output produced by configure, useful for debugging
6520 # configure, is in config.log if it exists.
6522 printf "exec" >>config.status
6523 printf " '%s'" "$0" "$@" >>config.status
6524 echo ' "$@"' >>config.status
6525 chmod +x config.status
6527 rm -r "$TMPDIR1"