1#!/bin/sh 2# 3# qemu configure script (c) 2003 Fabrice Bellard 4# 5 6# Unset some variables known to interfere with behavior of common tools, 7# just as autoconf does. Unlike autoconf, we assume that unset exists. 8unset CLICOLOR_FORCE GREP_OPTIONS BASH_ENV ENV MAIL MAILPATH CDPATH 9 10# Don't allow CCACHE, if present, to use cached results of compile tests! 11export CCACHE_RECACHE=yes 12 13# make source path absolute 14source_path=$(cd "$(dirname -- "$0")"; pwd) 15 16if test "$PWD" = "$source_path" 17then 18 echo "Using './build' as the directory for build output" 19 20 MARKER=build/auto-created-by-configure 21 22 if test -e build 23 then 24 if test -f $MARKER 25 then 26 rm -rf build 27 else 28 echo "ERROR: ./build dir already exists and was not previously created by configure" 29 exit 1 30 fi 31 fi 32 33 if ! mkdir build || ! touch $MARKER 34 then 35 echo "ERROR: Could not create ./build directory. Check the permissions on" 36 echo "your source directory, or try doing an out-of-tree build." 37 exit 1 38 fi 39 40 cat > GNUmakefile <<'EOF' 41# This file is auto-generated by configure to support in-source tree 42# 'make' command invocation 43 44build: 45 @echo 'changing dir to build for $(MAKE) "$(MAKECMDGOALS)"...' 46 @$(MAKE) -C build -f Makefile $(MAKECMDGOALS) 47 @if test "$(MAKECMDGOALS)" = "distclean" && \ 48 test -e build/auto-created-by-configure ; \ 49 then \ 50 rm -rf build GNUmakefile ; \ 51 fi 52%: build 53 @ 54.PHONY: build 55GNUmakefile: ; 56 57EOF 58 cd build 59 exec "$source_path/configure" "$@" 60fi 61 62# Temporary directory used for files created while 63# configure runs. Since it is in the build directory 64# we can safely blow away any previous version of it 65# (and we need not jump through hoops to try to delete 66# it when configure exits.) 67TMPDIR1="config-temp" 68rm -rf "${TMPDIR1}" 69if ! mkdir -p "${TMPDIR1}"; then 70 echo "ERROR: failed to create temporary directory" 71 exit 1 72fi 73 74TMPB="qemu-conf" 75TMPC="${TMPDIR1}/${TMPB}.c" 76TMPO="${TMPDIR1}/${TMPB}.o" 77TMPE="${TMPDIR1}/${TMPB}.exe" 78 79rm -f config.log 80 81# Print a helpful header at the top of config.log 82echo "# QEMU configure log $(date)" >> config.log 83printf "# Configured with:" >> config.log 84# repeat the invocation to log and stdout for CI 85invoke=$(printf " '%s'" "$0" "$@") 86test -n "$GITLAB_CI" && echo "configuring with: $invoke" 87{ echo "$invoke"; echo; echo "#"; } >> config.log 88 89quote_sh() { 90 printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&'," 91} 92 93error_exit() { 94 (echo 95 echo "ERROR: $1" 96 while test -n "$2"; do 97 echo " $2" 98 shift 99 done 100 echo) >&2 101 exit 1 102} 103 104do_compiler() { 105 # Run the compiler, capturing its output to the log. First argument 106 # is compiler binary to execute. 107 compiler="$1" 108 shift 109 if test -n "$BASH_VERSION"; then eval ' 110 echo >>config.log " 111funcs: ${FUNCNAME[*]} 112lines: ${BASH_LINENO[*]}" 113 '; fi 114 echo $compiler "$@" >> config.log 115 $compiler "$@" >> config.log 2>&1 || return $? 116} 117 118do_cc() { 119 do_compiler "$cc" $CPU_CFLAGS "$@" 120} 121 122compile_object() { 123 local_cflags="$1" 124 do_cc $CFLAGS $EXTRA_CFLAGS $local_cflags -c -o $TMPO $TMPC 125} 126 127compile_prog() { 128 local_cflags="$1" 129 local_ldflags="$2" 130 do_cc $CFLAGS $EXTRA_CFLAGS $local_cflags -o $TMPE $TMPC \ 131 $LDFLAGS $EXTRA_LDFLAGS $local_ldflags 132} 133 134# symbolically link $1 to $2. Portable version of "ln -sf". 135symlink() { 136 rm -rf "$2" 137 mkdir -p "$(dirname "$2")" 138 ln -s "$1" "$2" 139} 140 141# check whether a command is available to this shell (may be either an 142# executable or a builtin) 143has() { 144 type "$1" >/dev/null 2>&1 145} 146 147version_ge () { 148 local_ver1=$(expr "$1" : '\([0-9.]*\)' | tr . ' ') 149 local_ver2=$(echo "$2" | tr . ' ') 150 while true; do 151 set x $local_ver1 152 local_first=${2-0} 153 # 'shift 2' if $2 is set, or 'shift' if $2 is not set 154 shift ${2:+2} 155 local_ver1=$* 156 set x $local_ver2 157 # the second argument finished, the first must be greater or equal 158 test $# = 1 && return 0 159 test $local_first -lt $2 && return 1 160 test $local_first -gt $2 && return 0 161 shift ${2:+2} 162 local_ver2=$* 163 done 164} 165 166if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]"; 167then 168 error_exit "main directory cannot contain spaces nor colons" 169fi 170 171# parse CC options first; some compiler tests are used to establish 172# some defaults, based on the host environment 173 174# default parameters 175container_engine="auto" 176cpu="" 177cross_compile="no" 178cross_prefix="" 179host_cc="cc" 180EXTRA_CFLAGS="" 181EXTRA_CXXFLAGS="" 182EXTRA_OBJCFLAGS="" 183EXTRA_LDFLAGS="" 184 185# Default value for a variable defining feature "foo". 186# * foo="no" feature will only be used if --enable-foo arg is given 187# * foo="" feature will be searched for, and if found, will be used 188# unless --disable-foo is given 189# * foo="yes" this value will only be set by --enable-foo flag. 190# feature will searched for, 191# if not found, configure exits with error 192# 193# Always add --enable-foo and --disable-foo command line args. 194# Distributions want to ensure that several features are compiled in, and it 195# is impossible without a --enable-foo that exits if a feature is not found. 196default_feature="" 197 198for opt do 199 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 200 case "$opt" in 201 --cross-prefix=*) cross_prefix="$optarg" 202 cross_compile="yes" 203 ;; 204 --cc=*) CC="$optarg" 205 ;; 206 --cxx=*) CXX="$optarg" 207 ;; 208 --objcc=*) objcc="$optarg" 209 ;; 210 --rustc=*) RUSTC="$optarg" 211 ;; 212 --cpu=*) cpu="$optarg" 213 ;; 214 --extra-cflags=*) 215 EXTRA_CFLAGS="$EXTRA_CFLAGS $optarg" 216 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $optarg" 217 EXTRA_OBJCFLAGS="$EXTRA_OBJCFLAGS $optarg" 218 ;; 219 --extra-cxxflags=*) EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $optarg" 220 ;; 221 --extra-objcflags=*) EXTRA_OBJCFLAGS="$EXTRA_OBJCFLAGS $optarg" 222 ;; 223 --extra-ldflags=*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS $optarg" 224 ;; 225 --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" 226 ;; 227 --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-cflags-}; cc_arch=${cc_arch%%=*} 228 eval "cross_cc_cflags_${cc_arch}=\$optarg" 229 ;; 230 --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} 231 eval "cross_cc_${cc_arch}=\$optarg" 232 ;; 233 --cross-prefix-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-prefix-FOO option" 234 ;; 235 --cross-prefix-*) cc_arch=${opt#--cross-prefix-}; cc_arch=${cc_arch%%=*} 236 eval "cross_prefix_${cc_arch}=\$optarg" 237 ;; 238 --without-default-features) default_feature="no" 239 ;; 240 esac 241done 242 243default_cflags='-O2 -g' 244git_submodules_action="update" 245docs="auto" 246EXESUF="" 247system="yes" 248linux_user="" 249bsd_user="" 250plugins="$default_feature" 251subdirs="" 252ninja="" 253python= 254download="enabled" 255skip_meson=no 256use_containers="yes" 257rust="disabled" 258rust_target_triple="" 259gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb") 260gdb_arches="" 261 262# Don't accept a target_list environment variable. 263unset target_list 264unset target_list_exclude 265 266# The following Meson options are handled manually (still they 267# are included in the automatically generated help message) 268# because they automatically enable/disable other options 269tcg="auto" 270cfi="false" 271 272# Meson has PIE as a boolean rather than enabled/disabled/auto, 273# and we also need to check for -static-pie before Meson runs 274# which requires knowing whether --static is enabled. 275pie="" 276static="no" 277 278# Preferred compiler: 279# ${CC} (if set) 280# ${cross_prefix}gcc (if cross-prefix specified) 281# system compiler 282if test -z "${CC}${cross_prefix}"; then 283 cc="cc" 284else 285 cc="${CC-${cross_prefix}gcc}" 286fi 287 288if test -z "${CXX}${cross_prefix}"; then 289 cxx="c++" 290else 291 cxx="${CXX-${cross_prefix}g++}" 292fi 293 294# Preferred ObjC compiler: 295# $objcc (if set, i.e. via --objcc option) 296# ${cross_prefix}clang (if cross-prefix specified) 297# clang (if available) 298# $cc 299if test -z "${objcc}${cross_prefix}"; then 300 if has clang; then 301 objcc=clang 302 else 303 objcc="$cc" 304 fi 305else 306 objcc="${objcc-${cross_prefix}clang}" 307fi 308 309ar="${AR-${cross_prefix}ar}" 310as="${AS-${cross_prefix}as}" 311ccas="${CCAS-$cc}" 312dlltool="${DLLTOOL-${cross_prefix}dlltool}" 313objcopy="${OBJCOPY-${cross_prefix}objcopy}" 314ld="${LD-${cross_prefix}ld}" 315ranlib="${RANLIB-${cross_prefix}ranlib}" 316nm="${NM-${cross_prefix}nm}" 317readelf="${READELF-${cross_prefix}readelf}" 318strip="${STRIP-${cross_prefix}strip}" 319widl="${WIDL-${cross_prefix}widl}" 320windres="${WINDRES-${cross_prefix}windres}" 321windmc="${WINDMC-${cross_prefix}windmc}" 322pkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}" 323sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 324 325rustc="${RUSTC-rustc}" 326 327check_define() { 328cat > $TMPC <<EOF 329#if !defined($1) 330#error $1 not defined 331#endif 332int main(void) { return 0; } 333EOF 334 compile_object 335} 336 337write_c_skeleton() { 338 cat > $TMPC <<EOF 339int main(void) { return 0; } 340EOF 341} 342 343if check_define __linux__ ; then 344 host_os=linux 345elif check_define _WIN32 ; then 346 host_os=windows 347elif check_define __OpenBSD__ ; then 348 host_os=openbsd 349elif check_define __sun__ ; then 350 host_os=sunos 351elif check_define __HAIKU__ ; then 352 host_os=haiku 353elif check_define __FreeBSD__ ; then 354 host_os=freebsd 355elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 356 host_os=gnu/kfreebsd 357elif check_define __DragonFly__ ; then 358 host_os=dragonfly 359elif check_define __NetBSD__; then 360 host_os=netbsd 361elif check_define __APPLE__; then 362 host_os=darwin 363else 364 # This is a fatal error, but don't report it yet, because we 365 # might be going to just print the --help text, or it might 366 # be the result of a missing compiler. 367 host_os=bogus 368fi 369 370if test ! -z "$cpu" ; then 371 # command line argument 372 : 373elif check_define __i386__ ; then 374 cpu="i386" 375elif check_define __x86_64__ ; then 376 if check_define __ILP32__ ; then 377 cpu="x32" 378 else 379 cpu="x86_64" 380 fi 381elif check_define __sparc__ ; then 382 if check_define __arch64__ ; then 383 cpu="sparc64" 384 else 385 cpu="sparc" 386 fi 387elif check_define _ARCH_PPC ; then 388 if check_define _ARCH_PPC64 ; then 389 if check_define _LITTLE_ENDIAN ; then 390 cpu="ppc64le" 391 else 392 cpu="ppc64" 393 fi 394 else 395 cpu="ppc" 396 fi 397elif check_define __mips__ ; then 398 cpu="mips" 399elif check_define __s390__ ; then 400 if check_define __s390x__ ; then 401 cpu="s390x" 402 else 403 cpu="s390" 404 fi 405elif check_define __riscv ; then 406 if check_define _LP64 ; then 407 cpu="riscv64" 408 else 409 cpu="riscv32" 410 fi 411elif check_define __arm__ ; then 412 cpu="arm" 413elif check_define __aarch64__ ; then 414 cpu="aarch64" 415elif check_define __loongarch64 ; then 416 cpu="loongarch64" 417else 418 # Using uname is really broken, but it is just a fallback for architectures 419 # that are going to use TCI anyway 420 cpu=$(uname -m) 421 if test "$host_os" != "bogus"; then 422 echo "WARNING: unrecognized host CPU, proceeding with 'uname -m' output '$cpu'" 423 fi 424fi 425 426# Normalise host CPU name to the values used by Meson cross files and in source 427# directories, and set multilib cflags. The canonicalization isn't really 428# necessary, because the architectures that we check for should not hit the 429# 'uname -m' case, but better safe than sorry in case --cpu= is used. 430# 431# Note that this case should only have supported host CPUs, not guests. 432# Please keep it sorted and synchronized with meson.build's host_arch. 433host_arch= 434linux_arch= 435raw_cpu=$cpu 436case "$cpu" in 437 aarch64) 438 host_arch=aarch64 439 linux_arch=arm64 440 ;; 441 442 armv*b|armv*l|arm) 443 cpu=arm 444 host_arch=arm 445 linux_arch=arm 446 ;; 447 448 i386|i486|i586|i686) 449 cpu="i386" 450 host_arch=i386 451 linux_arch=x86 452 CPU_CFLAGS="-m32" 453 ;; 454 455 loongarch*) 456 cpu=loongarch64 457 host_arch=loongarch64 458 linux_arch=loongarch 459 ;; 460 461 mips64*|mipsisa64*) 462 cpu=mips64 463 host_arch=mips 464 linux_arch=mips 465 ;; 466 mips*) 467 cpu=mips 468 host_arch=mips 469 linux_arch=mips 470 ;; 471 472 ppc) 473 host_arch=ppc 474 linux_arch=powerpc 475 CPU_CFLAGS="-m32" 476 ;; 477 ppc64) 478 host_arch=ppc64 479 linux_arch=powerpc 480 CPU_CFLAGS="-m64 -mbig-endian" 481 ;; 482 ppc64le) 483 cpu=ppc64 484 host_arch=ppc64 485 linux_arch=powerpc 486 CPU_CFLAGS="-m64 -mlittle-endian" 487 ;; 488 489 riscv32 | riscv64) 490 host_arch=riscv 491 linux_arch=riscv 492 ;; 493 494 s390) 495 linux_arch=s390 496 CPU_CFLAGS="-m31" 497 ;; 498 s390x) 499 host_arch=s390x 500 linux_arch=s390 501 CPU_CFLAGS="-m64" 502 ;; 503 504 sparc|sun4[cdmuv]) 505 cpu=sparc 506 CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" 507 ;; 508 sparc64) 509 host_arch=sparc64 510 CPU_CFLAGS="-m64 -mcpu=ultrasparc" 511 ;; 512 513 x32) 514 cpu="x86_64" 515 host_arch=x86_64 516 linux_arch=x86 517 CPU_CFLAGS="-mx32" 518 ;; 519 x86_64|amd64) 520 cpu="x86_64" 521 host_arch=x86_64 522 linux_arch=x86 523 CPU_CFLAGS="-m64" 524 ;; 525esac 526 527# Now we have our CPU_CFLAGS we can check if we are targeting a 32 or 528# 64 bit host. 529 530check_64bit_host() { 531cat > $TMPC <<EOF 532#if __SIZEOF_POINTER__ != 8 533#error not 64 bit system 534#endif 535int main(void) { return 0; } 536EOF 537 compile_object "$1" 538} 539 540if check_64bit_host "$CPU_CFLAGS"; then 541 host_bits=64 542else 543 host_bits=32 544fi 545 546if test -n "$host_arch" && { 547 ! test -d "$source_path/linux-user/include/host/$host_arch" || 548 ! test -d "$source_path/common-user/host/$host_arch"; }; then 549 error_exit "linux-user/include/host/$host_arch does not exist." \ 550 "This is a bug in the configure script, please report it." 551fi 552if test -n "$linux_arch" && ! test -d "$source_path/linux-headers/asm-$linux_arch"; then 553 error_exit "linux-headers/asm-$linux_arch does not exist." \ 554 "This is a bug in the configure script, please report it." 555fi 556 557check_py_version() { 558 # We require python >= 3.8. 559 # NB: a True python conditional creates a non-zero return code (Failure) 560 "$1" -c 'import sys; sys.exit(sys.version_info < (3,8))' 561} 562 563first_python= 564if test -z "${PYTHON}"; then 565 # A bare 'python' is traditionally python 2.x, but some distros 566 # have it as python 3.x, so check in both places. 567 for binary in python3 python python3.12 python3.11 \ 568 python3.10 python3.9 python3.8; do 569 if has "$binary"; then 570 python=$(command -v "$binary") 571 if check_py_version "$python"; then 572 # This one is good. 573 first_python= 574 break 575 else 576 first_python=$python 577 fi 578 fi 579 done 580else 581 # Same as above, but only check the environment variable. 582 has "${PYTHON}" || error_exit "The PYTHON environment variable does not point to an executable" 583 python=$(command -v "$PYTHON") 584 if check_py_version "$python"; then 585 # This one is good. 586 first_python= 587 else 588 first_python=$first_python 589 fi 590fi 591 592# Check for ancillary tools used in testing 593genisoimage= 594for binary in genisoimage mkisofs 595do 596 if has $binary 597 then 598 genisoimage=$(command -v "$binary") 599 break 600 fi 601done 602 603if test "$host_os" = "windows" ; then 604 EXESUF=".exe" 605fi 606 607meson_option_build_array() { 608 printf '[' 609 (if test "$host_os" = windows; then 610 IFS=\; 611 else 612 IFS=: 613 fi 614 for e in $1; do 615 printf '"""' 616 # backslash escape any '\' and '"' characters 617 printf "%s" "$e" | sed -e 's/\([\"]\)/\\\1/g' 618 printf '""",' 619 done) 620 printf ']\n' 621} 622 623. "$source_path/scripts/meson-buildoptions.sh" 624 625meson_options= 626meson_option_add() { 627 local arg 628 for arg; do 629 meson_options="$meson_options $(quote_sh "$arg")" 630 done 631} 632meson_option_parse() { 633 meson_options="$meson_options $(_meson_option_parse "$@")" 634 if test $? -eq 1; then 635 echo "ERROR: unknown option $1" 636 echo "Try '$0 --help' for more information" 637 exit 1 638 fi 639} 640has_meson_option() { 641 test "${meson_options#*"$1"}" != "$meson_options" 642} 643 644meson_add_machine_file() { 645 if test "$cross_compile" = "yes"; then 646 meson_option_add --cross-file "$1" 647 else 648 meson_option_add --native-file "$1" 649 fi 650} 651 652for opt do 653 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 654 case "$opt" in 655 --help|-h) show_help=yes 656 ;; 657 --version|-V) exec cat "$source_path/VERSION" 658 ;; 659 --cross-prefix=*) 660 ;; 661 --cc=*) 662 ;; 663 --host-cc=*) host_cc="$optarg" 664 ;; 665 --cxx=*) 666 ;; 667 --objcc=*) 668 ;; 669 --rustc=*) 670 ;; 671 --make=*) 672 ;; 673 --install=*) 674 ;; 675 --python=*) python="$optarg" 676 ;; 677 --skip-meson) skip_meson=yes 678 ;; 679 --ninja=*) ninja="$optarg" 680 ;; 681 --extra-cflags=*) 682 ;; 683 --extra-cxxflags=*) 684 ;; 685 --extra-objcflags=*) 686 ;; 687 --extra-ldflags=*) 688 ;; 689 --cross-cc-*) 690 ;; 691 --cross-prefix-*) 692 ;; 693 --enable-docs) docs=enabled 694 ;; 695 --disable-docs) docs=disabled 696 ;; 697 --cpu=*) 698 ;; 699 --target-list=*) target_list="$optarg" 700 if test "$target_list_exclude"; then 701 error_exit "Can't mix --target-list with --target-list-exclude" 702 fi 703 ;; 704 --target-list-exclude=*) target_list_exclude="$optarg" 705 if test "$target_list"; then 706 error_exit "Can't mix --target-list-exclude with --target-list" 707 fi 708 ;; 709 --with-default-devices) meson_option_add -Ddefault_devices=true 710 ;; 711 --without-default-devices) meson_option_add -Ddefault_devices=false 712 ;; 713 --with-devices-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --with-devices-FOO option" 714 ;; 715 --with-devices-*) device_arch=${opt#--with-devices-}; 716 device_arch=${device_arch%%=*} 717 cf=$source_path/configs/devices/$device_arch-softmmu/$optarg.mak 718 if test -f "$cf"; then 719 device_archs="$device_archs $device_arch" 720 eval "devices_${device_arch}=\$optarg" 721 else 722 error_exit "File $cf does not exist" 723 fi 724 ;; 725 --without-default-features) # processed above 726 ;; 727 --static) static="yes" 728 ;; 729 --host=*|--build=*|\ 730 --disable-dependency-tracking|\ 731 --sbindir=*|--sharedstatedir=*|\ 732 --oldincludedir=*|--datarootdir=*|--infodir=*|\ 733 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 734 # These switches are silently ignored, for compatibility with 735 # autoconf-generated configure scripts. This allows QEMU's 736 # configure to be used by RPM and similar macros that set 737 # lots of directory switches by default. 738 ;; 739 --enable-debug) 740 # Enable debugging options that aren't excessively noisy 741 meson_option_parse --enable-debug-tcg "" 742 meson_option_parse --enable-debug-graph-lock "" 743 meson_option_parse --enable-debug-mutex "" 744 meson_option_add -Doptimization=0 745 default_cflags='-O0 -g' 746 ;; 747 --disable-tcg) tcg="disabled" 748 ;; 749 --enable-tcg) tcg="enabled" 750 ;; 751 --disable-system) system="no" 752 ;; 753 --enable-system) system="yes" 754 ;; 755 --disable-user) 756 linux_user="no" ; 757 bsd_user="no" ; 758 ;; 759 --enable-user) ;; 760 --disable-linux-user) linux_user="no" 761 ;; 762 --enable-linux-user) linux_user="yes" 763 ;; 764 --disable-bsd-user) bsd_user="no" 765 ;; 766 --enable-bsd-user) bsd_user="yes" 767 ;; 768 --enable-pie) pie="yes" 769 ;; 770 --disable-pie) pie="no" 771 ;; 772 --enable-cfi) cfi=true 773 ;; 774 --disable-cfi) cfi=false 775 ;; 776 --disable-download) download="disabled"; git_submodules_action=validate; 777 ;; 778 --enable-download) download="enabled"; git_submodules_action=update; 779 ;; 780 --enable-plugins) plugins="yes" 781 ;; 782 --disable-plugins) plugins="no" 783 ;; 784 --enable-containers) use_containers="yes" 785 ;; 786 --disable-containers) use_containers="no" 787 ;; 788 --container-engine=*) container_engine="$optarg" 789 ;; 790 --rust-target-triple=*) rust_target_triple="$optarg" 791 ;; 792 --gdb=*) gdb_bin="$optarg" 793 ;; 794 --enable-rust) rust=enabled 795 ;; 796 --disable-rust) rust=disabled 797 ;; 798 # everything else has the same name in configure and meson 799 --*) meson_option_parse "$opt" "$optarg" 800 ;; 801 # Pass through -Dxxxx options to meson 802 -D*) meson_option_add "$opt" 803 ;; 804 esac 805done 806 807if ! test -e "$source_path/.git" 808then 809 git_submodules_action="validate" 810fi 811 812if ! test -f "$source_path/subprojects/keycodemapdb/README" \ 813 && test "$download" = disabled 814then 815 echo 816 echo "ERROR: missing subprojects" 817 echo 818 if test -e "$source_path/.git"; then 819 echo "--disable-download specified but subprojects were not" 820 echo 'checked out. Please invoke "meson subprojects download"' 821 echo "before configuring QEMU, or remove --disable-download" 822 echo "from the command line." 823 else 824 echo "This is not a GIT checkout but subproject content appears to" 825 echo "be missing. Do not use 'git archive' or GitHub download links" 826 echo "to acquire QEMU source archives. Non-GIT builds are only" 827 echo "supported with source archives linked from:" 828 echo 829 echo " https://www.qemu.org/download/#source" 830 echo 831 echo "Developers working with GIT can use scripts/archive-source.sh" 832 echo "if they need to create valid source archives." 833 fi 834 echo 835 exit 1 836fi 837 838default_target_list="" 839mak_wilds="" 840 841if [ -n "$host_arch" ] && [ -d "$source_path/common-user/host/$host_arch" ]; then 842 if [ "$linux_user" != no ]; then 843 if [ "$host_os" = linux ]; then 844 linux_user=yes 845 elif [ "$linux_user" = yes ]; then 846 error_exit "linux-user not supported on this architecture" 847 fi 848 if [ "$linux_user" = "yes" ]; then 849 mak_wilds="${mak_wilds} $source_path/configs/targets/*-linux-user.mak" 850 fi 851 fi 852 if [ "$bsd_user" != no ]; then 853 if [ "$bsd_user" = "" ]; then 854 test $host_os = freebsd && bsd_user=yes 855 fi 856 if [ "$bsd_user" = yes ] && ! [ -d "$source_path/bsd-user/$host_os" ]; then 857 error_exit "bsd-user not supported on this host OS" 858 fi 859 if [ "$bsd_user" = "yes" ]; then 860 mak_wilds="${mak_wilds} $source_path/configs/targets/*-bsd-user.mak" 861 fi 862 fi 863else 864 if [ "$linux_user" = yes ] || [ "$bsd_user" = yes ]; then 865 error_exit "user mode emulation not supported on this architecture" 866 fi 867fi 868if [ "$system" = "yes" ]; then 869 mak_wilds="${mak_wilds} $source_path/configs/targets/*-softmmu.mak" 870fi 871 872for config in $mak_wilds; do 873 target="$(basename "$config" .mak)" 874 if echo "$target_list_exclude" | grep -vq "$target"; then 875 default_target_list="${default_target_list} $target" 876 fi 877done 878 879if test x"$show_help" = x"yes" ; then 880cat << EOF 881 882Usage: configure [options] 883Options: [defaults in brackets after descriptions] 884 885Standard options: 886 --help print this message 887 --target-list=LIST set target list (default: build all) 888$(echo Available targets: $default_target_list | \ 889 fold -s -w 53 | sed -e 's/^/ /') 890 --target-list-exclude=LIST exclude a set of targets from the default target-list 891 892Advanced options (experts only): 893 -Dmesonoptname=val passthrough option to meson unmodified 894 --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix] 895 --cc=CC use C compiler CC [$cc] 896 --host-cc=CC when cross compiling, use C compiler CC for code run 897 at build time [$host_cc] 898 --cxx=CXX use C++ compiler CXX [$cxx] 899 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 900 --rustc=RUSTC use Rust compiler RUSTC [$rustc] 901 --extra-cflags=CFLAGS append extra C compiler flags CFLAGS 902 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS 903 --extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS 904 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 905 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases 906 --cross-cc-cflags-ARCH= use compiler flags when building ARCH guest tests 907 --cross-prefix-ARCH=PREFIX cross compiler prefix when building ARCH guest test cases 908 --python=PYTHON use specified python [$python] 909 --ninja=NINJA use specified ninja [$ninja] 910 --static enable static build [$static] 911 --rust-target-triple=TRIPLE compilation target for Rust code [autodetect] 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 --cpu=CPU Build for host CPU [$cpu] 919 --disable-containers don't use containers for cross-building 920 --container-engine=TYPE which container engine to use [$container_engine] 921 --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] 922EOF 923 meson_options_help 924cat << EOF 925 system all system emulation targets 926 user supported user emulation targets 927 linux-user all linux usermode emulation targets 928 bsd-user all BSD usermode emulation targets 929 pie Position Independent Executables 930 931NOTE: The object files are built at the place where configure is launched 932EOF 933exit 0 934fi 935 936# Now that we are sure that the user did not only want to print the --help 937# information, we should double-check that the C compiler really works: 938write_c_skeleton 939if ! compile_object ; then 940 error_exit "C compiler \"$cc\" either does not exist or does not work." 941fi 942 943# Remove old dependency files to make sure that they get properly regenerated 944rm -f ./*/config-devices.mak.d 945 946if test -z "$python" 947then 948 # If first_python is set, there was a binary somewhere even though 949 # it was not suitable. Use it for the error message. 950 if test -n "$first_python"; then 951 error_exit "Cannot use '$first_python', Python >= 3.8 is required." \ 952 "Use --python=/path/to/python to specify a supported Python." 953 else 954 error_exit "Python not found. Use --python=/path/to/python" 955 fi 956fi 957 958if ! check_py_version "$python"; then 959 error_exit "Cannot use '$python', Python >= 3.8 is required." \ 960 "Use --python=/path/to/python to specify a supported Python." \ 961 "Maybe try:" \ 962 " openSUSE Leap 15.3+: zypper install python39" \ 963 " CentOS 8: dnf install python38" 964fi 965 966# Resolve PATH 967python="$(command -v "$python")" 968 969# Create a Python virtual environment using our configured python. 970# The stdout of this script will be the location of a symlink that 971# points to the configured Python. 972# Entry point scripts for pip, meson, and sphinx are generated if those 973# packages are present. 974 975# Defaults assumed for now: 976# - venv is cleared if it exists already; 977# - venv is allowed to use system packages; 978# - all setup can be performed offline; 979# - missing packages may be fetched from PyPI, 980# unless --disable-download is passed. 981# - pip is not installed into the venv when possible, 982# but ensurepip is called as a fallback when necessary. 983 984echo "python determined to be '$python'" 985echo "python version: $($python --version)" 986 987python="$($python -B "${source_path}/python/scripts/mkvenv.py" create pyvenv)" 988if test "$?" -ne 0 ; then 989 error_exit "python venv creation failed" 990fi 991 992# Suppress writing compiled files 993python="$python -B" 994mkvenv="$python ${source_path}/python/scripts/mkvenv.py" 995 996# Finish preparing the virtual environment using vendored .whl files 997 998$mkvenv ensuregroup --dir "${source_path}/python/wheels" \ 999 ${source_path}/pythondeps.toml meson || exit 1 1000 1001# At this point, we expect Meson to be installed and available. 1002# We expect mkvenv or pip to have created pyvenv/bin/meson for us. 1003# We ignore PATH completely here: we want to use the venv's Meson 1004# *exclusively*. 1005 1006meson="$(cd pyvenv/bin; pwd)/meson" 1007 1008# Conditionally ensure Sphinx is installed. 1009 1010mkvenv_online_flag="" 1011if test "$download" = "enabled" ; then 1012 mkvenv_online_flag=" --online" 1013fi 1014 1015if test "$docs" != "disabled" ; then 1016 if ! $mkvenv ensuregroup \ 1017 $(test "$docs" = "enabled" && echo "$mkvenv_online_flag") \ 1018 ${source_path}/pythondeps.toml docs; 1019 then 1020 if test "$docs" = "enabled" ; then 1021 exit 1 1022 fi 1023 echo "Sphinx not found/usable, disabling docs." 1024 docs=disabled 1025 else 1026 docs=enabled 1027 fi 1028fi 1029 1030# Probe for ninja 1031 1032if test -z "$ninja"; then 1033 for c in ninja ninja-build samu; do 1034 if has $c; then 1035 ninja=$(command -v "$c") 1036 break 1037 fi 1038 done 1039 if test -z "$ninja"; then 1040 error_exit "Cannot find Ninja" 1041 fi 1042fi 1043 1044if test "$host_os" = "bogus"; then 1045 # Now that we know that we're not printing the help and that 1046 # the compiler works (so the results of the check_defines we used 1047 # to identify the OS are reliable), if we didn't recognize the 1048 # host OS we should stop now. 1049 error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 1050fi 1051 1052# test for any invalid configuration combinations 1053if test "$host_os" = "windows" && ! has "$dlltool"; then 1054 if test "$plugins" = "yes"; then 1055 error_exit "TCG plugins requires dlltool to build on Windows platforms" 1056 fi 1057 plugins="no" 1058fi 1059if test "$tcg" = "disabled" ; then 1060 if test "$plugins" = "yes"; then 1061 error_exit "Can't enable plugins on non-TCG builds" 1062 fi 1063 plugins="no" 1064fi 1065if test "$static" = "yes" ; then 1066 if test "$plugins" = "yes"; then 1067 error_exit "static and plugins are mutually incompatible" 1068 fi 1069 plugins="no" 1070fi 1071if test "$plugins" != "no" && test $host_bits -eq 64; then 1072 if has_meson_option "-Dtcg_interpreter=true"; then 1073 plugins="no" 1074 else 1075 plugins=yes 1076 subdirs="$subdirs contrib/plugins" 1077 fi 1078fi 1079 1080cat > $TMPC << EOF 1081 1082#ifdef __linux__ 1083# define THREAD __thread 1084#else 1085# define THREAD 1086#endif 1087static THREAD int tls_var; 1088int main(void) { return tls_var; } 1089EOF 1090 1091if test "$host_os" = windows || test "$host_os" = haiku; then 1092 if test "$pie" = "yes"; then 1093 error_exit "PIE not available due to missing OS support" 1094 fi 1095 pie=no 1096fi 1097 1098if test "$pie" != "no"; then 1099 if test "$static" = "yes"; then 1100 pie_ldflags=-static-pie 1101 else 1102 pie_ldflags=-pie 1103 fi 1104 if compile_prog "-Werror -fPIE -DPIE" "$pie_ldflags"; then 1105 pie="yes" 1106 elif test "$pie" = "yes"; then 1107 error_exit "-static-pie not available due to missing toolchain support" 1108 else 1109 echo "Disabling PIE due to missing toolchain support" 1110 pie="no" 1111 fi 1112fi 1113 1114########################################## 1115 1116if test -z "${target_list+xxx}" ; then 1117 default_targets=yes 1118 for target in $default_target_list; do 1119 target_list="$target_list $target" 1120 done 1121 target_list="${target_list# }" 1122else 1123 default_targets=no 1124 target_list=$(echo "$target_list" | sed -e 's/,/ /g') 1125 for target in $target_list; do 1126 # Check that we recognised the target name; this allows a more 1127 # friendly error message than if we let it fall through. 1128 case " $default_target_list " in 1129 *" $target "*) 1130 ;; 1131 *) 1132 error_exit "Unknown target name '$target'" 1133 ;; 1134 esac 1135 done 1136fi 1137 1138if test "$tcg" = "auto"; then 1139 if test -z "$target_list"; then 1140 tcg="disabled" 1141 else 1142 tcg="enabled" 1143 fi 1144fi 1145 1146######################################### 1147# gdb test 1148 1149if test -n "$gdb_bin"; then 1150 gdb_version_string=$($gdb_bin --version | head -n 1) 1151 # Extract last field in the version string 1152 gdb_version=${gdb_version_string##* } 1153 if version_ge $gdb_version 9.1; then 1154 gdb_arches=$($python "$source_path/scripts/probe-gdb-support.py" $gdb_bin) 1155 else 1156 gdb_bin="" 1157 fi 1158fi 1159 1160########################################## 1161# big/little endian test 1162cat > $TMPC << EOF 1163#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 1164# error LITTLE 1165#endif 1166int main(void) { return 0; } 1167EOF 1168 1169if ! compile_prog ; then 1170 bigendian="no" 1171else 1172 cat > $TMPC << EOF 1173#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 1174# error BIG 1175#endif 1176int main(void) { return 0; } 1177EOF 1178 1179 if ! compile_prog ; then 1180 bigendian="yes" 1181 else 1182 echo big/little test failed 1183 exit 1 1184 fi 1185fi 1186 1187########################################## 1188# detect rust triple 1189 1190if test "$rust" != disabled && has "$rustc" && $rustc -vV > "${TMPDIR1}/${TMPB}.out"; then 1191 rust_host_triple=$(sed -n 's/^host: //p' "${TMPDIR1}/${TMPB}.out") 1192else 1193 if test "$rust" = enabled; then 1194 error_exit "could not execute rustc binary \"$rustc\"" 1195 fi 1196 rust=disabled 1197fi 1198if test "$rust" != disabled && test -z "$rust_target_triple"; then 1199 # arch and os generally matches between meson and rust 1200 rust_arch=$host_arch 1201 rust_os=$host_os 1202 rust_machine=unknown 1203 rust_osvariant= 1204 1205 # tweak rust_os if needed; also, machine and variant depend on the OS 1206 android=no 1207 case "$host_os" in 1208 darwin) 1209 # e.g. aarch64-apple-darwin 1210 rust_machine=apple 1211 ;; 1212 1213 linux) 1214 # detect android/glibc/musl 1215 if check_define __ANDROID__; then 1216 rust_osvariant=android 1217 android=yes 1218 else 1219 cat > $TMPC << EOF 1220#define _GNU_SOURCE 1221#include <features.h> 1222#ifndef __USE_GNU 1223error using musl 1224#endif 1225EOF 1226 if compile_object; then 1227 rust_osvariant=gnu 1228 else 1229 rust_osvariant=musl 1230 fi 1231 fi 1232 1233 case "$host_arch" in 1234 arm) 1235 # e.g. arm-unknown-linux-gnueabi, arm-unknown-linux-gnueabihf 1236 write_c_skeleton 1237 compile_object 1238 if $READELF -A $TMPO | grep Tag_API_VFP_args: > /dev/null; then 1239 rust_osvariant=${rust_osvariant}eabihf 1240 else 1241 rust_osvariant=${rust_osvariant}eabi 1242 fi 1243 ;; 1244 1245 mips64) 1246 # e.g. mips64-unknown-linux-gnuabi64 1247 rust_osvariant=${rust_osvariant}abi64 1248 ;; 1249 esac 1250 ;; 1251 1252 netbsd) 1253 # e.g. arm-unknown-netbsd-eabihf 1254 test "$host_arch" = arm && rust_osvariant=eabihf 1255 ;; 1256 1257 sunos) 1258 rust_machine=pc 1259 rust_os=solaris 1260 ;; 1261 1262 windows) 1263 # e.g. aarch64-pc-windows-gnullvm, x86_64-pc-windows-gnu (MSVC not supported) 1264 rust_machine=pc 1265 if test "$host_arch" = aarch64; then 1266 rust_osvariant=gnullvm 1267 else 1268 rust_osvariant=gnu 1269 fi 1270 ;; 1271 esac 1272 1273 # now tweak the architecture part, possibly based on pre-canonicalization --cpu 1274 case "$host_arch" in 1275 arm) 1276 # preserve ISA version (armv7 etc.) from $raw_cpu if passed via --cpu 1277 rust_arch=$raw_cpu 1278 test "$rust_arch" = arm && test "$rust_os" != linux && rust_arch=armv7 1279 ;; 1280 1281 mips|mips64) 1282 # preserve ISA version (mipsisa64r6 etc.) and include endianness 1283 rust_arch=${raw_cpu%el} 1284 test "$bigendian" = no && rust_arch=${rust_arch}el 1285 ;; 1286 1287 riscv32|riscv64) 1288 # e.g. riscv64gc-unknown-linux-gnu, but riscv64-linux-android 1289 test "$android" = no && rust_arch=${rust_arch}gc 1290 ;; 1291 1292 sparc64) 1293 if test "$rust_os" = solaris; then 1294 rust_arch=sparcv9 1295 rust_machine=sun 1296 fi 1297 ;; 1298 1299 x86_64) 1300 # e.g. x86_64-unknown-linux-gnux32 1301 test "$raw_cpu" = x32 && rust_osvariant=${rust_osvariant}x32 1302 ;; 1303 esac 1304 1305 if test "$android" = yes; then 1306 # e.g. aarch64-linux-android 1307 rust_target_triple=$rust_arch-$rust_os-$rust_osvariant 1308 else 1309 rust_target_triple=$rust_arch-$rust_machine-$rust_os${rust_osvariant:+-$rust_osvariant} 1310 fi 1311fi 1312 1313########################################## 1314# functions to probe cross compilers 1315 1316container="no" 1317runc="" 1318if test $use_containers = "yes" && (has "docker" || has "podman"); then 1319 case $($python "$source_path"/tests/docker/docker.py --engine "$container_engine" probe) in 1320 *docker) container=docker ;; 1321 podman) container=podman ;; 1322 no) container=no ;; 1323 esac 1324 if test "$container" != "no"; then 1325 docker_py="$python $source_path/tests/docker/docker.py --engine $container" 1326 runc=$container 1327 fi 1328fi 1329 1330# cross compilers defaults, can be overridden with --cross-cc-ARCH 1331: ${cross_prefix_aarch64="aarch64-linux-gnu-"} 1332: ${cross_prefix_aarch64_be="$cross_prefix_aarch64"} 1333: ${cross_prefix_alpha="alpha-linux-gnu-"} 1334: ${cross_prefix_arm="arm-linux-gnueabihf-"} 1335: ${cross_prefix_armeb="$cross_prefix_arm"} 1336: ${cross_prefix_hexagon="hexagon-unknown-linux-musl-"} 1337: ${cross_prefix_loongarch64="loongarch64-unknown-linux-gnu-"} 1338: ${cross_prefix_hppa="hppa-linux-gnu-"} 1339: ${cross_prefix_i386="i686-linux-gnu-"} 1340: ${cross_prefix_m68k="m68k-linux-gnu-"} 1341: ${cross_prefix_microblaze="microblaze-linux-musl-"} 1342: ${cross_prefix_mips64el="mips64el-linux-gnuabi64-"} 1343: ${cross_prefix_mips64="mips64-linux-gnuabi64-"} 1344: ${cross_prefix_mipsel="mipsel-linux-gnu-"} 1345: ${cross_prefix_mips="mips-linux-gnu-"} 1346: ${cross_prefix_ppc="powerpc-linux-gnu-"} 1347: ${cross_prefix_ppc64="powerpc64-linux-gnu-"} 1348: ${cross_prefix_ppc64le="$cross_prefix_ppc64"} 1349: ${cross_prefix_riscv64="riscv64-linux-gnu-"} 1350: ${cross_prefix_s390x="s390x-linux-gnu-"} 1351: ${cross_prefix_sh4="sh4-linux-gnu-"} 1352: ${cross_prefix_sparc64="sparc64-linux-gnu-"} 1353: ${cross_prefix_sparc="$cross_prefix_sparc64"} 1354: ${cross_prefix_tricore="tricore-"} 1355: ${cross_prefix_x86_64="x86_64-linux-gnu-"} 1356 1357: ${cross_cc_aarch64_be="$cross_cc_aarch64"} 1358: ${cross_cc_cflags_aarch64_be="-mbig-endian"} 1359: ${cross_cc_armeb="$cross_cc_arm"} 1360: ${cross_cc_cflags_armeb="-mbig-endian"} 1361: ${cross_cc_hexagon="hexagon-unknown-linux-musl-clang"} 1362: ${cross_cc_cflags_hexagon="-mv73 -O2 -static"} 1363: ${cross_cc_cflags_i386="-m32"} 1364: ${cross_cc_cflags_ppc="-m32 -mbig-endian"} 1365: ${cross_cc_cflags_ppc64="-m64 -mbig-endian"} 1366: ${cross_cc_ppc64le="$cross_cc_ppc64"} 1367: ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"} 1368: ${cross_cc_cflags_sparc64="-m64 -mcpu=ultrasparc"} 1369: ${cross_cc_sparc="$cross_cc_sparc64"} 1370: ${cross_cc_cflags_sparc="-m32 -mcpu=supersparc"} 1371: ${cross_cc_cflags_x86_64="-m64 -mcx16"} 1372 1373compute_target_variable() { 1374 eval "$2=" 1375 if eval test -n "\"\${cross_prefix_$1}\""; then 1376 if eval has "\"\${cross_prefix_$1}\$3\""; then 1377 eval "$2=\"\${cross_prefix_$1}\$3\"" 1378 fi 1379 fi 1380} 1381 1382have_target() { 1383 for i; do 1384 case " $target_list " in 1385 *" $i "*) return 0;; 1386 *) ;; 1387 esac 1388 done 1389 return 1 1390} 1391 1392# probe_target_compiler TARGET 1393# 1394# Look for a compiler for the given target, either native or cross. 1395# Set variables target_* if a compiler is found, and container_cross_* 1396# if a Docker-based cross-compiler image is known for the target. 1397# Set got_cross_cc to yes/no depending on whether a non-container-based 1398# compiler was found. 1399# 1400# If TARGET is a user-mode emulation target, also set build_static to 1401# "y" if static linking is possible. 1402# 1403probe_target_compiler() { 1404 # reset all output variables 1405 got_cross_cc=no 1406 container_image= 1407 container_hosts= 1408 container_cross_prefix= 1409 container_cross_cc= 1410 container_cross_ar= 1411 container_cross_as= 1412 container_cross_ld= 1413 container_cross_nm= 1414 container_cross_objcopy= 1415 container_cross_ranlib= 1416 container_cross_strip= 1417 1418 target_arch=${1%%-*} 1419 case $target_arch in 1420 aarch64) container_hosts="x86_64 aarch64" ;; 1421 aarch64_be) container_hosts="x86_64 aarch64" ;; 1422 alpha) container_hosts=x86_64 ;; 1423 arm) container_hosts="x86_64 aarch64" ;; 1424 hexagon) container_hosts=x86_64 ;; 1425 hppa) container_hosts=x86_64 ;; 1426 i386) container_hosts=x86_64 ;; 1427 loongarch64) container_hosts=x86_64 ;; 1428 m68k) container_hosts=x86_64 ;; 1429 microblaze) container_hosts=x86_64 ;; 1430 mips64el) container_hosts=x86_64 ;; 1431 mips64) container_hosts=x86_64 ;; 1432 mipsel) container_hosts=x86_64 ;; 1433 mips) container_hosts=x86_64 ;; 1434 ppc) container_hosts=x86_64 ;; 1435 ppc64|ppc64le) container_hosts=x86_64 ;; 1436 riscv64) container_hosts=x86_64 ;; 1437 s390x) container_hosts=x86_64 ;; 1438 sh4) container_hosts=x86_64 ;; 1439 sparc64) container_hosts=x86_64 ;; 1440 tricore) container_hosts=x86_64 ;; 1441 x86_64) container_hosts="aarch64 ppc64le x86_64" ;; 1442 xtensa*) container_hosts=x86_64 ;; 1443 esac 1444 1445 for host in $container_hosts; do 1446 test "$container" != no || continue 1447 test "$host" = "$cpu" || continue 1448 case $target_arch in 1449 # debian-all-test-cross architectures 1450 1451 aarch64_be) 1452 container_image=debian-all-test-cross 1453 container_cross_prefix=aarch64-linux-gnu- 1454 ;; 1455 hppa|m68k|mips|riscv64|sparc64) 1456 container_image=debian-all-test-cross 1457 ;; 1458 mips64) 1459 container_image=debian-all-test-cross 1460 container_cross_prefix=mips64-linux-gnuabi64- 1461 ;; 1462 ppc|ppc64|ppc64le) 1463 container_image=debian-all-test-cross 1464 container_cross_prefix=powerpc${target_arch#ppc}-linux-gnu- 1465 ;; 1466 1467 # debian-legacy-test-cross architectures (need Debian 11) 1468 # - libc6.1-dev-alpha-cross: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1054412 1469 # - sh4-linux-user: binaries don't run with bookworm compiler 1470 1471 alpha|sh4) 1472 container_image=debian-legacy-test-cross 1473 ;; 1474 1475 # architectures with individual containers 1476 1477 aarch64) 1478 # We don't have any bigendian build tools so we only use this for AArch64 1479 container_image=debian-arm64-cross 1480 ;; 1481 arm) 1482 # We don't have any bigendian build tools so we only use this for ARM 1483 container_image=debian-armhf-cross 1484 container_cross_prefix=arm-linux-gnueabihf- 1485 ;; 1486 hexagon) 1487 container_cross_prefix=hexagon-unknown-linux-musl- 1488 container_cross_cc=${container_cross_prefix}clang 1489 ;; 1490 i386) 1491 container_image=debian-i686-cross 1492 container_cross_prefix=i686-linux-gnu- 1493 ;; 1494 loongarch64) 1495 container_image=debian-loongarch-cross 1496 container_cross_prefix=loongarch64-unknown-linux-gnu- 1497 ;; 1498 microblaze) 1499 container_cross_prefix=microblaze-linux-musl- 1500 ;; 1501 mips64el) 1502 container_image=debian-all-test-cross 1503 container_cross_prefix=mips64el-linux-gnuabi64- 1504 ;; 1505 tricore) 1506 container_image=debian-tricore-cross 1507 container_cross_prefix=tricore- 1508 ;; 1509 x86_64) 1510 container_image=debian-amd64-cross 1511 ;; 1512 xtensa*) 1513 container_image=debian-xtensa-cross 1514 1515 # default to the dc232b cpu 1516 container_cross_prefix=/opt/2020.07/xtensa-dc232b-elf/bin/xtensa-dc232b-elf- 1517 ;; 1518 esac 1519 # Debian and GNU architecture names usually match 1520 : ${container_image:=debian-$target_arch-cross} 1521 : ${container_cross_prefix:=$target_arch-linux-gnu-} 1522 : ${container_cross_cc:=${container_cross_prefix}gcc} 1523 : ${container_cross_ar:=${container_cross_prefix}ar} 1524 : ${container_cross_as:=${container_cross_prefix}as} 1525 : ${container_cross_ld:=${container_cross_prefix}ld} 1526 : ${container_cross_nm:=${container_cross_prefix}nm} 1527 : ${container_cross_objcopy:=${container_cross_prefix}objcopy} 1528 : ${container_cross_ranlib:=${container_cross_prefix}ranlib} 1529 : ${container_cross_strip:=${container_cross_prefix}strip} 1530 done 1531 1532 try=cross 1533 # For softmmu/roms also look for a bi-endian or multilib-enabled host compiler 1534 if [ "${1%softmmu}" != "$1" ] || test "$target_arch" = "$cpu"; then 1535 case "$target_arch:$cpu" in 1536 aarch64_be:aarch64 | \ 1537 armeb:arm | \ 1538 i386:x86_64 | \ 1539 mips*:mips64 | \ 1540 ppc*:ppc64 | \ 1541 sparc:sparc64 | \ 1542 "$cpu:$cpu") 1543 try='native cross' ;; 1544 esac 1545 fi 1546 eval "target_cflags=\${cross_cc_cflags_$target_arch}" 1547 for thistry in $try; do 1548 case $thistry in 1549 native) 1550 target_cc=$cc 1551 target_ccas=$ccas 1552 target_ar=$ar 1553 target_as=$as 1554 target_ld=$ld 1555 target_nm=$nm 1556 target_objcopy=$objcopy 1557 target_ranlib=$ranlib 1558 target_strip=$strip 1559 ;; 1560 cross) 1561 target_cc= 1562 if eval test -n "\"\${cross_cc_$target_arch}\""; then 1563 if eval has "\"\${cross_cc_$target_arch}\""; then 1564 eval "target_cc=\"\${cross_cc_$target_arch}\"" 1565 fi 1566 else 1567 compute_target_variable $target_arch target_cc gcc 1568 fi 1569 target_ccas=$target_cc 1570 compute_target_variable $target_arch target_ar ar 1571 compute_target_variable $target_arch target_as as 1572 compute_target_variable $target_arch target_ld ld 1573 compute_target_variable $target_arch target_nm nm 1574 compute_target_variable $target_arch target_objcopy objcopy 1575 compute_target_variable $target_arch target_ranlib ranlib 1576 compute_target_variable $target_arch target_strip strip 1577 ;; 1578 esac 1579 1580 if test -n "$target_cc"; then 1581 case $target_arch in 1582 i386|x86_64) 1583 if $target_cc --version | grep -qi "clang"; then 1584 continue 1585 fi 1586 ;; 1587 esac 1588 elif test -n "$target_as" && test -n "$target_ld"; then 1589 # Special handling for assembler only targets 1590 case $target in 1591 tricore-softmmu) 1592 build_static= 1593 got_cross_cc=yes 1594 break 1595 ;; 1596 *) 1597 continue 1598 ;; 1599 esac 1600 else 1601 continue 1602 fi 1603 1604 write_c_skeleton 1605 case $1 in 1606 *-softmmu) 1607 if do_compiler "$target_cc" $target_cflags -o $TMPO -c $TMPC && 1608 do_compiler "$target_cc" $target_cflags -r -nostdlib -o "${TMPDIR1}/${TMPB}2.o" "$TMPO" -lgcc; then 1609 got_cross_cc=yes 1610 break 1611 fi 1612 ;; 1613 *) 1614 if do_compiler "$target_cc" $target_cflags -o $TMPE $TMPC -static ; then 1615 build_static=y 1616 got_cross_cc=yes 1617 break 1618 fi 1619 if do_compiler "$target_cc" $target_cflags -o $TMPE $TMPC ; then 1620 build_static= 1621 got_cross_cc=yes 1622 break 1623 fi 1624 ;; 1625 esac 1626 done 1627 if test $got_cross_cc != yes; then 1628 build_static= 1629 target_cc= 1630 target_ccas= 1631 target_ar= 1632 target_as= 1633 target_ld= 1634 target_nm= 1635 target_objcopy= 1636 target_ranlib= 1637 target_strip= 1638 fi 1639 test -n "$target_cc" 1640} 1641 1642write_target_makefile() { 1643 echo "EXTRA_CFLAGS=$target_cflags" 1644 if test -z "$target_cc" && test -z "$target_as"; then 1645 test -z "$container_image" && error_exit "Internal error: could not find cross compiler for $1?" 1646 echo "$1: docker-image-$container_image" >> Makefile.prereqs 1647 if test -n "$container_cross_cc"; then 1648 echo "CC=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --" 1649 echo "CCAS=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --" 1650 fi 1651 echo "AR=$docker_py cc --cc $container_cross_ar -i qemu/$container_image -s $source_path --" 1652 echo "AS=$docker_py cc --cc $container_cross_as -i qemu/$container_image -s $source_path --" 1653 echo "LD=$docker_py cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --" 1654 echo "NM=$docker_py cc --cc $container_cross_nm -i qemu/$container_image -s $source_path --" 1655 echo "OBJCOPY=$docker_py cc --cc $container_cross_objcopy -i qemu/$container_image -s $source_path --" 1656 echo "RANLIB=$docker_py cc --cc $container_cross_ranlib -i qemu/$container_image -s $source_path --" 1657 echo "STRIP=$docker_py cc --cc $container_cross_strip -i qemu/$container_image -s $source_path --" 1658 else 1659 if test -n "$target_cc"; then 1660 echo "CC=$target_cc" 1661 echo "CCAS=$target_ccas" 1662 fi 1663 if test -n "$target_ar"; then 1664 echo "AR=$target_ar" 1665 fi 1666 if test -n "$target_as"; then 1667 echo "AS=$target_as" 1668 fi 1669 if test -n "$target_ld"; then 1670 echo "LD=$target_ld" 1671 fi 1672 if test -n "$target_nm"; then 1673 echo "NM=$target_nm" 1674 fi 1675 if test -n "$target_objcopy"; then 1676 echo "OBJCOPY=$target_objcopy" 1677 fi 1678 if test -n "$target_ranlib"; then 1679 echo "RANLIB=$target_ranlib" 1680 fi 1681 if test -n "$target_strip"; then 1682 echo "STRIP=$target_strip" 1683 fi 1684 fi 1685} 1686 1687####################################### 1688# cross-compiled firmware targets 1689 1690# Set up build tree symlinks that point back into the source tree 1691# (these can be both files and directories). 1692# Caution: avoid adding files or directories here using wildcards. This 1693# will result in problems later if a new file matching the wildcard is 1694# added to the source tree -- nothing will cause configure to be rerun 1695# so the build tree will be missing the link back to the new file, and 1696# tests might fail. Prefer to keep the relevant files in their own 1697# directory and symlink the directory instead. 1698LINKS="Makefile" 1699LINKS="$LINKS docs/config" 1700LINKS="$LINKS pc-bios/optionrom/Makefile" 1701LINKS="$LINKS pc-bios/s390-ccw/Makefile" 1702LINKS="$LINKS pc-bios/vof/Makefile" 1703LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit 1704LINKS="$LINKS tests/avocado tests/data" 1705LINKS="$LINKS tests/qemu-iotests/check tests/qemu-iotests/Makefile" 1706LINKS="$LINKS python" 1707LINKS="$LINKS contrib/plugins/Makefile " 1708for f in $LINKS ; do 1709 if [ -e "$source_path/$f" ]; then 1710 symlink "$source_path/$f" "$f" 1711 fi 1712done 1713 1714# use included Linux headers for KVM architectures 1715if test "$host_os" = "linux" && test -n "$linux_arch"; then 1716 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 1717fi 1718 1719echo "# Automatically generated by configure - do not modify" > Makefile.prereqs 1720 1721# Mac OS X ships with a broken assembler 1722if have_target i386-softmmu x86_64-softmmu && \ 1723 test "$host_os" != "darwin" && test "$host_os" != "sunos" && \ 1724 test "$host_os" != "haiku" && \ 1725 probe_target_compiler i386-softmmu; then 1726 subdirs="$subdirs pc-bios/optionrom" 1727 config_mak=pc-bios/optionrom/config.mak 1728 echo "# Automatically generated by configure - do not modify" > $config_mak 1729 echo "TOPSRC_DIR=$source_path" >> $config_mak 1730 write_target_makefile >> $config_mak 1731fi 1732 1733if have_target ppc-softmmu ppc64-softmmu && \ 1734 probe_target_compiler ppc-softmmu; then 1735 subdirs="$subdirs pc-bios/vof" 1736 config_mak=pc-bios/vof/config.mak 1737 echo "# Automatically generated by configure - do not modify" > $config_mak 1738 echo "SRC_DIR=$source_path/pc-bios/vof" >> $config_mak 1739 write_target_makefile >> $config_mak 1740fi 1741 1742# Only build s390-ccw bios if the compiler has -march=z900 or -march=z10 1743# (which is the lowest architecture level that Clang supports) 1744if have_target s390x-softmmu && probe_target_compiler s390x-softmmu && \ 1745 GIT=git "$source_path/scripts/git-submodule.sh" "$git_submodules_action" roms/SLOF >> config.log 2>&1; then 1746 write_c_skeleton 1747 do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC 1748 has_z900=$? 1749 if [ $has_z900 = 0 ] || do_compiler "$target_cc" $target_cc_cflags -march=z10 -msoft-float -Werror -o $TMPO -c $TMPC; then 1750 if [ $has_z900 != 0 ]; then 1751 echo "WARNING: Your compiler does not support the z900!" 1752 echo " The s390-ccw bios will only work with guest CPUs >= z10." 1753 fi 1754 subdirs="$subdirs pc-bios/s390-ccw" 1755 config_mak=pc-bios/s390-ccw/config-host.mak 1756 echo "# Automatically generated by configure - do not modify" > $config_mak 1757 echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak 1758 echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_mak 1759 write_target_makefile >> $config_mak 1760 fi 1761fi 1762 1763####################################### 1764# generate config-host.mak 1765 1766config_host_mak="config-host.mak" 1767 1768echo "# Automatically generated by configure - do not modify" > $config_host_mak 1769echo >> $config_host_mak 1770 1771echo all: >> $config_host_mak 1772 1773echo "SRC_PATH=$source_path" >> $config_host_mak 1774echo "TARGET_DIRS=$target_list" >> $config_host_mak 1775echo "GDB=$gdb_bin" >> $config_host_mak 1776if test "$container" != no; then 1777 echo "RUNC=$runc" >> $config_host_mak 1778fi 1779echo "SUBDIRS=$subdirs" >> $config_host_mak 1780if test "$rust" != disabled; then 1781 echo "RUST_TARGET_TRIPLE=$rust_target_triple" >> $config_host_mak 1782fi 1783echo "PYTHON=$python" >> $config_host_mak 1784echo "MKVENV_ENSUREGROUP=$mkvenv ensuregroup $mkvenv_online_flag" >> $config_host_mak 1785echo "GENISOIMAGE=$genisoimage" >> $config_host_mak 1786echo "MESON=$meson" >> $config_host_mak 1787echo "NINJA=$ninja" >> $config_host_mak 1788echo "EXESUF=$EXESUF" >> $config_host_mak 1789if test "$default_targets" = "yes"; then 1790 echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak 1791fi 1792 1793# contrib/plugins configuration 1794echo "# Automatically generated by configure - do not modify" > contrib/plugins/$config_host_mak 1795echo "SRC_PATH=$source_path/contrib/plugins" >> contrib/plugins/$config_host_mak 1796echo "PKG_CONFIG=${pkg_config}" >> contrib/plugins/$config_host_mak 1797echo "CC=$cc $CPU_CFLAGS" >> contrib/plugins/$config_host_mak 1798echo "CFLAGS=${CFLAGS-$default_cflags} $EXTRA_CFLAGS" >> contrib/plugins/$config_host_mak 1799if test "$host_os" = windows; then 1800 echo "DLLTOOL=$dlltool" >> contrib/plugins/$config_host_mak 1801fi 1802if test "$host_os" = darwin; then 1803 echo "CONFIG_DARWIN=y" >> contrib/plugins/$config_host_mak 1804fi 1805if test "$host_os" = windows; then 1806 echo "CONFIG_WIN32=y" >> contrib/plugins/$config_host_mak 1807fi 1808 1809# tests/tcg configuration 1810mkdir -p tests/tcg 1811echo "# Automatically generated by configure - do not modify" > tests/tcg/$config_host_mak 1812echo "SRC_PATH=$source_path" >> tests/tcg/$config_host_mak 1813if test "$plugins" = "yes" ; then 1814 echo "CONFIG_PLUGIN=y" >> tests/tcg/$config_host_mak 1815fi 1816 1817tcg_tests_targets= 1818for target in $target_list; do 1819 arch=${target%%-*} 1820 1821 case $target in 1822 xtensa*-linux-user) 1823 # the toolchain is not complete with headers, only build system tests 1824 continue 1825 ;; 1826 *-softmmu) 1827 test -f "$source_path/tests/tcg/$arch/Makefile.softmmu-target" || continue 1828 qemu="qemu-system-$arch" 1829 ;; 1830 *-linux-user|*-bsd-user) 1831 qemu="qemu-$arch" 1832 ;; 1833 esac 1834 1835 if probe_target_compiler $target || test -n "$container_image"; then 1836 test -n "$container_image" && build_static=y 1837 mkdir -p "tests/tcg/$target" 1838 config_target_mak=tests/tcg/$target/config-target.mak 1839 ln -sf "$source_path/tests/tcg/Makefile.target" "tests/tcg/$target/Makefile" 1840 echo "# Automatically generated by configure - do not modify" > "$config_target_mak" 1841 echo "TARGET_NAME=$arch" >> "$config_target_mak" 1842 echo "TARGET=$target" >> "$config_target_mak" 1843 write_target_makefile "build-tcg-tests-$target" >> "$config_target_mak" 1844 echo "BUILD_STATIC=$build_static" >> "$config_target_mak" 1845 echo "QEMU=$PWD/$qemu" >> "$config_target_mak" 1846 1847 # will GDB work with these binaries? 1848 if test "${gdb_arches#*$arch}" != "$gdb_arches"; then 1849 echo "GDB=$gdb_bin" >> $config_target_mak 1850 fi 1851 1852 if test "${gdb_arches#*aarch64}" != "$gdb_arches" && version_ge $gdb_version 15.1; then 1853 echo "GDB_HAS_MTE=y" >> $config_target_mak 1854 fi 1855 1856 if test "${gdb_arches#*aarch64}" != "$gdb_arches" && version_ge $gdb_version 16.0; then 1857 # GDB has to support MTE in baremetal to allow debugging MTE in QEMU system mode 1858 echo "GDB_SUPPORTS_MTE_IN_BAREMETAL=y" >> $config_target_mak 1859 fi 1860 1861 echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs 1862 tcg_tests_targets="$tcg_tests_targets $target" 1863 fi 1864done 1865 1866if test "$tcg" = "enabled"; then 1867 echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> $config_host_mak 1868fi 1869 1870if test "$skip_meson" = no; then 1871 cross="config-meson.cross.new" 1872 meson_quote() { 1873 test $# = 0 && return 1874 echo "'$(echo $* | sed "s/ /','/g")'" 1875 } 1876 1877 echo "# Automatically generated by configure - do not modify" > $cross 1878 echo "[properties]" >> $cross 1879 1880 # unroll any custom device configs 1881 for a in $device_archs; do 1882 eval "c=\$devices_${a}" 1883 echo "${a}-softmmu = '$c'" >> $cross 1884 done 1885 1886 echo "[built-in options]" >> $cross 1887 echo "c_args = [$(meson_quote $CFLAGS $EXTRA_CFLAGS)]" >> $cross 1888 echo "cpp_args = [$(meson_quote $CXXFLAGS $EXTRA_CXXFLAGS)]" >> $cross 1889 test -n "$objcc" && echo "objc_args = [$(meson_quote $OBJCFLAGS $EXTRA_OBJCFLAGS)]" >> $cross 1890 echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross 1891 echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross 1892 1893 # Only enable by default for git builds and on select OSes 1894 echo "# environment defaults, can still be overridden on " >> $cross 1895 echo "# the command line" >> $cross 1896 if test -e "$source_path/.git" && \ 1897 { test "$host_os" = linux || test "$host_os" = "windows"; }; then 1898 echo 'werror = true' >> $cross 1899 fi 1900 echo "[project options]" >> $cross 1901 if test "$SMBD" != ''; then 1902 echo "smbd = $(meson_quote "$SMBD")" >> $cross 1903 fi 1904 if test "${QEMU_GA_MANUFACTURER}" != ''; then 1905 echo "qemu_ga_manufacturer = $(meson_quote "${QEMU_GA_MANUFACTURER}")" >> $cross 1906 fi 1907 if test "${QEMU_GA_DISTRO}" != ''; then 1908 echo "qemu_ga_distro = $(meson_quote "${QEMU_GA_DISTRO}")" >> $cross 1909 fi 1910 if test "${QEMU_GA_VERSION}" != ''; then 1911 echo "qemu_ga_version = $(meson_quote "${QEMU_GA_VERSION}")" >> $cross 1912 fi 1913 1914 echo >> $cross 1915 echo "[binaries]" >> $cross 1916 echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross 1917 test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross 1918 test -n "$objcc" && echo "objc = [$(meson_quote $objcc $CPU_CFLAGS)]" >> $cross 1919 if test "$rust" != disabled; then 1920 if test "$rust_host_triple" != "$rust_target_triple"; then 1921 echo "rust = [$(meson_quote $rustc --target "$rust_target_triple")]" >> $cross 1922 else 1923 echo "rust = [$(meson_quote $rustc)]" >> $cross 1924 fi 1925 fi 1926 echo "ar = [$(meson_quote $ar)]" >> $cross 1927 echo "dlltool = [$(meson_quote $dlltool)]" >> $cross 1928 echo "nm = [$(meson_quote $nm)]" >> $cross 1929 echo "pkgconfig = [$(meson_quote $pkg_config)]" >> $cross 1930 echo "pkg-config = [$(meson_quote $pkg_config)]" >> $cross 1931 echo "ranlib = [$(meson_quote $ranlib)]" >> $cross 1932 echo "readelf = [$(meson_quote $readelf)]" >> $cross 1933 if has $sdl2_config; then 1934 echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross 1935 fi 1936 echo "strip = [$(meson_quote $strip)]" >> $cross 1937 echo "widl = [$(meson_quote $widl)]" >> $cross 1938 echo "windres = [$(meson_quote $windres)]" >> $cross 1939 echo "windmc = [$(meson_quote $windmc)]" >> $cross 1940 if test "$cross_compile" = "yes"; then 1941 echo "[host_machine]" >> $cross 1942 echo "system = '$host_os'" >> $cross 1943 case "$cpu" in 1944 i386) 1945 echo "cpu_family = 'x86'" >> $cross 1946 ;; 1947 *) 1948 echo "cpu_family = '$cpu'" >> $cross 1949 ;; 1950 esac 1951 echo "cpu = '$cpu'" >> $cross 1952 if test "$bigendian" = "yes" ; then 1953 echo "endian = 'big'" >> $cross 1954 else 1955 echo "endian = 'little'" >> $cross 1956 fi 1957 1958 native="config-meson.native.new" 1959 echo "# Automatically generated by configure - do not modify" > $native 1960 echo "[binaries]" >> $native 1961 echo "c = [$(meson_quote $host_cc)]" >> $native 1962 if test "$rust" != disabled; then 1963 echo "rust = [$(meson_quote $rustc)]" >> $cross 1964 fi 1965 mv $native config-meson.native 1966 meson_option_add --native-file 1967 meson_option_add config-meson.native 1968 fi 1969 mv $cross config-meson.cross 1970 meson_add_machine_file config-meson.cross 1971 if test -f "$source_path/configs/meson/$host_os.txt"; then 1972 meson_add_machine_file $source_path/configs/meson/$host_os.txt 1973 fi 1974 1975 rm -rf meson-private meson-info meson-logs 1976 1977 test "$download" = "disabled" && meson_option_add "--wrap-mode=nodownload" 1978 test "$default_feature" = no && meson_option_add -Dauto_features=disabled 1979 test "$static" = yes && meson_option_add -Dprefer_static=true 1980 test "$pie" = no && meson_option_add -Db_pie=false 1981 1982 # QEMU options 1983 test "$rust" != "disabled" && meson_option_add "-Drust=$rust" 1984 test "$cfi" != false && meson_option_add "-Dcfi=$cfi" "-Db_lto=$cfi" 1985 test "$docs" != auto && meson_option_add "-Ddocs=$docs" 1986 test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE" 1987 test "$plugins" = yes && meson_option_add "-Dplugins=true" 1988 test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg" 1989 run_meson() { 1990 NINJA=$ninja $meson setup "$@" "$PWD" "$source_path" 1991 } 1992 eval run_meson $meson_options 1993 if test "$?" -ne 0 ; then 1994 error_exit "meson setup failed" 1995 fi 1996 echo "$meson" > build.ninja.stamp 1997else 1998 if test -f meson-private/cmd_line.txt; then 1999 # Adjust old command line options that were removed 2000 # sed -i is not portable 2001 perl -i -ne ' 2002 /^sphinx_build/ && next; 2003 print;' meson-private/cmd_line.txt 2004 fi 2005fi 2006 2007# Save the configure command line for later reuse. 2008cat <<EOD >config.status 2009#!/bin/sh 2010# Generated by configure. 2011# Run this file to recreate the current configuration. 2012# Compiler output produced by configure, useful for debugging 2013# configure, is in config.log if it exists. 2014EOD 2015 2016preserve_env() { 2017 envname=$1 2018 2019 eval envval=\$$envname 2020 2021 if test -n "$envval" 2022 then 2023 echo "$envname='$envval'" >> config.status 2024 echo "export $envname" >> config.status 2025 else 2026 echo "unset $envname" >> config.status 2027 fi 2028} 2029 2030# Preserve various env variables that influence what 2031# features/build target configure will detect 2032preserve_env AR 2033preserve_env AS 2034preserve_env CC 2035preserve_env CFLAGS 2036preserve_env CXX 2037preserve_env CXXFLAGS 2038preserve_env DLLTOOL 2039preserve_env LD 2040preserve_env LDFLAGS 2041preserve_env LD_LIBRARY_PATH 2042preserve_env NM 2043preserve_env OBJCFLAGS 2044preserve_env OBJCOPY 2045preserve_env PATH 2046preserve_env PKG_CONFIG 2047preserve_env PKG_CONFIG_LIBDIR 2048preserve_env PKG_CONFIG_PATH 2049preserve_env PYTHON 2050preserve_env QEMU_GA_MANUFACTURER 2051preserve_env QEMU_GA_DISTRO 2052preserve_env QEMU_GA_VERSION 2053preserve_env SDL2_CONFIG 2054preserve_env SMBD 2055preserve_env STRIP 2056preserve_env WIDL 2057preserve_env WINDRES 2058preserve_env WINDMC 2059 2060printf "exec" >>config.status 2061for i in "$0" "$@"; do 2062 test "$i" = --skip-meson || printf " %s" "$(quote_sh "$i")" >>config.status 2063done 2064echo ' "$@"' >>config.status 2065chmod +x config.status 2066 2067rm -r "$TMPDIR1" 2068 2069if test "$rust" != disabled; then 2070 echo 2071 echo 'INFO: Rust bindings generation with `bindgen` might fail in some cases where' 2072 echo 'the detected `libclang` does not match the expected `clang` version/target. In' 2073 echo 'this case you must pass the path to `clang` and `libclang` to your build' 2074 echo 'command invocation using the environment variables CLANG_PATH and LIBCLANG_PATH' 2075fi 2076