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 # make source path absolute
15 source_path
=$
(cd "$(dirname -- "$0")"; pwd)
17 if test "$PWD" = "$source_path"
19 echo "Using './build' as the directory for build output"
21 MARKER
=build
/auto-created-by-configure
29 echo "ERROR: ./build dir already exists and was not previously created by configure"
37 cat > GNUmakefile
<<'EOF'
38 # This file is auto-generated by configure to support in-source tree
39 # 'make' command invocation
41 ifeq ($(MAKECMDGOALS),)
47 @echo 'changing dir to build for $(MAKE) "$(MAKECMDGOALS)"...'
48 @$(MAKE) -C build -f Makefile $(MAKECMDGOALS)
49 @if test "$(MAKECMDGOALS)" = "distclean" && \
50 test -e build/auto-created-by-configure ; \
52 rm -rf build GNUmakefile ; \
60 exec $source_path/configure
"$@"
63 # Temporary directory used for files created while
64 # configure runs. Since it is in the build directory
65 # we can safely blow away any previous version of it
66 # (and we need not jump through hoops to try to delete
67 # it when configure exits.)
72 echo "ERROR: failed to create temporary directory"
77 TMPC
="${TMPDIR1}/${TMPB}.c"
78 TMPO
="${TMPDIR1}/${TMPB}.o"
79 TMPCXX
="${TMPDIR1}/${TMPB}.cxx"
80 TMPE
="${TMPDIR1}/${TMPB}.exe"
84 # Print a helpful header at the top of config.log
85 echo "# QEMU configure log $(date)" >> config.log
86 printf "# Configured with:" >> config.log
87 printf " '%s'" "$0" "$@" >> config.log
89 echo "#" >> config.log
92 printf "%s" "$1" |
sed "s,','\\\\'',g; s,.*,'&',"
98 while test -n "$2"; do
111 # Run the compiler, capturing its output to the log. First argument
112 # is compiler binary to execute.
115 if test -n "$BASH_VERSION"; then eval '
117 funcs: ${FUNCNAME[*]}
118 lines: ${BASH_LINENO[*]}"
120 echo $compiler "$@" >> config.log
121 $compiler "$@" >> config.log
2>&1 ||
return $?
122 # Test passed. If this is an --enable-werror build, rerun
123 # the test with -Werror and bail out if it fails. This
124 # makes warning-generating-errors in configure test code
125 # obvious to developers.
126 if test "$werror" != "yes"; then
129 # Don't bother rerunning the compile if we were already using -Werror
135 echo $compiler -Werror "$@" >> config.log
136 $compiler -Werror "$@" >> config.log
2>&1 && return $?
137 error_exit
"configure test passed without -Werror but failed with -Werror." \
138 "This is probably a bug in the configure script. The failing command" \
139 "will be at the bottom of config.log." \
140 "You can run configure with --disable-werror to bypass this check."
144 do_compiler
"$cc" $CPU_CFLAGS "$@"
148 do_compiler
"$cxx" $CPU_CFLAGS "$@"
151 # Append $2 to the variable named $1, with space separation
153 eval $1=\
${$1:+\"\$$1 \"}\
$2
157 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
158 # options which some versions of GCC's C++ compiler complain about
159 # because they only make sense for C programs.
160 QEMU_CXXFLAGS
="-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS"
161 CONFIGURE_CXXFLAGS
=$
(echo "$CONFIGURE_CFLAGS" |
sed s
/-std=gnu11
/-std=gnu
++11/)
162 for arg
in $QEMU_CFLAGS; do
164 -Wstrict-prototypes|
-Wmissing-prototypes|
-Wnested-externs|\
165 -Wold-style-declaration|
-Wold-style-definition|
-Wredundant-decls)
168 QEMU_CXXFLAGS
=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
176 do_cc
$CFLAGS $EXTRA_CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
182 do_cc
$CFLAGS $EXTRA_CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC \
183 $LDFLAGS $EXTRA_LDFLAGS $CONFIGURE_LDFLAGS $QEMU_LDFLAGS $local_ldflags
186 # symbolically link $1 to $2. Portable version of "ln -sf".
189 mkdir
-p "$(dirname "$2")"
193 # check whether a command is available to this shell (may be either an
194 # executable or a builtin)
196 type "$1" >/dev
/null
2>&1
200 local_ver1
=$
(expr "$1" : '\([0-9.]*\)' |
tr .
' ')
201 local_ver2
=$
(echo "$2" |
tr .
' ')
205 # 'shift 2' if $2 is set, or 'shift' if $2 is not set
209 # the second argument finished, the first must be greater or equal
210 test $# = 1 && return 0
211 test $local_first -lt $2 && return 1
212 test $local_first -gt $2 && return 0
219 eval test -z '"${1#'"$2"'}"'
223 $ld --help 2>/dev
/null |
grep ".$1" >/dev
/null
2>&1
226 if printf %s
\\n
"$source_path" "$PWD" |
grep -q "[[:space:]:]";
228 error_exit
"main directory cannot contain spaces nor colons"
234 interp_prefix
="/usr/gnemul/qemu-%M"
238 audio_drv_list
="default"
239 block_drv_rw_whitelist
=""
240 block_drv_ro_whitelist
=""
247 gdb_bin
=$
(command -v "gdb-multiarch" ||
command -v "gdb")
249 if test -e "$source_path/.git"
251 git_submodules_action
="update"
253 git_submodules_action
="ignore"
256 git_submodules
="ui/keycodemapdb"
259 # Don't accept a target_list environment variable.
261 unset target_list_exclude
263 # Default value for a variable defining feature "foo".
264 # * foo="no" feature will only be used if --enable-foo arg is given
265 # * foo="" feature will be searched for, and if found, will be used
266 # unless --disable-foo is given
267 # * foo="yes" this value will only be set by --enable-foo flag.
268 # feature will searched for,
269 # if not found, configure exits with error
271 # Always add --enable-foo and --disable-foo command line args.
272 # Distributions want to ensure that several features are compiled in, and it
273 # is impossible without a --enable-foo that exits if a feature is not found.
276 # parse CC options second
278 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
280 --without-default-features)
290 xen_ctrl_version
="$default_feature"
291 vhost_kernel
="$default_feature"
292 vhost_net
="$default_feature"
293 vhost_crypto
="$default_feature"
294 vhost_scsi
="$default_feature"
295 vhost_vsock
="$default_feature"
297 vhost_user_fs
="$default_feature"
298 vhost_vdpa
="$default_feature"
299 rdma
="$default_feature"
300 pvrdma
="$default_feature"
305 fortify_source
="$default_feature"
319 opengl
="$default_feature"
320 guest_agent
="$default_feature"
321 vss_win32_sdk
="$default_feature"
323 want_tools
="$default_feature"
325 coroutine_pool
="$default_feature"
326 debug_stack_usage
="no"
327 tls_priority
="NORMAL"
328 plugins
="$default_feature"
329 secret_keyring
="$default_feature"
333 gio
="$default_feature"
335 slirp_smbd
="$default_feature"
337 # The following Meson options are handled manually (still they
338 # are included in the automatically generated help message)
340 # 1. Track which submodules are needed
345 # 2. Support --with/--without option
346 default_devices
="true"
348 # 3. Automatically enable/disable other options
352 # 4. Detection partly done in configure
353 xen
=${default_feature:+disabled}
355 # parse CC options second
357 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
359 --cross-prefix=*) cross_prefix
="$optarg"
364 --cxx=*) CXX
="$optarg"
366 --cpu=*) cpu
="$optarg"
369 EXTRA_CFLAGS
="$EXTRA_CFLAGS $optarg"
370 EXTRA_CXXFLAGS
="$EXTRA_CXXFLAGS $optarg"
372 --extra-cxxflags=*) EXTRA_CXXFLAGS
="$EXTRA_CXXFLAGS $optarg"
374 --extra-ldflags=*) EXTRA_LDFLAGS
="$EXTRA_LDFLAGS $optarg"
376 --enable-debug-info) debug_info
="yes"
378 --disable-debug-info) debug_info
="no"
380 --cross-cc-*[!a-zA-Z0-9_-
]*=*) error_exit
"Passed bad --cross-cc-FOO option"
382 --cross-cc-cflags-*) cc_arch
=${opt#--cross-cc-cflags-}; cc_arch
=${cc_arch%%=*}
383 eval "cross_cc_cflags_${cc_arch}=\$optarg"
384 cross_cc_vars
="$cross_cc_vars cross_cc_cflags_${cc_arch}"
386 --cross-cc-*) cc_arch
=${opt#--cross-cc-}; cc_arch
=${cc_arch%%=*}
387 cc_archs
="$cc_archs $cc_arch"
388 eval "cross_cc_${cc_arch}=\$optarg"
389 cross_cc_vars
="$cross_cc_vars cross_cc_${cc_arch}"
394 # Using uname is really, really broken. Once we have the right set of checks
395 # we can eliminate its usage altogether.
397 # Preferred compiler:
399 # ${cross_prefix}gcc (if cross-prefix specified)
401 if test -z "${CC}${cross_prefix}"; then
404 cc
="${CC-${cross_prefix}gcc}"
407 if test -z "${CXX}${cross_prefix}"; then
410 cxx
="${CXX-${cross_prefix}g++}"
413 ar="${AR-${cross_prefix}ar}"
414 as
="${AS-${cross_prefix}as}"
417 objcopy
="${OBJCOPY-${cross_prefix}objcopy}"
418 ld
="${LD-${cross_prefix}ld}"
419 ranlib
="${RANLIB-${cross_prefix}ranlib}"
420 nm
="${NM-${cross_prefix}nm}"
421 strip
="${STRIP-${cross_prefix}strip}"
422 windres
="${WINDRES-${cross_prefix}windres}"
423 pkg_config_exe
="${PKG_CONFIG-${cross_prefix}pkg-config}"
425 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
427 pkg_config
=query_pkg_config
428 sdl2_config
="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
430 # default flags for all hosts
431 # We use -fwrapv to tell the compiler that we require a C dialect where
432 # left shift of signed integers is well defined and has the expected
433 # 2s-complement style results. (Both clang and gcc agree that it
434 # provides these semantics.)
435 QEMU_CFLAGS
="-fno-strict-aliasing -fno-common -fwrapv"
436 QEMU_CFLAGS
="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
437 QEMU_CFLAGS
="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
438 QEMU_CFLAGS
="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
442 # Flags that are needed during configure but later taken care of by Meson
443 CONFIGURE_CFLAGS
="-std=gnu11 -Wall"
450 #error $1 not defined
452 int main(void) { return 0; }
460 int main(void) { return 0; }
467 int main(void) { return 0; }
471 if check_define __linux__
; then
473 elif check_define _WIN32
; then
475 elif check_define __OpenBSD__
; then
477 elif check_define __sun__
; then
479 elif check_define __HAIKU__
; then
481 elif check_define __FreeBSD__
; then
483 elif check_define __FreeBSD_kernel__
&& check_define __GLIBC__
; then
484 targetos
=gnu
/kfreebsd
485 elif check_define __DragonFly__
; then
487 elif check_define __NetBSD__
; then
489 elif check_define __APPLE__
; then
492 # This is a fatal error, but don't report it yet, because we
493 # might be going to just print the --help text, or it might
494 # be the result of a missing compiler.
516 # needed for kinfo_getvmmap(3) in libutil.h
533 # Disable attempts to use ObjectiveC features in os/object.h since they
534 # won't work when we're compiling with gcc as a C compiler.
535 QEMU_CFLAGS
="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
540 smbd
="${SMBD-/usr/sfw/sbin/smbd}"
541 # needed for CMSG_ macros in sys/socket.h
542 QEMU_CFLAGS
="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
543 # needed for TIOCWIN* defines in termios.h
544 QEMU_CFLAGS
="-D__EXTENSIONS__ $QEMU_CFLAGS"
545 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
546 # Note that this check is broken for cross-compilation: if you're
547 # cross-compiling to one of these OSes then you'll need to specify
548 # the correct CPU with the --cpu option.
549 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
555 QEMU_CFLAGS
="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS"
559 vhost_user
=${default_feature:-yes}
563 if test ! -z "$cpu" ; then
564 # command line argument
566 elif check_define __i386__
; then
568 elif check_define __x86_64__
; then
569 if check_define __ILP32__
; then
574 elif check_define __sparc__
; then
575 if check_define __arch64__
; then
580 elif check_define _ARCH_PPC
; then
581 if check_define _ARCH_PPC64
; then
582 if check_define _LITTLE_ENDIAN
; then
590 elif check_define __mips__
; then
592 elif check_define __s390__
; then
593 if check_define __s390x__
; then
598 elif check_define __riscv
; then
600 elif check_define __arm__
; then
602 elif check_define __aarch64__
; then
604 elif check_define __loongarch64
; then
610 # Normalise host CPU name, set multilib cflags
611 # Note that this case should only have supported host CPUs, not guests.
616 i386|i486|i586|i686|i86pc|BePC
)
621 CPU_CFLAGS
="-mx32" ;;
624 # ??? Only extremely old AMD cpus do not have cmpxchg16b.
625 # If we truly care, we should simply detect this case at
626 # runtime and generate the fallback to serial emulation.
627 CPU_CFLAGS
="-m64 -mcx16" ;;
635 CPU_CFLAGS
="-m64 -mbig" ;;
638 CPU_CFLAGS
="-m64 -mlittle" ;;
647 CPU_CFLAGS
="-m32 -mv8plus -mcpu=ultrasparc" ;;
649 CPU_CFLAGS
="-m64 -mcpu=ultrasparc" ;;
652 : ${make=${MAKE-make}}
654 # We prefer python 3.x. A bare 'python' is traditionally
655 # python 2.x, but some distros have it as python 3.x, so
659 for binary
in "${PYTHON-python3}" python
663 python
=$
(command -v "$binary")
669 # Check for ancillary tools used in testing
671 for binary
in genisoimage mkisofs
675 genisoimage
=$
(command -v "$binary")
680 # Default objcc to clang if available, otherwise use CC
687 if test "$mingw32" = "yes" ; then
689 # MinGW needs -mthreads for TLS and macro _MT.
690 CONFIGURE_CFLAGS
="-mthreads $CONFIGURE_CFLAGS"
698 .
$source_path/scripts
/meson-buildoptions.sh
701 meson_option_parse
() {
702 meson_options
="$meson_options $(_meson_option_parse "$@
")"
703 if test $?
-eq 1; then
704 echo "ERROR: unknown option $1"
705 echo "Try '$0 --help' for more information"
711 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
713 --help|
-h) show_help
=yes
715 --version|
-V) exec cat $source_path/VERSION
717 --prefix=*) prefix
="$optarg"
719 --interp-prefix=*) interp_prefix
="$optarg"
725 --host-cc=*) host_cc
="$optarg"
729 --iasl=*) iasl
="$optarg"
731 --objcc=*) objcc
="$optarg"
733 --make=*) make="$optarg"
737 --python=*) python
="$optarg" ; explicit_python
=yes
739 --sphinx-build=*) sphinx_build
="$optarg"
741 --skip-meson) skip_meson
=yes
743 --meson=*) meson
="$optarg"
745 --ninja=*) ninja
="$optarg"
747 --smbd=*) smbd
="$optarg"
757 --disable-debug-info)
767 --disable-module-upgrades) module_upgrades
="no"
769 --enable-module-upgrades) module_upgrades
="yes"
773 --target-list=*) target_list
="$optarg"
774 if test "$target_list_exclude"; then
775 error_exit
"Can't mix --target-list with --target-list-exclude"
778 --target-list-exclude=*) target_list_exclude
="$optarg"
779 if test "$target_list"; then
780 error_exit
"Can't mix --target-list-exclude with --target-list"
783 --with-trace-file=*) trace_file
="$optarg"
785 --with-default-devices) default_devices
="true"
787 --without-default-devices) default_devices
="false"
789 --with-devices-*[!a-zA-Z0-9_-
]*=*) error_exit
"Passed bad --with-devices-FOO option"
791 --with-devices-*) device_arch
=${opt#--with-devices-};
792 device_arch
=${device_arch%%=*}
793 cf
=$source_path/configs
/devices
/$device_arch-softmmu/$optarg.mak
794 if test -f "$cf"; then
795 device_archs
="$device_archs $device_arch"
796 eval "devices_${device_arch}=\$optarg"
798 error_exit
"File $cf does not exist"
801 --without-default-features) # processed above
803 --enable-gcov) gcov
="yes"
807 QEMU_PKG_CONFIG_FLAGS
="--static $QEMU_PKG_CONFIG_FLAGS"
809 --mandir=*) mandir
="$optarg"
811 --bindir=*) bindir
="$optarg"
813 --libdir=*) libdir
="$optarg"
815 --libexecdir=*) libexecdir
="$optarg"
817 --includedir=*) includedir
="$optarg"
819 --datadir=*) datadir
="$optarg"
821 --with-suffix=*) qemu_suffix
="$optarg"
823 --docdir=*) docdir
="$optarg"
825 --localedir=*) localedir
="$optarg"
827 --sysconfdir=*) sysconfdir
="$optarg"
829 --localstatedir=*) local_statedir
="$optarg"
831 --firmwarepath=*) firmwarepath
="$optarg"
834 --disable-dependency-tracking|\
835 --sbindir=*|
--sharedstatedir=*|\
836 --oldincludedir=*|
--datarootdir=*|
--infodir=*|\
837 --htmldir=*|
--dvidir=*|
--pdfdir=*|
--psdir=*)
838 # These switches are silently ignored, for compatibility with
839 # autoconf-generated configure scripts. This allows QEMU's
840 # configure to be used by RPM and similar macros that set
841 # lots of directory switches by default.
843 --audio-drv-list=*) audio_drv_list
="$optarg"
845 --block-drv-rw-whitelist=*|
--block-drv-whitelist=*) block_drv_rw_whitelist
=$
(echo "$optarg" |
sed -e 's/,/ /g')
847 --block-drv-ro-whitelist=*) block_drv_ro_whitelist
=$
(echo "$optarg" |
sed -e 's/,/ /g')
849 --enable-debug-tcg) debug_tcg
="yes"
851 --disable-debug-tcg) debug_tcg
="no"
854 # Enable debugging options that aren't excessively noisy
856 meson_option_parse
--enable-debug-mutex ""
860 --enable-sanitizers) sanitizers
="yes"
862 --disable-sanitizers) sanitizers
="no"
864 --enable-tsan) tsan
="yes"
866 --disable-tsan) tsan
="no"
868 --disable-slirp) slirp
="disabled"
870 --enable-slirp) slirp
="enabled"
872 --enable-slirp=git
) slirp
="internal"
874 --enable-slirp=*) slirp
="$optarg"
876 --disable-xen) xen
="disabled"
878 --enable-xen) xen
="enabled"
880 --disable-tcg) tcg
="disabled"
883 --enable-tcg) tcg
="enabled"
885 --disable-system) softmmu
="no"
887 --enable-system) softmmu
="yes"
894 --disable-linux-user) linux_user
="no"
896 --enable-linux-user) linux_user
="yes"
898 --disable-bsd-user) bsd_user
="no"
900 --enable-bsd-user) bsd_user
="yes"
902 --enable-pie) pie
="yes"
904 --disable-pie) pie
="no"
906 --enable-werror) werror
="yes"
908 --disable-werror) werror
="no"
910 --enable-lto) lto
="true"
912 --disable-lto) lto
="false"
914 --enable-stack-protector) stack_protector
="yes"
916 --disable-stack-protector) stack_protector
="no"
918 --enable-safe-stack) safe_stack
="yes"
920 --disable-safe-stack) safe_stack
="no"
926 --disable-cfi) cfi
="false"
928 --disable-fdt) fdt
="disabled"
930 --enable-fdt) fdt
="enabled"
932 --enable-fdt=git
) fdt
="internal"
934 --enable-fdt=*) fdt
="$optarg"
936 --with-pkgversion=*) pkgversion
="$optarg"
938 --with-coroutine=*) coroutine
="$optarg"
940 --disable-coroutine-pool) coroutine_pool
="no"
942 --enable-coroutine-pool) coroutine_pool
="yes"
944 --enable-debug-stack-usage) debug_stack_usage
="yes"
946 --disable-vhost-net) vhost_net
="no"
948 --enable-vhost-net) vhost_net
="yes"
950 --disable-vhost-crypto) vhost_crypto
="no"
952 --enable-vhost-crypto) vhost_crypto
="yes"
954 --disable-vhost-scsi) vhost_scsi
="no"
956 --enable-vhost-scsi) vhost_scsi
="yes"
958 --disable-vhost-vsock) vhost_vsock
="no"
960 --enable-vhost-vsock) vhost_vsock
="yes"
962 --disable-vhost-user-fs) vhost_user_fs
="no"
964 --enable-vhost-user-fs) vhost_user_fs
="yes"
966 --disable-opengl) opengl
="no"
968 --enable-opengl) opengl
="yes"
972 --enable-guest-agent) guest_agent
="yes"
974 --disable-guest-agent) guest_agent
="no"
976 --with-vss-sdk) vss_win32_sdk
=""
978 --with-vss-sdk=*) vss_win32_sdk
="$optarg"
980 --without-vss-sdk) vss_win32_sdk
="no"
982 --with-win-sdk) win_sdk
=""
984 --with-win-sdk=*) win_sdk
="$optarg"
986 --without-win-sdk) win_sdk
="no"
988 --enable-tools) want_tools
="yes"
990 --disable-tools) want_tools
="no"
992 --disable-virtio-blk-data-plane|
--enable-virtio-blk-data-plane)
993 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
995 --enable-vhdx|
--disable-vhdx)
996 echo "$0: $opt is obsolete, VHDX driver is always built" >&2
998 --enable-uuid|
--disable-uuid)
999 echo "$0: $opt is obsolete, UUID support is always built" >&2
1001 --tls-priority=*) tls_priority
="$optarg"
1003 --enable-rdma) rdma
="yes"
1005 --disable-rdma) rdma
="no"
1007 --enable-pvrdma) pvrdma
="yes"
1009 --disable-pvrdma) pvrdma
="no"
1011 --disable-vhost-user) vhost_user
="no"
1013 --enable-vhost-user) vhost_user
="yes"
1015 --disable-vhost-vdpa) vhost_vdpa
="no"
1017 --enable-vhost-vdpa) vhost_vdpa
="yes"
1019 --disable-vhost-kernel) vhost_kernel
="no"
1021 --enable-vhost-kernel) vhost_kernel
="yes"
1023 --disable-capstone) capstone
="disabled"
1025 --enable-capstone) capstone
="enabled"
1027 --enable-capstone=git
) capstone
="internal"
1029 --enable-capstone=*) capstone
="$optarg"
1031 --with-git=*) git
="$optarg"
1033 --with-git-submodules=*)
1034 git_submodules_action
="$optarg"
1036 --enable-plugins) if test "$mingw32" = "yes"; then
1037 error_exit
"TCG plugins not currently supported on Windows platforms"
1042 --disable-plugins) plugins
="no"
1044 --enable-containers) use_containers
="yes"
1046 --disable-containers) use_containers
="no"
1048 --gdb=*) gdb_bin
="$optarg"
1050 --enable-keyring) secret_keyring
="yes"
1052 --disable-keyring) secret_keyring
="no"
1054 --enable-gio) gio
=yes
1056 --disable-gio) gio
=no
1058 --enable-slirp-smbd) slirp_smbd
=yes
1060 --disable-slirp-smbd) slirp_smbd
=no
1062 # backwards compatibility options
1063 --enable-trace-backend=*) meson_option_parse
"--enable-trace-backends=$optarg" "$optarg"
1065 --disable-blobs) meson_option_parse
--disable-install-blobs ""
1067 --enable-tcmalloc) meson_option_parse
--enable-malloc=tcmalloc tcmalloc
1069 --enable-jemalloc) meson_option_parse
--enable-malloc=jemalloc jemalloc
1071 # everything else has the same name in configure and meson
1072 --enable-* |
--disable-*) meson_option_parse
"$opt" "$optarg"
1075 echo "ERROR: unknown option $opt"
1076 echo "Try '$0 --help' for more information"
1082 # test for any invalid configuration combinations
1083 if test "$plugins" = "yes" -a "$tcg" = "disabled"; then
1084 error_exit
"Can't enable plugins on non-TCG builds"
1087 case $git_submodules_action in
1089 if test ! -e "$source_path/.git"; then
1090 echo "ERROR: cannot $git_submodules_action git submodules without .git"
1095 if ! test -f "$source_path/ui/keycodemapdb/README"
1098 echo "ERROR: missing GIT submodules"
1100 if test -e "$source_path/.git"; then
1101 echo "--with-git-submodules=ignore specified but submodules were not"
1102 echo "checked out. Please initialize and update submodules."
1104 echo "This is not a GIT checkout but module content appears to"
1105 echo "be missing. Do not use 'git archive' or GitHub download links"
1106 echo "to acquire QEMU source archives. Non-GIT builds are only"
1107 echo "supported with source archives linked from:"
1109 echo " https://www.qemu.org/download/#source"
1111 echo "Developers working with GIT can use scripts/archive-source.sh"
1112 echo "if they need to create valid source archives."
1119 echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'"
1124 libdir
="${libdir:-$prefix/lib}"
1125 libexecdir
="${libexecdir:-$prefix/libexec}"
1126 includedir
="${includedir:-$prefix/include}"
1128 if test "$mingw32" = "yes" ; then
1129 bindir
="${bindir:-$prefix}"
1131 bindir
="${bindir:-$prefix/bin}"
1133 mandir
="${mandir:-$prefix/share/man}"
1134 datadir
="${datadir:-$prefix/share}"
1135 docdir
="${docdir:-$prefix/share/doc}"
1136 sysconfdir
="${sysconfdir:-$prefix/etc}"
1137 local_statedir
="${local_statedir:-$prefix/var}"
1138 firmwarepath
="${firmwarepath:-$datadir/qemu-firmware}"
1139 localedir
="${localedir:-$datadir/locale}"
1141 if eval test -z "\${cross_cc_$cpu}"; then
1142 eval "cross_cc_${cpu}=\$cc"
1143 cross_cc_vars
="$cross_cc_vars cross_cc_${cpu}"
1146 default_target_list
=""
1149 if [ "$linux_user" != no
]; then
1150 if [ "$targetos" = linux
] && [ -d $source_path/linux-user
/include
/host
/$cpu ]; then
1152 elif [ "$linux_user" = yes ]; then
1153 error_exit
"linux-user not supported on this architecture"
1156 if [ "$bsd_user" != no
]; then
1157 if [ "$bsd_user" = "" ]; then
1158 test $targetos = freebsd
&& bsd_user
=yes
1160 if [ "$bsd_user" = yes ] && ! [ -d $source_path/bsd-user
/$targetos ]; then
1161 error_exit
"bsd-user not supported on this host OS"
1164 if [ "$softmmu" = "yes" ]; then
1165 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-softmmu.mak"
1167 if [ "$linux_user" = "yes" ]; then
1168 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-linux-user.mak"
1170 if [ "$bsd_user" = "yes" ]; then
1171 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-bsd-user.mak"
1174 for config
in $mak_wilds; do
1175 target
="$(basename "$config" .mak)"
1176 if echo "$target_list_exclude" |
grep -vq "$target"; then
1177 default_target_list
="${default_target_list} $target"
1181 if test x
"$show_help" = x
"yes" ; then
1184 Usage: configure [options]
1185 Options: [defaults in brackets after descriptions]
1188 --help print this message
1189 --prefix=PREFIX install in PREFIX [$prefix]
1190 --interp-prefix=PREFIX where to find shared libraries, etc.
1191 use %M for cpu name [$interp_prefix]
1192 --target-list=LIST set target list (default: build all)
1193 $(echo Available targets: $default_target_list | \
1194 fold -s -w 53 | sed -e 's/^/ /')
1195 --target-list-exclude=LIST exclude a set of targets from the default target-list
1197 Advanced options (experts only):
1198 --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix]
1199 --cc=CC use C compiler CC [$cc]
1200 --iasl=IASL use ACPI compiler IASL [$iasl]
1201 --host-cc=CC use C compiler CC [$host_cc] for code run at
1203 --cxx=CXX use C++ compiler CXX [$cxx]
1204 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1205 --extra-cflags=CFLAGS append extra C compiler flags CFLAGS
1206 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
1207 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1208 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases
1209 --cross-cc-cflags-ARCH= use compiler flags when building ARCH guest tests
1210 --make=MAKE use specified make [$make]
1211 --python=PYTHON use specified python [$python]
1212 --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build]
1213 --meson=MESON use specified meson [$meson]
1214 --ninja=NINJA use specified ninja [$ninja]
1215 --smbd=SMBD use specified smbd [$smbd]
1216 --with-git=GIT use specified git [$git]
1217 --with-git-submodules=update update git submodules (default if .git dir exists)
1218 --with-git-submodules=validate fail if git submodules are not up to date
1219 --with-git-submodules=ignore do not update or check git submodules (default if no .git dir)
1220 --static enable static build [$static]
1221 --mandir=PATH install man pages in PATH
1222 --datadir=PATH install firmware in PATH/$qemu_suffix
1223 --localedir=PATH install translation in PATH/$qemu_suffix
1224 --docdir=PATH install documentation in PATH/$qemu_suffix
1225 --bindir=PATH install binaries in PATH
1226 --libdir=PATH install libraries in PATH
1227 --libexecdir=PATH install helper binaries in PATH
1228 --sysconfdir=PATH install config in PATH/$qemu_suffix
1229 --localstatedir=PATH install local state in PATH (set at runtime on win32)
1230 --firmwarepath=PATH search PATH for firmware files
1231 --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs.
1232 --with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
1233 --with-pkgversion=VERS use specified string as sub-version of the package
1234 --without-default-features default all --enable-* options to "disabled"
1235 --without-default-devices do not include any device that is not needed to
1236 start the emulator (only use if you are including
1237 desired devices in configs/devices/)
1238 --with-devices-ARCH=NAME override default configs/devices
1239 --enable-debug enable common debug build options
1240 --enable-sanitizers enable default sanitizers
1241 --enable-tsan enable thread sanitizer
1242 --disable-werror disable compilation abort on warning
1243 --disable-stack-protector disable compiler-provided stack protection
1244 --audio-drv-list=LIST set audio drivers to try if -audiodev is not used
1245 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1246 --block-drv-rw-whitelist=L
1247 set block driver read-write whitelist
1248 (by default affects only QEMU, not tools like qemu-img)
1249 --block-drv-ro-whitelist=L
1250 set block driver read-only whitelist
1251 (by default affects only QEMU, not tools like qemu-img)
1252 --with-trace-file=NAME Full PATH,NAME of file to store traces
1254 --cpu=CPU Build for host CPU [$cpu]
1255 --with-coroutine=BACKEND coroutine backend. Supported options:
1256 ucontext, sigaltstack, windows
1257 --enable-gcov enable test coverage analysis with gcov
1258 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1259 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1260 --tls-priority default TLS protocol/cipher priority string
1261 --enable-debug-stack-usage
1262 track the maximum stack usage of stacks created by qemu_alloc_stack
1264 enable plugins via shared library loading
1265 --disable-containers don't use containers for cross-building
1266 --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin]
1270 system all system emulation targets
1271 user supported user emulation targets
1272 linux-user all linux usermode emulation targets
1273 bsd-user all BSD usermode emulation targets
1274 guest-agent build the QEMU Guest Agent
1275 pie Position Independent Executables
1276 modules modules support (non-Windows)
1277 module-upgrades try to load modules from alternate paths for upgrades
1278 debug-tcg TCG debugging (default is disabled)
1279 debug-info debugging information
1280 lto Enable Link-Time Optimization.
1281 safe-stack SafeStack Stack Smash Protection. Depends on
1282 clang/llvm >= 3.7 and requires coroutine backend ucontext.
1283 rdma Enable RDMA-based migration
1284 pvrdma Enable PVRDMA support
1285 vhost-net vhost-net kernel acceleration support
1286 vhost-vsock virtio sockets device support
1287 vhost-scsi vhost-scsi kernel target support
1288 vhost-crypto vhost-user-crypto backend support
1289 vhost-kernel vhost kernel backend support
1290 vhost-user vhost-user backend support
1291 vhost-vdpa vhost-vdpa kernel backend support
1292 coroutine-pool coroutine freelist (better performance)
1293 opengl opengl support
1294 tools build qemu-io, qemu-nbd and qemu-img tools
1296 slirp-smbd use smbd (at path --smbd=*) in slirp networking
1298 NOTE: The object files are built at the place where configure is launched
1303 # Remove old dependency files to make sure that they get properly regenerated
1304 rm -f */config-devices.mak.d
1306 if test -z "$python"
1308 error_exit
"Python not found. Use --python=/path/to/python"
1312 error_exit
"GNU make ($make) not found"
1315 # Note that if the Python conditional here evaluates True we will exit
1316 # with status 1 which is a shell 'false' value.
1317 if ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then
1318 error_exit
"Cannot use '$python', Python >= 3.6 is required." \
1319 "Use --python=/path/to/python to specify a supported Python."
1322 # Preserve python version since some functionality is dependent on it
1323 python_version
=$
($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev
/null
)
1325 # Suppress writing compiled files
1328 if test -z "$meson"; then
1329 if test "$explicit_python" = no
&& has meson
&& version_ge
"$(meson --version)" 0.59.3; then
1331 elif test $git_submodules_action != 'ignore' ; then
1333 elif test -e "${source_path}/meson/meson.py" ; then
1336 if test "$explicit_python" = yes; then
1337 error_exit
"--python requires using QEMU's embedded Meson distribution, but it was not found."
1339 error_exit
"Meson not found. Use --meson=/path/to/meson"
1343 # Meson uses its own Python interpreter to invoke other Python scripts,
1344 # but the user wants to use the one they specified with --python.
1346 # We do not want to override the distro Python interpreter (and sometimes
1347 # cannot: for example in Homebrew /usr/bin/meson is a bash script), so
1348 # just require --meson=git|internal together with --python.
1349 if test "$explicit_python" = yes; then
1352 *) error_exit
"--python requires using QEMU's embedded Meson distribution." ;;
1357 if test "$meson" = git
; then
1358 git_submodules
="${git_submodules} meson"
1363 meson
="$python ${source_path}/meson/meson.py"
1365 *) meson
=$
(command -v "$meson") ;;
1370 if test -z "$ninja"; then
1371 for c
in ninja ninja-build samu
; do
1373 ninja
=$
(command -v "$c")
1377 if test -z "$ninja"; then
1378 error_exit
"Cannot find Ninja"
1382 # Check that the C compiler works. Doing this here before testing
1383 # the host CPU ensures that we had a valid CC to autodetect the
1384 # $cpu var (and we should bail right here if that's not the case).
1385 # It also allows the help message to be printed without a CC.
1387 if compile_object
; then
1388 : C compiler works ok
1390 error_exit
"\"$cc\" either does not exist or does not work"
1392 if ! compile_prog
; then
1393 error_exit
"\"$cc\" cannot build an executable (is your linker broken?)"
1396 # Consult white-list to determine whether to enable werror
1397 # by default. Only enable by default for git builds
1398 if test -z "$werror" ; then
1399 if test "$git_submodules_action" != "ignore" && \
1400 { test "$linux" = "yes" ||
test "$mingw32" = "yes"; }; then
1407 if test "$targetos" = "bogus"; then
1408 # Now that we know that we're not printing the help and that
1409 # the compiler works (so the results of the check_defines we used
1410 # to identify the OS are reliable), if we didn't recognize the
1411 # host OS we should stop now.
1412 error_exit
"Unrecognized host OS (uname -s reports '$(uname -s)')"
1415 # Check whether the compiler matches our minimum requirements:
1417 #if defined(__clang_major__) && defined(__clang_minor__)
1418 # ifdef __apple_build_version__
1419 # if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0)
1420 # error You need at least XCode Clang v10.0 to compile QEMU
1423 # if __clang_major__ < 6 || (__clang_major__ == 6 && __clang_minor__ < 0)
1424 # error You need at least Clang v6.0 to compile QEMU
1427 #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
1428 # if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4)
1429 # error You need at least GCC v7.4.0 to compile QEMU
1432 # error You either need GCC or Clang to compiler QEMU
1434 int main (void) { return 0; }
1436 if ! compile_prog
"" "" ; then
1437 error_exit
"You need at least GCC v7.4 or Clang v6.0 (or XCode Clang v10.0)"
1440 # Accumulate -Wfoo and -Wno-bar separately.
1441 # We will list all of the enable flags first, and the disable flags second.
1442 # Note that we do not add -Werror, because that would enable it for all
1443 # configure tests. If a configure test failed due to -Werror this would
1444 # just silently disable some features, so it's too error prone.
1447 add_to warn_flags
-Wold-style-declaration
1448 add_to warn_flags
-Wold-style-definition
1449 add_to warn_flags
-Wtype-limits
1450 add_to warn_flags
-Wformat-security
1451 add_to warn_flags
-Wformat-y2k
1452 add_to warn_flags
-Winit-self
1453 add_to warn_flags
-Wignored-qualifiers
1454 add_to warn_flags
-Wempty-body
1455 add_to warn_flags
-Wnested-externs
1456 add_to warn_flags
-Wendif-labels
1457 add_to warn_flags
-Wexpansion-to-defined
1458 add_to warn_flags
-Wimplicit-fallthrough=2
1461 add_to nowarn_flags
-Wno-initializer-overrides
1462 add_to nowarn_flags
-Wno-missing-include-dirs
1463 add_to nowarn_flags
-Wno-shift-negative-value
1464 add_to nowarn_flags
-Wno-string-plus-int
1465 add_to nowarn_flags
-Wno-typedef-redefinition
1466 add_to nowarn_flags
-Wno-tautological-type-limit-compare
1467 add_to nowarn_flags
-Wno-psabi
1469 gcc_flags
="$warn_flags $nowarn_flags"
1471 cc_has_warning_flag
() {
1474 # Use the positive sense of the flag when testing for -Wno-wombat
1475 # support (gcc will happily accept the -Wno- form of unknown
1477 optflag
="$(echo $1 | sed -e 's/^-Wno-/-W/')"
1478 compile_prog
"-Werror $optflag" ""
1481 for flag
in $gcc_flags; do
1482 if cc_has_warning_flag
$flag ; then
1483 QEMU_CFLAGS
="$QEMU_CFLAGS $flag"
1487 if test "$stack_protector" != "no"; then
1489 int main(int argc, char *argv[])
1491 char arr[64], *p = arr, *c = argv[0];
1498 gcc_flags
="-fstack-protector-strong -fstack-protector-all"
1500 for flag
in $gcc_flags; do
1501 # We need to check both a compile and a link, since some compiler
1502 # setups fail only on a .c->.o compile and some only at link time
1503 if compile_object
"-Werror $flag" &&
1504 compile_prog
"-Werror $flag" ""; then
1505 QEMU_CFLAGS
="$QEMU_CFLAGS $flag"
1506 QEMU_LDFLAGS
="$QEMU_LDFLAGS $flag"
1511 if test "$stack_protector" = yes; then
1512 if test $sp_on = 0; then
1513 error_exit
"Stack protector not supported"
1518 # Disable -Wmissing-braces on older compilers that warn even for
1519 # the "universal" C zero initializer {0}.
1525 if compile_object
"-Werror" "" ; then
1528 QEMU_CFLAGS
="$QEMU_CFLAGS -Wno-missing-braces"
1531 # Our module code doesn't support Windows
1532 if test "$modules" = "yes" && test "$mingw32" = "yes" ; then
1533 error_exit
"Modules are not available for Windows"
1536 # module_upgrades is only reasonable if modules are enabled
1537 if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then
1538 error_exit
"Can't enable module-upgrades as Modules are not enabled"
1541 # Static linking is not possible with plugins, modules or PIE
1542 if test "$static" = "yes" ; then
1543 if test "$modules" = "yes" ; then
1544 error_exit
"static and modules are mutually incompatible"
1546 if test "$plugins" = "yes"; then
1547 error_exit
"static and plugins are mutually incompatible"
1552 test "$plugins" = "" && plugins
=yes
1557 # define THREAD __thread
1561 static THREAD int tls_var;
1562 int main(void) { return tls_var; }
1565 # Check we support -fno-pie and -no-pie first; we will need the former for
1566 # building ROMs, and both for everything if --disable-pie is passed.
1567 if compile_prog
"-Werror -fno-pie" "-no-pie"; then
1568 CFLAGS_NOPIE
="-fno-pie"
1569 LDFLAGS_NOPIE
="-no-pie"
1572 if test "$static" = "yes"; then
1573 if test "$pie" != "no" && compile_prog
"-Werror -fPIE -DPIE" "-static-pie"; then
1574 CONFIGURE_CFLAGS
="-fPIE -DPIE $CONFIGURE_CFLAGS"
1575 QEMU_LDFLAGS
="-static-pie $QEMU_LDFLAGS"
1577 elif test "$pie" = "yes"; then
1578 error_exit
"-static-pie not available due to missing toolchain support"
1580 QEMU_LDFLAGS
="-static $QEMU_LDFLAGS"
1583 elif test "$pie" = "no"; then
1584 CONFIGURE_CFLAGS
="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
1585 CONFIGURE_LDFLAGS
="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
1586 elif compile_prog
"-Werror -fPIE -DPIE" "-pie"; then
1587 CONFIGURE_CFLAGS
="-fPIE -DPIE $CONFIGURE_CFLAGS"
1588 CONFIGURE_LDFLAGS
="-pie $CONFIGURE_LDFLAGS"
1590 elif test "$pie" = "yes"; then
1591 error_exit
"PIE not available due to missing toolchain support"
1593 echo "Disabling PIE due to missing toolchain support"
1597 # Detect support for PT_GNU_RELRO + DT_BIND_NOW.
1598 # The combination is known as "full relro", because .got.plt is read-only too.
1599 if compile_prog
"" "-Wl,-z,relro -Wl,-z,now" ; then
1600 QEMU_LDFLAGS
="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS"
1603 ##########################################
1604 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
1605 # use i686 as default anyway, but for those that don't, an explicit
1606 # specification is necessary
1608 if test "$cpu" = "i386"; then
1610 static int sfaa(int *ptr)
1612 return __sync_fetch_and_and(ptr, 0);
1618 val = __sync_val_compare_and_swap(&val, 0, 1);
1623 if ! compile_prog
"" "" ; then
1624 QEMU_CFLAGS
="-march=i486 $QEMU_CFLAGS"
1628 if test "$tcg" = "enabled"; then
1629 git_submodules
="$git_submodules tests/fp/berkeley-testfloat-3"
1630 git_submodules
="$git_submodules tests/fp/berkeley-softfloat-3"
1633 if test -z "${target_list+xxx}" ; then
1635 for target
in $default_target_list; do
1636 target_list
="$target_list $target"
1638 target_list
="${target_list# }"
1641 target_list
=$
(echo "$target_list" |
sed -e 's/,/ /g')
1642 for target
in $target_list; do
1643 # Check that we recognised the target name; this allows a more
1644 # friendly error message than if we let it fall through.
1645 case " $default_target_list " in
1649 error_exit
"Unknown target name '$target'"
1655 # see if system emulation was really requested
1656 case " $target_list " in
1657 *"-softmmu "*) softmmu
=yes
1663 feature_not_found
() {
1667 error_exit
"User requested feature $feature" \
1668 "configure was not able to find it." \
1673 # big/little endian test
1676 short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1677 short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1678 int main(int argc, char *argv[])
1680 return printf("%s %s\n", (char *)big_endian, (char *)little_endian);
1684 if compile_prog
; then
1685 if strings -a $TMPE |
grep -q BiGeNdIaN
; then
1687 elif strings -a $TMPE |
grep -q LiTtLeEnDiAn
; then
1690 echo big
/little
test failed
1694 echo big
/little
test failed
1698 ##########################################
1700 if test -z "$want_tools"; then
1701 if test "$softmmu" = "no"; then
1708 #########################################
1709 # vhost interdependencies and host support
1712 if test "$vhost_user" = "yes" && test "$linux" != "yes"; then
1713 error_exit
"vhost-user is only available on Linux"
1715 test "$vhost_vdpa" = "" && vhost_vdpa
=$linux
1716 if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then
1717 error_exit
"vhost-vdpa is only available on Linux"
1719 test "$vhost_kernel" = "" && vhost_kernel
=$linux
1720 if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then
1721 error_exit
"vhost-kernel is only available on Linux"
1724 # vhost-kernel devices
1725 test "$vhost_scsi" = "" && vhost_scsi
=$vhost_kernel
1726 if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then
1727 error_exit
"--enable-vhost-scsi requires --enable-vhost-kernel"
1729 test "$vhost_vsock" = "" && vhost_vsock
=$vhost_kernel
1730 if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then
1731 error_exit
"--enable-vhost-vsock requires --enable-vhost-kernel"
1734 # vhost-user backends
1735 test "$vhost_net_user" = "" && vhost_net_user
=$vhost_user
1736 if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then
1737 error_exit
"--enable-vhost-net-user requires --enable-vhost-user"
1739 test "$vhost_crypto" = "" && vhost_crypto
=$vhost_user
1740 if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
1741 error_exit
"--enable-vhost-crypto requires --enable-vhost-user"
1743 test "$vhost_user_fs" = "" && vhost_user_fs
=$vhost_user
1744 if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then
1745 error_exit
"--enable-vhost-user-fs requires --enable-vhost-user"
1747 #vhost-vdpa backends
1748 test "$vhost_net_vdpa" = "" && vhost_net_vdpa
=$vhost_vdpa
1749 if test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then
1750 error_exit
"--enable-vhost-net-vdpa requires --enable-vhost-vdpa"
1753 # OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity
1754 if test "$vhost_net" = ""; then
1755 test "$vhost_net_user" = "yes" && vhost_net
=yes
1756 test "$vhost_net_vdpa" = "yes" && vhost_net
=yes
1757 test "$vhost_kernel" = "yes" && vhost_net
=yes
1760 ##########################################
1763 if ! has
"$pkg_config_exe"; then
1764 error_exit
"pkg-config binary '$pkg_config_exe' not found"
1767 ##########################################
1770 if test "$xen" != "disabled" ; then
1771 # Check whether Xen library path is specified via --extra-ldflags to avoid
1772 # overriding this setting with pkg-config output. If not, try pkg-config
1773 # to obtain all needed flags.
1775 if ! echo $EXTRA_LDFLAGS |
grep tools
/libxc
> /dev
/null
&& \
1776 $pkg_config --exists xencontrol
; then
1777 xen_ctrl_version
="$(printf '%d%02d%02d' \
1778 $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
1780 xen_pc
="xencontrol xenstore xenforeignmemory xengnttab"
1781 xen_pc
="$xen_pc xenevtchn xendevicemodel"
1782 if $pkg_config --exists xentoolcore
; then
1783 xen_pc
="$xen_pc xentoolcore"
1785 xen_cflags
="$($pkg_config --cflags $xen_pc)"
1786 xen_libs
="$($pkg_config --libs $xen_pc)"
1789 xen_libs
="-lxenstore -lxenctrl"
1790 xen_stable_libs
="-lxenforeignmemory -lxengnttab -lxenevtchn"
1792 # First we test whether Xen headers and libraries are available.
1793 # If no, we are done and there is no Xen support.
1794 # If yes, more tests are run to detect the Xen version.
1798 #include <xenctrl.h>
1803 if ! compile_prog
"" "$xen_libs" ; then
1805 if test "$xen" = "enabled" ; then
1806 feature_not_found
"xen" "Install xen devel"
1812 cat > $TMPC <<EOF &&
1813 #undef XC_WANT_COMPAT_DEVICEMODEL_API
1814 #define __XEN_TOOLS__
1815 #include <xendevicemodel.h>
1816 #include <xenforeignmemory.h>
1818 xendevicemodel_handle *xd;
1819 xenforeignmemory_handle *xfmem;
1821 xd = xendevicemodel_open(0, 0);
1822 xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0);
1824 xfmem = xenforeignmemory_open(0, 0);
1825 xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0);
1830 compile_prog
"" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
1832 xen_stable_libs
="-lxendevicemodel $xen_stable_libs -lxentoolcore"
1833 xen_ctrl_version
=41100
1836 cat > $TMPC <<EOF &&
1837 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
1838 #include <xenforeignmemory.h>
1839 #include <xentoolcore.h>
1841 xenforeignmemory_handle *xfmem;
1843 xfmem = xenforeignmemory_open(0, 0);
1844 xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0);
1845 xentoolcore_restrict_all(0);
1850 compile_prog
"" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
1852 xen_stable_libs
="-lxendevicemodel $xen_stable_libs -lxentoolcore"
1853 xen_ctrl_version
=41000
1856 cat > $TMPC <<EOF &&
1857 #undef XC_WANT_COMPAT_DEVICEMODEL_API
1858 #define __XEN_TOOLS__
1859 #include <xendevicemodel.h>
1861 xendevicemodel_handle *xd;
1863 xd = xendevicemodel_open(0, 0);
1864 xendevicemodel_close(xd);
1869 compile_prog
"" "$xen_libs -lxendevicemodel $xen_stable_libs"
1871 xen_stable_libs
="-lxendevicemodel $xen_stable_libs"
1872 xen_ctrl_version
=40900
1875 cat > $TMPC <<EOF &&
1877 * If we have stable libs the we don't want the libxc compat
1878 * layers, regardless of what CFLAGS we may have been given.
1880 * Also, check if xengnttab_grant_copy_segment_t is defined and
1881 * grant copy operation is implemented.
1883 #undef XC_WANT_COMPAT_EVTCHN_API
1884 #undef XC_WANT_COMPAT_GNTTAB_API
1885 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
1886 #include <xenctrl.h>
1887 #include <xenstore.h>
1888 #include <xenevtchn.h>
1889 #include <xengnttab.h>
1890 #include <xenforeignmemory.h>
1892 #include <xen/hvm/hvm_info_table.h>
1893 #if !defined(HVM_MAX_VCPUS)
1894 # error HVM_MAX_VCPUS not defined
1897 xc_interface *xc = NULL;
1898 xenforeignmemory_handle *xfmem;
1899 xenevtchn_handle *xe;
1900 xengnttab_handle *xg;
1901 xengnttab_grant_copy_segment_t* seg = NULL;
1905 xc = xc_interface_open(0, 0, 0);
1906 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1907 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1908 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1909 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
1911 xfmem = xenforeignmemory_open(0, 0);
1912 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
1914 xe = xenevtchn_open(0, 0);
1917 xg = xengnttab_open(0, 0);
1918 xengnttab_grant_copy(xg, 0, seg);
1923 compile_prog
"" "$xen_libs $xen_stable_libs"
1925 xen_ctrl_version
=40800
1928 cat > $TMPC <<EOF &&
1930 * If we have stable libs the we don't want the libxc compat
1931 * layers, regardless of what CFLAGS we may have been given.
1933 #undef XC_WANT_COMPAT_EVTCHN_API
1934 #undef XC_WANT_COMPAT_GNTTAB_API
1935 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
1936 #include <xenctrl.h>
1937 #include <xenstore.h>
1938 #include <xenevtchn.h>
1939 #include <xengnttab.h>
1940 #include <xenforeignmemory.h>
1942 #include <xen/hvm/hvm_info_table.h>
1943 #if !defined(HVM_MAX_VCPUS)
1944 # error HVM_MAX_VCPUS not defined
1947 xc_interface *xc = NULL;
1948 xenforeignmemory_handle *xfmem;
1949 xenevtchn_handle *xe;
1950 xengnttab_handle *xg;
1954 xc = xc_interface_open(0, 0, 0);
1955 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1956 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1957 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1958 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
1960 xfmem = xenforeignmemory_open(0, 0);
1961 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
1963 xe = xenevtchn_open(0, 0);
1966 xg = xengnttab_open(0, 0);
1967 xengnttab_map_grant_ref(xg, 0, 0, 0);
1972 compile_prog
"" "$xen_libs $xen_stable_libs"
1974 xen_ctrl_version
=40701
1979 cat > $TMPC <<EOF &&
1980 #include <xenctrl.h>
1981 #include <xenstore.h>
1983 #include <xen/hvm/hvm_info_table.h>
1984 #if !defined(HVM_MAX_VCPUS)
1985 # error HVM_MAX_VCPUS not defined
1990 xc = xc_interface_open(0, 0, 0);
1991 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1992 xc_gnttab_open(NULL, 0);
1993 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1994 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1995 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
1996 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
2000 compile_prog
"" "$xen_libs"
2002 xen_ctrl_version
=40600
2007 cat > $TMPC <<EOF &&
2008 #include <xenctrl.h>
2009 #include <xenstore.h>
2011 #include <xen/hvm/hvm_info_table.h>
2012 #if !defined(HVM_MAX_VCPUS)
2013 # error HVM_MAX_VCPUS not defined
2018 xc = xc_interface_open(0, 0, 0);
2019 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2020 xc_gnttab_open(NULL, 0);
2021 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2022 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2023 xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
2027 compile_prog
"" "$xen_libs"
2029 xen_ctrl_version
=40500
2033 cat > $TMPC <<EOF &&
2034 #include <xenctrl.h>
2035 #include <xenstore.h>
2037 #include <xen/hvm/hvm_info_table.h>
2038 #if !defined(HVM_MAX_VCPUS)
2039 # error HVM_MAX_VCPUS not defined
2044 xc = xc_interface_open(0, 0, 0);
2045 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2046 xc_gnttab_open(NULL, 0);
2047 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2048 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2052 compile_prog
"" "$xen_libs"
2054 xen_ctrl_version
=40200
2058 if test "$xen" = "enabled" ; then
2059 feature_not_found
"xen (unsupported version)" \
2060 "Install a supported xen (xen 4.2 or newer)"
2065 if test "$xen" = enabled
; then
2066 if test $xen_ctrl_version -ge 40701 ; then
2067 xen_libs
="$xen_libs $xen_stable_libs "
2073 ##########################################
2074 # RDMA needs OpenFabrics libraries
2075 if test "$rdma" != "no" ; then
2077 #include <rdma/rdma_cma.h>
2078 int main(void) { return 0; }
2080 rdma_libs
="-lrdmacm -libverbs -libumad"
2081 if compile_prog
"" "$rdma_libs" ; then
2084 if test "$rdma" = "yes" ; then
2086 " OpenFabrics librdmacm/libibverbs/libibumad not present." \
2088 " (1) Fast: Install infiniband packages (devel) from your distro." \
2089 " (2) Cleanest: Install libraries from www.openfabrics.org" \
2090 " (3) Also: Install softiwarp if you don't have RDMA hardware"
2096 ##########################################
2099 cat > $TMPC <<EOF &&
2100 #include <sys/mman.h>
2107 addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED);
2113 if test "$rdma" = "yes" ; then
2116 if compile_prog
"" ""; then
2123 if ! compile_prog
"" ""; then
2124 error_exit
"PVRDMA is not supported since mremap is not implemented"
2133 if test "$pvrdma" = "yes" ; then
2134 error_exit
"PVRDMA requires rdma suppport"
2139 # Let's see if enhanced reg_mr is supported
2140 if test "$pvrdma" = "yes" ; then
2142 cat > $TMPC <<EOF &&
2143 #include <infiniband/verbs.h>
2149 struct ibv_pd *pd = NULL;
2155 mr = ibv_reg_mr_iova(pd, addr, length, iova, access);
2162 if ! compile_prog
"" "-libverbs"; then
2163 QEMU_CFLAGS
="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR"
2167 ##########################################
2168 # glib support probe
2171 glib_modules
=gthread-2.0
2172 if test "$modules" = yes; then
2173 glib_modules
="$glib_modules gmodule-export-2.0"
2174 elif test "$plugins" = "yes"; then
2175 glib_modules
="$glib_modules gmodule-no-export-2.0"
2178 for i
in $glib_modules; do
2179 if $pkg_config --atleast-version=$glib_req_ver $i; then
2180 glib_cflags
=$
($pkg_config --cflags $i)
2181 glib_libs
=$
($pkg_config --libs $i)
2183 error_exit
"glib-$glib_req_ver $i is required to compile QEMU"
2187 # This workaround is required due to a bug in pkg-config file for glib as it
2188 # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
2190 if test "$static" = yes && test "$mingw32" = yes; then
2191 glib_cflags
="-DGLIB_STATIC_COMPILATION $glib_cflags"
2194 if ! test "$gio" = "no"; then
2196 if $pkg_config --atleast-version=$glib_req_ver gio-2.0
; then
2197 gio_cflags
=$
($pkg_config --cflags gio-2.0
)
2198 gio_libs
=$
($pkg_config --libs gio-2.0
)
2199 gdbus_codegen
=$
($pkg_config --variable=gdbus_codegen gio-2.0
)
2200 if ! has
"$gdbus_codegen"; then
2203 # Check that the libraries actually work -- Ubuntu 18.04 ships
2204 # with pkg-config --static --libs data for gio-2.0 that is missing
2205 # -lblkid and will give a link error.
2207 #include <gio/gio.h>
2210 g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
2214 if compile_prog
"$gio_cflags" "$gio_libs" ; then
2220 if test "$pass" = "yes" &&
2221 $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0
; then
2222 gio_cflags
="$gio_cflags $($pkg_config --cflags gio-unix-2.0)"
2223 gio_libs
="$gio_libs $($pkg_config --libs gio-unix-2.0)"
2227 if test "$pass" = "no"; then
2228 if test "$gio" = "yes"; then
2229 feature_not_found
"gio" "Install libgio >= 2.0"
2238 # Sanity check that the current size_t matches the
2239 # size that glib thinks it should be. This catches
2240 # problems on multi-arch where people try to build
2241 # 32-bit QEMU while pointing at 64-bit glib headers
2246 #define QEMU_BUILD_BUG_ON(x) \
2247 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
2250 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
2255 if ! compile_prog
"$glib_cflags" "$glib_libs" ; then
2256 error_exit
"sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
2257 "You probably need to set PKG_CONFIG_LIBDIR"\
2258 "to point to the right pkg-config files for your"\
2262 # Silence clang warnings triggered by glib < 2.57.2
2265 typedef struct Foo {
2268 static void foo_free(Foo *f)
2272 G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free);
2273 int main(void) { return 0; }
2275 if ! compile_prog
"$glib_cflags -Werror" "$glib_libs" ; then
2276 if cc_has_warning_flag
"-Wno-unused-function"; then
2277 glib_cflags
="$glib_cflags -Wno-unused-function"
2278 CONFIGURE_CFLAGS
="$CONFIGURE_CFLAGS -Wno-unused-function"
2282 ##########################################
2283 # SHA command probe for modules
2284 if test "$modules" = yes; then
2285 shacmd_probe
="sha1sum sha1 shasum"
2286 for c
in $shacmd_probe; do
2292 if test "$shacmd" = ""; then
2293 error_exit
"one of the checksum commands is required to enable modules: $shacmd_probe"
2297 ##########################################
2301 auto | enabled | internal
)
2302 # Simpler to always update submodule, even if not needed.
2303 git_submodules
="${git_submodules} dtc"
2307 ##########################################
2308 # opengl probe (for sdl2, gtk)
2310 if test "$opengl" != "no" ; then
2312 if $pkg_config epoxy
; then
2314 #include <epoxy/egl.h>
2315 int main(void) { return 0; }
2317 if compile_prog
"" "" ; then
2322 if test "$epoxy" = "yes" ; then
2323 opengl_cflags
="$($pkg_config --cflags epoxy)"
2324 opengl_libs
="$($pkg_config --libs epoxy)"
2327 if test "$opengl" = "yes" ; then
2328 feature_not_found
"opengl" "Please install epoxy with EGL"
2338 if test "$linux_user" = "yes"; then
2340 #include <linux/usbdevice_fs.h>
2342 #ifndef USBDEVFS_GET_CAPABILITIES
2343 #error "USBDEVFS_GET_CAPABILITIES undefined"
2346 #ifndef USBDEVFS_DISCONNECT_CLAIM
2347 #error "USBDEVFS_DISCONNECT_CLAIM undefined"
2355 if compile_prog
"" ""; then
2360 ##########################################
2361 # check if we have VSS SDK headers for win
2363 guest_agent_with_vss
="no"
2364 if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \
2365 test "$vss_win32_sdk" != "no" ; then
2366 case "$vss_win32_sdk" in
2367 "") vss_win32_include
="-isystem $source_path" ;;
2368 *\
*) # The SDK is installed in "Program Files" by default, but we cannot
2369 # handle path with spaces. So we symlink the headers into ".sdk/vss".
2370 vss_win32_include
="-isystem $source_path/.sdk/vss"
2371 symlink
"$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
2373 *) vss_win32_include
="-isystem $vss_win32_sdk"
2376 #define __MIDL_user_allocate_free_DEFINED__
2377 #include <inc/win2003/vss.h>
2378 int main(void) { return VSS_CTX_BACKUP; }
2380 if compile_prog
"$vss_win32_include" "" ; then
2381 guest_agent_with_vss
="yes"
2382 QEMU_CFLAGS
="$QEMU_CFLAGS $vss_win32_include"
2384 if test "$vss_win32_sdk" != "" ; then
2385 echo "ERROR: Please download and install Microsoft VSS SDK:"
2386 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
2387 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
2388 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
2389 echo "ERROR: The headers are extracted in the directory \`inc'."
2390 feature_not_found
"VSS support"
2395 ##########################################
2396 # lookup Windows platform SDK (if not specified)
2397 # The SDK is needed only to build .tlb (type library) file of guest agent
2398 # VSS provider from the source. It is usually unnecessary because the
2399 # pre-compiled .tlb file is included.
2401 if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \
2402 test "$guest_agent_with_vss" = "yes" ; then
2403 if test -z "$win_sdk"; then
2404 programfiles
="$PROGRAMFILES"
2405 test -n "$PROGRAMW6432" && programfiles
="$PROGRAMW6432"
2406 if test -n "$programfiles"; then
2407 win_sdk
=$
(ls -d "$programfiles/Microsoft SDKs/Windows/v"* |
tail -1) 2>/dev
/null
2409 feature_not_found
"Windows SDK"
2411 elif test "$win_sdk" = "no"; then
2416 ##########################################
2417 # check if mingw environment provides a recent ntddscsi.h
2418 guest_agent_ntddscsi
="no"
2419 if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then
2421 #include <windows.h>
2422 #include <ntddscsi.h>
2424 #if !defined(IOCTL_SCSI_GET_ADDRESS)
2425 #error Missing required ioctl definitions
2427 SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
2431 if compile_prog
"" "" ; then
2432 guest_agent_ntddscsi
=yes
2436 ##########################################
2440 auto | enabled | internal
)
2441 # Simpler to always update submodule, even if not needed.
2442 git_submodules
="${git_submodules} capstone"
2446 ##########################################
2447 # check and set a backend for coroutine
2449 # We prefer ucontext, but it's not always possible. The fallback
2450 # is sigcontext. On Windows the only valid backend is the Windows
2454 if test "$darwin" != "yes"; then
2456 #include <ucontext.h>
2457 #ifdef __stub_makecontext
2458 #error Ignoring glibc stub makecontext which will always fail
2460 int main(void) { makecontext(0, 0, 0); return 0; }
2462 if compile_prog
"" "" ; then
2467 if test "$coroutine" = ""; then
2468 if test "$mingw32" = "yes"; then
2470 elif test "$ucontext_works" = "yes"; then
2473 coroutine
=sigaltstack
2478 if test "$mingw32" != "yes"; then
2479 error_exit
"'windows' coroutine backend only valid for Windows"
2481 # Unfortunately the user visible backend name doesn't match the
2482 # coroutine-*.c filename for this case, so we have to adjust it here.
2486 if test "$ucontext_works" != "yes"; then
2487 feature_not_found
"ucontext"
2491 if test "$mingw32" = "yes"; then
2492 error_exit
"only the 'windows' coroutine backend is valid for Windows"
2496 error_exit
"unknown coroutine backend $coroutine"
2501 if test "$coroutine_pool" = ""; then
2505 if test "$debug_stack_usage" = "yes"; then
2506 if test "$coroutine_pool" = "yes"; then
2507 echo "WARN: disabling coroutine pool for stack usage debugging"
2512 ##################################################
2516 if test "$safe_stack" = "yes"; then
2518 int main(int argc, char *argv[])
2520 #if ! __has_feature(safe_stack)
2521 #error SafeStack Disabled
2526 flag
="-fsanitize=safe-stack"
2527 # Check that safe-stack is supported and enabled.
2528 if compile_prog
"-Werror $flag" "$flag"; then
2529 # Flag needed both at compilation and at linking
2530 QEMU_CFLAGS
="$QEMU_CFLAGS $flag"
2531 QEMU_LDFLAGS
="$QEMU_LDFLAGS $flag"
2533 error_exit
"SafeStack not supported by your compiler"
2535 if test "$coroutine" != "ucontext"; then
2536 error_exit
"SafeStack is only supported by the coroutine backend ucontext"
2540 int main(int argc, char *argv[])
2542 #if defined(__has_feature)
2543 #if __has_feature(safe_stack)
2544 #error SafeStack Enabled
2550 if test "$safe_stack" = "no"; then
2551 # Make sure that safe-stack is disabled
2552 if ! compile_prog
"-Werror" ""; then
2553 # SafeStack was already enabled, try to explicitly remove the feature
2554 flag
="-fno-sanitize=safe-stack"
2555 if ! compile_prog
"-Werror $flag" "$flag"; then
2556 error_exit
"Configure cannot disable SafeStack"
2558 QEMU_CFLAGS
="$QEMU_CFLAGS $flag"
2559 QEMU_LDFLAGS
="$QEMU_LDFLAGS $flag"
2561 else # "$safe_stack" = ""
2562 # Set safe_stack to yes or no based on pre-existing flags
2563 if compile_prog
"-Werror" ""; then
2567 if test "$coroutine" != "ucontext"; then
2568 error_exit
"SafeStack is only supported by the coroutine backend ucontext"
2574 ########################################
2575 # check if __[u]int128_t is usable.
2588 if compile_prog
"" "" ; then
2592 #########################################
2593 # See if 128-bit atomic operations are supported.
2596 if test "$int128" = "yes"; then
2600 unsigned __int128 x = 0, y = 0;
2601 y = __atomic_load(&x, 0);
2602 __atomic_store(&x, y, 0);
2603 __atomic_compare_exchange(&x, &y, x, 0, 0, 0);
2607 if compile_prog
"" "" ; then
2613 if test "$int128" = yes && test "$atomic128" = no
; then
2617 unsigned __int128 x = 0, y = 0;
2618 __sync_val_compare_and_swap_16(&x, y, x);
2622 if compile_prog
"" "" ; then
2627 ########################################
2628 # check if ccache is interfering with
2629 # semantic analysis of macros
2634 static const int Z = 1;
2635 #define fn() ({ Z; })
2636 #define TAUT(X) ((X) == Z)
2637 #define PAREN(X, Y) (X == Y)
2639 int main(int argc, char *argv[])
2645 if (PAREN(x, y)) return 0;
2646 if (TAUT(Z)) return 0;
2651 if ! compile_object
"-Werror"; then
2655 #################################################
2656 # clang does not support glibc + FORTIFY_SOURCE.
2658 if test "$fortify_source" != "no"; then
2659 if echo |
$cc -dM -E - |
grep __clang__
> /dev
/null
2>&1 ; then
2660 fortify_source
="no";
2661 elif test -n "$cxx" && has
$cxx &&
2662 echo |
$cxx -dM -E - |
grep __clang__
>/dev
/null
2>&1 ; then
2663 fortify_source
="no";
2665 fortify_source
="yes"
2669 ##########################################
2670 # checks for sanitizers
2674 have_asan_iface_h
=no
2675 have_asan_iface_fiber
=no
2677 if test "$sanitizers" = "yes" ; then
2679 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=address" ""; then
2683 # we could use a simple skeleton for flags checks, but this also
2684 # detect the static linking issue of ubsan, see also:
2685 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
2689 void *tmp = malloc(10);
2691 return *(int *)(tmp + 2);
2696 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
2700 if check_include
"sanitizer/asan_interface.h" ; then
2701 have_asan_iface_h
=yes
2705 #include <sanitizer/asan_interface.h>
2707 __sanitizer_start_switch_fiber(0, 0, 0);
2711 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=address" "" ; then
2712 have_asan_iface_fiber
=yes
2716 # Thread sanitizer is, for now, much noisier than the other sanitizers;
2717 # keep it separate until that is not the case.
2718 if test "$tsan" = "yes" && test "$sanitizers" = "yes"; then
2719 error_exit
"TSAN is not supported with other sanitiziers."
2722 have_tsan_iface_fiber
=no
2723 if test "$tsan" = "yes" ; then
2725 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then
2729 #include <sanitizer/tsan_interface.h>
2731 __tsan_create_fiber(0);
2735 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then
2736 have_tsan_iface_fiber
=yes
2740 ##########################################
2744 auto | enabled | internal
)
2745 # Simpler to always update submodule, even if not needed.
2746 git_submodules
="${git_submodules} slirp"
2750 # Check for slirp smbd dupport
2751 : ${smbd=${SMBD-/usr/sbin/smbd}}
2752 if test "$slirp_smbd" != "no" ; then
2753 if test "$mingw32" = "yes" ; then
2754 if test "$slirp_smbd" = "yes" ; then
2755 error_exit
"Host smbd not supported on this platform."
2763 ##########################################
2764 # check for usable __NR_keyctl syscall
2766 if test "$linux" = "yes" ; then
2771 #include <asm/unistd.h>
2772 #include <linux/keyctl.h>
2775 return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0);
2778 if compile_prog
"" "" ; then
2782 if test "$secret_keyring" != "no"
2784 if test "$have_keyring" = "yes"
2788 if test "$secret_keyring" = "yes"
2790 error_exit
"syscall __NR_keyctl requested, \
2791 but not implemented on your system"
2798 ##########################################
2800 # After here, no more $cc or $ld runs
2804 if test "$gcov" = "yes" ; then
2806 elif test "$fortify_source" = "yes" ; then
2807 QEMU_CFLAGS
="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
2813 # Ensure there's only a single GP
2814 QEMU_CFLAGS
="-msmall-data $QEMU_CFLAGS"
2818 if test "$have_asan" = "yes"; then
2819 QEMU_CFLAGS
="-fsanitize=address $QEMU_CFLAGS"
2820 QEMU_LDFLAGS
="-fsanitize=address $QEMU_LDFLAGS"
2821 if test "$have_asan_iface_h" = "no" ; then
2822 echo "ASAN build enabled, but ASAN header missing." \
2823 "Without code annotation, the report may be inferior."
2824 elif test "$have_asan_iface_fiber" = "no" ; then
2825 echo "ASAN build enabled, but ASAN header is too old." \
2826 "Without code annotation, the report may be inferior."
2829 if test "$have_tsan" = "yes" ; then
2830 if test "$have_tsan_iface_fiber" = "yes" ; then
2831 QEMU_CFLAGS
="-fsanitize=thread $QEMU_CFLAGS"
2832 QEMU_LDFLAGS
="-fsanitize=thread $QEMU_LDFLAGS"
2834 error_exit
"Cannot enable TSAN due to missing fiber annotation interface."
2836 elif test "$tsan" = "yes" ; then
2837 error_exit
"Cannot enable TSAN due to missing sanitize thread interface."
2839 if test "$have_ubsan" = "yes"; then
2840 QEMU_CFLAGS
="-fsanitize=undefined $QEMU_CFLAGS"
2841 QEMU_LDFLAGS
="-fsanitize=undefined $QEMU_LDFLAGS"
2844 ##########################################
2846 # Exclude --warn-common with TSan to suppress warnings from the TSan libraries.
2847 if test "$solaris" = "no" && test "$tsan" = "no"; then
2848 if $ld --version 2>/dev
/null |
grep "GNU ld" >/dev
/null
2>/dev
/null
; then
2849 QEMU_LDFLAGS
="-Wl,--warn-common $QEMU_LDFLAGS"
2853 # Use ASLR, no-SEH and DEP if available
2854 if test "$mingw32" = "yes" ; then
2855 flags
="--no-seh --nxcompat"
2857 # Disable ASLR for debug builds to allow debugging with gdb
2858 if test "$debug" = "no" ; then
2859 flags
="--dynamicbase $flags"
2862 for flag
in $flags; do
2863 if ld_has
$flag ; then
2864 QEMU_LDFLAGS
="-Wl,$flag $QEMU_LDFLAGS"
2869 # Probe for guest agent support/options
2871 if [ "$guest_agent" != "no" ]; then
2872 if [ "$softmmu" = no
-a "$want_tools" = no
] ; then
2874 elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
2876 elif [ "$guest_agent" != yes ]; then
2879 error_exit
"Guest agent is not supported on this platform"
2883 # Guest agent Windows MSI package
2885 if test "$QEMU_GA_MANUFACTURER" = ""; then
2886 QEMU_GA_MANUFACTURER
=QEMU
2888 if test "$QEMU_GA_DISTRO" = ""; then
2889 QEMU_GA_DISTRO
=Linux
2891 if test "$QEMU_GA_VERSION" = ""; then
2892 QEMU_GA_VERSION
=$
(cat $source_path/VERSION
)
2895 QEMU_GA_MSI_MINGW_DLL_PATH
="$($pkg_config --variable=prefix glib-2.0)/bin"
2897 # Mac OS X ships with a broken assembler
2899 if { test "$cpu" = "i386" ||
test "$cpu" = "x86_64"; } && \
2900 test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
2901 test "$targetos" != "haiku" && test "$softmmu" = yes ; then
2902 # Different host OS linkers have different ideas about the name of the ELF
2903 # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
2904 # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
2905 for emu
in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe
; do
2906 if "$ld" -verbose 2>&1 |
grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
2907 ld_i386_emulation
="$emu"
2914 # Only build s390-ccw bios if we're on s390x and the compiler has -march=z900
2915 # or -march=z10 (which is the lowest architecture level that Clang supports)
2916 if test "$cpu" = "s390x" ; then
2918 compile_prog
"-march=z900" ""
2920 if [ $has_z900 = 0 ] || compile_object
"-march=z10 -msoft-float -Werror"; then
2921 if [ $has_z900 != 0 ]; then
2922 echo "WARNING: Your compiler does not support the z900!"
2923 echo " The s390-ccw bios will only work with guest CPUs >= z10."
2925 roms
="$roms s390-ccw"
2926 # SLOF is required for building the s390-ccw firmware on s390x,
2927 # since it is using the libnet code from SLOF for network booting.
2928 git_submodules
="${git_submodules} roms/SLOF"
2932 # Check that the C++ compiler exists and works with the C compiler.
2933 # All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
2936 int c_function(void);
2937 int main(void) { return c_function(); }
2944 int c_function(void);
2946 int c_function(void) { return 42; }
2951 if do_cxx
$CXXFLAGS $EXTRA_CXXFLAGS $CONFIGURE_CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then
2952 # C++ compiler $cxx works ok with C compiler $cc
2955 echo "C++ compiler $cxx does not work with C compiler $cc"
2956 echo "Disabling C++ specific optional code"
2960 echo "No C++ compiler available; disabling C++ specific optional code"
2964 if !(GIT
="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
2968 config_host_mak
="config-host.mak"
2970 echo "# Automatically generated by configure - do not modify" > $config_host_mak
2971 echo >> $config_host_mak
2973 echo all
: >> $config_host_mak
2974 echo "GIT=$git" >> $config_host_mak
2975 echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
2976 echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
2978 if test "$debug_tcg" = "yes" ; then
2979 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2981 if test "$mingw32" = "yes" ; then
2982 echo "CONFIG_WIN32=y" >> $config_host_mak
2983 if test "$guest_agent_with_vss" = "yes" ; then
2984 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
2985 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
2987 if test "$guest_agent_ntddscsi" = "yes" ; then
2988 echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak
2990 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
2991 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
2992 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
2993 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
2995 echo "CONFIG_POSIX=y" >> $config_host_mak
2998 if test "$linux" = "yes" ; then
2999 echo "CONFIG_LINUX=y" >> $config_host_mak
3002 if test "$darwin" = "yes" ; then
3003 echo "CONFIG_DARWIN=y" >> $config_host_mak
3006 if test "$solaris" = "yes" ; then
3007 echo "CONFIG_SOLARIS=y" >> $config_host_mak
3009 if test "$static" = "yes" ; then
3010 echo "CONFIG_STATIC=y" >> $config_host_mak
3012 if test "$want_tools" = "yes" ; then
3013 echo "CONFIG_TOOLS=y" >> $config_host_mak
3015 if test "$guest_agent" = "yes" ; then
3016 echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak
3018 if test "$slirp_smbd" = "yes" ; then
3019 echo "CONFIG_SLIRP_SMBD=y" >> $config_host_mak
3020 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
3022 echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
3023 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
3024 qemu_version
=$
(head $source_path/VERSION
)
3025 echo "PKGVERSION=$pkgversion" >>$config_host_mak
3026 echo "SRC_PATH=$source_path" >> $config_host_mak
3027 echo "TARGET_DIRS=$target_list" >> $config_host_mak
3028 if test "$modules" = "yes"; then
3029 # $shacmd can generate a hash started with digit, which the compiler doesn't
3030 # like as an symbol. So prefix it with an underscore
3031 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
3032 echo "CONFIG_MODULES=y" >> $config_host_mak
3034 if test "$module_upgrades" = "yes"; then
3035 echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
3037 if test "$have_usbfs" = "yes" ; then
3038 echo "CONFIG_USBFS=y" >> $config_host_mak
3040 if test "$gio" = "yes" ; then
3041 echo "CONFIG_GIO=y" >> $config_host_mak
3042 echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak
3043 echo "GIO_LIBS=$gio_libs" >> $config_host_mak
3045 if test "$gdbus_codegen" != "" ; then
3046 echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak
3048 echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
3050 if test "$xen" = "enabled" ; then
3051 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
3052 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
3053 echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak
3054 echo "XEN_LIBS=$xen_libs" >> $config_host_mak
3056 if test "$vhost_scsi" = "yes" ; then
3057 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
3059 if test "$vhost_net" = "yes" ; then
3060 echo "CONFIG_VHOST_NET=y" >> $config_host_mak
3062 if test "$vhost_net_user" = "yes" ; then
3063 echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak
3065 if test "$vhost_net_vdpa" = "yes" ; then
3066 echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak
3068 if test "$vhost_crypto" = "yes" ; then
3069 echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
3071 if test "$vhost_vsock" = "yes" ; then
3072 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
3073 if test "$vhost_user" = "yes" ; then
3074 echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak
3077 if test "$vhost_kernel" = "yes" ; then
3078 echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
3080 if test "$vhost_user" = "yes" ; then
3081 echo "CONFIG_VHOST_USER=y" >> $config_host_mak
3083 if test "$vhost_vdpa" = "yes" ; then
3084 echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak
3086 if test "$vhost_user_fs" = "yes" ; then
3087 echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
3089 if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then
3090 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
3093 if test "$opengl" = "yes" ; then
3094 echo "CONFIG_OPENGL=y" >> $config_host_mak
3095 echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak
3096 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
3099 # XXX: suppress that
3100 if [ "$bsd" = "yes" ] ; then
3101 echo "CONFIG_BSD=y" >> $config_host_mak
3104 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
3105 if test "$coroutine_pool" = "yes" ; then
3106 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
3108 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
3111 if test "$debug_stack_usage" = "yes" ; then
3112 echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
3115 if test "$have_asan_iface_fiber" = "yes" ; then
3116 echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak
3119 if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then
3120 echo "CONFIG_TSAN=y" >> $config_host_mak
3123 if test "$int128" = "yes" ; then
3124 echo "CONFIG_INT128=y" >> $config_host_mak
3127 if test "$atomic128" = "yes" ; then
3128 echo "CONFIG_ATOMIC128=y" >> $config_host_mak
3131 if test "$cmpxchg128" = "yes" ; then
3132 echo "CONFIG_CMPXCHG128=y" >> $config_host_mak
3135 if test "$rdma" = "yes" ; then
3136 echo "CONFIG_RDMA=y" >> $config_host_mak
3137 echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
3140 if test "$pvrdma" = "yes" ; then
3141 echo "CONFIG_PVRDMA=y" >> $config_host_mak
3144 if test "$plugins" = "yes" ; then
3145 echo "CONFIG_PLUGIN=y" >> $config_host_mak
3148 if test -n "$gdb_bin"; then
3149 gdb_version
=$
($gdb_bin --version |
head -n 1)
3150 if version_ge
${gdb_version##* } 9.1; then
3151 echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
3155 if test "$secret_keyring" = "yes" ; then
3156 echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak
3159 echo "ROMS=$roms" >> $config_host_mak
3160 echo "MAKE=$make" >> $config_host_mak
3161 echo "PYTHON=$python" >> $config_host_mak
3162 echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
3163 echo "MESON=$meson" >> $config_host_mak
3164 echo "NINJA=$ninja" >> $config_host_mak
3165 echo "CC=$cc" >> $config_host_mak
3166 echo "HOST_CC=$host_cc" >> $config_host_mak
3167 if $iasl -h > /dev
/null
2>&1; then
3168 echo "CONFIG_IASL=$iasl" >> $config_host_mak
3170 echo "AR=$ar" >> $config_host_mak
3171 echo "AS=$as" >> $config_host_mak
3172 echo "CCAS=$ccas" >> $config_host_mak
3173 echo "CPP=$cpp" >> $config_host_mak
3174 echo "OBJCOPY=$objcopy" >> $config_host_mak
3175 echo "LD=$ld" >> $config_host_mak
3176 echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
3177 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3178 echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
3179 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
3180 echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
3181 echo "GLIB_VERSION=$(pkg-config --modversion glib-2.0)" >> $config_host_mak
3182 echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
3183 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
3184 echo "STRIP=$strip" >> $config_host_mak
3185 echo "EXESUF=$EXESUF" >> $config_host_mak
3187 # use included Linux headers
3188 if test "$linux" = "yes" ; then
3189 mkdir
-p linux-headers
3204 linux_arch
=loongarch
3210 # For most CPUs the kernel architecture name and QEMU CPU name match.
3214 # For non-KVM architectures we will not have asm headers
3215 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
3216 symlink
"$source_path/linux-headers/asm-$linux_arch" linux-headers
/asm
3220 for target
in $target_list; do
3221 target_dir
="$target"
3222 target_name
=$
(echo $target | cut
-d '-' -f 1)$EXESUF
3223 mkdir
-p $target_dir
3225 *-user) symlink
"../qemu-$target_name" "$target_dir/qemu-$target_name" ;;
3226 *) symlink
"../qemu-system-$target_name" "$target_dir/qemu-system-$target_name" ;;
3230 echo "CONFIG_QEMU_INTERP_PREFIX=$interp_prefix" |
sed 's/%M/@0@/' >> $config_host_mak
3231 if test "$default_targets" = "yes"; then
3232 echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
3235 if test "$ccache_cpp2" = "yes"; then
3236 echo "export CCACHE_CPP2=y" >> $config_host_mak
3239 if test "$safe_stack" = "yes"; then
3240 echo "CONFIG_SAFESTACK=y" >> $config_host_mak
3243 # If we're using a separate build tree, set it up now.
3244 # LINKS are things to symlink back into the source tree
3245 # (these can be both files and directories).
3246 # Caution: do not add files or directories here using wildcards. This
3247 # will result in problems later if a new file matching the wildcard is
3248 # added to the source tree -- nothing will cause configure to be rerun
3249 # so the build tree will be missing the link back to the new file, and
3250 # tests might fail. Prefer to keep the relevant files in their own
3251 # directory and symlink the directory instead.
3253 LINKS
="$LINKS tests/tcg/Makefile.target"
3254 LINKS
="$LINKS pc-bios/optionrom/Makefile"
3255 LINKS
="$LINKS pc-bios/s390-ccw/Makefile"
3256 LINKS
="$LINKS roms/seabios/Makefile"
3257 LINKS
="$LINKS pc-bios/qemu-icon.bmp"
3258 LINKS
="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
3259 LINKS
="$LINKS tests/avocado tests/data"
3260 LINKS
="$LINKS tests/qemu-iotests/check"
3261 LINKS
="$LINKS python"
3262 LINKS
="$LINKS contrib/plugins/Makefile "
3264 $source_path/pc-bios
/*.bin \
3265 $source_path/pc-bios
/*.elf \
3266 $source_path/pc-bios
/*.lid \
3267 $source_path/pc-bios
/*.rom \
3268 $source_path/pc-bios
/*.dtb \
3269 $source_path/pc-bios
/*.img \
3270 $source_path/pc-bios
/openbios-
* \
3271 $source_path/pc-bios
/u-boot.
* \
3272 $source_path/pc-bios
/palcode-
* \
3273 $source_path/pc-bios
/qemu_vga.ndrv
3276 LINKS
="$LINKS pc-bios/$(basename $bios_file)"
3278 for f
in $LINKS ; do
3279 if [ -e "$source_path/$f" ]; then
3280 mkdir
-p `dirname ./$f`
3281 symlink
"$source_path/$f" "$f"
3285 (for i
in $cross_cc_vars; do
3288 export target_list source_path use_containers cpu
3289 $source_path/tests
/tcg
/configure.sh
)
3291 # temporary config to build submodules
3292 if test -f $source_path/roms
/seabios
/Makefile
; then
3293 for rom
in seabios
; do
3294 config_mak
=roms
/$rom/config.mak
3295 echo "# Automatically generated by configure - do not modify" > $config_mak
3296 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3297 echo "AS=$as" >> $config_mak
3298 echo "CCAS=$ccas" >> $config_mak
3299 echo "CC=$cc" >> $config_mak
3300 echo "BCC=bcc" >> $config_mak
3301 echo "CPP=$cpp" >> $config_mak
3302 echo "OBJCOPY=objcopy" >> $config_mak
3303 echo "IASL=$iasl" >> $config_mak
3304 echo "LD=$ld" >> $config_mak
3305 echo "RANLIB=$ranlib" >> $config_mak
3309 config_mak
=pc-bios
/optionrom
/config.mak
3310 echo "# Automatically generated by configure - do not modify" > $config_mak
3311 echo "TOPSRC_DIR=$source_path" >> $config_mak
3313 if test "$skip_meson" = no
; then
3314 cross
="config-meson.cross.new"
3316 test $# = 0 && return
3317 echo "'$(echo $* | sed "s
/ /','/g
")'"
3320 echo "# Automatically generated by configure - do not modify" > $cross
3321 echo "[properties]" >> $cross
3323 # unroll any custom device configs
3324 for a
in $device_archs; do
3325 eval "c=\$devices_${a}"
3326 echo "${a}-softmmu = '$c'" >> $cross
3329 test -z "$cxx" && echo "link_language = 'c'" >> $cross
3330 echo "[built-in options]" >> $cross
3331 echo "c_args = [$(meson_quote $CFLAGS $EXTRA_CFLAGS)]" >> $cross
3332 echo "cpp_args = [$(meson_quote $CXXFLAGS $EXTRA_CXXFLAGS)]" >> $cross
3333 echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross
3334 echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross
3335 echo "[binaries]" >> $cross
3336 echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross
3337 test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross
3338 test -n "$objcc" && echo "objc = [$(meson_quote $objcc $CPU_CFLAGS)]" >> $cross
3339 echo "ar = [$(meson_quote $ar)]" >> $cross
3340 echo "nm = [$(meson_quote $nm)]" >> $cross
3341 echo "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross
3342 echo "ranlib = [$(meson_quote $ranlib)]" >> $cross
3343 if has
$sdl2_config; then
3344 echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross
3346 echo "strip = [$(meson_quote $strip)]" >> $cross
3347 echo "windres = [$(meson_quote $windres)]" >> $cross
3348 if test "$cross_compile" = "yes"; then
3349 cross_arg
="--cross-file config-meson.cross"
3350 echo "[host_machine]" >> $cross
3351 echo "system = '$targetos'" >> $cross
3354 echo "cpu_family = 'x86'" >> $cross
3357 echo "cpu_family = '$cpu'" >> $cross
3360 echo "cpu = '$cpu'" >> $cross
3361 if test "$bigendian" = "yes" ; then
3362 echo "endian = 'big'" >> $cross
3364 echo "endian = 'little'" >> $cross
3367 cross_arg
="--native-file config-meson.cross"
3369 mv $cross config-meson.cross
3371 rm -rf meson-private meson-info meson-logs
3373 NINJA
=$ninja $meson setup \
3374 --prefix "$prefix" \
3375 --libdir "$libdir" \
3376 --libexecdir "$libexecdir" \
3377 --bindir "$bindir" \
3378 --includedir "$includedir" \
3379 --datadir "$datadir" \
3380 --mandir "$mandir" \
3381 --sysconfdir "$sysconfdir" \
3382 --localedir "$localedir" \
3383 --localstatedir "$local_statedir" \
3384 -Daudio_drv_list=$audio_drv_list \
3385 -Ddefault_devices=$default_devices \
3386 -Ddocdir="$docdir" \
3387 -Dqemu_firmwarepath="$firmwarepath" \
3388 -Dqemu_suffix="$qemu_suffix" \
3389 -Dsphinx_build="$sphinx_build" \
3390 -Dtrace_file="$trace_file" \
3391 -Doptimization=$
(if test "$debug" = yes; then echo 0; else echo 2; fi) \
3392 -Ddebug=$
(if test "$debug_info" = yes; then echo true
; else echo false
; fi) \
3393 -Dwerror=$
(if test "$werror" = yes; then echo true
; else echo false
; fi) \
3394 -Db_pie=$
(if test "$pie" = yes; then echo true
; else echo false
; fi) \
3395 -Db_coverage=$
(if test "$gcov" = yes; then echo true
; else echo false
; fi) \
3396 -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg -Dxen=$xen \
3397 -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
3398 $
(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \
3399 $
(if test "$default_feature" = no
; then echo "-Dauto_features=disabled"; fi) \
3400 "$@" $cross_arg "$PWD" "$source_path"
3402 eval run_meson
$meson_options
3403 if test "$?" -ne 0 ; then
3404 error_exit
"meson setup failed"
3407 if test -f meson-private
/cmd_line.txt
; then
3408 # Adjust old command line options whose type was changed
3409 # Avoids having to use "setup --wipe" when Meson is upgraded
3411 s/^gettext = true$/gettext = auto/;
3412 s/^gettext = false$/gettext = disabled/;
3413 /^b_staticpic/ && next;
3414 print;' meson-private
/cmd_line.txt
3418 # Save the configure command line for later reuse.
3419 cat <<EOD >config.status
3421 # Generated by configure.
3422 # Run this file to recreate the current configuration.
3423 # Compiler output produced by configure, useful for debugging
3424 # configure, is in config.log if it exists.
3430 eval envval
=\$
$envname
3432 if test -n "$envval"
3434 echo "$envname='$envval'" >> config.status
3435 echo "export $envname" >> config.status
3437 echo "unset $envname" >> config.status
3441 # Preserve various env variables that influence what
3442 # features/build target configure will detect
3449 preserve_env CXXFLAGS
3450 preserve_env INSTALL
3452 preserve_env LDFLAGS
3453 preserve_env LD_LIBRARY_PATH
3454 preserve_env LIBTOOL
3457 preserve_env OBJCOPY
3459 preserve_env PKG_CONFIG
3460 preserve_env PKG_CONFIG_LIBDIR
3461 preserve_env PKG_CONFIG_PATH
3463 preserve_env SDL2_CONFIG
3466 preserve_env WINDRES
3468 printf "exec" >>config.status
3469 for i
in "$0" "$@"; do
3470 test "$i" = --skip-meson ||
printf " %s" "$(quote_sh "$i")" >>config.status
3472 echo ' "$@"' >>config.status
3473 chmod +x config.status