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"
34 if ! mkdir build ||
! touch $MARKER
36 echo "ERROR: Could not create ./build directory. Check the permissions on"
37 echo "your source directory, or try doing an out-of-tree build."
41 cat > GNUmakefile
<<'EOF'
42 # This file is auto-generated by configure to support in-source tree
43 # 'make' command invocation
45 ifeq ($(MAKECMDGOALS),)
51 @echo 'changing dir to build for $(MAKE) "$(MAKECMDGOALS)"...'
52 @$(MAKE) -C build -f Makefile $(MAKECMDGOALS)
53 @if test "$(MAKECMDGOALS)" = "distclean" && \
54 test -e build/auto-created-by-configure ; \
56 rm -rf build GNUmakefile ; \
64 exec "$source_path/configure" "$@"
67 # Temporary directory used for files created while
68 # configure runs. Since it is in the build directory
69 # we can safely blow away any previous version of it
70 # (and we need not jump through hoops to try to delete
71 # it when configure exits.)
74 if ! mkdir
-p "${TMPDIR1}"; then
75 echo "ERROR: failed to create temporary directory"
80 TMPC
="${TMPDIR1}/${TMPB}.c"
81 TMPO
="${TMPDIR1}/${TMPB}.o"
82 TMPE
="${TMPDIR1}/${TMPB}.exe"
86 # Print a helpful header at the top of config.log
87 echo "# QEMU configure log $(date)" >> config.log
88 printf "# Configured with:" >> config.log
89 # repeat the invocation to log and stdout for CI
90 invoke
=$
(printf " '%s'" "$0" "$@")
91 test -n "$GITLAB_CI" && echo "configuring with: $invoke"
92 { echo "$invoke"; echo; echo "#"; } >> config.log
95 printf "%s" "$1" |
sed "s,','\\\\'',g; s,.*,'&',"
101 while test -n "$2"; do
114 # Run the compiler, capturing its output to the log. First argument
115 # is compiler binary to execute.
118 if test -n "$BASH_VERSION"; then eval '
120 funcs: ${FUNCNAME[*]}
121 lines: ${BASH_LINENO[*]}"
123 echo $compiler "$@" >> config.log
124 $compiler "$@" >> config.log
2>&1 ||
return $?
128 do_compiler
"$cc" $CPU_CFLAGS "$@"
133 do_cc
$CFLAGS $EXTRA_CFLAGS $local_cflags -c -o $TMPO $TMPC
139 do_cc
$CFLAGS $EXTRA_CFLAGS $local_cflags -o $TMPE $TMPC \
140 $LDFLAGS $EXTRA_LDFLAGS $local_ldflags
143 # symbolically link $1 to $2. Portable version of "ln -sf".
146 mkdir
-p "$(dirname "$2")"
150 # check whether a command is available to this shell (may be either an
151 # executable or a builtin)
153 type "$1" >/dev
/null
2>&1
157 local_ver1
=$
(expr "$1" : '\([0-9.]*\)' |
tr .
' ')
158 local_ver2
=$
(echo "$2" |
tr .
' ')
162 # 'shift 2' if $2 is set, or 'shift' if $2 is not set
166 # the second argument finished, the first must be greater or equal
167 test $# = 1 && return 0
168 test $local_first -lt $2 && return 1
169 test $local_first -gt $2 && return 0
175 if printf %s
\\n
"$source_path" "$PWD" |
grep -q "[[:space:]:]";
177 error_exit
"main directory cannot contain spaces nor colons"
180 # parse CC options first; some compiler tests are used to establish
181 # some defaults, based on the host environment
193 # Default value for a variable defining feature "foo".
194 # * foo="no" feature will only be used if --enable-foo arg is given
195 # * foo="" feature will be searched for, and if found, will be used
196 # unless --disable-foo is given
197 # * foo="yes" this value will only be set by --enable-foo flag.
198 # feature will searched for,
199 # if not found, configure exits with error
201 # Always add --enable-foo and --disable-foo command line args.
202 # Distributions want to ensure that several features are compiled in, and it
203 # is impossible without a --enable-foo that exits if a feature is not found.
207 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
209 --cross-prefix=*) cross_prefix
="$optarg"
214 --cxx=*) CXX
="$optarg"
216 --objcc=*) objcc
="$optarg"
218 --cpu=*) cpu
="$optarg"
221 EXTRA_CFLAGS
="$EXTRA_CFLAGS $optarg"
222 EXTRA_CXXFLAGS
="$EXTRA_CXXFLAGS $optarg"
223 EXTRA_OBJCFLAGS
="$EXTRA_OBJCFLAGS $optarg"
225 --extra-cxxflags=*) EXTRA_CXXFLAGS
="$EXTRA_CXXFLAGS $optarg"
227 --extra-objcflags=*) EXTRA_OBJCFLAGS
="$EXTRA_OBJCFLAGS $optarg"
229 --extra-ldflags=*) EXTRA_LDFLAGS
="$EXTRA_LDFLAGS $optarg"
231 --cross-cc-*[!a-zA-Z0-9_-
]*=*) error_exit
"Passed bad --cross-cc-FOO option"
233 --cross-cc-cflags-*) cc_arch
=${opt#--cross-cc-cflags-}; cc_arch
=${cc_arch%%=*}
234 eval "cross_cc_cflags_${cc_arch}=\$optarg"
236 --cross-cc-*) cc_arch
=${opt#--cross-cc-}; cc_arch
=${cc_arch%%=*}
237 eval "cross_cc_${cc_arch}=\$optarg"
239 --cross-prefix-*[!a-zA-Z0-9_-
]*=*) error_exit
"Passed bad --cross-prefix-FOO option"
241 --cross-prefix-*) cc_arch
=${opt#--cross-prefix-}; cc_arch
=${cc_arch%%=*}
242 eval "cross_prefix_${cc_arch}=\$optarg"
244 --without-default-features) default_feature
="no"
250 if test -e "$source_path/.git"
252 git_submodules_action
="update"
254 git_submodules_action
="ignore"
257 git_submodules
="ui/keycodemapdb"
267 plugins
="$default_feature"
273 vfio_user_server
="disabled"
275 gdb_bin
=$
(command -v "gdb-multiarch" ||
command -v "gdb")
279 # Don't accept a target_list environment variable.
281 unset target_list_exclude
283 # The following Meson options are handled manually (still they
284 # are included in the automatically generated help message)
286 # 1. Track which submodules are needed
289 # 2. Automatically enable/disable other options
293 # 3. Need to check for -static-pie before Meson runs. Also,
294 # Meson has PIE as a boolean rather than enabled/disabled/auto.
298 # Preferred compiler:
300 # ${cross_prefix}gcc (if cross-prefix specified)
302 if test -z "${CC}${cross_prefix}"; then
305 cc
="${CC-${cross_prefix}gcc}"
308 if test -z "${CXX}${cross_prefix}"; then
311 cxx
="${CXX-${cross_prefix}g++}"
314 # Preferred ObjC compiler:
315 # $objcc (if set, i.e. via --objcc option)
316 # ${cross_prefix}clang (if cross-prefix specified)
317 # clang (if available)
319 if test -z "${objcc}${cross_prefix}"; then
326 objcc
="${objcc-${cross_prefix}clang}"
329 ar="${AR-${cross_prefix}ar}"
330 as
="${AS-${cross_prefix}as}"
332 objcopy
="${OBJCOPY-${cross_prefix}objcopy}"
333 ld
="${LD-${cross_prefix}ld}"
334 ranlib
="${RANLIB-${cross_prefix}ranlib}"
335 nm
="${NM-${cross_prefix}nm}"
337 strip
="${STRIP-${cross_prefix}strip}"
338 widl
="${WIDL-${cross_prefix}widl}"
339 windres
="${WINDRES-${cross_prefix}windres}"
340 windmc
="${WINDMC-${cross_prefix}windmc}"
341 pkg_config
="${PKG_CONFIG-${cross_prefix}pkg-config}"
342 sdl2_config
="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
347 #error $1 not defined
349 int main(void) { return 0; }
356 int main(void) { return 0; }
360 if check_define __linux__
; then
362 elif check_define _WIN32
; then
364 elif check_define __OpenBSD__
; then
366 elif check_define __sun__
; then
368 elif check_define __HAIKU__
; then
370 elif check_define __FreeBSD__
; then
372 elif check_define __FreeBSD_kernel__
&& check_define __GLIBC__
; then
373 targetos
=gnu
/kfreebsd
374 elif check_define __DragonFly__
; then
376 elif check_define __NetBSD__
; then
378 elif check_define __APPLE__
; then
381 # This is a fatal error, but don't report it yet, because we
382 # might be going to just print the --help text, or it might
383 # be the result of a missing compiler.
405 # needed for kinfo_getvmmap(3) in libutil.h
435 if test ! -z "$cpu" ; then
436 # command line argument
438 elif check_define __i386__
; then
440 elif check_define __x86_64__
; then
441 if check_define __ILP32__
; then
446 elif check_define __sparc__
; then
447 if check_define __arch64__
; then
452 elif check_define _ARCH_PPC
; then
453 if check_define _ARCH_PPC64
; then
454 if check_define _LITTLE_ENDIAN
; then
462 elif check_define __mips__
; then
464 elif check_define __s390__
; then
465 if check_define __s390x__
; then
470 elif check_define __riscv
; then
472 elif check_define __arm__
; then
474 elif check_define __aarch64__
; then
476 elif check_define __loongarch64
; then
479 # Using uname is really broken, but it is just a fallback for architectures
480 # that are going to use TCI anyway
482 echo "WARNING: unrecognized host CPU, proceeding with 'uname -m' output '$cpu'"
485 # Normalise host CPU name and set multilib cflags. The canonicalization
486 # isn't really necessary, because the architectures that we check for
487 # should not hit the 'uname -m' case, but better safe than sorry.
488 # Note that this case should only have supported host CPUs, not guests.
498 CPU_CFLAGS
="-mx32" ;;
501 # ??? Only extremely old AMD cpus do not have cmpxchg16b.
502 # If we truly care, we should simply detect this case at
503 # runtime and generate the fallback to serial emulation.
504 CPU_CFLAGS
="-m64 -mcx16" ;;
512 CPU_CFLAGS
="-m64 -mbig-endian" ;;
515 CPU_CFLAGS
="-m64 -mlittle-endian" ;;
524 CPU_CFLAGS
="-m32 -mv8plus -mcpu=ultrasparc" ;;
526 CPU_CFLAGS
="-m64 -mcpu=ultrasparc" ;;
529 : ${make=${MAKE-make}}
533 # We require python >= 3.7.
534 # NB: a True python conditional creates a non-zero return code (Failure)
535 "$1" -c 'import sys; sys.exit(sys.version_info < (3,7))'
539 if test -z "${PYTHON}"; then
540 # A bare 'python' is traditionally python 2.x, but some distros
541 # have it as python 3.x, so check in both places.
542 for binary
in python3 python python3.11 python3.10 python3.9 python3.8 python3.7
; do
543 if has
"$binary"; then
544 python
=$
(command -v "$binary")
545 if check_py_version
"$python"; then
555 # Same as above, but only check the environment variable.
556 has
"${PYTHON}" || error_exit
"The PYTHON environment variable does not point to an executable"
557 python
=$
(command -v "$PYTHON")
558 if check_py_version
"$python"; then
562 first_python
=$first_python
566 # Check for ancillary tools used in testing
568 for binary
in genisoimage mkisofs
572 genisoimage
=$
(command -v "$binary")
577 if test "$mingw32" = "yes" ; then
584 meson_option_build_array
() {
586 (if test "$targetos" = windows
; then
593 # backslash escape any '\' and '"' characters
594 printf "%s" "$e" |
sed -e 's/\([\"]\)/\\\1/g'
600 .
"$source_path/scripts/meson-buildoptions.sh"
604 meson_options
="$meson_options $(quote_sh "$1")"
606 meson_option_parse
() {
607 meson_options
="$meson_options $(_meson_option_parse "$@
")"
608 if test $?
-eq 1; then
609 echo "ERROR: unknown option $1"
610 echo "Try '$0 --help' for more information"
616 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
618 --help|
-h) show_help
=yes
620 --version|
-V) exec cat "$source_path/VERSION"
622 --prefix=*) prefix
="$optarg"
628 --host-cc=*) host_cc
="$optarg"
634 --make=*) make="$optarg"
638 --python=*) python
="$optarg"
640 --skip-meson) skip_meson
=yes
642 --ninja=*) ninja
="$optarg"
644 --smbd=*) smbd
="$optarg"
658 --enable-docs) docs
=enabled
660 --disable-docs) docs
=disabled
664 --target-list=*) target_list
="$optarg"
665 if test "$target_list_exclude"; then
666 error_exit
"Can't mix --target-list with --target-list-exclude"
669 --target-list-exclude=*) target_list_exclude
="$optarg"
670 if test "$target_list"; then
671 error_exit
"Can't mix --target-list-exclude with --target-list"
674 --with-default-devices) meson_option_add
-Ddefault_devices=true
676 --without-default-devices) meson_option_add
-Ddefault_devices=false
678 --with-devices-*[!a-zA-Z0-9_-
]*=*) error_exit
"Passed bad --with-devices-FOO option"
680 --with-devices-*) device_arch
=${opt#--with-devices-};
681 device_arch
=${device_arch%%=*}
682 cf
=$source_path/configs
/devices
/$device_arch-softmmu/$optarg.mak
683 if test -f "$cf"; then
684 device_archs
="$device_archs $device_arch"
685 eval "devices_${device_arch}=\$optarg"
687 error_exit
"File $cf does not exist"
690 --without-default-features) # processed above
692 --static) static
="yes"
694 --bindir=*) bindir
="$optarg"
696 --with-suffix=*) qemu_suffix
="$optarg"
699 --disable-dependency-tracking|\
700 --sbindir=*|
--sharedstatedir=*|\
701 --oldincludedir=*|
--datarootdir=*|
--infodir=*|\
702 --htmldir=*|
--dvidir=*|
--pdfdir=*|
--psdir=*)
703 # These switches are silently ignored, for compatibility with
704 # autoconf-generated configure scripts. This allows QEMU's
705 # configure to be used by RPM and similar macros that set
706 # lots of directory switches by default.
708 --enable-debug-tcg) debug_tcg
="yes"
710 --disable-debug-tcg) debug_tcg
="no"
713 # Enable debugging options that aren't excessively noisy
715 meson_option_parse
--enable-debug-graph-lock ""
716 meson_option_parse
--enable-debug-mutex ""
717 meson_option_add
-Doptimization=0
719 --disable-tcg) tcg
="disabled"
722 --enable-tcg) tcg
="enabled"
724 --disable-system) softmmu
="no"
726 --enable-system) softmmu
="yes"
733 --disable-linux-user) linux_user
="no"
735 --enable-linux-user) linux_user
="yes"
737 --disable-bsd-user) bsd_user
="no"
739 --enable-bsd-user) bsd_user
="yes"
741 --enable-pie) pie
="yes"
743 --disable-pie) pie
="no"
745 --enable-werror) werror
="yes"
747 --disable-werror) werror
="no"
751 meson_option_add
-Db_lto=true
753 --disable-cfi) cfi
="false"
755 --disable-fdt) fdt
="disabled"
757 --enable-fdt) fdt
="enabled"
759 --enable-fdt=git
) fdt
="internal"
761 --enable-fdt=*) fdt
="$optarg"
763 --with-git=*) git
="$optarg"
765 --with-git-submodules=*)
766 git_submodules_action
="$optarg"
768 --disable-pypi) pypi
="disabled"
770 --enable-pypi) pypi
="enabled"
772 --enable-plugins) if test "$mingw32" = "yes"; then
773 error_exit
"TCG plugins not currently supported on Windows platforms"
778 --disable-plugins) plugins
="no"
780 --enable-containers) use_containers
="yes"
782 --disable-containers) use_containers
="no"
784 --gdb=*) gdb_bin
="$optarg"
786 --enable-vfio-user-server) vfio_user_server
="enabled"
788 --disable-vfio-user-server) vfio_user_server
="disabled"
790 # everything else has the same name in configure and meson
791 --*) meson_option_parse
"$opt" "$optarg"
796 # test for any invalid configuration combinations
797 if test "$plugins" = "yes" -a "$tcg" = "disabled"; then
798 error_exit
"Can't enable plugins on non-TCG builds"
801 case $git_submodules_action in
803 if test ! -e "$source_path/.git"; then
804 echo "ERROR: cannot $git_submodules_action git submodules without .git"
809 if ! test -f "$source_path/ui/keycodemapdb/README"
812 echo "ERROR: missing GIT submodules"
814 if test -e "$source_path/.git"; then
815 echo "--with-git-submodules=ignore specified but submodules were not"
816 echo "checked out. Please initialize and update submodules."
818 echo "This is not a GIT checkout but module content appears to"
819 echo "be missing. Do not use 'git archive' or GitHub download links"
820 echo "to acquire QEMU source archives. Non-GIT builds are only"
821 echo "supported with source archives linked from:"
823 echo " https://www.qemu.org/download/#source"
825 echo "Developers working with GIT can use scripts/archive-source.sh"
826 echo "if they need to create valid source archives."
833 echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'"
838 default_target_list
=""
841 if [ "$linux_user" != no
]; then
842 if [ "$targetos" = linux
] && [ -d "$source_path/linux-user/include/host/$cpu" ]; then
844 elif [ "$linux_user" = yes ]; then
845 error_exit
"linux-user not supported on this architecture"
848 if [ "$bsd_user" != no
]; then
849 if [ "$bsd_user" = "" ]; then
850 test $targetos = freebsd
&& bsd_user
=yes
852 if [ "$bsd_user" = yes ] && ! [ -d "$source_path/bsd-user/$targetos" ]; then
853 error_exit
"bsd-user not supported on this host OS"
856 if [ "$softmmu" = "yes" ]; then
857 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-softmmu.mak"
859 if [ "$linux_user" = "yes" ]; then
860 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-linux-user.mak"
862 if [ "$bsd_user" = "yes" ]; then
863 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-bsd-user.mak"
866 for config
in $mak_wilds; do
867 target
="$(basename "$config" .mak)"
868 if echo "$target_list_exclude" |
grep -vq "$target"; then
869 default_target_list
="${default_target_list} $target"
873 if test x
"$show_help" = x
"yes" ; then
876 Usage: configure [options]
877 Options: [defaults in brackets after descriptions]
880 --help print this message
881 --prefix=PREFIX install in PREFIX [$prefix]
882 --target-list=LIST set target list (default: build all)
883 $(echo Available targets: $default_target_list | \
884 fold -s -w 53 | sed -e 's/^/ /')
885 --target-list-exclude=LIST exclude a set of targets from the default target-list
887 Advanced options (experts only):
888 --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix]
889 --cc=CC use C compiler CC [$cc]
890 --host-cc=CC use C compiler CC [$host_cc] for code run at
892 --cxx=CXX use C++ compiler CXX [$cxx]
893 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
894 --extra-cflags=CFLAGS append extra C compiler flags CFLAGS
895 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
896 --extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
897 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
898 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases
899 --cross-cc-cflags-ARCH= use compiler flags when building ARCH guest tests
900 --cross-prefix-ARCH=PREFIX cross compiler prefix when building ARCH guest test cases
901 --make=MAKE use specified make [$make]
902 --python=PYTHON use specified python [$python]
903 --ninja=NINJA use specified ninja [$ninja]
904 --smbd=SMBD use specified smbd [$smbd]
905 --with-git=GIT use specified git [$git]
906 --with-git-submodules=update update git submodules (default if .git dir exists)
907 --with-git-submodules=validate fail if git submodules are not up to date
908 --with-git-submodules=ignore do not update or check git submodules (default if no .git dir)
909 --static enable static build [$static]
910 --bindir=PATH install binaries in PATH
911 --with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
912 --without-default-features default all --enable-* options to "disabled"
913 --without-default-devices do not include any device that is not needed to
914 start the emulator (only use if you are including
915 desired devices in configs/devices/)
916 --with-devices-ARCH=NAME override default configs/devices
917 --enable-debug enable common debug build options
918 --disable-werror disable compilation abort on warning
919 --cpu=CPU Build for host CPU [$cpu]
921 enable plugins via shared library loading
922 --disable-containers don't use containers for cross-building
923 --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin]
927 system all system emulation targets
928 user supported user emulation targets
929 linux-user all linux usermode emulation targets
930 bsd-user all BSD usermode emulation targets
931 pie Position Independent Executables
932 debug-tcg TCG debugging (default is disabled)
934 NOTE: The object files are built at the place where configure is launched
939 # Remove old dependency files to make sure that they get properly regenerated
940 rm -f .
/*/config-devices.mak.d
944 # If first_python is set, there was a binary somewhere even though
945 # it was not suitable. Use it for the error message.
946 if test -n "$first_python"; then
947 error_exit
"Cannot use '$first_python', Python >= 3.7 is required." \
948 "Use --python=/path/to/python to specify a supported Python."
950 error_exit
"Python not found. Use --python=/path/to/python"
956 error_exit
"GNU make ($make) not found"
959 if ! check_py_version
"$python"; then
960 error_exit
"Cannot use '$python', Python >= 3.7 is required." \
961 "Use --python=/path/to/python to specify a supported Python." \
963 " openSUSE Leap 15.3+: zypper install python39" \
964 " CentOS 8: dnf install python38"
968 python
="$(command -v "$python")"
970 # Create a Python virtual environment using our configured python.
971 # The stdout of this script will be the location of a symlink that
972 # points to the configured Python.
973 # Entry point scripts for pip, meson, and sphinx are generated if those
974 # packages are present.
976 # Defaults assumed for now:
977 # - venv is cleared if it exists already;
978 # - venv is allowed to use system packages;
979 # - all setup can be performed offline;
980 # - missing packages may be fetched from PyPI,
981 # unless --disable-pypi is passed.
982 # - pip is not installed into the venv when possible,
983 # but ensurepip is called as a fallback when necessary.
985 echo "python determined to be '$python'"
986 echo "python version: $($python --version)"
988 python
="$($python -B "${source_path}/python
/scripts
/mkvenv.py
" create pyvenv)"
989 if test "$?" -ne 0 ; then
990 error_exit
"python venv creation failed"
993 # Suppress writing compiled files
995 mkvenv
="$python ${source_path}/python/scripts/mkvenv.py"
998 if test "$pypi" = "enabled" ; then
999 mkvenv_flags
="--online"
1002 if ! $mkvenv ensure \
1004 --dir "${source_path}/python/wheels" \
1005 --diagnose "meson" \
1011 # At this point, we expect Meson to be installed and available.
1012 # We expect mkvenv or pip to have created pyvenv/bin/meson for us.
1013 # We ignore PATH completely here: we want to use the venv's Meson
1016 meson
="$(cd pyvenv/bin; pwd)/meson"
1018 # Conditionally ensure Sphinx is installed.
1021 if test "$pypi" = "enabled" -a "$docs" = "enabled" ; then
1022 mkvenv_flags
="--online"
1025 if test "$docs" != "disabled" ; then
1026 if ! $mkvenv ensure \
1028 --diagnose "sphinx-build" \
1029 "sphinx>=1.6.0" "sphinx-rtd-theme>=0.5.0";
1031 if test "$docs" = "enabled" ; then
1034 echo "Sphinx not found/usable, disabling docs."
1043 if test -z "$ninja"; then
1044 for c
in ninja ninja-build samu
; do
1046 ninja
=$
(command -v "$c")
1050 if test -z "$ninja"; then
1051 error_exit
"Cannot find Ninja"
1055 # Consult white-list to determine whether to enable werror
1056 # by default. Only enable by default for git builds
1057 if test -z "$werror" ; then
1058 if test "$git_submodules_action" != "ignore" && \
1059 { test "$linux" = "yes" ||
test "$mingw32" = "yes"; }; then
1066 if test "$targetos" = "bogus"; then
1067 # Now that we know that we're not printing the help and that
1068 # the compiler works (so the results of the check_defines we used
1069 # to identify the OS are reliable), if we didn't recognize the
1070 # host OS we should stop now.
1071 error_exit
"Unrecognized host OS (uname -s reports '$(uname -s)')"
1074 if test "$static" = "yes" ; then
1075 if test "$plugins" = "yes"; then
1076 error_exit
"static and plugins are mutually incompatible"
1081 test "$plugins" = "" && plugins
=yes
1086 # define THREAD __thread
1090 static THREAD int tls_var;
1091 int main(void) { return tls_var; }
1094 if test "$static" = "yes"; then
1095 if test "$pie" != "no" && compile_prog
"-Werror -fPIE -DPIE" "-static-pie"; then
1097 elif test "$pie" = "yes"; then
1098 error_exit
"-static-pie not available due to missing toolchain support"
1102 elif test "$pie" != "no"; then
1103 if compile_prog
"-Werror -fPIE -DPIE" "-pie"; then
1105 elif test "$pie" = "yes"; then
1106 error_exit
"PIE not available due to missing toolchain support"
1108 echo "Disabling PIE due to missing toolchain support"
1113 ##########################################
1115 if test -z "${target_list+xxx}" ; then
1117 for target
in $default_target_list; do
1118 target_list
="$target_list $target"
1120 target_list
="${target_list# }"
1123 target_list
=$
(echo "$target_list" |
sed -e 's/,/ /g')
1124 for target
in $target_list; do
1125 # Check that we recognised the target name; this allows a more
1126 # friendly error message than if we let it fall through.
1127 case " $default_target_list " in
1131 error_exit
"Unknown target name '$target'"
1137 # see if system emulation was really requested
1138 case " $target_list " in
1139 *"-softmmu "*) softmmu
=yes
1145 if test "$tcg" = "auto"; then
1146 if test -z "$target_list"; then
1153 if test "$tcg" = "enabled"; then
1154 git_submodules
="$git_submodules tests/fp/berkeley-testfloat-3"
1155 git_submodules
="$git_submodules tests/fp/berkeley-softfloat-3"
1158 ##########################################
1159 # big/little endian test
1161 #if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
1164 int main(void) { return 0; }
1167 if ! compile_prog
; then
1171 #if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
1174 int main(void) { return 0; }
1177 if ! compile_prog
; then
1180 echo big
/little
test failed
1185 ##########################################
1189 auto | enabled | internal
)
1190 # Simpler to always update submodule, even if not needed.
1191 git_submodules
="${git_submodules} dtc"
1195 ########################################
1196 # check if ccache is interfering with
1197 # semantic analysis of macros
1202 static const int Z = 1;
1203 #define fn() ({ Z; })
1204 #define TAUT(X) ((X) == Z)
1205 #define PAREN(X, Y) (X == Y)
1213 if (PAREN(x, y)) return 0;
1214 if (TAUT(Z)) return 0;
1219 if ! compile_object
"-Werror"; then
1223 ##########################################
1224 # functions to probe cross compilers
1228 if test $use_containers = "yes" && (has
"docker" || has
"podman"); then
1229 case $
($python "$source_path"/tests
/docker
/docker.py probe
) in
1230 *docker
) container
=docker
;;
1231 podman
) container
=podman
;;
1234 if test "$container" != "no"; then
1235 docker_py
="$python $source_path/tests/docker/docker.py --engine $container"
1236 runc
=$
($python "$source_path"/tests
/docker
/docker.py probe
)
1240 # cross compilers defaults, can be overridden with --cross-cc-ARCH
1241 : ${cross_prefix_aarch64="aarch64-linux-gnu-"}
1242 : ${cross_prefix_aarch64_be="$cross_prefix_aarch64"}
1243 : ${cross_prefix_alpha="alpha-linux-gnu-"}
1244 : ${cross_prefix_arm="arm-linux-gnueabihf-"}
1245 : ${cross_prefix_armeb="$cross_prefix_arm"}
1246 : ${cross_prefix_hexagon="hexagon-unknown-linux-musl-"}
1247 : ${cross_prefix_loongarch64="loongarch64-unknown-linux-gnu-"}
1248 : ${cross_prefix_hppa="hppa-linux-gnu-"}
1249 : ${cross_prefix_i386="i686-linux-gnu-"}
1250 : ${cross_prefix_m68k="m68k-linux-gnu-"}
1251 : ${cross_prefix_microblaze="microblaze-linux-musl-"}
1252 : ${cross_prefix_mips64el="mips64el-linux-gnuabi64-"}
1253 : ${cross_prefix_mips64="mips64-linux-gnuabi64-"}
1254 : ${cross_prefix_mipsel="mipsel-linux-gnu-"}
1255 : ${cross_prefix_mips="mips-linux-gnu-"}
1256 : ${cross_prefix_nios2="nios2-linux-gnu-"}
1257 : ${cross_prefix_ppc="powerpc-linux-gnu-"}
1258 : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
1259 : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
1260 : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
1261 : ${cross_prefix_s390x="s390x-linux-gnu-"}
1262 : ${cross_prefix_sh4="sh4-linux-gnu-"}
1263 : ${cross_prefix_sparc64="sparc64-linux-gnu-"}
1264 : ${cross_prefix_sparc="$cross_prefix_sparc64"}
1265 : ${cross_prefix_x86_64="x86_64-linux-gnu-"}
1267 : ${cross_cc_aarch64_be="$cross_cc_aarch64"}
1268 : ${cross_cc_cflags_aarch64_be="-mbig-endian"}
1269 : ${cross_cc_armeb="$cross_cc_arm"}
1270 : ${cross_cc_cflags_armeb="-mbig-endian"}
1271 : ${cross_cc_hexagon="hexagon-unknown-linux-musl-clang"}
1272 : ${cross_cc_cflags_hexagon="-mv73 -O2 -static"}
1273 : ${cross_cc_cflags_i386="-m32"}
1274 : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
1275 : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
1276 : ${cross_cc_ppc64le="$cross_cc_ppc64"}
1277 : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
1278 : ${cross_cc_cflags_sparc64="-m64 -mcpu=ultrasparc"}
1279 : ${cross_cc_sparc="$cross_cc_sparc64"}
1280 : ${cross_cc_cflags_sparc="-m32 -mcpu=supersparc"}
1281 : ${cross_cc_cflags_x86_64="-m64"}
1283 compute_target_variable
() {
1285 if eval test -n "\"\${cross_prefix_$1}\""; then
1286 if eval has
"\"\${cross_prefix_$1}\$3\""; then
1287 eval "$2=\"\${cross_prefix_$1}\$3\""
1294 case " $target_list " in
1295 *" $i "*) return 0;;
1302 # probe_target_compiler TARGET
1304 # Look for a compiler for the given target, either native or cross.
1305 # Set variables target_* if a compiler is found, and container_cross_*
1306 # if a Docker-based cross-compiler image is known for the target.
1307 # Set got_cross_cc to yes/no depending on whether a non-container-based
1308 # compiler was found.
1310 # If TARGET is a user-mode emulation target, also set build_static to
1311 # "y" if static linking is possible.
1313 probe_target_compiler
() {
1314 # reset all output variables
1323 container_cross_objcopy
=
1324 container_cross_ranlib
=
1325 container_cross_strip
=
1327 target_arch
=${1%%-*}
1328 case $target_arch in
1329 aarch64
) container_hosts
="x86_64 aarch64" ;;
1330 alpha
) container_hosts
=x86_64
;;
1331 arm
) container_hosts
="x86_64 aarch64" ;;
1332 cris
) container_hosts
=x86_64
;;
1333 hexagon
) container_hosts
=x86_64
;;
1334 hppa
) container_hosts
=x86_64
;;
1335 i386
) container_hosts
=x86_64
;;
1336 loongarch64
) container_hosts
=x86_64
;;
1337 m68k
) container_hosts
=x86_64
;;
1338 microblaze
) container_hosts
=x86_64
;;
1339 mips64el
) container_hosts
=x86_64
;;
1340 mips64
) container_hosts
=x86_64
;;
1341 mipsel
) container_hosts
=x86_64
;;
1342 mips
) container_hosts
=x86_64
;;
1343 nios2
) container_hosts
=x86_64
;;
1344 ppc
) container_hosts
=x86_64
;;
1345 ppc64|ppc64le
) container_hosts
=x86_64
;;
1346 riscv64
) container_hosts
=x86_64
;;
1347 s390x
) container_hosts
=x86_64
;;
1348 sh4
) container_hosts
=x86_64
;;
1349 sparc64
) container_hosts
=x86_64
;;
1350 tricore
) container_hosts
=x86_64
;;
1351 x86_64
) container_hosts
="aarch64 ppc64el x86_64" ;;
1352 xtensa
*) container_hosts
=x86_64
;;
1355 for host in $container_hosts; do
1356 test "$container" != no ||
continue
1357 test "$host" = "$cpu" ||
continue
1358 case $target_arch in
1360 # We don't have any bigendian build tools so we only use this for AArch64
1361 container_image
=debian-arm64-cross
1362 container_cross_prefix
=aarch64-linux-gnu-
1363 container_cross_cc
=${container_cross_prefix}gcc-10
1366 container_image
=debian-alpha-cross
1367 container_cross_prefix
=alpha-linux-gnu-
1370 # We don't have any bigendian build tools so we only use this for ARM
1371 container_image
=debian-armhf-cross
1372 container_cross_prefix
=arm-linux-gnueabihf-
1375 container_image
=fedora-cris-cross
1376 container_cross_prefix
=cris-linux-gnu-
1379 container_image
=debian-hexagon-cross
1380 container_cross_prefix
=hexagon-unknown-linux-musl-
1381 container_cross_cc
=${container_cross_prefix}clang
1384 container_image
=debian-hppa-cross
1385 container_cross_prefix
=hppa-linux-gnu-
1388 container_image
=fedora-i386-cross
1389 container_cross_prefix
=
1392 container_image
=debian-loongarch-cross
1393 container_cross_prefix
=loongarch64-unknown-linux-gnu-
1396 container_image
=debian-m68k-cross
1397 container_cross_prefix
=m68k-linux-gnu-
1400 container_image
=debian-microblaze-cross
1401 container_cross_prefix
=microblaze-linux-musl-
1404 container_image
=debian-mips64el-cross
1405 container_cross_prefix
=mips64el-linux-gnuabi64-
1408 container_image
=debian-mips64-cross
1409 container_cross_prefix
=mips64-linux-gnuabi64-
1412 container_image
=debian-mipsel-cross
1413 container_cross_prefix
=mipsel-linux-gnu-
1416 container_image
=debian-mips-cross
1417 container_cross_prefix
=mips-linux-gnu-
1420 container_image
=debian-nios2-cross
1421 container_cross_prefix
=nios2-linux-gnu-
1424 container_image
=debian-powerpc-test-cross
1425 container_cross_prefix
=powerpc-linux-gnu-
1426 container_cross_cc
=${container_cross_prefix}gcc-10
1429 container_image
=debian-powerpc-test-cross
1430 container_cross_prefix
=powerpc
${target_arch#ppc}-linux-gnu-
1431 container_cross_cc
=${container_cross_prefix}gcc-10
1434 container_image
=debian-riscv64-test-cross
1435 container_cross_prefix
=riscv64-linux-gnu-
1438 container_image
=debian-s390x-cross
1439 container_cross_prefix
=s390x-linux-gnu-
1442 container_image
=debian-sh4-cross
1443 container_cross_prefix
=sh4-linux-gnu-
1446 container_image
=debian-sparc64-cross
1447 container_cross_prefix
=sparc64-linux-gnu-
1450 container_image
=debian-tricore-cross
1451 container_cross_prefix
=tricore-
1452 container_cross_as
=tricore-as
1453 container_cross_ld
=tricore-ld
1457 container_image
=debian-amd64-cross
1458 container_cross_prefix
=x86_64-linux-gnu-
1461 container_hosts
=x86_64
1462 container_image
=debian-xtensa-cross
1464 # default to the dc232b cpu
1465 container_cross_prefix
=/opt
/2020.07/xtensa-dc232b-elf
/bin
/xtensa-dc232b-elf-
1468 : ${container_cross_cc:=${container_cross_prefix}gcc}
1469 : ${container_cross_ar:=${container_cross_prefix}ar}
1470 : ${container_cross_as:=${container_cross_prefix}as}
1471 : ${container_cross_ld:=${container_cross_prefix}ld}
1472 : ${container_cross_nm:=${container_cross_prefix}nm}
1473 : ${container_cross_objcopy:=${container_cross_prefix}objcopy}
1474 : ${container_cross_ranlib:=${container_cross_prefix}ranlib}
1475 : ${container_cross_strip:=${container_cross_prefix}strip}
1479 case "$target_arch:$cpu" in
1480 aarch64_be
:aarch64 | \
1487 try
='native cross' ;;
1489 eval "target_cflags=\${cross_cc_cflags_$target_arch}"
1490 for thistry
in $try; do
1499 target_objcopy
=$objcopy
1500 target_ranlib
=$ranlib
1505 if eval test -n "\"\${cross_cc_$target_arch}\""; then
1506 if eval has
"\"\${cross_cc_$target_arch}\""; then
1507 eval "target_cc=\"\${cross_cc_$target_arch}\""
1510 compute_target_variable
$target_arch target_cc gcc
1512 target_ccas
=$target_cc
1513 compute_target_variable
$target_arch target_ar
ar
1514 compute_target_variable
$target_arch target_as as
1515 compute_target_variable
$target_arch target_ld ld
1516 compute_target_variable
$target_arch target_nm nm
1517 compute_target_variable
$target_arch target_objcopy objcopy
1518 compute_target_variable
$target_arch target_ranlib ranlib
1519 compute_target_variable
$target_arch target_strip strip
1523 if test -n "$target_cc"; then
1524 case $target_arch in
1526 if $target_cc --version |
grep -qi "clang"; then
1531 elif test -n "$target_as" && test -n "$target_ld"; then
1532 # Special handling for assembler only targets
1550 if do_compiler
"$target_cc" $target_cflags -o $TMPO -c $TMPC &&
1551 do_compiler
"$target_cc" $target_cflags -r -nostdlib -o "${TMPDIR1}/${TMPB}2.o" "$TMPO" -lgcc; then
1557 if do_compiler
"$target_cc" $target_cflags -o $TMPE $TMPC -static ; then
1562 if do_compiler
"$target_cc" $target_cflags -o $TMPE $TMPC ; then
1570 if test $got_cross_cc != yes; then
1582 test -n "$target_cc"
1585 write_target_makefile
() {
1586 echo "EXTRA_CFLAGS=$target_cflags"
1587 if test -z "$target_cc" && test -z "$target_as"; then
1588 test -z "$container_image" && error_exit
"Internal error: could not find cross compiler for $1?"
1589 echo "$1: docker-image-$container_image" >> Makefile.prereqs
1590 if test -n "$container_cross_cc"; then
1591 echo "CC=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
1592 echo "CCAS=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
1594 echo "AR=$docker_py cc --cc $container_cross_ar -i qemu/$container_image -s $source_path --"
1595 echo "AS=$docker_py cc --cc $container_cross_as -i qemu/$container_image -s $source_path --"
1596 echo "LD=$docker_py cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --"
1597 echo "NM=$docker_py cc --cc $container_cross_nm -i qemu/$container_image -s $source_path --"
1598 echo "OBJCOPY=$docker_py cc --cc $container_cross_objcopy -i qemu/$container_image -s $source_path --"
1599 echo "RANLIB=$docker_py cc --cc $container_cross_ranlib -i qemu/$container_image -s $source_path --"
1600 echo "STRIP=$docker_py cc --cc $container_cross_strip -i qemu/$container_image -s $source_path --"
1602 if test -n "$target_cc"; then
1603 echo "CC=$target_cc"
1604 echo "CCAS=$target_ccas"
1606 if test -n "$target_ar"; then
1607 echo "AR=$target_ar"
1609 if test -n "$target_as"; then
1610 echo "AS=$target_as"
1612 if test -n "$target_ld"; then
1613 echo "LD=$target_ld"
1615 if test -n "$target_nm"; then
1616 echo "NM=$target_nm"
1618 if test -n "$target_objcopy"; then
1619 echo "OBJCOPY=$target_objcopy"
1621 if test -n "$target_ranlib"; then
1622 echo "RANLIB=$target_ranlib"
1624 if test -n "$target_strip"; then
1625 echo "STRIP=$target_strip"
1630 ##########################################
1631 # check for vfio_user_server
1633 case "$vfio_user_server" in
1635 if test "$git_submodules_action" != "ignore"; then
1636 git_submodules
="${git_submodules} subprojects/libvfio-user"
1641 #######################################
1642 # cross-compiled firmware targets
1644 # Set up build tree symlinks that point back into the source tree
1645 # (these can be both files and directories).
1646 # Caution: avoid adding files or directories here using wildcards. This
1647 # will result in problems later if a new file matching the wildcard is
1648 # added to the source tree -- nothing will cause configure to be rerun
1649 # so the build tree will be missing the link back to the new file, and
1650 # tests might fail. Prefer to keep the relevant files in their own
1651 # directory and symlink the directory instead.
1653 LINKS
="$LINKS docs/config"
1654 LINKS
="$LINKS pc-bios/optionrom/Makefile"
1655 LINKS
="$LINKS pc-bios/s390-ccw/Makefile"
1656 LINKS
="$LINKS pc-bios/vof/Makefile"
1657 LINKS
="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
1658 LINKS
="$LINKS tests/avocado tests/data"
1659 LINKS
="$LINKS tests/qemu-iotests/check"
1660 LINKS
="$LINKS python"
1661 LINKS
="$LINKS contrib/plugins/Makefile "
1662 for f
in $LINKS ; do
1663 if [ -e "$source_path/$f" ]; then
1664 symlink
"$source_path/$f" "$f"
1668 echo "# Automatically generated by configure - do not modify" > Makefile.prereqs
1670 # Mac OS X ships with a broken assembler
1672 if have_target i386-softmmu x86_64-softmmu
&& \
1673 test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
1674 test "$targetos" != "haiku" && \
1675 probe_target_compiler i386-softmmu
; then
1676 roms
="pc-bios/optionrom"
1677 config_mak
=pc-bios
/optionrom
/config.mak
1678 echo "# Automatically generated by configure - do not modify" > $config_mak
1679 echo "TOPSRC_DIR=$source_path" >> $config_mak
1680 write_target_makefile
>> $config_mak
1683 if have_target ppc-softmmu ppc64-softmmu
&& \
1684 probe_target_compiler ppc-softmmu
; then
1685 roms
="$roms pc-bios/vof"
1686 config_mak
=pc-bios
/vof
/config.mak
1687 echo "# Automatically generated by configure - do not modify" > $config_mak
1688 echo "SRC_DIR=$source_path/pc-bios/vof" >> $config_mak
1689 write_target_makefile
>> $config_mak
1692 # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
1693 # (which is the lowest architecture level that Clang supports)
1694 if have_target s390x-softmmu
&& probe_target_compiler s390x-softmmu
; then
1696 do_compiler
"$target_cc" $target_cc_cflags -march=z900
-o $TMPO -c $TMPC
1698 if [ $has_z900 = 0 ] || do_compiler
"$target_cc" $target_cc_cflags -march=z10
-msoft-float -Werror -o $TMPO -c $TMPC; then
1699 if [ $has_z900 != 0 ]; then
1700 echo "WARNING: Your compiler does not support the z900!"
1701 echo " The s390-ccw bios will only work with guest CPUs >= z10."
1703 roms
="$roms pc-bios/s390-ccw"
1704 config_mak
=pc-bios
/s390-ccw
/config-host.mak
1705 echo "# Automatically generated by configure - do not modify" > $config_mak
1706 echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak
1707 write_target_makefile
>> $config_mak
1708 # SLOF is required for building the s390-ccw firmware on s390x,
1709 # since it is using the libnet code from SLOF for network booting.
1710 git_submodules
="${git_submodules} roms/SLOF"
1714 #######################################
1715 # generate config-host.mak
1717 if ! (GIT
="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
1721 config_host_mak
="config-host.mak"
1723 echo "# Automatically generated by configure - do not modify" > $config_host_mak
1724 echo >> $config_host_mak
1726 echo all
: >> $config_host_mak
1727 echo "GIT=$git" >> $config_host_mak
1728 echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
1729 echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
1731 if test "$debug_tcg" = "yes" ; then
1732 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
1734 if test "$mingw32" = "yes" ; then
1735 echo "CONFIG_WIN32=y" >> $config_host_mak
1736 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER-QEMU}" >> $config_host_mak
1737 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO-Linux}" >> $config_host_mak
1738 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION-$(cat "$source_path"/VERSION)}" >> $config_host_mak
1740 echo "CONFIG_POSIX=y" >> $config_host_mak
1743 if test "$linux" = "yes" ; then
1744 echo "CONFIG_LINUX=y" >> $config_host_mak
1747 if test "$darwin" = "yes" ; then
1748 echo "CONFIG_DARWIN=y" >> $config_host_mak
1751 if test "$solaris" = "yes" ; then
1752 echo "CONFIG_SOLARIS=y" >> $config_host_mak
1754 echo "SRC_PATH=$source_path" >> $config_host_mak
1755 echo "TARGET_DIRS=$target_list" >> $config_host_mak
1757 # XXX: suppress that
1758 if [ "$bsd" = "yes" ] ; then
1759 echo "CONFIG_BSD=y" >> $config_host_mak
1762 if test "$plugins" = "yes" ; then
1763 echo "CONFIG_PLUGIN=y" >> $config_host_mak
1766 if test -n "$gdb_bin"; then
1767 gdb_version
=$
($gdb_bin --version |
head -n 1)
1768 if version_ge
${gdb_version##* } 9.1; then
1769 echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
1770 gdb_arches
=$
($python "$source_path/scripts/probe-gdb-support.py" $gdb_bin)
1776 if test "$container" != no
; then
1777 echo "ENGINE=$container" >> $config_host_mak
1778 echo "RUNC=$runc" >> $config_host_mak
1780 echo "ROMS=$roms" >> $config_host_mak
1781 echo "MAKE=$make" >> $config_host_mak
1782 echo "PYTHON=$python" >> $config_host_mak
1783 echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
1784 echo "MESON=$meson" >> $config_host_mak
1785 echo "NINJA=$ninja" >> $config_host_mak
1786 echo "PKG_CONFIG=${pkg_config}" >> $config_host_mak
1787 echo "CC=$cc" >> $config_host_mak
1788 echo "EXESUF=$EXESUF" >> $config_host_mak
1790 # use included Linux headers
1791 if test "$linux" = "yes" ; then
1792 mkdir
-p linux-headers
1807 linux_arch
=loongarch
1813 # For most CPUs the kernel architecture name and QEMU CPU name match.
1817 # For non-KVM architectures we will not have asm headers
1818 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
1819 symlink
"$source_path/linux-headers/asm-$linux_arch" linux-headers
/asm
1823 for target
in $target_list; do
1824 target_dir
="$target"
1825 target_name
=$
(echo $target | cut
-d '-' -f 1)$EXESUF
1826 mkdir
-p "$target_dir"
1828 *-user) symlink
"../qemu-$target_name" "$target_dir/qemu-$target_name" ;;
1829 *) symlink
"../qemu-system-$target_name" "$target_dir/qemu-system-$target_name" ;;
1833 if test "$default_targets" = "yes"; then
1834 echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
1837 if test "$ccache_cpp2" = "yes"; then
1838 echo "export CCACHE_CPP2=y" >> $config_host_mak
1841 # tests/tcg configuration
1842 (config_host_mak
=tests
/tcg
/config-host.mak
1844 echo "# Automatically generated by configure - do not modify" > $config_host_mak
1845 echo "SRC_PATH=$source_path" >> $config_host_mak
1846 echo "HOST_CC=$host_cc" >> $config_host_mak
1848 # versioned checked in the main config_host.mak above
1849 if test -n "$gdb_bin"; then
1850 echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
1852 if test "$plugins" = "yes" ; then
1853 echo "CONFIG_PLUGIN=y" >> $config_host_mak
1857 for target
in $target_list; do
1862 # the toolchain is not complete with headers, only build softmmu tests
1866 test -f "$source_path/tests/tcg/$arch/Makefile.softmmu-target" ||
continue
1867 qemu
="qemu-system-$arch"
1869 *-linux-user|
*-bsd-user)
1874 if probe_target_compiler
$target ||
test -n "$container_image"; then
1875 test -n "$container_image" && build_static
=y
1876 mkdir
-p "tests/tcg/$target"
1877 config_target_mak
=tests
/tcg
/$target/config-target.mak
1878 ln -sf "$source_path/tests/tcg/Makefile.target" "tests/tcg/$target/Makefile"
1879 echo "# Automatically generated by configure - do not modify" > "$config_target_mak"
1880 echo "TARGET_NAME=$arch" >> "$config_target_mak"
1881 echo "TARGET=$target" >> "$config_target_mak"
1882 write_target_makefile
"build-tcg-tests-$target" >> "$config_target_mak"
1883 echo "BUILD_STATIC=$build_static" >> "$config_target_mak"
1884 echo "QEMU=$PWD/$qemu" >> "$config_target_mak"
1886 # will GDB work with these binaries?
1887 if test "${gdb_arches#*$arch}" != "$gdb_arches"; then
1888 echo "HOST_GDB_SUPPORTS_ARCH=y" >> "$config_target_mak"
1891 echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs
1892 tcg_tests_targets
="$tcg_tests_targets $target"
1896 if test "$tcg" = "enabled"; then
1897 echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> config-host.mak
1901 if test "$skip_meson" = no
; then
1902 cross
="config-meson.cross.new"
1904 test $# = 0 && return
1905 echo "'$(echo $* | sed "s
/ /','/g
")'"
1908 echo "# Automatically generated by configure - do not modify" > $cross
1909 echo "[properties]" >> $cross
1911 # unroll any custom device configs
1912 for a
in $device_archs; do
1913 eval "c=\$devices_${a}"
1914 echo "${a}-softmmu = '$c'" >> $cross
1917 echo "[built-in options]" >> $cross
1918 echo "c_args = [$(meson_quote $CFLAGS $EXTRA_CFLAGS)]" >> $cross
1919 echo "cpp_args = [$(meson_quote $CXXFLAGS $EXTRA_CXXFLAGS)]" >> $cross
1920 test -n "$objcc" && echo "objc_args = [$(meson_quote $OBJCFLAGS $EXTRA_OBJCFLAGS)]" >> $cross
1921 echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross
1922 echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross
1923 echo "[binaries]" >> $cross
1924 echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross
1925 test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross
1926 test -n "$objcc" && echo "objc = [$(meson_quote $objcc $CPU_CFLAGS)]" >> $cross
1927 echo "ar = [$(meson_quote $ar)]" >> $cross
1928 echo "nm = [$(meson_quote $nm)]" >> $cross
1929 echo "pkgconfig = [$(meson_quote $pkg_config)]" >> $cross
1930 echo "ranlib = [$(meson_quote $ranlib)]" >> $cross
1931 if has
$sdl2_config; then
1932 echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross
1934 echo "strip = [$(meson_quote $strip)]" >> $cross
1935 echo "widl = [$(meson_quote $widl)]" >> $cross
1936 echo "windres = [$(meson_quote $windres)]" >> $cross
1937 echo "windmc = [$(meson_quote $windmc)]" >> $cross
1938 if test "$cross_compile" = "yes"; then
1939 cross_arg
="--cross-file config-meson.cross"
1940 echo "[host_machine]" >> $cross
1941 echo "system = '$targetos'" >> $cross
1944 echo "cpu_family = 'x86'" >> $cross
1947 echo "cpu_family = '$cpu'" >> $cross
1950 echo "cpu = '$cpu'" >> $cross
1951 if test "$bigendian" = "yes" ; then
1952 echo "endian = 'big'" >> $cross
1954 echo "endian = 'little'" >> $cross
1957 cross_arg
="--native-file config-meson.cross"
1959 mv $cross config-meson.cross
1961 rm -rf meson-private meson-info meson-logs
1963 # Prevent meson from automatically downloading wrapped subprojects when missing.
1964 # You can use 'meson subprojects download' before running configure.
1965 meson_option_add
"--wrap-mode=nodownload"
1968 test "$bindir" != "bin" && meson_option_add
"-Dbindir=$bindir"
1969 test "$default_feature" = no
&& meson_option_add
-Dauto_features=disabled
1970 test "$static" = yes && meson_option_add
-Dprefer_static=true
1971 test "$pie" = no
&& meson_option_add
-Db_pie=false
1972 test "$werror" = yes && meson_option_add
-Dwerror=true
1975 test "$cfi" != false
&& meson_option_add
"-Dcfi=$cfi"
1976 test "$docs" != auto
&& meson_option_add
"-Ddocs=$docs"
1977 test "$fdt" != auto
&& meson_option_add
"-Dfdt=$fdt"
1978 test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add
"-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
1979 test "$qemu_suffix" != qemu
&& meson_option_add
"-Dqemu_suffix=$qemu_suffix"
1980 test "$smbd" != '' && meson_option_add
"-Dsmbd=$smbd"
1981 test "$tcg" != enabled
&& meson_option_add
"-Dtcg=$tcg"
1982 test "$vfio_user_server" != auto
&& meson_option_add
"-Dvfio_user_server=$vfio_user_server"
1984 NINJA
=$ninja $meson setup
--prefix "$prefix" "$@" $cross_arg "$PWD" "$source_path"
1986 eval run_meson
$meson_options
1987 if test "$?" -ne 0 ; then
1988 error_exit
"meson setup failed"
1991 if test -f meson-private
/cmd_line.txt
; then
1992 # Adjust old command line options that were removed
1993 # sed -i is not portable
1995 /^sphinx_build/ && next;
1996 print;' meson-private
/cmd_line.txt
2000 # Save the configure command line for later reuse.
2001 cat <<EOD >config.status
2003 # Generated by configure.
2004 # Run this file to recreate the current configuration.
2005 # Compiler output produced by configure, useful for debugging
2006 # configure, is in config.log if it exists.
2012 eval envval
=\$
$envname
2014 if test -n "$envval"
2016 echo "$envname='$envval'" >> config.status
2017 echo "export $envname" >> config.status
2019 echo "unset $envname" >> config.status
2023 # Preserve various env variables that influence what
2024 # features/build target configure will detect
2030 preserve_env CXXFLAGS
2032 preserve_env LDFLAGS
2033 preserve_env LD_LIBRARY_PATH
2036 preserve_env OBJCFLAGS
2037 preserve_env OBJCOPY
2039 preserve_env PKG_CONFIG
2040 preserve_env PKG_CONFIG_LIBDIR
2041 preserve_env PKG_CONFIG_PATH
2043 preserve_env QEMU_GA_MANUFACTURER
2044 preserve_env QEMU_GA_DISTRO
2045 preserve_env QEMU_GA_VERSION
2046 preserve_env SDL2_CONFIG
2050 preserve_env WINDRES
2053 printf "exec" >>config.status
2054 for i
in "$0" "$@"; do
2055 test "$i" = --skip-meson ||
printf " %s" "$(quote_sh "$i")" >>config.status
2057 echo ' "$@"' >>config.status
2058 chmod +x config.status