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