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 TMPM
="${TMPDIR1}/${TMPB}.m"
81 TMPE
="${TMPDIR1}/${TMPB}.exe"
85 # Print a helpful header at the top of config.log
86 echo "# QEMU configure log $(date)" >> config.log
87 printf "# Configured with:" >> config.log
88 printf " '%s'" "$0" "$@" >> config.log
90 echo "#" >> config.log
93 printf "%s" "$1" |
sed "s,','\\\\'',g; s,.*,'&',"
99 while test -n "$2"; do
112 # Run the compiler, capturing its output to the log. First argument
113 # is compiler binary to execute.
116 if test -n "$BASH_VERSION"; then eval '
118 funcs: ${FUNCNAME[*]}
119 lines: ${BASH_LINENO[*]}"
121 echo $compiler "$@" >> config.log
122 $compiler "$@" >> config.log
2>&1 ||
return $?
123 # Test passed. If this is an --enable-werror build, rerun
124 # the test with -Werror and bail out if it fails. This
125 # makes warning-generating-errors in configure test code
126 # obvious to developers.
127 if test "$werror" != "yes"; then
130 # Don't bother rerunning the compile if we were already using -Werror
136 echo $compiler -Werror "$@" >> config.log
137 $compiler -Werror "$@" >> config.log
2>&1 && return $?
138 error_exit
"configure test passed without -Werror but failed with -Werror." \
139 "This is probably a bug in the configure script. The failing command" \
140 "will be at the bottom of config.log." \
141 "You can run configure with --disable-werror to bypass this check."
145 do_compiler
"$cc" $CPU_CFLAGS "$@"
149 do_compiler
"$cxx" $CPU_CFLAGS "$@"
153 do_compiler
"$objcc" $CPU_CFLAGS "$@"
156 # Append $2 to the variable named $1, with space separation
158 eval $1=\
${$1:+\"\$$1 \"}\
$2
162 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
163 # options which some versions of GCC's C++ compiler complain about
164 # because they only make sense for C programs.
165 QEMU_CXXFLAGS
="-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS"
166 CONFIGURE_CXXFLAGS
=$
(echo "$CONFIGURE_CFLAGS" |
sed s
/-std=gnu11
/-std=gnu
++11/)
167 for arg
in $QEMU_CFLAGS; do
169 -Wstrict-prototypes|
-Wmissing-prototypes|
-Wnested-externs|\
170 -Wold-style-declaration|
-Wold-style-definition|
-Wredundant-decls)
173 QEMU_CXXFLAGS
=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
181 do_cc
$CFLAGS $EXTRA_CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
187 do_cc
$CFLAGS $EXTRA_CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC \
188 $LDFLAGS $EXTRA_LDFLAGS $CONFIGURE_LDFLAGS $QEMU_LDFLAGS $local_ldflags
191 # symbolically link $1 to $2. Portable version of "ln -sf".
194 mkdir
-p "$(dirname "$2")"
198 # check whether a command is available to this shell (may be either an
199 # executable or a builtin)
201 type "$1" >/dev
/null
2>&1
205 local_ver1
=$
(expr "$1" : '\([0-9.]*\)' |
tr .
' ')
206 local_ver2
=$
(echo "$2" |
tr .
' ')
210 # 'shift 2' if $2 is set, or 'shift' if $2 is not set
214 # the second argument finished, the first must be greater or equal
215 test $# = 1 && return 0
216 test $local_first -lt $2 && return 1
217 test $local_first -gt $2 && return 0
224 eval test -z '"${1#'"$2"'}"'
227 if printf %s
\\n
"$source_path" "$PWD" |
grep -q "[[:space:]:]";
229 error_exit
"main directory cannot contain spaces nor colons"
234 interp_prefix
="/usr/gnemul/qemu-%M"
238 block_drv_rw_whitelist
=""
239 block_drv_ro_whitelist
=""
245 gdb_bin
=$
(command -v "gdb-multiarch" ||
command -v "gdb")
247 if test -e "$source_path/.git"
249 git_submodules_action
="update"
251 git_submodules_action
="ignore"
254 git_submodules
="ui/keycodemapdb"
257 # Don't accept a target_list environment variable.
259 unset target_list_exclude
261 # Default value for a variable defining feature "foo".
262 # * foo="no" feature will only be used if --enable-foo arg is given
263 # * foo="" feature will be searched for, and if found, will be used
264 # unless --disable-foo is given
265 # * foo="yes" this value will only be set by --enable-foo flag.
266 # feature will searched for,
267 # if not found, configure exits with error
269 # Always add --enable-foo and --disable-foo command line args.
270 # Distributions want to ensure that several features are compiled in, and it
271 # is impossible without a --enable-foo that exits if a feature is not found.
274 # parse CC options second
276 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
278 --without-default-features)
289 vhost_kernel
="$default_feature"
290 vhost_net
="$default_feature"
291 vhost_crypto
="$default_feature"
292 vhost_scsi
="$default_feature"
293 vhost_vsock
="$default_feature"
295 vhost_user_fs
="$default_feature"
296 vhost_vdpa
="$default_feature"
314 plugins
="$default_feature"
320 # The following Meson options are handled manually (still they
321 # are included in the automatically generated help message)
323 # 1. Track which submodules are needed
324 if test "$default_feature" = no
; then
333 # 2. Support --with/--without option
334 default_devices
="true"
336 # 3. Automatically enable/disable other options
340 # parse CC options second
342 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
344 --cross-prefix=*) cross_prefix
="$optarg"
349 --cxx=*) CXX
="$optarg"
351 --cpu=*) cpu
="$optarg"
354 EXTRA_CFLAGS
="$EXTRA_CFLAGS $optarg"
355 EXTRA_CXXFLAGS
="$EXTRA_CXXFLAGS $optarg"
356 EXTRA_OBJCFLAGS
="$EXTRA_OBJCFLAGS $optarg"
358 --extra-cxxflags=*) EXTRA_CXXFLAGS
="$EXTRA_CXXFLAGS $optarg"
360 --extra-objcflags=*) EXTRA_OBJCFLAGS
="$EXTRA_OBJCFLAGS $optarg"
362 --extra-ldflags=*) EXTRA_LDFLAGS
="$EXTRA_LDFLAGS $optarg"
364 --cross-cc-*[!a-zA-Z0-9_-
]*=*) error_exit
"Passed bad --cross-cc-FOO option"
366 --cross-cc-cflags-*) cc_arch
=${opt#--cross-cc-cflags-}; cc_arch
=${cc_arch%%=*}
367 eval "cross_cc_cflags_${cc_arch}=\$optarg"
368 cross_cc_vars
="$cross_cc_vars cross_cc_cflags_${cc_arch}"
370 --cross-cc-*) cc_arch
=${opt#--cross-cc-}; cc_arch
=${cc_arch%%=*}
371 eval "cross_cc_${cc_arch}=\$optarg"
372 cross_cc_vars
="$cross_cc_vars cross_cc_${cc_arch}"
377 # Using uname is really, really broken. Once we have the right set of checks
378 # we can eliminate its usage altogether.
380 # Preferred compiler:
382 # ${cross_prefix}gcc (if cross-prefix specified)
384 if test -z "${CC}${cross_prefix}"; then
387 cc
="${CC-${cross_prefix}gcc}"
390 if test -z "${CXX}${cross_prefix}"; then
393 cxx
="${CXX-${cross_prefix}g++}"
396 ar="${AR-${cross_prefix}ar}"
397 as
="${AS-${cross_prefix}as}"
400 objcopy
="${OBJCOPY-${cross_prefix}objcopy}"
401 ld
="${LD-${cross_prefix}ld}"
402 ranlib
="${RANLIB-${cross_prefix}ranlib}"
403 nm
="${NM-${cross_prefix}nm}"
405 strip
="${STRIP-${cross_prefix}strip}"
406 widl
="${WIDL-${cross_prefix}widl}"
407 windres
="${WINDRES-${cross_prefix}windres}"
408 pkg_config_exe
="${PKG_CONFIG-${cross_prefix}pkg-config}"
410 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
412 pkg_config
=query_pkg_config
413 sdl2_config
="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
415 # default flags for all hosts
416 # We use -fwrapv to tell the compiler that we require a C dialect where
417 # left shift of signed integers is well defined and has the expected
418 # 2s-complement style results. (Both clang and gcc agree that it
419 # provides these semantics.)
420 QEMU_CFLAGS
="-fno-strict-aliasing -fno-common -fwrapv"
421 QEMU_CFLAGS
="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
422 QEMU_CFLAGS
="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
423 QEMU_CFLAGS
="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
427 # Flags that are needed during configure but later taken care of by Meson
428 CONFIGURE_CFLAGS
="-std=gnu11 -Wall"
435 #error $1 not defined
437 int main(void) { return 0; }
445 int main(void) { return 0; }
452 int main(void) { return 0; }
456 if check_define __linux__
; then
458 elif check_define _WIN32
; then
460 elif check_define __OpenBSD__
; then
462 elif check_define __sun__
; then
464 elif check_define __HAIKU__
; then
466 elif check_define __FreeBSD__
; then
468 elif check_define __FreeBSD_kernel__
&& check_define __GLIBC__
; then
469 targetos
=gnu
/kfreebsd
470 elif check_define __DragonFly__
; then
472 elif check_define __NetBSD__
; then
474 elif check_define __APPLE__
; then
477 # This is a fatal error, but don't report it yet, because we
478 # might be going to just print the --help text, or it might
479 # be the result of a missing compiler.
501 # needed for kinfo_getvmmap(3) in libutil.h
518 # Disable attempts to use ObjectiveC features in os/object.h since they
519 # won't work when we're compiling with gcc as a C compiler.
520 QEMU_CFLAGS
="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
525 # needed for CMSG_ macros in sys/socket.h
526 QEMU_CFLAGS
="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
527 # needed for TIOCWIN* defines in termios.h
528 QEMU_CFLAGS
="-D__EXTENSIONS__ $QEMU_CFLAGS"
529 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
530 # Note that this check is broken for cross-compilation: if you're
531 # cross-compiling to one of these OSes then you'll need to specify
532 # the correct CPU with the --cpu option.
533 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
539 QEMU_CFLAGS
="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS"
543 vhost_user
=${default_feature:-yes}
547 if test ! -z "$cpu" ; then
548 # command line argument
550 elif check_define __i386__
; then
552 elif check_define __x86_64__
; then
553 if check_define __ILP32__
; then
558 elif check_define __sparc__
; then
559 if check_define __arch64__
; then
564 elif check_define _ARCH_PPC
; then
565 if check_define _ARCH_PPC64
; then
566 if check_define _LITTLE_ENDIAN
; then
574 elif check_define __mips__
; then
576 elif check_define __s390__
; then
577 if check_define __s390x__
; then
582 elif check_define __riscv
; then
584 elif check_define __arm__
; then
586 elif check_define __aarch64__
; then
588 elif check_define __loongarch64
; then
594 # Normalise host CPU name, set multilib cflags
595 # Note that this case should only have supported host CPUs, not guests.
600 i386|i486|i586|i686|i86pc|BePC
)
605 CPU_CFLAGS
="-mx32" ;;
608 # ??? Only extremely old AMD cpus do not have cmpxchg16b.
609 # If we truly care, we should simply detect this case at
610 # runtime and generate the fallback to serial emulation.
611 CPU_CFLAGS
="-m64 -mcx16" ;;
619 CPU_CFLAGS
="-m64 -mbig-endian" ;;
622 CPU_CFLAGS
="-m64 -mlittle-endian" ;;
631 CPU_CFLAGS
="-m32 -mv8plus -mcpu=ultrasparc" ;;
633 CPU_CFLAGS
="-m64 -mcpu=ultrasparc" ;;
636 : ${make=${MAKE-make}}
638 # We prefer python 3.x. A bare 'python' is traditionally
639 # python 2.x, but some distros have it as python 3.x, so
643 for binary
in "${PYTHON-python3}" python
647 python
=$
(command -v "$binary")
653 # Check for ancillary tools used in testing
655 for binary
in genisoimage mkisofs
659 genisoimage
=$
(command -v "$binary")
664 # Default objcc to clang if available, otherwise use CC
671 if test "$mingw32" = "yes" ; then
673 # MinGW needs -mthreads for TLS and macro _MT.
674 CONFIGURE_CFLAGS
="-mthreads $CONFIGURE_CFLAGS"
682 .
$source_path/scripts
/meson-buildoptions.sh
685 meson_option_parse
() {
686 meson_options
="$meson_options $(_meson_option_parse "$@
")"
687 if test $?
-eq 1; then
688 echo "ERROR: unknown option $1"
689 echo "Try '$0 --help' for more information"
695 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
697 --help|
-h) show_help
=yes
699 --version|
-V) exec cat $source_path/VERSION
701 --prefix=*) prefix
="$optarg"
703 --interp-prefix=*) interp_prefix
="$optarg"
709 --host-cc=*) host_cc
="$optarg"
713 --objcc=*) objcc
="$optarg"
715 --make=*) make="$optarg"
719 --python=*) python
="$optarg" ; explicit_python
=yes
721 --skip-meson) skip_meson
=yes
723 --meson=*) meson
="$optarg"
725 --ninja=*) ninja
="$optarg"
727 --smbd=*) smbd
="$optarg"
739 --enable-debug-info) debug_info
="yes"
741 --disable-debug-info) debug_info
="no"
751 --target-list=*) target_list
="$optarg"
752 if test "$target_list_exclude"; then
753 error_exit
"Can't mix --target-list with --target-list-exclude"
756 --target-list-exclude=*) target_list_exclude
="$optarg"
757 if test "$target_list"; then
758 error_exit
"Can't mix --target-list-exclude with --target-list"
761 --with-default-devices) default_devices
="true"
763 --without-default-devices) default_devices
="false"
765 --with-devices-*[!a-zA-Z0-9_-
]*=*) error_exit
"Passed bad --with-devices-FOO option"
767 --with-devices-*) device_arch
=${opt#--with-devices-};
768 device_arch
=${device_arch%%=*}
769 cf
=$source_path/configs
/devices
/$device_arch-softmmu/$optarg.mak
770 if test -f "$cf"; then
771 device_archs
="$device_archs $device_arch"
772 eval "devices_${device_arch}=\$optarg"
774 error_exit
"File $cf does not exist"
777 --without-default-features) # processed above
779 --enable-gcov) gcov
="yes"
783 QEMU_PKG_CONFIG_FLAGS
="--static $QEMU_PKG_CONFIG_FLAGS"
785 --mandir=*) mandir
="$optarg"
787 --bindir=*) bindir
="$optarg"
789 --libdir=*) libdir
="$optarg"
791 --libexecdir=*) libexecdir
="$optarg"
793 --includedir=*) includedir
="$optarg"
795 --datadir=*) datadir
="$optarg"
797 --with-suffix=*) qemu_suffix
="$optarg"
799 --docdir=*) docdir
="$optarg"
801 --localedir=*) localedir
="$optarg"
803 --sysconfdir=*) sysconfdir
="$optarg"
805 --localstatedir=*) local_statedir
="$optarg"
807 --firmwarepath=*) firmwarepath
="$optarg"
810 --disable-dependency-tracking|\
811 --sbindir=*|
--sharedstatedir=*|\
812 --oldincludedir=*|
--datarootdir=*|
--infodir=*|\
813 --htmldir=*|
--dvidir=*|
--pdfdir=*|
--psdir=*)
814 # These switches are silently ignored, for compatibility with
815 # autoconf-generated configure scripts. This allows QEMU's
816 # configure to be used by RPM and similar macros that set
817 # lots of directory switches by default.
819 --block-drv-rw-whitelist=*|
--block-drv-whitelist=*) block_drv_rw_whitelist
=$
(echo "$optarg" |
sed -e 's/,/ /g')
821 --block-drv-ro-whitelist=*) block_drv_ro_whitelist
=$
(echo "$optarg" |
sed -e 's/,/ /g')
823 --enable-debug-tcg) debug_tcg
="yes"
825 --disable-debug-tcg) debug_tcg
="no"
828 # Enable debugging options that aren't excessively noisy
830 meson_option_parse
--enable-debug-mutex ""
834 --enable-sanitizers) sanitizers
="yes"
836 --disable-sanitizers) sanitizers
="no"
838 --enable-tsan) tsan
="yes"
840 --disable-tsan) tsan
="no"
842 --disable-slirp) slirp
="disabled"
844 --enable-slirp) slirp
="enabled"
846 --enable-slirp=git
) slirp
="internal"
848 --enable-slirp=*) slirp
="$optarg"
850 --disable-tcg) tcg
="disabled"
853 --enable-tcg) tcg
="enabled"
855 --disable-system) softmmu
="no"
857 --enable-system) softmmu
="yes"
864 --disable-linux-user) linux_user
="no"
866 --enable-linux-user) linux_user
="yes"
868 --disable-bsd-user) bsd_user
="no"
870 --enable-bsd-user) bsd_user
="yes"
872 --enable-pie) pie
="yes"
874 --disable-pie) pie
="no"
876 --enable-werror) werror
="yes"
878 --disable-werror) werror
="no"
880 --enable-lto) lto
="true"
882 --disable-lto) lto
="false"
884 --enable-stack-protector) stack_protector
="yes"
886 --disable-stack-protector) stack_protector
="no"
888 --enable-safe-stack) safe_stack
="yes"
890 --disable-safe-stack) safe_stack
="no"
896 --disable-cfi) cfi
="false"
898 --disable-fdt) fdt
="disabled"
900 --enable-fdt) fdt
="enabled"
902 --enable-fdt=git
) fdt
="internal"
904 --enable-fdt=*) fdt
="$optarg"
906 --with-pkgversion=*) pkgversion
="$optarg"
908 --with-coroutine=*) coroutine
="$optarg"
910 --disable-vhost-net) vhost_net
="no"
912 --enable-vhost-net) vhost_net
="yes"
914 --disable-vhost-crypto) vhost_crypto
="no"
916 --enable-vhost-crypto) vhost_crypto
="yes"
918 --disable-vhost-scsi) vhost_scsi
="no"
920 --enable-vhost-scsi) vhost_scsi
="yes"
922 --disable-vhost-vsock) vhost_vsock
="no"
924 --enable-vhost-vsock) vhost_vsock
="yes"
926 --disable-vhost-user-fs) vhost_user_fs
="no"
928 --enable-vhost-user-fs) vhost_user_fs
="yes"
932 --disable-virtio-blk-data-plane|
--enable-virtio-blk-data-plane)
933 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
935 --enable-vhdx|
--disable-vhdx)
936 echo "$0: $opt is obsolete, VHDX driver is always built" >&2
938 --enable-uuid|
--disable-uuid)
939 echo "$0: $opt is obsolete, UUID support is always built" >&2
941 --disable-vhost-user) vhost_user
="no"
943 --enable-vhost-user) vhost_user
="yes"
945 --disable-vhost-vdpa) vhost_vdpa
="no"
947 --enable-vhost-vdpa) vhost_vdpa
="yes"
949 --disable-vhost-kernel) vhost_kernel
="no"
951 --enable-vhost-kernel) vhost_kernel
="yes"
953 --disable-capstone) capstone
="disabled"
955 --enable-capstone) capstone
="enabled"
957 --enable-capstone=git
) capstone
="internal"
959 --enable-capstone=*) capstone
="$optarg"
961 --with-git=*) git
="$optarg"
963 --with-git-submodules=*)
964 git_submodules_action
="$optarg"
966 --enable-plugins) if test "$mingw32" = "yes"; then
967 error_exit
"TCG plugins not currently supported on Windows platforms"
972 --disable-plugins) plugins
="no"
974 --enable-containers) use_containers
="yes"
976 --disable-containers) use_containers
="no"
978 --gdb=*) gdb_bin
="$optarg"
980 # backwards compatibility options
981 --enable-trace-backend=*) meson_option_parse
"--enable-trace-backends=$optarg" "$optarg"
983 --disable-blobs) meson_option_parse
--disable-install-blobs ""
985 --enable-tcmalloc) meson_option_parse
--enable-malloc=tcmalloc tcmalloc
987 --enable-jemalloc) meson_option_parse
--enable-malloc=jemalloc jemalloc
989 # everything else has the same name in configure and meson
990 --*) meson_option_parse
"$opt" "$optarg"
995 # test for any invalid configuration combinations
996 if test "$plugins" = "yes" -a "$tcg" = "disabled"; then
997 error_exit
"Can't enable plugins on non-TCG builds"
1000 case $git_submodules_action in
1002 if test ! -e "$source_path/.git"; then
1003 echo "ERROR: cannot $git_submodules_action git submodules without .git"
1008 if ! test -f "$source_path/ui/keycodemapdb/README"
1011 echo "ERROR: missing GIT submodules"
1013 if test -e "$source_path/.git"; then
1014 echo "--with-git-submodules=ignore specified but submodules were not"
1015 echo "checked out. Please initialize and update submodules."
1017 echo "This is not a GIT checkout but module content appears to"
1018 echo "be missing. Do not use 'git archive' or GitHub download links"
1019 echo "to acquire QEMU source archives. Non-GIT builds are only"
1020 echo "supported with source archives linked from:"
1022 echo " https://www.qemu.org/download/#source"
1024 echo "Developers working with GIT can use scripts/archive-source.sh"
1025 echo "if they need to create valid source archives."
1032 echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'"
1037 libdir
="${libdir:-$prefix/lib}"
1038 libexecdir
="${libexecdir:-$prefix/libexec}"
1039 includedir
="${includedir:-$prefix/include}"
1041 if test "$mingw32" = "yes" ; then
1042 bindir
="${bindir:-$prefix}"
1044 bindir
="${bindir:-$prefix/bin}"
1046 mandir
="${mandir:-$prefix/share/man}"
1047 datadir
="${datadir:-$prefix/share}"
1048 docdir
="${docdir:-$prefix/share/doc}"
1049 sysconfdir
="${sysconfdir:-$prefix/etc}"
1050 local_statedir
="${local_statedir:-$prefix/var}"
1051 firmwarepath
="${firmwarepath:-$datadir/qemu-firmware}"
1052 localedir
="${localedir:-$datadir/locale}"
1054 if eval test -z "\${cross_cc_$cpu}"; then
1055 eval "cross_cc_${cpu}=\$cc"
1056 cross_cc_vars
="$cross_cc_vars cross_cc_${cpu}"
1059 default_target_list
=""
1062 if [ "$linux_user" != no
]; then
1063 if [ "$targetos" = linux
] && [ -d $source_path/linux-user
/include
/host
/$cpu ]; then
1065 elif [ "$linux_user" = yes ]; then
1066 error_exit
"linux-user not supported on this architecture"
1069 if [ "$bsd_user" != no
]; then
1070 if [ "$bsd_user" = "" ]; then
1071 test $targetos = freebsd
&& bsd_user
=yes
1073 if [ "$bsd_user" = yes ] && ! [ -d $source_path/bsd-user
/$targetos ]; then
1074 error_exit
"bsd-user not supported on this host OS"
1077 if [ "$softmmu" = "yes" ]; then
1078 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-softmmu.mak"
1080 if [ "$linux_user" = "yes" ]; then
1081 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-linux-user.mak"
1083 if [ "$bsd_user" = "yes" ]; then
1084 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-bsd-user.mak"
1087 for config
in $mak_wilds; do
1088 target
="$(basename "$config" .mak)"
1089 if echo "$target_list_exclude" |
grep -vq "$target"; then
1090 default_target_list
="${default_target_list} $target"
1094 if test x
"$show_help" = x
"yes" ; then
1097 Usage: configure [options]
1098 Options: [defaults in brackets after descriptions]
1101 --help print this message
1102 --prefix=PREFIX install in PREFIX [$prefix]
1103 --interp-prefix=PREFIX where to find shared libraries, etc.
1104 use %M for cpu name [$interp_prefix]
1105 --target-list=LIST set target list (default: build all)
1106 $(echo Available targets: $default_target_list | \
1107 fold -s -w 53 | sed -e 's/^/ /')
1108 --target-list-exclude=LIST exclude a set of targets from the default target-list
1110 Advanced options (experts only):
1111 --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix]
1112 --cc=CC use C compiler CC [$cc]
1113 --host-cc=CC use C compiler CC [$host_cc] for code run at
1115 --cxx=CXX use C++ compiler CXX [$cxx]
1116 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1117 --extra-cflags=CFLAGS append extra C compiler flags CFLAGS
1118 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
1119 --extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
1120 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1121 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases
1122 --cross-cc-cflags-ARCH= use compiler flags when building ARCH guest tests
1123 --make=MAKE use specified make [$make]
1124 --python=PYTHON use specified python [$python]
1125 --meson=MESON use specified meson [$meson]
1126 --ninja=NINJA use specified ninja [$ninja]
1127 --smbd=SMBD use specified smbd [$smbd]
1128 --with-git=GIT use specified git [$git]
1129 --with-git-submodules=update update git submodules (default if .git dir exists)
1130 --with-git-submodules=validate fail if git submodules are not up to date
1131 --with-git-submodules=ignore do not update or check git submodules (default if no .git dir)
1132 --static enable static build [$static]
1133 --mandir=PATH install man pages in PATH
1134 --datadir=PATH install firmware in PATH/$qemu_suffix
1135 --localedir=PATH install translation in PATH/$qemu_suffix
1136 --docdir=PATH install documentation in PATH/$qemu_suffix
1137 --bindir=PATH install binaries in PATH
1138 --libdir=PATH install libraries in PATH
1139 --libexecdir=PATH install helper binaries in PATH
1140 --sysconfdir=PATH install config in PATH/$qemu_suffix
1141 --localstatedir=PATH install local state in PATH (set at runtime on win32)
1142 --firmwarepath=PATH search PATH for firmware files
1143 --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs.
1144 --with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
1145 --with-pkgversion=VERS use specified string as sub-version of the package
1146 --without-default-features default all --enable-* options to "disabled"
1147 --without-default-devices do not include any device that is not needed to
1148 start the emulator (only use if you are including
1149 desired devices in configs/devices/)
1150 --with-devices-ARCH=NAME override default configs/devices
1151 --enable-debug enable common debug build options
1152 --enable-sanitizers enable default sanitizers
1153 --enable-tsan enable thread sanitizer
1154 --disable-werror disable compilation abort on warning
1155 --disable-stack-protector disable compiler-provided stack protection
1156 --audio-drv-list=LIST set audio drivers to try if -audiodev is not used
1157 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1158 --block-drv-rw-whitelist=L
1159 set block driver read-write whitelist
1160 (by default affects only QEMU, not tools like qemu-img)
1161 --block-drv-ro-whitelist=L
1162 set block driver read-only whitelist
1163 (by default affects only QEMU, not tools like qemu-img)
1164 --with-trace-file=NAME Full PATH,NAME of file to store traces
1166 --cpu=CPU Build for host CPU [$cpu]
1167 --with-coroutine=BACKEND coroutine backend. Supported options:
1168 ucontext, sigaltstack, windows
1169 --enable-gcov enable test coverage analysis with gcov
1171 enable plugins via shared library loading
1172 --disable-containers don't use containers for cross-building
1173 --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin]
1177 system all system emulation targets
1178 user supported user emulation targets
1179 linux-user all linux usermode emulation targets
1180 bsd-user all BSD usermode emulation targets
1181 pie Position Independent Executables
1182 modules modules support (non-Windows)
1183 debug-tcg TCG debugging (default is disabled)
1184 debug-info debugging information
1185 lto Enable Link-Time Optimization.
1186 safe-stack SafeStack Stack Smash Protection. Depends on
1187 clang/llvm >= 3.7 and requires coroutine backend ucontext.
1188 vhost-net vhost-net kernel acceleration support
1189 vhost-vsock virtio sockets device support
1190 vhost-scsi vhost-scsi kernel target support
1191 vhost-crypto vhost-user-crypto backend support
1192 vhost-kernel vhost kernel backend support
1193 vhost-user vhost-user backend support
1194 vhost-vdpa vhost-vdpa kernel backend support
1196 NOTE: The object files are built at the place where configure is launched
1201 # Remove old dependency files to make sure that they get properly regenerated
1202 rm -f */config-devices.mak.d
1204 if test -z "$python"
1206 error_exit
"Python not found. Use --python=/path/to/python"
1210 error_exit
"GNU make ($make) not found"
1213 # Note that if the Python conditional here evaluates True we will exit
1214 # with status 1 which is a shell 'false' value.
1215 if ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then
1216 error_exit
"Cannot use '$python', Python >= 3.6 is required." \
1217 "Use --python=/path/to/python to specify a supported Python."
1220 # Preserve python version since some functionality is dependent on it
1221 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
)
1223 # Suppress writing compiled files
1226 if test -z "$meson"; then
1227 if test "$explicit_python" = no
&& has meson
&& version_ge
"$(meson --version)" 0.59.3; then
1229 elif test $git_submodules_action != 'ignore' ; then
1231 elif test -e "${source_path}/meson/meson.py" ; then
1234 if test "$explicit_python" = yes; then
1235 error_exit
"--python requires using QEMU's embedded Meson distribution, but it was not found."
1237 error_exit
"Meson not found. Use --meson=/path/to/meson"
1241 # Meson uses its own Python interpreter to invoke other Python scripts,
1242 # but the user wants to use the one they specified with --python.
1244 # We do not want to override the distro Python interpreter (and sometimes
1245 # cannot: for example in Homebrew /usr/bin/meson is a bash script), so
1246 # just require --meson=git|internal together with --python.
1247 if test "$explicit_python" = yes; then
1250 *) error_exit
"--python requires using QEMU's embedded Meson distribution." ;;
1255 if test "$meson" = git
; then
1256 git_submodules
="${git_submodules} meson"
1261 meson
="$python ${source_path}/meson/meson.py"
1263 *) meson
=$
(command -v "$meson") ;;
1268 if test -z "$ninja"; then
1269 for c
in ninja ninja-build samu
; do
1271 ninja
=$
(command -v "$c")
1275 if test -z "$ninja"; then
1276 error_exit
"Cannot find Ninja"
1280 # Check that the C compiler works. Doing this here before testing
1281 # the host CPU ensures that we had a valid CC to autodetect the
1282 # $cpu var (and we should bail right here if that's not the case).
1283 # It also allows the help message to be printed without a CC.
1285 if compile_object
; then
1286 : C compiler works ok
1288 error_exit
"\"$cc\" either does not exist or does not work"
1290 if ! compile_prog
; then
1291 error_exit
"\"$cc\" cannot build an executable (is your linker broken?)"
1294 # Consult white-list to determine whether to enable werror
1295 # by default. Only enable by default for git builds
1296 if test -z "$werror" ; then
1297 if test "$git_submodules_action" != "ignore" && \
1298 { test "$linux" = "yes" ||
test "$mingw32" = "yes"; }; then
1305 if test "$targetos" = "bogus"; then
1306 # Now that we know that we're not printing the help and that
1307 # the compiler works (so the results of the check_defines we used
1308 # to identify the OS are reliable), if we didn't recognize the
1309 # host OS we should stop now.
1310 error_exit
"Unrecognized host OS (uname -s reports '$(uname -s)')"
1313 # Check whether the compiler matches our minimum requirements:
1315 #if defined(__clang_major__) && defined(__clang_minor__)
1316 # ifdef __apple_build_version__
1317 # if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0)
1318 # error You need at least XCode Clang v10.0 to compile QEMU
1321 # if __clang_major__ < 6 || (__clang_major__ == 6 && __clang_minor__ < 0)
1322 # error You need at least Clang v6.0 to compile QEMU
1325 #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
1326 # if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4)
1327 # error You need at least GCC v7.4.0 to compile QEMU
1330 # error You either need GCC or Clang to compiler QEMU
1332 int main (void) { return 0; }
1334 if ! compile_prog
"" "" ; then
1335 error_exit
"You need at least GCC v7.4 or Clang v6.0 (or XCode Clang v10.0)"
1338 # Accumulate -Wfoo and -Wno-bar separately.
1339 # We will list all of the enable flags first, and the disable flags second.
1340 # Note that we do not add -Werror, because that would enable it for all
1341 # configure tests. If a configure test failed due to -Werror this would
1342 # just silently disable some features, so it's too error prone.
1345 add_to warn_flags
-Wold-style-declaration
1346 add_to warn_flags
-Wold-style-definition
1347 add_to warn_flags
-Wtype-limits
1348 add_to warn_flags
-Wformat-security
1349 add_to warn_flags
-Wformat-y2k
1350 add_to warn_flags
-Winit-self
1351 add_to warn_flags
-Wignored-qualifiers
1352 add_to warn_flags
-Wempty-body
1353 add_to warn_flags
-Wnested-externs
1354 add_to warn_flags
-Wendif-labels
1355 add_to warn_flags
-Wexpansion-to-defined
1356 add_to warn_flags
-Wimplicit-fallthrough=2
1359 add_to nowarn_flags
-Wno-initializer-overrides
1360 add_to nowarn_flags
-Wno-missing-include-dirs
1361 add_to nowarn_flags
-Wno-shift-negative-value
1362 add_to nowarn_flags
-Wno-string-plus-int
1363 add_to nowarn_flags
-Wno-typedef-redefinition
1364 add_to nowarn_flags
-Wno-tautological-type-limit-compare
1365 add_to nowarn_flags
-Wno-psabi
1367 gcc_flags
="$warn_flags $nowarn_flags"
1369 cc_has_warning_flag
() {
1372 # Use the positive sense of the flag when testing for -Wno-wombat
1373 # support (gcc will happily accept the -Wno- form of unknown
1375 optflag
="$(echo $1 | sed -e 's/^-Wno-/-W/')"
1376 compile_prog
"-Werror $optflag" ""
1379 objcc_has_warning_flag
() {
1381 int main(void) { return 0; }
1384 # Use the positive sense of the flag when testing for -Wno-wombat
1385 # support (gcc will happily accept the -Wno- form of unknown
1387 optflag
="$(echo $1 | sed -e 's/^-Wno-/-W/')"
1388 do_objc
-Werror $optflag \
1389 $OBJCFLAGS $EXTRA_OBJCFLAGS $CONFIGURE_OBJCFLAGS $QEMU_OBJCFLAGS \
1390 -o $TMPE $TMPM $QEMU_LDFLAGS
1393 for flag
in $gcc_flags; do
1394 if cc_has_warning_flag
$flag ; then
1395 QEMU_CFLAGS
="$QEMU_CFLAGS $flag"
1397 if objcc_has_warning_flag
$flag ; then
1398 QEMU_OBJCFLAGS
="$QEMU_OBJCFLAGS $flag"
1402 if test "$stack_protector" != "no"; then
1404 int main(int argc, char *argv[])
1406 char arr[64], *p = arr, *c = argv[0];
1413 gcc_flags
="-fstack-protector-strong -fstack-protector-all"
1415 for flag
in $gcc_flags; do
1416 # We need to check both a compile and a link, since some compiler
1417 # setups fail only on a .c->.o compile and some only at link time
1418 if compile_object
"-Werror $flag" &&
1419 compile_prog
"-Werror $flag" ""; then
1420 QEMU_CFLAGS
="$QEMU_CFLAGS $flag"
1421 QEMU_LDFLAGS
="$QEMU_LDFLAGS $flag"
1426 if test "$stack_protector" = yes; then
1427 if test $sp_on = 0; then
1428 error_exit
"Stack protector not supported"
1433 # Disable -Wmissing-braces on older compilers that warn even for
1434 # the "universal" C zero initializer {0}.
1440 if compile_object
"-Werror" "" ; then
1443 QEMU_CFLAGS
="$QEMU_CFLAGS -Wno-missing-braces"
1446 # Our module code doesn't support Windows
1447 if test "$modules" = "yes" && test "$mingw32" = "yes" ; then
1448 error_exit
"Modules are not available for Windows"
1451 # Static linking is not possible with plugins, modules or PIE
1452 if test "$static" = "yes" ; then
1453 if test "$modules" = "yes" ; then
1454 error_exit
"static and modules are mutually incompatible"
1456 if test "$plugins" = "yes"; then
1457 error_exit
"static and plugins are mutually incompatible"
1462 test "$plugins" = "" && plugins
=yes
1467 # define THREAD __thread
1471 static THREAD int tls_var;
1472 int main(void) { return tls_var; }
1475 # Check we support -fno-pie and -no-pie first; we will need the former for
1476 # building ROMs, and both for everything if --disable-pie is passed.
1477 if compile_prog
"-Werror -fno-pie" "-no-pie"; then
1478 CFLAGS_NOPIE
="-fno-pie"
1479 LDFLAGS_NOPIE
="-no-pie"
1482 if test "$static" = "yes"; then
1483 if test "$pie" != "no" && compile_prog
"-Werror -fPIE -DPIE" "-static-pie"; then
1484 CONFIGURE_CFLAGS
="-fPIE -DPIE $CONFIGURE_CFLAGS"
1485 QEMU_LDFLAGS
="-static-pie $QEMU_LDFLAGS"
1487 elif test "$pie" = "yes"; then
1488 error_exit
"-static-pie not available due to missing toolchain support"
1490 QEMU_LDFLAGS
="-static $QEMU_LDFLAGS"
1493 elif test "$pie" = "no"; then
1494 CONFIGURE_CFLAGS
="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
1495 CONFIGURE_LDFLAGS
="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
1496 elif compile_prog
"-Werror -fPIE -DPIE" "-pie"; then
1497 CONFIGURE_CFLAGS
="-fPIE -DPIE $CONFIGURE_CFLAGS"
1498 CONFIGURE_LDFLAGS
="-pie $CONFIGURE_LDFLAGS"
1500 elif test "$pie" = "yes"; then
1501 error_exit
"PIE not available due to missing toolchain support"
1503 echo "Disabling PIE due to missing toolchain support"
1507 # Detect support for PT_GNU_RELRO + DT_BIND_NOW.
1508 # The combination is known as "full relro", because .got.plt is read-only too.
1509 if compile_prog
"" "-Wl,-z,relro -Wl,-z,now" ; then
1510 QEMU_LDFLAGS
="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS"
1513 ##########################################
1514 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
1515 # use i686 as default anyway, but for those that don't, an explicit
1516 # specification is necessary
1518 if test "$cpu" = "i386"; then
1520 static int sfaa(int *ptr)
1522 return __sync_fetch_and_and(ptr, 0);
1528 val = __sync_val_compare_and_swap(&val, 0, 1);
1533 if ! compile_prog
"" "" ; then
1534 QEMU_CFLAGS
="-march=i486 $QEMU_CFLAGS"
1538 if test "$tcg" = "enabled"; then
1539 git_submodules
="$git_submodules tests/fp/berkeley-testfloat-3"
1540 git_submodules
="$git_submodules tests/fp/berkeley-softfloat-3"
1543 if test -z "${target_list+xxx}" ; then
1545 for target
in $default_target_list; do
1546 target_list
="$target_list $target"
1548 target_list
="${target_list# }"
1551 target_list
=$
(echo "$target_list" |
sed -e 's/,/ /g')
1552 for target
in $target_list; do
1553 # Check that we recognised the target name; this allows a more
1554 # friendly error message than if we let it fall through.
1555 case " $default_target_list " in
1559 error_exit
"Unknown target name '$target'"
1565 # see if system emulation was really requested
1566 case " $target_list " in
1567 *"-softmmu "*) softmmu
=yes
1573 feature_not_found
() {
1577 error_exit
"User requested feature $feature" \
1578 "configure was not able to find it." \
1583 # big/little endian test
1586 short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1587 short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1588 int main(int argc, char *argv[])
1590 return printf("%s %s\n", (char *)big_endian, (char *)little_endian);
1594 if compile_prog
; then
1595 if strings -a $TMPE |
grep -q BiGeNdIaN
; then
1597 elif strings -a $TMPE |
grep -q LiTtLeEnDiAn
; then
1600 echo big
/little
test failed
1604 echo big
/little
test failed
1608 #########################################
1609 # vhost interdependencies and host support
1612 if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then
1613 error_exit
"vhost-user is not available on Windows"
1615 test "$vhost_vdpa" = "" && vhost_vdpa
=$linux
1616 if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then
1617 error_exit
"vhost-vdpa is only available on Linux"
1619 test "$vhost_kernel" = "" && vhost_kernel
=$linux
1620 if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then
1621 error_exit
"vhost-kernel is only available on Linux"
1624 # vhost-kernel devices
1625 test "$vhost_scsi" = "" && vhost_scsi
=$vhost_kernel
1626 if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then
1627 error_exit
"--enable-vhost-scsi requires --enable-vhost-kernel"
1629 test "$vhost_vsock" = "" && vhost_vsock
=$vhost_kernel
1630 if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then
1631 error_exit
"--enable-vhost-vsock requires --enable-vhost-kernel"
1634 # vhost-user backends
1635 test "$vhost_net_user" = "" && vhost_net_user
=$vhost_user
1636 if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then
1637 error_exit
"--enable-vhost-net-user requires --enable-vhost-user"
1639 test "$vhost_crypto" = "" && vhost_crypto
=$vhost_user
1640 if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
1641 error_exit
"--enable-vhost-crypto requires --enable-vhost-user"
1643 test "$vhost_user_fs" = "" && vhost_user_fs
=$vhost_user
1644 if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then
1645 error_exit
"--enable-vhost-user-fs requires --enable-vhost-user"
1647 #vhost-vdpa backends
1648 test "$vhost_net_vdpa" = "" && vhost_net_vdpa
=$vhost_vdpa
1649 if test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then
1650 error_exit
"--enable-vhost-net-vdpa requires --enable-vhost-vdpa"
1653 # OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity
1654 if test "$vhost_net" = ""; then
1655 test "$vhost_net_user" = "yes" && vhost_net
=yes
1656 test "$vhost_net_vdpa" = "yes" && vhost_net
=yes
1657 test "$vhost_kernel" = "yes" && vhost_net
=yes
1660 ##########################################
1663 if ! has
"$pkg_config_exe"; then
1664 error_exit
"pkg-config binary '$pkg_config_exe' not found"
1667 ##########################################
1668 # glib support probe
1671 glib_modules
=gthread-2.0
1672 if test "$modules" = yes; then
1673 glib_modules
="$glib_modules gmodule-export-2.0"
1674 elif test "$plugins" = "yes"; then
1675 glib_modules
="$glib_modules gmodule-no-export-2.0"
1678 for i
in $glib_modules; do
1679 if $pkg_config --atleast-version=$glib_req_ver $i; then
1680 glib_cflags
=$
($pkg_config --cflags $i)
1681 glib_libs
=$
($pkg_config --libs $i)
1683 error_exit
"glib-$glib_req_ver $i is required to compile QEMU"
1687 # This workaround is required due to a bug in pkg-config file for glib as it
1688 # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
1690 if test "$static" = yes && test "$mingw32" = yes; then
1691 glib_cflags
="-DGLIB_STATIC_COMPILATION $glib_cflags"
1694 # Sanity check that the current size_t matches the
1695 # size that glib thinks it should be. This catches
1696 # problems on multi-arch where people try to build
1697 # 32-bit QEMU while pointing at 64-bit glib headers
1702 #define QEMU_BUILD_BUG_ON(x) \
1703 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
1706 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
1711 if ! compile_prog
"$glib_cflags" "$glib_libs" ; then
1712 error_exit
"sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
1713 "You probably need to set PKG_CONFIG_LIBDIR"\
1714 "to point to the right pkg-config files for your"\
1718 # Silence clang warnings triggered by glib < 2.57.2
1721 typedef struct Foo {
1724 static void foo_free(Foo *f)
1728 G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free)
1729 int main(void) { return 0; }
1731 if ! compile_prog
"$glib_cflags -Werror" "$glib_libs" ; then
1732 if cc_has_warning_flag
"-Wno-unused-function"; then
1733 glib_cflags
="$glib_cflags -Wno-unused-function"
1734 CONFIGURE_CFLAGS
="$CONFIGURE_CFLAGS -Wno-unused-function"
1738 ##########################################
1739 # SHA command probe for modules
1740 if test "$modules" = yes; then
1741 shacmd_probe
="sha1sum sha1 shasum"
1742 for c
in $shacmd_probe; do
1748 if test "$shacmd" = ""; then
1749 error_exit
"one of the checksum commands is required to enable modules: $shacmd_probe"
1753 ##########################################
1757 auto | enabled | internal
)
1758 # Simpler to always update submodule, even if not needed.
1759 git_submodules
="${git_submodules} dtc"
1763 ##########################################
1767 auto | enabled | internal
)
1768 # Simpler to always update submodule, even if not needed.
1769 git_submodules
="${git_submodules} capstone"
1773 ##########################################
1774 # check and set a backend for coroutine
1776 # We prefer ucontext, but it's not always possible. The fallback
1777 # is sigcontext. On Windows the only valid backend is the Windows
1781 if test "$darwin" != "yes"; then
1783 #include <ucontext.h>
1784 #ifdef __stub_makecontext
1785 #error Ignoring glibc stub makecontext which will always fail
1787 int main(void) { makecontext(0, 0, 0); return 0; }
1789 if compile_prog
"" "" ; then
1794 if test "$coroutine" = ""; then
1795 if test "$mingw32" = "yes"; then
1797 elif test "$ucontext_works" = "yes"; then
1800 coroutine
=sigaltstack
1805 if test "$mingw32" != "yes"; then
1806 error_exit
"'windows' coroutine backend only valid for Windows"
1808 # Unfortunately the user visible backend name doesn't match the
1809 # coroutine-*.c filename for this case, so we have to adjust it here.
1813 if test "$ucontext_works" != "yes"; then
1814 feature_not_found
"ucontext"
1818 if test "$mingw32" = "yes"; then
1819 error_exit
"only the 'windows' coroutine backend is valid for Windows"
1823 error_exit
"unknown coroutine backend $coroutine"
1828 ##################################################
1832 if test "$safe_stack" = "yes"; then
1834 int main(int argc, char *argv[])
1836 #if ! __has_feature(safe_stack)
1837 #error SafeStack Disabled
1842 flag
="-fsanitize=safe-stack"
1843 # Check that safe-stack is supported and enabled.
1844 if compile_prog
"-Werror $flag" "$flag"; then
1845 # Flag needed both at compilation and at linking
1846 QEMU_CFLAGS
="$QEMU_CFLAGS $flag"
1847 QEMU_LDFLAGS
="$QEMU_LDFLAGS $flag"
1849 error_exit
"SafeStack not supported by your compiler"
1851 if test "$coroutine" != "ucontext"; then
1852 error_exit
"SafeStack is only supported by the coroutine backend ucontext"
1856 int main(int argc, char *argv[])
1858 #if defined(__has_feature)
1859 #if __has_feature(safe_stack)
1860 #error SafeStack Enabled
1866 if test "$safe_stack" = "no"; then
1867 # Make sure that safe-stack is disabled
1868 if ! compile_prog
"-Werror" ""; then
1869 # SafeStack was already enabled, try to explicitly remove the feature
1870 flag
="-fno-sanitize=safe-stack"
1871 if ! compile_prog
"-Werror $flag" "$flag"; then
1872 error_exit
"Configure cannot disable SafeStack"
1874 QEMU_CFLAGS
="$QEMU_CFLAGS $flag"
1875 QEMU_LDFLAGS
="$QEMU_LDFLAGS $flag"
1877 else # "$safe_stack" = ""
1878 # Set safe_stack to yes or no based on pre-existing flags
1879 if compile_prog
"-Werror" ""; then
1883 if test "$coroutine" != "ucontext"; then
1884 error_exit
"SafeStack is only supported by the coroutine backend ucontext"
1890 ########################################
1891 # check if ccache is interfering with
1892 # semantic analysis of macros
1897 static const int Z = 1;
1898 #define fn() ({ Z; })
1899 #define TAUT(X) ((X) == Z)
1900 #define PAREN(X, Y) (X == Y)
1902 int main(int argc, char *argv[])
1908 if (PAREN(x, y)) return 0;
1909 if (TAUT(Z)) return 0;
1914 if ! compile_object
"-Werror"; then
1918 #################################################
1919 # clang does not support glibc + FORTIFY_SOURCE.
1921 if test "$fortify_source" != "no"; then
1922 if echo |
$cc -dM -E - |
grep __clang__
> /dev
/null
2>&1 ; then
1923 fortify_source
="no";
1924 elif test -n "$cxx" && has
$cxx &&
1925 echo |
$cxx -dM -E - |
grep __clang__
>/dev
/null
2>&1 ; then
1926 fortify_source
="no";
1928 fortify_source
="yes"
1932 ##########################################
1933 # checks for sanitizers
1937 have_asan_iface_h
=no
1938 have_asan_iface_fiber
=no
1940 if test "$sanitizers" = "yes" ; then
1942 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=address" ""; then
1946 # we could use a simple skeleton for flags checks, but this also
1947 # detect the static linking issue of ubsan, see also:
1948 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
1952 void *tmp = malloc(10);
1954 return *(int *)(tmp + 2);
1959 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
1963 if check_include
"sanitizer/asan_interface.h" ; then
1964 have_asan_iface_h
=yes
1968 #include <sanitizer/asan_interface.h>
1970 __sanitizer_start_switch_fiber(0, 0, 0);
1974 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=address" "" ; then
1975 have_asan_iface_fiber
=yes
1979 # Thread sanitizer is, for now, much noisier than the other sanitizers;
1980 # keep it separate until that is not the case.
1981 if test "$tsan" = "yes" && test "$sanitizers" = "yes"; then
1982 error_exit
"TSAN is not supported with other sanitiziers."
1985 have_tsan_iface_fiber
=no
1986 if test "$tsan" = "yes" ; then
1988 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then
1992 #include <sanitizer/tsan_interface.h>
1994 __tsan_create_fiber(0);
1998 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then
1999 have_tsan_iface_fiber
=yes
2003 ##########################################
2007 auto | enabled | internal
)
2008 # Simpler to always update submodule, even if not needed.
2009 git_submodules
="${git_submodules} slirp"
2013 ##########################################
2015 # After here, no more $cc or $ld runs
2019 if test "$fortify_source" = "yes" ; then
2020 QEMU_CFLAGS
="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
2026 # Ensure there's only a single GP
2027 QEMU_CFLAGS
="-msmall-data $QEMU_CFLAGS"
2031 if test "$have_asan" = "yes"; then
2032 QEMU_CFLAGS
="-fsanitize=address $QEMU_CFLAGS"
2033 QEMU_LDFLAGS
="-fsanitize=address $QEMU_LDFLAGS"
2034 if test "$have_asan_iface_h" = "no" ; then
2035 echo "ASAN build enabled, but ASAN header missing." \
2036 "Without code annotation, the report may be inferior."
2037 elif test "$have_asan_iface_fiber" = "no" ; then
2038 echo "ASAN build enabled, but ASAN header is too old." \
2039 "Without code annotation, the report may be inferior."
2042 if test "$have_tsan" = "yes" ; then
2043 if test "$have_tsan_iface_fiber" = "yes" ; then
2044 QEMU_CFLAGS
="-fsanitize=thread $QEMU_CFLAGS"
2045 QEMU_LDFLAGS
="-fsanitize=thread $QEMU_LDFLAGS"
2047 error_exit
"Cannot enable TSAN due to missing fiber annotation interface."
2049 elif test "$tsan" = "yes" ; then
2050 error_exit
"Cannot enable TSAN due to missing sanitize thread interface."
2052 if test "$have_ubsan" = "yes"; then
2053 QEMU_CFLAGS
="-fsanitize=undefined $QEMU_CFLAGS"
2054 QEMU_LDFLAGS
="-fsanitize=undefined $QEMU_LDFLAGS"
2057 ##########################################
2059 # Exclude --warn-common with TSan to suppress warnings from the TSan libraries.
2060 if test "$solaris" = "no" && test "$tsan" = "no"; then
2061 if $ld --version 2>/dev
/null |
grep "GNU ld" >/dev
/null
2>/dev
/null
; then
2062 QEMU_LDFLAGS
="-Wl,--warn-common $QEMU_LDFLAGS"
2066 # Guest agent Windows MSI package
2068 if test "$QEMU_GA_MANUFACTURER" = ""; then
2069 QEMU_GA_MANUFACTURER
=QEMU
2071 if test "$QEMU_GA_DISTRO" = ""; then
2072 QEMU_GA_DISTRO
=Linux
2074 if test "$QEMU_GA_VERSION" = ""; then
2075 QEMU_GA_VERSION
=$
(cat $source_path/VERSION
)
2078 QEMU_GA_MSI_MINGW_BIN_PATH
="$($pkg_config --variable=prefix glib-2.0)/bin"
2080 # Mac OS X ships with a broken assembler
2082 if { test "$cpu" = "i386" ||
test "$cpu" = "x86_64"; } && \
2083 test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
2084 test "$targetos" != "haiku" && test "$softmmu" = yes ; then
2085 # Different host OS linkers have different ideas about the name of the ELF
2086 # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
2087 # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
2088 for emu
in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe
; do
2089 if "$ld" -verbose 2>&1 |
grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
2090 ld_i386_emulation
="$emu"
2097 # Only build s390-ccw bios if we're on s390x and the compiler has -march=z900
2098 # or -march=z10 (which is the lowest architecture level that Clang supports)
2099 if test "$cpu" = "s390x" ; then
2101 compile_prog
"-march=z900" ""
2103 if [ $has_z900 = 0 ] || compile_object
"-march=z10 -msoft-float -Werror"; then
2104 if [ $has_z900 != 0 ]; then
2105 echo "WARNING: Your compiler does not support the z900!"
2106 echo " The s390-ccw bios will only work with guest CPUs >= z10."
2108 roms
="$roms s390-ccw"
2109 # SLOF is required for building the s390-ccw firmware on s390x,
2110 # since it is using the libnet code from SLOF for network booting.
2111 git_submodules
="${git_submodules} roms/SLOF"
2115 # Check that the C++ compiler exists and works with the C compiler.
2116 # All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
2119 int c_function(void);
2120 int main(void) { return c_function(); }
2127 int c_function(void);
2129 int c_function(void) { return 42; }
2134 if do_cxx
$CXXFLAGS $EXTRA_CXXFLAGS $CONFIGURE_CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then
2135 # C++ compiler $cxx works ok with C compiler $cc
2138 echo "C++ compiler $cxx does not work with C compiler $cc"
2139 echo "Disabling C++ specific optional code"
2143 echo "No C++ compiler available; disabling C++ specific optional code"
2147 if !(GIT
="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
2151 config_host_mak
="config-host.mak"
2153 echo "# Automatically generated by configure - do not modify" > $config_host_mak
2154 echo >> $config_host_mak
2156 echo all
: >> $config_host_mak
2157 echo "GIT=$git" >> $config_host_mak
2158 echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
2159 echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
2161 if test "$debug_tcg" = "yes" ; then
2162 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2164 if test "$mingw32" = "yes" ; then
2165 echo "CONFIG_WIN32=y" >> $config_host_mak
2166 echo "QEMU_GA_MSI_MINGW_BIN_PATH=${QEMU_GA_MSI_MINGW_BIN_PATH}" >> $config_host_mak
2167 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
2168 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
2169 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
2171 echo "CONFIG_POSIX=y" >> $config_host_mak
2174 if test "$linux" = "yes" ; then
2175 echo "CONFIG_LINUX=y" >> $config_host_mak
2178 if test "$darwin" = "yes" ; then
2179 echo "CONFIG_DARWIN=y" >> $config_host_mak
2182 if test "$solaris" = "yes" ; then
2183 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2185 if test "$static" = "yes" ; then
2186 echo "CONFIG_STATIC=y" >> $config_host_mak
2188 echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
2189 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
2190 qemu_version
=$
(head $source_path/VERSION
)
2191 echo "PKGVERSION=$pkgversion" >>$config_host_mak
2192 echo "SRC_PATH=$source_path" >> $config_host_mak
2193 echo "TARGET_DIRS=$target_list" >> $config_host_mak
2194 if test "$modules" = "yes"; then
2195 # $shacmd can generate a hash started with digit, which the compiler doesn't
2196 # like as an symbol. So prefix it with an underscore
2197 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
2198 echo "CONFIG_MODULES=y" >> $config_host_mak
2201 if test "$vhost_scsi" = "yes" ; then
2202 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
2204 if test "$vhost_net" = "yes" ; then
2205 echo "CONFIG_VHOST_NET=y" >> $config_host_mak
2207 if test "$vhost_net_user" = "yes" ; then
2208 echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak
2210 if test "$vhost_net_vdpa" = "yes" ; then
2211 echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak
2213 if test "$vhost_crypto" = "yes" ; then
2214 echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
2216 if test "$vhost_vsock" = "yes" ; then
2217 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
2218 if test "$vhost_user" = "yes" ; then
2219 echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak
2222 if test "$vhost_kernel" = "yes" ; then
2223 echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
2225 if test "$vhost_user" = "yes" ; then
2226 echo "CONFIG_VHOST_USER=y" >> $config_host_mak
2228 if test "$vhost_vdpa" = "yes" ; then
2229 echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak
2231 if test "$vhost_user_fs" = "yes" ; then
2232 echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
2235 # XXX: suppress that
2236 if [ "$bsd" = "yes" ] ; then
2237 echo "CONFIG_BSD=y" >> $config_host_mak
2240 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
2242 if test "$have_asan_iface_fiber" = "yes" ; then
2243 echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak
2246 if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then
2247 echo "CONFIG_TSAN=y" >> $config_host_mak
2250 if test "$plugins" = "yes" ; then
2251 echo "CONFIG_PLUGIN=y" >> $config_host_mak
2254 if test -n "$gdb_bin"; then
2255 gdb_version
=$
($gdb_bin --version |
head -n 1)
2256 if version_ge
${gdb_version##* } 9.1; then
2257 echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
2261 echo "ROMS=$roms" >> $config_host_mak
2262 echo "MAKE=$make" >> $config_host_mak
2263 echo "PYTHON=$python" >> $config_host_mak
2264 echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
2265 echo "MESON=$meson" >> $config_host_mak
2266 echo "NINJA=$ninja" >> $config_host_mak
2267 echo "CC=$cc" >> $config_host_mak
2268 echo "AR=$ar" >> $config_host_mak
2269 echo "AS=$as" >> $config_host_mak
2270 echo "CCAS=$ccas" >> $config_host_mak
2271 echo "CPP=$cpp" >> $config_host_mak
2272 echo "OBJCOPY=$objcopy" >> $config_host_mak
2273 echo "LD=$ld" >> $config_host_mak
2274 echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
2275 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
2276 echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
2277 echo "QEMU_OBJCFLAGS=$QEMU_OBJCFLAGS" >> $config_host_mak
2278 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
2279 echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
2280 echo "GLIB_VERSION=$(pkg-config --modversion glib-2.0)" >> $config_host_mak
2281 echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
2282 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
2283 echo "STRIP=$strip" >> $config_host_mak
2284 echo "EXESUF=$EXESUF" >> $config_host_mak
2286 # use included Linux headers
2287 if test "$linux" = "yes" ; then
2288 mkdir
-p linux-headers
2303 linux_arch
=loongarch
2309 # For most CPUs the kernel architecture name and QEMU CPU name match.
2313 # For non-KVM architectures we will not have asm headers
2314 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
2315 symlink
"$source_path/linux-headers/asm-$linux_arch" linux-headers
/asm
2319 for target
in $target_list; do
2320 target_dir
="$target"
2321 target_name
=$
(echo $target | cut
-d '-' -f 1)$EXESUF
2322 mkdir
-p $target_dir
2324 *-user) symlink
"../qemu-$target_name" "$target_dir/qemu-$target_name" ;;
2325 *) symlink
"../qemu-system-$target_name" "$target_dir/qemu-system-$target_name" ;;
2329 echo "CONFIG_QEMU_INTERP_PREFIX=$interp_prefix" |
sed 's/%M/@0@/' >> $config_host_mak
2330 if test "$default_targets" = "yes"; then
2331 echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
2334 if test "$ccache_cpp2" = "yes"; then
2335 echo "export CCACHE_CPP2=y" >> $config_host_mak
2338 if test "$safe_stack" = "yes"; then
2339 echo "CONFIG_SAFESTACK=y" >> $config_host_mak
2342 # If we're using a separate build tree, set it up now.
2343 # LINKS are things to symlink back into the source tree
2344 # (these can be both files and directories).
2345 # Caution: do not add files or directories here using wildcards. This
2346 # will result in problems later if a new file matching the wildcard is
2347 # added to the source tree -- nothing will cause configure to be rerun
2348 # so the build tree will be missing the link back to the new file, and
2349 # tests might fail. Prefer to keep the relevant files in their own
2350 # directory and symlink the directory instead.
2352 LINKS
="$LINKS tests/tcg/Makefile.target"
2353 LINKS
="$LINKS pc-bios/optionrom/Makefile"
2354 LINKS
="$LINKS pc-bios/s390-ccw/Makefile"
2355 LINKS
="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
2356 LINKS
="$LINKS tests/avocado tests/data"
2357 LINKS
="$LINKS tests/qemu-iotests/check"
2358 LINKS
="$LINKS python"
2359 LINKS
="$LINKS contrib/plugins/Makefile "
2361 $source_path/pc-bios
/*.bin \
2362 $source_path/pc-bios
/*.elf \
2363 $source_path/pc-bios
/*.lid \
2364 $source_path/pc-bios
/*.rom \
2365 $source_path/pc-bios
/*.dtb \
2366 $source_path/pc-bios
/*.img \
2367 $source_path/pc-bios
/openbios-
* \
2368 $source_path/pc-bios
/u-boot.
* \
2369 $source_path/pc-bios
/palcode-
* \
2370 $source_path/pc-bios
/qemu_vga.ndrv
2373 LINKS
="$LINKS pc-bios/$(basename $bios_file)"
2375 for f
in $LINKS ; do
2376 if [ -e "$source_path/$f" ]; then
2377 mkdir
-p `dirname ./$f`
2378 symlink
"$source_path/$f" "$f"
2382 (for i
in $cross_cc_vars; do
2385 export target_list source_path use_containers cpu host_cc
2386 $source_path/tests
/tcg
/configure.sh
)
2388 config_mak
=pc-bios
/optionrom
/config.mak
2389 echo "# Automatically generated by configure - do not modify" > $config_mak
2390 echo "TOPSRC_DIR=$source_path" >> $config_mak
2392 if test "$skip_meson" = no
; then
2393 cross
="config-meson.cross.new"
2395 test $# = 0 && return
2396 echo "'$(echo $* | sed "s
/ /','/g
")'"
2399 echo "# Automatically generated by configure - do not modify" > $cross
2400 echo "[properties]" >> $cross
2402 # unroll any custom device configs
2403 for a
in $device_archs; do
2404 eval "c=\$devices_${a}"
2405 echo "${a}-softmmu = '$c'" >> $cross
2408 test -z "$cxx" && echo "link_language = 'c'" >> $cross
2409 echo "[built-in options]" >> $cross
2410 echo "c_args = [$(meson_quote $CFLAGS $EXTRA_CFLAGS)]" >> $cross
2411 echo "cpp_args = [$(meson_quote $CXXFLAGS $EXTRA_CXXFLAGS)]" >> $cross
2412 test -n "$objcc" && echo "objc_args = [$(meson_quote $OBJCFLAGS $EXTRA_OBJCFLAGS)]" >> $cross
2413 echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross
2414 echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross
2415 echo "[binaries]" >> $cross
2416 echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross
2417 test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross
2418 test -n "$objcc" && echo "objc = [$(meson_quote $objcc $CPU_CFLAGS)]" >> $cross
2419 echo "ar = [$(meson_quote $ar)]" >> $cross
2420 echo "nm = [$(meson_quote $nm)]" >> $cross
2421 echo "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross
2422 echo "ranlib = [$(meson_quote $ranlib)]" >> $cross
2423 if has
$sdl2_config; then
2424 echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross
2426 echo "strip = [$(meson_quote $strip)]" >> $cross
2427 echo "widl = [$(meson_quote $widl)]" >> $cross
2428 echo "windres = [$(meson_quote $windres)]" >> $cross
2429 if test "$cross_compile" = "yes"; then
2430 cross_arg
="--cross-file config-meson.cross"
2431 echo "[host_machine]" >> $cross
2432 echo "system = '$targetos'" >> $cross
2435 echo "cpu_family = 'x86'" >> $cross
2438 echo "cpu_family = '$cpu'" >> $cross
2441 echo "cpu = '$cpu'" >> $cross
2442 if test "$bigendian" = "yes" ; then
2443 echo "endian = 'big'" >> $cross
2445 echo "endian = 'little'" >> $cross
2448 cross_arg
="--native-file config-meson.cross"
2450 mv $cross config-meson.cross
2452 rm -rf meson-private meson-info meson-logs
2454 NINJA
=$ninja $meson setup \
2455 --prefix "$prefix" \
2456 --libdir "$libdir" \
2457 --libexecdir "$libexecdir" \
2458 --bindir "$bindir" \
2459 --includedir "$includedir" \
2460 --datadir "$datadir" \
2461 --mandir "$mandir" \
2462 --sysconfdir "$sysconfdir" \
2463 --localedir "$localedir" \
2464 --localstatedir "$local_statedir" \
2465 -Ddefault_devices=$default_devices \
2466 -Ddocdir="$docdir" \
2467 -Dqemu_firmwarepath="$firmwarepath" \
2468 -Dqemu_suffix="$qemu_suffix" \
2470 -Doptimization=$
(if test "$debug" = yes; then echo 0; else echo 2; fi) \
2471 -Ddebug=$
(if test "$debug_info" = yes; then echo true
; else echo false
; fi) \
2472 -Dwerror=$
(if test "$werror" = yes; then echo true
; else echo false
; fi) \
2473 -Db_pie=$
(if test "$pie" = yes; then echo true
; else echo false
; fi) \
2474 -Db_coverage=$
(if test "$gcov" = yes; then echo true
; else echo false
; fi) \
2475 -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg \
2476 -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
2477 $
(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \
2478 $
(if test "$default_feature" = no
; then echo "-Dauto_features=disabled"; fi) \
2479 "$@" $cross_arg "$PWD" "$source_path"
2481 eval run_meson
$meson_options
2482 if test "$?" -ne 0 ; then
2483 error_exit
"meson setup failed"
2486 if test -f meson-private
/cmd_line.txt
; then
2487 # Adjust old command line options whose type was changed
2488 # Avoids having to use "setup --wipe" when Meson is upgraded
2490 s/^gettext = true$/gettext = auto/;
2491 s/^gettext = false$/gettext = disabled/;
2492 /^b_staticpic/ && next;
2493 print;' meson-private
/cmd_line.txt
2497 # Save the configure command line for later reuse.
2498 cat <<EOD >config.status
2500 # Generated by configure.
2501 # Run this file to recreate the current configuration.
2502 # Compiler output produced by configure, useful for debugging
2503 # configure, is in config.log if it exists.
2509 eval envval
=\$
$envname
2511 if test -n "$envval"
2513 echo "$envname='$envval'" >> config.status
2514 echo "export $envname" >> config.status
2516 echo "unset $envname" >> config.status
2520 # Preserve various env variables that influence what
2521 # features/build target configure will detect
2528 preserve_env CXXFLAGS
2529 preserve_env INSTALL
2531 preserve_env LDFLAGS
2532 preserve_env LD_LIBRARY_PATH
2533 preserve_env LIBTOOL
2536 preserve_env OBJCOPY
2538 preserve_env PKG_CONFIG
2539 preserve_env PKG_CONFIG_LIBDIR
2540 preserve_env PKG_CONFIG_PATH
2542 preserve_env SDL2_CONFIG
2546 preserve_env WINDRES
2548 printf "exec" >>config.status
2549 for i
in "$0" "$@"; do
2550 test "$i" = --skip-meson ||
printf " %s" "$(quote_sh "$i")" >>config.status
2552 echo ' "$@"' >>config.status
2553 chmod +x config.status