dataplane: implement async flush
[qemu/ar7.git] / configure
blob0e516f9e2aa136b1b8fe18fe5cc30ed59c533c95
1 #!/bin/sh
3 # qemu configure script (c) 2003 Fabrice Bellard
6 # Temporary directory used for files created while
7 # configure runs. Since it is in the build directory
8 # we can safely blow away any previous version of it
9 # (and we need not jump through hoops to try to delete
10 # it when configure exits.)
11 TMPDIR1="config-temp"
12 rm -rf "${TMPDIR1}"
13 mkdir -p "${TMPDIR1}"
14 if [ $? -ne 0 ]; then
15 echo "ERROR: failed to create temporary directory"
16 exit 1
19 TMPB="qemu-conf"
20 TMPC="${TMPDIR1}/${TMPB}.c"
21 TMPO="${TMPDIR1}/${TMPB}.o"
22 TMPCXX="${TMPDIR1}/${TMPB}.cxx"
23 TMPL="${TMPDIR1}/${TMPB}.lo"
24 TMPA="${TMPDIR1}/lib${TMPB}.la"
25 TMPE="${TMPDIR1}/${TMPB}.exe"
27 rm -f config.log
29 # Print a helpful header at the top of config.log
30 echo "# QEMU configure log $(date)" >> config.log
31 printf "# Configured with:" >> config.log
32 printf " '%s'" "$0" "$@" >> config.log
33 echo >> config.log
34 echo "#" >> config.log
36 error_exit() {
37 echo
38 echo "ERROR: $1"
39 while test -n "$2"; do
40 echo " $2"
41 shift
42 done
43 echo
44 exit 1
47 do_compiler() {
48 # Run the compiler, capturing its output to the log. First argument
49 # is compiler binary to execute.
50 local compiler="$1"
51 shift
52 echo $compiler "$@" >> config.log
53 $compiler "$@" >> config.log 2>&1 || return $?
54 # Test passed. If this is an --enable-werror build, rerun
55 # the test with -Werror and bail out if it fails. This
56 # makes warning-generating-errors in configure test code
57 # obvious to developers.
58 if test "$werror" != "yes"; then
59 return 0
61 # Don't bother rerunning the compile if we were already using -Werror
62 case "$*" in
63 *-Werror*)
64 return 0
66 esac
67 echo $compiler -Werror "$@" >> config.log
68 $compiler -Werror "$@" >> config.log 2>&1 && return $?
69 error_exit "configure test passed without -Werror but failed with -Werror." \
70 "This is probably a bug in the configure script. The failing command" \
71 "will be at the bottom of config.log." \
72 "You can run configure with --disable-werror to bypass this check."
75 do_cc() {
76 do_compiler "$cc" "$@"
79 do_cxx() {
80 do_compiler "$cxx" "$@"
83 update_cxxflags() {
84 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
85 # options which some versions of GCC's C++ compiler complain about
86 # because they only make sense for C programs.
87 QEMU_CXXFLAGS=
88 for arg in $QEMU_CFLAGS; do
89 case $arg in
90 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
91 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
94 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
96 esac
97 done
100 compile_object() {
101 do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
104 compile_prog() {
105 local_cflags="$1"
106 local_ldflags="$2"
107 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
110 do_libtool() {
111 local mode=$1
112 shift
113 # Run the compiler, capturing its output to the log.
114 echo $libtool $mode --tag=CC $cc "$@" >> config.log
115 $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $?
116 # Test passed. If this is an --enable-werror build, rerun
117 # the test with -Werror and bail out if it fails. This
118 # makes warning-generating-errors in configure test code
119 # obvious to developers.
120 if test "$werror" != "yes"; then
121 return 0
123 # Don't bother rerunning the compile if we were already using -Werror
124 case "$*" in
125 *-Werror*)
126 return 0
128 esac
129 echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log
130 $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $?
131 error_exit "configure test passed without -Werror but failed with -Werror." \
132 "This is probably a bug in the configure script. The failing command" \
133 "will be at the bottom of config.log." \
134 "You can run configure with --disable-werror to bypass this check."
137 libtool_prog() {
138 do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $?
139 do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib
142 # symbolically link $1 to $2. Portable version of "ln -sf".
143 symlink() {
144 rm -rf "$2"
145 mkdir -p "$(dirname "$2")"
146 ln -s "$1" "$2"
149 # check whether a command is available to this shell (may be either an
150 # executable or a builtin)
151 has() {
152 type "$1" >/dev/null 2>&1
155 # search for an executable in PATH
156 path_of() {
157 local_command="$1"
158 local_ifs="$IFS"
159 local_dir=""
161 # pathname has a dir component?
162 if [ "${local_command#*/}" != "$local_command" ]; then
163 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
164 echo "$local_command"
165 return 0
168 if [ -z "$local_command" ]; then
169 return 1
172 IFS=:
173 for local_dir in $PATH; do
174 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
175 echo "$local_dir/$local_command"
176 IFS="${local_ifs:-$(printf ' \t\n')}"
177 return 0
179 done
180 # not found
181 IFS="${local_ifs:-$(printf ' \t\n')}"
182 return 1
185 # default parameters
186 source_path=`dirname "$0"`
187 cpu=""
188 iasl="iasl"
189 interp_prefix="/usr/gnemul/qemu-%M"
190 static="no"
191 cross_prefix=""
192 audio_drv_list=""
193 block_drv_rw_whitelist=""
194 block_drv_ro_whitelist=""
195 host_cc="cc"
196 libs_softmmu=""
197 libs_tools=""
198 audio_pt_int=""
199 audio_win_int=""
200 cc_i386=i386-pc-linux-gnu-gcc
201 libs_qga=""
202 debug_info="yes"
203 stack_protector=""
205 # Don't accept a target_list environment variable.
206 unset target_list
208 # Default value for a variable defining feature "foo".
209 # * foo="no" feature will only be used if --enable-foo arg is given
210 # * foo="" feature will be searched for, and if found, will be used
211 # unless --disable-foo is given
212 # * foo="yes" this value will only be set by --enable-foo flag.
213 # feature will searched for,
214 # if not found, configure exits with error
216 # Always add --enable-foo and --disable-foo command line args.
217 # Distributions want to ensure that several features are compiled in, and it
218 # is impossible without a --enable-foo that exits if a feature is not found.
220 bluez=""
221 brlapi=""
222 curl=""
223 curses=""
224 docs=""
225 fdt=""
226 netmap="no"
227 pixman=""
228 sdl=""
229 sdlabi="1.2"
230 virtfs=""
231 vnc="yes"
232 sparse="no"
233 uuid=""
234 vde=""
235 vnc_tls=""
236 vnc_sasl=""
237 vnc_jpeg=""
238 vnc_png=""
239 vnc_ws=""
240 xen=""
241 xen_ctrl_version=""
242 xen_pci_passthrough=""
243 linux_aio=""
244 cap_ng=""
245 attr=""
246 libattr=""
247 xfs=""
249 vhost_net="no"
250 vhost_scsi="no"
251 kvm="no"
252 rdma=""
253 gprof="no"
254 debug_tcg="no"
255 debug="no"
256 strip_opt="yes"
257 tcg_interpreter="no"
258 bigendian="no"
259 mingw32="no"
260 gcov="no"
261 gcov_tool="gcov"
262 EXESUF=""
263 DSOSUF=".so"
264 LDFLAGS_SHARED="-shared"
265 modules="no"
266 prefix="/usr/local"
267 mandir="\${prefix}/share/man"
268 datadir="\${prefix}/share"
269 qemu_docdir="\${prefix}/share/doc/qemu"
270 bindir="\${prefix}/bin"
271 libdir="\${prefix}/lib"
272 libexecdir="\${prefix}/libexec"
273 includedir="\${prefix}/include"
274 sysconfdir="\${prefix}/etc"
275 local_statedir="\${prefix}/var"
276 confsuffix="/qemu"
277 slirp="yes"
278 fmod_lib=""
279 fmod_inc=""
280 oss_lib=""
281 bsd="no"
282 linux="no"
283 solaris="no"
284 profiler="no"
285 cocoa="no"
286 softmmu="yes"
287 linux_user="no"
288 bsd_user="no"
289 guest_base="yes"
290 aix="no"
291 blobs="yes"
292 pkgversion=""
293 pie=""
294 zero_malloc=""
295 qom_cast_debug="yes"
296 trace_backend="nop"
297 trace_file="trace"
298 spice=""
299 rbd=""
300 smartcard_nss=""
301 libusb=""
302 usb_redir=""
303 glx=""
304 zlib="yes"
305 lzo="no"
306 snappy="no"
307 guest_agent=""
308 guest_agent_with_vss="no"
309 vss_win32_sdk=""
310 win_sdk="no"
311 want_tools="yes"
312 libiscsi=""
313 libnfs=""
314 coroutine=""
315 coroutine_pool=""
316 seccomp=""
317 glusterfs=""
318 glusterfs_discard="no"
319 glusterfs_zerofill="no"
320 virtio_blk_data_plane=""
321 gtk=""
322 gtkabi=""
323 vte=""
324 tpm="no"
325 libssh2=""
326 vhdx=""
327 quorum="no"
329 # parse CC options first
330 for opt do
331 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
332 case "$opt" in
333 --cross-prefix=*) cross_prefix="$optarg"
335 --cc=*) CC="$optarg"
337 --cxx=*) CXX="$optarg"
339 --source-path=*) source_path="$optarg"
341 --cpu=*) cpu="$optarg"
343 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
344 EXTRA_CFLAGS="$optarg"
346 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
347 EXTRA_LDFLAGS="$optarg"
349 --enable-debug-info) debug_info="yes"
351 --disable-debug-info) debug_info="no"
353 esac
354 done
355 # OS specific
356 # Using uname is really, really broken. Once we have the right set of checks
357 # we can eliminate its usage altogether.
359 # Preferred compiler:
360 # ${CC} (if set)
361 # ${cross_prefix}gcc (if cross-prefix specified)
362 # system compiler
363 if test -z "${CC}${cross_prefix}"; then
364 cc="$host_cc"
365 else
366 cc="${CC-${cross_prefix}gcc}"
369 if test -z "${CXX}${cross_prefix}"; then
370 cxx="c++"
371 else
372 cxx="${CXX-${cross_prefix}g++}"
375 ar="${AR-${cross_prefix}ar}"
376 as="${AS-${cross_prefix}as}"
377 cpp="${CPP-$cc -E}"
378 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
379 ld="${LD-${cross_prefix}ld}"
380 libtool="${LIBTOOL-${cross_prefix}libtool}"
381 strip="${STRIP-${cross_prefix}strip}"
382 windres="${WINDRES-${cross_prefix}windres}"
383 pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
384 query_pkg_config() {
385 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
387 pkg_config=query_pkg_config
388 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
389 sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
391 # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
392 ARFLAGS="${ARFLAGS-rv}"
394 # default flags for all hosts
395 QEMU_CFLAGS="-fno-strict-aliasing -fno-common $QEMU_CFLAGS"
396 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
397 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
398 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
399 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
400 if test "$debug_info" = "yes"; then
401 CFLAGS="-g $CFLAGS"
402 LDFLAGS="-g $LDFLAGS"
405 # make source path absolute
406 source_path=`cd "$source_path"; pwd`
408 # running configure in the source tree?
409 # we know that's the case if configure is there.
410 if test -f "./configure"; then
411 pwd_is_source_path="y"
412 else
413 pwd_is_source_path="n"
416 check_define() {
417 cat > $TMPC <<EOF
418 #if !defined($1)
419 #error $1 not defined
420 #endif
421 int main(void) { return 0; }
423 compile_object
426 if check_define __linux__ ; then
427 targetos="Linux"
428 elif check_define _WIN32 ; then
429 targetos='MINGW32'
430 elif check_define __OpenBSD__ ; then
431 targetos='OpenBSD'
432 elif check_define __sun__ ; then
433 targetos='SunOS'
434 elif check_define __HAIKU__ ; then
435 targetos='Haiku'
436 else
437 targetos=`uname -s`
440 # Some host OSes need non-standard checks for which CPU to use.
441 # Note that these checks are broken for cross-compilation: if you're
442 # cross-compiling to one of these OSes then you'll need to specify
443 # the correct CPU with the --cpu option.
444 case $targetos in
445 Darwin)
446 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
447 # run 64-bit userspace code.
448 # If the user didn't specify a CPU explicitly and the kernel says this is
449 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
450 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
451 cpu="x86_64"
454 SunOS)
455 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
456 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
457 cpu="x86_64"
459 esac
461 if test ! -z "$cpu" ; then
462 # command line argument
464 elif check_define __i386__ ; then
465 cpu="i386"
466 elif check_define __x86_64__ ; then
467 if check_define __ILP32__ ; then
468 cpu="x32"
469 else
470 cpu="x86_64"
472 elif check_define __sparc__ ; then
473 if check_define __arch64__ ; then
474 cpu="sparc64"
475 else
476 cpu="sparc"
478 elif check_define _ARCH_PPC ; then
479 if check_define _ARCH_PPC64 ; then
480 cpu="ppc64"
481 else
482 cpu="ppc"
484 elif check_define __mips__ ; then
485 cpu="mips"
486 elif check_define __ia64__ ; then
487 cpu="ia64"
488 elif check_define __s390__ ; then
489 if check_define __s390x__ ; then
490 cpu="s390x"
491 else
492 cpu="s390"
494 elif check_define __arm__ ; then
495 cpu="arm"
496 elif check_define __aarch64__ ; then
497 cpu="aarch64"
498 elif check_define __hppa__ ; then
499 cpu="hppa"
500 else
501 cpu=`uname -m`
504 ARCH=
505 # Normalise host CPU name and set ARCH.
506 # Note that this case should only have supported host CPUs, not guests.
507 case "$cpu" in
508 ia64|ppc|ppc64|s390|s390x|sparc64|x32)
509 cpu="$cpu"
511 i386|i486|i586|i686|i86pc|BePC)
512 cpu="i386"
514 x86_64|amd64)
515 cpu="x86_64"
517 armv*b|armv*l|arm)
518 cpu="arm"
520 aarch64)
521 cpu="aarch64"
523 mips*)
524 cpu="mips"
526 sparc|sun4[cdmuv])
527 cpu="sparc"
530 # This will result in either an error or falling back to TCI later
531 ARCH=unknown
533 esac
534 if test -z "$ARCH"; then
535 ARCH="$cpu"
538 # OS specific
540 case $targetos in
541 CYGWIN*)
542 mingw32="yes"
543 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
544 audio_possible_drivers="winwave sdl"
545 audio_drv_list="winwave"
547 MINGW32*)
548 mingw32="yes"
549 audio_possible_drivers="winwave dsound sdl fmod"
550 audio_drv_list="winwave"
552 GNU/kFreeBSD)
553 bsd="yes"
554 audio_drv_list="oss"
555 audio_possible_drivers="oss sdl esd pa"
557 FreeBSD)
558 bsd="yes"
559 make="${MAKE-gmake}"
560 audio_drv_list="oss"
561 audio_possible_drivers="oss sdl esd pa"
562 # needed for kinfo_getvmmap(3) in libutil.h
563 LIBS="-lutil $LIBS"
564 netmap="" # enable netmap autodetect
566 DragonFly)
567 bsd="yes"
568 make="${MAKE-gmake}"
569 audio_drv_list="oss"
570 audio_possible_drivers="oss sdl esd pa"
572 NetBSD)
573 bsd="yes"
574 make="${MAKE-gmake}"
575 audio_drv_list="oss"
576 audio_possible_drivers="oss sdl esd"
577 oss_lib="-lossaudio"
579 OpenBSD)
580 bsd="yes"
581 make="${MAKE-gmake}"
582 audio_drv_list="sdl"
583 audio_possible_drivers="sdl esd"
585 Darwin)
586 bsd="yes"
587 darwin="yes"
588 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
589 if [ "$cpu" = "x86_64" ] ; then
590 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
591 LDFLAGS="-arch x86_64 $LDFLAGS"
593 cocoa="yes"
594 audio_drv_list="coreaudio"
595 audio_possible_drivers="coreaudio sdl fmod"
596 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
597 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
598 # Disable attempts to use ObjectiveC features in os/object.h since they
599 # won't work when we're compiling with gcc as a C compiler.
600 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
602 SunOS)
603 solaris="yes"
604 make="${MAKE-gmake}"
605 install="${INSTALL-ginstall}"
606 ld="gld"
607 smbd="${SMBD-/usr/sfw/sbin/smbd}"
608 needs_libsunmath="no"
609 solarisrev=`uname -r | cut -f2 -d.`
610 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
611 if test "$solarisrev" -le 9 ; then
612 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
613 needs_libsunmath="yes"
614 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
615 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
616 LIBS="-lsunmath $LIBS"
617 else
618 error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
619 "libsunmath from the Sun Studio compilers tools, due to a lack of" \
620 "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
621 "Studio 11 can be downloaded from www.sun.com."
625 if test -f /usr/include/sys/soundcard.h ; then
626 audio_drv_list="oss"
628 audio_possible_drivers="oss sdl"
629 # needed for CMSG_ macros in sys/socket.h
630 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
631 # needed for TIOCWIN* defines in termios.h
632 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
633 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
634 solarisnetlibs="-lsocket -lnsl -lresolv"
635 LIBS="$solarisnetlibs $LIBS"
636 libs_qga="$solarisnetlibs $libs_qga"
638 AIX)
639 aix="yes"
640 make="${MAKE-gmake}"
642 Haiku)
643 haiku="yes"
644 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
645 LIBS="-lposix_error_mapper -lnetwork $LIBS"
648 audio_drv_list="oss"
649 audio_possible_drivers="oss alsa sdl esd pa"
650 linux="yes"
651 linux_user="yes"
652 kvm="yes"
653 vhost_net="yes"
654 vhost_scsi="yes"
655 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
656 audio_possible_drivers="$audio_possible_drivers fmod"
658 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
660 esac
662 if [ "$bsd" = "yes" ] ; then
663 if [ "$darwin" != "yes" ] ; then
664 bsd_user="yes"
668 : ${make=${MAKE-make}}
669 : ${install=${INSTALL-install}}
670 : ${python=${PYTHON-python}}
671 : ${smbd=${SMBD-/usr/sbin/smbd}}
673 # Default objcc to clang if available, otherwise use CC
674 if has clang; then
675 objcc=clang
676 else
677 objcc="$cc"
680 if test "$mingw32" = "yes" ; then
681 EXESUF=".exe"
682 DSOSUF=".dll"
683 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
684 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
685 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
686 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
687 cat > $TMPC << EOF
688 int main(void) { return 0; }
690 if compile_prog "" "-liberty" ; then
691 LIBS="-liberty $LIBS"
693 prefix="c:/Program Files/QEMU"
694 mandir="\${prefix}"
695 datadir="\${prefix}"
696 qemu_docdir="\${prefix}"
697 bindir="\${prefix}"
698 sysconfdir="\${prefix}"
699 local_statedir=
700 confsuffix=""
701 libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
704 werror=""
706 for opt do
707 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
708 case "$opt" in
709 --help|-h) show_help=yes
711 --version|-V) exec cat $source_path/VERSION
713 --prefix=*) prefix="$optarg"
715 --interp-prefix=*) interp_prefix="$optarg"
717 --source-path=*)
719 --cross-prefix=*)
721 --cc=*)
723 --host-cc=*) host_cc="$optarg"
725 --cxx=*)
727 --iasl=*) iasl="$optarg"
729 --objcc=*) objcc="$optarg"
731 --make=*) make="$optarg"
733 --install=*) install="$optarg"
735 --python=*) python="$optarg"
737 --gcov=*) gcov_tool="$optarg"
739 --smbd=*) smbd="$optarg"
741 --extra-cflags=*)
743 --extra-ldflags=*)
745 --enable-debug-info)
747 --disable-debug-info)
749 --enable-modules)
750 modules="yes"
752 --cpu=*)
754 --target-list=*) target_list="$optarg"
756 --enable-trace-backend=*) trace_backend="$optarg"
758 --with-trace-file=*) trace_file="$optarg"
760 --enable-gprof) gprof="yes"
762 --enable-gcov) gcov="yes"
764 --static)
765 static="yes"
766 LDFLAGS="-static $LDFLAGS"
767 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
769 --mandir=*) mandir="$optarg"
771 --bindir=*) bindir="$optarg"
773 --libdir=*) libdir="$optarg"
775 --libexecdir=*) libexecdir="$optarg"
777 --includedir=*) includedir="$optarg"
779 --datadir=*) datadir="$optarg"
781 --with-confsuffix=*) confsuffix="$optarg"
783 --docdir=*) qemu_docdir="$optarg"
785 --sysconfdir=*) sysconfdir="$optarg"
787 --localstatedir=*) local_statedir="$optarg"
789 --sbindir=*|--sharedstatedir=*|\
790 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
791 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
792 # These switches are silently ignored, for compatibility with
793 # autoconf-generated configure scripts. This allows QEMU's
794 # configure to be used by RPM and similar macros that set
795 # lots of directory switches by default.
797 --with-system-pixman) pixman="system"
799 --without-system-pixman) pixman="internal"
801 --without-pixman) pixman="none"
803 --disable-sdl) sdl="no"
805 --enable-sdl) sdl="yes"
807 --with-sdlabi=*) sdlabi="$optarg"
809 --disable-qom-cast-debug) qom_cast_debug="no"
811 --enable-qom-cast-debug) qom_cast_debug="yes"
813 --disable-virtfs) virtfs="no"
815 --enable-virtfs) virtfs="yes"
817 --disable-vnc) vnc="no"
819 --enable-vnc) vnc="yes"
821 --fmod-lib=*) fmod_lib="$optarg"
823 --fmod-inc=*) fmod_inc="$optarg"
825 --oss-lib=*) oss_lib="$optarg"
827 --audio-drv-list=*) audio_drv_list="$optarg"
829 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
831 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
833 --enable-debug-tcg) debug_tcg="yes"
835 --disable-debug-tcg) debug_tcg="no"
837 --enable-debug)
838 # Enable debugging options that aren't excessively noisy
839 debug_tcg="yes"
840 debug="yes"
841 strip_opt="no"
843 --enable-sparse) sparse="yes"
845 --disable-sparse) sparse="no"
847 --disable-strip) strip_opt="no"
849 --disable-vnc-tls) vnc_tls="no"
851 --enable-vnc-tls) vnc_tls="yes"
853 --disable-vnc-sasl) vnc_sasl="no"
855 --enable-vnc-sasl) vnc_sasl="yes"
857 --disable-vnc-jpeg) vnc_jpeg="no"
859 --enable-vnc-jpeg) vnc_jpeg="yes"
861 --disable-vnc-png) vnc_png="no"
863 --enable-vnc-png) vnc_png="yes"
865 --disable-vnc-ws) vnc_ws="no"
867 --enable-vnc-ws) vnc_ws="yes"
869 --disable-slirp) slirp="no"
871 --disable-uuid) uuid="no"
873 --enable-uuid) uuid="yes"
875 --disable-vde) vde="no"
877 --enable-vde) vde="yes"
879 --disable-netmap) netmap="no"
881 --enable-netmap) netmap="yes"
883 --disable-xen) xen="no"
885 --enable-xen) xen="yes"
887 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
889 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
891 --disable-brlapi) brlapi="no"
893 --enable-brlapi) brlapi="yes"
895 --disable-bluez) bluez="no"
897 --enable-bluez) bluez="yes"
899 --disable-kvm) kvm="no"
901 --enable-kvm) kvm="yes"
903 --disable-tcg-interpreter) tcg_interpreter="no"
905 --enable-tcg-interpreter) tcg_interpreter="yes"
907 --disable-cap-ng) cap_ng="no"
909 --enable-cap-ng) cap_ng="yes"
911 --disable-spice) spice="no"
913 --enable-spice) spice="yes"
915 --disable-libiscsi) libiscsi="no"
917 --enable-libiscsi) libiscsi="yes"
919 --disable-libnfs) libnfs="no"
921 --enable-libnfs) libnfs="yes"
923 --enable-profiler) profiler="yes"
925 --disable-cocoa) cocoa="no"
927 --enable-cocoa)
928 cocoa="yes" ;
929 sdl="no" ;
930 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
932 --disable-system) softmmu="no"
934 --enable-system) softmmu="yes"
936 --disable-user)
937 linux_user="no" ;
938 bsd_user="no" ;
940 --enable-user) ;;
941 --disable-linux-user) linux_user="no"
943 --enable-linux-user) linux_user="yes"
945 --disable-bsd-user) bsd_user="no"
947 --enable-bsd-user) bsd_user="yes"
949 --enable-guest-base) guest_base="yes"
951 --disable-guest-base) guest_base="no"
953 --enable-pie) pie="yes"
955 --disable-pie) pie="no"
957 --enable-werror) werror="yes"
959 --disable-werror) werror="no"
961 --enable-stack-protector) stack_protector="yes"
963 --disable-stack-protector) stack_protector="no"
965 --disable-curses) curses="no"
967 --enable-curses) curses="yes"
969 --disable-curl) curl="no"
971 --enable-curl) curl="yes"
973 --disable-fdt) fdt="no"
975 --enable-fdt) fdt="yes"
977 --disable-linux-aio) linux_aio="no"
979 --enable-linux-aio) linux_aio="yes"
981 --disable-attr) attr="no"
983 --enable-attr) attr="yes"
985 --disable-blobs) blobs="no"
987 --with-pkgversion=*) pkgversion=" ($optarg)"
989 --with-coroutine=*) coroutine="$optarg"
991 --disable-coroutine-pool) coroutine_pool="no"
993 --enable-coroutine-pool) coroutine_pool="yes"
995 --disable-docs) docs="no"
997 --enable-docs) docs="yes"
999 --disable-vhost-net) vhost_net="no"
1001 --enable-vhost-net) vhost_net="yes"
1003 --disable-vhost-scsi) vhost_scsi="no"
1005 --enable-vhost-scsi) vhost_scsi="yes"
1007 --disable-glx) glx="no"
1009 --enable-glx) glx="yes"
1011 --disable-rbd) rbd="no"
1013 --enable-rbd) rbd="yes"
1015 --disable-xfsctl) xfs="no"
1017 --enable-xfsctl) xfs="yes"
1019 --disable-smartcard-nss) smartcard_nss="no"
1021 --enable-smartcard-nss) smartcard_nss="yes"
1023 --disable-libusb) libusb="no"
1025 --enable-libusb) libusb="yes"
1027 --disable-usb-redir) usb_redir="no"
1029 --enable-usb-redir) usb_redir="yes"
1031 --disable-zlib-test) zlib="no"
1033 --enable-lzo) lzo="yes"
1035 --enable-snappy) snappy="yes"
1037 --enable-guest-agent) guest_agent="yes"
1039 --disable-guest-agent) guest_agent="no"
1041 --with-vss-sdk) vss_win32_sdk=""
1043 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1045 --without-vss-sdk) vss_win32_sdk="no"
1047 --with-win-sdk) win_sdk=""
1049 --with-win-sdk=*) win_sdk="$optarg"
1051 --without-win-sdk) win_sdk="no"
1053 --enable-tools) want_tools="yes"
1055 --disable-tools) want_tools="no"
1057 --enable-seccomp) seccomp="yes"
1059 --disable-seccomp) seccomp="no"
1061 --disable-glusterfs) glusterfs="no"
1063 --enable-glusterfs) glusterfs="yes"
1065 --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
1067 --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
1069 --disable-gtk) gtk="no"
1071 --enable-gtk) gtk="yes"
1073 --enable-rdma) rdma="yes"
1075 --disable-rdma) rdma="no"
1077 --with-gtkabi=*) gtkabi="$optarg"
1079 --disable-vte) vte="no"
1081 --enable-vte) vte="yes"
1083 --enable-tpm) tpm="yes"
1085 --disable-libssh2) libssh2="no"
1087 --enable-libssh2) libssh2="yes"
1089 --enable-vhdx) vhdx="yes"
1091 --disable-vhdx) vhdx="no"
1093 --disable-quorum) quorum="no"
1095 --enable-quorum) quorum="yes"
1098 echo "ERROR: unknown option $opt"
1099 echo "Try '$0 --help' for more information"
1100 exit 1
1102 esac
1103 done
1105 if ! has $python; then
1106 error_exit "Python not found. Use --python=/path/to/python"
1109 # Note that if the Python conditional here evaluates True we will exit
1110 # with status 1 which is a shell 'false' value.
1111 if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1112 error_exit "Cannot use '$python', Python 2.4 or later is required." \
1113 "Note that Python 3 or later is not yet supported." \
1114 "Use --python=/path/to/python to specify a supported Python."
1117 # The -B switch was added in Python 2.6.
1118 # If it is supplied, compiled files are not written.
1119 # Use it for Python versions which support it.
1120 if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
1121 python="$python -B"
1124 case "$cpu" in
1125 ppc)
1126 CPU_CFLAGS="-m32"
1127 LDFLAGS="-m32 $LDFLAGS"
1129 ppc64)
1130 CPU_CFLAGS="-m64"
1131 LDFLAGS="-m64 $LDFLAGS"
1133 sparc)
1134 LDFLAGS="-m32 $LDFLAGS"
1135 CPU_CFLAGS="-m32 -mcpu=ultrasparc"
1137 sparc64)
1138 LDFLAGS="-m64 $LDFLAGS"
1139 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
1141 s390)
1142 CPU_CFLAGS="-m31"
1143 LDFLAGS="-m31 $LDFLAGS"
1145 s390x)
1146 CPU_CFLAGS="-m64"
1147 LDFLAGS="-m64 $LDFLAGS"
1149 i386)
1150 CPU_CFLAGS="-m32"
1151 LDFLAGS="-m32 $LDFLAGS"
1152 cc_i386='$(CC) -m32'
1154 x86_64)
1155 CPU_CFLAGS="-m64"
1156 LDFLAGS="-m64 $LDFLAGS"
1157 cc_i386='$(CC) -m32'
1159 x32)
1160 CPU_CFLAGS="-mx32"
1161 LDFLAGS="-mx32 $LDFLAGS"
1162 cc_i386='$(CC) -m32'
1164 # No special flags required for other host CPUs
1165 esac
1167 QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1168 EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1170 default_target_list=""
1172 mak_wilds=""
1174 if [ "$softmmu" = "yes" ]; then
1175 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
1177 if [ "$linux_user" = "yes" ]; then
1178 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
1180 if [ "$bsd_user" = "yes" ]; then
1181 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
1184 for config in $mak_wilds; do
1185 default_target_list="${default_target_list} $(basename "$config" .mak)"
1186 done
1188 if test x"$show_help" = x"yes" ; then
1189 cat << EOF
1191 Usage: configure [options]
1192 Options: [defaults in brackets after descriptions]
1194 Standard options:
1195 --help print this message
1196 --prefix=PREFIX install in PREFIX [$prefix]
1197 --interp-prefix=PREFIX where to find shared libraries, etc.
1198 use %M for cpu name [$interp_prefix]
1199 --target-list=LIST set target list (default: build everything)
1200 $(echo Available targets: $default_target_list | \
1201 fold -s -w 53 | sed -e 's/^/ /')
1203 Advanced options (experts only):
1204 --source-path=PATH path of source code [$source_path]
1205 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1206 --cc=CC use C compiler CC [$cc]
1207 --iasl=IASL use ACPI compiler IASL [$iasl]
1208 --host-cc=CC use C compiler CC [$host_cc] for code run at
1209 build time
1210 --cxx=CXX use C++ compiler CXX [$cxx]
1211 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1212 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
1213 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1214 --make=MAKE use specified make [$make]
1215 --install=INSTALL use specified install [$install]
1216 --python=PYTHON use specified python [$python]
1217 --smbd=SMBD use specified smbd [$smbd]
1218 --static enable static build [$static]
1219 --mandir=PATH install man pages in PATH
1220 --datadir=PATH install firmware in PATH$confsuffix
1221 --docdir=PATH install documentation in PATH$confsuffix
1222 --bindir=PATH install binaries in PATH
1223 --libdir=PATH install libraries in PATH
1224 --sysconfdir=PATH install config in PATH$confsuffix
1225 --localstatedir=PATH install local state in PATH (set at runtime on win32)
1226 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
1227 --enable-modules enable modules support
1228 --enable-debug-tcg enable TCG debugging
1229 --disable-debug-tcg disable TCG debugging (default)
1230 --enable-debug-info enable debugging information (default)
1231 --disable-debug-info disable debugging information
1232 --enable-debug enable common debug build options
1233 --enable-sparse enable sparse checker
1234 --disable-sparse disable sparse checker (default)
1235 --disable-strip disable stripping binaries
1236 --disable-werror disable compilation abort on warning
1237 --disable-stack-protector disable compiler-provided stack protection
1238 --disable-sdl disable SDL
1239 --enable-sdl enable SDL
1240 --with-sdlabi select preferred SDL ABI 1.2 or 2.0
1241 --disable-gtk disable gtk UI
1242 --enable-gtk enable gtk UI
1243 --with-gtkabi select preferred GTK ABI 2.0 or 3.0
1244 --disable-virtfs disable VirtFS
1245 --enable-virtfs enable VirtFS
1246 --disable-vnc disable VNC
1247 --enable-vnc enable VNC
1248 --disable-cocoa disable Cocoa (Mac OS X only)
1249 --enable-cocoa enable Cocoa (default on Mac OS X)
1250 --audio-drv-list=LIST set audio drivers list:
1251 Available drivers: $audio_possible_drivers
1252 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1253 --block-drv-rw-whitelist=L
1254 set block driver read-write whitelist
1255 (affects only QEMU, not qemu-img)
1256 --block-drv-ro-whitelist=L
1257 set block driver read-only whitelist
1258 (affects only QEMU, not qemu-img)
1259 --disable-xen disable xen backend driver support
1260 --enable-xen enable xen backend driver support
1261 --disable-xen-pci-passthrough
1262 --enable-xen-pci-passthrough
1263 --disable-brlapi disable BrlAPI
1264 --enable-brlapi enable BrlAPI
1265 --disable-vnc-tls disable TLS encryption for VNC server
1266 --enable-vnc-tls enable TLS encryption for VNC server
1267 --disable-vnc-sasl disable SASL encryption for VNC server
1268 --enable-vnc-sasl enable SASL encryption for VNC server
1269 --disable-vnc-jpeg disable JPEG lossy compression for VNC server
1270 --enable-vnc-jpeg enable JPEG lossy compression for VNC server
1271 --disable-vnc-png disable PNG compression for VNC server (default)
1272 --enable-vnc-png enable PNG compression for VNC server
1273 --disable-vnc-ws disable Websockets support for VNC server
1274 --enable-vnc-ws enable Websockets support for VNC server
1275 --disable-curses disable curses output
1276 --enable-curses enable curses output
1277 --disable-curl disable curl connectivity
1278 --enable-curl enable curl connectivity
1279 --disable-fdt disable fdt device tree
1280 --enable-fdt enable fdt device tree
1281 --disable-bluez disable bluez stack connectivity
1282 --enable-bluez enable bluez stack connectivity
1283 --disable-slirp disable SLIRP userspace network connectivity
1284 --disable-kvm disable KVM acceleration support
1285 --enable-kvm enable KVM acceleration support
1286 --disable-rdma disable RDMA-based migration support
1287 --enable-rdma enable RDMA-based migration support
1288 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1289 --enable-system enable all system emulation targets
1290 --disable-system disable all system emulation targets
1291 --enable-user enable supported user emulation targets
1292 --disable-user disable all user emulation targets
1293 --enable-linux-user enable all linux usermode emulation targets
1294 --disable-linux-user disable all linux usermode emulation targets
1295 --enable-bsd-user enable all BSD usermode emulation targets
1296 --disable-bsd-user disable all BSD usermode emulation targets
1297 --enable-guest-base enable GUEST_BASE support for usermode
1298 emulation targets
1299 --disable-guest-base disable GUEST_BASE support
1300 --enable-pie build Position Independent Executables
1301 --disable-pie do not build Position Independent Executables
1302 --fmod-lib path to FMOD library
1303 --fmod-inc path to FMOD includes
1304 --oss-lib path to OSS library
1305 --cpu=CPU Build for host CPU [$cpu]
1306 --disable-uuid disable uuid support
1307 --enable-uuid enable uuid support
1308 --disable-vde disable support for vde network
1309 --enable-vde enable support for vde network
1310 --disable-netmap disable support for netmap network
1311 --enable-netmap enable support for netmap network
1312 --disable-linux-aio disable Linux AIO support
1313 --enable-linux-aio enable Linux AIO support
1314 --disable-cap-ng disable libcap-ng support
1315 --enable-cap-ng enable libcap-ng support
1316 --disable-attr disables attr and xattr support
1317 --enable-attr enable attr and xattr support
1318 --disable-blobs disable installing provided firmware blobs
1319 --enable-docs enable documentation build
1320 --disable-docs disable documentation build
1321 --disable-vhost-net disable vhost-net acceleration support
1322 --enable-vhost-net enable vhost-net acceleration support
1323 --enable-trace-backend=B Set trace backend
1324 Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
1325 --with-trace-file=NAME Full PATH,NAME of file to store traces
1326 Default:trace-<pid>
1327 --disable-spice disable spice
1328 --enable-spice enable spice
1329 --enable-rbd enable building the rados block device (rbd)
1330 --disable-libiscsi disable iscsi support
1331 --enable-libiscsi enable iscsi support
1332 --disable-libnfs disable nfs support
1333 --enable-libnfs enable nfs support
1334 --disable-smartcard-nss disable smartcard nss support
1335 --enable-smartcard-nss enable smartcard nss support
1336 --disable-libusb disable libusb (for usb passthrough)
1337 --enable-libusb enable libusb (for usb passthrough)
1338 --disable-usb-redir disable usb network redirection support
1339 --enable-usb-redir enable usb network redirection support
1340 --enable-lzo enable the support of lzo compression library
1341 --enable-snappy enable the support of snappy compression library
1342 --disable-guest-agent disable building of the QEMU Guest Agent
1343 --enable-guest-agent enable building of the QEMU Guest Agent
1344 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1345 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1346 --disable-seccomp disable seccomp support
1347 --enable-seccomp enables seccomp support
1348 --with-coroutine=BACKEND coroutine backend. Supported options:
1349 gthread, ucontext, sigaltstack, windows
1350 --disable-coroutine-pool disable coroutine freelist (worse performance)
1351 --enable-coroutine-pool enable coroutine freelist (better performance)
1352 --enable-glusterfs enable GlusterFS backend
1353 --disable-glusterfs disable GlusterFS backend
1354 --enable-gcov enable test coverage analysis with gcov
1355 --gcov=GCOV use specified gcov [$gcov_tool]
1356 --enable-tpm enable TPM support
1357 --disable-libssh2 disable ssh block device support
1358 --enable-libssh2 enable ssh block device support
1359 --disable-vhdx disables support for the Microsoft VHDX image format
1360 --enable-vhdx enable support for the Microsoft VHDX image format
1361 --disable-quorum disable quorum block filter support
1362 --enable-quorum enable quorum block filter support
1364 NOTE: The object files are built at the place where configure is launched
1366 exit 0
1369 # Now we have handled --enable-tcg-interpreter and know we're not just
1370 # printing the help message, bail out if the host CPU isn't supported.
1371 if test "$ARCH" = "unknown"; then
1372 if test "$tcg_interpreter" = "yes" ; then
1373 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1374 ARCH=tci
1375 else
1376 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1380 # Consult white-list to determine whether to enable werror
1381 # by default. Only enable by default for git builds
1382 z_version=`cut -f3 -d. $source_path/VERSION`
1384 if test -z "$werror" ; then
1385 if test -d "$source_path/.git" -a \
1386 "$linux" = "yes" ; then
1387 werror="yes"
1388 else
1389 werror="no"
1393 # check that the C compiler works.
1394 cat > $TMPC <<EOF
1395 int main(void) { return 0; }
1398 if compile_object ; then
1399 : C compiler works ok
1400 else
1401 error_exit "\"$cc\" either does not exist or does not work"
1404 # Check that the C++ compiler exists and works with the C compiler
1405 if has $cxx; then
1406 cat > $TMPC <<EOF
1407 int c_function(void);
1408 int main(void) { return c_function(); }
1411 compile_object
1413 cat > $TMPCXX <<EOF
1414 extern "C" {
1415 int c_function(void);
1417 int c_function(void) { return 42; }
1420 update_cxxflags
1422 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
1423 # C++ compiler $cxx works ok with C compiler $cc
1425 else
1426 echo "C++ compiler $cxx does not work with C compiler $cc"
1427 echo "Disabling C++ specific optional code"
1428 cxx=
1430 else
1431 echo "No C++ compiler available; disabling C++ specific optional code"
1432 cxx=
1435 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1436 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1437 gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1438 gcc_flags="-Wendif-labels $gcc_flags"
1439 gcc_flags="-Wno-initializer-overrides $gcc_flags"
1440 gcc_flags="-Wno-string-plus-int $gcc_flags"
1441 # Note that we do not add -Werror to gcc_flags here, because that would
1442 # enable it for all configure tests. If a configure test failed due
1443 # to -Werror this would just silently disable some features,
1444 # so it's too error prone.
1445 cat > $TMPC << EOF
1446 int main(void) { return 0; }
1448 for flag in $gcc_flags; do
1449 # Use the positive sense of the flag when testing for -Wno-wombat
1450 # support (gcc will happily accept the -Wno- form of unknown
1451 # warning options).
1452 optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1453 if compile_prog "-Werror $optflag" "" ; then
1454 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1456 done
1458 if test "$stack_protector" != "no" ; then
1459 gcc_flags="-fstack-protector-strong -fstack-protector-all"
1460 for flag in $gcc_flags; do
1461 # We need to check both a compile and a link, since some compiler
1462 # setups fail only on a .c->.o compile and some only at link time
1463 if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
1464 compile_prog "-Werror $flag" ""; then
1465 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1466 LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,$flag"
1467 break
1469 done
1472 # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1473 # large functions that use global variables. The bug is in all releases of
1474 # GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1475 # 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1476 cat > $TMPC << EOF
1477 #if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1478 int main(void) { return 0; }
1479 #else
1480 #error No bug in this compiler.
1481 #endif
1483 if compile_prog "-Werror -fno-gcse" "" ; then
1484 TRANSLATE_OPT_CFLAGS=-fno-gcse
1487 if test "$static" = "yes" ; then
1488 if test "$modules" = "yes" ; then
1489 error_exit "static and modules are mutually incompatible"
1491 if test "$pie" = "yes" ; then
1492 error_exit "static and pie are mutually incompatible"
1493 else
1494 pie="no"
1498 if test "$pie" = ""; then
1499 case "$cpu-$targetos" in
1500 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
1503 pie="no"
1505 esac
1508 if test "$pie" != "no" ; then
1509 cat > $TMPC << EOF
1511 #ifdef __linux__
1512 # define THREAD __thread
1513 #else
1514 # define THREAD
1515 #endif
1517 static THREAD int tls_var;
1519 int main(void) { return tls_var; }
1522 if compile_prog "-fPIE -DPIE" "-pie"; then
1523 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1524 LDFLAGS="-pie $LDFLAGS"
1525 pie="yes"
1526 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1527 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1529 else
1530 if test "$pie" = "yes"; then
1531 error_exit "PIE not available due to missing toolchain support"
1532 else
1533 echo "Disabling PIE due to missing toolchain support"
1534 pie="no"
1538 if compile_prog "-fno-pie" "-nopie"; then
1539 CFLAGS_NOPIE="-fno-pie"
1540 LDFLAGS_NOPIE="-nopie"
1544 # check for broken gcc and libtool in RHEL5
1545 if test -n "$libtool" -a "$pie" != "no" ; then
1546 cat > $TMPC <<EOF
1548 void *f(unsigned char *buf, int len);
1549 void *g(unsigned char *buf, int len);
1551 void *
1552 f(unsigned char *buf, int len)
1554 return (void*)0L;
1557 void *
1558 g(unsigned char *buf, int len)
1560 return f(buf, len);
1564 if ! libtool_prog; then
1565 echo "Disabling libtool due to broken toolchain support"
1566 libtool=
1570 ##########################################
1571 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
1572 # use i686 as default anyway, but for those that don't, an explicit
1573 # specification is necessary
1575 if test "$cpu" = "i386"; then
1576 cat > $TMPC << EOF
1577 static int sfaa(int *ptr)
1579 return __sync_fetch_and_and(ptr, 0);
1582 int main(void)
1584 int val = 42;
1585 val = __sync_val_compare_and_swap(&val, 0, 1);
1586 sfaa(&val);
1587 return val;
1590 if ! compile_prog "" "" ; then
1591 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1595 #########################################
1596 # Solaris specific configure tool chain decisions
1598 if test "$solaris" = "yes" ; then
1599 if has $install; then
1601 else
1602 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1603 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1604 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1606 if test "`path_of $install`" = "/usr/sbin/install" ; then
1607 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1608 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1609 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1611 if has ar; then
1613 else
1614 if test -f /usr/ccs/bin/ar ; then
1615 error_exit "No path includes ar" \
1616 "Add /usr/ccs/bin to your path and rerun configure"
1618 error_exit "No path includes ar"
1622 if test -z "${target_list+xxx}" ; then
1623 target_list="$default_target_list"
1624 else
1625 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1628 # Check that we recognised the target name; this allows a more
1629 # friendly error message than if we let it fall through.
1630 for target in $target_list; do
1631 case " $default_target_list " in
1632 *" $target "*)
1635 error_exit "Unknown target name '$target'"
1637 esac
1638 done
1640 # see if system emulation was really requested
1641 case " $target_list " in
1642 *"-softmmu "*) softmmu=yes
1644 *) softmmu=no
1646 esac
1648 feature_not_found() {
1649 feature=$1
1650 remedy=$2
1652 error_exit "User requested feature $feature" \
1653 "configure was not able to find it." \
1654 "$remedy"
1657 # ---
1658 # big/little endian test
1659 cat > $TMPC << EOF
1660 short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1661 short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1662 extern int foo(short *, short *);
1663 int main(int argc, char *argv[]) {
1664 return foo(big_endian, little_endian);
1668 if compile_object ; then
1669 if grep -q BiGeNdIaN $TMPO ; then
1670 bigendian="yes"
1671 elif grep -q LiTtLeEnDiAn $TMPO ; then
1672 bigendian="no"
1673 else
1674 echo big/little test failed
1676 else
1677 echo big/little test failed
1680 ##########################################
1681 # pkg-config probe
1683 if ! has "$pkg_config_exe"; then
1684 error_exit "pkg-config binary '$pkg_config_exe' not found"
1687 ##########################################
1688 # NPTL probe
1690 if test "$linux_user" = "yes"; then
1691 cat > $TMPC <<EOF
1692 #include <sched.h>
1693 #include <linux/futex.h>
1694 int main(void) {
1695 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1696 #error bork
1697 #endif
1698 return 0;
1701 if ! compile_object ; then
1702 feature_not_found "nptl" "Install glibc and linux kernel headers."
1706 ##########################################
1707 # zlib check
1709 if test "$zlib" != "no" ; then
1710 cat > $TMPC << EOF
1711 #include <zlib.h>
1712 int main(void) { zlibVersion(); return 0; }
1714 if compile_prog "" "-lz" ; then
1716 else
1717 error_exit "zlib check failed" \
1718 "Make sure to have the zlib libs and headers installed."
1721 LIBS="$LIBS -lz"
1723 ##########################################
1724 # lzo check
1726 if test "$lzo" != "no" ; then
1727 cat > $TMPC << EOF
1728 #include <lzo/lzo1x.h>
1729 int main(void) { lzo_version(); return 0; }
1731 if compile_prog "" "-llzo2" ; then
1733 else
1734 error_exit "lzo check failed" \
1735 "Make sure to have the lzo libs and headers installed."
1738 libs_softmmu="$libs_softmmu -llzo2"
1741 ##########################################
1742 # snappy check
1744 if test "$snappy" != "no" ; then
1745 cat > $TMPC << EOF
1746 #include <snappy-c.h>
1747 int main(void) { snappy_max_compressed_length(4096); return 0; }
1749 if compile_prog "" "-lsnappy" ; then
1751 else
1752 error_exit "snappy check failed" \
1753 "Make sure to have the snappy libs and headers installed."
1756 libs_softmmu="$libs_softmmu -lsnappy"
1759 ##########################################
1760 # libseccomp check
1762 if test "$seccomp" != "no" ; then
1763 if $pkg_config --atleast-version=2.1.0 libseccomp; then
1764 libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
1765 QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
1766 seccomp="yes"
1767 else
1768 if test "$seccomp" = "yes"; then
1769 feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
1771 seccomp="no"
1774 ##########################################
1775 # xen probe
1777 if test "$xen" != "no" ; then
1778 xen_libs="-lxenstore -lxenctrl -lxenguest"
1780 # First we test whether Xen headers and libraries are available.
1781 # If no, we are done and there is no Xen support.
1782 # If yes, more tests are run to detect the Xen version.
1784 # Xen (any)
1785 cat > $TMPC <<EOF
1786 #include <xenctrl.h>
1787 int main(void) {
1788 return 0;
1791 if ! compile_prog "" "$xen_libs" ; then
1792 # Xen not found
1793 if test "$xen" = "yes" ; then
1794 feature_not_found "xen" "Install xen devel"
1796 xen=no
1798 # Xen unstable
1799 elif
1800 cat > $TMPC <<EOF &&
1801 #include <xenctrl.h>
1802 #include <xenstore.h>
1803 #include <stdint.h>
1804 #include <xen/hvm/hvm_info_table.h>
1805 #if !defined(HVM_MAX_VCPUS)
1806 # error HVM_MAX_VCPUS not defined
1807 #endif
1808 int main(void) {
1809 xc_interface *xc;
1810 xs_daemon_open();
1811 xc = xc_interface_open(0, 0, 0);
1812 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1813 xc_gnttab_open(NULL, 0);
1814 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1815 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1816 return 0;
1819 compile_prog "" "$xen_libs"
1820 then
1821 xen_ctrl_version=420
1822 xen=yes
1824 elif
1825 cat > $TMPC <<EOF &&
1826 #include <xenctrl.h>
1827 #include <xs.h>
1828 #include <stdint.h>
1829 #include <xen/hvm/hvm_info_table.h>
1830 #if !defined(HVM_MAX_VCPUS)
1831 # error HVM_MAX_VCPUS not defined
1832 #endif
1833 int main(void) {
1834 xs_daemon_open();
1835 xc_interface_open(0, 0, 0);
1836 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1837 xc_gnttab_open(NULL, 0);
1838 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1839 return 0;
1842 compile_prog "" "$xen_libs"
1843 then
1844 xen_ctrl_version=410
1845 xen=yes
1847 # Xen 4.0.0
1848 elif
1849 cat > $TMPC <<EOF &&
1850 #include <xenctrl.h>
1851 #include <xs.h>
1852 #include <stdint.h>
1853 #include <xen/hvm/hvm_info_table.h>
1854 #if !defined(HVM_MAX_VCPUS)
1855 # error HVM_MAX_VCPUS not defined
1856 #endif
1857 int main(void) {
1858 struct xen_add_to_physmap xatp = {
1859 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1861 xs_daemon_open();
1862 xc_interface_open();
1863 xc_gnttab_open();
1864 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1865 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1866 return 0;
1869 compile_prog "" "$xen_libs"
1870 then
1871 xen_ctrl_version=400
1872 xen=yes
1874 # Xen 3.4.0
1875 elif
1876 cat > $TMPC <<EOF &&
1877 #include <xenctrl.h>
1878 #include <xs.h>
1879 int main(void) {
1880 struct xen_add_to_physmap xatp = {
1881 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1883 xs_daemon_open();
1884 xc_interface_open();
1885 xc_gnttab_open();
1886 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1887 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1888 return 0;
1891 compile_prog "" "$xen_libs"
1892 then
1893 xen_ctrl_version=340
1894 xen=yes
1896 # Xen 3.3.0
1897 elif
1898 cat > $TMPC <<EOF &&
1899 #include <xenctrl.h>
1900 #include <xs.h>
1901 int main(void) {
1902 xs_daemon_open();
1903 xc_interface_open();
1904 xc_gnttab_open();
1905 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1906 return 0;
1909 compile_prog "" "$xen_libs"
1910 then
1911 xen_ctrl_version=330
1912 xen=yes
1914 # Xen version unsupported
1915 else
1916 if test "$xen" = "yes" ; then
1917 feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
1919 xen=no
1922 if test "$xen" = yes; then
1923 libs_softmmu="$xen_libs $libs_softmmu"
1927 if test "$xen_pci_passthrough" != "no"; then
1928 if test "$xen" = "yes" && test "$linux" = "yes" &&
1929 test "$xen_ctrl_version" -ge 340; then
1930 xen_pci_passthrough=yes
1931 else
1932 if test "$xen_pci_passthrough" = "yes"; then
1933 if test "$xen_ctrl_version" -lt 340; then
1934 error_exit "User requested feature Xen PCI Passthrough" \
1935 "This feature does not work with Xen 3.3"
1937 error_exit "User requested feature Xen PCI Passthrough" \
1938 " but this feature requires /sys from Linux"
1940 xen_pci_passthrough=no
1944 ##########################################
1945 # libtool probe
1947 if ! has $libtool; then
1948 libtool=
1951 # MacOSX ships with a libtool which isn't the GNU one; weed this
1952 # out by checking whether libtool supports the --version switch
1953 if test -n "$libtool"; then
1954 if ! "$libtool" --version >/dev/null 2>&1; then
1955 libtool=
1959 ##########################################
1960 # Sparse probe
1961 if test "$sparse" != "no" ; then
1962 if has cgcc; then
1963 sparse=yes
1964 else
1965 if test "$sparse" = "yes" ; then
1966 feature_not_found "sparse" "Install sparse binary"
1968 sparse=no
1972 ##########################################
1973 # GTK probe
1975 if test "$gtkabi" = ""; then
1976 # The GTK ABI was not specified explicitly, so try whether 2.0 is available.
1977 # Use 3.0 as a fallback if that is available.
1978 if $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
1979 gtkabi=2.0
1980 elif $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
1981 gtkabi=3.0
1982 else
1983 gtkabi=2.0
1987 if test "$gtk" != "no"; then
1988 gtkpackage="gtk+-$gtkabi"
1989 if test "$gtkabi" = "3.0" ; then
1990 gtkversion="3.0.0"
1991 else
1992 gtkversion="2.18.0"
1994 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
1995 gtk_cflags=`$pkg_config --cflags $gtkpackage`
1996 gtk_libs=`$pkg_config --libs $gtkpackage`
1997 libs_softmmu="$gtk_libs $libs_softmmu"
1998 gtk="yes"
1999 elif test "$gtk" = "yes"; then
2000 feature_not_found "gtk" "Install gtk2 or gtk3 devel"
2001 else
2002 gtk="no"
2006 ##########################################
2007 # VTE probe
2009 if test "$vte" != "no"; then
2010 if test "$gtkabi" = "3.0"; then
2011 vtepackage="vte-2.90"
2012 vteversion="0.32.0"
2013 else
2014 vtepackage="vte"
2015 vteversion="0.24.0"
2017 if $pkg_config --exists "$vtepackage >= $vteversion"; then
2018 vte_cflags=`$pkg_config --cflags $vtepackage`
2019 vte_libs=`$pkg_config --libs $vtepackage`
2020 libs_softmmu="$vte_libs $libs_softmmu"
2021 vte="yes"
2022 elif test "$vte" = "yes"; then
2023 if test "$gtkabi" = "3.0"; then
2024 feature_not_found "vte" "Install libvte-2.90 devel"
2025 else
2026 feature_not_found "vte" "Install libvte devel"
2028 else
2029 vte="no"
2033 ##########################################
2034 # SDL probe
2036 # Look for sdl configuration program (pkg-config or sdl-config). Try
2037 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
2039 if test $sdlabi = "2.0"; then
2040 sdl_config=$sdl2_config
2041 sdlname=sdl2
2042 sdlconfigname=sdl2_config
2043 else
2044 sdlname=sdl
2045 sdlconfigname=sdl_config
2048 if test "`basename $sdl_config`" != $sdlconfigname && ! has ${sdl_config}; then
2049 sdl_config=$sdlconfigname
2052 if $pkg_config $sdlname --exists; then
2053 sdlconfig="$pkg_config $sdlname"
2054 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
2055 elif has ${sdl_config}; then
2056 sdlconfig="$sdl_config"
2057 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
2058 else
2059 if test "$sdl" = "yes" ; then
2060 feature_not_found "sdl" "Install SDL devel"
2062 sdl=no
2064 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
2065 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
2068 sdl_too_old=no
2069 if test "$sdl" != "no" ; then
2070 cat > $TMPC << EOF
2071 #include <SDL.h>
2072 #undef main /* We don't want SDL to override our main() */
2073 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
2075 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
2076 if test "$static" = "yes" ; then
2077 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
2078 else
2079 sdl_libs=`$sdlconfig --libs 2> /dev/null`
2081 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2082 if test "$_sdlversion" -lt 121 ; then
2083 sdl_too_old=yes
2084 else
2085 if test "$cocoa" = "no" ; then
2086 sdl=yes
2090 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
2091 if test "$sdl" = "yes" -a "$static" = "yes" ; then
2092 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
2093 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
2094 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
2096 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2098 else
2099 sdl=no
2101 fi # static link
2102 else # sdl not found
2103 if test "$sdl" = "yes" ; then
2104 feature_not_found "sdl" "Install SDL devel"
2106 sdl=no
2107 fi # sdl compile test
2110 if test "$sdl" = "yes" ; then
2111 cat > $TMPC <<EOF
2112 #include <SDL.h>
2113 #if defined(SDL_VIDEO_DRIVER_X11)
2114 #include <X11/XKBlib.h>
2115 #else
2116 #error No x11 support
2117 #endif
2118 int main(void) { return 0; }
2120 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2121 sdl_libs="$sdl_libs -lX11"
2123 libs_softmmu="$sdl_libs $libs_softmmu"
2126 ##########################################
2127 # RDMA needs OpenFabrics libraries
2128 if test "$rdma" != "no" ; then
2129 cat > $TMPC <<EOF
2130 #include <rdma/rdma_cma.h>
2131 int main(void) { return 0; }
2133 rdma_libs="-lrdmacm -libverbs"
2134 if compile_prog "" "$rdma_libs" ; then
2135 rdma="yes"
2136 libs_softmmu="$libs_softmmu $rdma_libs"
2137 else
2138 if test "$rdma" = "yes" ; then
2139 error_exit \
2140 " OpenFabrics librdmacm/libibverbs not present." \
2141 " Your options:" \
2142 " (1) Fast: Install infiniband packages from your distro." \
2143 " (2) Cleanest: Install libraries from www.openfabrics.org" \
2144 " (3) Also: Install softiwarp if you don't have RDMA hardware"
2146 rdma="no"
2150 ##########################################
2151 # VNC TLS/WS detection
2152 if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
2153 cat > $TMPC <<EOF
2154 #include <gnutls/gnutls.h>
2155 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
2157 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2158 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
2159 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
2160 if test "$vnc_tls" != "no" ; then
2161 vnc_tls=yes
2163 if test "$vnc_ws" != "no" ; then
2164 vnc_ws=yes
2166 libs_softmmu="$vnc_tls_libs $libs_softmmu"
2167 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
2168 else
2169 if test "$vnc_tls" = "yes" ; then
2170 feature_not_found "vnc-tls" "Install gnutls devel"
2172 if test "$vnc_ws" = "yes" ; then
2173 feature_not_found "vnc-ws" "Install gnutls devel"
2175 vnc_tls=no
2176 vnc_ws=no
2180 ##########################################
2181 # Quorum probe (check for gnutls)
2182 if test "$quorum" != "no" ; then
2183 cat > $TMPC <<EOF
2184 #include <gnutls/gnutls.h>
2185 #include <gnutls/crypto.h>
2186 int main(void) {char data[4096], digest[32];
2187 gnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest);
2188 return 0;
2191 quorum_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2192 quorum_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
2193 if compile_prog "$quorum_tls_cflags" "$quorum_tls_libs" ; then
2194 qcow_tls=yes
2195 libs_softmmu="$quorum_tls_libs $libs_softmmu"
2196 libs_tools="$quorum_tls_libs $libs_softmmu"
2197 QEMU_CFLAGS="$QEMU_CFLAGS $quorum_tls_cflags"
2198 else
2199 echo "gnutls > 2.10.0 required to compile Quorum"
2200 exit 1
2204 ##########################################
2205 # VNC SASL detection
2206 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
2207 cat > $TMPC <<EOF
2208 #include <sasl/sasl.h>
2209 #include <stdio.h>
2210 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
2212 # Assuming Cyrus-SASL installed in /usr prefix
2213 vnc_sasl_cflags=""
2214 vnc_sasl_libs="-lsasl2"
2215 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
2216 vnc_sasl=yes
2217 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
2218 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
2219 else
2220 if test "$vnc_sasl" = "yes" ; then
2221 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
2223 vnc_sasl=no
2227 ##########################################
2228 # VNC JPEG detection
2229 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
2230 cat > $TMPC <<EOF
2231 #include <stdio.h>
2232 #include <jpeglib.h>
2233 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2235 vnc_jpeg_cflags=""
2236 vnc_jpeg_libs="-ljpeg"
2237 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2238 vnc_jpeg=yes
2239 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
2240 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
2241 else
2242 if test "$vnc_jpeg" = "yes" ; then
2243 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
2245 vnc_jpeg=no
2249 ##########################################
2250 # VNC PNG detection
2251 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
2252 cat > $TMPC <<EOF
2253 //#include <stdio.h>
2254 #include <png.h>
2255 #include <stddef.h>
2256 int main(void) {
2257 png_structp png_ptr;
2258 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
2259 return png_ptr != 0;
2262 if $pkg_config libpng --exists; then
2263 vnc_png_cflags=`$pkg_config libpng --cflags`
2264 vnc_png_libs=`$pkg_config libpng --libs`
2265 else
2266 vnc_png_cflags=""
2267 vnc_png_libs="-lpng"
2269 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2270 vnc_png=yes
2271 libs_softmmu="$vnc_png_libs $libs_softmmu"
2272 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
2273 else
2274 if test "$vnc_png" = "yes" ; then
2275 feature_not_found "vnc-png" "Install libpng devel"
2277 vnc_png=no
2281 ##########################################
2282 # fnmatch() probe, used for ACL routines
2283 fnmatch="no"
2284 cat > $TMPC << EOF
2285 #include <fnmatch.h>
2286 int main(void)
2288 fnmatch("foo", "foo", 0);
2289 return 0;
2292 if compile_prog "" "" ; then
2293 fnmatch="yes"
2296 ##########################################
2297 # uuid_generate() probe, used for vdi block driver
2298 # Note that on some systems (notably MacOSX) no extra library
2299 # need be linked to get the uuid functions.
2300 if test "$uuid" != "no" ; then
2301 uuid_libs="-luuid"
2302 cat > $TMPC << EOF
2303 #include <uuid/uuid.h>
2304 int main(void)
2306 uuid_t my_uuid;
2307 uuid_generate(my_uuid);
2308 return 0;
2311 if compile_prog "" "" ; then
2312 uuid="yes"
2313 elif compile_prog "" "$uuid_libs" ; then
2314 uuid="yes"
2315 libs_softmmu="$uuid_libs $libs_softmmu"
2316 libs_tools="$uuid_libs $libs_tools"
2317 else
2318 if test "$uuid" = "yes" ; then
2319 feature_not_found "uuid" "Install libuuid devel"
2321 uuid=no
2325 if test "$vhdx" = "yes" ; then
2326 if test "$uuid" = "no" ; then
2327 error_exit "uuid required for VHDX support"
2329 elif test "$vhdx" != "no" ; then
2330 if test "$uuid" = "yes" ; then
2331 vhdx=yes
2332 else
2333 vhdx=no
2337 ##########################################
2338 # xfsctl() probe, used for raw-posix
2339 if test "$xfs" != "no" ; then
2340 cat > $TMPC << EOF
2341 #include <stddef.h> /* NULL */
2342 #include <xfs/xfs.h>
2343 int main(void)
2345 xfsctl(NULL, 0, 0, NULL);
2346 return 0;
2349 if compile_prog "" "" ; then
2350 xfs="yes"
2351 else
2352 if test "$xfs" = "yes" ; then
2353 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
2355 xfs=no
2359 ##########################################
2360 # vde libraries probe
2361 if test "$vde" != "no" ; then
2362 vde_libs="-lvdeplug"
2363 cat > $TMPC << EOF
2364 #include <libvdeplug.h>
2365 int main(void)
2367 struct vde_open_args a = {0, 0, 0};
2368 char s[] = "";
2369 vde_open(s, s, &a);
2370 return 0;
2373 if compile_prog "" "$vde_libs" ; then
2374 vde=yes
2375 libs_softmmu="$vde_libs $libs_softmmu"
2376 libs_tools="$vde_libs $libs_tools"
2377 else
2378 if test "$vde" = "yes" ; then
2379 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
2381 vde=no
2385 ##########################################
2386 # netmap support probe
2387 # Apart from looking for netmap headers, we make sure that the host API version
2388 # supports the netmap backend (>=11). The upper bound (15) is meant to simulate
2389 # a minor/major version number. Minor new features will be marked with values up
2390 # to 15, and if something happens that requires a change to the backend we will
2391 # move above 15, submit the backend fixes and modify this two bounds.
2392 if test "$netmap" != "no" ; then
2393 cat > $TMPC << EOF
2394 #include <inttypes.h>
2395 #include <net/if.h>
2396 #include <net/netmap.h>
2397 #include <net/netmap_user.h>
2398 #if (NETMAP_API < 11) || (NETMAP_API > 15)
2399 #error
2400 #endif
2401 int main(void) { return 0; }
2403 if compile_prog "" "" ; then
2404 netmap=yes
2405 else
2406 if test "$netmap" = "yes" ; then
2407 feature_not_found "netmap"
2409 netmap=no
2413 ##########################################
2414 # libcap-ng library probe
2415 if test "$cap_ng" != "no" ; then
2416 cap_libs="-lcap-ng"
2417 cat > $TMPC << EOF
2418 #include <cap-ng.h>
2419 int main(void)
2421 capng_capability_to_name(CAPNG_EFFECTIVE);
2422 return 0;
2425 if compile_prog "" "$cap_libs" ; then
2426 cap_ng=yes
2427 libs_tools="$cap_libs $libs_tools"
2428 else
2429 if test "$cap_ng" = "yes" ; then
2430 feature_not_found "cap_ng" "Install libcap-ng devel"
2432 cap_ng=no
2436 ##########################################
2437 # Sound support libraries probe
2439 audio_drv_probe()
2441 drv=$1
2442 hdr=$2
2443 lib=$3
2444 exp=$4
2445 cfl=$5
2446 cat > $TMPC << EOF
2447 #include <$hdr>
2448 int main(void) { $exp }
2450 if compile_prog "$cfl" "$lib" ; then
2452 else
2453 error_exit "$drv check failed" \
2454 "Make sure to have the $drv libs and headers installed."
2458 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
2459 for drv in $audio_drv_list; do
2460 case $drv in
2461 alsa)
2462 audio_drv_probe $drv alsa/asoundlib.h -lasound \
2463 "return snd_pcm_close((snd_pcm_t *)0);"
2464 libs_softmmu="-lasound $libs_softmmu"
2467 fmod)
2468 if test -z $fmod_lib || test -z $fmod_inc; then
2469 error_exit "You must specify path to FMOD library and headers" \
2470 "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
2472 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
2473 libs_softmmu="$fmod_lib $libs_softmmu"
2476 esd)
2477 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
2478 libs_softmmu="-lesd $libs_softmmu"
2479 audio_pt_int="yes"
2483 audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2484 "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2485 libs_softmmu="-lpulse $libs_softmmu"
2486 audio_pt_int="yes"
2489 coreaudio)
2490 libs_softmmu="-framework CoreAudio $libs_softmmu"
2493 dsound)
2494 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
2495 audio_win_int="yes"
2498 oss)
2499 libs_softmmu="$oss_lib $libs_softmmu"
2502 sdl|wav)
2503 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
2506 winwave)
2507 libs_softmmu="-lwinmm $libs_softmmu"
2508 audio_win_int="yes"
2512 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
2513 error_exit "Unknown driver '$drv' selected" \
2514 "Possible drivers are: $audio_possible_drivers"
2517 esac
2518 done
2520 ##########################################
2521 # BrlAPI probe
2523 if test "$brlapi" != "no" ; then
2524 brlapi_libs="-lbrlapi"
2525 cat > $TMPC << EOF
2526 #include <brlapi.h>
2527 #include <stddef.h>
2528 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
2530 if compile_prog "" "$brlapi_libs" ; then
2531 brlapi=yes
2532 libs_softmmu="$brlapi_libs $libs_softmmu"
2533 else
2534 if test "$brlapi" = "yes" ; then
2535 feature_not_found "brlapi" "Install brlapi devel"
2537 brlapi=no
2541 ##########################################
2542 # curses probe
2543 if test "$curses" != "no" ; then
2544 if test "$mingw32" = "yes" ; then
2545 curses_list="-lpdcurses"
2546 else
2547 curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
2549 curses_found=no
2550 cat > $TMPC << EOF
2551 #include <curses.h>
2552 int main(void) {
2553 const char *s = curses_version();
2554 resize_term(0, 0);
2555 return s != 0;
2558 IFS=:
2559 for curses_lib in $curses_list; do
2560 unset IFS
2561 if compile_prog "" "$curses_lib" ; then
2562 curses_found=yes
2563 libs_softmmu="$curses_lib $libs_softmmu"
2564 break
2566 done
2567 unset IFS
2568 if test "$curses_found" = "yes" ; then
2569 curses=yes
2570 else
2571 if test "$curses" = "yes" ; then
2572 feature_not_found "curses" "Install ncurses devel"
2574 curses=no
2578 ##########################################
2579 # curl probe
2580 if test "$curl" != "no" ; then
2581 if $pkg_config libcurl --exists; then
2582 curlconfig="$pkg_config libcurl"
2583 else
2584 curlconfig=curl-config
2586 cat > $TMPC << EOF
2587 #include <curl/curl.h>
2588 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2590 curl_cflags=`$curlconfig --cflags 2>/dev/null`
2591 curl_libs=`$curlconfig --libs 2>/dev/null`
2592 if compile_prog "$curl_cflags" "$curl_libs" ; then
2593 curl=yes
2594 else
2595 if test "$curl" = "yes" ; then
2596 feature_not_found "curl" "Install libcurl devel"
2598 curl=no
2600 fi # test "$curl"
2602 ##########################################
2603 # bluez support probe
2604 if test "$bluez" != "no" ; then
2605 cat > $TMPC << EOF
2606 #include <bluetooth/bluetooth.h>
2607 int main(void) { return bt_error(0); }
2609 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2610 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
2611 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2612 bluez=yes
2613 libs_softmmu="$bluez_libs $libs_softmmu"
2614 else
2615 if test "$bluez" = "yes" ; then
2616 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
2618 bluez="no"
2622 ##########################################
2623 # glib support probe
2625 if test "$mingw32" = yes; then
2626 # g_poll is required in order to integrate with the glib main loop.
2627 glib_req_ver=2.20
2628 else
2629 glib_req_ver=2.12
2631 glib_modules=gthread-2.0
2632 if test "$modules" = yes; then
2633 glib_modules="$glib_modules gmodule-2.0"
2636 for i in $glib_modules; do
2637 if $pkg_config --atleast-version=$glib_req_ver $i; then
2638 glib_cflags=`$pkg_config --cflags $i`
2639 glib_libs=`$pkg_config --libs $i`
2640 CFLAGS="$glib_cflags $CFLAGS"
2641 LIBS="$glib_libs $LIBS"
2642 libs_qga="$glib_libs $libs_qga"
2643 else
2644 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
2646 done
2648 ##########################################
2649 # SHA command probe for modules
2650 if test "$modules" = yes; then
2651 shacmd_probe="sha1sum sha1 shasum"
2652 for c in $shacmd_probe; do
2653 if which $c >/dev/null 2>&1; then
2654 shacmd="$c"
2655 break
2657 done
2658 if test "$shacmd" = ""; then
2659 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
2663 ##########################################
2664 # pixman support probe
2666 if test "$pixman" = ""; then
2667 if test "$want_tools" = "no" -a "$softmmu" = "no"; then
2668 pixman="none"
2669 elif $pkg_config pixman-1 > /dev/null 2>&1; then
2670 pixman="system"
2671 else
2672 pixman="internal"
2675 if test "$pixman" = "none"; then
2676 if test "$want_tools" != "no" -o "$softmmu" != "no"; then
2677 error_exit "pixman disabled but system emulation or tools build" \
2678 "enabled. You can turn off pixman only if you also" \
2679 "disable all system emulation targets and the tools" \
2680 "build with '--disable-tools --disable-system'."
2682 pixman_cflags=
2683 pixman_libs=
2684 elif test "$pixman" = "system"; then
2685 pixman_cflags=`$pkg_config --cflags pixman-1`
2686 pixman_libs=`$pkg_config --libs pixman-1`
2687 else
2688 if test ! -d ${source_path}/pixman/pixman; then
2689 error_exit "pixman not present. Your options:" \
2690 " (1) Preferred: Install the pixman devel package (any recent" \
2691 " distro should have packages as Xorg needs pixman too)." \
2692 " (2) Fetch the pixman submodule, using:" \
2693 " git submodule update --init pixman"
2695 mkdir -p pixman/pixman
2696 pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
2697 pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
2700 ##########################################
2701 # libcap probe
2703 if test "$cap" != "no" ; then
2704 cat > $TMPC <<EOF
2705 #include <stdio.h>
2706 #include <sys/capability.h>
2707 int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
2709 if compile_prog "" "-lcap" ; then
2710 cap=yes
2711 else
2712 cap=no
2716 ##########################################
2717 # pthread probe
2718 PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
2720 pthread=no
2721 cat > $TMPC << EOF
2722 #include <pthread.h>
2723 static void *f(void *p) { return NULL; }
2724 int main(void) {
2725 pthread_t thread;
2726 pthread_create(&thread, 0, f, 0);
2727 return 0;
2730 if compile_prog "" "" ; then
2731 pthread=yes
2732 else
2733 for pthread_lib in $PTHREADLIBS_LIST; do
2734 if compile_prog "" "$pthread_lib" ; then
2735 pthread=yes
2736 found=no
2737 for lib_entry in $LIBS; do
2738 if test "$lib_entry" = "$pthread_lib"; then
2739 found=yes
2740 break
2742 done
2743 if test "$found" = "no"; then
2744 LIBS="$pthread_lib $LIBS"
2746 break
2748 done
2751 if test "$mingw32" != yes -a "$pthread" = no; then
2752 error_exit "pthread check failed" \
2753 "Make sure to have the pthread libs and headers installed."
2756 # check for pthread_setname_np
2757 pthread_setname_np=no
2758 cat > $TMPC << EOF
2759 #include <pthread.h>
2761 static void *f(void *p) { return NULL; }
2762 int main(void)
2764 pthread_t thread;
2765 pthread_create(&thread, 0, f, 0);
2766 pthread_setname_np(thread, "QEMU");
2767 return 0;
2770 if compile_prog "" "$pthread_lib" ; then
2771 pthread_setname_np=yes
2774 ##########################################
2775 # rbd probe
2776 if test "$rbd" != "no" ; then
2777 cat > $TMPC <<EOF
2778 #include <stdio.h>
2779 #include <rbd/librbd.h>
2780 int main(void) {
2781 rados_t cluster;
2782 rados_create(&cluster, NULL);
2783 return 0;
2786 rbd_libs="-lrbd -lrados"
2787 if compile_prog "" "$rbd_libs" ; then
2788 rbd=yes
2789 else
2790 if test "$rbd" = "yes" ; then
2791 feature_not_found "rados block device" "Install librbd/ceph devel"
2793 rbd=no
2797 ##########################################
2798 # libssh2 probe
2799 min_libssh2_version=1.2.8
2800 if test "$libssh2" != "no" ; then
2801 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
2802 libssh2_cflags=`$pkg_config libssh2 --cflags`
2803 libssh2_libs=`$pkg_config libssh2 --libs`
2804 libssh2=yes
2805 else
2806 if test "$libssh2" = "yes" ; then
2807 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
2809 libssh2=no
2813 ##########################################
2814 # libssh2_sftp_fsync probe
2816 if test "$libssh2" = "yes"; then
2817 cat > $TMPC <<EOF
2818 #include <stdio.h>
2819 #include <libssh2.h>
2820 #include <libssh2_sftp.h>
2821 int main(void) {
2822 LIBSSH2_SESSION *session;
2823 LIBSSH2_SFTP *sftp;
2824 LIBSSH2_SFTP_HANDLE *sftp_handle;
2825 session = libssh2_session_init ();
2826 sftp = libssh2_sftp_init (session);
2827 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
2828 libssh2_sftp_fsync (sftp_handle);
2829 return 0;
2832 # libssh2_cflags/libssh2_libs defined in previous test.
2833 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
2834 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
2838 ##########################################
2839 # linux-aio probe
2841 if test "$linux_aio" != "no" ; then
2842 cat > $TMPC <<EOF
2843 #include <libaio.h>
2844 #include <sys/eventfd.h>
2845 #include <stddef.h>
2846 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2848 if compile_prog "" "-laio" ; then
2849 linux_aio=yes
2850 else
2851 if test "$linux_aio" = "yes" ; then
2852 feature_not_found "linux AIO" "Install libaio devel"
2854 linux_aio=no
2858 ##########################################
2859 # TPM passthrough is only on x86 Linux
2861 if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
2862 tpm_passthrough=$tpm
2863 else
2864 tpm_passthrough=no
2867 ##########################################
2868 # adjust virtio-blk-data-plane based on linux-aio
2870 if test "$virtio_blk_data_plane" = "yes" -a \
2871 "$linux_aio" != "yes" ; then
2872 error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
2873 elif test -z "$virtio_blk_data_plane" ; then
2874 virtio_blk_data_plane=$linux_aio
2877 ##########################################
2878 # attr probe
2880 if test "$attr" != "no" ; then
2881 cat > $TMPC <<EOF
2882 #include <stdio.h>
2883 #include <sys/types.h>
2884 #ifdef CONFIG_LIBATTR
2885 #include <attr/xattr.h>
2886 #else
2887 #include <sys/xattr.h>
2888 #endif
2889 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2891 if compile_prog "" "" ; then
2892 attr=yes
2893 # Older distros have <attr/xattr.h>, and need -lattr:
2894 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2895 attr=yes
2896 LIBS="-lattr $LIBS"
2897 libattr=yes
2898 else
2899 if test "$attr" = "yes" ; then
2900 feature_not_found "ATTR" "Install libc6 or libattr devel"
2902 attr=no
2906 ##########################################
2907 # iovec probe
2908 cat > $TMPC <<EOF
2909 #include <sys/types.h>
2910 #include <sys/uio.h>
2911 #include <unistd.h>
2912 int main(void) { return sizeof(struct iovec); }
2914 iovec=no
2915 if compile_prog "" "" ; then
2916 iovec=yes
2919 ##########################################
2920 # preadv probe
2921 cat > $TMPC <<EOF
2922 #include <sys/types.h>
2923 #include <sys/uio.h>
2924 #include <unistd.h>
2925 int main(void) { return preadv(0, 0, 0, 0); }
2927 preadv=no
2928 if compile_prog "" "" ; then
2929 preadv=yes
2932 ##########################################
2933 # fdt probe
2934 # fdt support is mandatory for at least some target architectures,
2935 # so insist on it if we're building those system emulators.
2936 fdt_required=no
2937 for target in $target_list; do
2938 case $target in
2939 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
2940 fdt_required=yes
2942 esac
2943 done
2945 if test "$fdt_required" = "yes"; then
2946 if test "$fdt" = "no"; then
2947 error_exit "fdt disabled but some requested targets require it." \
2948 "You can turn off fdt only if you also disable all the system emulation" \
2949 "targets which need it (by specifying a cut down --target-list)."
2951 fdt=yes
2954 if test "$fdt" != "no" ; then
2955 fdt_libs="-lfdt"
2956 # explicitly check for libfdt_env.h as it is missing in some stable installs
2957 cat > $TMPC << EOF
2958 #include <libfdt_env.h>
2959 int main(void) { return 0; }
2961 if compile_prog "" "$fdt_libs" ; then
2962 # system DTC is good - use it
2963 fdt=yes
2964 elif test -d ${source_path}/dtc/libfdt ; then
2965 # have submodule DTC - use it
2966 fdt=yes
2967 dtc_internal="yes"
2968 mkdir -p dtc
2969 if [ "$pwd_is_source_path" != "y" ] ; then
2970 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
2971 symlink "$source_path/dtc/scripts" "dtc/scripts"
2973 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
2974 fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
2975 elif test "$fdt" = "yes" ; then
2976 # have neither and want - prompt for system/submodule install
2977 error_exit "DTC (libfdt) not present. Your options:" \
2978 " (1) Preferred: Install the DTC (libfdt) devel package" \
2979 " (2) Fetch the DTC submodule, using:" \
2980 " git submodule update --init dtc"
2981 else
2982 # don't have and don't want
2983 fdt_libs=
2984 fdt=no
2988 libs_softmmu="$libs_softmmu $fdt_libs"
2990 ##########################################
2991 # GLX probe, used by milkymist-tmu2
2992 if test "$glx" != "no" ; then
2993 glx_libs="-lGL -lX11"
2994 cat > $TMPC << EOF
2995 #include <X11/Xlib.h>
2996 #include <GL/gl.h>
2997 #include <GL/glx.h>
2998 int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
3000 if compile_prog "" "-lGL -lX11" ; then
3001 glx=yes
3002 else
3003 if test "$glx" = "yes" ; then
3004 feature_not_found "glx" "Install GL devel (e.g. MESA)"
3006 glx_libs=
3007 glx=no
3011 ##########################################
3012 # glusterfs probe
3013 if test "$glusterfs" != "no" ; then
3014 if $pkg_config --atleast-version=3 glusterfs-api; then
3015 glusterfs="yes"
3016 glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
3017 glusterfs_libs=`$pkg_config --libs glusterfs-api`
3018 if $pkg_config --atleast-version=5 glusterfs-api; then
3019 glusterfs_discard="yes"
3021 if $pkg_config --atleast-version=6 glusterfs-api; then
3022 glusterfs_zerofill="yes"
3024 else
3025 if test "$glusterfs" = "yes" ; then
3026 feature_not_found "GlusterFS backend support" "Install glusterfs-api devel"
3028 glusterfs="no"
3032 # Check for inotify functions when we are building linux-user
3033 # emulator. This is done because older glibc versions don't
3034 # have syscall stubs for these implemented. In that case we
3035 # don't provide them even if kernel supports them.
3037 inotify=no
3038 cat > $TMPC << EOF
3039 #include <sys/inotify.h>
3042 main(void)
3044 /* try to start inotify */
3045 return inotify_init();
3048 if compile_prog "" "" ; then
3049 inotify=yes
3052 inotify1=no
3053 cat > $TMPC << EOF
3054 #include <sys/inotify.h>
3057 main(void)
3059 /* try to start inotify */
3060 return inotify_init1(0);
3063 if compile_prog "" "" ; then
3064 inotify1=yes
3067 # check if utimensat and futimens are supported
3068 utimens=no
3069 cat > $TMPC << EOF
3070 #define _ATFILE_SOURCE
3071 #include <stddef.h>
3072 #include <fcntl.h>
3073 #include <sys/stat.h>
3075 int main(void)
3077 utimensat(AT_FDCWD, "foo", NULL, 0);
3078 futimens(0, NULL);
3079 return 0;
3082 if compile_prog "" "" ; then
3083 utimens=yes
3086 # check if pipe2 is there
3087 pipe2=no
3088 cat > $TMPC << EOF
3089 #include <unistd.h>
3090 #include <fcntl.h>
3092 int main(void)
3094 int pipefd[2];
3095 return pipe2(pipefd, O_CLOEXEC);
3098 if compile_prog "" "" ; then
3099 pipe2=yes
3102 # check if accept4 is there
3103 accept4=no
3104 cat > $TMPC << EOF
3105 #include <sys/socket.h>
3106 #include <stddef.h>
3108 int main(void)
3110 accept4(0, NULL, NULL, SOCK_CLOEXEC);
3111 return 0;
3114 if compile_prog "" "" ; then
3115 accept4=yes
3118 # check if tee/splice is there. vmsplice was added same time.
3119 splice=no
3120 cat > $TMPC << EOF
3121 #include <unistd.h>
3122 #include <fcntl.h>
3123 #include <limits.h>
3125 int main(void)
3127 int len, fd = 0;
3128 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
3129 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
3130 return 0;
3133 if compile_prog "" "" ; then
3134 splice=yes
3137 ##########################################
3138 # signalfd probe
3139 signalfd="no"
3140 cat > $TMPC << EOF
3141 #include <unistd.h>
3142 #include <sys/syscall.h>
3143 #include <signal.h>
3144 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
3147 if compile_prog "" "" ; then
3148 signalfd=yes
3151 # check if eventfd is supported
3152 eventfd=no
3153 cat > $TMPC << EOF
3154 #include <sys/eventfd.h>
3156 int main(void)
3158 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
3161 if compile_prog "" "" ; then
3162 eventfd=yes
3165 # check for fallocate
3166 fallocate=no
3167 cat > $TMPC << EOF
3168 #include <fcntl.h>
3170 int main(void)
3172 fallocate(0, 0, 0, 0);
3173 return 0;
3176 if compile_prog "" "" ; then
3177 fallocate=yes
3180 # check for fallocate hole punching
3181 fallocate_punch_hole=no
3182 cat > $TMPC << EOF
3183 #include <fcntl.h>
3184 #include <linux/falloc.h>
3186 int main(void)
3188 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
3189 return 0;
3192 if compile_prog "" "" ; then
3193 fallocate_punch_hole=yes
3196 # check for sync_file_range
3197 sync_file_range=no
3198 cat > $TMPC << EOF
3199 #include <fcntl.h>
3201 int main(void)
3203 sync_file_range(0, 0, 0, 0);
3204 return 0;
3207 if compile_prog "" "" ; then
3208 sync_file_range=yes
3211 # check for linux/fiemap.h and FS_IOC_FIEMAP
3212 fiemap=no
3213 cat > $TMPC << EOF
3214 #include <sys/ioctl.h>
3215 #include <linux/fs.h>
3216 #include <linux/fiemap.h>
3218 int main(void)
3220 ioctl(0, FS_IOC_FIEMAP, 0);
3221 return 0;
3224 if compile_prog "" "" ; then
3225 fiemap=yes
3228 # check for dup3
3229 dup3=no
3230 cat > $TMPC << EOF
3231 #include <unistd.h>
3233 int main(void)
3235 dup3(0, 0, 0);
3236 return 0;
3239 if compile_prog "" "" ; then
3240 dup3=yes
3243 # check for ppoll support
3244 ppoll=no
3245 cat > $TMPC << EOF
3246 #include <poll.h>
3248 int main(void)
3250 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
3251 ppoll(&pfd, 1, 0, 0);
3252 return 0;
3255 if compile_prog "" "" ; then
3256 ppoll=yes
3259 # check for prctl(PR_SET_TIMERSLACK , ... ) support
3260 prctl_pr_set_timerslack=no
3261 cat > $TMPC << EOF
3262 #include <sys/prctl.h>
3264 int main(void)
3266 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
3267 return 0;
3270 if compile_prog "" "" ; then
3271 prctl_pr_set_timerslack=yes
3274 # check for epoll support
3275 epoll=no
3276 cat > $TMPC << EOF
3277 #include <sys/epoll.h>
3279 int main(void)
3281 epoll_create(0);
3282 return 0;
3285 if compile_prog "" "" ; then
3286 epoll=yes
3289 # epoll_create1 and epoll_pwait are later additions
3290 # so we must check separately for their presence
3291 epoll_create1=no
3292 cat > $TMPC << EOF
3293 #include <sys/epoll.h>
3295 int main(void)
3297 /* Note that we use epoll_create1 as a value, not as
3298 * a function being called. This is necessary so that on
3299 * old SPARC glibc versions where the function was present in
3300 * the library but not declared in the header file we will
3301 * fail the configure check. (Otherwise we will get a compiler
3302 * warning but not an error, and will proceed to fail the
3303 * qemu compile where we compile with -Werror.)
3305 return (int)(uintptr_t)&epoll_create1;
3308 if compile_prog "" "" ; then
3309 epoll_create1=yes
3312 epoll_pwait=no
3313 cat > $TMPC << EOF
3314 #include <sys/epoll.h>
3316 int main(void)
3318 epoll_pwait(0, 0, 0, 0, 0);
3319 return 0;
3322 if compile_prog "" "" ; then
3323 epoll_pwait=yes
3326 # check for sendfile support
3327 sendfile=no
3328 cat > $TMPC << EOF
3329 #include <sys/sendfile.h>
3331 int main(void)
3333 return sendfile(0, 0, 0, 0);
3336 if compile_prog "" "" ; then
3337 sendfile=yes
3340 # Check if tools are available to build documentation.
3341 if test "$docs" != "no" ; then
3342 if has makeinfo && has pod2man; then
3343 docs=yes
3344 else
3345 if test "$docs" = "yes" ; then
3346 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
3348 docs=no
3352 # Search for bswap_32 function
3353 byteswap_h=no
3354 cat > $TMPC << EOF
3355 #include <byteswap.h>
3356 int main(void) { return bswap_32(0); }
3358 if compile_prog "" "" ; then
3359 byteswap_h=yes
3362 # Search for bswap32 function
3363 bswap_h=no
3364 cat > $TMPC << EOF
3365 #include <sys/endian.h>
3366 #include <sys/types.h>
3367 #include <machine/bswap.h>
3368 int main(void) { return bswap32(0); }
3370 if compile_prog "" "" ; then
3371 bswap_h=yes
3374 ##########################################
3375 # Do we have libiscsi
3376 # We check for iscsi_write16_sync() to make sure we have a
3377 # at least version 1.4.0 of libiscsi.
3378 if test "$libiscsi" != "no" ; then
3379 cat > $TMPC << EOF
3380 #include <stdio.h>
3381 #include <iscsi/iscsi.h>
3382 int main(void) { iscsi_write16_sync(NULL,0,0,NULL,0,0,0,0,0,0,0); return 0; }
3384 if $pkg_config --atleast-version=1.7.0 libiscsi; then
3385 libiscsi="yes"
3386 libiscsi_cflags=$($pkg_config --cflags libiscsi)
3387 libiscsi_libs=$($pkg_config --libs libiscsi)
3388 elif compile_prog "" "-liscsi" ; then
3389 libiscsi="yes"
3390 libiscsi_libs="-liscsi"
3391 else
3392 if test "$libiscsi" = "yes" ; then
3393 feature_not_found "libiscsi" "Install libiscsi devel"
3395 libiscsi="no"
3399 # We also need to know the API version because there was an
3400 # API change from 1.4.0 to 1.5.0.
3401 if test "$libiscsi" = "yes"; then
3402 cat >$TMPC <<EOF
3403 #include <iscsi/iscsi.h>
3404 int main(void)
3406 iscsi_read10_task(0, 0, 0, 0, 0, 0, 0);
3407 return 0;
3410 if compile_prog "" "-liscsi"; then
3411 libiscsi_version="1.4.0"
3415 ##########################################
3416 # Do we need libm
3417 cat > $TMPC << EOF
3418 #include <math.h>
3419 int main(void) { return isnan(sin(0.0)); }
3421 if compile_prog "" "" ; then
3423 elif compile_prog "" "-lm" ; then
3424 LIBS="-lm $LIBS"
3425 libs_qga="-lm $libs_qga"
3426 else
3427 error_exit "libm check failed"
3430 ##########################################
3431 # Do we need librt
3432 # uClibc provides 2 versions of clock_gettime(), one with realtime
3433 # support and one without. This means that the clock_gettime() don't
3434 # need -lrt. We still need it for timer_create() so we check for this
3435 # function in addition.
3436 cat > $TMPC <<EOF
3437 #include <signal.h>
3438 #include <time.h>
3439 int main(void) {
3440 timer_create(CLOCK_REALTIME, NULL, NULL);
3441 return clock_gettime(CLOCK_REALTIME, NULL);
3445 if compile_prog "" "" ; then
3447 # we need pthread for static linking. use previous pthread test result
3448 elif compile_prog "" "-lrt $pthread_lib" ; then
3449 LIBS="-lrt $LIBS"
3450 libs_qga="-lrt $libs_qga"
3453 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
3454 "$aix" != "yes" -a "$haiku" != "yes" ; then
3455 libs_softmmu="-lutil $libs_softmmu"
3458 ##########################################
3459 # spice probe
3460 if test "$spice" != "no" ; then
3461 cat > $TMPC << EOF
3462 #include <spice.h>
3463 int main(void) { spice_server_new(); return 0; }
3465 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3466 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
3467 if $pkg_config --atleast-version=0.12.0 spice-server && \
3468 $pkg_config --atleast-version=0.12.3 spice-protocol && \
3469 compile_prog "$spice_cflags" "$spice_libs" ; then
3470 spice="yes"
3471 libs_softmmu="$libs_softmmu $spice_libs"
3472 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
3473 spice_protocol_version=$($pkg_config --modversion spice-protocol)
3474 spice_server_version=$($pkg_config --modversion spice-server)
3475 else
3476 if test "$spice" = "yes" ; then
3477 feature_not_found "spice" "Install spice-server and spice-protocol devel"
3479 spice="no"
3483 # check for libcacard for smartcard support
3484 smartcard_cflags=""
3485 # TODO - what's the minimal nss version we support?
3486 if test "$smartcard_nss" != "no"; then
3487 cat > $TMPC << EOF
3488 #include <pk11pub.h>
3489 int main(void) { PK11_FreeSlot(0); return 0; }
3491 # FIXME: do not include $glib_* in here
3492 nss_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
3493 nss_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
3494 test_cflags="$nss_cflags"
3495 # The header files in nss < 3.13.3 have a bug which causes them to
3496 # emit a warning. If we're going to compile QEMU with -Werror, then
3497 # test that the headers don't have this bug. Otherwise we would pass
3498 # the configure test but fail to compile QEMU later.
3499 if test "$werror" = "yes"; then
3500 test_cflags="-Werror $test_cflags"
3502 if test -n "$libtool" &&
3503 $pkg_config --atleast-version=3.12.8 nss && \
3504 compile_prog "$test_cflags" "$nss_libs"; then
3505 smartcard_nss="yes"
3506 else
3507 if test "$smartcard_nss" = "yes"; then
3508 feature_not_found "nss"
3510 smartcard_nss="no"
3514 # check for libusb
3515 if test "$libusb" != "no" ; then
3516 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
3517 libusb="yes"
3518 libusb_cflags=$($pkg_config --cflags libusb-1.0)
3519 libusb_libs=$($pkg_config --libs libusb-1.0)
3520 QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
3521 libs_softmmu="$libs_softmmu $libusb_libs"
3522 else
3523 if test "$libusb" = "yes"; then
3524 feature_not_found "libusb" "Install libusb devel"
3526 libusb="no"
3530 # check for usbredirparser for usb network redirection support
3531 if test "$usb_redir" != "no" ; then
3532 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
3533 usb_redir="yes"
3534 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3535 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
3536 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
3537 libs_softmmu="$libs_softmmu $usb_redir_libs"
3538 else
3539 if test "$usb_redir" = "yes"; then
3540 feature_not_found "usb-redir" "Install usbredir devel"
3542 usb_redir="no"
3546 ##########################################
3547 # check if we have VSS SDK headers for win
3549 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3550 case "$vss_win32_sdk" in
3551 "") vss_win32_include="-I$source_path" ;;
3552 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3553 # handle path with spaces. So we symlink the headers into ".sdk/vss".
3554 vss_win32_include="-I$source_path/.sdk/vss"
3555 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3557 *) vss_win32_include="-I$vss_win32_sdk"
3558 esac
3559 cat > $TMPC << EOF
3560 #define __MIDL_user_allocate_free_DEFINED__
3561 #include <inc/win2003/vss.h>
3562 int main(void) { return VSS_CTX_BACKUP; }
3564 if compile_prog "$vss_win32_include" "" ; then
3565 guest_agent_with_vss="yes"
3566 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3567 libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3568 else
3569 if test "$vss_win32_sdk" != "" ; then
3570 echo "ERROR: Please download and install Microsoft VSS SDK:"
3571 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3572 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3573 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
3574 echo "ERROR: The headers are extracted in the directory \`inc'."
3575 feature_not_found "VSS support"
3577 guest_agent_with_vss="no"
3581 ##########################################
3582 # lookup Windows platform SDK (if not specified)
3583 # The SDK is needed only to build .tlb (type library) file of guest agent
3584 # VSS provider from the source. It is usually unnecessary because the
3585 # pre-compiled .tlb file is included.
3587 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3588 if test -z "$win_sdk"; then
3589 programfiles="$PROGRAMFILES"
3590 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3591 if test -n "$programfiles"; then
3592 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3593 else
3594 feature_not_found "Windows SDK"
3596 elif test "$win_sdk" = "no"; then
3597 win_sdk=""
3601 ##########################################
3603 ##########################################
3604 # check if we have fdatasync
3606 fdatasync=no
3607 cat > $TMPC << EOF
3608 #include <unistd.h>
3609 int main(void) {
3610 #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3611 return fdatasync(0);
3612 #else
3613 #error Not supported
3614 #endif
3617 if compile_prog "" "" ; then
3618 fdatasync=yes
3621 ##########################################
3622 # check if we have madvise
3624 madvise=no
3625 cat > $TMPC << EOF
3626 #include <sys/types.h>
3627 #include <sys/mman.h>
3628 #include <stddef.h>
3629 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3631 if compile_prog "" "" ; then
3632 madvise=yes
3635 ##########################################
3636 # check if we have posix_madvise
3638 posix_madvise=no
3639 cat > $TMPC << EOF
3640 #include <sys/mman.h>
3641 #include <stddef.h>
3642 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3644 if compile_prog "" "" ; then
3645 posix_madvise=yes
3648 ##########################################
3649 # check if we have usable SIGEV_THREAD_ID
3651 sigev_thread_id=no
3652 cat > $TMPC << EOF
3653 #include <signal.h>
3654 int main(void) {
3655 struct sigevent ev;
3656 ev.sigev_notify = SIGEV_THREAD_ID;
3657 ev._sigev_un._tid = 0;
3658 asm volatile("" : : "g"(&ev));
3659 return 0;
3662 if compile_prog "" "" ; then
3663 sigev_thread_id=yes
3666 ##########################################
3667 # check if trace backend exists
3669 $python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null
3670 if test "$?" -ne 0 ; then
3671 error_exit "invalid trace backend" \
3672 "Please choose a supported trace backend."
3675 ##########################################
3676 # For 'ust' backend, test if ust headers are present
3677 if test "$trace_backend" = "ust"; then
3678 cat > $TMPC << EOF
3679 #include <lttng/tracepoint.h>
3680 int main(void) { return 0; }
3682 if compile_prog "" "" ; then
3683 if $pkg_config lttng-ust --exists; then
3684 lttng_ust_libs=`$pkg_config --libs lttng-ust`
3685 else
3686 lttng_ust_libs="-llttng-ust"
3688 if $pkg_config liburcu-bp --exists; then
3689 urcu_bp_libs=`$pkg_config --libs liburcu-bp`
3690 else
3691 urcu_bp_libs="-lurcu-bp"
3694 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
3695 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
3696 else
3697 error_exit "Trace backend 'ust' missing lttng-ust header files"
3701 ##########################################
3702 # For 'dtrace' backend, test if 'dtrace' command is present
3703 if test "$trace_backend" = "dtrace"; then
3704 if ! has 'dtrace' ; then
3705 error_exit "dtrace command is not found in PATH $PATH"
3707 trace_backend_stap="no"
3708 if has 'stap' ; then
3709 trace_backend_stap="yes"
3713 ##########################################
3714 # check and set a backend for coroutine
3716 # We prefer ucontext, but it's not always possible. The fallback
3717 # is sigcontext. gthread is not selectable except explicitly, because
3718 # it is not functional enough to run QEMU proper. (It is occasionally
3719 # useful for debugging purposes.) On Windows the only valid backend
3720 # is the Windows-specific one.
3722 ucontext_works=no
3723 if test "$darwin" != "yes"; then
3724 cat > $TMPC << EOF
3725 #include <ucontext.h>
3726 #ifdef __stub_makecontext
3727 #error Ignoring glibc stub makecontext which will always fail
3728 #endif
3729 int main(void) { makecontext(0, 0, 0); return 0; }
3731 if compile_prog "" "" ; then
3732 ucontext_works=yes
3736 if test "$coroutine" = ""; then
3737 if test "$mingw32" = "yes"; then
3738 coroutine=win32
3739 elif test "$ucontext_works" = "yes"; then
3740 coroutine=ucontext
3741 else
3742 coroutine=sigaltstack
3744 else
3745 case $coroutine in
3746 windows)
3747 if test "$mingw32" != "yes"; then
3748 error_exit "'windows' coroutine backend only valid for Windows"
3750 # Unfortunately the user visible backend name doesn't match the
3751 # coroutine-*.c filename for this case, so we have to adjust it here.
3752 coroutine=win32
3754 ucontext)
3755 if test "$ucontext_works" != "yes"; then
3756 feature_not_found "ucontext"
3759 gthread|sigaltstack)
3760 if test "$mingw32" = "yes"; then
3761 error_exit "only the 'windows' coroutine backend is valid for Windows"
3765 error_exit "unknown coroutine backend $coroutine"
3767 esac
3770 if test "$coroutine_pool" = ""; then
3771 if test "$coroutine" = "gthread"; then
3772 coroutine_pool=no
3773 else
3774 coroutine_pool=yes
3777 if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
3778 error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
3781 ##########################################
3782 # check if we have open_by_handle_at
3784 open_by_handle_at=no
3785 cat > $TMPC << EOF
3786 #include <fcntl.h>
3787 #if !defined(AT_EMPTY_PATH)
3788 # error missing definition
3789 #else
3790 int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
3791 #endif
3793 if compile_prog "" "" ; then
3794 open_by_handle_at=yes
3797 ########################################
3798 # check if we have linux/magic.h
3800 linux_magic_h=no
3801 cat > $TMPC << EOF
3802 #include <linux/magic.h>
3803 int main(void) {
3804 return 0;
3807 if compile_prog "" "" ; then
3808 linux_magic_h=yes
3811 ########################################
3812 # check whether we can disable warning option with a pragma (this is needed
3813 # to silence warnings in the headers of some versions of external libraries).
3814 # This test has to be compiled with -Werror as otherwise an unknown pragma is
3815 # only a warning.
3817 # If we can't selectively disable warning in the code, disable -Werror so that
3818 # the build doesn't fail anyway.
3820 pragma_disable_unused_but_set=no
3821 cat > $TMPC << EOF
3822 #pragma GCC diagnostic push
3823 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
3824 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
3825 #pragma GCC diagnostic pop
3827 int main(void) {
3828 return 0;
3831 if compile_prog "-Werror" "" ; then
3832 pragma_diagnostic_available=yes
3833 else
3834 werror=no
3837 ########################################
3838 # check if we have valgrind/valgrind.h and valgrind/memcheck.h
3840 valgrind_h=no
3841 cat > $TMPC << EOF
3842 #include <valgrind/valgrind.h>
3843 #include <valgrind/memcheck.h>
3844 int main(void) {
3845 return 0;
3848 if compile_prog "" "" ; then
3849 valgrind_h=yes
3852 ########################################
3853 # check if environ is declared
3855 has_environ=no
3856 cat > $TMPC << EOF
3857 #include <unistd.h>
3858 int main(void) {
3859 environ = 0;
3860 return 0;
3863 if compile_prog "" "" ; then
3864 has_environ=yes
3867 ########################################
3868 # check if cpuid.h is usable.
3870 cpuid_h=no
3871 cat > $TMPC << EOF
3872 #include <cpuid.h>
3873 int main(void) {
3874 unsigned a, b, c, d;
3875 int max = __get_cpuid_max(0, 0);
3877 if (max >= 1) {
3878 __cpuid(1, a, b, c, d);
3881 if (max >= 7) {
3882 __cpuid_count(7, 0, a, b, c, d);
3885 return 0;
3888 if compile_prog "" "" ; then
3889 cpuid_h=yes
3892 ########################################
3893 # check if __[u]int128_t is usable.
3895 int128=no
3896 cat > $TMPC << EOF
3897 #if defined(__clang_major__) && defined(__clang_minor__)
3898 # if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
3899 # error __int128_t does not work in CLANG before 3.2
3900 # endif
3901 #endif
3902 __int128_t a;
3903 __uint128_t b;
3904 int main (void) {
3905 a = a + b;
3906 b = a * b;
3907 a = a * a;
3908 return 0;
3911 if compile_prog "" "" ; then
3912 int128=yes
3915 ########################################
3916 # check if getauxval is available.
3918 getauxval=no
3919 cat > $TMPC << EOF
3920 #include <sys/auxv.h>
3921 int main(void) {
3922 return getauxval(AT_HWCAP) == 0;
3925 if compile_prog "" "" ; then
3926 getauxval=yes
3929 ##########################################
3930 # End of CC checks
3931 # After here, no more $cc or $ld runs
3933 if test "$gcov" = "yes" ; then
3934 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
3935 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
3936 elif test "$debug" = "no" ; then
3937 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
3940 ##########################################
3941 # Do we have libnfs
3942 if test "$libnfs" != "no" ; then
3943 if $pkg_config --atleast-version=1.9.3 libnfs; then
3944 libnfs="yes"
3945 libnfs_libs=$($pkg_config --libs libnfs)
3946 LIBS="$LIBS $libnfs_libs"
3947 else
3948 if test "$libnfs" = "yes" ; then
3949 feature_not_found "libnfs"
3951 libnfs="no"
3955 # Disable zero malloc errors for official releases unless explicitly told to
3956 # enable/disable
3957 if test -z "$zero_malloc" ; then
3958 if test "$z_version" = "50" ; then
3959 zero_malloc="no"
3960 else
3961 zero_malloc="yes"
3965 # Now we've finished running tests it's OK to add -Werror to the compiler flags
3966 if test "$werror" = "yes"; then
3967 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
3970 if test "$solaris" = "no" ; then
3971 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
3972 LDFLAGS="-Wl,--warn-common $LDFLAGS"
3976 # test if pod2man has --utf8 option
3977 if pod2man --help | grep -q utf8; then
3978 POD2MAN="pod2man --utf8"
3979 else
3980 POD2MAN="pod2man"
3983 # Use ASLR, no-SEH and DEP if available
3984 if test "$mingw32" = "yes" ; then
3985 for flag in --dynamicbase --no-seh --nxcompat; do
3986 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3987 LDFLAGS="-Wl,$flag $LDFLAGS"
3989 done
3992 qemu_confdir=$sysconfdir$confsuffix
3993 qemu_moddir=$libdir$confsuffix
3994 qemu_datadir=$datadir$confsuffix
3995 qemu_localedir="$datadir/locale"
3997 tools=""
3998 if test "$want_tools" = "yes" ; then
3999 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
4000 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
4001 tools="qemu-nbd\$(EXESUF) $tools"
4004 if test "$softmmu" = yes ; then
4005 if test "$virtfs" != no ; then
4006 if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
4007 virtfs=yes
4008 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
4009 else
4010 if test "$virtfs" = yes; then
4011 error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
4013 virtfs=no
4017 if [ "$guest_agent" != "no" ]; then
4018 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
4019 tools="qemu-ga\$(EXESUF) $tools"
4020 if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
4021 tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
4023 guest_agent=yes
4024 elif [ "$guest_agent" != yes ]; then
4025 guest_agent=no
4026 else
4027 error_exit "Guest agent is not supported on this platform"
4031 # Mac OS X ships with a broken assembler
4032 roms=
4033 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
4034 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
4035 "$softmmu" = yes ; then
4036 roms="optionrom"
4038 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
4039 roms="$roms spapr-rtas"
4042 if test "$cpu" = "s390x" ; then
4043 roms="$roms s390-ccw"
4046 # Probe for the need for relocating the user-only binary.
4047 if test "$pie" = "no" ; then
4048 textseg_addr=
4049 case "$cpu" in
4050 arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
4051 # ??? Rationale for choosing this address
4052 textseg_addr=0x60000000
4054 mips)
4055 # A 256M aligned address, high in the address space, with enough
4056 # room for the code_gen_buffer above it before the stack.
4057 textseg_addr=0x60000000
4059 esac
4060 if [ -n "$textseg_addr" ]; then
4061 cat > $TMPC <<EOF
4062 int main(void) { return 0; }
4064 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
4065 if ! compile_prog "" "$textseg_ldflags"; then
4066 # In case ld does not support -Ttext-segment, edit the default linker
4067 # script via sed to set the .text start addr. This is needed on FreeBSD
4068 # at least.
4069 $ld --verbose | sed \
4070 -e '1,/==================================================/d' \
4071 -e '/==================================================/,$d' \
4072 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
4073 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
4074 textseg_ldflags="-Wl,-T../config-host.ld"
4079 # add pixman flags after all config tests are done
4080 QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
4081 libs_softmmu="$libs_softmmu $pixman_libs"
4083 echo "Install prefix $prefix"
4084 echo "BIOS directory `eval echo $qemu_datadir`"
4085 echo "binary directory `eval echo $bindir`"
4086 echo "library directory `eval echo $libdir`"
4087 echo "module directory `eval echo $qemu_moddir`"
4088 echo "libexec directory `eval echo $libexecdir`"
4089 echo "include directory `eval echo $includedir`"
4090 echo "config directory `eval echo $sysconfdir`"
4091 if test "$mingw32" = "no" ; then
4092 echo "local state directory `eval echo $local_statedir`"
4093 echo "Manual directory `eval echo $mandir`"
4094 echo "ELF interp prefix $interp_prefix"
4095 else
4096 echo "local state directory queried at runtime"
4097 echo "Windows SDK $win_sdk"
4099 echo "Source path $source_path"
4100 echo "C compiler $cc"
4101 echo "Host C compiler $host_cc"
4102 echo "C++ compiler $cxx"
4103 echo "Objective-C compiler $objcc"
4104 echo "ARFLAGS $ARFLAGS"
4105 echo "CFLAGS $CFLAGS"
4106 echo "QEMU_CFLAGS $QEMU_CFLAGS"
4107 echo "LDFLAGS $LDFLAGS"
4108 echo "make $make"
4109 echo "install $install"
4110 echo "python $python"
4111 if test "$slirp" = "yes" ; then
4112 echo "smbd $smbd"
4114 echo "module support $modules"
4115 echo "host CPU $cpu"
4116 echo "host big endian $bigendian"
4117 echo "target list $target_list"
4118 echo "tcg debug enabled $debug_tcg"
4119 echo "gprof enabled $gprof"
4120 echo "sparse enabled $sparse"
4121 echo "strip binaries $strip_opt"
4122 echo "profiler $profiler"
4123 echo "static build $static"
4124 if test "$darwin" = "yes" ; then
4125 echo "Cocoa support $cocoa"
4127 echo "pixman $pixman"
4128 echo "SDL support $sdl"
4129 echo "GTK support $gtk"
4130 echo "VTE support $vte"
4131 echo "curses support $curses"
4132 echo "curl support $curl"
4133 echo "mingw32 support $mingw32"
4134 echo "Audio drivers $audio_drv_list"
4135 echo "Block whitelist (rw) $block_drv_rw_whitelist"
4136 echo "Block whitelist (ro) $block_drv_ro_whitelist"
4137 echo "VirtFS support $virtfs"
4138 echo "VNC support $vnc"
4139 if test "$vnc" = "yes" ; then
4140 echo "VNC TLS support $vnc_tls"
4141 echo "VNC SASL support $vnc_sasl"
4142 echo "VNC JPEG support $vnc_jpeg"
4143 echo "VNC PNG support $vnc_png"
4144 echo "VNC WS support $vnc_ws"
4146 if test -n "$sparc_cpu"; then
4147 echo "Target Sparc Arch $sparc_cpu"
4149 echo "xen support $xen"
4150 echo "brlapi support $brlapi"
4151 echo "bluez support $bluez"
4152 echo "Documentation $docs"
4153 echo "GUEST_BASE $guest_base"
4154 echo "PIE $pie"
4155 echo "vde support $vde"
4156 echo "netmap support $netmap"
4157 echo "Linux AIO support $linux_aio"
4158 echo "ATTR/XATTR support $attr"
4159 echo "Install blobs $blobs"
4160 echo "KVM support $kvm"
4161 echo "RDMA support $rdma"
4162 echo "TCG interpreter $tcg_interpreter"
4163 echo "fdt support $fdt"
4164 echo "preadv support $preadv"
4165 echo "fdatasync $fdatasync"
4166 echo "madvise $madvise"
4167 echo "posix_madvise $posix_madvise"
4168 echo "sigev_thread_id $sigev_thread_id"
4169 echo "uuid support $uuid"
4170 echo "libcap-ng support $cap_ng"
4171 echo "vhost-net support $vhost_net"
4172 echo "vhost-scsi support $vhost_scsi"
4173 echo "Trace backend $trace_backend"
4174 if test "$trace_backend" = "simple"; then
4175 echo "Trace output file $trace_file-<pid>"
4177 if test "$spice" = "yes"; then
4178 echo "spice support $spice ($spice_protocol_version/$spice_server_version)"
4179 else
4180 echo "spice support $spice"
4182 echo "rbd support $rbd"
4183 echo "xfsctl support $xfs"
4184 echo "nss used $smartcard_nss"
4185 echo "libusb $libusb"
4186 echo "usb net redir $usb_redir"
4187 echo "GLX support $glx"
4188 if test "$libiscsi_version" = "1.4.0"; then
4189 echo "libiscsi support $libiscsi (1.4.0)"
4190 else
4191 echo "libiscsi support $libiscsi"
4193 echo "libnfs support $libnfs"
4194 echo "build guest agent $guest_agent"
4195 echo "QGA VSS support $guest_agent_with_vss"
4196 echo "seccomp support $seccomp"
4197 echo "coroutine backend $coroutine"
4198 echo "coroutine pool $coroutine_pool"
4199 echo "GlusterFS support $glusterfs"
4200 echo "virtio-blk-data-plane $virtio_blk_data_plane"
4201 echo "gcov $gcov_tool"
4202 echo "gcov enabled $gcov"
4203 echo "TPM support $tpm"
4204 echo "libssh2 support $libssh2"
4205 echo "TPM passthrough $tpm_passthrough"
4206 echo "QOM debugging $qom_cast_debug"
4207 echo "vhdx $vhdx"
4208 echo "Quorum $quorum"
4209 echo "lzo support $lzo"
4210 echo "snappy support $snappy"
4212 if test "$sdl_too_old" = "yes"; then
4213 echo "-> Your SDL version is too old - please upgrade to have SDL support"
4216 config_host_mak="config-host.mak"
4218 echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
4220 echo "# Automatically generated by configure - do not modify" > $config_host_mak
4221 echo >> $config_host_mak
4223 echo all: >> $config_host_mak
4224 echo "prefix=$prefix" >> $config_host_mak
4225 echo "bindir=$bindir" >> $config_host_mak
4226 echo "libdir=$libdir" >> $config_host_mak
4227 echo "libexecdir=$libexecdir" >> $config_host_mak
4228 echo "includedir=$includedir" >> $config_host_mak
4229 echo "mandir=$mandir" >> $config_host_mak
4230 echo "sysconfdir=$sysconfdir" >> $config_host_mak
4231 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
4232 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
4233 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
4234 echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
4235 if test "$mingw32" = "no" ; then
4236 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
4238 echo "qemu_helperdir=$libexecdir" >> $config_host_mak
4239 echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
4240 echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
4241 echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
4242 echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
4244 echo "ARCH=$ARCH" >> $config_host_mak
4246 if test "$debug_tcg" = "yes" ; then
4247 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
4249 if test "$strip_opt" = "yes" ; then
4250 echo "STRIP=${strip}" >> $config_host_mak
4252 if test "$bigendian" = "yes" ; then
4253 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
4255 if test "$mingw32" = "yes" ; then
4256 echo "CONFIG_WIN32=y" >> $config_host_mak
4257 rc_version=`cat $source_path/VERSION`
4258 version_major=${rc_version%%.*}
4259 rc_version=${rc_version#*.}
4260 version_minor=${rc_version%%.*}
4261 rc_version=${rc_version#*.}
4262 version_subminor=${rc_version%%.*}
4263 version_micro=0
4264 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
4265 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
4266 if test "$guest_agent_with_vss" = "yes" ; then
4267 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
4268 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
4270 else
4271 echo "CONFIG_POSIX=y" >> $config_host_mak
4274 if test "$linux" = "yes" ; then
4275 echo "CONFIG_LINUX=y" >> $config_host_mak
4278 if test "$darwin" = "yes" ; then
4279 echo "CONFIG_DARWIN=y" >> $config_host_mak
4282 if test "$aix" = "yes" ; then
4283 echo "CONFIG_AIX=y" >> $config_host_mak
4286 if test "$solaris" = "yes" ; then
4287 echo "CONFIG_SOLARIS=y" >> $config_host_mak
4288 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
4289 if test "$needs_libsunmath" = "yes" ; then
4290 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
4293 if test "$haiku" = "yes" ; then
4294 echo "CONFIG_HAIKU=y" >> $config_host_mak
4296 if test "$static" = "yes" ; then
4297 echo "CONFIG_STATIC=y" >> $config_host_mak
4299 if test "$profiler" = "yes" ; then
4300 echo "CONFIG_PROFILER=y" >> $config_host_mak
4302 if test "$slirp" = "yes" ; then
4303 echo "CONFIG_SLIRP=y" >> $config_host_mak
4304 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
4306 if test "$vde" = "yes" ; then
4307 echo "CONFIG_VDE=y" >> $config_host_mak
4309 if test "$netmap" = "yes" ; then
4310 echo "CONFIG_NETMAP=y" >> $config_host_mak
4312 if test "$cap_ng" = "yes" ; then
4313 echo "CONFIG_LIBCAP=y" >> $config_host_mak
4315 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
4316 for drv in $audio_drv_list; do
4317 def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
4318 echo "$def=y" >> $config_host_mak
4319 if test "$drv" = "fmod"; then
4320 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
4322 done
4323 if test "$audio_pt_int" = "yes" ; then
4324 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
4326 if test "$audio_win_int" = "yes" ; then
4327 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
4329 echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
4330 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
4331 if test "$vnc" = "yes" ; then
4332 echo "CONFIG_VNC=y" >> $config_host_mak
4334 if test "$vnc_tls" = "yes" ; then
4335 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
4337 if test "$vnc_sasl" = "yes" ; then
4338 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
4340 if test "$vnc_jpeg" = "yes" ; then
4341 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
4343 if test "$vnc_png" = "yes" ; then
4344 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
4346 if test "$vnc_ws" = "yes" ; then
4347 echo "CONFIG_VNC_WS=y" >> $config_host_mak
4348 echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
4350 if test "$fnmatch" = "yes" ; then
4351 echo "CONFIG_FNMATCH=y" >> $config_host_mak
4353 if test "$uuid" = "yes" ; then
4354 echo "CONFIG_UUID=y" >> $config_host_mak
4356 if test "$xfs" = "yes" ; then
4357 echo "CONFIG_XFS=y" >> $config_host_mak
4359 qemu_version=`head $source_path/VERSION`
4360 echo "VERSION=$qemu_version" >>$config_host_mak
4361 echo "PKGVERSION=$pkgversion" >>$config_host_mak
4362 echo "SRC_PATH=$source_path" >> $config_host_mak
4363 echo "TARGET_DIRS=$target_list" >> $config_host_mak
4364 if [ "$docs" = "yes" ] ; then
4365 echo "BUILD_DOCS=yes" >> $config_host_mak
4367 if test "$modules" = "yes"; then
4368 # $shacmd can generate a hash started with digit, which the compiler doesn't
4369 # like as an symbol. So prefix it with an underscore
4370 echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak
4371 echo "CONFIG_MODULES=y" >> $config_host_mak
4373 if test "$sdl" = "yes" ; then
4374 echo "CONFIG_SDL=y" >> $config_host_mak
4375 echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
4376 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
4378 if test "$cocoa" = "yes" ; then
4379 echo "CONFIG_COCOA=y" >> $config_host_mak
4381 if test "$curses" = "yes" ; then
4382 echo "CONFIG_CURSES=y" >> $config_host_mak
4384 if test "$utimens" = "yes" ; then
4385 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
4387 if test "$pipe2" = "yes" ; then
4388 echo "CONFIG_PIPE2=y" >> $config_host_mak
4390 if test "$accept4" = "yes" ; then
4391 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
4393 if test "$splice" = "yes" ; then
4394 echo "CONFIG_SPLICE=y" >> $config_host_mak
4396 if test "$eventfd" = "yes" ; then
4397 echo "CONFIG_EVENTFD=y" >> $config_host_mak
4399 if test "$fallocate" = "yes" ; then
4400 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
4402 if test "$fallocate_punch_hole" = "yes" ; then
4403 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
4405 if test "$sync_file_range" = "yes" ; then
4406 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
4408 if test "$fiemap" = "yes" ; then
4409 echo "CONFIG_FIEMAP=y" >> $config_host_mak
4411 if test "$dup3" = "yes" ; then
4412 echo "CONFIG_DUP3=y" >> $config_host_mak
4414 if test "$ppoll" = "yes" ; then
4415 echo "CONFIG_PPOLL=y" >> $config_host_mak
4417 if test "$prctl_pr_set_timerslack" = "yes" ; then
4418 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
4420 if test "$epoll" = "yes" ; then
4421 echo "CONFIG_EPOLL=y" >> $config_host_mak
4423 if test "$epoll_create1" = "yes" ; then
4424 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
4426 if test "$epoll_pwait" = "yes" ; then
4427 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
4429 if test "$sendfile" = "yes" ; then
4430 echo "CONFIG_SENDFILE=y" >> $config_host_mak
4432 if test "$inotify" = "yes" ; then
4433 echo "CONFIG_INOTIFY=y" >> $config_host_mak
4435 if test "$inotify1" = "yes" ; then
4436 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
4438 if test "$byteswap_h" = "yes" ; then
4439 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
4441 if test "$bswap_h" = "yes" ; then
4442 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
4444 if test "$curl" = "yes" ; then
4445 echo "CONFIG_CURL=m" >> $config_host_mak
4446 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
4447 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
4449 if test "$brlapi" = "yes" ; then
4450 echo "CONFIG_BRLAPI=y" >> $config_host_mak
4452 if test "$bluez" = "yes" ; then
4453 echo "CONFIG_BLUEZ=y" >> $config_host_mak
4454 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
4456 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
4457 if test "$gtk" = "yes" ; then
4458 echo "CONFIG_GTK=y" >> $config_host_mak
4459 echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
4460 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
4462 if test "$vte" = "yes" ; then
4463 echo "CONFIG_VTE=y" >> $config_host_mak
4464 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
4466 if test "$xen" = "yes" ; then
4467 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
4468 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
4470 if test "$linux_aio" = "yes" ; then
4471 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
4473 if test "$attr" = "yes" ; then
4474 echo "CONFIG_ATTR=y" >> $config_host_mak
4476 if test "$libattr" = "yes" ; then
4477 echo "CONFIG_LIBATTR=y" >> $config_host_mak
4479 if test "$virtfs" = "yes" ; then
4480 echo "CONFIG_VIRTFS=y" >> $config_host_mak
4482 if test "$vhost_scsi" = "yes" ; then
4483 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
4485 if test "$blobs" = "yes" ; then
4486 echo "INSTALL_BLOBS=yes" >> $config_host_mak
4488 if test "$iovec" = "yes" ; then
4489 echo "CONFIG_IOVEC=y" >> $config_host_mak
4491 if test "$preadv" = "yes" ; then
4492 echo "CONFIG_PREADV=y" >> $config_host_mak
4494 if test "$fdt" = "yes" ; then
4495 echo "CONFIG_FDT=y" >> $config_host_mak
4497 if test "$signalfd" = "yes" ; then
4498 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
4500 if test "$tcg_interpreter" = "yes" ; then
4501 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
4503 if test "$fdatasync" = "yes" ; then
4504 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
4506 if test "$madvise" = "yes" ; then
4507 echo "CONFIG_MADVISE=y" >> $config_host_mak
4509 if test "$posix_madvise" = "yes" ; then
4510 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
4512 if test "$sigev_thread_id" = "yes" ; then
4513 echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
4516 if test "$spice" = "yes" ; then
4517 echo "CONFIG_SPICE=y" >> $config_host_mak
4520 if test "$smartcard_nss" = "yes" ; then
4521 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
4522 echo "NSS_LIBS=$nss_libs" >> $config_host_mak
4523 echo "NSS_CFLAGS=$nss_cflags" >> $config_host_mak
4526 if test "$libusb" = "yes" ; then
4527 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
4530 if test "$usb_redir" = "yes" ; then
4531 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
4534 if test "$glx" = "yes" ; then
4535 echo "CONFIG_GLX=y" >> $config_host_mak
4536 echo "GLX_LIBS=$glx_libs" >> $config_host_mak
4539 if test "$lzo" = "yes" ; then
4540 echo "CONFIG_LZO=y" >> $config_host_mak
4543 if test "$snappy" = "yes" ; then
4544 echo "CONFIG_SNAPPY=y" >> $config_host_mak
4547 if test "$libiscsi" = "yes" ; then
4548 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
4549 if test "$libiscsi_version" = "1.4.0"; then
4550 echo "CONFIG_LIBISCSI_1_4=y" >> $config_host_mak
4552 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
4553 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
4556 if test "$libnfs" = "yes" ; then
4557 echo "CONFIG_LIBNFS=y" >> $config_host_mak
4560 if test "$seccomp" = "yes"; then
4561 echo "CONFIG_SECCOMP=y" >> $config_host_mak
4564 # XXX: suppress that
4565 if [ "$bsd" = "yes" ] ; then
4566 echo "CONFIG_BSD=y" >> $config_host_mak
4569 if test "$zero_malloc" = "yes" ; then
4570 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
4572 if test "$qom_cast_debug" = "yes" ; then
4573 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
4575 if test "$rbd" = "yes" ; then
4576 echo "CONFIG_RBD=m" >> $config_host_mak
4577 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
4578 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
4581 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
4582 if test "$coroutine_pool" = "yes" ; then
4583 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
4584 else
4585 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
4588 if test "$open_by_handle_at" = "yes" ; then
4589 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
4592 if test "$linux_magic_h" = "yes" ; then
4593 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
4596 if test "$pragma_diagnostic_available" = "yes" ; then
4597 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
4600 if test "$valgrind_h" = "yes" ; then
4601 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
4604 if test "$has_environ" = "yes" ; then
4605 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
4608 if test "$cpuid_h" = "yes" ; then
4609 echo "CONFIG_CPUID_H=y" >> $config_host_mak
4612 if test "$int128" = "yes" ; then
4613 echo "CONFIG_INT128=y" >> $config_host_mak
4616 if test "$getauxval" = "yes" ; then
4617 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
4620 if test "$glusterfs" = "yes" ; then
4621 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
4622 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
4623 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
4626 if test "$glusterfs_discard" = "yes" ; then
4627 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
4630 if test "$glusterfs_zerofill" = "yes" ; then
4631 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
4634 if test "$libssh2" = "yes" ; then
4635 echo "CONFIG_LIBSSH2=m" >> $config_host_mak
4636 echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
4637 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
4640 if test "$quorum" = "yes" ; then
4641 echo "CONFIG_QUORUM=y" >> $config_host_mak
4644 if test "$virtio_blk_data_plane" = "yes" ; then
4645 echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
4648 if test "$vhdx" = "yes" ; then
4649 echo "CONFIG_VHDX=y" >> $config_host_mak
4652 # USB host support
4653 if test "$libusb" = "yes"; then
4654 echo "HOST_USB=libusb legacy" >> $config_host_mak
4655 else
4656 echo "HOST_USB=stub" >> $config_host_mak
4659 # TPM passthrough support?
4660 if test "$tpm" = "yes"; then
4661 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
4662 if test "$tpm_passthrough" = "yes"; then
4663 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
4667 # use default implementation for tracing backend-specific routines
4668 trace_default=yes
4669 echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
4670 if test "$trace_backend" = "nop"; then
4671 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
4673 if test "$trace_backend" = "simple"; then
4674 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
4675 trace_default=no
4676 # Set the appropriate trace file.
4677 trace_file="\"$trace_file-\" FMT_pid"
4679 if test "$trace_backend" = "stderr"; then
4680 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
4681 trace_default=no
4683 if test "$trace_backend" = "ust"; then
4684 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
4686 if test "$trace_backend" = "dtrace"; then
4687 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
4688 if test "$trace_backend_stap" = "yes" ; then
4689 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
4692 if test "$trace_backend" = "ftrace"; then
4693 if test "$linux" = "yes" ; then
4694 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
4695 trace_default=no
4696 else
4697 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
4700 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
4701 if test "$trace_default" = "yes"; then
4702 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
4705 if test "$rdma" = "yes" ; then
4706 echo "CONFIG_RDMA=y" >> $config_host_mak
4709 # Hold two types of flag:
4710 # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
4711 # a thread we have a handle to
4712 # CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
4713 # platform
4714 if test "$pthread_setname_np" = "yes" ; then
4715 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
4716 echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
4719 if test "$tcg_interpreter" = "yes"; then
4720 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
4721 elif test "$ARCH" = "sparc64" ; then
4722 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
4723 elif test "$ARCH" = "s390x" ; then
4724 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
4725 elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
4726 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
4727 else
4728 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
4730 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
4732 echo "TOOLS=$tools" >> $config_host_mak
4733 echo "ROMS=$roms" >> $config_host_mak
4734 echo "MAKE=$make" >> $config_host_mak
4735 echo "INSTALL=$install" >> $config_host_mak
4736 echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
4737 echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
4738 if test -n "$libtool"; then
4739 echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
4740 echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
4741 else
4742 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
4743 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
4745 echo "PYTHON=$python" >> $config_host_mak
4746 echo "CC=$cc" >> $config_host_mak
4747 if $iasl -h > /dev/null 2>&1; then
4748 echo "IASL=$iasl" >> $config_host_mak
4750 echo "CC_I386=$cc_i386" >> $config_host_mak
4751 echo "HOST_CC=$host_cc" >> $config_host_mak
4752 echo "CXX=$cxx" >> $config_host_mak
4753 echo "OBJCC=$objcc" >> $config_host_mak
4754 echo "AR=$ar" >> $config_host_mak
4755 echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
4756 echo "AS=$as" >> $config_host_mak
4757 echo "CPP=$cpp" >> $config_host_mak
4758 echo "OBJCOPY=$objcopy" >> $config_host_mak
4759 echo "LD=$ld" >> $config_host_mak
4760 echo "WINDRES=$windres" >> $config_host_mak
4761 echo "LIBTOOL=$libtool" >> $config_host_mak
4762 echo "CFLAGS=$CFLAGS" >> $config_host_mak
4763 echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
4764 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
4765 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
4766 if test "$sparse" = "yes" ; then
4767 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
4768 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
4769 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
4771 if test "$cross_prefix" != ""; then
4772 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
4773 else
4774 echo "AUTOCONF_HOST := " >> $config_host_mak
4776 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
4777 echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
4778 echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
4779 echo "LIBS+=$LIBS" >> $config_host_mak
4780 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
4781 echo "EXESUF=$EXESUF" >> $config_host_mak
4782 echo "DSOSUF=$DSOSUF" >> $config_host_mak
4783 echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
4784 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
4785 echo "POD2MAN=$POD2MAN" >> $config_host_mak
4786 echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
4787 if test "$gcov" = "yes" ; then
4788 echo "CONFIG_GCOV=y" >> $config_host_mak
4789 echo "GCOV=$gcov_tool" >> $config_host_mak
4792 # use included Linux headers
4793 if test "$linux" = "yes" ; then
4794 mkdir -p linux-headers
4795 case "$cpu" in
4796 i386|x86_64|x32)
4797 linux_arch=x86
4799 ppcemb|ppc|ppc64)
4800 linux_arch=powerpc
4802 s390x)
4803 linux_arch=s390
4805 aarch64)
4806 linux_arch=arm64
4809 # For most CPUs the kernel architecture name and QEMU CPU name match.
4810 linux_arch="$cpu"
4812 esac
4813 # For non-KVM architectures we will not have asm headers
4814 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
4815 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
4819 for target in $target_list; do
4820 target_dir="$target"
4821 config_target_mak=$target_dir/config-target.mak
4822 target_name=`echo $target | cut -d '-' -f 1`
4823 target_bigendian="no"
4825 case "$target_name" in
4826 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
4827 target_bigendian=yes
4829 esac
4830 target_softmmu="no"
4831 target_user_only="no"
4832 target_linux_user="no"
4833 target_bsd_user="no"
4834 case "$target" in
4835 ${target_name}-softmmu)
4836 target_softmmu="yes"
4838 ${target_name}-linux-user)
4839 if test "$linux" != "yes" ; then
4840 error_exit "Target '$target' is only available on a Linux host"
4842 target_user_only="yes"
4843 target_linux_user="yes"
4845 ${target_name}-bsd-user)
4846 if test "$bsd" != "yes" ; then
4847 error_exit "Target '$target' is only available on a BSD host"
4849 target_user_only="yes"
4850 target_bsd_user="yes"
4853 error_exit "Target '$target' not recognised"
4854 exit 1
4856 esac
4858 mkdir -p $target_dir
4859 echo "# Automatically generated by configure - do not modify" > $config_target_mak
4861 bflt="no"
4862 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
4863 gdb_xml_files=""
4865 TARGET_ARCH="$target_name"
4866 TARGET_BASE_ARCH=""
4867 TARGET_ABI_DIR=""
4869 case "$target_name" in
4870 i386)
4872 x86_64)
4873 TARGET_BASE_ARCH=i386
4875 alpha)
4877 arm|armeb)
4878 TARGET_ARCH=arm
4879 bflt="yes"
4880 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
4882 aarch64)
4883 TARGET_BASE_ARCH=arm
4884 bflt="yes"
4885 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml"
4887 cris)
4889 lm32)
4891 m68k)
4892 bflt="yes"
4893 gdb_xml_files="cf-core.xml cf-fp.xml"
4895 microblaze|microblazeel)
4896 TARGET_ARCH=microblaze
4897 bflt="yes"
4899 mips|mipsel)
4900 TARGET_ARCH=mips
4901 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
4903 mipsn32|mipsn32el)
4904 TARGET_ARCH=mips64
4905 TARGET_BASE_ARCH=mips
4906 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
4907 echo "TARGET_ABI32=y" >> $config_target_mak
4909 mips64|mips64el)
4910 TARGET_ARCH=mips64
4911 TARGET_BASE_ARCH=mips
4912 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
4914 moxie)
4916 or32)
4917 TARGET_ARCH=openrisc
4918 TARGET_BASE_ARCH=openrisc
4920 ppc)
4921 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4923 ppcemb)
4924 TARGET_BASE_ARCH=ppc
4925 TARGET_ABI_DIR=ppc
4926 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4928 ppc64)
4929 TARGET_BASE_ARCH=ppc
4930 TARGET_ABI_DIR=ppc
4931 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4933 ppc64abi32)
4934 TARGET_ARCH=ppc64
4935 TARGET_BASE_ARCH=ppc
4936 TARGET_ABI_DIR=ppc
4937 echo "TARGET_ABI32=y" >> $config_target_mak
4938 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4940 sh4|sh4eb)
4941 TARGET_ARCH=sh4
4942 bflt="yes"
4944 sparc)
4946 sparc64)
4947 TARGET_BASE_ARCH=sparc
4949 sparc32plus)
4950 TARGET_ARCH=sparc64
4951 TARGET_BASE_ARCH=sparc
4952 TARGET_ABI_DIR=sparc
4953 echo "TARGET_ABI32=y" >> $config_target_mak
4955 s390x)
4957 unicore32)
4959 xtensa|xtensaeb)
4960 TARGET_ARCH=xtensa
4963 error_exit "Unsupported target CPU"
4965 esac
4966 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
4967 if [ "$TARGET_BASE_ARCH" = "" ]; then
4968 TARGET_BASE_ARCH=$TARGET_ARCH
4971 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
4973 upper() {
4974 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
4977 target_arch_name="`upper $TARGET_ARCH`"
4978 echo "TARGET_$target_arch_name=y" >> $config_target_mak
4979 echo "TARGET_NAME=$target_name" >> $config_target_mak
4980 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
4981 if [ "$TARGET_ABI_DIR" = "" ]; then
4982 TARGET_ABI_DIR=$TARGET_ARCH
4984 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
4985 case "$target_name" in
4986 i386|x86_64)
4987 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
4988 echo "CONFIG_XEN=y" >> $config_target_mak
4989 if test "$xen_pci_passthrough" = yes; then
4990 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4995 esac
4996 case "$target_name" in
4997 aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
4998 # Make sure the target and host cpus are compatible
4999 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
5000 \( "$target_name" = "$cpu" -o \
5001 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
5002 \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
5003 \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
5004 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
5005 \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
5006 \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then
5007 echo "CONFIG_KVM=y" >> $config_target_mak
5008 if test "$vhost_net" = "yes" ; then
5009 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
5012 esac
5013 if test "$target_bigendian" = "yes" ; then
5014 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
5016 if test "$target_softmmu" = "yes" ; then
5017 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
5019 if test "$target_user_only" = "yes" ; then
5020 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
5021 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
5023 if test "$target_linux_user" = "yes" ; then
5024 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
5026 list=""
5027 if test ! -z "$gdb_xml_files" ; then
5028 for x in $gdb_xml_files; do
5029 list="$list $source_path/gdb-xml/$x"
5030 done
5031 echo "TARGET_XML_FILES=$list" >> $config_target_mak
5034 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
5035 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
5037 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
5038 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
5040 if test "$target_bsd_user" = "yes" ; then
5041 echo "CONFIG_BSD_USER=y" >> $config_target_mak
5044 # generate QEMU_CFLAGS/LDFLAGS for targets
5046 cflags=""
5047 ldflags=""
5049 for i in $ARCH $TARGET_BASE_ARCH ; do
5050 case "$i" in
5051 alpha)
5052 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
5053 echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak
5055 aarch64)
5056 if test -n "${cxx}"; then
5057 echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
5058 echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
5061 arm)
5062 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
5063 echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak
5064 if test -n "${cxx}"; then
5065 echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
5066 echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
5069 cris)
5070 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
5071 echo "CONFIG_CRIS_DIS=y" >> config-all-disas.mak
5073 hppa)
5074 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
5075 echo "CONFIG_HPPA_DIS=y" >> config-all-disas.mak
5077 i386|x86_64|x32)
5078 echo "CONFIG_I386_DIS=y" >> $config_target_mak
5079 echo "CONFIG_I386_DIS=y" >> config-all-disas.mak
5081 ia64*)
5082 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
5083 echo "CONFIG_IA64_DIS=y" >> config-all-disas.mak
5085 lm32)
5086 echo "CONFIG_LM32_DIS=y" >> $config_target_mak
5087 echo "CONFIG_LM32_DIS=y" >> config-all-disas.mak
5089 m68k)
5090 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
5091 echo "CONFIG_M68K_DIS=y" >> config-all-disas.mak
5093 microblaze*)
5094 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
5095 echo "CONFIG_MICROBLAZE_DIS=y" >> config-all-disas.mak
5097 mips*)
5098 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
5099 echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak
5101 moxie*)
5102 echo "CONFIG_MOXIE_DIS=y" >> $config_target_mak
5103 echo "CONFIG_MOXIE_DIS=y" >> config-all-disas.mak
5105 or32)
5106 echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak
5107 echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak
5109 ppc*)
5110 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
5111 echo "CONFIG_PPC_DIS=y" >> config-all-disas.mak
5113 s390*)
5114 echo "CONFIG_S390_DIS=y" >> $config_target_mak
5115 echo "CONFIG_S390_DIS=y" >> config-all-disas.mak
5117 sh4)
5118 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
5119 echo "CONFIG_SH4_DIS=y" >> config-all-disas.mak
5121 sparc*)
5122 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
5123 echo "CONFIG_SPARC_DIS=y" >> config-all-disas.mak
5125 xtensa*)
5126 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
5127 echo "CONFIG_XTENSA_DIS=y" >> config-all-disas.mak
5129 esac
5130 done
5131 if test "$tcg_interpreter" = "yes" ; then
5132 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
5133 echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak
5136 case "$ARCH" in
5137 alpha)
5138 # Ensure there's only a single GP
5139 cflags="-msmall-data $cflags"
5141 esac
5143 if test "$gprof" = "yes" ; then
5144 echo "TARGET_GPROF=yes" >> $config_target_mak
5145 if test "$target_linux_user" = "yes" ; then
5146 cflags="-p $cflags"
5147 ldflags="-p $ldflags"
5149 if test "$target_softmmu" = "yes" ; then
5150 ldflags="-p $ldflags"
5151 echo "GPROF_CFLAGS=-p" >> $config_target_mak
5155 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
5156 ldflags="$ldflags $textseg_ldflags"
5159 echo "LDFLAGS+=$ldflags" >> $config_target_mak
5160 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
5162 done # for target in $targets
5164 if [ "$pixman" = "internal" ]; then
5165 echo "config-host.h: subdir-pixman" >> $config_host_mak
5168 if test "$rdma" = "yes" ; then
5169 echo "CONFIG_RDMA=y" >> $config_host_mak
5172 if [ "$dtc_internal" = "yes" ]; then
5173 echo "config-host.h: subdir-dtc" >> $config_host_mak
5176 # build tree in object directory in case the source is not in the current directory
5177 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
5178 DIRS="$DIRS fsdev"
5179 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
5180 DIRS="$DIRS roms/seabios roms/vgabios"
5181 DIRS="$DIRS qapi-generated"
5182 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
5183 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
5184 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
5185 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
5186 FILES="$FILES pc-bios/spapr-rtas/Makefile"
5187 FILES="$FILES pc-bios/s390-ccw/Makefile"
5188 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
5189 FILES="$FILES pc-bios/qemu-icon.bmp"
5190 for bios_file in \
5191 $source_path/pc-bios/*.bin \
5192 $source_path/pc-bios/*.aml \
5193 $source_path/pc-bios/*.rom \
5194 $source_path/pc-bios/*.dtb \
5195 $source_path/pc-bios/*.img \
5196 $source_path/pc-bios/openbios-* \
5197 $source_path/pc-bios/palcode-*
5199 FILES="$FILES pc-bios/`basename $bios_file`"
5200 done
5201 for test_file in `find $source_path/tests/acpi-test-data -type f`
5203 FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`"
5204 done
5205 mkdir -p $DIRS
5206 for f in $FILES ; do
5207 if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
5208 symlink "$source_path/$f" "$f"
5210 done
5212 # temporary config to build submodules
5213 for rom in seabios vgabios ; do
5214 config_mak=roms/$rom/config.mak
5215 echo "# Automatically generated by configure - do not modify" > $config_mak
5216 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
5217 echo "AS=$as" >> $config_mak
5218 echo "CC=$cc" >> $config_mak
5219 echo "BCC=bcc" >> $config_mak
5220 echo "CPP=$cpp" >> $config_mak
5221 echo "OBJCOPY=objcopy" >> $config_mak
5222 echo "IASL=$iasl" >> $config_mak
5223 echo "LD=$ld" >> $config_mak
5224 done
5226 if test "$docs" = "yes" ; then
5227 mkdir -p QMP
5230 # Save the configure command line for later reuse.
5231 cat <<EOD >config.status
5232 #!/bin/sh
5233 # Generated by configure.
5234 # Run this file to recreate the current configuration.
5235 # Compiler output produced by configure, useful for debugging
5236 # configure, is in config.log if it exists.
5238 printf "exec" >>config.status
5239 printf " '%s'" "$0" "$@" >>config.status
5240 echo >>config.status
5241 chmod +x config.status
5243 rm -r "$TMPDIR1"