3 # qemu configure script (c) 2003 Fabrice Bellard
6 # Unset some variables known to interfere with behavior of common tools,
7 # just as autoconf does.
8 CLICOLOR_FORCE
= GREP_OPTIONS
=
9 unset CLICOLOR_FORCE GREP_OPTIONS
11 # Don't allow CCACHE, if present, to use cached results of compile tests!
12 export CCACHE_RECACHE
=yes
14 # make source path absolute
15 source_path
=$
(cd "$(dirname -- "$0")"; pwd)
17 if test "$PWD" = "$source_path"
19 echo "Using './build' as the directory for build output"
21 MARKER
=build
/auto-created-by-configure
29 echo "ERROR: ./build dir already exists and was not previously created by configure"
37 cat > GNUmakefile
<<'EOF'
38 # This file is auto-generated by configure to support in-source tree
39 # 'make' command invocation
41 ifeq ($(MAKECMDGOALS),)
47 @echo 'changing dir to build for $(MAKE) "$(MAKECMDGOALS)"...'
48 @$(MAKE) -C build -f Makefile $(MAKECMDGOALS)
49 @if test "$(MAKECMDGOALS)" = "distclean" && \
50 test -e build/auto-created-by-configure ; \
52 rm -rf build GNUmakefile ; \
60 exec $source_path/configure
"$@"
63 # Temporary directory used for files created while
64 # configure runs. Since it is in the build directory
65 # we can safely blow away any previous version of it
66 # (and we need not jump through hoops to try to delete
67 # it when configure exits.)
72 echo "ERROR: failed to create temporary directory"
77 TMPC
="${TMPDIR1}/${TMPB}.c"
78 TMPO
="${TMPDIR1}/${TMPB}.o"
79 TMPCXX
="${TMPDIR1}/${TMPB}.cxx"
80 TMPE
="${TMPDIR1}/${TMPB}.exe"
84 # Print a helpful header at the top of config.log
85 echo "# QEMU configure log $(date)" >> config.log
86 printf "# Configured with:" >> config.log
87 printf " '%s'" "$0" "$@" >> config.log
89 echo "#" >> config.log
92 printf "%s" "$1" |
sed "s,','\\\\'',g; s,.*,'&',"
98 while test -n "$2"; do
111 # Run the compiler, capturing its output to the log. First argument
112 # is compiler binary to execute.
115 if test -n "$BASH_VERSION"; then eval '
117 funcs: ${FUNCNAME[*]}
118 lines: ${BASH_LINENO[*]}"
120 echo $compiler "$@" >> config.log
121 $compiler "$@" >> config.log
2>&1 ||
return $?
122 # Test passed. If this is an --enable-werror build, rerun
123 # the test with -Werror and bail out if it fails. This
124 # makes warning-generating-errors in configure test code
125 # obvious to developers.
126 if test "$werror" != "yes"; then
129 # Don't bother rerunning the compile if we were already using -Werror
135 echo $compiler -Werror "$@" >> config.log
136 $compiler -Werror "$@" >> config.log
2>&1 && return $?
137 error_exit
"configure test passed without -Werror but failed with -Werror." \
138 "This is probably a bug in the configure script. The failing command" \
139 "will be at the bottom of config.log." \
140 "You can run configure with --disable-werror to bypass this check."
144 do_compiler
"$cc" $CPU_CFLAGS "$@"
148 do_compiler
"$cxx" $CPU_CFLAGS "$@"
151 # Append $2 to the variable named $1, with space separation
153 eval $1=\
${$1:+\"\$$1 \"}\
$2
157 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
158 # options which some versions of GCC's C++ compiler complain about
159 # because they only make sense for C programs.
160 QEMU_CXXFLAGS
="-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS"
161 CONFIGURE_CXXFLAGS
=$
(echo "$CONFIGURE_CFLAGS" |
sed s
/-std=gnu11
/-std=gnu
++11/)
162 for arg
in $QEMU_CFLAGS; do
164 -Wstrict-prototypes|
-Wmissing-prototypes|
-Wnested-externs|\
165 -Wold-style-declaration|
-Wold-style-definition|
-Wredundant-decls)
168 QEMU_CXXFLAGS
=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
176 do_cc
$CFLAGS $EXTRA_CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
182 do_cc
$CFLAGS $EXTRA_CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC \
183 $LDFLAGS $EXTRA_LDFLAGS $CONFIGURE_LDFLAGS $QEMU_LDFLAGS $local_ldflags
186 # symbolically link $1 to $2. Portable version of "ln -sf".
189 mkdir
-p "$(dirname "$2")"
193 # check whether a command is available to this shell (may be either an
194 # executable or a builtin)
196 type "$1" >/dev
/null
2>&1
200 local_ver1
=$
(expr "$1" : '\([0-9.]*\)' |
tr .
' ')
201 local_ver2
=$
(echo "$2" |
tr .
' ')
205 # 'shift 2' if $2 is set, or 'shift' if $2 is not set
209 # the second argument finished, the first must be greater or equal
210 test $# = 1 && return 0
211 test $local_first -lt $2 && return 1
212 test $local_first -gt $2 && return 0
219 eval test -z '"${1#'"$2"'}"'
223 $ld --help 2>/dev
/null |
grep ".$1" >/dev
/null
2>&1
226 if printf %s
\\n
"$source_path" "$PWD" |
grep -q "[[:space:]:]";
228 error_exit
"main directory cannot contain spaces nor colons"
234 interp_prefix
="/usr/gnemul/qemu-%M"
238 audio_drv_list
="default"
239 block_drv_rw_whitelist
=""
240 block_drv_ro_whitelist
=""
247 gdb_bin
=$
(command -v "gdb-multiarch" ||
command -v "gdb")
249 if test -e "$source_path/.git"
251 git_submodules_action
="update"
253 git_submodules_action
="ignore"
256 git_submodules
="ui/keycodemapdb"
259 # Don't accept a target_list environment variable.
261 unset target_list_exclude
263 # Default value for a variable defining feature "foo".
264 # * foo="no" feature will only be used if --enable-foo arg is given
265 # * foo="" feature will be searched for, and if found, will be used
266 # unless --disable-foo is given
267 # * foo="yes" this value will only be set by --enable-foo flag.
268 # feature will searched for,
269 # if not found, configure exits with error
271 # Always add --enable-foo and --disable-foo command line args.
272 # Distributions want to ensure that several features are compiled in, and it
273 # is impossible without a --enable-foo that exits if a feature is not found.
276 # parse CC options second
278 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
280 --without-default-features)
291 xen_ctrl_version
="$default_feature"
292 vhost_kernel
="$default_feature"
293 vhost_net
="$default_feature"
294 vhost_crypto
="$default_feature"
295 vhost_scsi
="$default_feature"
296 vhost_vsock
="$default_feature"
298 vhost_user_fs
="$default_feature"
299 vhost_vdpa
="$default_feature"
300 rdma
="$default_feature"
301 pvrdma
="$default_feature"
306 fortify_source
="$default_feature"
320 opengl
="$default_feature"
322 tls_priority
="NORMAL"
323 plugins
="$default_feature"
324 secret_keyring
="$default_feature"
328 gio
="$default_feature"
331 # The following Meson options are handled manually (still they
332 # are included in the automatically generated help message)
334 # 1. Track which submodules are needed
335 if test "$default_feature" = no
; then
344 # 2. Support --with/--without option
345 default_devices
="true"
347 # 3. Automatically enable/disable other options
351 # 4. Detection partly done in configure
352 xen
=${default_feature:+disabled}
354 # parse CC options second
356 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
358 --cross-prefix=*) cross_prefix
="$optarg"
363 --cxx=*) CXX
="$optarg"
365 --cpu=*) cpu
="$optarg"
368 EXTRA_CFLAGS
="$EXTRA_CFLAGS $optarg"
369 EXTRA_CXXFLAGS
="$EXTRA_CXXFLAGS $optarg"
370 EXTRA_OBJCFLAGS
="$EXTRA_OBJCFLAGS $optarg"
372 --extra-cxxflags=*) EXTRA_CXXFLAGS
="$EXTRA_CXXFLAGS $optarg"
374 --extra-objcflags=*) EXTRA_OBJCFLAGS
="$EXTRA_OBJCFLAGS $optarg"
376 --extra-ldflags=*) EXTRA_LDFLAGS
="$EXTRA_LDFLAGS $optarg"
378 --enable-debug-info) debug_info
="yes"
380 --disable-debug-info) debug_info
="no"
382 --cross-cc-*[!a-zA-Z0-9_-
]*=*) error_exit
"Passed bad --cross-cc-FOO option"
384 --cross-cc-cflags-*) cc_arch
=${opt#--cross-cc-cflags-}; cc_arch
=${cc_arch%%=*}
385 eval "cross_cc_cflags_${cc_arch}=\$optarg"
386 cross_cc_vars
="$cross_cc_vars cross_cc_cflags_${cc_arch}"
388 --cross-cc-*) cc_arch
=${opt#--cross-cc-}; cc_arch
=${cc_arch%%=*}
389 cc_archs
="$cc_archs $cc_arch"
390 eval "cross_cc_${cc_arch}=\$optarg"
391 cross_cc_vars
="$cross_cc_vars cross_cc_${cc_arch}"
396 # Using uname is really, really broken. Once we have the right set of checks
397 # we can eliminate its usage altogether.
399 # Preferred compiler:
401 # ${cross_prefix}gcc (if cross-prefix specified)
403 if test -z "${CC}${cross_prefix}"; then
406 cc
="${CC-${cross_prefix}gcc}"
409 if test -z "${CXX}${cross_prefix}"; then
412 cxx
="${CXX-${cross_prefix}g++}"
415 ar="${AR-${cross_prefix}ar}"
416 as
="${AS-${cross_prefix}as}"
419 objcopy
="${OBJCOPY-${cross_prefix}objcopy}"
420 ld
="${LD-${cross_prefix}ld}"
421 ranlib
="${RANLIB-${cross_prefix}ranlib}"
422 nm
="${NM-${cross_prefix}nm}"
424 strip
="${STRIP-${cross_prefix}strip}"
425 windres
="${WINDRES-${cross_prefix}windres}"
426 pkg_config_exe
="${PKG_CONFIG-${cross_prefix}pkg-config}"
428 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
430 pkg_config
=query_pkg_config
431 sdl2_config
="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
433 # default flags for all hosts
434 # We use -fwrapv to tell the compiler that we require a C dialect where
435 # left shift of signed integers is well defined and has the expected
436 # 2s-complement style results. (Both clang and gcc agree that it
437 # provides these semantics.)
438 QEMU_CFLAGS
="-fno-strict-aliasing -fno-common -fwrapv"
439 QEMU_CFLAGS
="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
440 QEMU_CFLAGS
="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
441 QEMU_CFLAGS
="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
445 # Flags that are needed during configure but later taken care of by Meson
446 CONFIGURE_CFLAGS
="-std=gnu11 -Wall"
453 #error $1 not defined
455 int main(void) { return 0; }
463 int main(void) { return 0; }
470 int main(void) { return 0; }
474 if check_define __linux__
; then
476 elif check_define _WIN32
; then
478 elif check_define __OpenBSD__
; then
480 elif check_define __sun__
; then
482 elif check_define __HAIKU__
; then
484 elif check_define __FreeBSD__
; then
486 elif check_define __FreeBSD_kernel__
&& check_define __GLIBC__
; then
487 targetos
=gnu
/kfreebsd
488 elif check_define __DragonFly__
; then
490 elif check_define __NetBSD__
; then
492 elif check_define __APPLE__
; then
495 # This is a fatal error, but don't report it yet, because we
496 # might be going to just print the --help text, or it might
497 # be the result of a missing compiler.
519 # needed for kinfo_getvmmap(3) in libutil.h
536 # Disable attempts to use ObjectiveC features in os/object.h since they
537 # won't work when we're compiling with gcc as a C compiler.
538 QEMU_CFLAGS
="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
543 # needed for CMSG_ macros in sys/socket.h
544 QEMU_CFLAGS
="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
545 # needed for TIOCWIN* defines in termios.h
546 QEMU_CFLAGS
="-D__EXTENSIONS__ $QEMU_CFLAGS"
547 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
548 # Note that this check is broken for cross-compilation: if you're
549 # cross-compiling to one of these OSes then you'll need to specify
550 # the correct CPU with the --cpu option.
551 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
557 QEMU_CFLAGS
="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS"
561 vhost_user
=${default_feature:-yes}
565 if test ! -z "$cpu" ; then
566 # command line argument
568 elif check_define __i386__
; then
570 elif check_define __x86_64__
; then
571 if check_define __ILP32__
; then
576 elif check_define __sparc__
; then
577 if check_define __arch64__
; then
582 elif check_define _ARCH_PPC
; then
583 if check_define _ARCH_PPC64
; then
584 if check_define _LITTLE_ENDIAN
; then
592 elif check_define __mips__
; then
594 elif check_define __s390__
; then
595 if check_define __s390x__
; then
600 elif check_define __riscv
; then
602 elif check_define __arm__
; then
604 elif check_define __aarch64__
; then
606 elif check_define __loongarch64
; then
612 # Normalise host CPU name, set multilib cflags
613 # Note that this case should only have supported host CPUs, not guests.
618 i386|i486|i586|i686|i86pc|BePC
)
623 CPU_CFLAGS
="-mx32" ;;
626 # ??? Only extremely old AMD cpus do not have cmpxchg16b.
627 # If we truly care, we should simply detect this case at
628 # runtime and generate the fallback to serial emulation.
629 CPU_CFLAGS
="-m64 -mcx16" ;;
637 CPU_CFLAGS
="-m64 -mbig-endian" ;;
640 CPU_CFLAGS
="-m64 -mlittle-endian" ;;
649 CPU_CFLAGS
="-m32 -mv8plus -mcpu=ultrasparc" ;;
651 CPU_CFLAGS
="-m64 -mcpu=ultrasparc" ;;
654 : ${make=${MAKE-make}}
656 # We prefer python 3.x. A bare 'python' is traditionally
657 # python 2.x, but some distros have it as python 3.x, so
661 for binary
in "${PYTHON-python3}" python
665 python
=$
(command -v "$binary")
671 # Check for ancillary tools used in testing
673 for binary
in genisoimage mkisofs
677 genisoimage
=$
(command -v "$binary")
682 # Default objcc to clang if available, otherwise use CC
689 if test "$mingw32" = "yes" ; then
691 # MinGW needs -mthreads for TLS and macro _MT.
692 CONFIGURE_CFLAGS
="-mthreads $CONFIGURE_CFLAGS"
700 .
$source_path/scripts
/meson-buildoptions.sh
703 meson_option_parse
() {
704 meson_options
="$meson_options $(_meson_option_parse "$@
")"
705 if test $?
-eq 1; then
706 echo "ERROR: unknown option $1"
707 echo "Try '$0 --help' for more information"
713 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
715 --help|
-h) show_help
=yes
717 --version|
-V) exec cat $source_path/VERSION
719 --prefix=*) prefix
="$optarg"
721 --interp-prefix=*) interp_prefix
="$optarg"
727 --host-cc=*) host_cc
="$optarg"
731 --iasl=*) iasl
="$optarg"
733 --objcc=*) objcc
="$optarg"
735 --make=*) make="$optarg"
739 --python=*) python
="$optarg" ; explicit_python
=yes
741 --sphinx-build=*) sphinx_build
="$optarg"
743 --skip-meson) skip_meson
=yes
745 --meson=*) meson
="$optarg"
747 --ninja=*) ninja
="$optarg"
749 --smbd=*) smbd
="$optarg"
761 --disable-debug-info)
771 --disable-module-upgrades) module_upgrades
="no"
773 --enable-module-upgrades) module_upgrades
="yes"
777 --target-list=*) target_list
="$optarg"
778 if test "$target_list_exclude"; then
779 error_exit
"Can't mix --target-list with --target-list-exclude"
782 --target-list-exclude=*) target_list_exclude
="$optarg"
783 if test "$target_list"; then
784 error_exit
"Can't mix --target-list-exclude with --target-list"
787 --with-trace-file=*) trace_file
="$optarg"
789 --with-default-devices) default_devices
="true"
791 --without-default-devices) default_devices
="false"
793 --with-devices-*[!a-zA-Z0-9_-
]*=*) error_exit
"Passed bad --with-devices-FOO option"
795 --with-devices-*) device_arch
=${opt#--with-devices-};
796 device_arch
=${device_arch%%=*}
797 cf
=$source_path/configs
/devices
/$device_arch-softmmu/$optarg.mak
798 if test -f "$cf"; then
799 device_archs
="$device_archs $device_arch"
800 eval "devices_${device_arch}=\$optarg"
802 error_exit
"File $cf does not exist"
805 --without-default-features) # processed above
807 --enable-gcov) gcov
="yes"
811 QEMU_PKG_CONFIG_FLAGS
="--static $QEMU_PKG_CONFIG_FLAGS"
813 --mandir=*) mandir
="$optarg"
815 --bindir=*) bindir
="$optarg"
817 --libdir=*) libdir
="$optarg"
819 --libexecdir=*) libexecdir
="$optarg"
821 --includedir=*) includedir
="$optarg"
823 --datadir=*) datadir
="$optarg"
825 --with-suffix=*) qemu_suffix
="$optarg"
827 --docdir=*) docdir
="$optarg"
829 --localedir=*) localedir
="$optarg"
831 --sysconfdir=*) sysconfdir
="$optarg"
833 --localstatedir=*) local_statedir
="$optarg"
835 --firmwarepath=*) firmwarepath
="$optarg"
838 --disable-dependency-tracking|\
839 --sbindir=*|
--sharedstatedir=*|\
840 --oldincludedir=*|
--datarootdir=*|
--infodir=*|\
841 --htmldir=*|
--dvidir=*|
--pdfdir=*|
--psdir=*)
842 # These switches are silently ignored, for compatibility with
843 # autoconf-generated configure scripts. This allows QEMU's
844 # configure to be used by RPM and similar macros that set
845 # lots of directory switches by default.
847 --audio-drv-list=*) audio_drv_list
="$optarg"
849 --block-drv-rw-whitelist=*|
--block-drv-whitelist=*) block_drv_rw_whitelist
=$
(echo "$optarg" |
sed -e 's/,/ /g')
851 --block-drv-ro-whitelist=*) block_drv_ro_whitelist
=$
(echo "$optarg" |
sed -e 's/,/ /g')
853 --enable-debug-tcg) debug_tcg
="yes"
855 --disable-debug-tcg) debug_tcg
="no"
858 # Enable debugging options that aren't excessively noisy
860 meson_option_parse
--enable-debug-mutex ""
864 --enable-sanitizers) sanitizers
="yes"
866 --disable-sanitizers) sanitizers
="no"
868 --enable-tsan) tsan
="yes"
870 --disable-tsan) tsan
="no"
872 --disable-slirp) slirp
="disabled"
874 --enable-slirp) slirp
="enabled"
876 --enable-slirp=git
) slirp
="internal"
878 --enable-slirp=*) slirp
="$optarg"
880 --disable-xen) xen
="disabled"
882 --enable-xen) xen
="enabled"
884 --disable-tcg) tcg
="disabled"
887 --enable-tcg) tcg
="enabled"
889 --disable-system) softmmu
="no"
891 --enable-system) softmmu
="yes"
898 --disable-linux-user) linux_user
="no"
900 --enable-linux-user) linux_user
="yes"
902 --disable-bsd-user) bsd_user
="no"
904 --enable-bsd-user) bsd_user
="yes"
906 --enable-pie) pie
="yes"
908 --disable-pie) pie
="no"
910 --enable-werror) werror
="yes"
912 --disable-werror) werror
="no"
914 --enable-lto) lto
="true"
916 --disable-lto) lto
="false"
918 --enable-stack-protector) stack_protector
="yes"
920 --disable-stack-protector) stack_protector
="no"
922 --enable-safe-stack) safe_stack
="yes"
924 --disable-safe-stack) safe_stack
="no"
930 --disable-cfi) cfi
="false"
932 --disable-fdt) fdt
="disabled"
934 --enable-fdt) fdt
="enabled"
936 --enable-fdt=git
) fdt
="internal"
938 --enable-fdt=*) fdt
="$optarg"
940 --with-pkgversion=*) pkgversion
="$optarg"
942 --with-coroutine=*) coroutine
="$optarg"
944 --disable-vhost-net) vhost_net
="no"
946 --enable-vhost-net) vhost_net
="yes"
948 --disable-vhost-crypto) vhost_crypto
="no"
950 --enable-vhost-crypto) vhost_crypto
="yes"
952 --disable-vhost-scsi) vhost_scsi
="no"
954 --enable-vhost-scsi) vhost_scsi
="yes"
956 --disable-vhost-vsock) vhost_vsock
="no"
958 --enable-vhost-vsock) vhost_vsock
="yes"
960 --disable-vhost-user-fs) vhost_user_fs
="no"
962 --enable-vhost-user-fs) vhost_user_fs
="yes"
964 --disable-opengl) opengl
="no"
966 --enable-opengl) opengl
="yes"
970 --disable-virtio-blk-data-plane|
--enable-virtio-blk-data-plane)
971 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
973 --enable-vhdx|
--disable-vhdx)
974 echo "$0: $opt is obsolete, VHDX driver is always built" >&2
976 --enable-uuid|
--disable-uuid)
977 echo "$0: $opt is obsolete, UUID support is always built" >&2
979 --tls-priority=*) tls_priority
="$optarg"
981 --enable-rdma) rdma
="yes"
983 --disable-rdma) rdma
="no"
985 --enable-pvrdma) pvrdma
="yes"
987 --disable-pvrdma) pvrdma
="no"
989 --disable-vhost-user) vhost_user
="no"
991 --enable-vhost-user) vhost_user
="yes"
993 --disable-vhost-vdpa) vhost_vdpa
="no"
995 --enable-vhost-vdpa) vhost_vdpa
="yes"
997 --disable-vhost-kernel) vhost_kernel
="no"
999 --enable-vhost-kernel) vhost_kernel
="yes"
1001 --disable-capstone) capstone
="disabled"
1003 --enable-capstone) capstone
="enabled"
1005 --enable-capstone=git
) capstone
="internal"
1007 --enable-capstone=*) capstone
="$optarg"
1009 --with-git=*) git
="$optarg"
1011 --with-git-submodules=*)
1012 git_submodules_action
="$optarg"
1014 --enable-plugins) if test "$mingw32" = "yes"; then
1015 error_exit
"TCG plugins not currently supported on Windows platforms"
1020 --disable-plugins) plugins
="no"
1022 --enable-containers) use_containers
="yes"
1024 --disable-containers) use_containers
="no"
1026 --gdb=*) gdb_bin
="$optarg"
1028 --enable-keyring) secret_keyring
="yes"
1030 --disable-keyring) secret_keyring
="no"
1032 --enable-gio) gio
=yes
1034 --disable-gio) gio
=no
1036 # backwards compatibility options
1037 --enable-trace-backend=*) meson_option_parse
"--enable-trace-backends=$optarg" "$optarg"
1039 --disable-blobs) meson_option_parse
--disable-install-blobs ""
1041 --enable-tcmalloc) meson_option_parse
--enable-malloc=tcmalloc tcmalloc
1043 --enable-jemalloc) meson_option_parse
--enable-malloc=jemalloc jemalloc
1045 # everything else has the same name in configure and meson
1046 --enable-* |
--disable-*) meson_option_parse
"$opt" "$optarg"
1049 echo "ERROR: unknown option $opt"
1050 echo "Try '$0 --help' for more information"
1056 # test for any invalid configuration combinations
1057 if test "$plugins" = "yes" -a "$tcg" = "disabled"; then
1058 error_exit
"Can't enable plugins on non-TCG builds"
1061 case $git_submodules_action in
1063 if test ! -e "$source_path/.git"; then
1064 echo "ERROR: cannot $git_submodules_action git submodules without .git"
1069 if ! test -f "$source_path/ui/keycodemapdb/README"
1072 echo "ERROR: missing GIT submodules"
1074 if test -e "$source_path/.git"; then
1075 echo "--with-git-submodules=ignore specified but submodules were not"
1076 echo "checked out. Please initialize and update submodules."
1078 echo "This is not a GIT checkout but module content appears to"
1079 echo "be missing. Do not use 'git archive' or GitHub download links"
1080 echo "to acquire QEMU source archives. Non-GIT builds are only"
1081 echo "supported with source archives linked from:"
1083 echo " https://www.qemu.org/download/#source"
1085 echo "Developers working with GIT can use scripts/archive-source.sh"
1086 echo "if they need to create valid source archives."
1093 echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'"
1098 libdir
="${libdir:-$prefix/lib}"
1099 libexecdir
="${libexecdir:-$prefix/libexec}"
1100 includedir
="${includedir:-$prefix/include}"
1102 if test "$mingw32" = "yes" ; then
1103 bindir
="${bindir:-$prefix}"
1105 bindir
="${bindir:-$prefix/bin}"
1107 mandir
="${mandir:-$prefix/share/man}"
1108 datadir
="${datadir:-$prefix/share}"
1109 docdir
="${docdir:-$prefix/share/doc}"
1110 sysconfdir
="${sysconfdir:-$prefix/etc}"
1111 local_statedir
="${local_statedir:-$prefix/var}"
1112 firmwarepath
="${firmwarepath:-$datadir/qemu-firmware}"
1113 localedir
="${localedir:-$datadir/locale}"
1115 if eval test -z "\${cross_cc_$cpu}"; then
1116 eval "cross_cc_${cpu}=\$cc"
1117 cross_cc_vars
="$cross_cc_vars cross_cc_${cpu}"
1120 default_target_list
=""
1123 if [ "$linux_user" != no
]; then
1124 if [ "$targetos" = linux
] && [ -d $source_path/linux-user
/include
/host
/$cpu ]; then
1126 elif [ "$linux_user" = yes ]; then
1127 error_exit
"linux-user not supported on this architecture"
1130 if [ "$bsd_user" != no
]; then
1131 if [ "$bsd_user" = "" ]; then
1132 test $targetos = freebsd
&& bsd_user
=yes
1134 if [ "$bsd_user" = yes ] && ! [ -d $source_path/bsd-user
/$targetos ]; then
1135 error_exit
"bsd-user not supported on this host OS"
1138 if [ "$softmmu" = "yes" ]; then
1139 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-softmmu.mak"
1141 if [ "$linux_user" = "yes" ]; then
1142 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-linux-user.mak"
1144 if [ "$bsd_user" = "yes" ]; then
1145 mak_wilds
="${mak_wilds} $source_path/configs/targets/*-bsd-user.mak"
1148 for config
in $mak_wilds; do
1149 target
="$(basename "$config" .mak)"
1150 if echo "$target_list_exclude" |
grep -vq "$target"; then
1151 default_target_list
="${default_target_list} $target"
1155 if test x
"$show_help" = x
"yes" ; then
1158 Usage: configure [options]
1159 Options: [defaults in brackets after descriptions]
1162 --help print this message
1163 --prefix=PREFIX install in PREFIX [$prefix]
1164 --interp-prefix=PREFIX where to find shared libraries, etc.
1165 use %M for cpu name [$interp_prefix]
1166 --target-list=LIST set target list (default: build all)
1167 $(echo Available targets: $default_target_list | \
1168 fold -s -w 53 | sed -e 's/^/ /')
1169 --target-list-exclude=LIST exclude a set of targets from the default target-list
1171 Advanced options (experts only):
1172 --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix]
1173 --cc=CC use C compiler CC [$cc]
1174 --iasl=IASL use ACPI compiler IASL [$iasl]
1175 --host-cc=CC use C compiler CC [$host_cc] for code run at
1177 --cxx=CXX use C++ compiler CXX [$cxx]
1178 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1179 --extra-cflags=CFLAGS append extra C compiler flags CFLAGS
1180 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
1181 --extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
1182 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1183 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases
1184 --cross-cc-cflags-ARCH= use compiler flags when building ARCH guest tests
1185 --make=MAKE use specified make [$make]
1186 --python=PYTHON use specified python [$python]
1187 --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build]
1188 --meson=MESON use specified meson [$meson]
1189 --ninja=NINJA use specified ninja [$ninja]
1190 --smbd=SMBD use specified smbd [$smbd]
1191 --with-git=GIT use specified git [$git]
1192 --with-git-submodules=update update git submodules (default if .git dir exists)
1193 --with-git-submodules=validate fail if git submodules are not up to date
1194 --with-git-submodules=ignore do not update or check git submodules (default if no .git dir)
1195 --static enable static build [$static]
1196 --mandir=PATH install man pages in PATH
1197 --datadir=PATH install firmware in PATH/$qemu_suffix
1198 --localedir=PATH install translation in PATH/$qemu_suffix
1199 --docdir=PATH install documentation in PATH/$qemu_suffix
1200 --bindir=PATH install binaries in PATH
1201 --libdir=PATH install libraries in PATH
1202 --libexecdir=PATH install helper binaries in PATH
1203 --sysconfdir=PATH install config in PATH/$qemu_suffix
1204 --localstatedir=PATH install local state in PATH (set at runtime on win32)
1205 --firmwarepath=PATH search PATH for firmware files
1206 --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs.
1207 --with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
1208 --with-pkgversion=VERS use specified string as sub-version of the package
1209 --without-default-features default all --enable-* options to "disabled"
1210 --without-default-devices do not include any device that is not needed to
1211 start the emulator (only use if you are including
1212 desired devices in configs/devices/)
1213 --with-devices-ARCH=NAME override default configs/devices
1214 --enable-debug enable common debug build options
1215 --enable-sanitizers enable default sanitizers
1216 --enable-tsan enable thread sanitizer
1217 --disable-werror disable compilation abort on warning
1218 --disable-stack-protector disable compiler-provided stack protection
1219 --audio-drv-list=LIST set audio drivers to try if -audiodev is not used
1220 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1221 --block-drv-rw-whitelist=L
1222 set block driver read-write whitelist
1223 (by default affects only QEMU, not tools like qemu-img)
1224 --block-drv-ro-whitelist=L
1225 set block driver read-only whitelist
1226 (by default affects only QEMU, not tools like qemu-img)
1227 --with-trace-file=NAME Full PATH,NAME of file to store traces
1229 --cpu=CPU Build for host CPU [$cpu]
1230 --with-coroutine=BACKEND coroutine backend. Supported options:
1231 ucontext, sigaltstack, windows
1232 --enable-gcov enable test coverage analysis with gcov
1233 --tls-priority default TLS protocol/cipher priority string
1235 enable plugins via shared library loading
1236 --disable-containers don't use containers for cross-building
1237 --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin]
1241 system all system emulation targets
1242 user supported user emulation targets
1243 linux-user all linux usermode emulation targets
1244 bsd-user all BSD usermode emulation targets
1245 pie Position Independent Executables
1246 modules modules support (non-Windows)
1247 module-upgrades try to load modules from alternate paths for upgrades
1248 debug-tcg TCG debugging (default is disabled)
1249 debug-info debugging information
1250 lto Enable Link-Time Optimization.
1251 safe-stack SafeStack Stack Smash Protection. Depends on
1252 clang/llvm >= 3.7 and requires coroutine backend ucontext.
1253 rdma Enable RDMA-based migration
1254 pvrdma Enable PVRDMA support
1255 vhost-net vhost-net kernel acceleration support
1256 vhost-vsock virtio sockets device support
1257 vhost-scsi vhost-scsi kernel target support
1258 vhost-crypto vhost-user-crypto backend support
1259 vhost-kernel vhost kernel backend support
1260 vhost-user vhost-user backend support
1261 vhost-vdpa vhost-vdpa kernel backend support
1262 opengl opengl support
1265 NOTE: The object files are built at the place where configure is launched
1270 # Remove old dependency files to make sure that they get properly regenerated
1271 rm -f */config-devices.mak.d
1273 if test -z "$python"
1275 error_exit
"Python not found. Use --python=/path/to/python"
1279 error_exit
"GNU make ($make) not found"
1282 # Note that if the Python conditional here evaluates True we will exit
1283 # with status 1 which is a shell 'false' value.
1284 if ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then
1285 error_exit
"Cannot use '$python', Python >= 3.6 is required." \
1286 "Use --python=/path/to/python to specify a supported Python."
1289 # Preserve python version since some functionality is dependent on it
1290 python_version
=$
($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev
/null
)
1292 # Suppress writing compiled files
1295 if test -z "$meson"; then
1296 if test "$explicit_python" = no
&& has meson
&& version_ge
"$(meson --version)" 0.59.3; then
1298 elif test $git_submodules_action != 'ignore' ; then
1300 elif test -e "${source_path}/meson/meson.py" ; then
1303 if test "$explicit_python" = yes; then
1304 error_exit
"--python requires using QEMU's embedded Meson distribution, but it was not found."
1306 error_exit
"Meson not found. Use --meson=/path/to/meson"
1310 # Meson uses its own Python interpreter to invoke other Python scripts,
1311 # but the user wants to use the one they specified with --python.
1313 # We do not want to override the distro Python interpreter (and sometimes
1314 # cannot: for example in Homebrew /usr/bin/meson is a bash script), so
1315 # just require --meson=git|internal together with --python.
1316 if test "$explicit_python" = yes; then
1319 *) error_exit
"--python requires using QEMU's embedded Meson distribution." ;;
1324 if test "$meson" = git
; then
1325 git_submodules
="${git_submodules} meson"
1330 meson
="$python ${source_path}/meson/meson.py"
1332 *) meson
=$
(command -v "$meson") ;;
1337 if test -z "$ninja"; then
1338 for c
in ninja ninja-build samu
; do
1340 ninja
=$
(command -v "$c")
1344 if test -z "$ninja"; then
1345 error_exit
"Cannot find Ninja"
1349 # Check that the C compiler works. Doing this here before testing
1350 # the host CPU ensures that we had a valid CC to autodetect the
1351 # $cpu var (and we should bail right here if that's not the case).
1352 # It also allows the help message to be printed without a CC.
1354 if compile_object
; then
1355 : C compiler works ok
1357 error_exit
"\"$cc\" either does not exist or does not work"
1359 if ! compile_prog
; then
1360 error_exit
"\"$cc\" cannot build an executable (is your linker broken?)"
1363 # Consult white-list to determine whether to enable werror
1364 # by default. Only enable by default for git builds
1365 if test -z "$werror" ; then
1366 if test "$git_submodules_action" != "ignore" && \
1367 { test "$linux" = "yes" ||
test "$mingw32" = "yes"; }; then
1374 if test "$targetos" = "bogus"; then
1375 # Now that we know that we're not printing the help and that
1376 # the compiler works (so the results of the check_defines we used
1377 # to identify the OS are reliable), if we didn't recognize the
1378 # host OS we should stop now.
1379 error_exit
"Unrecognized host OS (uname -s reports '$(uname -s)')"
1382 # Check whether the compiler matches our minimum requirements:
1384 #if defined(__clang_major__) && defined(__clang_minor__)
1385 # ifdef __apple_build_version__
1386 # if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0)
1387 # error You need at least XCode Clang v10.0 to compile QEMU
1390 # if __clang_major__ < 6 || (__clang_major__ == 6 && __clang_minor__ < 0)
1391 # error You need at least Clang v6.0 to compile QEMU
1394 #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
1395 # if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4)
1396 # error You need at least GCC v7.4.0 to compile QEMU
1399 # error You either need GCC or Clang to compiler QEMU
1401 int main (void) { return 0; }
1403 if ! compile_prog
"" "" ; then
1404 error_exit
"You need at least GCC v7.4 or Clang v6.0 (or XCode Clang v10.0)"
1407 # Accumulate -Wfoo and -Wno-bar separately.
1408 # We will list all of the enable flags first, and the disable flags second.
1409 # Note that we do not add -Werror, because that would enable it for all
1410 # configure tests. If a configure test failed due to -Werror this would
1411 # just silently disable some features, so it's too error prone.
1414 add_to warn_flags
-Wold-style-declaration
1415 add_to warn_flags
-Wold-style-definition
1416 add_to warn_flags
-Wtype-limits
1417 add_to warn_flags
-Wformat-security
1418 add_to warn_flags
-Wformat-y2k
1419 add_to warn_flags
-Winit-self
1420 add_to warn_flags
-Wignored-qualifiers
1421 add_to warn_flags
-Wempty-body
1422 add_to warn_flags
-Wnested-externs
1423 add_to warn_flags
-Wendif-labels
1424 add_to warn_flags
-Wexpansion-to-defined
1425 add_to warn_flags
-Wimplicit-fallthrough=2
1428 add_to nowarn_flags
-Wno-initializer-overrides
1429 add_to nowarn_flags
-Wno-missing-include-dirs
1430 add_to nowarn_flags
-Wno-shift-negative-value
1431 add_to nowarn_flags
-Wno-string-plus-int
1432 add_to nowarn_flags
-Wno-typedef-redefinition
1433 add_to nowarn_flags
-Wno-tautological-type-limit-compare
1434 add_to nowarn_flags
-Wno-psabi
1436 gcc_flags
="$warn_flags $nowarn_flags"
1438 cc_has_warning_flag
() {
1441 # Use the positive sense of the flag when testing for -Wno-wombat
1442 # support (gcc will happily accept the -Wno- form of unknown
1444 optflag
="$(echo $1 | sed -e 's/^-Wno-/-W/')"
1445 compile_prog
"-Werror $optflag" ""
1448 for flag
in $gcc_flags; do
1449 if cc_has_warning_flag
$flag ; then
1450 QEMU_CFLAGS
="$QEMU_CFLAGS $flag"
1454 if test "$stack_protector" != "no"; then
1456 int main(int argc, char *argv[])
1458 char arr[64], *p = arr, *c = argv[0];
1465 gcc_flags
="-fstack-protector-strong -fstack-protector-all"
1467 for flag
in $gcc_flags; do
1468 # We need to check both a compile and a link, since some compiler
1469 # setups fail only on a .c->.o compile and some only at link time
1470 if compile_object
"-Werror $flag" &&
1471 compile_prog
"-Werror $flag" ""; then
1472 QEMU_CFLAGS
="$QEMU_CFLAGS $flag"
1473 QEMU_LDFLAGS
="$QEMU_LDFLAGS $flag"
1478 if test "$stack_protector" = yes; then
1479 if test $sp_on = 0; then
1480 error_exit
"Stack protector not supported"
1485 # Disable -Wmissing-braces on older compilers that warn even for
1486 # the "universal" C zero initializer {0}.
1492 if compile_object
"-Werror" "" ; then
1495 QEMU_CFLAGS
="$QEMU_CFLAGS -Wno-missing-braces"
1498 # Our module code doesn't support Windows
1499 if test "$modules" = "yes" && test "$mingw32" = "yes" ; then
1500 error_exit
"Modules are not available for Windows"
1503 # module_upgrades is only reasonable if modules are enabled
1504 if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then
1505 error_exit
"Can't enable module-upgrades as Modules are not enabled"
1508 # Static linking is not possible with plugins, modules or PIE
1509 if test "$static" = "yes" ; then
1510 if test "$modules" = "yes" ; then
1511 error_exit
"static and modules are mutually incompatible"
1513 if test "$plugins" = "yes"; then
1514 error_exit
"static and plugins are mutually incompatible"
1519 test "$plugins" = "" && plugins
=yes
1524 # define THREAD __thread
1528 static THREAD int tls_var;
1529 int main(void) { return tls_var; }
1532 # Check we support -fno-pie and -no-pie first; we will need the former for
1533 # building ROMs, and both for everything if --disable-pie is passed.
1534 if compile_prog
"-Werror -fno-pie" "-no-pie"; then
1535 CFLAGS_NOPIE
="-fno-pie"
1536 LDFLAGS_NOPIE
="-no-pie"
1539 if test "$static" = "yes"; then
1540 if test "$pie" != "no" && compile_prog
"-Werror -fPIE -DPIE" "-static-pie"; then
1541 CONFIGURE_CFLAGS
="-fPIE -DPIE $CONFIGURE_CFLAGS"
1542 QEMU_LDFLAGS
="-static-pie $QEMU_LDFLAGS"
1544 elif test "$pie" = "yes"; then
1545 error_exit
"-static-pie not available due to missing toolchain support"
1547 QEMU_LDFLAGS
="-static $QEMU_LDFLAGS"
1550 elif test "$pie" = "no"; then
1551 CONFIGURE_CFLAGS
="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
1552 CONFIGURE_LDFLAGS
="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
1553 elif compile_prog
"-Werror -fPIE -DPIE" "-pie"; then
1554 CONFIGURE_CFLAGS
="-fPIE -DPIE $CONFIGURE_CFLAGS"
1555 CONFIGURE_LDFLAGS
="-pie $CONFIGURE_LDFLAGS"
1557 elif test "$pie" = "yes"; then
1558 error_exit
"PIE not available due to missing toolchain support"
1560 echo "Disabling PIE due to missing toolchain support"
1564 # Detect support for PT_GNU_RELRO + DT_BIND_NOW.
1565 # The combination is known as "full relro", because .got.plt is read-only too.
1566 if compile_prog
"" "-Wl,-z,relro -Wl,-z,now" ; then
1567 QEMU_LDFLAGS
="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS"
1570 ##########################################
1571 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
1572 # use i686 as default anyway, but for those that don't, an explicit
1573 # specification is necessary
1575 if test "$cpu" = "i386"; then
1577 static int sfaa(int *ptr)
1579 return __sync_fetch_and_and(ptr, 0);
1585 val = __sync_val_compare_and_swap(&val, 0, 1);
1590 if ! compile_prog
"" "" ; then
1591 QEMU_CFLAGS
="-march=i486 $QEMU_CFLAGS"
1595 if test "$tcg" = "enabled"; then
1596 git_submodules
="$git_submodules tests/fp/berkeley-testfloat-3"
1597 git_submodules
="$git_submodules tests/fp/berkeley-softfloat-3"
1600 if test -z "${target_list+xxx}" ; then
1602 for target
in $default_target_list; do
1603 target_list
="$target_list $target"
1605 target_list
="${target_list# }"
1608 target_list
=$
(echo "$target_list" |
sed -e 's/,/ /g')
1609 for target
in $target_list; do
1610 # Check that we recognised the target name; this allows a more
1611 # friendly error message than if we let it fall through.
1612 case " $default_target_list " in
1616 error_exit
"Unknown target name '$target'"
1622 # see if system emulation was really requested
1623 case " $target_list " in
1624 *"-softmmu "*) softmmu
=yes
1630 feature_not_found
() {
1634 error_exit
"User requested feature $feature" \
1635 "configure was not able to find it." \
1640 # big/little endian test
1643 short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1644 short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1645 int main(int argc, char *argv[])
1647 return printf("%s %s\n", (char *)big_endian, (char *)little_endian);
1651 if compile_prog
; then
1652 if strings -a $TMPE |
grep -q BiGeNdIaN
; then
1654 elif strings -a $TMPE |
grep -q LiTtLeEnDiAn
; then
1657 echo big
/little
test failed
1661 echo big
/little
test failed
1665 #########################################
1666 # vhost interdependencies and host support
1669 if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then
1670 error_exit
"vhost-user is not available on Windows"
1672 test "$vhost_vdpa" = "" && vhost_vdpa
=$linux
1673 if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then
1674 error_exit
"vhost-vdpa is only available on Linux"
1676 test "$vhost_kernel" = "" && vhost_kernel
=$linux
1677 if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then
1678 error_exit
"vhost-kernel is only available on Linux"
1681 # vhost-kernel devices
1682 test "$vhost_scsi" = "" && vhost_scsi
=$vhost_kernel
1683 if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then
1684 error_exit
"--enable-vhost-scsi requires --enable-vhost-kernel"
1686 test "$vhost_vsock" = "" && vhost_vsock
=$vhost_kernel
1687 if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then
1688 error_exit
"--enable-vhost-vsock requires --enable-vhost-kernel"
1691 # vhost-user backends
1692 test "$vhost_net_user" = "" && vhost_net_user
=$vhost_user
1693 if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then
1694 error_exit
"--enable-vhost-net-user requires --enable-vhost-user"
1696 test "$vhost_crypto" = "" && vhost_crypto
=$vhost_user
1697 if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
1698 error_exit
"--enable-vhost-crypto requires --enable-vhost-user"
1700 test "$vhost_user_fs" = "" && vhost_user_fs
=$vhost_user
1701 if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then
1702 error_exit
"--enable-vhost-user-fs requires --enable-vhost-user"
1704 #vhost-vdpa backends
1705 test "$vhost_net_vdpa" = "" && vhost_net_vdpa
=$vhost_vdpa
1706 if test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then
1707 error_exit
"--enable-vhost-net-vdpa requires --enable-vhost-vdpa"
1710 # OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity
1711 if test "$vhost_net" = ""; then
1712 test "$vhost_net_user" = "yes" && vhost_net
=yes
1713 test "$vhost_net_vdpa" = "yes" && vhost_net
=yes
1714 test "$vhost_kernel" = "yes" && vhost_net
=yes
1717 ##########################################
1720 if ! has
"$pkg_config_exe"; then
1721 error_exit
"pkg-config binary '$pkg_config_exe' not found"
1724 ##########################################
1727 if test "$xen" != "disabled" ; then
1728 # Check whether Xen library path is specified via --extra-ldflags to avoid
1729 # overriding this setting with pkg-config output. If not, try pkg-config
1730 # to obtain all needed flags.
1732 if ! echo $EXTRA_LDFLAGS |
grep tools
/libxc
> /dev
/null
&& \
1733 $pkg_config --exists xencontrol
; then
1734 xen_ctrl_version
="$(printf '%d%02d%02d' \
1735 $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
1737 xen_pc
="xencontrol xenstore xenforeignmemory xengnttab"
1738 xen_pc
="$xen_pc xenevtchn xendevicemodel"
1739 if $pkg_config --exists xentoolcore
; then
1740 xen_pc
="$xen_pc xentoolcore"
1742 xen_cflags
="$($pkg_config --cflags $xen_pc)"
1743 xen_libs
="$($pkg_config --libs $xen_pc)"
1746 xen_libs
="-lxenstore -lxenctrl"
1747 xen_stable_libs
="-lxenforeignmemory -lxengnttab -lxenevtchn"
1749 # First we test whether Xen headers and libraries are available.
1750 # If no, we are done and there is no Xen support.
1751 # If yes, more tests are run to detect the Xen version.
1755 #include <xenctrl.h>
1760 if ! compile_prog
"" "$xen_libs" ; then
1762 if test "$xen" = "enabled" ; then
1763 feature_not_found
"xen" "Install xen devel"
1769 cat > $TMPC <<EOF &&
1770 #undef XC_WANT_COMPAT_DEVICEMODEL_API
1771 #define __XEN_TOOLS__
1772 #include <xendevicemodel.h>
1773 #include <xenforeignmemory.h>
1775 xendevicemodel_handle *xd;
1776 xenforeignmemory_handle *xfmem;
1778 xd = xendevicemodel_open(0, 0);
1779 xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0);
1781 xfmem = xenforeignmemory_open(0, 0);
1782 xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0);
1787 compile_prog
"" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
1789 xen_stable_libs
="-lxendevicemodel $xen_stable_libs -lxentoolcore"
1790 xen_ctrl_version
=41100
1793 cat > $TMPC <<EOF &&
1794 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
1795 #include <xenforeignmemory.h>
1796 #include <xentoolcore.h>
1798 xenforeignmemory_handle *xfmem;
1800 xfmem = xenforeignmemory_open(0, 0);
1801 xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0);
1802 xentoolcore_restrict_all(0);
1807 compile_prog
"" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
1809 xen_stable_libs
="-lxendevicemodel $xen_stable_libs -lxentoolcore"
1810 xen_ctrl_version
=41000
1813 cat > $TMPC <<EOF &&
1814 #undef XC_WANT_COMPAT_DEVICEMODEL_API
1815 #define __XEN_TOOLS__
1816 #include <xendevicemodel.h>
1818 xendevicemodel_handle *xd;
1820 xd = xendevicemodel_open(0, 0);
1821 xendevicemodel_close(xd);
1826 compile_prog
"" "$xen_libs -lxendevicemodel $xen_stable_libs"
1828 xen_stable_libs
="-lxendevicemodel $xen_stable_libs"
1829 xen_ctrl_version
=40900
1832 cat > $TMPC <<EOF &&
1834 * If we have stable libs the we don't want the libxc compat
1835 * layers, regardless of what CFLAGS we may have been given.
1837 * Also, check if xengnttab_grant_copy_segment_t is defined and
1838 * grant copy operation is implemented.
1840 #undef XC_WANT_COMPAT_EVTCHN_API
1841 #undef XC_WANT_COMPAT_GNTTAB_API
1842 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
1843 #include <xenctrl.h>
1844 #include <xenstore.h>
1845 #include <xenevtchn.h>
1846 #include <xengnttab.h>
1847 #include <xenforeignmemory.h>
1849 #include <xen/hvm/hvm_info_table.h>
1850 #if !defined(HVM_MAX_VCPUS)
1851 # error HVM_MAX_VCPUS not defined
1854 xc_interface *xc = NULL;
1855 xenforeignmemory_handle *xfmem;
1856 xenevtchn_handle *xe;
1857 xengnttab_handle *xg;
1858 xengnttab_grant_copy_segment_t* seg = NULL;
1862 xc = xc_interface_open(0, 0, 0);
1863 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1864 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1865 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1866 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
1868 xfmem = xenforeignmemory_open(0, 0);
1869 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
1871 xe = xenevtchn_open(0, 0);
1874 xg = xengnttab_open(0, 0);
1875 xengnttab_grant_copy(xg, 0, seg);
1880 compile_prog
"" "$xen_libs $xen_stable_libs"
1882 xen_ctrl_version
=40800
1885 cat > $TMPC <<EOF &&
1887 * If we have stable libs the we don't want the libxc compat
1888 * layers, regardless of what CFLAGS we may have been given.
1890 #undef XC_WANT_COMPAT_EVTCHN_API
1891 #undef XC_WANT_COMPAT_GNTTAB_API
1892 #undef XC_WANT_COMPAT_MAP_FOREIGN_API
1893 #include <xenctrl.h>
1894 #include <xenstore.h>
1895 #include <xenevtchn.h>
1896 #include <xengnttab.h>
1897 #include <xenforeignmemory.h>
1899 #include <xen/hvm/hvm_info_table.h>
1900 #if !defined(HVM_MAX_VCPUS)
1901 # error HVM_MAX_VCPUS not defined
1904 xc_interface *xc = NULL;
1905 xenforeignmemory_handle *xfmem;
1906 xenevtchn_handle *xe;
1907 xengnttab_handle *xg;
1911 xc = xc_interface_open(0, 0, 0);
1912 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1913 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1914 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1915 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
1917 xfmem = xenforeignmemory_open(0, 0);
1918 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
1920 xe = xenevtchn_open(0, 0);
1923 xg = xengnttab_open(0, 0);
1924 xengnttab_map_grant_ref(xg, 0, 0, 0);
1929 compile_prog
"" "$xen_libs $xen_stable_libs"
1931 xen_ctrl_version
=40701
1936 cat > $TMPC <<EOF &&
1937 #include <xenctrl.h>
1938 #include <xenstore.h>
1940 #include <xen/hvm/hvm_info_table.h>
1941 #if !defined(HVM_MAX_VCPUS)
1942 # error HVM_MAX_VCPUS not defined
1947 xc = xc_interface_open(0, 0, 0);
1948 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1949 xc_gnttab_open(NULL, 0);
1950 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1951 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1952 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
1953 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
1957 compile_prog
"" "$xen_libs"
1959 xen_ctrl_version
=40600
1964 cat > $TMPC <<EOF &&
1965 #include <xenctrl.h>
1966 #include <xenstore.h>
1968 #include <xen/hvm/hvm_info_table.h>
1969 #if !defined(HVM_MAX_VCPUS)
1970 # error HVM_MAX_VCPUS not defined
1975 xc = xc_interface_open(0, 0, 0);
1976 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1977 xc_gnttab_open(NULL, 0);
1978 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1979 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1980 xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
1984 compile_prog
"" "$xen_libs"
1986 xen_ctrl_version
=40500
1990 cat > $TMPC <<EOF &&
1991 #include <xenctrl.h>
1992 #include <xenstore.h>
1994 #include <xen/hvm/hvm_info_table.h>
1995 #if !defined(HVM_MAX_VCPUS)
1996 # error HVM_MAX_VCPUS not defined
2001 xc = xc_interface_open(0, 0, 0);
2002 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
2003 xc_gnttab_open(NULL, 0);
2004 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
2005 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
2009 compile_prog
"" "$xen_libs"
2011 xen_ctrl_version
=40200
2015 if test "$xen" = "enabled" ; then
2016 feature_not_found
"xen (unsupported version)" \
2017 "Install a supported xen (xen 4.2 or newer)"
2022 if test "$xen" = enabled
; then
2023 if test $xen_ctrl_version -ge 40701 ; then
2024 xen_libs
="$xen_libs $xen_stable_libs "
2030 ##########################################
2031 # RDMA needs OpenFabrics libraries
2032 if test "$rdma" != "no" ; then
2034 #include <rdma/rdma_cma.h>
2035 int main(void) { return 0; }
2037 rdma_libs
="-lrdmacm -libverbs -libumad"
2038 if compile_prog
"" "$rdma_libs" ; then
2041 if test "$rdma" = "yes" ; then
2043 " OpenFabrics librdmacm/libibverbs/libibumad not present." \
2045 " (1) Fast: Install infiniband packages (devel) from your distro." \
2046 " (2) Cleanest: Install libraries from www.openfabrics.org" \
2047 " (3) Also: Install softiwarp if you don't have RDMA hardware"
2053 ##########################################
2056 cat > $TMPC <<EOF &&
2057 #include <sys/mman.h>
2064 addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED);
2070 if test "$rdma" = "yes" ; then
2073 if compile_prog
"" ""; then
2080 if ! compile_prog
"" ""; then
2081 error_exit
"PVRDMA is not supported since mremap is not implemented"
2090 if test "$pvrdma" = "yes" ; then
2091 error_exit
"PVRDMA requires rdma suppport"
2096 # Let's see if enhanced reg_mr is supported
2097 if test "$pvrdma" = "yes" ; then
2099 cat > $TMPC <<EOF &&
2100 #include <infiniband/verbs.h>
2106 struct ibv_pd *pd = NULL;
2112 mr = ibv_reg_mr_iova(pd, addr, length, iova, access);
2119 if ! compile_prog
"" "-libverbs"; then
2120 QEMU_CFLAGS
="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR"
2124 ##########################################
2125 # glib support probe
2128 glib_modules
=gthread-2.0
2129 if test "$modules" = yes; then
2130 glib_modules
="$glib_modules gmodule-export-2.0"
2131 elif test "$plugins" = "yes"; then
2132 glib_modules
="$glib_modules gmodule-no-export-2.0"
2135 for i
in $glib_modules; do
2136 if $pkg_config --atleast-version=$glib_req_ver $i; then
2137 glib_cflags
=$
($pkg_config --cflags $i)
2138 glib_libs
=$
($pkg_config --libs $i)
2140 error_exit
"glib-$glib_req_ver $i is required to compile QEMU"
2144 # This workaround is required due to a bug in pkg-config file for glib as it
2145 # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
2147 if test "$static" = yes && test "$mingw32" = yes; then
2148 glib_cflags
="-DGLIB_STATIC_COMPILATION $glib_cflags"
2151 if ! test "$gio" = "no"; then
2153 if $pkg_config --atleast-version=$glib_req_ver gio-2.0
; then
2154 gio_cflags
=$
($pkg_config --cflags gio-2.0
)
2155 gio_libs
=$
($pkg_config --libs gio-2.0
)
2156 gdbus_codegen
=$
($pkg_config --variable=gdbus_codegen gio-2.0
)
2157 if ! has
"$gdbus_codegen"; then
2160 # Check that the libraries actually work -- Ubuntu 18.04 ships
2161 # with pkg-config --static --libs data for gio-2.0 that is missing
2162 # -lblkid and will give a link error.
2164 #include <gio/gio.h>
2167 g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
2171 if compile_prog
"$gio_cflags" "$gio_libs" ; then
2177 if test "$pass" = "yes" &&
2178 $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0
; then
2179 gio_cflags
="$gio_cflags $($pkg_config --cflags gio-unix-2.0)"
2180 gio_libs
="$gio_libs $($pkg_config --libs gio-unix-2.0)"
2184 if test "$pass" = "no"; then
2185 if test "$gio" = "yes"; then
2186 feature_not_found
"gio" "Install libgio >= 2.0"
2195 # Sanity check that the current size_t matches the
2196 # size that glib thinks it should be. This catches
2197 # problems on multi-arch where people try to build
2198 # 32-bit QEMU while pointing at 64-bit glib headers
2203 #define QEMU_BUILD_BUG_ON(x) \
2204 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
2207 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
2212 if ! compile_prog
"$glib_cflags" "$glib_libs" ; then
2213 error_exit
"sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
2214 "You probably need to set PKG_CONFIG_LIBDIR"\
2215 "to point to the right pkg-config files for your"\
2219 # Silence clang warnings triggered by glib < 2.57.2
2222 typedef struct Foo {
2225 static void foo_free(Foo *f)
2229 G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free);
2230 int main(void) { return 0; }
2232 if ! compile_prog
"$glib_cflags -Werror" "$glib_libs" ; then
2233 if cc_has_warning_flag
"-Wno-unused-function"; then
2234 glib_cflags
="$glib_cflags -Wno-unused-function"
2235 CONFIGURE_CFLAGS
="$CONFIGURE_CFLAGS -Wno-unused-function"
2239 ##########################################
2240 # SHA command probe for modules
2241 if test "$modules" = yes; then
2242 shacmd_probe
="sha1sum sha1 shasum"
2243 for c
in $shacmd_probe; do
2249 if test "$shacmd" = ""; then
2250 error_exit
"one of the checksum commands is required to enable modules: $shacmd_probe"
2254 ##########################################
2258 auto | enabled | internal
)
2259 # Simpler to always update submodule, even if not needed.
2260 git_submodules
="${git_submodules} dtc"
2264 ##########################################
2265 # opengl probe (for sdl2, gtk)
2267 if test "$opengl" != "no" ; then
2269 if $pkg_config epoxy
; then
2271 #include <epoxy/egl.h>
2272 int main(void) { return 0; }
2274 if compile_prog
"" "" ; then
2279 if test "$epoxy" = "yes" ; then
2280 opengl_cflags
="$($pkg_config --cflags epoxy)"
2281 opengl_libs
="$($pkg_config --libs epoxy)"
2284 if test "$opengl" = "yes" ; then
2285 feature_not_found
"opengl" "Please install epoxy with EGL"
2295 if test "$linux_user" = "yes"; then
2297 #include <linux/usbdevice_fs.h>
2299 #ifndef USBDEVFS_GET_CAPABILITIES
2300 #error "USBDEVFS_GET_CAPABILITIES undefined"
2303 #ifndef USBDEVFS_DISCONNECT_CLAIM
2304 #error "USBDEVFS_DISCONNECT_CLAIM undefined"
2312 if compile_prog
"" ""; then
2317 ##########################################
2321 auto | enabled | internal
)
2322 # Simpler to always update submodule, even if not needed.
2323 git_submodules
="${git_submodules} capstone"
2327 ##########################################
2328 # check and set a backend for coroutine
2330 # We prefer ucontext, but it's not always possible. The fallback
2331 # is sigcontext. On Windows the only valid backend is the Windows
2335 if test "$darwin" != "yes"; then
2337 #include <ucontext.h>
2338 #ifdef __stub_makecontext
2339 #error Ignoring glibc stub makecontext which will always fail
2341 int main(void) { makecontext(0, 0, 0); return 0; }
2343 if compile_prog
"" "" ; then
2348 if test "$coroutine" = ""; then
2349 if test "$mingw32" = "yes"; then
2351 elif test "$ucontext_works" = "yes"; then
2354 coroutine
=sigaltstack
2359 if test "$mingw32" != "yes"; then
2360 error_exit
"'windows' coroutine backend only valid for Windows"
2362 # Unfortunately the user visible backend name doesn't match the
2363 # coroutine-*.c filename for this case, so we have to adjust it here.
2367 if test "$ucontext_works" != "yes"; then
2368 feature_not_found
"ucontext"
2372 if test "$mingw32" = "yes"; then
2373 error_exit
"only the 'windows' coroutine backend is valid for Windows"
2377 error_exit
"unknown coroutine backend $coroutine"
2382 ##################################################
2386 if test "$safe_stack" = "yes"; then
2388 int main(int argc, char *argv[])
2390 #if ! __has_feature(safe_stack)
2391 #error SafeStack Disabled
2396 flag
="-fsanitize=safe-stack"
2397 # Check that safe-stack is supported and enabled.
2398 if compile_prog
"-Werror $flag" "$flag"; then
2399 # Flag needed both at compilation and at linking
2400 QEMU_CFLAGS
="$QEMU_CFLAGS $flag"
2401 QEMU_LDFLAGS
="$QEMU_LDFLAGS $flag"
2403 error_exit
"SafeStack not supported by your compiler"
2405 if test "$coroutine" != "ucontext"; then
2406 error_exit
"SafeStack is only supported by the coroutine backend ucontext"
2410 int main(int argc, char *argv[])
2412 #if defined(__has_feature)
2413 #if __has_feature(safe_stack)
2414 #error SafeStack Enabled
2420 if test "$safe_stack" = "no"; then
2421 # Make sure that safe-stack is disabled
2422 if ! compile_prog
"-Werror" ""; then
2423 # SafeStack was already enabled, try to explicitly remove the feature
2424 flag
="-fno-sanitize=safe-stack"
2425 if ! compile_prog
"-Werror $flag" "$flag"; then
2426 error_exit
"Configure cannot disable SafeStack"
2428 QEMU_CFLAGS
="$QEMU_CFLAGS $flag"
2429 QEMU_LDFLAGS
="$QEMU_LDFLAGS $flag"
2431 else # "$safe_stack" = ""
2432 # Set safe_stack to yes or no based on pre-existing flags
2433 if compile_prog
"-Werror" ""; then
2437 if test "$coroutine" != "ucontext"; then
2438 error_exit
"SafeStack is only supported by the coroutine backend ucontext"
2444 ########################################
2445 # check if __[u]int128_t is usable.
2458 if compile_prog
"" "" ; then
2462 #########################################
2463 # See if 128-bit atomic operations are supported.
2466 if test "$int128" = "yes"; then
2470 unsigned __int128 x = 0, y = 0;
2471 y = __atomic_load(&x, 0);
2472 __atomic_store(&x, y, 0);
2473 __atomic_compare_exchange(&x, &y, x, 0, 0, 0);
2477 if compile_prog
"" "" ; then
2483 if test "$int128" = yes && test "$atomic128" = no
; then
2487 unsigned __int128 x = 0, y = 0;
2488 __sync_val_compare_and_swap_16(&x, y, x);
2492 if compile_prog
"" "" ; then
2497 ########################################
2498 # check if ccache is interfering with
2499 # semantic analysis of macros
2504 static const int Z = 1;
2505 #define fn() ({ Z; })
2506 #define TAUT(X) ((X) == Z)
2507 #define PAREN(X, Y) (X == Y)
2509 int main(int argc, char *argv[])
2515 if (PAREN(x, y)) return 0;
2516 if (TAUT(Z)) return 0;
2521 if ! compile_object
"-Werror"; then
2525 #################################################
2526 # clang does not support glibc + FORTIFY_SOURCE.
2528 if test "$fortify_source" != "no"; then
2529 if echo |
$cc -dM -E - |
grep __clang__
> /dev
/null
2>&1 ; then
2530 fortify_source
="no";
2531 elif test -n "$cxx" && has
$cxx &&
2532 echo |
$cxx -dM -E - |
grep __clang__
>/dev
/null
2>&1 ; then
2533 fortify_source
="no";
2535 fortify_source
="yes"
2539 ##########################################
2540 # checks for sanitizers
2544 have_asan_iface_h
=no
2545 have_asan_iface_fiber
=no
2547 if test "$sanitizers" = "yes" ; then
2549 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=address" ""; then
2553 # we could use a simple skeleton for flags checks, but this also
2554 # detect the static linking issue of ubsan, see also:
2555 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
2559 void *tmp = malloc(10);
2561 return *(int *)(tmp + 2);
2566 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
2570 if check_include
"sanitizer/asan_interface.h" ; then
2571 have_asan_iface_h
=yes
2575 #include <sanitizer/asan_interface.h>
2577 __sanitizer_start_switch_fiber(0, 0, 0);
2581 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=address" "" ; then
2582 have_asan_iface_fiber
=yes
2586 # Thread sanitizer is, for now, much noisier than the other sanitizers;
2587 # keep it separate until that is not the case.
2588 if test "$tsan" = "yes" && test "$sanitizers" = "yes"; then
2589 error_exit
"TSAN is not supported with other sanitiziers."
2592 have_tsan_iface_fiber
=no
2593 if test "$tsan" = "yes" ; then
2595 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then
2599 #include <sanitizer/tsan_interface.h>
2601 __tsan_create_fiber(0);
2605 if compile_prog
"$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then
2606 have_tsan_iface_fiber
=yes
2610 ##########################################
2614 auto | enabled | internal
)
2615 # Simpler to always update submodule, even if not needed.
2616 git_submodules
="${git_submodules} slirp"
2620 ##########################################
2621 # check for usable __NR_keyctl syscall
2623 if test "$linux" = "yes" ; then
2628 #include <asm/unistd.h>
2629 #include <linux/keyctl.h>
2632 return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0);
2635 if compile_prog
"" "" ; then
2639 if test "$secret_keyring" != "no"
2641 if test "$have_keyring" = "yes"
2645 if test "$secret_keyring" = "yes"
2647 error_exit
"syscall __NR_keyctl requested, \
2648 but not implemented on your system"
2655 ##########################################
2657 # After here, no more $cc or $ld runs
2661 if test "$gcov" = "yes" ; then
2663 elif test "$fortify_source" = "yes" ; then
2664 QEMU_CFLAGS
="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
2670 # Ensure there's only a single GP
2671 QEMU_CFLAGS
="-msmall-data $QEMU_CFLAGS"
2675 if test "$have_asan" = "yes"; then
2676 QEMU_CFLAGS
="-fsanitize=address $QEMU_CFLAGS"
2677 QEMU_LDFLAGS
="-fsanitize=address $QEMU_LDFLAGS"
2678 if test "$have_asan_iface_h" = "no" ; then
2679 echo "ASAN build enabled, but ASAN header missing." \
2680 "Without code annotation, the report may be inferior."
2681 elif test "$have_asan_iface_fiber" = "no" ; then
2682 echo "ASAN build enabled, but ASAN header is too old." \
2683 "Without code annotation, the report may be inferior."
2686 if test "$have_tsan" = "yes" ; then
2687 if test "$have_tsan_iface_fiber" = "yes" ; then
2688 QEMU_CFLAGS
="-fsanitize=thread $QEMU_CFLAGS"
2689 QEMU_LDFLAGS
="-fsanitize=thread $QEMU_LDFLAGS"
2691 error_exit
"Cannot enable TSAN due to missing fiber annotation interface."
2693 elif test "$tsan" = "yes" ; then
2694 error_exit
"Cannot enable TSAN due to missing sanitize thread interface."
2696 if test "$have_ubsan" = "yes"; then
2697 QEMU_CFLAGS
="-fsanitize=undefined $QEMU_CFLAGS"
2698 QEMU_LDFLAGS
="-fsanitize=undefined $QEMU_LDFLAGS"
2701 ##########################################
2703 # Exclude --warn-common with TSan to suppress warnings from the TSan libraries.
2704 if test "$solaris" = "no" && test "$tsan" = "no"; then
2705 if $ld --version 2>/dev
/null |
grep "GNU ld" >/dev
/null
2>/dev
/null
; then
2706 QEMU_LDFLAGS
="-Wl,--warn-common $QEMU_LDFLAGS"
2710 # Use ASLR, no-SEH and DEP if available
2711 if test "$mingw32" = "yes" ; then
2712 flags
="--no-seh --nxcompat"
2714 # Disable ASLR for debug builds to allow debugging with gdb
2715 if test "$debug" = "no" ; then
2716 flags
="--dynamicbase $flags"
2719 for flag
in $flags; do
2720 if ld_has
$flag ; then
2721 QEMU_LDFLAGS
="-Wl,$flag $QEMU_LDFLAGS"
2726 # Guest agent Windows MSI package
2728 if test "$QEMU_GA_MANUFACTURER" = ""; then
2729 QEMU_GA_MANUFACTURER
=QEMU
2731 if test "$QEMU_GA_DISTRO" = ""; then
2732 QEMU_GA_DISTRO
=Linux
2734 if test "$QEMU_GA_VERSION" = ""; then
2735 QEMU_GA_VERSION
=$
(cat $source_path/VERSION
)
2738 QEMU_GA_MSI_MINGW_DLL_PATH
="$($pkg_config --variable=prefix glib-2.0)/bin"
2740 # Mac OS X ships with a broken assembler
2742 if { test "$cpu" = "i386" ||
test "$cpu" = "x86_64"; } && \
2743 test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
2744 test "$targetos" != "haiku" && test "$softmmu" = yes ; then
2745 # Different host OS linkers have different ideas about the name of the ELF
2746 # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
2747 # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
2748 for emu
in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe
; do
2749 if "$ld" -verbose 2>&1 |
grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
2750 ld_i386_emulation
="$emu"
2757 # Only build s390-ccw bios if we're on s390x and the compiler has -march=z900
2758 # or -march=z10 (which is the lowest architecture level that Clang supports)
2759 if test "$cpu" = "s390x" ; then
2761 compile_prog
"-march=z900" ""
2763 if [ $has_z900 = 0 ] || compile_object
"-march=z10 -msoft-float -Werror"; then
2764 if [ $has_z900 != 0 ]; then
2765 echo "WARNING: Your compiler does not support the z900!"
2766 echo " The s390-ccw bios will only work with guest CPUs >= z10."
2768 roms
="$roms s390-ccw"
2769 # SLOF is required for building the s390-ccw firmware on s390x,
2770 # since it is using the libnet code from SLOF for network booting.
2771 git_submodules
="${git_submodules} roms/SLOF"
2775 # Check that the C++ compiler exists and works with the C compiler.
2776 # All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
2779 int c_function(void);
2780 int main(void) { return c_function(); }
2787 int c_function(void);
2789 int c_function(void) { return 42; }
2794 if do_cxx
$CXXFLAGS $EXTRA_CXXFLAGS $CONFIGURE_CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then
2795 # C++ compiler $cxx works ok with C compiler $cc
2798 echo "C++ compiler $cxx does not work with C compiler $cc"
2799 echo "Disabling C++ specific optional code"
2803 echo "No C++ compiler available; disabling C++ specific optional code"
2807 if !(GIT
="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
2811 config_host_mak
="config-host.mak"
2813 echo "# Automatically generated by configure - do not modify" > $config_host_mak
2814 echo >> $config_host_mak
2816 echo all
: >> $config_host_mak
2817 echo "GIT=$git" >> $config_host_mak
2818 echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
2819 echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
2821 if test "$debug_tcg" = "yes" ; then
2822 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2824 if test "$mingw32" = "yes" ; then
2825 echo "CONFIG_WIN32=y" >> $config_host_mak
2826 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
2827 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
2828 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
2829 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
2831 echo "CONFIG_POSIX=y" >> $config_host_mak
2834 if test "$linux" = "yes" ; then
2835 echo "CONFIG_LINUX=y" >> $config_host_mak
2838 if test "$darwin" = "yes" ; then
2839 echo "CONFIG_DARWIN=y" >> $config_host_mak
2842 if test "$solaris" = "yes" ; then
2843 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2845 if test "$static" = "yes" ; then
2846 echo "CONFIG_STATIC=y" >> $config_host_mak
2848 echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
2849 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
2850 qemu_version
=$
(head $source_path/VERSION
)
2851 echo "PKGVERSION=$pkgversion" >>$config_host_mak
2852 echo "SRC_PATH=$source_path" >> $config_host_mak
2853 echo "TARGET_DIRS=$target_list" >> $config_host_mak
2854 if test "$modules" = "yes"; then
2855 # $shacmd can generate a hash started with digit, which the compiler doesn't
2856 # like as an symbol. So prefix it with an underscore
2857 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
2858 echo "CONFIG_MODULES=y" >> $config_host_mak
2860 if test "$module_upgrades" = "yes"; then
2861 echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
2863 if test "$have_usbfs" = "yes" ; then
2864 echo "CONFIG_USBFS=y" >> $config_host_mak
2866 if test "$gio" = "yes" ; then
2867 echo "CONFIG_GIO=y" >> $config_host_mak
2868 echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak
2869 echo "GIO_LIBS=$gio_libs" >> $config_host_mak
2871 if test "$gdbus_codegen" != "" ; then
2872 echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak
2874 echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
2876 if test "$xen" = "enabled" ; then
2877 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
2878 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
2879 echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak
2880 echo "XEN_LIBS=$xen_libs" >> $config_host_mak
2882 if test "$vhost_scsi" = "yes" ; then
2883 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
2885 if test "$vhost_net" = "yes" ; then
2886 echo "CONFIG_VHOST_NET=y" >> $config_host_mak
2888 if test "$vhost_net_user" = "yes" ; then
2889 echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak
2891 if test "$vhost_net_vdpa" = "yes" ; then
2892 echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak
2894 if test "$vhost_crypto" = "yes" ; then
2895 echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
2897 if test "$vhost_vsock" = "yes" ; then
2898 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
2899 if test "$vhost_user" = "yes" ; then
2900 echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak
2903 if test "$vhost_kernel" = "yes" ; then
2904 echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
2906 if test "$vhost_user" = "yes" ; then
2907 echo "CONFIG_VHOST_USER=y" >> $config_host_mak
2909 if test "$vhost_vdpa" = "yes" ; then
2910 echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak
2912 if test "$vhost_user_fs" = "yes" ; then
2913 echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
2915 if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then
2916 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
2919 if test "$opengl" = "yes" ; then
2920 echo "CONFIG_OPENGL=y" >> $config_host_mak
2921 echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak
2922 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
2925 # XXX: suppress that
2926 if [ "$bsd" = "yes" ] ; then
2927 echo "CONFIG_BSD=y" >> $config_host_mak
2930 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
2932 if test "$have_asan_iface_fiber" = "yes" ; then
2933 echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak
2936 if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then
2937 echo "CONFIG_TSAN=y" >> $config_host_mak
2940 if test "$int128" = "yes" ; then
2941 echo "CONFIG_INT128=y" >> $config_host_mak
2944 if test "$atomic128" = "yes" ; then
2945 echo "CONFIG_ATOMIC128=y" >> $config_host_mak
2948 if test "$cmpxchg128" = "yes" ; then
2949 echo "CONFIG_CMPXCHG128=y" >> $config_host_mak
2952 if test "$rdma" = "yes" ; then
2953 echo "CONFIG_RDMA=y" >> $config_host_mak
2954 echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
2957 if test "$pvrdma" = "yes" ; then
2958 echo "CONFIG_PVRDMA=y" >> $config_host_mak
2961 if test "$plugins" = "yes" ; then
2962 echo "CONFIG_PLUGIN=y" >> $config_host_mak
2965 if test -n "$gdb_bin"; then
2966 gdb_version
=$
($gdb_bin --version |
head -n 1)
2967 if version_ge
${gdb_version##* } 9.1; then
2968 echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
2972 if test "$secret_keyring" = "yes" ; then
2973 echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak
2976 echo "ROMS=$roms" >> $config_host_mak
2977 echo "MAKE=$make" >> $config_host_mak
2978 echo "PYTHON=$python" >> $config_host_mak
2979 echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
2980 echo "MESON=$meson" >> $config_host_mak
2981 echo "NINJA=$ninja" >> $config_host_mak
2982 echo "CC=$cc" >> $config_host_mak
2983 echo "HOST_CC=$host_cc" >> $config_host_mak
2984 echo "AR=$ar" >> $config_host_mak
2985 echo "AS=$as" >> $config_host_mak
2986 echo "CCAS=$ccas" >> $config_host_mak
2987 echo "CPP=$cpp" >> $config_host_mak
2988 echo "OBJCOPY=$objcopy" >> $config_host_mak
2989 echo "LD=$ld" >> $config_host_mak
2990 echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
2991 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
2992 echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
2993 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
2994 echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
2995 echo "GLIB_VERSION=$(pkg-config --modversion glib-2.0)" >> $config_host_mak
2996 echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
2997 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
2998 echo "STRIP=$strip" >> $config_host_mak
2999 echo "EXESUF=$EXESUF" >> $config_host_mak
3001 # use included Linux headers
3002 if test "$linux" = "yes" ; then
3003 mkdir
-p linux-headers
3018 linux_arch
=loongarch
3024 # For most CPUs the kernel architecture name and QEMU CPU name match.
3028 # For non-KVM architectures we will not have asm headers
3029 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
3030 symlink
"$source_path/linux-headers/asm-$linux_arch" linux-headers
/asm
3034 for target
in $target_list; do
3035 target_dir
="$target"
3036 target_name
=$
(echo $target | cut
-d '-' -f 1)$EXESUF
3037 mkdir
-p $target_dir
3039 *-user) symlink
"../qemu-$target_name" "$target_dir/qemu-$target_name" ;;
3040 *) symlink
"../qemu-system-$target_name" "$target_dir/qemu-system-$target_name" ;;
3044 echo "CONFIG_QEMU_INTERP_PREFIX=$interp_prefix" |
sed 's/%M/@0@/' >> $config_host_mak
3045 if test "$default_targets" = "yes"; then
3046 echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
3049 if test "$ccache_cpp2" = "yes"; then
3050 echo "export CCACHE_CPP2=y" >> $config_host_mak
3053 if test "$safe_stack" = "yes"; then
3054 echo "CONFIG_SAFESTACK=y" >> $config_host_mak
3057 # If we're using a separate build tree, set it up now.
3058 # LINKS are things to symlink back into the source tree
3059 # (these can be both files and directories).
3060 # Caution: do not add files or directories here using wildcards. This
3061 # will result in problems later if a new file matching the wildcard is
3062 # added to the source tree -- nothing will cause configure to be rerun
3063 # so the build tree will be missing the link back to the new file, and
3064 # tests might fail. Prefer to keep the relevant files in their own
3065 # directory and symlink the directory instead.
3067 LINKS
="$LINKS tests/tcg/Makefile.target"
3068 LINKS
="$LINKS pc-bios/optionrom/Makefile"
3069 LINKS
="$LINKS pc-bios/s390-ccw/Makefile"
3070 LINKS
="$LINKS roms/seabios/Makefile"
3071 LINKS
="$LINKS pc-bios/qemu-icon.bmp"
3072 LINKS
="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
3073 LINKS
="$LINKS tests/avocado tests/data"
3074 LINKS
="$LINKS tests/qemu-iotests/check"
3075 LINKS
="$LINKS python"
3076 LINKS
="$LINKS contrib/plugins/Makefile "
3078 $source_path/pc-bios
/*.bin \
3079 $source_path/pc-bios
/*.elf \
3080 $source_path/pc-bios
/*.lid \
3081 $source_path/pc-bios
/*.rom \
3082 $source_path/pc-bios
/*.dtb \
3083 $source_path/pc-bios
/*.img \
3084 $source_path/pc-bios
/openbios-
* \
3085 $source_path/pc-bios
/u-boot.
* \
3086 $source_path/pc-bios
/palcode-
* \
3087 $source_path/pc-bios
/qemu_vga.ndrv
3090 LINKS
="$LINKS pc-bios/$(basename $bios_file)"
3092 for f
in $LINKS ; do
3093 if [ -e "$source_path/$f" ]; then
3094 mkdir
-p `dirname ./$f`
3095 symlink
"$source_path/$f" "$f"
3099 (for i
in $cross_cc_vars; do
3102 export target_list source_path use_containers cpu
3103 $source_path/tests
/tcg
/configure.sh
)
3105 # temporary config to build submodules
3106 if test -f $source_path/roms
/seabios
/Makefile
; then
3107 for rom
in seabios
; do
3108 config_mak
=roms
/$rom/config.mak
3109 echo "# Automatically generated by configure - do not modify" > $config_mak
3110 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3111 echo "AS=$as" >> $config_mak
3112 echo "CCAS=$ccas" >> $config_mak
3113 echo "CC=$cc" >> $config_mak
3114 echo "BCC=bcc" >> $config_mak
3115 echo "CPP=$cpp" >> $config_mak
3116 echo "OBJCOPY=objcopy" >> $config_mak
3117 echo "IASL=$iasl" >> $config_mak
3118 echo "LD=$ld" >> $config_mak
3119 echo "RANLIB=$ranlib" >> $config_mak
3123 config_mak
=pc-bios
/optionrom
/config.mak
3124 echo "# Automatically generated by configure - do not modify" > $config_mak
3125 echo "TOPSRC_DIR=$source_path" >> $config_mak
3127 if test "$skip_meson" = no
; then
3128 cross
="config-meson.cross.new"
3130 test $# = 0 && return
3131 echo "'$(echo $* | sed "s
/ /','/g
")'"
3134 echo "# Automatically generated by configure - do not modify" > $cross
3135 echo "[properties]" >> $cross
3137 # unroll any custom device configs
3138 for a
in $device_archs; do
3139 eval "c=\$devices_${a}"
3140 echo "${a}-softmmu = '$c'" >> $cross
3143 test -z "$cxx" && echo "link_language = 'c'" >> $cross
3144 echo "[built-in options]" >> $cross
3145 echo "c_args = [$(meson_quote $CFLAGS $EXTRA_CFLAGS)]" >> $cross
3146 echo "cpp_args = [$(meson_quote $CXXFLAGS $EXTRA_CXXFLAGS)]" >> $cross
3147 test -n "$objcc" && echo "objc_args = [$(meson_quote $OBJCFLAGS $EXTRA_OBJCFLAGS)]" >> $cross
3148 echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross
3149 echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross
3150 echo "[binaries]" >> $cross
3151 echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross
3152 test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross
3153 test -n "$objcc" && echo "objc = [$(meson_quote $objcc $CPU_CFLAGS)]" >> $cross
3154 echo "ar = [$(meson_quote $ar)]" >> $cross
3155 echo "nm = [$(meson_quote $nm)]" >> $cross
3156 echo "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross
3157 echo "ranlib = [$(meson_quote $ranlib)]" >> $cross
3158 if has
$sdl2_config; then
3159 echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross
3161 echo "strip = [$(meson_quote $strip)]" >> $cross
3162 echo "windres = [$(meson_quote $windres)]" >> $cross
3163 if test "$cross_compile" = "yes"; then
3164 cross_arg
="--cross-file config-meson.cross"
3165 echo "[host_machine]" >> $cross
3166 echo "system = '$targetos'" >> $cross
3169 echo "cpu_family = 'x86'" >> $cross
3172 echo "cpu_family = '$cpu'" >> $cross
3175 echo "cpu = '$cpu'" >> $cross
3176 if test "$bigendian" = "yes" ; then
3177 echo "endian = 'big'" >> $cross
3179 echo "endian = 'little'" >> $cross
3182 cross_arg
="--native-file config-meson.cross"
3184 mv $cross config-meson.cross
3186 rm -rf meson-private meson-info meson-logs
3188 NINJA
=$ninja $meson setup \
3189 --prefix "$prefix" \
3190 --libdir "$libdir" \
3191 --libexecdir "$libexecdir" \
3192 --bindir "$bindir" \
3193 --includedir "$includedir" \
3194 --datadir "$datadir" \
3195 --mandir "$mandir" \
3196 --sysconfdir "$sysconfdir" \
3197 --localedir "$localedir" \
3198 --localstatedir "$local_statedir" \
3199 -Daudio_drv_list=$audio_drv_list \
3200 -Ddefault_devices=$default_devices \
3201 -Ddocdir="$docdir" \
3202 -Diasl="$($iasl -h >/dev/null 2>&1 && printf %s "$iasl")" \
3203 -Dqemu_firmwarepath="$firmwarepath" \
3204 -Dqemu_suffix="$qemu_suffix" \
3206 -Dsphinx_build="$sphinx_build" \
3207 -Dtrace_file="$trace_file" \
3208 -Doptimization=$
(if test "$debug" = yes; then echo 0; else echo 2; fi) \
3209 -Ddebug=$
(if test "$debug_info" = yes; then echo true
; else echo false
; fi) \
3210 -Dwerror=$
(if test "$werror" = yes; then echo true
; else echo false
; fi) \
3211 -Db_pie=$
(if test "$pie" = yes; then echo true
; else echo false
; fi) \
3212 -Db_coverage=$
(if test "$gcov" = yes; then echo true
; else echo false
; fi) \
3213 -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg -Dxen=$xen \
3214 -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
3215 $
(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \
3216 $
(if test "$default_feature" = no
; then echo "-Dauto_features=disabled"; fi) \
3217 "$@" $cross_arg "$PWD" "$source_path"
3219 eval run_meson
$meson_options
3220 if test "$?" -ne 0 ; then
3221 error_exit
"meson setup failed"
3224 if test -f meson-private
/cmd_line.txt
; then
3225 # Adjust old command line options whose type was changed
3226 # Avoids having to use "setup --wipe" when Meson is upgraded
3228 s/^gettext = true$/gettext = auto/;
3229 s/^gettext = false$/gettext = disabled/;
3230 /^b_staticpic/ && next;
3231 print;' meson-private
/cmd_line.txt
3235 # Save the configure command line for later reuse.
3236 cat <<EOD >config.status
3238 # Generated by configure.
3239 # Run this file to recreate the current configuration.
3240 # Compiler output produced by configure, useful for debugging
3241 # configure, is in config.log if it exists.
3247 eval envval
=\$
$envname
3249 if test -n "$envval"
3251 echo "$envname='$envval'" >> config.status
3252 echo "export $envname" >> config.status
3254 echo "unset $envname" >> config.status
3258 # Preserve various env variables that influence what
3259 # features/build target configure will detect
3266 preserve_env CXXFLAGS
3267 preserve_env INSTALL
3269 preserve_env LDFLAGS
3270 preserve_env LD_LIBRARY_PATH
3271 preserve_env LIBTOOL
3274 preserve_env OBJCOPY
3276 preserve_env PKG_CONFIG
3277 preserve_env PKG_CONFIG_LIBDIR
3278 preserve_env PKG_CONFIG_PATH
3280 preserve_env SDL2_CONFIG
3283 preserve_env WINDRES
3285 printf "exec" >>config.status
3286 for i
in "$0" "$@"; do
3287 test "$i" = --skip-meson ||
printf " %s" "$(quote_sh "$i")" >>config.status
3289 echo ' "$@"' >>config.status
3290 chmod +x config.status