Merge tag 'v2.9.0-rc3'
[qemu/ar7.git] / configure
blob7de79fded06ea0a7bd413e149e4219e6fc460556
1 #!/bin/sh
3 # qemu configure script (c) 2003 Fabrice Bellard
6 # Unset some variables known to interfere with behavior of common tools,
7 # just as autoconf does.
8 CLICOLOR_FORCE= GREP_OPTIONS=
9 unset CLICOLOR_FORCE GREP_OPTIONS
11 # Don't allow CCACHE, if present, to use cached results of compile tests!
12 export CCACHE_RECACHE=yes
14 # Temporary directory used for files created while
15 # configure runs. Since it is in the build directory
16 # we can safely blow away any previous version of it
17 # (and we need not jump through hoops to try to delete
18 # it when configure exits.)
19 TMPDIR1="config-temp"
20 rm -rf "${TMPDIR1}"
21 mkdir -p "${TMPDIR1}"
22 if [ $? -ne 0 ]; then
23 echo "ERROR: failed to create temporary directory"
24 exit 1
27 TMPB="qemu-conf"
28 TMPC="${TMPDIR1}/${TMPB}.c"
29 TMPO="${TMPDIR1}/${TMPB}.o"
30 TMPCXX="${TMPDIR1}/${TMPB}.cxx"
31 TMPE="${TMPDIR1}/${TMPB}.exe"
32 TMPMO="${TMPDIR1}/${TMPB}.mo"
34 rm -f config.log
36 # Print a helpful header at the top of config.log
37 echo "# QEMU configure log $(date)" >> config.log
38 printf "# Configured with:" >> config.log
39 printf " '%s'" "$0" "$@" >> config.log
40 echo >> config.log
41 echo "#" >> config.log
43 error_exit() {
44 echo
45 echo "ERROR: $1"
46 while test -n "$2"; do
47 echo " $2"
48 shift
49 done
50 echo
51 exit 1
54 do_compiler() {
55 # Run the compiler, capturing its output to the log. First argument
56 # is compiler binary to execute.
57 local compiler="$1"
58 shift
59 echo $compiler "$@" >> config.log
60 $compiler "$@" >> config.log 2>&1 || return $?
61 # Test passed. If this is an --enable-werror build, rerun
62 # the test with -Werror and bail out if it fails. This
63 # makes warning-generating-errors in configure test code
64 # obvious to developers.
65 if test "$werror" != "yes"; then
66 return 0
68 # Don't bother rerunning the compile if we were already using -Werror
69 case "$*" in
70 *-Werror*)
71 return 0
73 esac
74 echo $compiler -Werror "$@" >> config.log
75 $compiler -Werror "$@" >> config.log 2>&1 && return $?
76 error_exit "configure test passed without -Werror but failed with -Werror." \
77 "This is probably a bug in the configure script. The failing command" \
78 "will be at the bottom of config.log." \
79 "You can run configure with --disable-werror to bypass this check."
82 do_cc() {
83 do_compiler "$cc" "$@"
86 do_cxx() {
87 do_compiler "$cxx" "$@"
90 update_cxxflags() {
91 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
92 # options which some versions of GCC's C++ compiler complain about
93 # because they only make sense for C programs.
94 QEMU_CXXFLAGS=
95 for arg in $QEMU_CFLAGS; do
96 case $arg in
97 -Wno-override-init|\
98 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
99 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
102 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
104 esac
105 done
108 compile_object() {
109 local_cflags="$1"
110 do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
113 compile_prog() {
114 local_cflags="$1"
115 local_ldflags="$2"
116 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
119 # symbolically link $1 to $2. Portable version of "ln -sf".
120 symlink() {
121 rm -rf "$2"
122 mkdir -p "$(dirname "$2")"
123 ln -s "$1" "$2"
126 # check whether a command is available to this shell (may be either an
127 # executable or a builtin)
128 has() {
129 type "$1" >/dev/null 2>&1
132 # search for an executable in PATH
133 path_of() {
134 local_command="$1"
135 local_ifs="$IFS"
136 local_dir=""
138 # pathname has a dir component?
139 if [ "${local_command#*/}" != "$local_command" ]; then
140 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
141 echo "$local_command"
142 return 0
145 if [ -z "$local_command" ]; then
146 return 1
149 IFS=:
150 for local_dir in $PATH; do
151 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
152 echo "$local_dir/$local_command"
153 IFS="${local_ifs:-$(printf ' \t\n')}"
154 return 0
156 done
157 # not found
158 IFS="${local_ifs:-$(printf ' \t\n')}"
159 return 1
162 have_backend () {
163 echo "$trace_backends" | grep "$1" >/dev/null
166 # default parameters
167 source_path=$(dirname "$0")
168 cpu=""
169 iasl="iasl"
170 interp_prefix="/usr/gnemul/qemu-%M"
171 static="no"
172 cross_prefix=""
173 audio_drv_list=""
174 block_drv_rw_whitelist=""
175 block_drv_ro_whitelist=""
176 host_cc="cc"
177 libs_softmmu=""
178 libs_tools=""
179 audio_pt_int=""
180 audio_win_int=""
181 cc_i386=i386-pc-linux-gnu-gcc
182 libs_qga=""
183 debug_info="yes"
184 stack_protector=""
186 # Don't accept a target_list environment variable.
187 unset target_list
189 # Default value for a variable defining feature "foo".
190 # * foo="no" feature will only be used if --enable-foo arg is given
191 # * foo="" feature will be searched for, and if found, will be used
192 # unless --disable-foo is given
193 # * foo="yes" this value will only be set by --enable-foo flag.
194 # feature will searched for,
195 # if not found, configure exits with error
197 # Always add --enable-foo and --disable-foo command line args.
198 # Distributions want to ensure that several features are compiled in, and it
199 # is impossible without a --enable-foo that exits if a feature is not found.
201 bluez=""
202 brlapi=""
203 curl=""
204 curses=""
205 docs=""
206 fdt=""
207 netmap="no"
208 pixman=""
209 sdl=""
210 sdlabi=""
211 virtfs=""
212 vnc="yes"
213 sparse="no"
214 vde=""
215 vnc_sasl=""
216 vnc_jpeg=""
217 vnc_png=""
218 xen=""
219 xen_ctrl_version=""
220 xen_pv_domain_build="no"
221 xen_pci_passthrough=""
222 linux_aio=""
223 cap_ng=""
224 attr=""
225 libattr=""
226 xfs=""
228 vhost_net="no"
229 vhost_scsi="no"
230 vhost_vsock="no"
231 kvm="no"
232 hax="no"
233 rdma=""
234 gprof="no"
235 debug_tcg="no"
236 debug="no"
237 fortify_source=""
238 strip_opt="yes"
239 tcg_interpreter="no"
240 bigendian="no"
241 mingw32="no"
242 gcov="no"
243 gcov_tool="gcov"
244 EXESUF=""
245 DSOSUF=".so"
246 LDFLAGS_SHARED="-shared"
247 modules="no"
248 prefix="/usr/local"
249 mandir="\${prefix}/share/man"
250 datadir="\${prefix}/share"
251 qemu_docdir="\${prefix}/share/doc/qemu"
252 bindir="\${prefix}/bin"
253 libdir="\${prefix}/lib"
254 libexecdir="\${prefix}/libexec"
255 includedir="\${prefix}/include"
256 sysconfdir="\${prefix}/etc"
257 local_statedir="\${prefix}/var"
258 confsuffix="/qemu"
259 slirp="yes"
260 oss_lib=""
261 bsd="no"
262 haiku="no"
263 linux="no"
264 solaris="no"
265 profiler="no"
266 cocoa="no"
267 softmmu="yes"
268 linux_user="no"
269 bsd_user="no"
270 aix="no"
271 blobs="yes"
272 pkgversion=""
273 pie=""
274 qom_cast_debug="yes"
275 trace_backends="log"
276 trace_file="trace"
277 spice=""
278 rbd=""
279 smartcard=""
280 libusb=""
281 usb_redir=""
282 opengl=""
283 opengl_dmabuf="no"
284 avx2_opt="no"
285 zlib="yes"
286 lzo=""
287 snappy=""
288 bzip2=""
289 guest_agent=""
290 guest_agent_with_vss="no"
291 guest_agent_ntddscsi="no"
292 guest_agent_msi=""
293 vss_win32_sdk=""
294 win_sdk="no"
295 want_tools="yes"
296 libiscsi=""
297 libnfs=""
298 coroutine=""
299 coroutine_pool=""
300 debug_stack_usage="no"
301 seccomp=""
302 glusterfs=""
303 glusterfs_xlator_opt="no"
304 glusterfs_discard="no"
305 glusterfs_zerofill="no"
306 gtk=""
307 gtkabi=""
308 gtk_gl="no"
309 tls_priority="NORMAL"
310 gnutls=""
311 gnutls_rnd=""
312 nettle=""
313 nettle_kdf="no"
314 gcrypt=""
315 gcrypt_hmac="no"
316 gcrypt_kdf="no"
317 vte=""
318 virglrenderer=""
319 tpm="yes"
320 libssh2=""
321 numa=""
322 tcmalloc="no"
323 jemalloc="no"
324 replication="yes"
326 supported_cpu="no"
327 supported_os="no"
328 bogus_os="no"
330 # parse CC options first
331 for opt do
332 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
333 case "$opt" in
334 --cross-prefix=*) cross_prefix="$optarg"
336 --cc=*) CC="$optarg"
338 --cxx=*) CXX="$optarg"
340 --source-path=*) source_path="$optarg"
342 --cpu=*) cpu="$optarg"
344 --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
345 EXTRA_CFLAGS="$optarg"
347 --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
348 EXTRA_LDFLAGS="$optarg"
350 --enable-debug-info) debug_info="yes"
352 --disable-debug-info) debug_info="no"
354 esac
355 done
356 # OS specific
357 # Using uname is really, really broken. Once we have the right set of checks
358 # we can eliminate its usage altogether.
360 # Preferred compiler:
361 # ${CC} (if set)
362 # ${cross_prefix}gcc (if cross-prefix specified)
363 # system compiler
364 if test -z "${CC}${cross_prefix}"; then
365 cc="$host_cc"
366 else
367 cc="${CC-${cross_prefix}gcc}"
370 if test -z "${CXX}${cross_prefix}"; then
371 cxx="c++"
372 else
373 cxx="${CXX-${cross_prefix}g++}"
376 ar="${AR-${cross_prefix}ar}"
377 as="${AS-${cross_prefix}as}"
378 ccas="${CCAS-$cc}"
379 cpp="${CPP-$cc -E}"
380 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
381 ld="${LD-${cross_prefix}ld}"
382 nm="${NM-${cross_prefix}nm}"
383 strip="${STRIP-${cross_prefix}strip}"
384 windres="${WINDRES-${cross_prefix}windres}"
385 pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
386 query_pkg_config() {
387 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
389 pkg_config=query_pkg_config
390 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
391 sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
393 # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
394 ARFLAGS="${ARFLAGS-rv}"
396 # default flags for all hosts
397 # We use -fwrapv to tell the compiler that we require a C dialect where
398 # left shift of signed integers is well defined and has the expected
399 # 2s-complement style results. (Both clang and gcc agree that it
400 # provides these semantics.)
401 QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
402 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
403 QEMU_CFLAGS="-Wmissing-format-attribute $QEMU_CFLAGS"
404 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
405 QEMU_CFLAGS="-Wno-unused-parameter $QEMU_CFLAGS"
406 QEMU_CFLAGS="-Wno-missing-field-initializers $QEMU_CFLAGS"
407 QEMU_CFLAGS="-Wno-sign-compare $QEMU_CFLAGS"
408 QEMU_CFLAGS="-Wno-override-init $QEMU_CFLAGS"
409 QEMU_CFLAGS="-Wno-error=format $QEMU_CFLAGS"
410 QEMU_CFLAGS="-Wno-error=format-extra-args $QEMU_CFLAGS"
411 QEMU_CFLAGS="-Wno-error=parentheses $QEMU_CFLAGS"
412 QEMU_CFLAGS="-Wextra $QEMU_CFLAGS"
413 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
414 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
415 if test "$debug_info" = "yes"; then
416 CFLAGS="-g $CFLAGS"
417 LDFLAGS="-g $LDFLAGS"
420 # make source path absolute
421 source_path=$(cd "$source_path"; pwd)
423 cc_macros=$($cc $QEMU_CFLAGS -E -dD - </dev/null)
425 # running configure in the source tree?
426 # we know that's the case if configure is there.
427 if test -f "./configure"; then
428 pwd_is_source_path="y"
429 else
430 pwd_is_source_path="n"
433 check_define() {
434 rm -f $TMPC
435 cat > $TMPC <<EOF
436 #if !defined($1)
437 #error $1 not defined
438 #endif
439 int main(void) { return 0; }
441 compile_object
444 check_include() {
445 cat > $TMPC <<EOF
446 #include <$1>
447 int main(void) { return 0; }
449 compile_object
452 write_c_skeleton() {
453 cat > $TMPC <<EOF
454 int main(void) { return 0; }
458 if check_define __linux__ ; then
459 targetos="Linux"
460 elif check_define _WIN32 ; then
461 targetos='MINGW32'
462 elif check_define __OpenBSD__ ; then
463 targetos='OpenBSD'
464 elif check_define __sun__ ; then
465 targetos='SunOS'
466 elif check_define __HAIKU__ ; then
467 targetos='Haiku'
468 else
469 targetos=$(uname -s)
472 # Some host OSes need non-standard checks for which CPU to use.
473 # Note that these checks are broken for cross-compilation: if you're
474 # cross-compiling to one of these OSes then you'll need to specify
475 # the correct CPU with the --cpu option.
476 case $targetos in
477 Darwin)
478 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
479 # run 64-bit userspace code.
480 # If the user didn't specify a CPU explicitly and the kernel says this is
481 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
482 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
483 cpu="x86_64"
486 SunOS)
487 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
488 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
489 cpu="x86_64"
491 esac
493 if test ! -z "$cpu" ; then
494 # command line argument
496 elif check_define __i386__ ; then
497 cpu="i386"
498 elif check_define __x86_64__ ; then
499 if check_define __ILP32__ ; then
500 cpu="x32"
501 else
502 cpu="x86_64"
504 elif check_define __sparc__ ; then
505 if check_define __arch64__ ; then
506 cpu="sparc64"
507 else
508 cpu="sparc"
510 elif check_define _ARCH_PPC ; then
511 if check_define _ARCH_PPC64 ; then
512 cpu="ppc64"
513 else
514 cpu="ppc"
516 elif check_define __mips__ ; then
517 if check_define __mips64 ; then
518 cpu="mips64"
519 else
520 cpu="mips"
522 elif check_define __ia64__ ; then
523 cpu="ia64"
524 elif check_define __s390__ ; then
525 if check_define __s390x__ ; then
526 cpu="s390x"
527 else
528 cpu="s390"
530 elif check_define __arm__ ; then
531 cpu="arm"
532 elif check_define __aarch64__ ; then
533 cpu="aarch64"
534 else
535 cpu=$(uname -m)
538 ARCH=
539 # Normalise host CPU name and set ARCH.
540 # Note that this case should only have supported host CPUs, not guests.
541 case "$cpu" in
542 ppc|ppc64|s390|s390x|sparc64|x32)
543 cpu="$cpu"
544 supported_cpu="yes"
546 ia64)
547 cpu="$cpu"
549 i386|i486|i586|i686|i86pc|BePC)
550 cpu="i386"
551 supported_cpu="yes"
553 x86_64|amd64)
554 cpu="x86_64"
555 supported_cpu="yes"
557 armv*b|armv*l|arm)
558 cpu="arm"
559 supported_cpu="yes"
561 aarch64)
562 cpu="aarch64"
563 supported_cpu="yes"
565 mips*)
566 cpu="mips"
567 if check_define __MIPSEL__ ; then
568 cpu="${cpu}el"
570 supported_cpu="yes"
572 sparc|sun4[cdmuv])
573 cpu="sparc"
574 supported_cpu="yes"
576 sh4)
577 cpu="sh4"
580 # This will result in either an error or falling back to TCI later
581 ARCH=unknown
583 esac
584 if test -z "$ARCH"; then
585 ARCH="$cpu"
588 # OS specific
590 # host *BSD for user mode
591 HOST_VARIANT_DIR=""
593 case $targetos in
594 MINGW32*)
595 mingw32="yes"
596 hax="yes"
597 audio_possible_drivers="dsound sdl"
598 if check_include dsound.h; then
599 audio_drv_list="dsound"
600 else
601 audio_drv_list=""
603 supported_os="yes"
605 GNU/kFreeBSD)
606 bsd="yes"
607 audio_drv_list="oss"
608 audio_possible_drivers="oss sdl pa"
610 FreeBSD)
611 bsd="yes"
612 make="${MAKE-gmake}"
613 audio_drv_list="oss"
614 audio_possible_drivers="oss sdl pa"
615 # needed for kinfo_getvmmap(3) in libutil.h
616 LIBS="-lutil $LIBS"
617 # needed for kinfo_getproc
618 libs_qga="-lutil $libs_qga"
619 netmap="" # enable netmap autodetect
620 HOST_VARIANT_DIR="freebsd"
621 supported_os="yes"
623 DragonFly)
624 bsd="yes"
625 make="${MAKE-gmake}"
626 audio_drv_list="oss"
627 audio_possible_drivers="oss sdl pa"
628 HOST_VARIANT_DIR="dragonfly"
630 NetBSD)
631 bsd="yes"
632 make="${MAKE-gmake}"
633 audio_drv_list="oss"
634 audio_possible_drivers="oss sdl"
635 oss_lib="-lossaudio"
636 HOST_VARIANT_DIR="netbsd"
638 OpenBSD)
639 bsd="yes"
640 make="${MAKE-gmake}"
641 audio_drv_list="sdl"
642 audio_possible_drivers="sdl"
643 HOST_VARIANT_DIR="openbsd"
645 Darwin)
646 bsd="yes"
647 darwin="yes"
648 hax="yes"
649 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
650 if [ "$cpu" = "x86_64" ] ; then
651 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
652 LDFLAGS="-arch x86_64 $LDFLAGS"
654 cocoa="yes"
655 audio_drv_list="coreaudio"
656 audio_possible_drivers="coreaudio sdl"
657 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
658 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
659 # Disable attempts to use ObjectiveC features in os/object.h since they
660 # won't work when we're compiling with gcc as a C compiler.
661 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
662 HOST_VARIANT_DIR="darwin"
663 supported_os="yes"
665 SunOS)
666 solaris="yes"
667 make="${MAKE-gmake}"
668 install="${INSTALL-ginstall}"
669 ld="gld"
670 smbd="${SMBD-/usr/sfw/sbin/smbd}"
671 needs_libsunmath="no"
672 solarisrev=$(uname -r | cut -f2 -d.)
673 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
674 if test "$solarisrev" -le 9 ; then
675 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
676 needs_libsunmath="yes"
677 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
678 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
679 LIBS="-lsunmath $LIBS"
680 else
681 error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
682 "libsunmath from the Sun Studio compilers tools, due to a lack of" \
683 "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
684 "Studio 11 can be downloaded from www.sun.com."
688 if test -f /usr/include/sys/soundcard.h ; then
689 audio_drv_list="oss"
691 audio_possible_drivers="oss sdl"
692 # needed for CMSG_ macros in sys/socket.h
693 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
694 # needed for TIOCWIN* defines in termios.h
695 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
696 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
697 solarisnetlibs="-lsocket -lnsl -lresolv"
698 LIBS="$solarisnetlibs $LIBS"
699 libs_qga="$solarisnetlibs $libs_qga"
701 AIX)
702 aix="yes"
703 make="${MAKE-gmake}"
705 Haiku)
706 haiku="yes"
707 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
708 LIBS="-lposix_error_mapper -lnetwork $LIBS"
710 Linux)
711 audio_drv_list="oss"
712 audio_possible_drivers="oss alsa sdl pa"
713 linux="yes"
714 linux_user="yes"
715 kvm="yes"
716 vhost_net="yes"
717 vhost_scsi="yes"
718 vhost_vsock="yes"
719 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
720 supported_os="yes"
723 # This is a fatal error, but don't report it yet, because we
724 # might be going to just print the --help text, or it might
725 # be the result of a missing compiler.
726 bogus_os="yes"
728 esac
730 if [ "$bsd" = "yes" ] ; then
731 if [ "$darwin" != "yes" ] ; then
732 bsd_user="yes"
736 : ${make=${MAKE-make}}
737 : ${install=${INSTALL-install}}
738 : ${python=${PYTHON-python}}
739 : ${smbd=${SMBD-/usr/sbin/smbd}}
741 # Default objcc to clang if available, otherwise use CC
742 if has clang; then
743 objcc=clang
744 else
745 objcc="$cc"
748 if test "$mingw32" = "yes" ; then
749 EXESUF=".exe"
750 DSOSUF=".dll"
751 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
752 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
753 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
754 # MinGW-w64 needs _POSIX defined.
755 QEMU_CFLAGS="-D_POSIX=1 $QEMU_CFLAGS"
756 # MinGW needs -mthreads for TLS and macro _MT.
757 QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
758 QEMU_CFLAGS="-I\$(SRC_PATH)/hosts/w32/include $QEMU_CFLAGS"
759 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
760 write_c_skeleton;
761 if compile_prog "" "-liberty" ; then
762 LIBS="-liberty $LIBS"
764 prefix="c:/Program Files/QEMU"
765 mandir="\${prefix}"
766 datadir="\${prefix}"
767 qemu_docdir="\${prefix}"
768 bindir="\${prefix}"
769 sysconfdir="\${prefix}"
770 local_statedir=
771 confsuffix=""
772 libs_qga="-lws2_32 -lwinmm -lpowrprof -liphlpapi -lnetapi32 $libs_qga"
775 werror=""
777 for opt do
778 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
779 case "$opt" in
780 --help|-h) show_help=yes
782 --version|-V) exec cat $source_path/VERSION
784 --prefix=*) prefix="$optarg"
786 --interp-prefix=*) interp_prefix="$optarg"
788 --source-path=*)
790 --cross-prefix=*)
792 --cc=*)
794 --host-cc=*) host_cc="$optarg"
796 --cxx=*)
798 --iasl=*) iasl="$optarg"
800 --objcc=*) objcc="$optarg"
802 --make=*) make="$optarg"
804 --install=*) install="$optarg"
806 --python=*) python="$optarg"
808 --gcov=*) gcov_tool="$optarg"
810 --smbd=*) smbd="$optarg"
812 --extra-cflags=*)
814 --extra-ldflags=*)
816 --enable-debug-info)
818 --disable-debug-info)
820 --enable-modules)
821 modules="yes"
823 --disable-modules)
824 modules="no"
826 --cpu=*)
828 --target-list=*) target_list="$optarg"
830 --enable-trace-backends=*) trace_backends="$optarg"
832 # XXX: backwards compatibility
833 --enable-trace-backend=*) trace_backends="$optarg"
835 --with-trace-file=*) trace_file="$optarg"
837 --enable-gprof) gprof="yes"
839 --enable-gcov) gcov="yes"
841 --static)
842 static="yes"
843 LDFLAGS="-static $LDFLAGS"
844 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
846 --mandir=*) mandir="$optarg"
848 --bindir=*) bindir="$optarg"
850 --libdir=*) libdir="$optarg"
852 --libexecdir=*) libexecdir="$optarg"
854 --includedir=*) includedir="$optarg"
856 --datadir=*) datadir="$optarg"
858 --with-confsuffix=*) confsuffix="$optarg"
860 --docdir=*) qemu_docdir="$optarg"
862 --sysconfdir=*) sysconfdir="$optarg"
864 --localstatedir=*) local_statedir="$optarg"
866 --sbindir=*|--sharedstatedir=*|\
867 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
868 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
869 # These switches are silently ignored, for compatibility with
870 # autoconf-generated configure scripts. This allows QEMU's
871 # configure to be used by RPM and similar macros that set
872 # lots of directory switches by default.
874 --with-system-pixman) pixman="system"
876 --without-system-pixman) pixman="internal"
878 --without-pixman) pixman="none"
880 --disable-sdl) sdl="no"
882 --enable-sdl) sdl="yes"
884 --with-sdlabi=*) sdlabi="$optarg"
886 --disable-qom-cast-debug) qom_cast_debug="no"
888 --enable-qom-cast-debug) qom_cast_debug="yes"
890 --disable-virtfs) virtfs="no"
892 --enable-virtfs) virtfs="yes"
894 --disable-vnc) vnc="no"
896 --enable-vnc) vnc="yes"
898 --oss-lib=*) oss_lib="$optarg"
900 --audio-drv-list=*) audio_drv_list="$optarg"
902 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
904 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
906 --enable-debug-tcg) debug_tcg="yes"
908 --disable-debug-tcg) debug_tcg="no"
910 --enable-debug)
911 # Enable debugging options that aren't excessively noisy
912 debug_tcg="yes"
913 debug="yes"
914 strip_opt="no"
915 fortify_source="no"
917 --enable-sparse) sparse="yes"
919 --disable-sparse) sparse="no"
921 --disable-strip) strip_opt="no"
923 --disable-vnc-sasl) vnc_sasl="no"
925 --enable-vnc-sasl) vnc_sasl="yes"
927 --disable-vnc-jpeg) vnc_jpeg="no"
929 --enable-vnc-jpeg) vnc_jpeg="yes"
931 --disable-vnc-png) vnc_png="no"
933 --enable-vnc-png) vnc_png="yes"
935 --disable-slirp) slirp="no"
937 --disable-vde) vde="no"
939 --enable-vde) vde="yes"
941 --disable-netmap) netmap="no"
943 --enable-netmap) netmap="yes"
945 --disable-xen) xen="no"
947 --enable-xen) xen="yes"
949 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
951 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
953 --disable-xen-pv-domain-build) xen_pv_domain_build="no"
955 --enable-xen-pv-domain-build) xen_pv_domain_build="yes"
957 --disable-brlapi) brlapi="no"
959 --enable-brlapi) brlapi="yes"
961 --disable-bluez) bluez="no"
963 --enable-bluez) bluez="yes"
965 --disable-kvm) kvm="no"
967 --enable-kvm) kvm="yes"
969 --disable-hax) hax="no"
971 --enable-hax) hax="yes"
973 --disable-tcg-interpreter) tcg_interpreter="no"
975 --enable-tcg-interpreter) tcg_interpreter="yes"
977 --disable-cap-ng) cap_ng="no"
979 --enable-cap-ng) cap_ng="yes"
981 --disable-spice) spice="no"
983 --enable-spice) spice="yes"
985 --disable-libiscsi) libiscsi="no"
987 --enable-libiscsi) libiscsi="yes"
989 --disable-libnfs) libnfs="no"
991 --enable-libnfs) libnfs="yes"
993 --enable-profiler) profiler="yes"
995 --disable-cocoa) cocoa="no"
997 --enable-cocoa)
998 cocoa="yes" ;
999 audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
1001 --disable-system) softmmu="no"
1003 --enable-system) softmmu="yes"
1005 --disable-user)
1006 linux_user="no" ;
1007 bsd_user="no" ;
1009 --enable-user) ;;
1010 --disable-linux-user) linux_user="no"
1012 --enable-linux-user) linux_user="yes"
1014 --disable-bsd-user) bsd_user="no"
1016 --enable-bsd-user) bsd_user="yes"
1018 --enable-pie) pie="yes"
1020 --disable-pie) pie="no"
1022 --enable-werror) werror="yes"
1024 --disable-werror) werror="no"
1026 --enable-stack-protector) stack_protector="yes"
1028 --disable-stack-protector) stack_protector="no"
1030 --disable-curses) curses="no"
1032 --enable-curses) curses="yes"
1034 --disable-curl) curl="no"
1036 --enable-curl) curl="yes"
1038 --disable-fdt) fdt="no"
1040 --enable-fdt) fdt="yes"
1042 --disable-linux-aio) linux_aio="no"
1044 --enable-linux-aio) linux_aio="yes"
1046 --disable-attr) attr="no"
1048 --enable-attr) attr="yes"
1050 --disable-blobs) blobs="no"
1052 --with-pkgversion=*) pkgversion=" ($optarg)"
1054 --with-coroutine=*) coroutine="$optarg"
1056 --disable-coroutine-pool) coroutine_pool="no"
1058 --enable-coroutine-pool) coroutine_pool="yes"
1060 --enable-debug-stack-usage) debug_stack_usage="yes"
1062 --disable-docs) docs="no"
1064 --enable-docs) docs="yes"
1066 --disable-vhost-net) vhost_net="no"
1068 --enable-vhost-net) vhost_net="yes"
1070 --disable-vhost-scsi) vhost_scsi="no"
1072 --enable-vhost-scsi) vhost_scsi="yes"
1074 --disable-vhost-vsock) vhost_vsock="no"
1076 --enable-vhost-vsock) vhost_vsock="yes"
1078 --disable-opengl) opengl="no"
1080 --enable-opengl) opengl="yes"
1082 --disable-rbd) rbd="no"
1084 --enable-rbd) rbd="yes"
1086 --disable-xfsctl) xfs="no"
1088 --enable-xfsctl) xfs="yes"
1090 --disable-smartcard) smartcard="no"
1092 --enable-smartcard) smartcard="yes"
1094 --disable-libusb) libusb="no"
1096 --enable-libusb) libusb="yes"
1098 --disable-usb-redir) usb_redir="no"
1100 --enable-usb-redir) usb_redir="yes"
1102 --disable-zlib-test) zlib="no"
1104 --disable-lzo) lzo="no"
1106 --enable-lzo) lzo="yes"
1108 --disable-snappy) snappy="no"
1110 --enable-snappy) snappy="yes"
1112 --disable-bzip2) bzip2="no"
1114 --enable-bzip2) bzip2="yes"
1116 --enable-guest-agent) guest_agent="yes"
1118 --disable-guest-agent) guest_agent="no"
1120 --enable-guest-agent-msi) guest_agent_msi="yes"
1122 --disable-guest-agent-msi) guest_agent_msi="no"
1124 --with-vss-sdk) vss_win32_sdk=""
1126 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1128 --without-vss-sdk) vss_win32_sdk="no"
1130 --with-win-sdk) win_sdk=""
1132 --with-win-sdk=*) win_sdk="$optarg"
1134 --without-win-sdk) win_sdk="no"
1136 --enable-tools) want_tools="yes"
1138 --disable-tools) want_tools="no"
1140 --enable-seccomp) seccomp="yes"
1142 --disable-seccomp) seccomp="no"
1144 --disable-glusterfs) glusterfs="no"
1146 --enable-glusterfs) glusterfs="yes"
1148 --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
1149 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
1151 --enable-vhdx|--disable-vhdx)
1152 echo "$0: $opt is obsolete, VHDX driver is always built" >&2
1154 --enable-uuid|--disable-uuid)
1155 echo "$0: $opt is obsolete, UUID support is always built" >&2
1157 --disable-gtk) gtk="no"
1159 --enable-gtk) gtk="yes"
1161 --tls-priority=*) tls_priority="$optarg"
1163 --disable-gnutls) gnutls="no"
1165 --enable-gnutls) gnutls="yes"
1167 --disable-nettle) nettle="no"
1169 --enable-nettle) nettle="yes"
1171 --disable-gcrypt) gcrypt="no"
1173 --enable-gcrypt) gcrypt="yes"
1175 --enable-rdma) rdma="yes"
1177 --disable-rdma) rdma="no"
1179 --with-gtkabi=*) gtkabi="$optarg"
1181 --disable-vte) vte="no"
1183 --enable-vte) vte="yes"
1185 --disable-virglrenderer) virglrenderer="no"
1187 --enable-virglrenderer) virglrenderer="yes"
1189 --disable-tpm) tpm="no"
1191 --enable-tpm) tpm="yes"
1193 --disable-libssh2) libssh2="no"
1195 --enable-libssh2) libssh2="yes"
1197 --disable-numa) numa="no"
1199 --enable-numa) numa="yes"
1201 --disable-tcmalloc) tcmalloc="no"
1203 --enable-tcmalloc) tcmalloc="yes"
1205 --disable-jemalloc) jemalloc="no"
1207 --enable-jemalloc) jemalloc="yes"
1209 --disable-replication) replication="no"
1211 --enable-replication) replication="yes"
1214 echo "ERROR: unknown option $opt"
1215 echo "Try '$0 --help' for more information"
1216 exit 1
1218 esac
1219 done
1221 if ! has $python; then
1222 error_exit "Python not found. Use --python=/path/to/python"
1225 # Note that if the Python conditional here evaluates True we will exit
1226 # with status 1 which is a shell 'false' value.
1227 if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then
1228 error_exit "Cannot use '$python', Python 2.6 or later is required." \
1229 "Note that Python 3 or later is not yet supported." \
1230 "Use --python=/path/to/python to specify a supported Python."
1233 # Suppress writing compiled files
1234 python="$python -B"
1236 case "$cpu" in
1237 ppc)
1238 CPU_CFLAGS="-m32"
1239 LDFLAGS="-m32 $LDFLAGS"
1241 ppc64)
1242 CPU_CFLAGS="-m64"
1243 LDFLAGS="-m64 $LDFLAGS"
1245 sparc)
1246 LDFLAGS="-m32 $LDFLAGS"
1247 CPU_CFLAGS="-m32 -mcpu=ultrasparc"
1249 sparc64)
1250 LDFLAGS="-m64 $LDFLAGS"
1251 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
1253 s390)
1254 CPU_CFLAGS="-m31"
1255 LDFLAGS="-m31 $LDFLAGS"
1257 s390x)
1258 CPU_CFLAGS="-m64"
1259 LDFLAGS="-m64 $LDFLAGS"
1261 i386)
1262 CPU_CFLAGS="-m32"
1263 LDFLAGS="-m32 $LDFLAGS"
1264 cc_i386='$(CC) -m32'
1266 x86_64)
1267 # ??? Only extremely old AMD cpus do not have cmpxchg16b.
1268 # If we truly care, we should simply detect this case at
1269 # runtime and generate the fallback to serial emulation.
1270 CPU_CFLAGS="-m64 -mcx16"
1271 LDFLAGS="-m64 $LDFLAGS"
1272 cc_i386='$(CC) -m32'
1274 x32)
1275 CPU_CFLAGS="-mx32"
1276 LDFLAGS="-mx32 $LDFLAGS"
1277 cc_i386='$(CC) -m32'
1279 # No special flags required for other host CPUs
1280 esac
1282 QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1283 EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1285 # For user-mode emulation the host arch has to be one we explicitly
1286 # support, even if we're using TCI.
1287 if [ "$ARCH" = "unknown" ]; then
1288 bsd_user="no"
1289 linux_user="no"
1292 default_target_list=""
1294 mak_wilds=""
1296 if [ "$softmmu" = "yes" ]; then
1297 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
1299 if [ "$linux_user" = "yes" ]; then
1300 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
1302 if [ "$bsd_user" = "yes" ]; then
1303 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
1306 for config in $mak_wilds; do
1307 default_target_list="${default_target_list} $(basename "$config" .mak)"
1308 done
1310 if test x"$show_help" = x"yes" ; then
1311 cat << EOF
1313 Usage: configure [options]
1314 Options: [defaults in brackets after descriptions]
1316 Standard options:
1317 --help print this message
1318 --prefix=PREFIX install in PREFIX [$prefix]
1319 --interp-prefix=PREFIX where to find shared libraries, etc.
1320 use %M for cpu name [$interp_prefix]
1321 --target-list=LIST set target list (default: build everything)
1322 $(echo Available targets: $default_target_list | \
1323 fold -s -w 53 | sed -e 's/^/ /')
1325 Advanced options (experts only):
1326 --source-path=PATH path of source code [$source_path]
1327 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1328 --cc=CC use C compiler CC [$cc]
1329 --iasl=IASL use ACPI compiler IASL [$iasl]
1330 --host-cc=CC use C compiler CC [$host_cc] for code run at
1331 build time
1332 --cxx=CXX use C++ compiler CXX [$cxx]
1333 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1334 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
1335 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1336 --make=MAKE use specified make [$make]
1337 --install=INSTALL use specified install [$install]
1338 --python=PYTHON use specified python [$python]
1339 --smbd=SMBD use specified smbd [$smbd]
1340 --static enable static build [$static]
1341 --mandir=PATH install man pages in PATH
1342 --datadir=PATH install firmware in PATH$confsuffix
1343 --docdir=PATH install documentation in PATH$confsuffix
1344 --bindir=PATH install binaries in PATH
1345 --libdir=PATH install libraries in PATH
1346 --sysconfdir=PATH install config in PATH$confsuffix
1347 --localstatedir=PATH install local state in PATH (set at runtime on win32)
1348 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
1349 --enable-debug enable common debug build options
1350 --disable-strip disable stripping binaries
1351 --disable-werror disable compilation abort on warning
1352 --disable-stack-protector disable compiler-provided stack protection
1353 --audio-drv-list=LIST set audio drivers list:
1354 Available drivers: $audio_possible_drivers
1355 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1356 --block-drv-rw-whitelist=L
1357 set block driver read-write whitelist
1358 (affects only QEMU, not qemu-img)
1359 --block-drv-ro-whitelist=L
1360 set block driver read-only whitelist
1361 (affects only QEMU, not qemu-img)
1362 --enable-trace-backends=B Set trace backend
1363 Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
1364 --with-trace-file=NAME Full PATH,NAME of file to store traces
1365 Default:trace-<pid>
1366 --disable-slirp disable SLIRP userspace network connectivity
1367 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1368 --oss-lib path to OSS library
1369 --cpu=CPU Build for host CPU [$cpu]
1370 --with-coroutine=BACKEND coroutine backend. Supported options:
1371 gthread, ucontext, sigaltstack, windows
1372 --enable-gcov enable test coverage analysis with gcov
1373 --gcov=GCOV use specified gcov [$gcov_tool]
1374 --disable-blobs disable installing provided firmware blobs
1375 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1376 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1377 --tls-priority default TLS protocol/cipher priority string
1378 --enable-gprof QEMU profiling with gprof
1379 --enable-profiler profiler support
1380 --enable-xen-pv-domain-build
1381 xen pv domain builder
1382 --enable-debug-stack-usage
1383 track the maximum stack usage of stacks created by qemu_alloc_stack
1385 Optional features, enabled with --enable-FEATURE and
1386 disabled with --disable-FEATURE, default is enabled if available:
1388 system all system emulation targets
1389 user supported user emulation targets
1390 linux-user all linux usermode emulation targets
1391 bsd-user all BSD usermode emulation targets
1392 docs build documentation
1393 guest-agent build the QEMU Guest Agent
1394 guest-agent-msi build guest agent Windows MSI installation package
1395 pie Position Independent Executables
1396 modules modules support
1397 debug-tcg TCG debugging (default is disabled)
1398 debug-info debugging information
1399 sparse sparse checker
1401 gnutls GNUTLS cryptography support
1402 nettle nettle cryptography support
1403 gcrypt libgcrypt cryptography support
1404 sdl SDL UI
1405 --with-sdlabi select preferred SDL ABI 1.2 or 2.0
1406 gtk gtk UI
1407 --with-gtkabi select preferred GTK ABI 2.0 or 3.0
1408 vte vte support for the gtk UI
1409 curses curses UI
1410 vnc VNC UI support
1411 vnc-sasl SASL encryption for VNC server
1412 vnc-jpeg JPEG lossy compression for VNC server
1413 vnc-png PNG compression for VNC server
1414 cocoa Cocoa UI (Mac OS X only)
1415 virtfs VirtFS
1416 xen xen backend driver support
1417 xen-pci-passthrough
1418 brlapi BrlAPI (Braile)
1419 curl curl connectivity
1420 fdt fdt device tree
1421 bluez bluez stack connectivity
1422 kvm KVM acceleration support
1423 hax HAX acceleration support
1424 rdma RDMA-based migration support
1425 vde support for vde network
1426 netmap support for netmap network
1427 linux-aio Linux AIO support
1428 cap-ng libcap-ng support
1429 attr attr and xattr support
1430 vhost-net vhost-net acceleration support
1431 spice spice
1432 rbd rados block device (rbd)
1433 libiscsi iscsi support
1434 libnfs nfs support
1435 smartcard smartcard support (libcacard)
1436 libusb libusb (for usb passthrough)
1437 usb-redir usb network redirection support
1438 lzo support of lzo compression library
1439 snappy support of snappy compression library
1440 bzip2 support of bzip2 compression library
1441 (for reading bzip2-compressed dmg images)
1442 seccomp seccomp support
1443 coroutine-pool coroutine freelist (better performance)
1444 glusterfs GlusterFS backend
1445 tpm TPM support
1446 libssh2 ssh block device support
1447 numa libnuma support
1448 tcmalloc tcmalloc support
1449 jemalloc jemalloc support
1450 replication replication support
1451 vhost-vsock virtio sockets device support
1452 opengl opengl support
1453 virglrenderer virgl rendering support
1454 xfsctl xfsctl support
1455 qom-cast-debug cast debugging support
1456 tools build qemu-io, qemu-nbd and qemu-image tools
1458 NOTE: The object files are built at the place where configure is launched
1460 exit 0
1463 # Now we have handled --enable-tcg-interpreter and know we're not just
1464 # printing the help message, bail out if the host CPU isn't supported.
1465 if test "$ARCH" = "unknown"; then
1466 if test "$tcg_interpreter" = "yes" ; then
1467 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1468 else
1469 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1473 # Consult white-list to determine whether to enable werror
1474 # by default. Only enable by default for git builds
1475 if test -z "$werror" ; then
1476 if test -d "$source_path/.git" -a \
1477 \( "$linux" = "yes" -o "$mingw32" = "yes" \) ; then
1478 werror="yes"
1479 else
1480 werror="no"
1484 # check that the C compiler works.
1485 write_c_skeleton;
1486 if compile_object ; then
1487 : C compiler works ok
1488 else
1489 error_exit "\"$cc\" either does not exist or does not work"
1491 if ! compile_prog ; then
1492 error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
1495 if test "$bogus_os" = "yes"; then
1496 # Now that we know that we're not printing the help and that
1497 # the compiler works (so the results of the check_defines we used
1498 # to identify the OS are reliable), if we didn't recognize the
1499 # host OS we should stop now.
1500 error_exit "Unrecognized host OS $targetos"
1503 # Check that the C++ compiler exists and works with the C compiler
1504 if has $cxx; then
1505 cat > $TMPC <<EOF
1506 int c_function(void);
1507 int main(void) { return c_function(); }
1510 compile_object
1512 cat > $TMPCXX <<EOF
1513 extern "C" {
1514 int c_function(void);
1516 int c_function(void) { return 42; }
1519 update_cxxflags
1521 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
1522 # C++ compiler $cxx works ok with C compiler $cc
1524 else
1525 echo "C++ compiler $cxx does not work with C compiler $cc"
1526 echo "Disabling C++ specific optional code"
1527 cxx=
1529 else
1530 echo "No C++ compiler available; disabling C++ specific optional code"
1531 cxx=
1534 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1535 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1536 gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1537 gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
1538 gcc_flags="-Wno-initializer-overrides $gcc_flags"
1539 gcc_flags="-Wno-string-plus-int $gcc_flags"
1540 # Note that we do not add -Werror to gcc_flags here, because that would
1541 # enable it for all configure tests. If a configure test failed due
1542 # to -Werror this would just silently disable some features,
1543 # so it's too error prone.
1545 cc_has_warning_flag() {
1546 write_c_skeleton;
1548 # Use the positive sense of the flag when testing for -Wno-wombat
1549 # support (gcc will happily accept the -Wno- form of unknown
1550 # warning options).
1551 optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
1552 compile_prog "-Werror $optflag" ""
1555 for flag in $gcc_flags; do
1556 if cc_has_warning_flag $flag ; then
1557 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1559 done
1561 if test "$mingw32" = "yes"; then
1562 stack_protector="no"
1564 if test "$stack_protector" != "no"; then
1565 cat > $TMPC << EOF
1566 int main(int argc, char *argv[])
1568 char arr[64], *p = arr, *c = argv[0];
1569 while (*c) {
1570 *p++ = *c++;
1572 return 0;
1575 gcc_flags="-fstack-protector-strong -fstack-protector-all"
1576 sp_on=0
1577 for flag in $gcc_flags; do
1578 # We need to check both a compile and a link, since some compiler
1579 # setups fail only on a .c->.o compile and some only at link time
1580 if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
1581 compile_prog "-Werror $flag" ""; then
1582 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1583 sp_on=1
1584 break
1586 done
1587 if test "$stack_protector" = yes; then
1588 if test $sp_on = 0; then
1589 error_exit "Stack protector not supported"
1594 # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1595 # large functions that use global variables. The bug is in all releases of
1596 # GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1597 # 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1598 cat > $TMPC << EOF
1599 #if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1600 int main(void) { return 0; }
1601 #else
1602 #error No bug in this compiler.
1603 #endif
1605 if compile_prog "-Werror -fno-gcse" "" ; then
1606 TRANSLATE_OPT_CFLAGS=-fno-gcse
1609 if test "$static" = "yes" ; then
1610 if test "$modules" = "yes" ; then
1611 error_exit "static and modules are mutually incompatible"
1613 if test "$pie" = "yes" ; then
1614 error_exit "static and pie are mutually incompatible"
1615 else
1616 pie="no"
1620 # Unconditional check for compiler __thread support
1621 cat > $TMPC << EOF
1622 static __thread int tls_var;
1623 int main(void) { return tls_var; }
1626 if ! compile_prog "-Werror" "" ; then
1627 error_exit "Your compiler does not support the __thread specifier for " \
1628 "Thread-Local Storage (TLS). Please upgrade to a version that does."
1631 if test "$pie" = ""; then
1632 case "$cpu-$targetos" in
1633 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
1636 pie="no"
1638 esac
1641 if test "$pie" != "no" ; then
1642 cat > $TMPC << EOF
1644 #ifdef __linux__
1645 # define THREAD __thread
1646 #else
1647 # define THREAD
1648 #endif
1650 static THREAD int tls_var;
1652 int main(void) { return tls_var; }
1655 if compile_prog "-fPIE -DPIE" "-pie"; then
1656 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1657 LDFLAGS="-pie $LDFLAGS"
1658 pie="yes"
1659 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1660 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1662 else
1663 if test "$pie" = "yes"; then
1664 error_exit "PIE not available due to missing toolchain support"
1665 else
1666 echo "Disabling PIE due to missing toolchain support"
1667 pie="no"
1671 if compile_prog "-Werror -fno-pie" "-nopie"; then
1672 CFLAGS_NOPIE="-fno-pie"
1673 LDFLAGS_NOPIE="-nopie"
1677 ##########################################
1678 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
1679 # use i686 as default anyway, but for those that don't, an explicit
1680 # specification is necessary
1682 if test "$cpu" = "i386"; then
1683 cat > $TMPC << EOF
1684 static int sfaa(int *ptr)
1686 return __sync_fetch_and_and(ptr, 0);
1689 int main(void)
1691 int val = 42;
1692 val = __sync_val_compare_and_swap(&val, 0, 1);
1693 sfaa(&val);
1694 return val;
1697 if ! compile_prog "" "" ; then
1698 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1702 #########################################
1703 # Solaris specific configure tool chain decisions
1705 if test "$solaris" = "yes" ; then
1706 if has $install; then
1708 else
1709 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1710 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1711 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1713 if test "$(path_of $install)" = "/usr/sbin/install" ; then
1714 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1715 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1716 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1718 if has ar; then
1720 else
1721 if test -f /usr/ccs/bin/ar ; then
1722 error_exit "No path includes ar" \
1723 "Add /usr/ccs/bin to your path and rerun configure"
1725 error_exit "No path includes ar"
1729 if test -z "${target_list+xxx}" ; then
1730 target_list="$default_target_list"
1731 else
1732 target_list=$(echo "$target_list" | sed -e 's/,/ /g')
1735 # Check that we recognised the target name; this allows a more
1736 # friendly error message than if we let it fall through.
1737 for target in $target_list; do
1738 case " $default_target_list " in
1739 *" $target "*)
1742 error_exit "Unknown target name '$target'"
1744 esac
1745 done
1747 # see if system emulation was really requested
1748 case " $target_list " in
1749 *"-softmmu "*) softmmu=yes
1751 *) softmmu=no
1753 esac
1755 feature_not_found() {
1756 feature=$1
1757 remedy=$2
1759 error_exit "User requested feature $feature" \
1760 "configure was not able to find it." \
1761 "$remedy"
1764 # ---
1765 # big/little endian test
1766 cat > $TMPC << EOF
1767 short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1768 short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1769 extern int foo(short *, short *);
1770 int main(int argc, char *argv[]) {
1771 return foo(big_endian, little_endian);
1775 if compile_object ; then
1776 if grep -q BiGeNdIaN $TMPO ; then
1777 bigendian="yes"
1778 elif grep -q LiTtLeEnDiAn $TMPO ; then
1779 bigendian="no"
1780 else
1781 echo big/little test failed
1783 else
1784 echo big/little test failed
1787 ##########################################
1788 # cocoa implies not SDL or GTK
1789 # (the cocoa UI code currently assumes it is always the active UI
1790 # and doesn't interact well with other UI frontend code)
1791 if test "$cocoa" = "yes"; then
1792 if test "$sdl" = "yes"; then
1793 error_exit "Cocoa and SDL UIs cannot both be enabled at once"
1795 if test "$gtk" = "yes"; then
1796 error_exit "Cocoa and GTK UIs cannot both be enabled at once"
1798 gtk=no
1799 sdl=no
1802 # Some versions of Mac OS X incorrectly define SIZE_MAX
1803 cat > $TMPC << EOF
1804 #include <stdint.h>
1805 #include <stdio.h>
1806 int main(int argc, char *argv[]) {
1807 return printf("%zu", SIZE_MAX);
1810 have_broken_size_max=no
1811 if ! compile_object -Werror ; then
1812 have_broken_size_max=yes
1815 ##########################################
1816 # L2TPV3 probe
1818 cat > $TMPC <<EOF
1819 #include <sys/socket.h>
1820 #include <linux/ip.h>
1821 int main(void) { return sizeof(struct mmsghdr); }
1823 if compile_prog "" "" ; then
1824 l2tpv3=yes
1825 else
1826 l2tpv3=no
1829 ##########################################
1830 # MinGW / Mingw-w64 localtime_r/gmtime_r check
1832 if test "$mingw32" = "yes"; then
1833 # Some versions of MinGW / Mingw-w64 lack localtime_r
1834 # and gmtime_r entirely.
1836 # Some versions of Mingw-w64 define a macro for
1837 # localtime_r/gmtime_r.
1839 # Some versions of Mingw-w64 will define functions
1840 # for localtime_r/gmtime_r, but only if you have
1841 # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
1842 # though, unistd.h and pthread.h both define
1843 # that for you.
1845 # So this #undef localtime_r and #include <unistd.h>
1846 # are not in fact redundant.
1847 cat > $TMPC << EOF
1848 #include <unistd.h>
1849 #include <time.h>
1850 #undef localtime_r
1851 int main(void) { localtime_r(NULL, NULL); return 0; }
1853 if compile_prog "" "" ; then
1854 localtime_r="yes"
1855 else
1856 localtime_r="no"
1860 ##########################################
1861 # pkg-config probe
1863 if ! has "$pkg_config_exe"; then
1864 error_exit "pkg-config binary '$pkg_config_exe' not found"
1867 ##########################################
1868 # NPTL probe
1870 if test "$linux_user" = "yes"; then
1871 cat > $TMPC <<EOF
1872 #include <sched.h>
1873 #include <linux/futex.h>
1874 int main(void) {
1875 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1876 #error bork
1877 #endif
1878 return 0;
1881 if ! compile_object ; then
1882 feature_not_found "nptl" "Install glibc and linux kernel headers."
1886 ##########################################
1887 # avx2 optimization requirement check
1889 cat > $TMPC << EOF
1890 #pragma GCC push_options
1891 #pragma GCC target("avx2")
1892 #include <cpuid.h>
1893 #include <immintrin.h>
1894 static int bar(void *a) {
1895 __m256i x = *(__m256i *)a;
1896 return _mm256_testz_si256(x, x);
1898 int main(int argc, char *argv[]) { return bar(argv[0]); }
1900 if compile_object "" ; then
1901 avx2_opt="yes"
1904 ##########################################
1905 # lzo check
1907 if test "$lzo" != "no" ; then
1908 cat > $TMPC << EOF
1909 #include <lzo/lzo1x.h>
1910 int main(void) { lzo_version(); return 0; }
1912 if compile_prog "" "-llzo2" ; then
1913 libs_softmmu="$libs_softmmu -llzo2"
1914 lzo="yes"
1915 else
1916 if test "$lzo" = "yes"; then
1917 feature_not_found "liblzo2" "Install liblzo2 devel"
1919 lzo="no"
1923 ##########################################
1924 # snappy check
1926 if test "$snappy" != "no" ; then
1927 cat > $TMPC << EOF
1928 #include <snappy-c.h>
1929 int main(void) { snappy_max_compressed_length(4096); return 0; }
1931 if compile_prog "" "-lsnappy" ; then
1932 libs_softmmu="$libs_softmmu -lsnappy"
1933 snappy="yes"
1934 else
1935 if test "$snappy" = "yes"; then
1936 feature_not_found "libsnappy" "Install libsnappy devel"
1938 snappy="no"
1942 ##########################################
1943 # bzip2 check
1945 if test "$bzip2" != "no" ; then
1946 cat > $TMPC << EOF
1947 #include <bzlib.h>
1948 int main(void) { BZ2_bzlibVersion(); return 0; }
1950 if compile_prog "" "-lbz2" ; then
1951 bzip2="yes"
1952 else
1953 if test "$bzip2" = "yes"; then
1954 feature_not_found "libbzip2" "Install libbzip2 devel"
1956 bzip2="no"
1960 ##########################################
1961 # libseccomp check
1963 if test "$seccomp" != "no" ; then
1964 case "$cpu" in
1965 i386|x86_64)
1966 libseccomp_minver="2.1.0"
1968 mips)
1969 libseccomp_minver="2.2.0"
1971 arm|aarch64)
1972 libseccomp_minver="2.2.3"
1974 ppc|ppc64)
1975 libseccomp_minver="2.3.0"
1978 libseccomp_minver=""
1980 esac
1982 if test "$libseccomp_minver" != "" &&
1983 $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
1984 libs_softmmu="$libs_softmmu $($pkg_config --libs libseccomp)"
1985 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags libseccomp)"
1986 seccomp="yes"
1987 else
1988 if test "$seccomp" = "yes" ; then
1989 if test "$libseccomp_minver" != "" ; then
1990 feature_not_found "libseccomp" \
1991 "Install libseccomp devel >= $libseccomp_minver"
1992 else
1993 feature_not_found "libseccomp" \
1994 "libseccomp is not supported for host cpu $cpu"
1997 seccomp="no"
2000 ##########################################
2001 # xen probe
2003 if test "$xen" != "no" ; then
2004 xen_libs="-lxenstore -lxenctrl -lxenguest"
2005 xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
2007 # First we test whether Xen headers and libraries are available.
2008 # If no, we are done and there is no Xen support.
2009 # If yes, more tests are run to detect the Xen version.
2011 # Xen (any)
2012 cat > $TMPC <<EOF
2013 #include <xenctrl.h>
2014 int main(void) {
2015 return 0;
2018 if ! compile_prog "" "$xen_libs" ; then
2019 # Xen not found
2020 if test "$xen" = "yes" ; then
2021 feature_not_found "xen" "Install xen devel"
2023 xen=no
2025 # Xen unstable
2026 elif
2027 cat > $TMPC <<EOF &&
2029 * If we have stable libs the we don't want the libxc compat
2030 * layers, regardless of what CFLAGS we may have been given.
2032 * Also, check if xengnttab_grant_copy_segment_t is defined and
2033 * grant copy operation is implemented.
2035 #undef XC_WANT_COMPAT_EVTCHN_API
2036 #undef XC_WANT_COMPAT_GNTTAB_API
2037 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2038 #include <xenctrl.h>
2039 #include <xenstore.h>
2040 #include <xenevtchn.h>
2041 #include <xengnttab.h>
2042 #include <xenforeignmemory.h>
2043 #include <stdint.h>
2044 #include <xen/hvm/hvm_info_table.h>
2045 #if !defined(HVM_MAX_VCPUS)
2046 # error HVM_MAX_VCPUS not defined
2047 #endif
2048 int main(void) {
2049 xc_interface *xc = NULL;
2050 xenforeignmemory_handle *xfmem;
2051 xenevtchn_handle *xe;
2052 xengnttab_handle *xg;
2053 xen_domain_handle_t handle;
2054 xengnttab_grant_copy_segment_t* seg = NULL;
2056 xs_daemon_open();
2058 xc = xc_interface_open(0, 0, 0);
2059 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2060 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2061 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2062 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2063 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2065 xfmem = xenforeignmemory_open(0, 0);
2066 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2068 xe = xenevtchn_open(0, 0);
2069 xenevtchn_fd(xe);
2071 xg = xengnttab_open(0, 0);
2072 xengnttab_grant_copy(xg, 0, seg);
2074 return 0;
2077 compile_prog "" "$xen_libs $xen_stable_libs"
2078 then
2079 xen_ctrl_version=480
2080 xen=yes
2081 elif
2082 cat > $TMPC <<EOF &&
2084 * If we have stable libs the we don't want the libxc compat
2085 * layers, regardless of what CFLAGS we may have been given.
2087 #undef XC_WANT_COMPAT_EVTCHN_API
2088 #undef XC_WANT_COMPAT_GNTTAB_API
2089 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
2090 #include <xenctrl.h>
2091 #include <xenstore.h>
2092 #include <xenevtchn.h>
2093 #include <xengnttab.h>
2094 #include <xenforeignmemory.h>
2095 #include <stdint.h>
2096 #include <xen/hvm/hvm_info_table.h>
2097 #if !defined(HVM_MAX_VCPUS)
2098 # error HVM_MAX_VCPUS not defined
2099 #endif
2100 int main(void) {
2101 xc_interface *xc = NULL;
2102 xenforeignmemory_handle *xfmem;
2103 xenevtchn_handle *xe;
2104 xengnttab_handle *xg;
2105 xen_domain_handle_t handle;
2107 xs_daemon_open();
2109 xc = xc_interface_open(0, 0, 0);
2110 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2111 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2112 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2113 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2114 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2116 xfmem = xenforeignmemory_open(0, 0);
2117 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
2119 xe = xenevtchn_open(0, 0);
2120 xenevtchn_fd(xe);
2122 xg = xengnttab_open(0, 0);
2123 xengnttab_map_grant_ref(xg, 0, 0, 0);
2125 return 0;
2128 compile_prog "" "$xen_libs $xen_stable_libs"
2129 then
2130 xen_ctrl_version=471
2131 xen=yes
2132 elif
2133 cat > $TMPC <<EOF &&
2134 #include <xenctrl.h>
2135 #include <stdint.h>
2136 int main(void) {
2137 xc_interface *xc = NULL;
2138 xen_domain_handle_t handle;
2139 xc_domain_create(xc, 0, handle, 0, NULL, NULL);
2140 return 0;
2143 compile_prog "" "$xen_libs"
2144 then
2145 xen_ctrl_version=470
2146 xen=yes
2148 # Xen 4.6
2149 elif
2150 cat > $TMPC <<EOF &&
2151 #include <xenctrl.h>
2152 #include <xenstore.h>
2153 #include <stdint.h>
2154 #include <xen/hvm/hvm_info_table.h>
2155 #if !defined(HVM_MAX_VCPUS)
2156 # error HVM_MAX_VCPUS not defined
2157 #endif
2158 int main(void) {
2159 xc_interface *xc;
2160 xs_daemon_open();
2161 xc = xc_interface_open(0, 0, 0);
2162 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2163 xc_gnttab_open(NULL, 0);
2164 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2165 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2166 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
2167 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
2168 return 0;
2171 compile_prog "" "$xen_libs"
2172 then
2173 xen_ctrl_version=460
2174 xen=yes
2176 # Xen 4.5
2177 elif
2178 cat > $TMPC <<EOF &&
2179 #include <xenctrl.h>
2180 #include <xenstore.h>
2181 #include <stdint.h>
2182 #include <xen/hvm/hvm_info_table.h>
2183 #if !defined(HVM_MAX_VCPUS)
2184 # error HVM_MAX_VCPUS not defined
2185 #endif
2186 int main(void) {
2187 xc_interface *xc;
2188 xs_daemon_open();
2189 xc = xc_interface_open(0, 0, 0);
2190 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2191 xc_gnttab_open(NULL, 0);
2192 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2193 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2194 xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
2195 return 0;
2198 compile_prog "" "$xen_libs"
2199 then
2200 xen_ctrl_version=450
2201 xen=yes
2203 elif
2204 cat > $TMPC <<EOF &&
2205 #include <xenctrl.h>
2206 #include <xenstore.h>
2207 #include <stdint.h>
2208 #include <xen/hvm/hvm_info_table.h>
2209 #if !defined(HVM_MAX_VCPUS)
2210 # error HVM_MAX_VCPUS not defined
2211 #endif
2212 int main(void) {
2213 xc_interface *xc;
2214 xs_daemon_open();
2215 xc = xc_interface_open(0, 0, 0);
2216 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2217 xc_gnttab_open(NULL, 0);
2218 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2219 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2220 return 0;
2223 compile_prog "" "$xen_libs"
2224 then
2225 xen_ctrl_version=420
2226 xen=yes
2228 else
2229 if test "$xen" = "yes" ; then
2230 feature_not_found "xen (unsupported version)" \
2231 "Install a supported xen (xen 4.2 or newer)"
2233 xen=no
2236 if test "$xen" = yes; then
2237 if test $xen_ctrl_version -ge 471 ; then
2238 libs_softmmu="$xen_stable_libs $libs_softmmu"
2240 libs_softmmu="$xen_libs $libs_softmmu"
2244 if test "$xen_pci_passthrough" != "no"; then
2245 if test "$xen" = "yes" && test "$linux" = "yes"; then
2246 xen_pci_passthrough=yes
2247 else
2248 if test "$xen_pci_passthrough" = "yes"; then
2249 error_exit "User requested feature Xen PCI Passthrough" \
2250 " but this feature requires /sys from Linux"
2252 xen_pci_passthrough=no
2256 if test "$xen_pv_domain_build" = "yes" &&
2257 test "$xen" != "yes"; then
2258 error_exit "User requested Xen PV domain builder support" \
2259 "which requires Xen support."
2262 ##########################################
2263 # Sparse probe
2264 if test "$sparse" != "no" ; then
2265 if has cgcc; then
2266 sparse=yes
2267 else
2268 if test "$sparse" = "yes" ; then
2269 feature_not_found "sparse" "Install sparse binary"
2271 sparse=no
2275 ##########################################
2276 # X11 probe
2277 x11_cflags=
2278 x11_libs=-lX11
2279 if $pkg_config --exists "x11"; then
2280 x11_cflags=$($pkg_config --cflags x11)
2281 x11_libs=$($pkg_config --libs x11)
2284 ##########################################
2285 # GTK probe
2287 if test "$gtkabi" = ""; then
2288 # The GTK ABI was not specified explicitly, so try whether 2.0 is available.
2289 # Use 3.0 as a fallback if that is available.
2290 if $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
2291 gtkabi=2.0
2292 elif $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
2293 gtkabi=3.0
2294 else
2295 gtkabi=2.0
2299 if test "$gtk" != "no"; then
2300 gtkpackage="gtk+-$gtkabi"
2301 gtkx11package="gtk+-x11-$gtkabi"
2302 if test "$gtkabi" = "3.0" ; then
2303 gtkversion="3.0.0"
2304 else
2305 gtkversion="2.18.0"
2307 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
2308 gtk_cflags=$($pkg_config --cflags $gtkpackage)
2309 gtk_libs=$($pkg_config --libs $gtkpackage)
2310 gtk_version=$($pkg_config --modversion $gtkpackage)
2311 if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
2312 gtk_cflags="$gtk_cflags $x11_cflags"
2313 gtk_libs="$gtk_libs $x11_libs"
2315 libs_softmmu="$gtk_libs $libs_softmmu"
2316 gtk="yes"
2317 elif test "$gtk" = "yes"; then
2318 feature_not_found "gtk" "Install gtk2 or gtk3 devel"
2319 else
2320 gtk="no"
2325 ##########################################
2326 # GNUTLS probe
2328 gnutls_works() {
2329 # Unfortunately some distros have bad pkg-config information for gnutls
2330 # such that it claims to exist but you get a compiler error if you try
2331 # to use the options returned by --libs. Specifically, Ubuntu for --static
2332 # builds doesn't work:
2333 # https://bugs.launchpad.net/ubuntu/+source/gnutls26/+bug/1478035
2335 # So sanity check the cflags/libs before assuming gnutls can be used.
2336 if ! $pkg_config --exists "gnutls"; then
2337 return 1
2340 write_c_skeleton
2341 compile_prog "$($pkg_config --cflags gnutls)" "$($pkg_config --libs gnutls)"
2344 gnutls_gcrypt=no
2345 gnutls_nettle=no
2346 if test "$gnutls" != "no"; then
2347 if gnutls_works; then
2348 gnutls_cflags=$($pkg_config --cflags gnutls)
2349 gnutls_libs=$($pkg_config --libs gnutls)
2350 libs_softmmu="$gnutls_libs $libs_softmmu"
2351 libs_tools="$gnutls_libs $libs_tools"
2352 QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
2353 gnutls="yes"
2355 # gnutls_rnd requires >= 2.11.0
2356 if $pkg_config --exists "gnutls >= 2.11.0"; then
2357 gnutls_rnd="yes"
2358 else
2359 gnutls_rnd="no"
2362 if $pkg_config --exists 'gnutls >= 3.0'; then
2363 gnutls_gcrypt=no
2364 gnutls_nettle=yes
2365 elif $pkg_config --exists 'gnutls >= 2.12'; then
2366 case $($pkg_config --libs --static gnutls) in
2367 *gcrypt*)
2368 gnutls_gcrypt=yes
2369 gnutls_nettle=no
2371 *nettle*)
2372 gnutls_gcrypt=no
2373 gnutls_nettle=yes
2376 gnutls_gcrypt=yes
2377 gnutls_nettle=no
2379 esac
2380 else
2381 gnutls_gcrypt=yes
2382 gnutls_nettle=no
2384 elif test "$gnutls" = "yes"; then
2385 feature_not_found "gnutls" "Install gnutls devel"
2386 else
2387 gnutls="no"
2388 gnutls_rnd="no"
2390 else
2391 gnutls_rnd="no"
2395 # If user didn't give a --disable/enable-gcrypt flag,
2396 # then mark as disabled if user requested nettle
2397 # explicitly, or if gnutls links to nettle
2398 if test -z "$gcrypt"
2399 then
2400 if test "$nettle" = "yes" || test "$gnutls_nettle" = "yes"
2401 then
2402 gcrypt="no"
2406 # If user didn't give a --disable/enable-nettle flag,
2407 # then mark as disabled if user requested gcrypt
2408 # explicitly, or if gnutls links to gcrypt
2409 if test -z "$nettle"
2410 then
2411 if test "$gcrypt" = "yes" || test "$gnutls_gcrypt" = "yes"
2412 then
2413 nettle="no"
2417 has_libgcrypt_config() {
2418 if ! has "libgcrypt-config"
2419 then
2420 return 1
2423 if test -n "$cross_prefix"
2424 then
2425 host=$(libgcrypt-config --host)
2426 if test "$host-" != $cross_prefix
2427 then
2428 return 1
2432 return 0
2435 if test "$gcrypt" != "no"; then
2436 if has_libgcrypt_config; then
2437 gcrypt_cflags=$(libgcrypt-config --cflags)
2438 gcrypt_libs=$(libgcrypt-config --libs)
2439 # Debian has remove -lgpg-error from libgcrypt-config
2440 # as it "spreads unnecessary dependencies" which in
2441 # turn breaks static builds...
2442 if test "$static" = "yes"
2443 then
2444 gcrypt_libs="$gcrypt_libs -lgpg-error"
2446 libs_softmmu="$gcrypt_libs $libs_softmmu"
2447 libs_tools="$gcrypt_libs $libs_tools"
2448 QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
2449 gcrypt="yes"
2450 if test -z "$nettle"; then
2451 nettle="no"
2454 cat > $TMPC << EOF
2455 #include <gcrypt.h>
2456 int main(void) {
2457 gcry_kdf_derive(NULL, 0, GCRY_KDF_PBKDF2,
2458 GCRY_MD_SHA256,
2459 NULL, 0, 0, 0, NULL);
2460 return 0;
2463 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2464 gcrypt_kdf=yes
2467 cat > $TMPC << EOF
2468 #include <gcrypt.h>
2469 int main(void) {
2470 gcry_mac_hd_t handle;
2471 gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5,
2472 GCRY_MAC_FLAG_SECURE, NULL);
2473 return 0;
2476 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
2477 gcrypt_hmac=yes
2479 else
2480 if test "$gcrypt" = "yes"; then
2481 feature_not_found "gcrypt" "Install gcrypt devel"
2482 else
2483 gcrypt="no"
2489 if test "$nettle" != "no"; then
2490 if $pkg_config --exists "nettle"; then
2491 nettle_cflags=$($pkg_config --cflags nettle)
2492 nettle_libs=$($pkg_config --libs nettle)
2493 nettle_version=$($pkg_config --modversion nettle)
2494 libs_softmmu="$nettle_libs $libs_softmmu"
2495 libs_tools="$nettle_libs $libs_tools"
2496 QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
2497 nettle="yes"
2499 cat > $TMPC << EOF
2500 #include <stddef.h>
2501 #include <nettle/pbkdf2.h>
2502 int main(void) {
2503 pbkdf2_hmac_sha256(8, NULL, 1000, 8, NULL, 8, NULL);
2504 return 0;
2507 if compile_prog "$nettle_cflags" "$nettle_libs" ; then
2508 nettle_kdf=yes
2510 else
2511 if test "$nettle" = "yes"; then
2512 feature_not_found "nettle" "Install nettle devel"
2513 else
2514 nettle="no"
2519 if test "$gcrypt" = "yes" && test "$nettle" = "yes"
2520 then
2521 error_exit "Only one of gcrypt & nettle can be enabled"
2524 ##########################################
2525 # libtasn1 - only for the TLS creds/session test suite
2527 tasn1=yes
2528 tasn1_cflags=""
2529 tasn1_libs=""
2530 if $pkg_config --exists "libtasn1"; then
2531 tasn1_cflags=$($pkg_config --cflags libtasn1)
2532 tasn1_libs=$($pkg_config --libs libtasn1)
2533 else
2534 tasn1=no
2538 ##########################################
2539 # getifaddrs (for tests/test-io-channel-socket )
2541 have_ifaddrs_h=yes
2542 if ! check_include "ifaddrs.h" ; then
2543 have_ifaddrs_h=no
2546 ##########################################
2547 # VTE probe
2549 if test "$vte" != "no"; then
2550 if test "$gtkabi" = "3.0"; then
2551 vteminversion="0.32.0"
2552 if $pkg_config --exists "vte-2.91"; then
2553 vtepackage="vte-2.91"
2554 else
2555 vtepackage="vte-2.90"
2557 else
2558 vtepackage="vte"
2559 vteminversion="0.24.0"
2561 if $pkg_config --exists "$vtepackage >= $vteminversion"; then
2562 vte_cflags=$($pkg_config --cflags $vtepackage)
2563 vte_libs=$($pkg_config --libs $vtepackage)
2564 vteversion=$($pkg_config --modversion $vtepackage)
2565 libs_softmmu="$vte_libs $libs_softmmu"
2566 vte="yes"
2567 elif test "$vte" = "yes"; then
2568 if test "$gtkabi" = "3.0"; then
2569 feature_not_found "vte" "Install libvte-2.90/2.91 devel"
2570 else
2571 feature_not_found "vte" "Install libvte devel"
2573 else
2574 vte="no"
2578 ##########################################
2579 # SDL probe
2581 # Look for sdl configuration program (pkg-config or sdl-config). Try
2582 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
2584 if test "$sdlabi" = ""; then
2585 if $pkg_config --exists "sdl"; then
2586 sdlabi=1.2
2587 elif $pkg_config --exists "sdl2"; then
2588 sdlabi=2.0
2589 else
2590 sdlabi=1.2
2594 if test $sdlabi = "2.0"; then
2595 sdl_config=$sdl2_config
2596 sdlname=sdl2
2597 sdlconfigname=sdl2_config
2598 elif test $sdlabi = "1.2"; then
2599 sdlname=sdl
2600 sdlconfigname=sdl_config
2601 else
2602 error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0"
2605 if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then
2606 sdl_config=$sdlconfigname
2609 if $pkg_config $sdlname --exists; then
2610 sdlconfig="$pkg_config $sdlname"
2611 sdlversion=$($sdlconfig --modversion 2>/dev/null)
2612 elif has ${sdl_config}; then
2613 sdlconfig="$sdl_config"
2614 sdlversion=$($sdlconfig --version)
2615 else
2616 if test "$sdl" = "yes" ; then
2617 feature_not_found "sdl" "Install SDL devel"
2619 sdl=no
2621 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
2622 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
2625 sdl_too_old=no
2626 if test "$sdl" != "no" ; then
2627 cat > $TMPC << EOF
2628 #include <SDL.h>
2629 #undef main /* We don't want SDL to override our main() */
2630 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
2632 sdl_cflags=$($sdlconfig --cflags 2>/dev/null)
2633 if test "$static" = "yes" ; then
2634 sdl_libs=$($sdlconfig --static-libs 2>/dev/null)
2635 else
2636 sdl_libs=$($sdlconfig --libs 2>/dev/null)
2638 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2639 if test $(echo $sdlversion | sed 's/[^0-9]//g') -lt 121 ; then
2640 sdl_too_old=yes
2641 else
2642 sdl=yes
2645 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
2646 if test "$sdl" = "yes" -a "$static" = "yes" ; then
2647 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
2648 sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)"
2649 sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)"
2651 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2653 else
2654 sdl=no
2656 fi # static link
2657 else # sdl not found
2658 if test "$sdl" = "yes" ; then
2659 feature_not_found "sdl" "Install SDL devel"
2661 sdl=no
2662 fi # sdl compile test
2665 if test "$sdl" = "yes" ; then
2666 cat > $TMPC <<EOF
2667 #include <SDL.h>
2668 #if defined(SDL_VIDEO_DRIVER_X11)
2669 #include <X11/XKBlib.h>
2670 #else
2671 #error No x11 support
2672 #endif
2673 int main(void) { return 0; }
2675 if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then
2676 sdl_cflags="$sdl_cflags $x11_cflags"
2677 sdl_libs="$sdl_libs $x11_libs"
2679 libs_softmmu="$sdl_libs $libs_softmmu"
2682 ##########################################
2683 # RDMA needs OpenFabrics libraries
2684 if test "$rdma" != "no" ; then
2685 cat > $TMPC <<EOF
2686 #include <rdma/rdma_cma.h>
2687 int main(void) { return 0; }
2689 rdma_libs="-lrdmacm -libverbs"
2690 if compile_prog "" "$rdma_libs" ; then
2691 rdma="yes"
2692 libs_softmmu="$libs_softmmu $rdma_libs"
2693 else
2694 if test "$rdma" = "yes" ; then
2695 error_exit \
2696 " OpenFabrics librdmacm/libibverbs not present." \
2697 " Your options:" \
2698 " (1) Fast: Install infiniband packages from your distro." \
2699 " (2) Cleanest: Install libraries from www.openfabrics.org" \
2700 " (3) Also: Install softiwarp if you don't have RDMA hardware"
2702 rdma="no"
2706 ##########################################
2707 # VNC SASL detection
2708 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
2709 cat > $TMPC <<EOF
2710 #include <sasl/sasl.h>
2711 #include <stdio.h>
2712 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
2714 # Assuming Cyrus-SASL installed in /usr prefix
2715 vnc_sasl_cflags=""
2716 vnc_sasl_libs="-lsasl2"
2717 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
2718 vnc_sasl=yes
2719 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
2720 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
2721 else
2722 if test "$vnc_sasl" = "yes" ; then
2723 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
2725 vnc_sasl=no
2729 ##########################################
2730 # VNC JPEG detection
2731 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
2732 if $pkg_config --exists libjpeg; then
2733 vnc_jpeg=yes
2734 libs_softmmu="$libs_softmmu $($pkg_config --libs libjpeg)"
2735 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags libjpeg)"
2736 else
2737 cat > $TMPC <<EOF
2738 #include <stdio.h>
2739 #include <jpeglib.h>
2740 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2742 vnc_jpeg_cflags=""
2743 vnc_jpeg_libs="-ljpeg"
2744 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2745 vnc_jpeg=yes
2746 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
2747 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
2748 else
2749 if test "$vnc_jpeg" = "yes" ; then
2750 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
2752 vnc_jpeg=no
2757 ##########################################
2758 # VNC PNG detection
2759 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
2760 cat > $TMPC <<EOF
2761 //#include <stdio.h>
2762 #include <png.h>
2763 #include <stddef.h>
2764 int main(void) {
2765 png_structp png_ptr;
2766 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
2767 return png_ptr != 0;
2770 if $pkg_config libpng --exists; then
2771 vnc_png_cflags=$($pkg_config libpng --cflags)
2772 vnc_png_libs=$($pkg_config libpng --libs)
2773 else
2774 vnc_png_cflags=""
2775 vnc_png_libs="-lpng"
2777 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2778 vnc_png=yes
2779 libs_softmmu="$vnc_png_libs $libs_softmmu"
2780 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
2781 else
2782 if test "$vnc_png" = "yes" ; then
2783 feature_not_found "vnc-png" "Install libpng devel"
2785 vnc_png=no
2789 ##########################################
2790 # fnmatch() probe, used for ACL routines
2791 fnmatch="no"
2792 cat > $TMPC << EOF
2793 #include <fnmatch.h>
2794 int main(void)
2796 fnmatch("foo", "foo", 0);
2797 return 0;
2800 if compile_prog "" "" ; then
2801 fnmatch="yes"
2804 ##########################################
2805 # xfsctl() probe, used for file-posix.c
2806 if test "$xfs" != "no" ; then
2807 cat > $TMPC << EOF
2808 #include <stddef.h> /* NULL */
2809 #include <xfs/xfs.h>
2810 int main(void)
2812 xfsctl(NULL, 0, 0, NULL);
2813 return 0;
2816 if compile_prog "" "" ; then
2817 xfs="yes"
2818 else
2819 if test "$xfs" = "yes" ; then
2820 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
2822 xfs=no
2826 ##########################################
2827 # vde libraries probe
2828 if test "$vde" != "no" ; then
2829 vde_libs="-lvdeplug"
2830 cat > $TMPC << EOF
2831 #include <stddef.h>
2832 #include <libvdeplug.h>
2833 int main(void)
2835 struct vde_open_args a = {0, 0, 0};
2836 char s[] = "";
2837 vde_open(s, s, &a);
2838 return 0;
2841 if compile_prog "" "$vde_libs" ; then
2842 vde=yes
2843 libs_softmmu="$vde_libs $libs_softmmu"
2844 libs_tools="$vde_libs $libs_tools"
2845 else
2846 if test "$vde" = "yes" ; then
2847 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
2849 vde=no
2853 ##########################################
2854 # netmap support probe
2855 # Apart from looking for netmap headers, we make sure that the host API version
2856 # supports the netmap backend (>=11). The upper bound (15) is meant to simulate
2857 # a minor/major version number. Minor new features will be marked with values up
2858 # to 15, and if something happens that requires a change to the backend we will
2859 # move above 15, submit the backend fixes and modify this two bounds.
2860 if test "$netmap" != "no" ; then
2861 cat > $TMPC << EOF
2862 #include <inttypes.h>
2863 #include <net/if.h>
2864 #include <net/netmap.h>
2865 #include <net/netmap_user.h>
2866 #if (NETMAP_API < 11) || (NETMAP_API > 15)
2867 #error
2868 #endif
2869 int main(void) { return 0; }
2871 if compile_prog "" "" ; then
2872 netmap=yes
2873 else
2874 if test "$netmap" = "yes" ; then
2875 feature_not_found "netmap"
2877 netmap=no
2881 ##########################################
2882 # libcap-ng library probe
2883 if test "$cap_ng" != "no" ; then
2884 cap_libs="-lcap-ng"
2885 cat > $TMPC << EOF
2886 #include <cap-ng.h>
2887 int main(void)
2889 capng_capability_to_name(CAPNG_EFFECTIVE);
2890 return 0;
2893 if compile_prog "" "$cap_libs" ; then
2894 cap_ng=yes
2895 libs_tools="$cap_libs $libs_tools"
2896 else
2897 if test "$cap_ng" = "yes" ; then
2898 feature_not_found "cap_ng" "Install libcap-ng devel"
2900 cap_ng=no
2904 ##########################################
2905 # Sound support libraries probe
2907 audio_drv_probe()
2909 drv=$1
2910 hdr=$2
2911 lib=$3
2912 exp=$4
2913 cfl=$5
2914 cat > $TMPC << EOF
2915 #include <$hdr>
2916 int main(void) { $exp }
2918 if compile_prog "$cfl" "$lib" ; then
2920 else
2921 error_exit "$drv check failed" \
2922 "Make sure to have the $drv libs and headers installed."
2926 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g')
2927 for drv in $audio_drv_list; do
2928 case $drv in
2929 alsa)
2930 audio_drv_probe $drv alsa/asoundlib.h -lasound \
2931 "return snd_pcm_close((snd_pcm_t *)0);"
2932 libs_softmmu="-lasound $libs_softmmu"
2936 audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \
2937 "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;"
2938 libs_softmmu="-lpulse $libs_softmmu"
2939 audio_pt_int="yes"
2942 sdl)
2943 if test "$sdl" = "no"; then
2944 error_exit "sdl not found or disabled, can not use sdl audio driver"
2948 coreaudio)
2949 libs_softmmu="-framework CoreAudio $libs_softmmu"
2952 dsound)
2953 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
2954 audio_win_int="yes"
2957 oss)
2958 libs_softmmu="$oss_lib $libs_softmmu"
2961 wav)
2962 # XXX: Probes for CoreAudio, DirectSound
2966 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
2967 error_exit "Unknown driver '$drv' selected" \
2968 "Possible drivers are: $audio_possible_drivers"
2971 esac
2972 done
2974 ##########################################
2975 # BrlAPI probe
2977 if test "$brlapi" != "no" ; then
2978 brlapi_libs="-lbrlapi"
2979 cat > $TMPC << EOF
2980 #include <brlapi.h>
2981 #include <stddef.h>
2982 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
2984 if compile_prog "" "$brlapi_libs" ; then
2985 brlapi=yes
2986 libs_softmmu="$brlapi_libs $libs_softmmu"
2987 else
2988 if test "$brlapi" = "yes" ; then
2989 feature_not_found "brlapi" "Install brlapi devel"
2991 brlapi=no
2995 ##########################################
2996 # curses probe
2997 if test "$curses" != "no" ; then
2998 if test "$mingw32" = "yes" ; then
2999 curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
3000 curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
3001 else
3002 curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
3003 curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
3005 curses_found=no
3006 cat > $TMPC << EOF
3007 #include <locale.h>
3008 #include <curses.h>
3009 #include <wchar.h>
3010 int main(void) {
3011 const char *s = curses_version();
3012 wchar_t wch = L'w';
3013 setlocale(LC_ALL, "");
3014 resize_term(0, 0);
3015 addwstr(L"wide chars\n");
3016 addnwstr(&wch, 1);
3017 add_wch(WACS_DEGREE);
3018 return s != 0;
3021 IFS=:
3022 for curses_inc in $curses_inc_list; do
3023 IFS=:
3024 for curses_lib in $curses_lib_list; do
3025 unset IFS
3026 if compile_prog "$curses_inc" "$curses_lib" ; then
3027 curses_found=yes
3028 QEMU_CFLAGS="$curses_inc $QEMU_CFLAGS"
3029 libs_softmmu="$curses_lib $libs_softmmu"
3030 break
3032 done
3033 if test "$curses_found" = yes ; then
3034 break
3036 done
3037 unset IFS
3038 if test "$curses_found" = "yes" ; then
3039 curses=yes
3040 else
3041 if test "$curses" = "yes" ; then
3042 feature_not_found "curses" "Install ncurses devel"
3044 curses=no
3048 ##########################################
3049 # curl probe
3050 if test "$curl" != "no" ; then
3051 if $pkg_config libcurl --exists; then
3052 curlconfig="$pkg_config libcurl"
3053 else
3054 curlconfig=curl-config
3056 cat > $TMPC << EOF
3057 #include <curl/curl.h>
3058 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
3060 curl_cflags=$($curlconfig --cflags 2>/dev/null)
3061 curl_libs=$($curlconfig --libs 2>/dev/null)
3062 if compile_prog "$curl_cflags" "$curl_libs" ; then
3063 curl=yes
3064 else
3065 if test "$curl" = "yes" ; then
3066 feature_not_found "curl" "Install libcurl devel"
3068 curl=no
3070 fi # test "$curl"
3072 ##########################################
3073 # bluez support probe
3074 if test "$bluez" != "no" ; then
3075 cat > $TMPC << EOF
3076 #include <bluetooth/bluetooth.h>
3077 int main(void) { return bt_error(0); }
3079 bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null)
3080 bluez_libs=$($pkg_config --libs bluez 2>/dev/null)
3081 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
3082 bluez=yes
3083 libs_softmmu="$bluez_libs $libs_softmmu"
3084 else
3085 if test "$bluez" = "yes" ; then
3086 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
3088 bluez="no"
3092 ##########################################
3093 # glib support probe
3095 glib_req_ver=2.22
3096 glib_modules=gthread-2.0
3097 if test "$modules" = yes; then
3098 glib_modules="$glib_modules gmodule-2.0"
3101 # This workaround is required due to a bug in pkg-config file for glib as it
3102 # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
3104 if test "$static" = yes -a "$mingw32" = yes; then
3105 QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS"
3108 for i in $glib_modules; do
3109 if $pkg_config --atleast-version=$glib_req_ver $i; then
3110 glib_cflags=$($pkg_config --cflags $i)
3111 glib_libs=$($pkg_config --libs $i)
3112 QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
3113 LIBS="$glib_libs $LIBS"
3114 libs_qga="$glib_libs $libs_qga"
3115 else
3116 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
3118 done
3120 # Sanity check that the current size_t matches the
3121 # size that glib thinks it should be. This catches
3122 # problems on multi-arch where people try to build
3123 # 32-bit QEMU while pointing at 64-bit glib headers
3124 cat > $TMPC <<EOF
3125 #include <glib.h>
3126 #include <unistd.h>
3128 #define QEMU_BUILD_BUG_ON(x) \
3129 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
3131 int main(void) {
3132 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
3133 return 0;
3137 if ! compile_prog "$CFLAGS" "$LIBS" ; then
3138 error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
3139 "You probably need to set PKG_CONFIG_LIBDIR"\
3140 "to point to the right pkg-config files for your"\
3141 "build target"
3144 # g_test_trap_subprocess added in 2.38. Used by some tests.
3145 glib_subprocess=yes
3146 if ! $pkg_config --atleast-version=2.38 glib-2.0; then
3147 glib_subprocess=no
3150 # Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage
3151 cat > $TMPC << EOF
3152 #include <glib.h>
3153 int main(void) { return 0; }
3155 if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
3156 if cc_has_warning_flag "-Wno-unknown-attributes"; then
3157 glib_cflags="-Wno-unknown-attributes $glib_cflags"
3158 CFLAGS="-Wno-unknown-attributes $CFLAGS"
3162 #########################################
3163 # zlib check
3165 if test "$zlib" != "no" ; then
3166 if $pkg_config --exists zlib; then
3167 zlib_cflags=$($pkg_config --cflags zlib)
3168 zlib_libs=$($pkg_config --libs zlib)
3169 QEMU_CFLAGS="$zlib_cflags $QEMU_CFLAGS"
3170 LIBS="$zlib_libs $LIBS"
3171 else
3172 cat > $TMPC << EOF
3173 #include <zlib.h>
3174 int main(void) { zlibVersion(); return 0; }
3176 if compile_prog "" "-lz" ; then
3177 LIBS="$LIBS -lz"
3178 else
3179 error_exit "zlib check failed" \
3180 "Make sure to have the zlib libs and headers installed."
3185 ##########################################
3186 # SHA command probe for modules
3187 if test "$modules" = yes; then
3188 shacmd_probe="sha1sum sha1 shasum"
3189 for c in $shacmd_probe; do
3190 if has $c; then
3191 shacmd="$c"
3192 break
3194 done
3195 if test "$shacmd" = ""; then
3196 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
3200 ##########################################
3201 # pixman support probe
3203 if test "$pixman" = ""; then
3204 if test "$want_tools" = "no" -a "$softmmu" = "no"; then
3205 pixman="none"
3206 elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
3207 pixman="system"
3208 else
3209 pixman="internal"
3212 if test "$pixman" = "none"; then
3213 if test "$want_tools" != "no" -o "$softmmu" != "no"; then
3214 error_exit "pixman disabled but system emulation or tools build" \
3215 "enabled. You can turn off pixman only if you also" \
3216 "disable all system emulation targets and the tools" \
3217 "build with '--disable-tools --disable-system'."
3219 pixman_cflags=
3220 pixman_libs=
3221 elif test "$pixman" = "system"; then
3222 # pixman version has been checked above
3223 pixman_cflags=$($pkg_config --cflags pixman-1)
3224 pixman_libs=$($pkg_config --libs pixman-1)
3225 else
3226 if test ! -d ${source_path}/pixman/pixman; then
3227 error_exit "pixman >= 0.21.8 not present. Your options:" \
3228 " (1) Preferred: Install the pixman devel package (any recent" \
3229 " distro should have packages as Xorg needs pixman too)." \
3230 " (2) Fetch the pixman submodule, using:" \
3231 " git submodule update --init pixman"
3233 mkdir -p pixman/pixman
3234 pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
3235 pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
3238 ##########################################
3239 # libcap probe
3241 if test "$cap" != "no" ; then
3242 cat > $TMPC <<EOF
3243 #include <stdio.h>
3244 #include <sys/capability.h>
3245 int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
3247 if compile_prog "" "-lcap" ; then
3248 cap=yes
3249 else
3250 cap=no
3254 ##########################################
3255 # pthread probe
3256 PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
3258 pthread=no
3259 cat > $TMPC << EOF
3260 #include <pthread.h>
3261 static void *f(void *p) { return NULL; }
3262 int main(void) {
3263 pthread_t thread;
3264 pthread_create(&thread, 0, f, 0);
3265 return 0;
3268 if compile_prog "" "" ; then
3269 pthread=yes
3270 else
3271 for pthread_lib in $PTHREADLIBS_LIST; do
3272 if compile_prog "" "$pthread_lib" ; then
3273 pthread=yes
3274 found=no
3275 for lib_entry in $LIBS; do
3276 if test "$lib_entry" = "$pthread_lib"; then
3277 found=yes
3278 break
3280 done
3281 if test "$found" = "no"; then
3282 LIBS="$pthread_lib $LIBS"
3284 PTHREAD_LIB="$pthread_lib"
3285 break
3287 done
3290 if test "$mingw32" != yes -a "$pthread" = no; then
3291 error_exit "pthread check failed" \
3292 "Make sure to have the pthread libs and headers installed."
3295 # check for pthread_setname_np
3296 pthread_setname_np=no
3297 cat > $TMPC << EOF
3298 #include <pthread.h>
3300 static void *f(void *p) { return NULL; }
3301 int main(void)
3303 pthread_t thread;
3304 pthread_create(&thread, 0, f, 0);
3305 pthread_setname_np(thread, "QEMU");
3306 return 0;
3309 if compile_prog "" "$pthread_lib" ; then
3310 pthread_setname_np=yes
3313 ##########################################
3314 # rbd probe
3315 if test "$rbd" != "no" ; then
3316 cat > $TMPC <<EOF
3317 #include <stdio.h>
3318 #include <rbd/librbd.h>
3319 int main(void) {
3320 rados_t cluster;
3321 rados_create(&cluster, NULL);
3322 return 0;
3325 rbd_libs="-lrbd -lrados"
3326 if compile_prog "" "$rbd_libs" ; then
3327 rbd=yes
3328 else
3329 if test "$rbd" = "yes" ; then
3330 feature_not_found "rados block device" "Install librbd/ceph devel"
3332 rbd=no
3336 ##########################################
3337 # libssh2 probe
3338 min_libssh2_version=1.2.8
3339 if test "$libssh2" != "no" ; then
3340 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
3341 libssh2_cflags=$($pkg_config libssh2 --cflags)
3342 libssh2_libs=$($pkg_config libssh2 --libs)
3343 libssh2=yes
3344 else
3345 if test "$libssh2" = "yes" ; then
3346 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
3348 libssh2=no
3352 ##########################################
3353 # libssh2_sftp_fsync probe
3355 if test "$libssh2" = "yes"; then
3356 cat > $TMPC <<EOF
3357 #include <stdio.h>
3358 #include <libssh2.h>
3359 #include <libssh2_sftp.h>
3360 int main(void) {
3361 LIBSSH2_SESSION *session;
3362 LIBSSH2_SFTP *sftp;
3363 LIBSSH2_SFTP_HANDLE *sftp_handle;
3364 session = libssh2_session_init ();
3365 sftp = libssh2_sftp_init (session);
3366 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
3367 libssh2_sftp_fsync (sftp_handle);
3368 return 0;
3371 # libssh2_cflags/libssh2_libs defined in previous test.
3372 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
3373 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
3377 ##########################################
3378 # linux-aio probe
3380 if test "$linux_aio" != "no" ; then
3381 cat > $TMPC <<EOF
3382 #include <libaio.h>
3383 #include <sys/eventfd.h>
3384 #include <stddef.h>
3385 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
3387 if compile_prog "" "-laio" ; then
3388 linux_aio=yes
3389 else
3390 if test "$linux_aio" = "yes" ; then
3391 feature_not_found "linux AIO" "Install libaio devel"
3393 linux_aio=no
3397 ##########################################
3398 # TPM passthrough is only on x86 Linux
3400 if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
3401 tpm_passthrough=$tpm
3402 else
3403 tpm_passthrough=no
3406 ##########################################
3407 # attr probe
3409 if test "$attr" != "no" ; then
3410 cat > $TMPC <<EOF
3411 #include <stdio.h>
3412 #include <sys/types.h>
3413 #ifdef CONFIG_LIBATTR
3414 #include <attr/xattr.h>
3415 #else
3416 #include <sys/xattr.h>
3417 #endif
3418 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
3420 if compile_prog "" "" ; then
3421 attr=yes
3422 # Older distros have <attr/xattr.h>, and need -lattr:
3423 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
3424 attr=yes
3425 LIBS="-lattr $LIBS"
3426 libattr=yes
3427 else
3428 if test "$attr" = "yes" ; then
3429 feature_not_found "ATTR" "Install libc6 or libattr devel"
3431 attr=no
3435 ##########################################
3436 # iovec probe
3437 cat > $TMPC <<EOF
3438 #include <sys/types.h>
3439 #include <sys/uio.h>
3440 #include <unistd.h>
3441 int main(void) { return sizeof(struct iovec); }
3443 iovec=no
3444 if compile_prog "" "" ; then
3445 iovec=yes
3448 ##########################################
3449 # preadv probe
3450 cat > $TMPC <<EOF
3451 #include <sys/types.h>
3452 #include <sys/uio.h>
3453 #include <unistd.h>
3454 int main(void) { return preadv(0, 0, 0, 0); }
3456 preadv=no
3457 if compile_prog "" "" ; then
3458 preadv=yes
3461 ##########################################
3462 # fdt probe
3463 # fdt support is mandatory for at least some target architectures,
3464 # so insist on it if we're building those system emulators.
3465 fdt_required=no
3466 for target in $target_list; do
3467 case $target in
3468 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu)
3469 fdt_required=yes
3471 esac
3472 done
3474 if test "$fdt_required" = "yes"; then
3475 if test "$fdt" = "no"; then
3476 error_exit "fdt disabled but some requested targets require it." \
3477 "You can turn off fdt only if you also disable all the system emulation" \
3478 "targets which need it (by specifying a cut down --target-list)."
3480 fdt=yes
3483 if test "$fdt" != "no" ; then
3484 fdt_libs="-lfdt"
3485 # explicitly check for libfdt_env.h as it is missing in some stable installs
3486 # and test for required functions to make sure we are on a version >= 1.4.2
3487 cat > $TMPC << EOF
3488 #include <libfdt.h>
3489 #include <libfdt_env.h>
3490 int main(void) { fdt_first_subnode(0, 0); return 0; }
3492 if compile_prog "" "$fdt_libs" ; then
3493 # system DTC is good - use it
3494 fdt=yes
3495 elif test -d ${source_path}/dtc/libfdt ; then
3496 # have submodule DTC - use it
3497 fdt=yes
3498 dtc_internal="yes"
3499 mkdir -p dtc
3500 if [ "$pwd_is_source_path" != "y" ] ; then
3501 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
3502 symlink "$source_path/dtc/scripts" "dtc/scripts"
3504 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
3505 fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
3506 elif test "$fdt" = "yes" ; then
3507 # have neither and want - prompt for system/submodule install
3508 error_exit "DTC (libfdt) version >= 1.4.2 not present. Your options:" \
3509 " (1) Preferred: Install the DTC (libfdt) devel package" \
3510 " (2) Fetch the DTC submodule, using:" \
3511 " git submodule update --init dtc"
3512 else
3513 # don't have and don't want
3514 fdt_libs=
3515 fdt=no
3519 libs_softmmu="$libs_softmmu $fdt_libs"
3521 ##########################################
3522 # opengl probe (for sdl2, gtk, milkymist-tmu2)
3524 if test "$opengl" != "no" ; then
3525 opengl_pkgs="epoxy libdrm gbm"
3526 if $pkg_config $opengl_pkgs x11; then
3527 opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
3528 opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
3529 opengl=yes
3530 if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
3531 gtk_gl="yes"
3533 QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
3534 else
3535 if test "$opengl" = "yes" ; then
3536 feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
3538 opengl_cflags=""
3539 opengl_libs=""
3540 opengl=no
3544 if test "$opengl" = "yes"; then
3545 cat > $TMPC << EOF
3546 #include <epoxy/egl.h>
3547 #ifndef EGL_MESA_image_dma_buf_export
3548 # error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
3549 #endif
3550 int main(void) { return 0; }
3552 if compile_prog "" "" ; then
3553 opengl_dmabuf=yes
3558 ##########################################
3559 # glusterfs probe
3560 if test "$glusterfs" != "no" ; then
3561 if $pkg_config --atleast-version=3 glusterfs-api; then
3562 glusterfs="yes"
3563 glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
3564 glusterfs_libs=$($pkg_config --libs glusterfs-api)
3565 if $pkg_config --atleast-version=4 glusterfs-api; then
3566 glusterfs_xlator_opt="yes"
3568 if $pkg_config --atleast-version=5 glusterfs-api; then
3569 glusterfs_discard="yes"
3571 if $pkg_config --atleast-version=6 glusterfs-api; then
3572 glusterfs_zerofill="yes"
3574 else
3575 if test "$glusterfs" = "yes" ; then
3576 feature_not_found "GlusterFS backend support" \
3577 "Install glusterfs-api devel >= 3"
3579 glusterfs="no"
3583 # Check for inotify functions when we are building linux-user
3584 # emulator. This is done because older glibc versions don't
3585 # have syscall stubs for these implemented. In that case we
3586 # don't provide them even if kernel supports them.
3588 inotify=no
3589 cat > $TMPC << EOF
3590 #include <sys/inotify.h>
3593 main(void)
3595 /* try to start inotify */
3596 return inotify_init();
3599 if compile_prog "" "" ; then
3600 inotify=yes
3603 inotify1=no
3604 cat > $TMPC << EOF
3605 #include <sys/inotify.h>
3608 main(void)
3610 /* try to start inotify */
3611 return inotify_init1(0);
3614 if compile_prog "" "" ; then
3615 inotify1=yes
3618 # check if utimensat and futimens are supported
3619 utimens=no
3620 cat > $TMPC << EOF
3621 #define _ATFILE_SOURCE
3622 #include <stddef.h>
3623 #include <fcntl.h>
3624 #include <sys/stat.h>
3626 int main(void)
3628 utimensat(AT_FDCWD, "foo", NULL, 0);
3629 futimens(0, NULL);
3630 return 0;
3633 if compile_prog "" "" ; then
3634 utimens=yes
3637 # check if pipe2 is there
3638 pipe2=no
3639 cat > $TMPC << EOF
3640 #include <unistd.h>
3641 #include <fcntl.h>
3643 int main(void)
3645 int pipefd[2];
3646 return pipe2(pipefd, O_CLOEXEC);
3649 if compile_prog "" "" ; then
3650 pipe2=yes
3653 # check if accept4 is there
3654 accept4=no
3655 cat > $TMPC << EOF
3656 #include <sys/socket.h>
3657 #include <stddef.h>
3659 int main(void)
3661 accept4(0, NULL, NULL, SOCK_CLOEXEC);
3662 return 0;
3665 if compile_prog "" "" ; then
3666 accept4=yes
3669 # check if tee/splice is there. vmsplice was added same time.
3670 splice=no
3671 cat > $TMPC << EOF
3672 #include <unistd.h>
3673 #include <fcntl.h>
3674 #include <limits.h>
3676 int main(void)
3678 int len, fd = 0;
3679 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
3680 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
3681 return 0;
3684 if compile_prog "" "" ; then
3685 splice=yes
3688 ##########################################
3689 # libnuma probe
3691 if test "$numa" != "no" ; then
3692 cat > $TMPC << EOF
3693 #include <numa.h>
3694 int main(void) { return numa_available(); }
3697 if compile_prog "" "-lnuma" ; then
3698 numa=yes
3699 libs_softmmu="-lnuma $libs_softmmu"
3700 else
3701 if test "$numa" = "yes" ; then
3702 feature_not_found "numa" "install numactl devel"
3704 numa=no
3708 if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
3709 echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
3710 exit 1
3713 ##########################################
3714 # tcmalloc probe
3716 if test "$tcmalloc" = "yes" ; then
3717 cat > $TMPC << EOF
3718 #include <stdlib.h>
3719 int main(void) { malloc(1); return 0; }
3722 if compile_prog "" "-ltcmalloc" ; then
3723 LIBS="-ltcmalloc $LIBS"
3724 else
3725 feature_not_found "tcmalloc" "install gperftools devel"
3729 ##########################################
3730 # jemalloc probe
3732 if test "$jemalloc" = "yes" ; then
3733 cat > $TMPC << EOF
3734 #include <stdlib.h>
3735 int main(void) { malloc(1); return 0; }
3738 if compile_prog "" "-ljemalloc" ; then
3739 LIBS="-ljemalloc $LIBS"
3740 else
3741 feature_not_found "jemalloc" "install jemalloc devel"
3745 ##########################################
3746 # signalfd probe
3747 signalfd="no"
3748 cat > $TMPC << EOF
3749 #include <unistd.h>
3750 #include <sys/syscall.h>
3751 #include <signal.h>
3752 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
3755 if compile_prog "" "" ; then
3756 signalfd=yes
3759 # check if eventfd is supported
3760 eventfd=no
3761 cat > $TMPC << EOF
3762 #include <sys/eventfd.h>
3764 int main(void)
3766 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
3769 if compile_prog "" "" ; then
3770 eventfd=yes
3773 # check if memfd is supported
3774 memfd=no
3775 cat > $TMPC << EOF
3776 #include <sys/memfd.h>
3778 int main(void)
3780 return memfd_create("foo", MFD_ALLOW_SEALING);
3783 if compile_prog "" "" ; then
3784 memfd=yes
3789 # check for fallocate
3790 fallocate=no
3791 cat > $TMPC << EOF
3792 #include <fcntl.h>
3794 int main(void)
3796 fallocate(0, 0, 0, 0);
3797 return 0;
3800 if compile_prog "" "" ; then
3801 fallocate=yes
3804 # check for fallocate hole punching
3805 fallocate_punch_hole=no
3806 cat > $TMPC << EOF
3807 #include <fcntl.h>
3808 #include <linux/falloc.h>
3810 int main(void)
3812 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
3813 return 0;
3816 if compile_prog "" "" ; then
3817 fallocate_punch_hole=yes
3820 # check that fallocate supports range zeroing inside the file
3821 fallocate_zero_range=no
3822 cat > $TMPC << EOF
3823 #include <fcntl.h>
3824 #include <linux/falloc.h>
3826 int main(void)
3828 fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0);
3829 return 0;
3832 if compile_prog "" "" ; then
3833 fallocate_zero_range=yes
3836 # check for posix_fallocate
3837 posix_fallocate=no
3838 cat > $TMPC << EOF
3839 #include <fcntl.h>
3841 int main(void)
3843 posix_fallocate(0, 0, 0);
3844 return 0;
3847 if compile_prog "" "" ; then
3848 posix_fallocate=yes
3851 # check for sync_file_range
3852 sync_file_range=no
3853 cat > $TMPC << EOF
3854 #include <fcntl.h>
3856 int main(void)
3858 sync_file_range(0, 0, 0, 0);
3859 return 0;
3862 if compile_prog "" "" ; then
3863 sync_file_range=yes
3866 # check for linux/fiemap.h and FS_IOC_FIEMAP
3867 fiemap=no
3868 cat > $TMPC << EOF
3869 #include <sys/ioctl.h>
3870 #include <linux/fs.h>
3871 #include <linux/fiemap.h>
3873 int main(void)
3875 ioctl(0, FS_IOC_FIEMAP, 0);
3876 return 0;
3879 if compile_prog "" "" ; then
3880 fiemap=yes
3883 # check for dup3
3884 dup3=no
3885 cat > $TMPC << EOF
3886 #include <unistd.h>
3888 int main(void)
3890 dup3(0, 0, 0);
3891 return 0;
3894 if compile_prog "" "" ; then
3895 dup3=yes
3898 # check for ppoll support
3899 ppoll=no
3900 cat > $TMPC << EOF
3901 #include <poll.h>
3903 int main(void)
3905 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
3906 ppoll(&pfd, 1, 0, 0);
3907 return 0;
3910 if compile_prog "" "" ; then
3911 ppoll=yes
3914 # check for prctl(PR_SET_TIMERSLACK , ... ) support
3915 prctl_pr_set_timerslack=no
3916 cat > $TMPC << EOF
3917 #include <sys/prctl.h>
3919 int main(void)
3921 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
3922 return 0;
3925 if compile_prog "" "" ; then
3926 prctl_pr_set_timerslack=yes
3929 # check for epoll support
3930 epoll=no
3931 cat > $TMPC << EOF
3932 #include <sys/epoll.h>
3934 int main(void)
3936 epoll_create(0);
3937 return 0;
3940 if compile_prog "" "" ; then
3941 epoll=yes
3944 # epoll_create1 is a later addition
3945 # so we must check separately for its presence
3946 epoll_create1=no
3947 cat > $TMPC << EOF
3948 #include <sys/epoll.h>
3950 int main(void)
3952 /* Note that we use epoll_create1 as a value, not as
3953 * a function being called. This is necessary so that on
3954 * old SPARC glibc versions where the function was present in
3955 * the library but not declared in the header file we will
3956 * fail the configure check. (Otherwise we will get a compiler
3957 * warning but not an error, and will proceed to fail the
3958 * qemu compile where we compile with -Werror.)
3960 return (int)(uintptr_t)&epoll_create1;
3963 if compile_prog "" "" ; then
3964 epoll_create1=yes
3967 # check for sendfile support
3968 sendfile=no
3969 cat > $TMPC << EOF
3970 #include <sys/sendfile.h>
3972 int main(void)
3974 return sendfile(0, 0, 0, 0);
3977 if compile_prog "" "" ; then
3978 sendfile=yes
3981 # check for timerfd support (glibc 2.8 and newer)
3982 timerfd=no
3983 cat > $TMPC << EOF
3984 #include <sys/timerfd.h>
3986 int main(void)
3988 return(timerfd_create(CLOCK_REALTIME, 0));
3991 if compile_prog "" "" ; then
3992 timerfd=yes
3995 # check for setns and unshare support
3996 setns=no
3997 cat > $TMPC << EOF
3998 #include <sched.h>
4000 int main(void)
4002 int ret;
4003 ret = setns(0, 0);
4004 ret = unshare(0);
4005 return ret;
4008 if compile_prog "" "" ; then
4009 setns=yes
4012 # clock_adjtime probe
4013 clock_adjtime=no
4014 cat > $TMPC <<EOF
4015 #include <time.h>
4017 int main(void)
4019 return clock_adjtime(0, 0);
4022 clock_adjtime=no
4023 if compile_prog "" "" ; then
4024 clock_adjtime=yes
4027 # syncfs probe
4028 syncfs=no
4029 cat > $TMPC <<EOF
4030 #include <unistd.h>
4032 int main(void)
4034 return syncfs(0);
4037 syncfs=no
4038 if compile_prog "" "" ; then
4039 syncfs=yes
4042 # Check if tools are available to build documentation.
4043 if test "$docs" != "no" ; then
4044 if has makeinfo && has pod2man; then
4045 docs=yes
4046 else
4047 if test "$docs" = "yes" ; then
4048 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
4050 docs=no
4054 if test "$want_tools" = ""; then
4055 if test $(expr "$target_list" : ".*softmmu.*") != 0; then
4056 want_tools=yes
4057 else
4058 want_tools=no
4062 # Search for bswap_32 function
4063 byteswap_h=no
4064 cat > $TMPC << EOF
4065 #include <byteswap.h>
4066 int main(void) { return bswap_32(0); }
4068 if compile_prog "" "" ; then
4069 byteswap_h=yes
4072 # Search for bswap32 function
4073 bswap_h=no
4074 cat > $TMPC << EOF
4075 #include <sys/endian.h>
4076 #include <sys/types.h>
4077 #include <machine/bswap.h>
4078 int main(void) { return bswap32(0); }
4080 if compile_prog "" "" ; then
4081 bswap_h=yes
4084 ##########################################
4085 # Do we have libiscsi >= 1.9.0
4086 if test "$libiscsi" != "no" ; then
4087 if $pkg_config --atleast-version=1.9.0 libiscsi; then
4088 libiscsi="yes"
4089 libiscsi_cflags=$($pkg_config --cflags libiscsi)
4090 libiscsi_libs=$($pkg_config --libs libiscsi)
4091 else
4092 if test "$libiscsi" = "yes" ; then
4093 feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
4095 libiscsi="no"
4099 ##########################################
4100 # Do we need libm
4101 cat > $TMPC << EOF
4102 #include <math.h>
4103 int main(int argc, char **argv) { return isnan(sin((double)argc)); }
4105 if compile_prog "" "" ; then
4107 elif compile_prog "" "-lm" ; then
4108 LIBS="-lm $LIBS"
4109 libs_qga="-lm $libs_qga"
4110 else
4111 error_exit "libm check failed"
4114 ##########################################
4115 # Do we need librt
4116 # uClibc provides 2 versions of clock_gettime(), one with realtime
4117 # support and one without. This means that the clock_gettime() don't
4118 # need -lrt. We still need it for timer_create() so we check for this
4119 # function in addition.
4120 cat > $TMPC <<EOF
4121 #include <signal.h>
4122 #include <time.h>
4123 int main(void) {
4124 timer_create(CLOCK_REALTIME, NULL, NULL);
4125 return clock_gettime(CLOCK_REALTIME, NULL);
4129 if compile_prog "" "" ; then
4131 # we need pthread for static linking. use previous pthread test result
4132 elif compile_prog "" "$pthread_lib -lrt" ; then
4133 LIBS="$LIBS -lrt"
4134 libs_qga="$libs_qga -lrt"
4137 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
4138 "$aix" != "yes" -a "$haiku" != "yes" ; then
4139 libs_softmmu="-lutil $libs_softmmu"
4142 ##########################################
4143 # spice probe
4144 if test "$spice" != "no" ; then
4145 cat > $TMPC << EOF
4146 #include <spice.h>
4147 int main(void) { spice_server_new(); return 0; }
4149 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
4150 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
4151 if $pkg_config --atleast-version=0.12.0 spice-server && \
4152 $pkg_config --atleast-version=0.12.3 spice-protocol && \
4153 compile_prog "$spice_cflags" "$spice_libs" ; then
4154 spice="yes"
4155 libs_softmmu="$libs_softmmu $spice_libs"
4156 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
4157 spice_protocol_version=$($pkg_config --modversion spice-protocol)
4158 spice_server_version=$($pkg_config --modversion spice-server)
4159 else
4160 if test "$spice" = "yes" ; then
4161 feature_not_found "spice" \
4162 "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel"
4164 spice="no"
4168 # check for smartcard support
4169 smartcard_cflags=""
4170 if test "$smartcard" != "no"; then
4171 if $pkg_config libcacard; then
4172 libcacard_cflags=$($pkg_config --cflags libcacard)
4173 libcacard_libs=$($pkg_config --libs libcacard)
4174 QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
4175 libs_softmmu="$libs_softmmu $libcacard_libs"
4176 smartcard="yes"
4177 else
4178 if test "$smartcard" = "yes"; then
4179 feature_not_found "smartcard" "Install libcacard devel"
4181 smartcard="no"
4185 # check for libusb
4186 if test "$libusb" != "no" ; then
4187 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
4188 libusb="yes"
4189 libusb_cflags=$($pkg_config --cflags libusb-1.0)
4190 libusb_libs=$($pkg_config --libs libusb-1.0)
4191 QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
4192 libs_softmmu="$libs_softmmu $libusb_libs"
4193 else
4194 if test "$libusb" = "yes"; then
4195 feature_not_found "libusb" "Install libusb devel >= 1.0.13"
4197 libusb="no"
4201 # check for usbredirparser for usb network redirection support
4202 if test "$usb_redir" != "no" ; then
4203 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
4204 usb_redir="yes"
4205 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
4206 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
4207 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
4208 libs_softmmu="$libs_softmmu $usb_redir_libs"
4209 else
4210 if test "$usb_redir" = "yes"; then
4211 feature_not_found "usb-redir" "Install usbredir devel"
4213 usb_redir="no"
4217 ##########################################
4218 # check if we have VSS SDK headers for win
4220 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
4221 case "$vss_win32_sdk" in
4222 "") vss_win32_include="-isystem $source_path" ;;
4223 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
4224 # handle path with spaces. So we symlink the headers into ".sdk/vss".
4225 vss_win32_include="-isystem $source_path/.sdk/vss"
4226 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
4228 *) vss_win32_include="-isystem $vss_win32_sdk"
4229 esac
4230 cat > $TMPC << EOF
4231 #define __MIDL_user_allocate_free_DEFINED__
4232 #include <inc/win2003/vss.h>
4233 int main(void) { return VSS_CTX_BACKUP; }
4235 if compile_prog "$vss_win32_include" "" ; then
4236 guest_agent_with_vss="yes"
4237 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
4238 libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
4239 qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
4240 else
4241 if test "$vss_win32_sdk" != "" ; then
4242 echo "ERROR: Please download and install Microsoft VSS SDK:"
4243 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
4244 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
4245 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
4246 echo "ERROR: The headers are extracted in the directory \`inc'."
4247 feature_not_found "VSS support"
4249 guest_agent_with_vss="no"
4253 ##########################################
4254 # lookup Windows platform SDK (if not specified)
4255 # The SDK is needed only to build .tlb (type library) file of guest agent
4256 # VSS provider from the source. It is usually unnecessary because the
4257 # pre-compiled .tlb file is included.
4259 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
4260 if test -z "$win_sdk"; then
4261 programfiles="$PROGRAMFILES"
4262 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
4263 if test -n "$programfiles"; then
4264 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
4265 else
4266 feature_not_found "Windows SDK"
4268 elif test "$win_sdk" = "no"; then
4269 win_sdk=""
4273 ##########################################
4274 # check if mingw environment provides a recent ntddscsi.h
4275 if test "$mingw32" = "yes" -a "$guest_agent" != "no"; then
4276 cat > $TMPC << EOF
4277 #include <windows.h>
4278 #include <ntddscsi.h>
4279 int main(void) {
4280 #if !defined(IOCTL_SCSI_GET_ADDRESS)
4281 #error Missing required ioctl definitions
4282 #endif
4283 SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
4284 return addr.Lun;
4287 if compile_prog "" "" ; then
4288 guest_agent_ntddscsi=yes
4289 libs_qga="-lsetupapi $libs_qga"
4293 ##########################################
4294 # virgl renderer probe
4296 if test "$virglrenderer" != "no" ; then
4297 cat > $TMPC << EOF
4298 #include <virglrenderer.h>
4299 int main(void) { virgl_renderer_poll(); return 0; }
4301 virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null)
4302 virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null)
4303 if $pkg_config virglrenderer >/dev/null 2>&1 && \
4304 compile_prog "$virgl_cflags" "$virgl_libs" ; then
4305 virglrenderer="yes"
4306 else
4307 if test "$virglrenderer" = "yes" ; then
4308 feature_not_found "virglrenderer"
4310 virglrenderer="no"
4314 ##########################################
4315 # check if we have fdatasync
4317 fdatasync=no
4318 cat > $TMPC << EOF
4319 #include <unistd.h>
4320 int main(void) {
4321 #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
4322 return fdatasync(0);
4323 #else
4324 #error Not supported
4325 #endif
4328 if compile_prog "" "" ; then
4329 fdatasync=yes
4332 ##########################################
4333 # check if we have madvise
4335 madvise=no
4336 cat > $TMPC << EOF
4337 #include <sys/types.h>
4338 #include <sys/mman.h>
4339 #include <stddef.h>
4340 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
4342 if compile_prog "" "" ; then
4343 madvise=yes
4346 ##########################################
4347 # check if we have posix_madvise
4349 posix_madvise=no
4350 cat > $TMPC << EOF
4351 #include <sys/mman.h>
4352 #include <stddef.h>
4353 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
4355 if compile_prog "" "" ; then
4356 posix_madvise=yes
4359 ##########################################
4360 # check if we have posix_syslog
4362 posix_syslog=no
4363 cat > $TMPC << EOF
4364 #include <syslog.h>
4365 int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; }
4367 if compile_prog "" "" ; then
4368 posix_syslog=yes
4371 ##########################################
4372 # check if trace backend exists
4374 $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
4375 if test "$?" -ne 0 ; then
4376 error_exit "invalid trace backends" \
4377 "Please choose supported trace backends."
4380 ##########################################
4381 # For 'ust' backend, test if ust headers are present
4382 if have_backend "ust"; then
4383 cat > $TMPC << EOF
4384 #include <lttng/tracepoint.h>
4385 int main(void) { return 0; }
4387 if compile_prog "" "-Wl,--no-as-needed -ldl" ; then
4388 if $pkg_config lttng-ust --exists; then
4389 lttng_ust_libs=$($pkg_config --libs lttng-ust)
4390 else
4391 lttng_ust_libs="-llttng-ust -ldl"
4393 if $pkg_config liburcu-bp --exists; then
4394 urcu_bp_libs=$($pkg_config --libs liburcu-bp)
4395 else
4396 urcu_bp_libs="-lurcu-bp"
4399 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
4400 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
4401 else
4402 error_exit "Trace backend 'ust' missing lttng-ust header files"
4406 ##########################################
4407 # For 'dtrace' backend, test if 'dtrace' command is present
4408 if have_backend "dtrace"; then
4409 if ! has 'dtrace' ; then
4410 error_exit "dtrace command is not found in PATH $PATH"
4412 trace_backend_stap="no"
4413 if has 'stap' ; then
4414 trace_backend_stap="yes"
4418 ##########################################
4419 # check and set a backend for coroutine
4421 # We prefer ucontext, but it's not always possible. The fallback
4422 # is sigcontext. gthread is not selectable except explicitly, because
4423 # it is not functional enough to run QEMU proper. (It is occasionally
4424 # useful for debugging purposes.) On Windows the only valid backend
4425 # is the Windows-specific one.
4427 ucontext_works=no
4428 if test "$darwin" != "yes"; then
4429 cat > $TMPC << EOF
4430 #include <ucontext.h>
4431 #ifdef __stub_makecontext
4432 #error Ignoring glibc stub makecontext which will always fail
4433 #endif
4434 int main(void) { makecontext(0, 0, 0); return 0; }
4436 if compile_prog "" "" ; then
4437 ucontext_works=yes
4441 if test "$coroutine" = ""; then
4442 if test "$mingw32" = "yes"; then
4443 coroutine=win32
4444 elif test "$ucontext_works" = "yes"; then
4445 coroutine=ucontext
4446 else
4447 coroutine=sigaltstack
4449 else
4450 case $coroutine in
4451 windows)
4452 if test "$mingw32" != "yes"; then
4453 error_exit "'windows' coroutine backend only valid for Windows"
4455 # Unfortunately the user visible backend name doesn't match the
4456 # coroutine-*.c filename for this case, so we have to adjust it here.
4457 coroutine=win32
4459 ucontext)
4460 if test "$ucontext_works" != "yes"; then
4461 feature_not_found "ucontext"
4464 gthread|sigaltstack)
4465 if test "$mingw32" = "yes"; then
4466 error_exit "only the 'windows' coroutine backend is valid for Windows"
4470 error_exit "unknown coroutine backend $coroutine"
4472 esac
4475 if test "$coroutine_pool" = ""; then
4476 if test "$coroutine" = "gthread" -o "$coroutine" = "win32"; then
4477 coroutine_pool=no
4478 else
4479 coroutine_pool=yes
4482 if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
4483 error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
4486 if test "$debug_stack_usage" = "yes"; then
4487 if test "$cpu" = "ia64" -o "$cpu" = "hppa"; then
4488 error_exit "stack usage debugging is not supported for $cpu"
4490 if test "$coroutine_pool" = "yes"; then
4491 echo "WARN: disabling coroutine pool for stack usage debugging"
4492 coroutine_pool=no
4497 ##########################################
4498 # check if we have open_by_handle_at
4500 open_by_handle_at=no
4501 cat > $TMPC << EOF
4502 #include <fcntl.h>
4503 #if !defined(AT_EMPTY_PATH)
4504 # error missing definition
4505 #else
4506 int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
4507 #endif
4509 if compile_prog "" "" ; then
4510 open_by_handle_at=yes
4513 ########################################
4514 # check if we have linux/magic.h
4516 linux_magic_h=no
4517 cat > $TMPC << EOF
4518 #include <linux/magic.h>
4519 int main(void) {
4520 return 0;
4523 if compile_prog "" "" ; then
4524 linux_magic_h=yes
4527 ########################################
4528 # check whether we can disable warning option with a pragma (this is needed
4529 # to silence warnings in the headers of some versions of external libraries).
4530 # This test has to be compiled with -Werror as otherwise an unknown pragma is
4531 # only a warning.
4533 # If we can't selectively disable warning in the code, disable -Werror so that
4534 # the build doesn't fail anyway.
4536 pragma_disable_unused_but_set=no
4537 cat > $TMPC << EOF
4538 #pragma GCC diagnostic push
4539 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
4540 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
4541 #pragma GCC diagnostic pop
4543 int main(void) {
4544 return 0;
4547 if compile_prog "-Werror" "" ; then
4548 pragma_diagnostic_available=yes
4551 ########################################
4552 # check if we have valgrind/valgrind.h
4554 valgrind_h=no
4555 cat > $TMPC << EOF
4556 #include <valgrind/valgrind.h>
4557 int main(void) {
4558 return 0;
4561 if compile_prog "" "" ; then
4562 valgrind_h=yes
4565 ########################################
4566 # check if environ is declared
4568 has_environ=no
4569 cat > $TMPC << EOF
4570 #include <unistd.h>
4571 int main(void) {
4572 environ = 0;
4573 return 0;
4576 if compile_prog "" "" ; then
4577 has_environ=yes
4580 ########################################
4581 # check if cpuid.h is usable.
4583 cpuid_h=no
4584 cat > $TMPC << EOF
4585 #include <cpuid.h>
4586 int main(void) {
4587 unsigned a, b, c, d;
4588 int max = __get_cpuid_max(0, 0);
4590 if (max >= 1) {
4591 __cpuid(1, a, b, c, d);
4594 if (max >= 7) {
4595 __cpuid_count(7, 0, a, b, c, d);
4598 return 0;
4601 if compile_prog "" "" ; then
4602 cpuid_h=yes
4605 ########################################
4606 # check if __[u]int128_t is usable.
4608 int128=no
4609 cat > $TMPC << EOF
4610 #if defined(__clang_major__) && defined(__clang_minor__)
4611 # if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
4612 # error __int128_t does not work in CLANG before 3.2
4613 # endif
4614 #endif
4615 __int128_t a;
4616 __uint128_t b;
4617 int main (void) {
4618 a = a + b;
4619 b = a * b;
4620 a = a * a;
4621 return 0;
4624 if compile_prog "" "" ; then
4625 int128=yes
4628 #########################################
4629 # See if 128-bit atomic operations are supported.
4631 atomic128=no
4632 if test "$int128" = "yes"; then
4633 cat > $TMPC << EOF
4634 int main(void)
4636 unsigned __int128 x = 0, y = 0;
4637 y = __atomic_load_16(&x, 0);
4638 __atomic_store_16(&x, y, 0);
4639 __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0);
4640 return 0;
4643 if compile_prog "" "" ; then
4644 atomic128=yes
4648 #########################################
4649 # See if 64-bit atomic operations are supported.
4650 # Note that without __atomic builtins, we can only
4651 # assume atomic loads/stores max at pointer size.
4653 cat > $TMPC << EOF
4654 #include <stdint.h>
4655 int main(void)
4657 uint64_t x = 0, y = 0;
4658 #ifdef __ATOMIC_RELAXED
4659 y = __atomic_load_8(&x, 0);
4660 __atomic_store_8(&x, y, 0);
4661 __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
4662 __atomic_exchange_8(&x, y, 0);
4663 __atomic_fetch_add_8(&x, y, 0);
4664 #else
4665 typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
4666 __sync_lock_test_and_set(&x, y);
4667 __sync_val_compare_and_swap(&x, y, 0);
4668 __sync_fetch_and_add(&x, y);
4669 #endif
4670 return 0;
4673 if compile_prog "" "" ; then
4674 atomic64=yes
4677 ########################################
4678 # check if getauxval is available.
4680 getauxval=no
4681 cat > $TMPC << EOF
4682 #include <sys/auxv.h>
4683 int main(void) {
4684 return getauxval(AT_HWCAP) == 0;
4687 if compile_prog "" "" ; then
4688 getauxval=yes
4691 ########################################
4692 # check if ccache is interfering with
4693 # semantic analysis of macros
4695 unset CCACHE_CPP2
4696 ccache_cpp2=no
4697 cat > $TMPC << EOF
4698 static const int Z = 1;
4699 #define fn() ({ Z; })
4700 #define TAUT(X) ((X) == Z)
4701 #define PAREN(X, Y) (X == Y)
4702 #define ID(X) (X)
4703 int main(int argc, char *argv[])
4705 int x = 0, y = 0;
4706 x = ID(x);
4707 x = fn();
4708 fn();
4709 if (PAREN(x, y)) return 0;
4710 if (TAUT(Z)) return 0;
4711 return 0;
4715 if ! compile_object "-Werror"; then
4716 ccache_cpp2=yes
4719 #################################################
4720 # clang does not support glibc + FORTIFY_SOURCE.
4722 if test "$fortify_source" != "no"; then
4723 if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
4724 fortify_source="no";
4725 elif test -n "$cxx" &&
4726 echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then
4727 fortify_source="no";
4728 else
4729 fortify_source="yes"
4733 ##########################################
4734 # check if struct fsxattr is available via linux/fs.h
4736 have_fsxattr=no
4737 cat > $TMPC << EOF
4738 #include <linux/fs.h>
4739 struct fsxattr foo;
4740 int main(void) {
4741 return 0;
4744 if compile_prog "" "" ; then
4745 have_fsxattr=yes
4748 ##########################################
4749 # check if rtnetlink.h exists and is useful
4750 have_rtnetlink=no
4751 cat > $TMPC << EOF
4752 #include <linux/rtnetlink.h>
4753 int main(void) {
4754 return IFLA_PROTO_DOWN;
4757 if compile_prog "" "" ; then
4758 have_rtnetlink=yes
4761 ##########################################
4762 # check for usable AF_VSOCK environment
4763 have_af_vsock=no
4764 cat > $TMPC << EOF
4765 #include <errno.h>
4766 #include <sys/types.h>
4767 #include <sys/socket.h>
4768 #if !defined(AF_VSOCK)
4769 # error missing AF_VSOCK flag
4770 #endif
4771 #include <linux/vm_sockets.h>
4772 int main(void) {
4773 int sock, ret;
4774 struct sockaddr_vm svm;
4775 socklen_t len = sizeof(svm);
4776 sock = socket(AF_VSOCK, SOCK_STREAM, 0);
4777 ret = getpeername(sock, (struct sockaddr *)&svm, &len);
4778 if ((ret == -1) && (errno == ENOTCONN)) {
4779 return 0;
4781 return -1;
4784 if compile_prog "" "" ; then
4785 have_af_vsock=yes
4788 #################################################
4789 # Sparc implicitly links with --relax, which is
4790 # incompatible with -r, so --no-relax should be
4791 # given. It does no harm to give it on other
4792 # platforms too.
4794 # Note: the prototype is needed since QEMU_CFLAGS
4795 # contains -Wmissing-prototypes
4796 cat > $TMPC << EOF
4797 extern int foo(void);
4798 int foo(void) { return 0; }
4800 if ! compile_object ""; then
4801 error_exit "Failed to compile object file for LD_REL_FLAGS test"
4803 for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do
4804 if do_cc -nostdlib $i -o $TMPMO $TMPO; then
4805 LD_REL_FLAGS=$i
4806 break
4808 done
4809 if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then
4810 feature_not_found "modules" "Cannot find how to build relocatable objects"
4813 ##########################################
4814 # check for sysmacros.h
4816 have_sysmacros=no
4817 cat > $TMPC << EOF
4818 #include <sys/sysmacros.h>
4819 int main(void) {
4820 return makedev(0, 0);
4823 if compile_prog "" "" ; then
4824 have_sysmacros=yes
4827 ##########################################
4828 # End of CC checks
4829 # After here, no more $cc or $ld runs
4831 if test "$gcov" = "yes" ; then
4832 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
4833 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
4834 elif test "$fortify_source" = "yes" ; then
4835 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
4836 elif test "$debug" = "no"; then
4837 CFLAGS="-O2 $CFLAGS"
4840 ##########################################
4841 # Do we have libnfs
4842 if test "$libnfs" != "no" ; then
4843 if $pkg_config --atleast-version=1.9.3 libnfs; then
4844 libnfs="yes"
4845 libnfs_libs=$($pkg_config --libs libnfs)
4846 else
4847 if test "$libnfs" = "yes" ; then
4848 feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
4850 libnfs="no"
4854 # Now we've finished running tests it's OK to add -Werror to the compiler flags
4855 if test "$werror" = "yes"; then
4856 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
4859 if test "$solaris" = "no" ; then
4860 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
4861 LDFLAGS="-Wl,--warn-common $LDFLAGS"
4865 # test if pod2man has --utf8 option
4866 if pod2man --help | grep -q utf8; then
4867 POD2MAN="pod2man --utf8"
4868 else
4869 POD2MAN="pod2man"
4872 # Use large addresses, ASLR, no-SEH and DEP if available.
4873 if test "$mingw32" = "yes" ; then
4874 if test "$cpu" = i386; then
4875 LDFLAGS="-Wl,--large-address-aware $LDFLAGS"
4877 for flag in --dynamicbase --no-seh --nxcompat; do
4878 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
4879 LDFLAGS="-Wl,$flag $LDFLAGS"
4881 done
4884 qemu_confdir=$sysconfdir$confsuffix
4885 qemu_moddir=$libdir$confsuffix
4886 qemu_datadir=$datadir$confsuffix
4887 qemu_localedir="$datadir/locale"
4889 tools=""
4890 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
4891 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
4892 tools="qemu-nbd\$(EXESUF) $tools"
4893 tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools"
4895 if test "$softmmu" = yes ; then
4896 if test "$virtfs" != no ; then
4897 if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
4898 virtfs=yes
4899 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
4900 else
4901 if test "$virtfs" = yes; then
4902 error_exit "VirtFS is supported only on Linux and requires libcap devel and libattr devel"
4904 virtfs=no
4909 # Probe for guest agent support/options
4911 if [ "$guest_agent" != "no" ]; then
4912 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
4913 tools="qemu-ga $tools"
4914 guest_agent=yes
4915 elif [ "$guest_agent" != yes ]; then
4916 guest_agent=no
4917 else
4918 error_exit "Guest agent is not supported on this platform"
4922 # Guest agent Window MSI package
4924 if test "$guest_agent" != yes; then
4925 if test "$guest_agent_msi" = yes; then
4926 error_exit "MSI guest agent package requires guest agent enabled"
4928 guest_agent_msi=no
4929 elif test "$mingw32" != "yes"; then
4930 if test "$guest_agent_msi" = "yes"; then
4931 error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation"
4933 guest_agent_msi=no
4934 elif ! has wixl; then
4935 if test "$guest_agent_msi" = "yes"; then
4936 error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )"
4938 guest_agent_msi=no
4939 else
4940 # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't
4941 # disabled explicitly
4942 if test "$guest_agent_msi" != "no"; then
4943 guest_agent_msi=yes
4947 if test "$guest_agent_msi" = "yes"; then
4948 if test "$guest_agent_with_vss" = "yes"; then
4949 QEMU_GA_MSI_WITH_VSS="-D InstallVss"
4952 if test "$QEMU_GA_MANUFACTURER" = ""; then
4953 QEMU_GA_MANUFACTURER=QEMU
4956 if test "$QEMU_GA_DISTRO" = ""; then
4957 QEMU_GA_DISTRO=Linux
4960 if test "$QEMU_GA_VERSION" = ""; then
4961 QEMU_GA_VERSION=$(cat $source_path/VERSION)
4964 QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin"
4966 case "$cpu" in
4967 x86_64)
4968 QEMU_GA_MSI_ARCH="-a x64 -D Arch=64"
4970 i386)
4971 QEMU_GA_MSI_ARCH="-D Arch=32"
4974 error_exit "CPU $cpu not supported for building installation package"
4976 esac
4979 # Mac OS X ships with a broken assembler
4980 roms=
4981 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
4982 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
4983 "$softmmu" = yes ; then
4984 # Different host OS linkers have different ideas about the name of the ELF
4985 # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd
4986 # variant; and Windows uses i386pe.
4987 for emu in elf_i386 elf_i386_fbsd i386pe; do
4988 if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
4989 ld_i386_emulation="$emu"
4990 roms="optionrom"
4991 break
4993 done
4995 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
4996 roms="$roms spapr-rtas"
4999 if test "$cpu" = "s390x" ; then
5000 roms="$roms s390-ccw"
5003 # Probe for the need for relocating the user-only binary.
5004 if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
5005 textseg_addr=
5006 case "$cpu" in
5007 arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
5008 # ??? Rationale for choosing this address
5009 textseg_addr=0x60000000
5011 mips)
5012 # A 256M aligned address, high in the address space, with enough
5013 # room for the code_gen_buffer above it before the stack.
5014 textseg_addr=0x60000000
5016 esac
5017 if [ -n "$textseg_addr" ]; then
5018 cat > $TMPC <<EOF
5019 int main(void) { return 0; }
5021 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
5022 if ! compile_prog "" "$textseg_ldflags"; then
5023 # In case ld does not support -Ttext-segment, edit the default linker
5024 # script via sed to set the .text start addr. This is needed on FreeBSD
5025 # at least.
5026 if ! $ld --verbose >/dev/null 2>&1; then
5027 error_exit \
5028 "We need to link the QEMU user mode binaries at a" \
5029 "specific text address. Unfortunately your linker" \
5030 "doesn't support either the -Ttext-segment option or" \
5031 "printing the default linker script with --verbose." \
5032 "If you don't want the user mode binaries, pass the" \
5033 "--disable-user option to configure."
5036 $ld --verbose | sed \
5037 -e '1,/==================================================/d' \
5038 -e '/==================================================/,$d' \
5039 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
5040 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
5041 textseg_ldflags="-Wl,-T../config-host.ld"
5046 echo_version() {
5047 if test "$1" = "yes" ; then
5048 echo "($2)"
5052 # prepend pixman and ftd flags after all config tests are done
5053 QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
5054 libs_softmmu="$pixman_libs $libs_softmmu"
5056 echo "Install prefix $prefix"
5057 echo "BIOS directory $(eval echo $qemu_datadir)"
5058 echo "binary directory $(eval echo $bindir)"
5059 echo "library directory $(eval echo $libdir)"
5060 echo "module directory $(eval echo $qemu_moddir)"
5061 echo "libexec directory $(eval echo $libexecdir)"
5062 echo "include directory $(eval echo $includedir)"
5063 echo "config directory $(eval echo $sysconfdir)"
5064 if test "$mingw32" = "no" ; then
5065 echo "local state directory $(eval echo $local_statedir)"
5066 echo "Manual directory $(eval echo $mandir)"
5067 echo "ELF interp prefix $interp_prefix"
5068 else
5069 echo "local state directory queried at runtime"
5070 echo "Windows SDK $win_sdk"
5072 echo "Source path $source_path"
5073 echo "C compiler $cc"
5074 echo "Host C compiler $host_cc"
5075 echo "C++ compiler $cxx"
5076 echo "Objective-C compiler $objcc"
5077 echo "ARFLAGS $ARFLAGS"
5078 echo "CFLAGS $CFLAGS"
5079 echo "QEMU_CFLAGS $QEMU_CFLAGS"
5080 echo "LDFLAGS $LDFLAGS"
5081 echo "make $make"
5082 echo "install $install"
5083 echo "python $python"
5084 if test "$slirp" = "yes" ; then
5085 echo "smbd $smbd"
5087 echo "module support $modules"
5088 echo "host CPU $cpu"
5089 echo "host big endian $bigendian"
5090 echo "target list $target_list"
5091 echo "tcg debug enabled $debug_tcg"
5092 echo "gprof enabled $gprof"
5093 echo "sparse enabled $sparse"
5094 echo "strip binaries $strip_opt"
5095 echo "profiler $profiler"
5096 echo "static build $static"
5097 if test "$darwin" = "yes" ; then
5098 echo "Cocoa support $cocoa"
5100 echo "pixman $pixman"
5101 echo "SDL support $sdl $(echo_version $sdl $sdlversion)"
5102 echo "GTK support $gtk $(echo_version $gtk $gtk_version)"
5103 echo "GTK GL support $gtk_gl"
5104 echo "VTE support $vte $(echo_version $vte $vteversion)"
5105 echo "TLS priority $tls_priority"
5106 echo "GNUTLS support $gnutls"
5107 echo "GNUTLS rnd $gnutls_rnd"
5108 if test "$gcrypt" = "yes"; then
5109 echo "encryption libgcrypt"
5110 echo "libgcrypt kdf $gcrypt_kdf"
5111 elif test "$nettle" = "yes"; then
5112 echo "nettle $nettle $(echo_version $nettle $nettle_version)"
5113 else
5114 echo "encryption none"
5116 echo "nettle kdf $nettle_kdf"
5117 echo "libtasn1 $tasn1"
5118 echo "curses support $curses"
5119 echo "virgl support $virglrenderer"
5120 echo "curl support $curl"
5121 echo "mingw32 support $mingw32"
5122 echo "Audio drivers $audio_drv_list"
5123 echo "Block whitelist (rw) $block_drv_rw_whitelist"
5124 echo "Block whitelist (ro) $block_drv_ro_whitelist"
5125 echo "VirtFS support $virtfs"
5126 echo "VNC support $vnc"
5127 if test "$vnc" = "yes" ; then
5128 echo "VNC SASL support $vnc_sasl"
5129 echo "VNC JPEG support $vnc_jpeg"
5130 echo "VNC PNG support $vnc_png"
5132 if test -n "$sparc_cpu"; then
5133 echo "Target Sparc Arch $sparc_cpu"
5135 echo "xen support $xen"
5136 if test "$xen" = "yes" ; then
5137 echo "xen ctrl version $xen_ctrl_version"
5138 echo "pv dom build $xen_pv_domain_build"
5140 echo "brlapi support $brlapi"
5141 echo "bluez support $bluez"
5142 echo "Documentation $docs"
5143 echo "Tools $tools"
5144 echo "PIE $pie"
5145 echo "vde support $vde"
5146 echo "netmap support $netmap"
5147 echo "Linux AIO support $linux_aio"
5148 echo "(X)ATTR support $attr"
5149 echo "Install blobs $blobs"
5150 echo "KVM support $kvm"
5151 echo "HAX support $hax"
5152 echo "RDMA support $rdma"
5153 echo "TCG interpreter $tcg_interpreter"
5154 echo "fdt support $fdt"
5155 echo "preadv support $preadv"
5156 echo "fdatasync $fdatasync"
5157 echo "madvise $madvise"
5158 echo "posix_madvise $posix_madvise"
5159 echo "libcap-ng support $cap_ng"
5160 echo "vhost-net support $vhost_net"
5161 echo "vhost-scsi support $vhost_scsi"
5162 echo "vhost-vsock support $vhost_vsock"
5163 echo "Trace backends $trace_backends"
5164 if have_backend "simple"; then
5165 echo "Trace output file $trace_file-<pid>"
5167 echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)"
5168 echo "rbd support $rbd"
5169 echo "xfsctl support $xfs"
5170 echo "smartcard support $smartcard"
5171 echo "libusb $libusb"
5172 echo "usb net redir $usb_redir"
5173 echo "OpenGL support $opengl"
5174 echo "OpenGL dmabufs $opengl_dmabuf"
5175 echo "libiscsi support $libiscsi"
5176 echo "libnfs support $libnfs"
5177 echo "build guest agent $guest_agent"
5178 echo "QGA VSS support $guest_agent_with_vss"
5179 echo "QGA w32 disk info $guest_agent_ntddscsi"
5180 echo "QGA MSI support $guest_agent_msi"
5181 echo "seccomp support $seccomp"
5182 echo "coroutine backend $coroutine"
5183 echo "coroutine pool $coroutine_pool"
5184 echo "debug stack usage $debug_stack_usage"
5185 echo "GlusterFS support $glusterfs"
5186 echo "gcov $gcov_tool"
5187 echo "gcov enabled $gcov"
5188 echo "TPM support $tpm"
5189 echo "libssh2 support $libssh2"
5190 echo "TPM passthrough $tpm_passthrough"
5191 echo "QOM debugging $qom_cast_debug"
5192 echo "lzo support $lzo"
5193 echo "snappy support $snappy"
5194 echo "bzip2 support $bzip2"
5195 echo "NUMA host support $numa"
5196 echo "tcmalloc support $tcmalloc"
5197 echo "jemalloc support $jemalloc"
5198 echo "avx2 optimization $avx2_opt"
5199 echo "replication support $replication"
5201 if test "$sdl_too_old" = "yes"; then
5202 echo "-> Your SDL version is too old - please upgrade to have SDL support"
5205 if test "$supported_cpu" = "no"; then
5206 echo
5207 echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
5208 echo
5209 echo "CPU host architecture $cpu support is not currently maintained."
5210 echo "The QEMU project intends to remove support for this host CPU in"
5211 echo "a future release if nobody volunteers to maintain it and to"
5212 echo "provide a build host for our continuous integration setup."
5213 echo "configure has succeeded and you can continue to build, but"
5214 echo "if you care about QEMU on this platform you should contact"
5215 echo "us upstream at qemu-devel@nongnu.org."
5218 if test "$supported_os" = "no"; then
5219 echo
5220 echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!"
5221 echo
5222 echo "Host OS $targetos support is not currently maintained."
5223 echo "The QEMU project intends to remove support for this host OS in"
5224 echo "a future release if nobody volunteers to maintain it and to"
5225 echo "provide a build host for our continuous integration setup."
5226 echo "configure has succeeded and you can continue to build, but"
5227 echo "if you care about QEMU on this platform you should contact"
5228 echo "us upstream at qemu-devel@nongnu.org."
5231 config_host_mak="config-host.mak"
5233 echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
5235 echo "# Automatically generated by configure - do not modify" > $config_host_mak
5236 echo >> $config_host_mak
5238 echo all: >> $config_host_mak
5239 echo "prefix=$prefix" >> $config_host_mak
5240 echo "bindir=$bindir" >> $config_host_mak
5241 echo "libdir=$libdir" >> $config_host_mak
5242 echo "libexecdir=$libexecdir" >> $config_host_mak
5243 echo "includedir=$includedir" >> $config_host_mak
5244 echo "mandir=$mandir" >> $config_host_mak
5245 echo "sysconfdir=$sysconfdir" >> $config_host_mak
5246 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
5247 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
5248 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
5249 echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
5250 if test "$mingw32" = "no" ; then
5251 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
5253 echo "qemu_helperdir=$libexecdir" >> $config_host_mak
5254 echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
5255 echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
5256 echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
5257 echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
5259 echo "ARCH=$ARCH" >> $config_host_mak
5261 if test "$debug_tcg" = "yes" ; then
5262 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
5264 if test "$strip_opt" = "yes" ; then
5265 echo "STRIP=${strip}" >> $config_host_mak
5267 if test "$bigendian" = "yes" ; then
5268 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
5270 if test "$mingw32" = "yes" ; then
5271 echo "CONFIG_WIN32=y" >> $config_host_mak
5272 echo "CONFIG_INSTALLER=y" >> $config_host_mak
5273 rc_version=$(cat $source_path/VERSION)
5274 version_major=${rc_version%%.*}
5275 rc_version=${rc_version#*.}
5276 version_minor=${rc_version%%.*}
5277 rc_version=${rc_version#*.}
5278 version_subminor=${rc_version%%.*}
5279 version_micro=0
5280 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
5281 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
5282 if test "$guest_agent_with_vss" = "yes" ; then
5283 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
5284 echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak
5285 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
5287 if test "$guest_agent_ntddscsi" = "yes" ; then
5288 echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak
5290 if test "$guest_agent_msi" = "yes"; then
5291 echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
5292 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
5293 echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
5294 echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
5295 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
5296 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
5297 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
5299 else
5300 echo "CONFIG_POSIX=y" >> $config_host_mak
5303 if test "$linux" = "yes" ; then
5304 echo "CONFIG_LINUX=y" >> $config_host_mak
5307 if test "$darwin" = "yes" ; then
5308 echo "CONFIG_DARWIN=y" >> $config_host_mak
5311 if test "$aix" = "yes" ; then
5312 echo "CONFIG_AIX=y" >> $config_host_mak
5315 if test "$solaris" = "yes" ; then
5316 echo "CONFIG_SOLARIS=y" >> $config_host_mak
5317 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
5318 if test "$needs_libsunmath" = "yes" ; then
5319 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
5322 if test "$haiku" = "yes" ; then
5323 echo "CONFIG_HAIKU=y" >> $config_host_mak
5325 if test "$static" = "yes" ; then
5326 echo "CONFIG_STATIC=y" >> $config_host_mak
5328 if test "$profiler" = "yes" ; then
5329 echo "CONFIG_PROFILER=y" >> $config_host_mak
5331 if test "$slirp" = "yes" ; then
5332 echo "CONFIG_SLIRP=y" >> $config_host_mak
5333 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
5335 if test "$vde" = "yes" ; then
5336 echo "CONFIG_VDE=y" >> $config_host_mak
5338 if test "$netmap" = "yes" ; then
5339 echo "CONFIG_NETMAP=y" >> $config_host_mak
5341 if test "$l2tpv3" = "yes" ; then
5342 echo "CONFIG_L2TPV3=y" >> $config_host_mak
5344 if test "$cap_ng" = "yes" ; then
5345 echo "CONFIG_LIBCAP=y" >> $config_host_mak
5347 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
5348 for drv in $audio_drv_list; do
5349 def=CONFIG_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
5350 echo "$def=y" >> $config_host_mak
5351 done
5352 if test "$audio_pt_int" = "yes" ; then
5353 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
5355 if test "$audio_win_int" = "yes" ; then
5356 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
5358 echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
5359 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
5360 if test "$vnc" = "yes" ; then
5361 echo "CONFIG_VNC=y" >> $config_host_mak
5363 if test "$vnc_sasl" = "yes" ; then
5364 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
5366 if test "$vnc_jpeg" = "yes" ; then
5367 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
5369 if test "$vnc_png" = "yes" ; then
5370 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
5372 if test "$fnmatch" = "yes" ; then
5373 echo "CONFIG_FNMATCH=y" >> $config_host_mak
5375 if test "$xfs" = "yes" ; then
5376 echo "CONFIG_XFS=y" >> $config_host_mak
5378 qemu_version=$(head $source_path/VERSION)
5379 echo "VERSION=$qemu_version" >>$config_host_mak
5380 echo "PKGVERSION=$pkgversion" >>$config_host_mak
5381 echo "SRC_PATH=$source_path" >> $config_host_mak
5382 echo "TARGET_DIRS=$target_list" >> $config_host_mak
5383 if [ "$docs" = "yes" ] ; then
5384 echo "BUILD_DOCS=yes" >> $config_host_mak
5386 if [ "$want_tools" = "yes" ] ; then
5387 echo "BUILD_TOOLS=yes" >> $config_host_mak
5389 if test "$modules" = "yes"; then
5390 # $shacmd can generate a hash started with digit, which the compiler doesn't
5391 # like as an symbol. So prefix it with an underscore
5392 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
5393 echo "CONFIG_MODULES=y" >> $config_host_mak
5395 if test "$sdl" = "yes" ; then
5396 echo "CONFIG_SDL=y" >> $config_host_mak
5397 echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
5398 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
5400 if test "$cocoa" = "yes" ; then
5401 echo "CONFIG_COCOA=y" >> $config_host_mak
5403 if test "$curses" = "yes" ; then
5404 echo "CONFIG_CURSES=y" >> $config_host_mak
5406 if test "$utimens" = "yes" ; then
5407 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
5409 if test "$pipe2" = "yes" ; then
5410 echo "CONFIG_PIPE2=y" >> $config_host_mak
5412 if test "$accept4" = "yes" ; then
5413 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
5415 if test "$splice" = "yes" ; then
5416 echo "CONFIG_SPLICE=y" >> $config_host_mak
5418 if test "$eventfd" = "yes" ; then
5419 echo "CONFIG_EVENTFD=y" >> $config_host_mak
5421 if test "$memfd" = "yes" ; then
5422 echo "CONFIG_MEMFD=y" >> $config_host_mak
5424 if test "$fallocate" = "yes" ; then
5425 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
5427 if test "$fallocate_punch_hole" = "yes" ; then
5428 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
5430 if test "$fallocate_zero_range" = "yes" ; then
5431 echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak
5433 if test "$posix_fallocate" = "yes" ; then
5434 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
5436 if test "$sync_file_range" = "yes" ; then
5437 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
5439 if test "$fiemap" = "yes" ; then
5440 echo "CONFIG_FIEMAP=y" >> $config_host_mak
5442 if test "$dup3" = "yes" ; then
5443 echo "CONFIG_DUP3=y" >> $config_host_mak
5445 if test "$ppoll" = "yes" ; then
5446 echo "CONFIG_PPOLL=y" >> $config_host_mak
5448 if test "$prctl_pr_set_timerslack" = "yes" ; then
5449 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
5451 if test "$epoll" = "yes" ; then
5452 echo "CONFIG_EPOLL=y" >> $config_host_mak
5454 if test "$epoll_create1" = "yes" ; then
5455 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
5457 if test "$sendfile" = "yes" ; then
5458 echo "CONFIG_SENDFILE=y" >> $config_host_mak
5460 if test "$timerfd" = "yes" ; then
5461 echo "CONFIG_TIMERFD=y" >> $config_host_mak
5463 if test "$setns" = "yes" ; then
5464 echo "CONFIG_SETNS=y" >> $config_host_mak
5466 if test "$clock_adjtime" = "yes" ; then
5467 echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak
5469 if test "$syncfs" = "yes" ; then
5470 echo "CONFIG_SYNCFS=y" >> $config_host_mak
5472 if test "$inotify" = "yes" ; then
5473 echo "CONFIG_INOTIFY=y" >> $config_host_mak
5475 if test "$inotify1" = "yes" ; then
5476 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
5478 if test "$byteswap_h" = "yes" ; then
5479 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
5481 if test "$bswap_h" = "yes" ; then
5482 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
5484 if test "$curl" = "yes" ; then
5485 echo "CONFIG_CURL=m" >> $config_host_mak
5486 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
5487 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
5489 if test "$brlapi" = "yes" ; then
5490 echo "CONFIG_BRLAPI=y" >> $config_host_mak
5492 if test "$bluez" = "yes" ; then
5493 echo "CONFIG_BLUEZ=y" >> $config_host_mak
5494 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
5496 if test "$glib_subprocess" = "yes" ; then
5497 echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak
5499 if test "$gtk" = "yes" ; then
5500 echo "CONFIG_GTK=y" >> $config_host_mak
5501 echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
5502 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
5503 echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
5504 if test "$gtk_gl" = "yes" ; then
5505 echo "CONFIG_GTK_GL=y" >> $config_host_mak
5508 echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
5509 if test "$gnutls" = "yes" ; then
5510 echo "CONFIG_GNUTLS=y" >> $config_host_mak
5512 if test "$gnutls_rnd" = "yes" ; then
5513 echo "CONFIG_GNUTLS_RND=y" >> $config_host_mak
5515 if test "$gcrypt" = "yes" ; then
5516 echo "CONFIG_GCRYPT=y" >> $config_host_mak
5517 if test "$gcrypt_hmac" = "yes" ; then
5518 echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak
5520 if test "$gcrypt_kdf" = "yes" ; then
5521 echo "CONFIG_GCRYPT_KDF=y" >> $config_host_mak
5524 if test "$nettle" = "yes" ; then
5525 echo "CONFIG_NETTLE=y" >> $config_host_mak
5526 echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak
5527 if test "$nettle_kdf" = "yes" ; then
5528 echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak
5531 if test "$tasn1" = "yes" ; then
5532 echo "CONFIG_TASN1=y" >> $config_host_mak
5534 if test "$have_ifaddrs_h" = "yes" ; then
5535 echo "HAVE_IFADDRS_H=y" >> $config_host_mak
5537 if test "$have_broken_size_max" = "yes" ; then
5538 echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
5541 # Work around a system header bug with some kernel/XFS header
5542 # versions where they both try to define 'struct fsxattr':
5543 # xfs headers will not try to redefine structs from linux headers
5544 # if this macro is set.
5545 if test "$have_fsxattr" = "yes" ; then
5546 echo "HAVE_FSXATTR=y" >> $config_host_mak
5548 if test "$vte" = "yes" ; then
5549 echo "CONFIG_VTE=y" >> $config_host_mak
5550 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
5552 if test "$virglrenderer" = "yes" ; then
5553 echo "CONFIG_VIRGL=y" >> $config_host_mak
5554 echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak
5555 echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak
5557 if test "$xen" = "yes" ; then
5558 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
5559 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
5560 if test "$xen_pv_domain_build" = "yes" ; then
5561 echo "CONFIG_XEN_PV_DOMAIN_BUILD=y" >> $config_host_mak
5564 if test "$linux_aio" = "yes" ; then
5565 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
5567 if test "$attr" = "yes" ; then
5568 echo "CONFIG_ATTR=y" >> $config_host_mak
5570 if test "$libattr" = "yes" ; then
5571 echo "CONFIG_LIBATTR=y" >> $config_host_mak
5573 if test "$virtfs" = "yes" ; then
5574 echo "CONFIG_VIRTFS=y" >> $config_host_mak
5576 if test "$vhost_scsi" = "yes" ; then
5577 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
5579 if test "$vhost_net" = "yes" ; then
5580 echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
5582 if test "$vhost_vsock" = "yes" ; then
5583 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
5585 if test "$blobs" = "yes" ; then
5586 echo "INSTALL_BLOBS=yes" >> $config_host_mak
5588 if test "$iovec" = "yes" ; then
5589 echo "CONFIG_IOVEC=y" >> $config_host_mak
5591 if test "$preadv" = "yes" ; then
5592 echo "CONFIG_PREADV=y" >> $config_host_mak
5594 if test "$fdt" = "yes" ; then
5595 echo "CONFIG_FDT=y" >> $config_host_mak
5597 if test "$signalfd" = "yes" ; then
5598 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
5600 if test "$tcg_interpreter" = "yes" ; then
5601 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
5603 if test "$fdatasync" = "yes" ; then
5604 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
5606 if test "$madvise" = "yes" ; then
5607 echo "CONFIG_MADVISE=y" >> $config_host_mak
5609 if test "$posix_madvise" = "yes" ; then
5610 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
5613 if test "$spice" = "yes" ; then
5614 echo "CONFIG_SPICE=y" >> $config_host_mak
5617 if test "$smartcard" = "yes" ; then
5618 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
5621 if test "$libusb" = "yes" ; then
5622 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
5625 if test "$usb_redir" = "yes" ; then
5626 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
5629 if test "$opengl" = "yes" ; then
5630 echo "CONFIG_OPENGL=y" >> $config_host_mak
5631 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
5632 if test "$opengl_dmabuf" = "yes" ; then
5633 echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
5637 if test "$avx2_opt" = "yes" ; then
5638 echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
5641 if test "$lzo" = "yes" ; then
5642 echo "CONFIG_LZO=y" >> $config_host_mak
5645 if test "$snappy" = "yes" ; then
5646 echo "CONFIG_SNAPPY=y" >> $config_host_mak
5649 if test "$bzip2" = "yes" ; then
5650 echo "CONFIG_BZIP2=y" >> $config_host_mak
5651 echo "BZIP2_LIBS=-lbz2" >> $config_host_mak
5654 if test "$libiscsi" = "yes" ; then
5655 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
5656 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
5657 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
5660 if test "$libnfs" = "yes" ; then
5661 echo "CONFIG_LIBNFS=m" >> $config_host_mak
5662 echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
5665 if test "$seccomp" = "yes"; then
5666 echo "CONFIG_SECCOMP=y" >> $config_host_mak
5669 # XXX: suppress that
5670 if [ "$bsd" = "yes" ] ; then
5671 echo "CONFIG_BSD=y" >> $config_host_mak
5674 if test "$localtime_r" = "yes" ; then
5675 echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
5677 if test "$qom_cast_debug" = "yes" ; then
5678 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
5680 if test "$rbd" = "yes" ; then
5681 echo "CONFIG_RBD=m" >> $config_host_mak
5682 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
5683 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
5686 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
5687 if test "$coroutine_pool" = "yes" ; then
5688 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
5689 else
5690 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
5693 if test "$debug_stack_usage" = "yes" ; then
5694 echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
5697 if test "$open_by_handle_at" = "yes" ; then
5698 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
5701 if test "$linux_magic_h" = "yes" ; then
5702 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
5705 if test "$pragma_diagnostic_available" = "yes" ; then
5706 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
5709 if test "$valgrind_h" = "yes" ; then
5710 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
5713 if test "$has_environ" = "yes" ; then
5714 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
5717 if test "$cpuid_h" = "yes" ; then
5718 echo "CONFIG_CPUID_H=y" >> $config_host_mak
5721 if test "$int128" = "yes" ; then
5722 echo "CONFIG_INT128=y" >> $config_host_mak
5725 if test "$atomic128" = "yes" ; then
5726 echo "CONFIG_ATOMIC128=y" >> $config_host_mak
5729 if test "$atomic64" = "yes" ; then
5730 echo "CONFIG_ATOMIC64=y" >> $config_host_mak
5733 if test "$getauxval" = "yes" ; then
5734 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
5737 if test "$glusterfs" = "yes" ; then
5738 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
5739 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
5740 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
5743 if test "$glusterfs_xlator_opt" = "yes" ; then
5744 echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
5747 if test "$glusterfs_discard" = "yes" ; then
5748 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
5751 if test "$glusterfs_zerofill" = "yes" ; then
5752 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
5755 if test "$libssh2" = "yes" ; then
5756 echo "CONFIG_LIBSSH2=m" >> $config_host_mak
5757 echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
5758 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
5761 # USB host support
5762 if test "$libusb" = "yes"; then
5763 echo "HOST_USB=libusb legacy" >> $config_host_mak
5764 else
5765 echo "HOST_USB=stub" >> $config_host_mak
5768 # TPM passthrough support?
5769 if test "$tpm" = "yes"; then
5770 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
5771 if test "$tpm_passthrough" = "yes"; then
5772 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
5776 echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
5777 if have_backend "nop"; then
5778 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
5780 if have_backend "simple"; then
5781 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
5782 # Set the appropriate trace file.
5783 trace_file="\"$trace_file-\" FMT_pid"
5785 if have_backend "log"; then
5786 echo "CONFIG_TRACE_LOG=y" >> $config_host_mak
5788 if have_backend "ust"; then
5789 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
5791 if have_backend "dtrace"; then
5792 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
5793 if test "$trace_backend_stap" = "yes" ; then
5794 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
5797 if have_backend "ftrace"; then
5798 if test "$linux" = "yes" ; then
5799 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
5800 else
5801 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
5804 if have_backend "syslog"; then
5805 if test "$posix_syslog" = "yes" ; then
5806 echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak
5807 else
5808 feature_not_found "syslog(trace backend)" "syslog not available"
5811 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
5813 if test "$rdma" = "yes" ; then
5814 echo "CONFIG_RDMA=y" >> $config_host_mak
5817 if test "$have_rtnetlink" = "yes" ; then
5818 echo "CONFIG_RTNETLINK=y" >> $config_host_mak
5821 if test "$replication" = "yes" ; then
5822 echo "CONFIG_REPLICATION=y" >> $config_host_mak
5825 if test "$have_af_vsock" = "yes" ; then
5826 echo "CONFIG_AF_VSOCK=y" >> $config_host_mak
5829 if test "$have_sysmacros" = "yes" ; then
5830 echo "CONFIG_SYSMACROS=y" >> $config_host_mak
5833 # Hold two types of flag:
5834 # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
5835 # a thread we have a handle to
5836 # CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
5837 # platform
5838 if test "$pthread_setname_np" = "yes" ; then
5839 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
5840 echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
5843 if test "$tcg_interpreter" = "yes"; then
5844 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
5845 elif test "$ARCH" = "sparc64" ; then
5846 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
5847 elif test "$ARCH" = "s390x" ; then
5848 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
5849 elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
5850 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
5851 elif test "$ARCH" = "ppc64" ; then
5852 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
5853 else
5854 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
5856 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
5858 echo "TOOLS=$tools" >> $config_host_mak
5859 echo "ROMS=$roms" >> $config_host_mak
5860 echo "MAKE=$make" >> $config_host_mak
5861 echo "INSTALL=$install" >> $config_host_mak
5862 echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
5863 echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
5864 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
5865 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
5866 echo "PYTHON=$python" >> $config_host_mak
5867 echo "CC=$cc" >> $config_host_mak
5868 if $iasl -h > /dev/null 2>&1; then
5869 echo "IASL=$iasl" >> $config_host_mak
5871 echo "CC_I386=$cc_i386" >> $config_host_mak
5872 echo "HOST_CC=$host_cc" >> $config_host_mak
5873 echo "CXX=$cxx" >> $config_host_mak
5874 echo "OBJCC=$objcc" >> $config_host_mak
5875 echo "AR=$ar" >> $config_host_mak
5876 echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
5877 echo "AS=$as" >> $config_host_mak
5878 echo "CCAS=$ccas" >> $config_host_mak
5879 echo "CPP=$cpp" >> $config_host_mak
5880 echo "OBJCOPY=$objcopy" >> $config_host_mak
5881 echo "LD=$ld" >> $config_host_mak
5882 echo "NM=$nm" >> $config_host_mak
5883 echo "WINDRES=$windres" >> $config_host_mak
5884 echo "CFLAGS=$CFLAGS" >> $config_host_mak
5885 echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
5886 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
5887 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
5888 if test "$sparse" = "yes" ; then
5889 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
5890 echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak
5891 echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
5892 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
5893 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
5895 if test "$cross_prefix" != ""; then
5896 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
5897 else
5898 echo "AUTOCONF_HOST := " >> $config_host_mak
5900 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
5901 echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
5902 echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
5903 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
5904 echo "LIBS+=$LIBS" >> $config_host_mak
5905 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
5906 echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak
5907 echo "EXESUF=$EXESUF" >> $config_host_mak
5908 echo "DSOSUF=$DSOSUF" >> $config_host_mak
5909 echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
5910 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
5911 echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
5912 echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
5913 echo "POD2MAN=$POD2MAN" >> $config_host_mak
5914 echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
5915 if test "$gcov" = "yes" ; then
5916 echo "CONFIG_GCOV=y" >> $config_host_mak
5917 echo "GCOV=$gcov_tool" >> $config_host_mak
5920 # use included Linux headers
5921 if test "$linux" = "yes" ; then
5922 mkdir -p linux-headers
5923 case "$cpu" in
5924 i386|x86_64|x32)
5925 linux_arch=x86
5927 ppcemb|ppc|ppc64)
5928 linux_arch=powerpc
5930 s390x)
5931 linux_arch=s390
5933 aarch64)
5934 linux_arch=arm64
5936 mips64)
5937 linux_arch=mips
5940 # For most CPUs the kernel architecture name and QEMU CPU name match.
5941 linux_arch="$cpu"
5943 esac
5944 # For non-KVM architectures we will not have asm headers
5945 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
5946 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
5950 for target in $target_list; do
5951 target_dir="$target"
5952 config_target_mak=$target_dir/config-target.mak
5953 target_name=$(echo $target | cut -d '-' -f 1)
5954 target_bigendian="no"
5956 case "$target_name" in
5957 armeb|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
5958 target_bigendian=yes
5960 esac
5961 target_softmmu="no"
5962 target_user_only="no"
5963 target_linux_user="no"
5964 target_bsd_user="no"
5965 case "$target" in
5966 ${target_name}-softmmu)
5967 target_softmmu="yes"
5969 ${target_name}-linux-user)
5970 if test "$linux" != "yes" ; then
5971 error_exit "Target '$target' is only available on a Linux host"
5973 target_user_only="yes"
5974 target_linux_user="yes"
5976 ${target_name}-bsd-user)
5977 if test "$bsd" != "yes" ; then
5978 error_exit "Target '$target' is only available on a BSD host"
5980 target_user_only="yes"
5981 target_bsd_user="yes"
5984 error_exit "Target '$target' not recognised"
5985 exit 1
5987 esac
5989 mkdir -p $target_dir
5990 echo "# Automatically generated by configure - do not modify" > $config_target_mak
5992 bflt="no"
5993 mttcg="no"
5994 interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g")
5995 gdb_xml_files=""
5997 TARGET_ARCH="$target_name"
5998 TARGET_BASE_ARCH=""
5999 TARGET_ABI_DIR=""
6001 case "$target_name" in
6002 i386)
6004 x86_64)
6005 TARGET_BASE_ARCH=i386
6007 alpha)
6008 mttcg="yes"
6010 arm|armeb)
6011 TARGET_ARCH=arm
6012 bflt="yes"
6013 mttcg="yes"
6014 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
6016 aarch64)
6017 TARGET_BASE_ARCH=arm
6018 bflt="yes"
6019 mttcg="yes"
6020 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
6022 cris)
6024 hppa)
6026 lm32)
6028 m68k)
6029 bflt="yes"
6030 gdb_xml_files="cf-core.xml cf-fp.xml"
6032 microblaze|microblazeel)
6033 TARGET_ARCH=microblaze
6034 bflt="yes"
6036 mips|mipsel)
6037 TARGET_ARCH=mips
6038 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
6040 mipsn32|mipsn32el)
6041 TARGET_ARCH=mips64
6042 TARGET_BASE_ARCH=mips
6043 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
6044 echo "TARGET_ABI32=y" >> $config_target_mak
6046 mips64|mips64el)
6047 TARGET_ARCH=mips64
6048 TARGET_BASE_ARCH=mips
6049 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
6051 moxie)
6053 nios2)
6055 or1k)
6056 TARGET_ARCH=openrisc
6057 TARGET_BASE_ARCH=openrisc
6059 ppc)
6060 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
6062 ppcemb)
6063 TARGET_BASE_ARCH=ppc
6064 TARGET_ABI_DIR=ppc
6065 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
6067 ppc64)
6068 TARGET_BASE_ARCH=ppc
6069 TARGET_ABI_DIR=ppc
6070 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6072 ppc64le)
6073 TARGET_ARCH=ppc64
6074 TARGET_BASE_ARCH=ppc
6075 TARGET_ABI_DIR=ppc
6076 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6078 ppc64abi32)
6079 TARGET_ARCH=ppc64
6080 TARGET_BASE_ARCH=ppc
6081 TARGET_ABI_DIR=ppc
6082 echo "TARGET_ABI32=y" >> $config_target_mak
6083 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
6085 sh4|sh4eb)
6086 TARGET_ARCH=sh4
6087 bflt="yes"
6089 sparc)
6091 sparc64)
6092 TARGET_BASE_ARCH=sparc
6094 sparc32plus)
6095 TARGET_ARCH=sparc64
6096 TARGET_BASE_ARCH=sparc
6097 TARGET_ABI_DIR=sparc
6098 echo "TARGET_ABI32=y" >> $config_target_mak
6100 s390x)
6101 gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml"
6103 tilegx)
6105 tricore)
6107 unicore32)
6109 xtensa|xtensaeb)
6110 TARGET_ARCH=xtensa
6113 error_exit "Unsupported target CPU"
6115 esac
6116 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
6117 if [ "$TARGET_BASE_ARCH" = "" ]; then
6118 TARGET_BASE_ARCH=$TARGET_ARCH
6121 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
6123 upper() {
6124 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
6127 target_arch_name="$(upper $TARGET_ARCH)"
6128 echo "TARGET_$target_arch_name=y" >> $config_target_mak
6129 echo "TARGET_NAME=$target_name" >> $config_target_mak
6130 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
6131 if [ "$TARGET_ABI_DIR" = "" ]; then
6132 TARGET_ABI_DIR=$TARGET_ARCH
6134 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
6135 if [ "$HOST_VARIANT_DIR" != "" ]; then
6136 echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
6138 case "$target_name" in
6139 i386|x86_64)
6140 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
6141 echo "CONFIG_XEN=y" >> $config_target_mak
6142 if test "$xen_pci_passthrough" = yes; then
6143 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
6148 esac
6149 case "$target_name" in
6150 aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x|mipsel|mips)
6151 # Make sure the target and host cpus are compatible
6152 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
6153 \( "$target_name" = "$cpu" -o \
6154 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
6155 \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
6156 \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
6157 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
6158 \( "$target_name" = "mipsel" -a "$cpu" = "mips" \) -o \
6159 \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
6160 \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) -o \
6161 \( "$target_name" = "x86_64" -a "$cpu" = "x32" \) -o \
6162 \( "$target_name" = "i386" -a "$cpu" = "x32" \) \) ; then
6163 echo "CONFIG_KVM=y" >> $config_target_mak
6164 if test "$vhost_net" = "yes" ; then
6165 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
6166 echo "CONFIG_VHOST_NET_TEST_$target_name=y" >> $config_host_mak
6169 esac
6170 if test "$hax" = "yes" ; then
6171 if test "$target_softmmu" = "yes" ; then
6172 case "$target_name" in
6173 i386|x86_64)
6174 echo "CONFIG_HAX=y" >> $config_target_mak
6176 esac
6179 if test "$target_bigendian" = "yes" ; then
6180 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
6182 if test "$target_softmmu" = "yes" ; then
6183 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
6184 if test "$mttcg" = "yes" ; then
6185 echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak
6188 if test "$target_user_only" = "yes" ; then
6189 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
6190 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
6192 if test "$target_linux_user" = "yes" ; then
6193 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
6195 list=""
6196 if test ! -z "$gdb_xml_files" ; then
6197 for x in $gdb_xml_files; do
6198 list="$list $source_path/gdb-xml/$x"
6199 done
6200 echo "TARGET_XML_FILES=$list" >> $config_target_mak
6203 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
6204 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
6206 if test "$target_bsd_user" = "yes" ; then
6207 echo "CONFIG_BSD_USER=y" >> $config_target_mak
6210 # generate QEMU_CFLAGS/LDFLAGS for targets
6212 cflags=""
6213 ldflags=""
6215 disas_config() {
6216 echo "CONFIG_${1}_DIS=y" >> $config_target_mak
6217 echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak
6220 for i in $ARCH $TARGET_BASE_ARCH ; do
6221 case "$i" in
6222 alpha)
6223 disas_config "ALPHA"
6225 aarch64)
6226 if test -n "${cxx}"; then
6227 disas_config "ARM_A64"
6230 arm)
6231 disas_config "ARM"
6232 if test -n "${cxx}"; then
6233 disas_config "ARM_A64"
6236 cris)
6237 disas_config "CRIS"
6239 hppa)
6240 disas_config "HPPA"
6242 i386|x86_64|x32)
6243 disas_config "I386"
6245 ia64*)
6246 disas_config "IA64"
6248 lm32)
6249 disas_config "LM32"
6251 m68k)
6252 disas_config "M68K"
6254 microblaze*)
6255 disas_config "MICROBLAZE"
6257 mips*)
6258 disas_config "MIPS"
6260 moxie*)
6261 disas_config "MOXIE"
6263 nios2)
6264 disas_config "NIOS2"
6266 or1k)
6267 disas_config "OPENRISC"
6269 ppc*)
6270 disas_config "PPC"
6272 s390*)
6273 disas_config "S390"
6275 sh4)
6276 disas_config "SH4"
6278 sparc*)
6279 disas_config "SPARC"
6281 xtensa*)
6282 disas_config "XTENSA"
6284 esac
6285 done
6286 if test "$tcg_interpreter" = "yes" ; then
6287 disas_config "TCI"
6290 case "$ARCH" in
6291 alpha)
6292 # Ensure there's only a single GP
6293 cflags="-msmall-data $cflags"
6295 esac
6297 if test "$gprof" = "yes" ; then
6298 echo "TARGET_GPROF=yes" >> $config_target_mak
6299 if test "$target_linux_user" = "yes" ; then
6300 cflags="-p $cflags"
6301 ldflags="-p $ldflags"
6303 if test "$target_softmmu" = "yes" ; then
6304 ldflags="-p $ldflags"
6305 echo "GPROF_CFLAGS=-p" >> $config_target_mak
6309 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
6310 ldflags="$ldflags $textseg_ldflags"
6313 echo "LDFLAGS+=$ldflags" >> $config_target_mak
6314 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
6316 done # for target in $targets
6318 if [ "$pixman" = "internal" ]; then
6319 echo "config-host.h: subdir-pixman" >> $config_host_mak
6322 if [ "$dtc_internal" = "yes" ]; then
6323 echo "config-host.h: subdir-dtc" >> $config_host_mak
6326 if test "$numa" = "yes"; then
6327 echo "CONFIG_NUMA=y" >> $config_host_mak
6330 if test "$ccache_cpp2" = "yes"; then
6331 echo "export CCACHE_CPP2=y" >> $config_host_mak
6334 # build tree in object directory in case the source is not in the current directory
6335 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
6336 DIRS="$DIRS docs fsdev"
6337 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
6338 DIRS="$DIRS roms/seabios roms/vgabios"
6339 DIRS="$DIRS qapi-generated"
6340 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
6341 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
6342 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
6343 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
6344 FILES="$FILES pc-bios/spapr-rtas/Makefile"
6345 FILES="$FILES pc-bios/s390-ccw/Makefile"
6346 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
6347 FILES="$FILES pc-bios/qemu-icon.bmp"
6348 for bios_file in \
6349 $source_path/pc-bios/*.bin \
6350 $source_path/pc-bios/*.lid \
6351 $source_path/pc-bios/*.aml \
6352 $source_path/pc-bios/*.rom \
6353 $source_path/pc-bios/*.dtb \
6354 $source_path/pc-bios/*.img \
6355 $source_path/pc-bios/openbios-* \
6356 $source_path/pc-bios/u-boot.* \
6357 $source_path/pc-bios/palcode-*
6359 FILES="$FILES pc-bios/$(basename $bios_file)"
6360 done
6361 for test_file in $(find $source_path/tests/acpi-test-data -type f)
6363 FILES="$FILES tests/acpi-test-data$(echo $test_file | sed -e 's/.*acpi-test-data//')"
6364 done
6365 mkdir -p $DIRS
6366 for f in $FILES ; do
6367 if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
6368 symlink "$source_path/$f" "$f"
6370 done
6372 # temporary config to build submodules
6373 for rom in seabios vgabios ; do
6374 config_mak=roms/$rom/config.mak
6375 echo "# Automatically generated by configure - do not modify" > $config_mak
6376 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
6377 echo "AS=$as" >> $config_mak
6378 echo "CCAS=$ccas" >> $config_mak
6379 echo "CC=$cc" >> $config_mak
6380 echo "BCC=bcc" >> $config_mak
6381 echo "CPP=$cpp" >> $config_mak
6382 echo "OBJCOPY=objcopy" >> $config_mak
6383 echo "IASL=$iasl" >> $config_mak
6384 echo "LD=$ld" >> $config_mak
6385 done
6387 # set up tests data directory
6388 if [ ! -e tests/data ]; then
6389 symlink "$source_path/tests/data" tests/data
6392 # set up qemu-iotests in this build directory
6393 iotests_common_env="tests/qemu-iotests/common.env"
6394 iotests_check="tests/qemu-iotests/check"
6396 echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
6397 echo >> "$iotests_common_env"
6398 echo "export PYTHON='$python'" >> "$iotests_common_env"
6400 if [ ! -e "$iotests_check" ]; then
6401 symlink "$source_path/$iotests_check" "$iotests_check"
6404 # Save the configure command line for later reuse.
6405 cat <<EOD >config.status
6406 #!/bin/sh
6407 # Generated by configure.
6408 # Run this file to recreate the current configuration.
6409 # Compiler output produced by configure, useful for debugging
6410 # configure, is in config.log if it exists.
6412 printf "exec" >>config.status
6413 printf " '%s'" "$0" "$@" >>config.status
6414 echo ' "$@"' >>config.status
6415 chmod +x config.status
6417 rm -r "$TMPDIR1"