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. Unlike autoconf, we assume that unset exists.
8 unset CLICOLOR_FORCE GREP_OPTIONS BASH_ENV ENV MAIL MAILPATH CDPATH
10 # Don't allow CCACHE, if present, to use cached results of compile tests!
11 export CCACHE_RECACHE
=yes
13 # make source path absolute
14 source_path
=$
(cd "$(dirname -- "$0")"; pwd)
16 if test "$PWD" -ef "$source_path"
18 echo "Using './build' as the directory for build output"
20 MARKER
=build
/auto-created-by-configure
28 echo "ERROR: ./build dir already exists and was not previously created by configure"
33 if ! mkdir build ||
! touch $MARKER
35 echo "ERROR: Could not create ./build directory. Check the permissions on"
36 echo "your source directory, or try doing an out-of-tree build."
40 cat > GNUmakefile
<<'EOF'
41 # This file is auto-generated by configure to support in-source tree
42 # 'make' command invocation
45 @echo 'changing dir to build for $(MAKE) "$(MAKECMDGOALS)"...'
46 @$(MAKE) -C build -f Makefile $(MAKECMDGOALS)
47 @if test "$(MAKECMDGOALS)" = "distclean" && \
48 test -e build/auto-created-by-configure ; \
50 rm -rf build GNUmakefile ; \
59 exec "$source_path/configure" "$@"
62 # Temporary directory used for files created while
63 # configure runs. Since it is in the build directory
64 # we can safely blow away any previous version of it
65 # (and we need not jump through hoops to try to delete
66 # it when configure exits.)
69 if ! mkdir
-p "${TMPDIR1}"; then
70 echo "ERROR: failed to create temporary directory"
75 TMPC
="${TMPDIR1}/${TMPB}.c"
76 TMPO
="${TMPDIR1}/${TMPB}.o"
77 TMPE
="${TMPDIR1}/${TMPB}.exe"
81 # Print a helpful header at the top of config.log
82 echo "# QEMU configure log $(date)" >> config.log
83 printf "# Configured with:" >> config.log
84 # repeat the invocation to log and stdout for CI
85 invoke
=$
(printf " '%s'" "$0" "$@")
86 test -n "$GITLAB_CI" && echo "configuring with: $invoke"
87 { echo "$invoke"; echo; echo "#"; } >> config.log
90 printf "%s" "$1" |
sed "s,','\\\\'',g; s,.*,'&',"
96 while test -n "$2"; do
105 # Run the compiler, capturing its output to the log. First argument
106 # is compiler binary to execute.
109 if test -n "$BASH_VERSION"; then eval '
111 funcs: ${FUNCNAME[*]}
112 lines: ${BASH_LINENO[*]}"
114 echo $compiler "$@" >> config.log
115 $compiler "$@" >> config.log
2>&1 ||
return $?
119 do_compiler
"$cc" $CPU_CFLAGS "$@"
124 do_cc
$CFLAGS $EXTRA_CFLAGS $local_cflags -c -o $TMPO $TMPC
130 do_cc
$CFLAGS $EXTRA_CFLAGS $local_cflags -o $TMPE $TMPC \
131 $LDFLAGS $EXTRA_LDFLAGS $local_ldflags
134 # symbolically link $1 to $2. Portable version of "ln -sf".
137 mkdir
-p "$(dirname "$2")"
141 # check whether a command is available to this shell (may be either an
142 # executable or a builtin)
144 type "$1" >/dev
/null
2>&1
148 local_ver1
=$
(expr "$1" : '\([0-9.]*\)' |
tr .
' ')
149 local_ver2
=$
(echo "$2" |
tr .
' ')
153 # 'shift 2' if $2 is set, or 'shift' if $2 is not set
157 # the second argument finished, the first must be greater or equal
158 test $# = 1 && return 0
159 test $local_first -lt $2 && return 1
160 test $local_first -gt $2 && return 0
166 if printf %s
\\n
"$source_path" "$PWD" |
grep -q "[[:space:]:]";
168 error_exit
"main directory cannot contain spaces nor colons"
171 # parse CC options first; some compiler tests are used to establish
172 # some defaults, based on the host environment
175 container_engine
="auto"
185 # Default value for a variable defining feature "foo".
186 # * foo="no" feature will only be used if --enable-foo arg is given
187 # * foo="" feature will be searched for, and if found, will be used
188 # unless --disable-foo is given
189 # * foo="yes" this value will only be set by --enable-foo flag.
190 # feature will searched for,
191 # if not found, configure exits with error
193 # Always add --enable-foo and --disable-foo command line args.
194 # Distributions want to ensure that several features are compiled in, and it
195 # is impossible without a --enable-foo that exits if a feature is not found.
199 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
201 --cross-prefix=*) cross_prefix
="$optarg"
206 --cxx=*) CXX
="$optarg"
208 --objcc=*) objcc
="$optarg"
210 --rustc=*) RUSTC
="$optarg"
212 --rustdoc=*) RUSTDOC
="$optarg"
214 --cpu=*) cpu
="$optarg"
217 EXTRA_CFLAGS
="$EXTRA_CFLAGS $optarg"
218 EXTRA_CXXFLAGS
="$EXTRA_CXXFLAGS $optarg"
219 EXTRA_OBJCFLAGS
="$EXTRA_OBJCFLAGS $optarg"
221 --extra-cxxflags=*) EXTRA_CXXFLAGS
="$EXTRA_CXXFLAGS $optarg"
223 --extra-objcflags=*) EXTRA_OBJCFLAGS
="$EXTRA_OBJCFLAGS $optarg"
225 --extra-ldflags=*) EXTRA_LDFLAGS
="$EXTRA_LDFLAGS $optarg"
227 --cross-cc-*[!a-zA-Z0-9_-
]*=*) error_exit
"Passed bad --cross-cc-FOO option"
229 --cross-cc-cflags-*) cc_arch
=${opt#--cross-cc-cflags-}; cc_arch
=${cc_arch%%=*}
230 eval "cross_cc_cflags_${cc_arch}=\$optarg"
232 --cross-cc-*) cc_arch
=${opt#--cross-cc-}; cc_arch
=${cc_arch%%=*}
233 eval "cross_cc_${cc_arch}=\$optarg"
235 --cross-prefix-*[!a-zA-Z0-9_-
]*=*) error_exit
"Passed bad --cross-prefix-FOO option"
237 --cross-prefix-*) cc_arch
=${opt#--cross-prefix-}; cc_arch
=${cc_arch%%=*}
238 eval "cross_prefix_${cc_arch}=\$optarg"
240 --without-default-features) default_feature
="no"
245 default_cflags
='-O2 -g'
246 git_submodules_action
="update"
252 plugins
="$default_feature"
260 rust_target_triple
=""
261 gdb_bin
=$
(command -v "gdb-multiarch" ||
command -v "gdb")
264 # Don't accept a target_list environment variable.
266 unset target_list_exclude
268 # The following Meson options are handled manually (still they
269 # are included in the automatically generated help message)
270 # because they automatically enable/disable other options
274 # Meson has PIE as a boolean rather than enabled/disabled/auto,
275 # and we also need to check for -static-pie before Meson runs
276 # which requires knowing whether --static is enabled.
280 # Preferred compiler:
282 # ${cross_prefix}gcc (if cross-prefix specified)
284 if test -z "${CC}${cross_prefix}"; then
287 cc
="${CC-${cross_prefix}gcc}"
290 if test -z "${CXX}${cross_prefix}"; then
293 cxx
="${CXX-${cross_prefix}g++}"
296 # Preferred ObjC compiler:
297 # $objcc (if set, i.e. via --objcc option)
298 # ${cross_prefix}clang (if cross-prefix specified)
299 # clang (if available)
301 if test -z "${objcc}${cross_prefix}"; then
308 objcc
="${objcc-${cross_prefix}clang}"
311 ar="${AR-${cross_prefix}ar}"
312 as
="${AS-${cross_prefix}as}"
314 dlltool
="${DLLTOOL-${cross_prefix}dlltool}"
315 objcopy
="${OBJCOPY-${cross_prefix}objcopy}"
316 ld
="${LD-${cross_prefix}ld}"
317 ranlib
="${RANLIB-${cross_prefix}ranlib}"
318 nm
="${NM-${cross_prefix}nm}"
319 readelf
="${READELF-${cross_prefix}readelf}"
320 strip
="${STRIP-${cross_prefix}strip}"
321 widl
="${WIDL-${cross_prefix}widl}"
322 windres
="${WINDRES-${cross_prefix}windres}"
323 windmc
="${WINDMC-${cross_prefix}windmc}"
324 pkg_config
="${PKG_CONFIG-${cross_prefix}pkg-config}"
325 sdl2_config
="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
327 rustc
="${RUSTC-rustc}"
328 rustdoc
="${RUSTDOC-rustdoc}"
333 #error $1 not defined
335 int main(void) { return 0; }
342 int main(void) { return 0; }
346 if check_define __linux__
; then
348 elif check_define _WIN32
; then
350 elif check_define __OpenBSD__
; then
352 elif check_define __sun__
; then
354 elif check_define __HAIKU__
; then
356 elif check_define __FreeBSD__
; then
358 elif check_define __FreeBSD_kernel__
&& check_define __GLIBC__
; then
360 elif check_define __DragonFly__
; then
362 elif check_define __NetBSD__
; then
364 elif check_define __APPLE__
; then
366 elif check_define EMSCRIPTEN
; then
371 # This is a fatal error, but don't report it yet, because we
372 # might be going to just print the --help text, or it might
373 # be the result of a missing compiler.
377 if test ! -z "$cpu" ; then
378 # command line argument
380 elif check_define __i386__
; then
382 elif check_define __x86_64__
; then
383 if check_define __ILP32__
; then
388 elif check_define __sparc__
; then
389 if check_define __arch64__
; then
394 elif check_define _ARCH_PPC
; then
395 if check_define _ARCH_PPC64
; then
396 if check_define _LITTLE_ENDIAN
; then
404 elif check_define __mips__
; then
405 if check_define __mips64
; then
410 elif check_define __s390__
; then
411 if check_define __s390x__
; then
416 elif check_define __riscv
; then
417 if check_define _LP64
; then
422 elif check_define __arm__
; then
424 elif check_define __aarch64__
; then
426 elif check_define __loongarch64
; then
429 # Using uname is really broken, but it is just a fallback for architectures
430 # that are going to use TCI anyway
432 if test "$host_os" != "bogus"; then
433 echo "WARNING: unrecognized host CPU, proceeding with 'uname -m' output '$cpu'"
437 # Normalise host CPU name to the values used by Meson cross files and in source
438 # directories, and set multilib cflags. The canonicalization isn't really
439 # necessary, because the architectures that we check for should not hit the
440 # 'uname -m' case, but better safe than sorry in case --cpu= is used.
442 # Note that this case should only have supported host CPUs, not guests.
443 # Please keep it sorted and synchronized with meson.build's host_arch.
468 host_arch
=loongarch64
491 CPU_CFLAGS
="-m64 -mbig-endian"
497 CPU_CFLAGS
="-m64 -mlittle-endian"
517 CPU_CFLAGS
="-m32 -mv8plus -mcpu=ultrasparc"
521 CPU_CFLAGS
="-m64 -mcpu=ultrasparc"
541 if test -n "$host_arch" && {
542 ! test -d "$source_path/linux-user/include/host/$host_arch" ||
543 ! test -d "$source_path/common-user/host/$host_arch"; }; then
544 error_exit
"linux-user/include/host/$host_arch does not exist." \
545 "This is a bug in the configure script, please report it."
547 if test -n "$linux_arch" && ! test -d "$source_path/linux-headers/asm-$linux_arch"; then
548 error_exit
"linux-headers/asm-$linux_arch does not exist." \
549 "This is a bug in the configure script, please report it."
553 # We require python >= 3.9.
554 # NB: a True python conditional creates a non-zero return code (Failure)
555 "$1" -c 'import sys; sys.exit(sys.version_info < (3,9))'
559 if test -z "${PYTHON}"; then
560 # A bare 'python' is traditionally python 2.x, but some distros
561 # have it as python 3.x, so check in both places.
562 for binary
in python3 python python3.13 python3.12 python3.11 \
563 python3.10 python3.9
; do
564 if has
"$binary"; then
565 python
=$
(command -v "$binary")
566 if check_py_version
"$python"; then
576 # Same as above, but only check the environment variable.
577 has
"${PYTHON}" || error_exit
"The PYTHON environment variable does not point to an executable"
578 python
=$
(command -v "$PYTHON")
579 if check_py_version
"$python"; then
583 first_python
=$first_python
587 # Check for ancillary tools used in testing
589 for binary
in genisoimage mkisofs
593 genisoimage
=$
(command -v "$binary")
598 if test "$host_os" = "windows" ; then
602 meson_option_build_array
() {
604 (if test "$host_os" = windows
; then
611 # backslash escape any '\' and '"' characters
612 printf "%s" "$e" |
sed -e 's/\([\"]\)/\\\1/g'
618 .
"$source_path/scripts/meson-buildoptions.sh"
624 meson_options
="$meson_options $(quote_sh "$arg")"
627 meson_option_parse
() {
628 meson_options
="$meson_options $(_meson_option_parse "$@
")"
629 if test $?
-eq 1; then
630 echo "ERROR: unknown option $1"
631 echo "Try '$0 --help' for more information"
636 test "${meson_options#*"$1"}" != "$meson_options"
639 meson_add_machine_file
() {
640 if test "$cross_compile" = "yes"; then
641 meson_option_add
--cross-file "$1"
643 meson_option_add
--native-file "$1"
648 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
650 --help|
-h) show_help
=yes
652 --version|
-V) exec cat "$source_path/VERSION"
658 --host-cc=*) host_cc
="$optarg"
672 --python=*) python
="$optarg"
674 --skip-meson) skip_meson
=yes
676 --ninja=*) ninja
="$optarg"
690 --enable-docs) docs
=enabled
692 --disable-docs) docs
=disabled
696 --target-list=*) target_list
="$optarg"
697 if test "$target_list_exclude"; then
698 error_exit
"Can't mix --target-list with --target-list-exclude"
701 --target-list-exclude=*) target_list_exclude
="$optarg"
702 if test "$target_list"; then
703 error_exit
"Can't mix --target-list-exclude with --target-list"
706 --with-default-devices) meson_option_add
-Ddefault_devices=true
708 --without-default-devices) meson_option_add
-Ddefault_devices=false
710 --with-devices-*[!a-zA-Z0-9_-
]*=*) error_exit
"Passed bad --with-devices-FOO option"
712 --with-devices-*) device_arch
=${opt#--with-devices-};
713 device_arch
=${device_arch%%=*}
714 cf
=$source_path/configs
/devices
/$device_arch-softmmu/$optarg.mak
715 if test -f "$cf"; then
716 device_archs
="$device_archs $device_arch"
717 eval "devices_${device_arch}=\$optarg"
719 error_exit
"File $cf does not exist"
722 --without-default-features) # processed above
724 --static) static
="yes"
727 --disable-dependency-tracking|\
728 --sbindir=*|
--sharedstatedir=*|\
729 --oldincludedir=*|
--datarootdir=*|
--infodir=*|\
730 --htmldir=*|
--dvidir=*|
--pdfdir=*|
--psdir=*)
731 # These switches are silently ignored, for compatibility with
732 # autoconf-generated configure scripts. This allows QEMU's
733 # configure to be used by RPM and similar macros that set
734 # lots of directory switches by default.
737 # Enable debugging options that aren't excessively noisy
738 meson_option_parse
--enable-debug-tcg ""
739 meson_option_parse
--enable-debug-graph-lock ""
740 meson_option_parse
--enable-debug-mutex ""
741 meson_option_add
-Doptimization=0
742 default_cflags
='-O0 -g'
744 --disable-tcg) tcg
="disabled"
746 --enable-tcg) tcg
="enabled"
748 --disable-system) system
="no"
750 --enable-system) system
="yes"
757 --disable-linux-user) linux_user
="no"
759 --enable-linux-user) linux_user
="yes"
761 --disable-bsd-user) bsd_user
="no"
763 --enable-bsd-user) bsd_user
="yes"
765 --enable-pie) pie
="yes"
767 --disable-pie) pie
="no"
769 --enable-cfi) cfi
=true
771 --disable-cfi) cfi
=false
773 --disable-download) download
="disabled"; git_submodules_action
=validate
;
775 --enable-download) download
="enabled"; git_submodules_action
=update
;
777 --enable-plugins) plugins
="yes"
779 --disable-plugins) plugins
="no"
781 --enable-containers) use_containers
="yes"
783 --disable-containers) use_containers
="no"
785 --container-engine=*) container_engine
="$optarg"
787 --rust-target-triple=*) rust_target_triple
="$optarg"
789 --gdb=*) gdb_bin
="$optarg"
791 --enable-rust) rust
=enabled
793 --disable-rust) rust
=disabled
795 # everything else has the same name in configure and meson
796 --*) meson_option_parse
"$opt" "$optarg"
798 # Pass through -Dxxxx options to meson
799 -D*) meson_option_add
"$opt"
804 if ! test -e "$source_path/.git"
806 git_submodules_action
="validate"
809 if ! test -f "$source_path/subprojects/keycodemapdb/README" \
810 && test "$download" = disabled
813 echo "ERROR: missing subprojects"
815 if test -e "$source_path/.git"; then
816 echo "--disable-download specified but subprojects were not"
817 echo 'checked out. Please invoke "meson subprojects download"'
818 echo "before configuring QEMU, or remove --disable-download"
819 echo "from the command line."
821 echo "This is not a GIT checkout but subproject content appears to"
822 echo "be missing. Do not use 'git archive' or GitHub download links"
823 echo "to acquire QEMU source archives. Non-GIT builds are only"
824 echo "supported with source archives linked from:"
826 echo " https://www.qemu.org/download/#source"
828 echo "Developers working with GIT can use scripts/archive-source.sh"
829 echo "if they need to create valid source archives."
835 default_target_list
=""
838 if [ -n "$host_arch" ] && [ -d "$source_path/common-user/host/$host_arch" ]; then
839 if [ "$linux_user" != no
]; then
840 if [ "$host_os" = linux
]; then
842 elif [ "$linux_user" = yes ]; then
843 error_exit
"linux-user not supported on this architecture"
845 if [ "$linux_user" = "yes" ]; then
846 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-linux-user.mak"
849 if [ "$bsd_user" != no
]; then
850 if [ "$bsd_user" = "" ]; then
851 test $host_os = freebsd
&& bsd_user
=yes
853 if [ "$bsd_user" = yes ] && ! [ -d "$source_path/bsd-user/$host_os" ]; then
854 error_exit
"bsd-user not supported on this host OS"
856 if [ "$bsd_user" = "yes" ]; then
857 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-bsd-user.mak"
861 if [ "$linux_user" = yes ] ||
[ "$bsd_user" = yes ]; then
862 error_exit
"user mode emulation not supported on this architecture"
865 if [ "$system" = "yes" ]; then
866 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-softmmu.mak"
869 for config
in $mak_wilds; do
870 target
="$(basename "$config" .mak)"
871 if echo "$target_list_exclude" |
grep -vq "$target"; then
872 default_target_list
="${default_target_list} $target"
876 if test x
"$show_help" = x
"yes" ; then
879 Usage: configure [options]
880 Options: [defaults in brackets after descriptions]
883 --help print this message
884 --target-list=LIST set target list (default: build all)
885 $(echo Available targets: $default_target_list | \
886 fold -s -w 53 | sed -e 's/^/ /')
887 --target-list-exclude=LIST exclude a set of targets from the default target-list
889 Advanced options (experts only):
890 -Dmesonoptname=val passthrough option to meson unmodified
891 --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix]
892 --cc=CC use C compiler CC [$cc]
893 --host-cc=CC when cross compiling, use C compiler CC for code run
894 at build time [$host_cc]
895 --cxx=CXX use C++ compiler CXX [$cxx]
896 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
897 --rustc=RUSTC use Rust compiler RUSTC [$rustc]
898 --rustdoc=RUSTDOC use rustdoc binary RUSTDOC [$rustdoc]
899 --extra-cflags=CFLAGS append extra C compiler flags CFLAGS
900 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
901 --extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
902 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
903 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases
904 --cross-cc-cflags-ARCH= use compiler flags when building ARCH guest tests
905 --cross-prefix-ARCH=PREFIX cross compiler prefix when building ARCH guest test cases
906 --python=PYTHON use specified python [$python]
907 --ninja=NINJA use specified ninja [$ninja]
908 --static enable static build [$static]
909 --rust-target-triple=TRIPLE compilation target for Rust code [autodetect]
910 --without-default-features default all --enable-* options to "disabled"
911 --without-default-devices do not include any device that is not needed to
912 start the emulator (only use if you are including
913 desired devices in configs/devices/)
914 --with-devices-ARCH=NAME override default configs/devices
915 --enable-debug enable common debug build options
916 --cpu=CPU Build for host CPU [$cpu]
917 --disable-containers don't use containers for cross-building
918 --container-engine=TYPE which container engine to use [$container_engine]
919 --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin]
923 system all system emulation targets
924 user supported user emulation targets
925 linux-user all linux usermode emulation targets
926 bsd-user all BSD usermode emulation targets
927 pie Position Independent Executables
929 NOTE: The object files are built at the place where configure is launched
934 # Now that we are sure that the user did not only want to print the --help
935 # information, we should double-check that the C compiler really works:
937 if ! compile_object
; then
938 error_exit
"C compiler \"$cc\" either does not exist or does not work."
941 # Remove old dependency files to make sure that they get properly regenerated
942 rm -f .
/*/config-devices.mak.d
946 # If first_python is set, there was a binary somewhere even though
947 # it was not suitable. Use it for the error message.
948 if test -n "$first_python"; then
949 error_exit
"Cannot use '$first_python', Python >= 3.9 is required." \
950 "Use --python=/path/to/python to specify a supported Python."
952 error_exit
"Python not found. Use --python=/path/to/python"
956 if ! check_py_version
"$python"; then
957 error_exit
"Cannot use '$python', Python >= 3.9 is required." \
958 "Use --python=/path/to/python to specify a supported Python." \
960 " openSUSE Leap 15.3+: zypper install python39" \
961 " CentOS: dnf install python3.12"
965 python
="$(command -v "$python")"
967 # Create a Python virtual environment using our configured python.
968 # The stdout of this script will be the location of a symlink that
969 # points to the configured Python.
970 # Entry point scripts for pip, meson, and sphinx are generated if those
971 # packages are present.
973 # Defaults assumed for now:
974 # - venv is cleared if it exists already;
975 # - venv is allowed to use system packages;
976 # - all setup can be performed offline;
977 # - missing packages may be fetched from PyPI,
978 # unless --disable-download is passed.
979 # - pip is not installed into the venv when possible,
980 # but ensurepip is called as a fallback when necessary.
982 echo "python determined to be '$python'"
983 echo "python version: $($python --version)"
985 python
="$($python -B "${source_path}/python
/scripts
/mkvenv.py
" create pyvenv)"
986 if test "$?" -ne 0 ; then
987 error_exit
"python venv creation failed"
990 # Suppress writing compiled files
992 mkvenv
="$python ${source_path}/python/scripts/mkvenv.py"
994 # Finish preparing the virtual environment using vendored .whl files
996 $mkvenv ensuregroup
--dir "${source_path}/python/wheels" \
997 ${source_path}/pythondeps.toml meson ||
exit 1
999 # At this point, we expect Meson to be installed and available.
1000 # We expect mkvenv or pip to have created pyvenv/bin/meson for us.
1001 # We ignore PATH completely here: we want to use the venv's Meson
1004 meson
="$(cd pyvenv/bin; pwd)/meson"
1006 # Conditionally ensure Sphinx is installed.
1008 mkvenv_online_flag
=""
1009 if test "$download" = "enabled" ; then
1010 mkvenv_online_flag
=" --online"
1013 if test "$docs" != "disabled" ; then
1014 if ! $mkvenv ensuregroup \
1015 $
(test "$docs" = "enabled" && echo "$mkvenv_online_flag") \
1016 ${source_path}/pythondeps.toml docs
;
1018 if test "$docs" = "enabled" ; then
1021 echo "Sphinx not found/usable, disabling docs."
1030 if test -z "$ninja"; then
1031 for c
in ninja ninja-build samu
; do
1033 ninja
=$
(command -v "$c")
1037 if test -z "$ninja"; then
1038 error_exit
"Cannot find Ninja"
1042 if test "$host_os" = "bogus"; then
1043 # Now that we know that we're not printing the help and that
1044 # the compiler works (so the results of the check_defines we used
1045 # to identify the OS are reliable), if we didn't recognize the
1046 # host OS we should stop now.
1047 error_exit
"Unrecognized host OS (uname -s reports '$(uname -s)')"
1050 # test for any invalid configuration combinations
1051 if test "$host_os" = "windows" && ! has
"$dlltool"; then
1052 if test "$plugins" = "yes"; then
1053 error_exit
"TCG plugins requires dlltool to build on Windows platforms"
1057 if test "$tcg" = "disabled" ; then
1058 if test "$plugins" = "yes"; then
1059 error_exit
"Can't enable plugins on non-TCG builds"
1063 if test "$static" = "yes" ; then
1064 if test "$plugins" = "yes"; then
1065 error_exit
"static and plugins are mutually incompatible"
1069 if test "$plugins" != "no"; then
1070 if has_meson_option
"-Dtcg_interpreter=true"; then
1080 # define THREAD __thread
1084 static THREAD int tls_var;
1085 int main(void) { return tls_var; }
1088 if test "$host_os" = windows ||
test "$host_os" = haiku
; then
1089 if test "$pie" = "yes"; then
1090 error_exit
"PIE not available due to missing OS support"
1095 if test "$pie" != "no"; then
1096 if test "$static" = "yes"; then
1097 pie_ldflags
=-static-pie
1101 if compile_prog
"-Werror -fPIE -DPIE" "$pie_ldflags"; then
1103 elif test "$pie" = "yes"; then
1104 error_exit
"-static-pie not available due to missing toolchain support"
1106 echo "Disabling PIE due to missing toolchain support"
1111 ##########################################
1113 if test -z "${target_list+xxx}" ; then
1115 for target
in $default_target_list; do
1116 target_list
="$target_list $target"
1118 target_list
="${target_list# }"
1121 target_list
=$
(echo "$target_list" |
sed -e 's/,/ /g')
1122 for target
in $target_list; do
1123 # Check that we recognised the target name; this allows a more
1124 # friendly error message than if we let it fall through.
1125 case " $default_target_list " in
1129 error_exit
"Unknown target name '$target'"
1135 if test "$tcg" = "auto"; then
1136 if test -z "$target_list"; then
1143 #########################################
1146 if test -n "$gdb_bin"; then
1147 gdb_version_string
=$
($gdb_bin --version |
head -n 1)
1148 # Extract last field in the version string
1149 gdb_version
=${gdb_version_string##* }
1150 if version_ge
$gdb_version 9.1; then
1151 gdb_arches
=$
($python "$source_path/scripts/probe-gdb-support.py" $gdb_bin)
1157 ##########################################
1158 # big/little endian test
1160 #if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
1163 int main(void) { return 0; }
1166 if ! compile_prog
; then
1170 #if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
1173 int main(void) { return 0; }
1176 if ! compile_prog
; then
1179 echo big
/little
test failed
1184 ##########################################
1185 # detect rust triple
1187 meson_version
=$
($meson --version)
1188 if test "$rust" != disabled
&& ! version_ge
"$meson_version" 1.8.1; then
1189 if test "$rust" = enabled
; then
1190 error_exit
"Rust support needs Meson 1.8.1 or newer"
1192 echo "Rust needs Meson 1.8.1, disabling" 2>&1
1195 if test "$rust" != disabled
&& has
"$rustc" && $rustc -vV > "${TMPDIR1}/${TMPB}.out"; then
1196 rust_host_triple
=$
(sed -n 's/^host: //p' "${TMPDIR1}/${TMPB}.out")
1198 if test "$rust" = enabled
; then
1199 error_exit
"could not execute rustc binary \"$rustc\""
1203 if test "$rust" != disabled
&& test -z "$rust_target_triple"; then
1204 # arch and os generally matches between meson and rust
1205 rust_arch
=$host_arch
1207 rust_machine
=unknown
1210 # tweak rust_os if needed; also, machine and variant depend on the OS
1214 # e.g. aarch64-apple-darwin
1219 # detect android/glibc/musl
1220 if check_define __ANDROID__
; then
1221 rust_osvariant
=android
1226 #include <features.h>
1231 if compile_object
; then
1240 # e.g. arm-unknown-linux-gnueabi, arm-unknown-linux-gnueabihf
1243 if $READELF -A $TMPO |
grep Tag_API_VFP_args
: > /dev
/null
; then
1244 rust_osvariant
=${rust_osvariant}eabihf
1246 rust_osvariant
=${rust_osvariant}eabi
1251 # e.g. mips64-unknown-linux-gnuabi64
1252 rust_osvariant
=${rust_osvariant}abi64
1258 # e.g. arm-unknown-netbsd-eabihf
1259 test "$host_arch" = arm
&& rust_osvariant
=eabihf
1268 # e.g. aarch64-pc-windows-gnullvm, x86_64-pc-windows-gnu (MSVC not supported)
1270 if test "$host_arch" = aarch64
; then
1271 rust_osvariant
=gnullvm
1278 # now tweak the architecture part, possibly based on pre-canonicalization --cpu
1279 case "$host_arch" in
1281 # preserve ISA version (armv7 etc.) from $raw_cpu if passed via --cpu
1283 test "$rust_arch" = arm
&& test "$rust_os" != linux
&& rust_arch
=armv7
1287 # preserve ISA version (mipsisa64r6 etc.) and include endianness
1288 rust_arch
=${raw_cpu%el}
1289 test "$bigendian" = no
&& rust_arch
=${rust_arch}el
1293 # e.g. riscv64gc-unknown-linux-gnu, but riscv64-linux-android
1294 test "$android" = no
&& rust_arch
=${rust_arch}gc
1298 if test "$rust_os" = solaris
; then
1305 # e.g. x86_64-unknown-linux-gnux32
1306 test "$raw_cpu" = x32
&& rust_osvariant
=${rust_osvariant}x32
1310 if test "$android" = yes; then
1311 # e.g. aarch64-linux-android
1312 rust_target_triple
=$rust_arch-$rust_os-$rust_osvariant
1314 rust_target_triple
=$rust_arch-$rust_machine-$rust_os${rust_osvariant:+-$rust_osvariant}
1318 ##########################################
1319 # functions to probe cross compilers
1323 if test $use_containers = "yes" && (has
"docker" || has
"podman"); then
1324 case $
($python "$source_path"/tests
/docker
/docker.py
--engine "$container_engine" probe
) in
1325 *docker
) container
=docker
;;
1326 podman
) container
=podman
;;
1329 if test "$container" != "no"; then
1330 docker_py
="$python $source_path/tests/docker/docker.py --engine $container"
1335 # cross compilers defaults, can be overridden with --cross-cc-ARCH
1336 : ${cross_prefix_aarch64="aarch64-linux-gnu-"}
1337 : ${cross_prefix_aarch64_be="$cross_prefix_aarch64"}
1338 : ${cross_prefix_alpha="alpha-linux-gnu-"}
1339 : ${cross_prefix_arm="arm-linux-gnueabihf-"}
1340 : ${cross_prefix_armeb="$cross_prefix_arm"}
1341 : ${cross_prefix_hexagon="hexagon-unknown-linux-musl-"}
1342 : ${cross_prefix_loongarch64="loongarch64-unknown-linux-gnu-"}
1343 : ${cross_prefix_hppa="hppa-linux-gnu-"}
1344 : ${cross_prefix_i386="i686-linux-gnu-"}
1345 : ${cross_prefix_m68k="m68k-linux-gnu-"}
1346 : ${cross_prefix_microblaze="microblaze-linux-musl-"}
1347 : ${cross_prefix_mips64el="mips64el-linux-gnuabi64-"}
1348 : ${cross_prefix_mips64="mips64-linux-gnuabi64-"}
1349 : ${cross_prefix_mipsel="mipsel-linux-gnu-"}
1350 : ${cross_prefix_mips="mips-linux-gnu-"}
1351 : ${cross_prefix_ppc="powerpc-linux-gnu-"}
1352 : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
1353 : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
1354 : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
1355 : ${cross_prefix_s390x="s390x-linux-gnu-"}
1356 : ${cross_prefix_sh4="sh4-linux-gnu-"}
1357 : ${cross_prefix_sparc64="sparc64-linux-gnu-"}
1358 : ${cross_prefix_sparc="$cross_prefix_sparc64"}
1359 : ${cross_prefix_tricore="tricore-"}
1360 : ${cross_prefix_x86_64="x86_64-linux-gnu-"}
1362 : ${cross_cc_aarch64_be="$cross_cc_aarch64"}
1363 : ${cross_cc_cflags_aarch64_be="-mbig-endian"}
1364 : ${cross_cc_armeb="$cross_cc_arm"}
1365 : ${cross_cc_cflags_armeb="-mbig-endian"}
1366 : ${cross_cc_hexagon="hexagon-unknown-linux-musl-clang"}
1367 : ${cross_cc_cflags_hexagon="-mv73 -O2 -static"}
1368 : ${cross_cc_cflags_i386="-m32"}
1369 : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
1370 : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
1371 : ${cross_cc_ppc64le="$cross_cc_ppc64"}
1372 : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
1373 : ${cross_cc_cflags_sparc64="-m64 -mcpu=ultrasparc"}
1374 : ${cross_cc_sparc="$cross_cc_sparc64"}
1375 : ${cross_cc_cflags_sparc="-m32 -mcpu=supersparc"}
1376 : ${cross_cc_cflags_x86_64="-m64 -mcx16"}
1378 compute_target_variable
() {
1380 if eval test -n "\"\${cross_prefix_$1}\""; then
1381 if eval has
"\"\${cross_prefix_$1}\$3\""; then
1382 eval "$2=\"\${cross_prefix_$1}\$3\""
1389 case " $target_list " in
1390 *" $i "*) return 0;;
1397 # probe_target_compiler TARGET
1399 # Look for a compiler for the given target, either native or cross.
1400 # Set variables target_* if a compiler is found, and container_cross_*
1401 # if a Docker-based cross-compiler image is known for the target.
1402 # Set got_cross_cc to yes/no depending on whether a non-container-based
1403 # compiler was found.
1405 # If TARGET is a user-mode emulation target, also set build_static to
1406 # "y" if static linking is possible.
1408 probe_target_compiler
() {
1409 # reset all output variables
1413 container_cross_prefix
=
1419 container_cross_objcopy
=
1420 container_cross_ranlib
=
1421 container_cross_strip
=
1423 target_arch
=${1%%-*}
1424 case $target_arch in
1425 aarch64
) container_hosts
="x86_64 aarch64" ;;
1426 aarch64_be
) container_hosts
="x86_64 aarch64" ;;
1427 alpha
) container_hosts
=x86_64
;;
1428 arm
) container_hosts
="x86_64 aarch64" ;;
1429 hexagon
) container_hosts
=x86_64
;;
1430 hppa
) container_hosts
=x86_64
;;
1431 i386
) container_hosts
=x86_64
;;
1432 loongarch64
) container_hosts
=x86_64
;;
1433 m68k
) container_hosts
=x86_64
;;
1434 microblaze
) container_hosts
=x86_64
;;
1435 mips64el
) container_hosts
=x86_64
;;
1436 mips64
) container_hosts
=x86_64
;;
1437 mipsel
) container_hosts
=x86_64
;;
1438 mips
) container_hosts
=x86_64
;;
1439 ppc
) container_hosts
=x86_64
;;
1440 ppc64|ppc64le
) container_hosts
=x86_64
;;
1441 riscv64
) container_hosts
=x86_64
;;
1442 s390x
) container_hosts
=x86_64
;;
1443 sh4
) container_hosts
=x86_64
;;
1444 sparc64
) container_hosts
=x86_64
;;
1445 tricore
) container_hosts
=x86_64
;;
1446 x86_64
) container_hosts
="aarch64 ppc64le x86_64" ;;
1447 xtensa
*) container_hosts
=x86_64
;;
1450 for host in $container_hosts; do
1451 test "$container" != no ||
continue
1452 test "$host" = "$cpu" ||
continue
1453 case $target_arch in
1454 # debian-all-test-cross architectures
1457 container_image
=debian-all-test-cross
1458 container_cross_prefix
=aarch64-linux-gnu-
1460 hppa|m68k|mips|riscv64|sparc64
)
1461 container_image
=debian-all-test-cross
1464 container_image
=debian-all-test-cross
1465 container_cross_prefix
=mips64-linux-gnuabi64-
1468 container_image
=debian-all-test-cross
1469 container_cross_prefix
=powerpc
${target_arch#ppc}-linux-gnu-
1472 # debian-legacy-test-cross architectures (need Debian 11)
1473 # - libc6.1-dev-alpha-cross: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1054412
1474 # - sh4-linux-user: binaries don't run with bookworm compiler
1477 container_image
=debian-legacy-test-cross
1480 # architectures with individual containers
1483 # We don't have any bigendian build tools so we only use this for AArch64
1484 container_image
=debian-arm64-cross
1487 # We don't have any bigendian build tools so we only use this for ARM
1488 container_image
=debian-armhf-cross
1489 container_cross_prefix
=arm-linux-gnueabihf-
1492 container_cross_prefix
=hexagon-unknown-linux-musl-
1493 container_cross_cc
=${container_cross_prefix}clang
1496 container_image
=debian-i686-cross
1497 container_cross_prefix
=i686-linux-gnu-
1500 container_image
=debian-loongarch-cross
1501 container_cross_prefix
=loongarch64-unknown-linux-gnu-
1504 container_cross_prefix
=microblaze-linux-musl-
1507 container_image
=debian-all-test-cross
1508 container_cross_prefix
=mips64el-linux-gnuabi64-
1511 container_image
=debian-tricore-cross
1512 container_cross_prefix
=tricore-
1515 container_image
=debian-amd64-cross
1518 container_image
=debian-xtensa-cross
1520 # default to the dc232b cpu
1521 container_cross_prefix
=/opt
/2020.07/xtensa-dc232b-elf
/bin
/xtensa-dc232b-elf-
1524 # Debian and GNU architecture names usually match
1525 : ${container_image:=debian-$target_arch-cross}
1526 : ${container_cross_prefix:=$target_arch-linux-gnu-}
1527 : ${container_cross_cc:=${container_cross_prefix}gcc}
1528 : ${container_cross_ar:=${container_cross_prefix}ar}
1529 : ${container_cross_as:=${container_cross_prefix}as}
1530 : ${container_cross_ld:=${container_cross_prefix}ld}
1531 : ${container_cross_nm:=${container_cross_prefix}nm}
1532 : ${container_cross_objcopy:=${container_cross_prefix}objcopy}
1533 : ${container_cross_ranlib:=${container_cross_prefix}ranlib}
1534 : ${container_cross_strip:=${container_cross_prefix}strip}
1538 # For softmmu/roms also look for a bi-endian or multilib-enabled host compiler
1539 if [ "${1%softmmu}" != "$1" ] ||
test "$target_arch" = "$cpu"; then
1540 case "$target_arch:$cpu" in
1541 aarch64_be
:aarch64 | \
1548 try
='native cross' ;;
1551 eval "target_cflags=\${cross_cc_cflags_$target_arch}"
1552 for thistry
in $try; do
1561 target_objcopy
=$objcopy
1562 target_ranlib
=$ranlib
1567 if eval test -n "\"\${cross_cc_$target_arch}\""; then
1568 if eval has
"\"\${cross_cc_$target_arch}\""; then
1569 eval "target_cc=\"\${cross_cc_$target_arch}\""
1572 compute_target_variable
$target_arch target_cc gcc
1574 target_ccas
=$target_cc
1575 compute_target_variable
$target_arch target_ar
ar
1576 compute_target_variable
$target_arch target_as as
1577 compute_target_variable
$target_arch target_ld ld
1578 compute_target_variable
$target_arch target_nm nm
1579 compute_target_variable
$target_arch target_objcopy objcopy
1580 compute_target_variable
$target_arch target_ranlib ranlib
1581 compute_target_variable
$target_arch target_strip strip
1585 if test -n "$target_cc"; then
1586 case $target_arch in
1588 if $target_cc --version |
grep -qi "clang"; then
1593 elif test -n "$target_as" && test -n "$target_ld"; then
1594 # Special handling for assembler only targets
1612 if do_compiler
"$target_cc" $target_cflags -o $TMPO -c $TMPC &&
1613 do_compiler
"$target_cc" $target_cflags -r -nostdlib -o "${TMPDIR1}/${TMPB}2.o" "$TMPO" -lgcc; then
1619 if do_compiler
"$target_cc" $target_cflags -o $TMPE $TMPC -static ; then
1624 if do_compiler
"$target_cc" $target_cflags -o $TMPE $TMPC ; then
1632 if test $got_cross_cc != yes; then
1644 test -n "$target_cc"
1647 write_target_makefile
() {
1648 echo "EXTRA_CFLAGS=$target_cflags"
1649 if test -z "$target_cc" && test -z "$target_as"; then
1650 test -z "$container_image" && error_exit
"Internal error: could not find cross compiler for $1?"
1651 echo "$1: docker-image-$container_image" >> Makefile.prereqs
1652 if test -n "$container_cross_cc"; then
1653 echo "CC=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
1654 echo "CCAS=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
1656 echo "AR=$docker_py cc --cc $container_cross_ar -i qemu/$container_image -s $source_path --"
1657 echo "AS=$docker_py cc --cc $container_cross_as -i qemu/$container_image -s $source_path --"
1658 echo "LD=$docker_py cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --"
1659 echo "NM=$docker_py cc --cc $container_cross_nm -i qemu/$container_image -s $source_path --"
1660 echo "OBJCOPY=$docker_py cc --cc $container_cross_objcopy -i qemu/$container_image -s $source_path --"
1661 echo "RANLIB=$docker_py cc --cc $container_cross_ranlib -i qemu/$container_image -s $source_path --"
1662 echo "STRIP=$docker_py cc --cc $container_cross_strip -i qemu/$container_image -s $source_path --"
1664 if test -n "$target_cc"; then
1665 echo "CC=$target_cc"
1666 echo "CCAS=$target_ccas"
1668 if test -n "$target_ar"; then
1669 echo "AR=$target_ar"
1671 if test -n "$target_as"; then
1672 echo "AS=$target_as"
1674 if test -n "$target_ld"; then
1675 echo "LD=$target_ld"
1677 if test -n "$target_nm"; then
1678 echo "NM=$target_nm"
1680 if test -n "$target_objcopy"; then
1681 echo "OBJCOPY=$target_objcopy"
1683 if test -n "$target_ranlib"; then
1684 echo "RANLIB=$target_ranlib"
1686 if test -n "$target_strip"; then
1687 echo "STRIP=$target_strip"
1692 #######################################
1693 # cross-compiled firmware targets
1695 # Set up build tree symlinks that point back into the source tree
1696 # (these can be both files and directories).
1697 # Caution: avoid adding files or directories here using wildcards. This
1698 # will result in problems later if a new file matching the wildcard is
1699 # added to the source tree -- nothing will cause configure to be rerun
1700 # so the build tree will be missing the link back to the new file, and
1701 # tests might fail. Prefer to keep the relevant files in their own
1702 # directory and symlink the directory instead.
1704 LINKS
="$LINKS docs/config"
1705 LINKS
="$LINKS pc-bios/optionrom/Makefile"
1706 LINKS
="$LINKS pc-bios/s390-ccw/Makefile"
1707 LINKS
="$LINKS pc-bios/vof/Makefile"
1708 LINKS
="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
1709 LINKS
="$LINKS tests/data"
1710 LINKS
="$LINKS tests/qemu-iotests/check tests/qemu-iotests/Makefile"
1711 LINKS
="$LINKS python"
1712 for f
in $LINKS ; do
1713 if [ -e "$source_path/$f" ]; then
1714 symlink
"$source_path/$f" "$f"
1718 # use included Linux headers for KVM architectures
1719 if test "$host_os" = "linux" && test -n "$linux_arch"; then
1720 symlink
"$source_path/linux-headers/asm-$linux_arch" linux-headers
/asm
1723 echo "# Automatically generated by configure - do not modify" > Makefile.prereqs
1725 # Mac OS X ships with a broken assembler
1726 if have_target i386-softmmu x86_64-softmmu
&& \
1727 test "$host_os" != "darwin" && test "$host_os" != "sunos" && \
1728 test "$host_os" != "haiku" && \
1729 probe_target_compiler i386-softmmu
; then
1730 subdirs
="$subdirs pc-bios/optionrom"
1731 config_mak
=pc-bios
/optionrom
/config.mak
1732 echo "# Automatically generated by configure - do not modify" > $config_mak
1733 echo "TOPSRC_DIR=$source_path" >> $config_mak
1734 write_target_makefile
>> $config_mak
1737 if have_target ppc-softmmu ppc64-softmmu
&& \
1738 probe_target_compiler ppc-softmmu
; then
1739 subdirs
="$subdirs pc-bios/vof"
1740 config_mak
=pc-bios
/vof
/config.mak
1741 echo "# Automatically generated by configure - do not modify" > $config_mak
1742 echo "SRC_DIR=$source_path/pc-bios/vof" >> $config_mak
1743 write_target_makefile
>> $config_mak
1746 # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
1747 # (which is the lowest architecture level that Clang supports)
1748 if have_target s390x-softmmu
&& probe_target_compiler s390x-softmmu
&& \
1749 GIT
=git
"$source_path/scripts/git-submodule.sh" "$git_submodules_action" roms
/SLOF
>> config.log
2>&1; then
1751 do_compiler
"$target_cc" $target_cc_cflags -march=z900
-o $TMPO -c $TMPC
1753 if [ $has_z900 = 0 ] || do_compiler
"$target_cc" $target_cc_cflags -march=z10
-msoft-float -Werror -o $TMPO -c $TMPC; then
1754 if [ $has_z900 != 0 ]; then
1755 echo "WARNING: Your compiler does not support the z900!"
1756 echo " The s390-ccw bios will only work with guest CPUs >= z10."
1758 subdirs
="$subdirs pc-bios/s390-ccw"
1759 config_mak
=pc-bios
/s390-ccw
/config-host.mak
1760 echo "# Automatically generated by configure - do not modify" > $config_mak
1761 echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak
1762 echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_mak
1763 write_target_makefile
>> $config_mak
1767 #######################################
1768 # generate config-host.mak
1770 config_host_mak
="config-host.mak"
1772 echo "# Automatically generated by configure - do not modify" > $config_host_mak
1773 echo >> $config_host_mak
1775 echo all
: >> $config_host_mak
1777 echo "SRC_PATH=$source_path" >> $config_host_mak
1778 echo "TARGET_DIRS=$target_list" >> $config_host_mak
1779 echo "GDB=$gdb_bin" >> $config_host_mak
1780 if test "$container" != no
; then
1781 echo "RUNC=$runc" >> $config_host_mak
1783 echo "SUBDIRS=$subdirs" >> $config_host_mak
1784 if test "$rust" != disabled
; then
1785 echo "RUST_TARGET_TRIPLE=$rust_target_triple" >> $config_host_mak
1787 echo "PYTHON=$python" >> $config_host_mak
1788 echo "MKVENV_ENSUREGROUP=$mkvenv ensuregroup $mkvenv_online_flag" >> $config_host_mak
1789 echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
1790 echo "MESON=$meson" >> $config_host_mak
1791 echo "NINJA=$ninja" >> $config_host_mak
1792 echo "EXESUF=$EXESUF" >> $config_host_mak
1793 if test "$default_targets" = "yes"; then
1794 echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
1797 # tests/tcg configuration
1799 echo "# Automatically generated by configure - do not modify" > tests
/tcg
/$config_host_mak
1800 echo "SRC_PATH=$source_path" >> tests
/tcg
/$config_host_mak
1801 if test "$plugins" = "yes" ; then
1802 echo "CONFIG_PLUGIN=y" >> tests
/tcg
/$config_host_mak
1806 for target
in $target_list; do
1811 # the toolchain is not complete with headers, only build system tests
1815 test -f "$source_path/tests/tcg/$arch/Makefile.softmmu-target" ||
continue
1816 qemu
="qemu-system-$arch"
1818 *-linux-user|
*-bsd-user)
1823 if probe_target_compiler
$target ||
test -n "$container_image"; then
1824 test -n "$container_image" && build_static
=y
1825 mkdir
-p "tests/tcg/$target"
1826 config_target_mak
=tests
/tcg
/$target/config-target.mak
1827 ln -sf "$source_path/tests/tcg/Makefile.target" "tests/tcg/$target/Makefile"
1828 echo "# Automatically generated by configure - do not modify" > "$config_target_mak"
1829 echo "TARGET_NAME=$arch" >> "$config_target_mak"
1830 echo "TARGET=$target" >> "$config_target_mak"
1831 write_target_makefile
"build-tcg-tests-$target" >> "$config_target_mak"
1832 echo "BUILD_STATIC=$build_static" >> "$config_target_mak"
1833 echo "QEMU=$PWD/$qemu" >> "$config_target_mak"
1835 # will GDB work with these binaries?
1836 if test "${gdb_arches#*$arch}" != "$gdb_arches"; then
1837 echo "GDB=$gdb_bin" >> $config_target_mak
1840 if test "${gdb_arches#*aarch64}" != "$gdb_arches" && version_ge
$gdb_version 15.1; then
1841 echo "GDB_HAS_MTE=y" >> $config_target_mak
1844 if test "${gdb_arches#*aarch64}" != "$gdb_arches" && version_ge
$gdb_version 16.0; then
1845 # GDB has to support MTE in baremetal to allow debugging MTE in QEMU system mode
1846 echo "GDB_SUPPORTS_MTE_IN_BAREMETAL=y" >> $config_target_mak
1849 echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs
1850 tcg_tests_targets
="$tcg_tests_targets $target"
1854 if test "$tcg" = "enabled"; then
1855 echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> $config_host_mak
1858 if test "$skip_meson" = no
; then
1859 cross
="config-meson.cross.new"
1861 test $# = 0 && return
1862 echo "'$(echo $* | sed "s
/ /','/g
")'"
1865 echo "# Automatically generated by configure - do not modify" > $cross
1866 echo "[properties]" >> $cross
1868 # unroll any custom device configs
1869 for a
in $device_archs; do
1870 eval "c=\$devices_${a}"
1871 echo "${a}-softmmu = '$c'" >> $cross
1874 echo "[built-in options]" >> $cross
1875 echo "c_args = [$(meson_quote $CFLAGS $EXTRA_CFLAGS)]" >> $cross
1876 echo "cpp_args = [$(meson_quote $CXXFLAGS $EXTRA_CXXFLAGS)]" >> $cross
1877 test -n "$objcc" && echo "objc_args = [$(meson_quote $OBJCFLAGS $EXTRA_OBJCFLAGS)]" >> $cross
1878 echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross
1879 echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross
1881 # Only enable by default for git builds and on select OSes
1882 echo "# environment defaults, can still be overridden on " >> $cross
1883 echo "# the command line" >> $cross
1884 if test -e "$source_path/.git" && \
1885 { test "$host_os" = linux ||
test "$host_os" = "windows"; }; then
1886 echo 'werror = true' >> $cross
1888 echo "[project options]" >> $cross
1889 if test "$SMBD" != ''; then
1890 echo "smbd = $(meson_quote "$SMBD")" >> $cross
1892 if test "${QEMU_GA_MANUFACTURER}" != ''; then
1893 echo "qemu_ga_manufacturer = $(meson_quote "${QEMU_GA_MANUFACTURER}")" >> $cross
1895 if test "${QEMU_GA_DISTRO}" != ''; then
1896 echo "qemu_ga_distro = $(meson_quote "${QEMU_GA_DISTRO}")" >> $cross
1898 if test "${QEMU_GA_VERSION}" != ''; then
1899 echo "qemu_ga_version = $(meson_quote "${QEMU_GA_VERSION}")" >> $cross
1903 echo "[binaries]" >> $cross
1904 echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross
1905 test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross
1906 test -n "$objcc" && echo "objc = [$(meson_quote $objcc $CPU_CFLAGS)]" >> $cross
1907 if test "$rust" != disabled
; then
1908 if test "$rust_host_triple" != "$rust_target_triple"; then
1909 echo "rust = [$(meson_quote $rustc --target "$rust_target_triple")]" >> $cross
1910 echo "rustdoc = [$(meson_quote $rustdoc --target "$rust_target_triple")]" >> $cross
1912 echo "rust = [$(meson_quote $rustc)]" >> $cross
1913 echo "rustdoc = [$(meson_quote $rustdoc)]" >> $cross
1916 echo "ar = [$(meson_quote $ar)]" >> $cross
1917 echo "dlltool = [$(meson_quote $dlltool)]" >> $cross
1918 echo "nm = [$(meson_quote $nm)]" >> $cross
1919 echo "pkgconfig = [$(meson_quote $pkg_config)]" >> $cross
1920 echo "pkg-config = [$(meson_quote $pkg_config)]" >> $cross
1921 echo "ranlib = [$(meson_quote $ranlib)]" >> $cross
1922 echo "readelf = [$(meson_quote $readelf)]" >> $cross
1923 if has
$sdl2_config; then
1924 echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross
1926 echo "strip = [$(meson_quote $strip)]" >> $cross
1927 echo "widl = [$(meson_quote $widl)]" >> $cross
1928 echo "windres = [$(meson_quote $windres)]" >> $cross
1929 echo "windmc = [$(meson_quote $windmc)]" >> $cross
1930 if test "$cross_compile" = "yes"; then
1931 echo "[host_machine]" >> $cross
1932 echo "system = '$host_os'" >> $cross
1935 echo "cpu_family = 'x86'" >> $cross
1938 echo "cpu_family = '$cpu'" >> $cross
1941 echo "cpu = '$cpu'" >> $cross
1942 if test "$bigendian" = "yes" ; then
1943 echo "endian = 'big'" >> $cross
1945 echo "endian = 'little'" >> $cross
1948 native
="config-meson.native.new"
1949 echo "# Automatically generated by configure - do not modify" > $native
1950 echo "[binaries]" >> $native
1951 echo "c = [$(meson_quote $host_cc)]" >> $native
1952 if test "$rust" != disabled
; then
1953 echo "rust = [$(meson_quote $rustc)]" >> $cross
1955 mv $native config-meson.native
1956 meson_option_add
--native-file
1957 meson_option_add config-meson.native
1959 mv $cross config-meson.cross
1960 meson_add_machine_file config-meson.cross
1961 if test -f "$source_path/configs/meson/$host_os.txt"; then
1962 meson_add_machine_file
$source_path/configs
/meson
/$host_os.txt
1965 rm -rf meson-private meson-info meson-logs
1967 test "$download" = "disabled" && meson_option_add
"--wrap-mode=nodownload"
1968 test "$default_feature" = no
&& meson_option_add
-Dauto_features=disabled
1969 test "$static" = yes && meson_option_add
-Dprefer_static=true
1970 test "$pie" = no
&& meson_option_add
-Db_pie=false
1973 test "$rust" != "disabled" && meson_option_add
"-Drust=$rust"
1974 test "$cfi" != false
&& meson_option_add
"-Dcfi=$cfi" "-Db_lto=$cfi"
1975 test "$docs" != auto
&& meson_option_add
"-Ddocs=$docs"
1976 test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add
"-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
1977 test "$plugins" = yes && meson_option_add
"-Dplugins=true"
1978 test "$tcg" != enabled
&& meson_option_add
"-Dtcg=$tcg"
1980 NINJA
=$ninja $meson setup
"$@" "$PWD" "$source_path"
1982 eval run_meson
$meson_options
1983 if test "$?" -ne 0 ; then
1984 error_exit
"meson setup failed"
1986 echo "$meson" > build.ninja.stamp
1988 if test -f meson-private
/cmd_line.txt
; then
1989 # Adjust old command line options that were removed
1990 # sed -i is not portable
1992 /^sphinx_build/ && next;
1993 print;' meson-private
/cmd_line.txt
1997 # Save the configure command line for later reuse.
1998 cat <<EOD >config.status
2000 # Generated by configure.
2001 # Run this file to recreate the current configuration.
2002 # Compiler output produced by configure, useful for debugging
2003 # configure, is in config.log if it exists.
2009 eval envval
=\$
$envname
2011 if test -n "$envval"
2013 echo "$envname='$envval'" >> config.status
2014 echo "export $envname" >> config.status
2016 echo "unset $envname" >> config.status
2020 # Preserve various env variables that influence what
2021 # features/build target configure will detect
2027 preserve_env CXXFLAGS
2028 preserve_env DLLTOOL
2030 preserve_env LDFLAGS
2031 preserve_env LD_LIBRARY_PATH
2033 preserve_env OBJCFLAGS
2034 preserve_env OBJCOPY
2036 preserve_env PKG_CONFIG
2037 preserve_env PKG_CONFIG_LIBDIR
2038 preserve_env PKG_CONFIG_PATH
2040 preserve_env QEMU_GA_MANUFACTURER
2041 preserve_env QEMU_GA_DISTRO
2042 preserve_env QEMU_GA_VERSION
2043 preserve_env SDL2_CONFIG
2047 preserve_env WINDRES
2050 printf "exec" >>config.status
2051 for i
in "$0" "$@"; do
2052 test "$i" = --skip-meson ||
printf " %s" "$(quote_sh "$i")" >>config.status
2054 echo ' "$@"' >>config.status
2055 chmod +x config.status
2059 if test "$rust" != disabled
; then
2061 echo 'INFO: Rust bindings generation with `bindgen` might fail in some cases where'
2062 echo 'the detected `libclang` does not match the expected `clang` version/target. In'
2063 echo 'this case you must pass the path to `clang` and `libclang` to your build'
2064 echo 'command invocation using the environment variables CLANG_PATH and LIBCLANG_PATH'