]>
Commit | Line | Data |
---|---|---|
7d13299d FB |
1 | #!/bin/sh |
2 | # | |
3ef693a0 | 3 | # qemu configure script (c) 2003 Fabrice Bellard |
7d13299d | 4 | # |
8cd05ab6 | 5 | |
99519e67 CH |
6 | # Unset some variables known to interfere with behavior of common tools, |
7 | # just as autoconf does. | |
8 | CLICOLOR_FORCE= GREP_OPTIONS= | |
9 | unset CLICOLOR_FORCE GREP_OPTIONS | |
10 | ||
5e4dfd3d JS |
11 | # Don't allow CCACHE, if present, to use cached results of compile tests! |
12 | export CCACHE_RECACHE=yes | |
13 | ||
8cd05ab6 PM |
14 | # Temporary directory used for files created while |
15 | # configure runs. Since it is in the build directory | |
16 | # we can safely blow away any previous version of it | |
17 | # (and we need not jump through hoops to try to delete | |
18 | # it when configure exits.) | |
19 | TMPDIR1="config-temp" | |
20 | rm -rf "${TMPDIR1}" | |
21 | mkdir -p "${TMPDIR1}" | |
22 | if [ $? -ne 0 ]; then | |
23 | echo "ERROR: failed to create temporary directory" | |
24 | exit 1 | |
7d13299d FB |
25 | fi |
26 | ||
8cd05ab6 PM |
27 | TMPB="qemu-conf" |
28 | TMPC="${TMPDIR1}/${TMPB}.c" | |
66518bf6 | 29 | TMPO="${TMPDIR1}/${TMPB}.o" |
9c83ffd8 | 30 | TMPCXX="${TMPDIR1}/${TMPB}.cxx" |
8cd05ab6 | 31 | TMPE="${TMPDIR1}/${TMPB}.exe" |
6969ec6c | 32 | TMPMO="${TMPDIR1}/${TMPB}.mo" |
7d13299d | 33 | |
da1d85e3 | 34 | rm -f config.log |
9ac81bbb | 35 | |
b48e3611 PM |
36 | # Print a helpful header at the top of config.log |
37 | echo "# QEMU configure log $(date)" >> config.log | |
979ae168 PM |
38 | printf "# Configured with:" >> config.log |
39 | printf " '%s'" "$0" "$@" >> config.log | |
40 | echo >> config.log | |
b48e3611 PM |
41 | echo "#" >> config.log |
42 | ||
76ad07a4 PM |
43 | error_exit() { |
44 | echo | |
45 | echo "ERROR: $1" | |
46 | while test -n "$2"; do | |
47 | echo " $2" | |
48 | shift | |
49 | done | |
50 | echo | |
51 | exit 1 | |
52 | } | |
53 | ||
9c83ffd8 PM |
54 | do_compiler() { |
55 | # Run the compiler, capturing its output to the log. First argument | |
56 | # is compiler binary to execute. | |
57 | local compiler="$1" | |
58 | shift | |
59 | echo $compiler "$@" >> config.log | |
60 | $compiler "$@" >> config.log 2>&1 || return $? | |
8dc38a78 PM |
61 | # Test passed. If this is an --enable-werror build, rerun |
62 | # the test with -Werror and bail out if it fails. This | |
63 | # makes warning-generating-errors in configure test code | |
64 | # obvious to developers. | |
65 | if test "$werror" != "yes"; then | |
66 | return 0 | |
67 | fi | |
68 | # Don't bother rerunning the compile if we were already using -Werror | |
69 | case "$*" in | |
70 | *-Werror*) | |
71 | return 0 | |
72 | ;; | |
73 | esac | |
9c83ffd8 PM |
74 | echo $compiler -Werror "$@" >> config.log |
75 | $compiler -Werror "$@" >> config.log 2>&1 && return $? | |
76ad07a4 PM |
76 | error_exit "configure test passed without -Werror but failed with -Werror." \ |
77 | "This is probably a bug in the configure script. The failing command" \ | |
78 | "will be at the bottom of config.log." \ | |
79 | "You can run configure with --disable-werror to bypass this check." | |
8dc38a78 PM |
80 | } |
81 | ||
9c83ffd8 PM |
82 | do_cc() { |
83 | do_compiler "$cc" "$@" | |
84 | } | |
85 | ||
86 | do_cxx() { | |
87 | do_compiler "$cxx" "$@" | |
88 | } | |
89 | ||
90 | update_cxxflags() { | |
91 | # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those | |
92 | # options which some versions of GCC's C++ compiler complain about | |
93 | # because they only make sense for C programs. | |
94 | QEMU_CXXFLAGS= | |
95 | for arg in $QEMU_CFLAGS; do | |
96 | case $arg in | |
97 | -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ | |
98 | -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls) | |
99 | ;; | |
100 | *) | |
101 | QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg | |
102 | ;; | |
103 | esac | |
104 | done | |
105 | } | |
106 | ||
52166aa0 | 107 | compile_object() { |
fd0e6053 JS |
108 | local_cflags="$1" |
109 | do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC | |
52166aa0 JQ |
110 | } |
111 | ||
112 | compile_prog() { | |
113 | local_cflags="$1" | |
114 | local_ldflags="$2" | |
8dc38a78 | 115 | do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags |
52166aa0 JQ |
116 | } |
117 | ||
11568d6d PB |
118 | # symbolically link $1 to $2. Portable version of "ln -sf". |
119 | symlink() { | |
72b8b5a1 | 120 | rm -rf "$2" |
ec5b06d7 | 121 | mkdir -p "$(dirname "$2")" |
72b8b5a1 | 122 | ln -s "$1" "$2" |
11568d6d PB |
123 | } |
124 | ||
0dba6195 LM |
125 | # check whether a command is available to this shell (may be either an |
126 | # executable or a builtin) | |
127 | has() { | |
128 | type "$1" >/dev/null 2>&1 | |
129 | } | |
130 | ||
131 | # search for an executable in PATH | |
132 | path_of() { | |
133 | local_command="$1" | |
134 | local_ifs="$IFS" | |
135 | local_dir="" | |
136 | ||
137 | # pathname has a dir component? | |
138 | if [ "${local_command#*/}" != "$local_command" ]; then | |
139 | if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then | |
140 | echo "$local_command" | |
141 | return 0 | |
142 | fi | |
143 | fi | |
144 | if [ -z "$local_command" ]; then | |
145 | return 1 | |
146 | fi | |
147 | ||
148 | IFS=: | |
149 | for local_dir in $PATH; do | |
150 | if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then | |
151 | echo "$local_dir/$local_command" | |
152 | IFS="${local_ifs:-$(printf ' \t\n')}" | |
153 | return 0 | |
154 | fi | |
155 | done | |
156 | # not found | |
157 | IFS="${local_ifs:-$(printf ' \t\n')}" | |
158 | return 1 | |
159 | } | |
160 | ||
5b808275 LV |
161 | have_backend () { |
162 | echo "$trace_backends" | grep "$1" >/dev/null | |
163 | } | |
164 | ||
7d13299d | 165 | # default parameters |
89138857 | 166 | source_path=$(dirname "$0") |
2ff6b91e | 167 | cpu="" |
a31a8642 | 168 | iasl="iasl" |
1e43adfc | 169 | interp_prefix="/usr/gnemul/qemu-%M" |
43ce4dfe | 170 | static="no" |
7d13299d | 171 | cross_prefix="" |
0c58ac1c | 172 | audio_drv_list="" |
b64ec4e4 FZ |
173 | block_drv_rw_whitelist="" |
174 | block_drv_ro_whitelist="" | |
e49d021e | 175 | host_cc="cc" |
73da375e | 176 | libs_softmmu="" |
3e2e0e6b | 177 | libs_tools="" |
67f86e8e | 178 | audio_pt_int="" |
d5631638 | 179 | audio_win_int="" |
2b2e59e6 | 180 | cc_i386=i386-pc-linux-gnu-gcc |
957f1f99 | 181 | libs_qga="" |
5bc62e01 | 182 | debug_info="yes" |
63678e17 | 183 | stack_protector="" |
ac0df51d | 184 | |
afb63ebd SW |
185 | # Don't accept a target_list environment variable. |
186 | unset target_list | |
377529c0 PB |
187 | |
188 | # Default value for a variable defining feature "foo". | |
189 | # * foo="no" feature will only be used if --enable-foo arg is given | |
190 | # * foo="" feature will be searched for, and if found, will be used | |
191 | # unless --disable-foo is given | |
192 | # * foo="yes" this value will only be set by --enable-foo flag. | |
193 | # feature will searched for, | |
194 | # if not found, configure exits with error | |
195 | # | |
196 | # Always add --enable-foo and --disable-foo command line args. | |
197 | # Distributions want to ensure that several features are compiled in, and it | |
198 | # is impossible without a --enable-foo that exits if a feature is not found. | |
199 | ||
200 | bluez="" | |
201 | brlapi="" | |
202 | curl="" | |
203 | curses="" | |
204 | docs="" | |
205 | fdt="" | |
58952137 | 206 | netmap="no" |
e2134eb9 | 207 | pixman="" |
377529c0 | 208 | sdl="" |
ee8466d0 | 209 | sdlabi="" |
983eef5a | 210 | virtfs="" |
821601ea | 211 | vnc="yes" |
377529c0 | 212 | sparse="no" |
377529c0 | 213 | vde="" |
377529c0 PB |
214 | vnc_sasl="" |
215 | vnc_jpeg="" | |
216 | vnc_png="" | |
377529c0 | 217 | xen="" |
d5b93ddf | 218 | xen_ctrl_version="" |
64a7ad6f | 219 | xen_pv_domain_build="no" |
eb6fda0f | 220 | xen_pci_passthrough="" |
377529c0 | 221 | linux_aio="" |
47e98658 | 222 | cap_ng="" |
377529c0 | 223 | attr="" |
4f26f2b6 | 224 | libattr="" |
377529c0 PB |
225 | xfs="" |
226 | ||
d41a75a2 | 227 | vhost_net="no" |
5e9be92d | 228 | vhost_scsi="no" |
fc0b9b0e | 229 | vhost_vsock="no" |
d41a75a2 | 230 | kvm="no" |
b0cb0a66 | 231 | hax="no" |
2da776db | 232 | rdma="" |
377529c0 PB |
233 | gprof="no" |
234 | debug_tcg="no" | |
377529c0 | 235 | debug="no" |
b553a042 | 236 | fortify_source="" |
377529c0 | 237 | strip_opt="yes" |
9195b2c2 | 238 | tcg_interpreter="no" |
377529c0 PB |
239 | bigendian="no" |
240 | mingw32="no" | |
1d728c39 BS |
241 | gcov="no" |
242 | gcov_tool="gcov" | |
377529c0 | 243 | EXESUF="" |
17969268 FZ |
244 | DSOSUF=".so" |
245 | LDFLAGS_SHARED="-shared" | |
246 | modules="no" | |
377529c0 PB |
247 | prefix="/usr/local" |
248 | mandir="\${prefix}/share/man" | |
528ae5b8 | 249 | datadir="\${prefix}/share" |
850da188 | 250 | qemu_docdir="\${prefix}/share/doc/qemu" |
377529c0 | 251 | bindir="\${prefix}/bin" |
3aa5d2be | 252 | libdir="\${prefix}/lib" |
8bf188aa | 253 | libexecdir="\${prefix}/libexec" |
0f94d6da | 254 | includedir="\${prefix}/include" |
377529c0 | 255 | sysconfdir="\${prefix}/etc" |
785c23ae | 256 | local_statedir="\${prefix}/var" |
377529c0 PB |
257 | confsuffix="/qemu" |
258 | slirp="yes" | |
377529c0 PB |
259 | oss_lib="" |
260 | bsd="no" | |
261 | linux="no" | |
262 | solaris="no" | |
263 | profiler="no" | |
264 | cocoa="no" | |
265 | softmmu="yes" | |
266 | linux_user="no" | |
377529c0 | 267 | bsd_user="no" |
377529c0 PB |
268 | aix="no" |
269 | blobs="yes" | |
270 | pkgversion="" | |
40d6444e | 271 | pie="" |
3556c233 | 272 | qom_cast_debug="yes" |
baf86d6b | 273 | trace_backends="log" |
377529c0 PB |
274 | trace_file="trace" |
275 | spice="" | |
276 | rbd="" | |
7b02f544 | 277 | smartcard="" |
2b2325ff | 278 | libusb="" |
69354a83 | 279 | usb_redir="" |
da076ffe | 280 | opengl="" |
014cb152 | 281 | opengl_dmabuf="no" |
99f2dbd3 | 282 | avx2_opt="no" |
1ece9905 | 283 | zlib="yes" |
b25c9dff SW |
284 | lzo="" |
285 | snappy="" | |
6b383c08 | 286 | bzip2="" |
e8ef31a3 | 287 | guest_agent="" |
d9840e25 | 288 | guest_agent_with_vss="no" |
50cbebb9 | 289 | guest_agent_ntddscsi="no" |
9dacf32d | 290 | guest_agent_msi="" |
d9840e25 TS |
291 | vss_win32_sdk="" |
292 | win_sdk="no" | |
4b1c11fd | 293 | want_tools="yes" |
c589b249 | 294 | libiscsi="" |
6542aa9c | 295 | libnfs="" |
519175a2 | 296 | coroutine="" |
70c60c08 | 297 | coroutine_pool="" |
7d992e4d | 298 | debug_stack_usage="no" |
f794573e | 299 | seccomp="" |
eb100396 | 300 | glusterfs="" |
d85fa9eb | 301 | glusterfs_xlator_opt="no" |
0c14fb47 | 302 | glusterfs_discard="no" |
7c815372 | 303 | glusterfs_zerofill="no" |
a4ccabcf | 304 | gtk="" |
9e04c683 | 305 | gtkabi="" |
925a0400 | 306 | gtk_gl="no" |
a1c5e949 | 307 | tls_priority="NORMAL" |
ddbb0d09 | 308 | gnutls="" |
b917da4c | 309 | gnutls_rnd="" |
91bfcdb0 | 310 | nettle="" |
fff2f982 | 311 | nettle_kdf="no" |
91bfcdb0 | 312 | gcrypt="" |
1f923c70 | 313 | gcrypt_hmac="no" |
37788f25 | 314 | gcrypt_kdf="no" |
bbbf9bfb | 315 | vte="" |
9d9e1521 | 316 | virglrenderer="" |
e91c793c | 317 | tpm="yes" |
0a12ec87 | 318 | libssh2="" |
a99d57bb | 319 | numa="" |
2847b469 | 320 | tcmalloc="no" |
7b01cb97 | 321 | jemalloc="no" |
a6b1d4c0 | 322 | replication="yes" |
da92c3ff | 323 | vxhs="" |
377529c0 | 324 | |
898be3e0 PM |
325 | supported_cpu="no" |
326 | supported_os="no" | |
fb59dabd | 327 | bogus_os="no" |
898be3e0 | 328 | |
ac0df51d AL |
329 | # parse CC options first |
330 | for opt do | |
89138857 | 331 | optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') |
ac0df51d AL |
332 | case "$opt" in |
333 | --cross-prefix=*) cross_prefix="$optarg" | |
334 | ;; | |
3d8df640 | 335 | --cc=*) CC="$optarg" |
ac0df51d | 336 | ;; |
83f73fce TS |
337 | --cxx=*) CXX="$optarg" |
338 | ;; | |
ca4deeb1 PB |
339 | --source-path=*) source_path="$optarg" |
340 | ;; | |
2ff6b91e JQ |
341 | --cpu=*) cpu="$optarg" |
342 | ;; | |
de385287 | 343 | --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" |
f9943cd5 | 344 | EXTRA_CFLAGS="$optarg" |
e2a2ed06 | 345 | ;; |
a4969e90 | 346 | --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg" |
f9943cd5 | 347 | EXTRA_LDFLAGS="$optarg" |
e2a2ed06 | 348 | ;; |
5bc62e01 GH |
349 | --enable-debug-info) debug_info="yes" |
350 | ;; | |
351 | --disable-debug-info) debug_info="no" | |
352 | ;; | |
ac0df51d AL |
353 | esac |
354 | done | |
ac0df51d AL |
355 | # OS specific |
356 | # Using uname is really, really broken. Once we have the right set of checks | |
93148aa5 | 357 | # we can eliminate its usage altogether. |
ac0df51d | 358 | |
e49d021e PM |
359 | # Preferred compiler: |
360 | # ${CC} (if set) | |
361 | # ${cross_prefix}gcc (if cross-prefix specified) | |
362 | # system compiler | |
363 | if test -z "${CC}${cross_prefix}"; then | |
364 | cc="$host_cc" | |
365 | else | |
366 | cc="${CC-${cross_prefix}gcc}" | |
367 | fi | |
368 | ||
83f73fce TS |
369 | if test -z "${CXX}${cross_prefix}"; then |
370 | cxx="c++" | |
371 | else | |
372 | cxx="${CXX-${cross_prefix}g++}" | |
373 | fi | |
374 | ||
b3198cc2 | 375 | ar="${AR-${cross_prefix}ar}" |
cdbd727c | 376 | as="${AS-${cross_prefix}as}" |
5f6f0e27 | 377 | ccas="${CCAS-$cc}" |
3dd46c78 | 378 | cpp="${CPP-$cc -E}" |
b3198cc2 SY |
379 | objcopy="${OBJCOPY-${cross_prefix}objcopy}" |
380 | ld="${LD-${cross_prefix}ld}" | |
4852ee95 | 381 | nm="${NM-${cross_prefix}nm}" |
b3198cc2 SY |
382 | strip="${STRIP-${cross_prefix}strip}" |
383 | windres="${WINDRES-${cross_prefix}windres}" | |
17884d7b ST |
384 | pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" |
385 | query_pkg_config() { | |
386 | "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" | |
387 | } | |
388 | pkg_config=query_pkg_config | |
b3198cc2 | 389 | sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" |
47c03744 | 390 | sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" |
ac0df51d | 391 | |
45d285ab PM |
392 | # If the user hasn't specified ARFLAGS, default to 'rv', just as make does. |
393 | ARFLAGS="${ARFLAGS-rv}" | |
394 | ||
be17dc90 | 395 | # default flags for all hosts |
2d31515b PM |
396 | # We use -fwrapv to tell the compiler that we require a C dialect where |
397 | # left shift of signed integers is well defined and has the expected | |
398 | # 2s-complement style results. (Both clang and gcc agree that it | |
399 | # provides these semantics.) | |
400 | QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS" | |
f9188227 | 401 | QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" |
c95e3080 | 402 | QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" |
be17dc90 | 403 | QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" |
6b4c305c | 404 | QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include" |
5bc62e01 GH |
405 | if test "$debug_info" = "yes"; then |
406 | CFLAGS="-g $CFLAGS" | |
407 | LDFLAGS="-g $LDFLAGS" | |
408 | fi | |
be17dc90 | 409 | |
ca4deeb1 | 410 | # make source path absolute |
89138857 | 411 | source_path=$(cd "$source_path"; pwd) |
ca4deeb1 | 412 | |
cab00a5a MT |
413 | # running configure in the source tree? |
414 | # we know that's the case if configure is there. | |
415 | if test -f "./configure"; then | |
416 | pwd_is_source_path="y" | |
417 | else | |
418 | pwd_is_source_path="n" | |
419 | fi | |
420 | ||
ac0df51d AL |
421 | check_define() { |
422 | cat > $TMPC <<EOF | |
423 | #if !defined($1) | |
fd786e1a | 424 | #error $1 not defined |
ac0df51d AL |
425 | #endif |
426 | int main(void) { return 0; } | |
427 | EOF | |
52166aa0 | 428 | compile_object |
ac0df51d AL |
429 | } |
430 | ||
307119e7 GH |
431 | check_include() { |
432 | cat > $TMPC <<EOF | |
433 | #include <$1> | |
434 | int main(void) { return 0; } | |
435 | EOF | |
436 | compile_object | |
437 | } | |
438 | ||
93b25869 JS |
439 | write_c_skeleton() { |
440 | cat > $TMPC <<EOF | |
441 | int main(void) { return 0; } | |
442 | EOF | |
443 | } | |
444 | ||
bbea4050 PM |
445 | if check_define __linux__ ; then |
446 | targetos="Linux" | |
447 | elif check_define _WIN32 ; then | |
448 | targetos='MINGW32' | |
449 | elif check_define __OpenBSD__ ; then | |
450 | targetos='OpenBSD' | |
451 | elif check_define __sun__ ; then | |
452 | targetos='SunOS' | |
453 | elif check_define __HAIKU__ ; then | |
454 | targetos='Haiku' | |
455 | else | |
89138857 | 456 | targetos=$(uname -s) |
bbea4050 PM |
457 | fi |
458 | ||
459 | # Some host OSes need non-standard checks for which CPU to use. | |
460 | # Note that these checks are broken for cross-compilation: if you're | |
461 | # cross-compiling to one of these OSes then you'll need to specify | |
462 | # the correct CPU with the --cpu option. | |
463 | case $targetos in | |
464 | Darwin) | |
465 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can | |
466 | # run 64-bit userspace code. | |
467 | # If the user didn't specify a CPU explicitly and the kernel says this is | |
468 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. | |
469 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | |
470 | cpu="x86_64" | |
471 | fi | |
472 | ;; | |
473 | SunOS) | |
89138857 | 474 | # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo |
bbea4050 PM |
475 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then |
476 | cpu="x86_64" | |
477 | fi | |
478 | esac | |
479 | ||
2ff6b91e JQ |
480 | if test ! -z "$cpu" ; then |
481 | # command line argument | |
482 | : | |
483 | elif check_define __i386__ ; then | |
ac0df51d AL |
484 | cpu="i386" |
485 | elif check_define __x86_64__ ; then | |
c72b26ec RH |
486 | if check_define __ILP32__ ; then |
487 | cpu="x32" | |
488 | else | |
489 | cpu="x86_64" | |
490 | fi | |
3aa9bd6c | 491 | elif check_define __sparc__ ; then |
3aa9bd6c BS |
492 | if check_define __arch64__ ; then |
493 | cpu="sparc64" | |
494 | else | |
495 | cpu="sparc" | |
496 | fi | |
fdf7ed96 | 497 | elif check_define _ARCH_PPC ; then |
498 | if check_define _ARCH_PPC64 ; then | |
499 | cpu="ppc64" | |
500 | else | |
501 | cpu="ppc" | |
502 | fi | |
afa05235 AJ |
503 | elif check_define __mips__ ; then |
504 | cpu="mips" | |
477ba620 AJ |
505 | elif check_define __ia64__ ; then |
506 | cpu="ia64" | |
d66ed0ea AJ |
507 | elif check_define __s390__ ; then |
508 | if check_define __s390x__ ; then | |
509 | cpu="s390x" | |
510 | else | |
511 | cpu="s390" | |
512 | fi | |
21d89f84 PM |
513 | elif check_define __arm__ ; then |
514 | cpu="arm" | |
1f080313 CF |
515 | elif check_define __aarch64__ ; then |
516 | cpu="aarch64" | |
ac0df51d | 517 | else |
89138857 | 518 | cpu=$(uname -m) |
ac0df51d AL |
519 | fi |
520 | ||
359bc95d PM |
521 | ARCH= |
522 | # Normalise host CPU name and set ARCH. | |
523 | # Note that this case should only have supported host CPUs, not guests. | |
7d13299d | 524 | case "$cpu" in |
6499fd15 | 525 | ppc|ppc64|s390|s390x|sparc64|x32) |
898be3e0 PM |
526 | cpu="$cpu" |
527 | supported_cpu="yes" | |
528 | ;; | |
6499fd15 | 529 | ia64) |
ea8f20f8 JQ |
530 | cpu="$cpu" |
531 | ;; | |
7d13299d | 532 | i386|i486|i586|i686|i86pc|BePC) |
97a847bc | 533 | cpu="i386" |
898be3e0 | 534 | supported_cpu="yes" |
7d13299d | 535 | ;; |
aaa5fa14 AJ |
536 | x86_64|amd64) |
537 | cpu="x86_64" | |
898be3e0 | 538 | supported_cpu="yes" |
aaa5fa14 | 539 | ;; |
21d89f84 PM |
540 | armv*b|armv*l|arm) |
541 | cpu="arm" | |
898be3e0 | 542 | supported_cpu="yes" |
7d13299d | 543 | ;; |
1f080313 CF |
544 | aarch64) |
545 | cpu="aarch64" | |
898be3e0 | 546 | supported_cpu="yes" |
1f080313 | 547 | ;; |
afa05235 AJ |
548 | mips*) |
549 | cpu="mips" | |
898be3e0 | 550 | supported_cpu="yes" |
afa05235 | 551 | ;; |
3142255c | 552 | sparc|sun4[cdmuv]) |
ae228531 | 553 | cpu="sparc" |
6499fd15 | 554 | supported_cpu="yes" |
ae228531 | 555 | ;; |
7d13299d | 556 | *) |
359bc95d PM |
557 | # This will result in either an error or falling back to TCI later |
558 | ARCH=unknown | |
7d13299d FB |
559 | ;; |
560 | esac | |
359bc95d PM |
561 | if test -z "$ARCH"; then |
562 | ARCH="$cpu" | |
563 | fi | |
e2d52ad3 | 564 | |
7d13299d | 565 | # OS specific |
0dbfc675 | 566 | |
adfc3e91 SS |
567 | # host *BSD for user mode |
568 | HOST_VARIANT_DIR="" | |
569 | ||
7d13299d | 570 | case $targetos in |
67b915a5 | 571 | MINGW32*) |
0dbfc675 | 572 | mingw32="yes" |
b0cb0a66 | 573 | hax="yes" |
3cec7cc2 | 574 | audio_possible_drivers="dsound sdl" |
307119e7 GH |
575 | if check_include dsound.h; then |
576 | audio_drv_list="dsound" | |
577 | else | |
578 | audio_drv_list="" | |
579 | fi | |
898be3e0 | 580 | supported_os="yes" |
67b915a5 | 581 | ;; |
5c40d2bd | 582 | GNU/kFreeBSD) |
a167ba50 | 583 | bsd="yes" |
0dbfc675 | 584 | audio_drv_list="oss" |
0bac1111 | 585 | audio_possible_drivers="oss sdl pa" |
5c40d2bd | 586 | ;; |
7d3505c5 | 587 | FreeBSD) |
0dbfc675 | 588 | bsd="yes" |
0db4a067 | 589 | make="${MAKE-gmake}" |
0dbfc675 | 590 | audio_drv_list="oss" |
0bac1111 | 591 | audio_possible_drivers="oss sdl pa" |
f01576f1 JL |
592 | # needed for kinfo_getvmmap(3) in libutil.h |
593 | LIBS="-lutil $LIBS" | |
a7764f15 EM |
594 | # needed for kinfo_getproc |
595 | libs_qga="-lutil $libs_qga" | |
58952137 | 596 | netmap="" # enable netmap autodetect |
adfc3e91 | 597 | HOST_VARIANT_DIR="freebsd" |
898be3e0 | 598 | supported_os="yes" |
7d3505c5 | 599 | ;; |
c5e97233 | 600 | DragonFly) |
0dbfc675 | 601 | bsd="yes" |
0db4a067 | 602 | make="${MAKE-gmake}" |
0dbfc675 | 603 | audio_drv_list="oss" |
0bac1111 | 604 | audio_possible_drivers="oss sdl pa" |
adfc3e91 | 605 | HOST_VARIANT_DIR="dragonfly" |
c5e97233 | 606 | ;; |
7d3505c5 | 607 | NetBSD) |
0dbfc675 | 608 | bsd="yes" |
0db4a067 | 609 | make="${MAKE-gmake}" |
0dbfc675 | 610 | audio_drv_list="oss" |
0bac1111 | 611 | audio_possible_drivers="oss sdl" |
0dbfc675 | 612 | oss_lib="-lossaudio" |
adfc3e91 | 613 | HOST_VARIANT_DIR="netbsd" |
3c2bdbc1 | 614 | supported_os="yes" |
7d3505c5 FB |
615 | ;; |
616 | OpenBSD) | |
0dbfc675 | 617 | bsd="yes" |
0db4a067 | 618 | make="${MAKE-gmake}" |
4f6ab397 | 619 | audio_drv_list="sdl" |
0bac1111 | 620 | audio_possible_drivers="sdl" |
adfc3e91 | 621 | HOST_VARIANT_DIR="openbsd" |
7d3505c5 | 622 | ;; |
83fb7adf | 623 | Darwin) |
0dbfc675 JQ |
624 | bsd="yes" |
625 | darwin="yes" | |
b0cb0a66 | 626 | hax="yes" |
17969268 | 627 | LDFLAGS_SHARED="-bundle -undefined dynamic_lookup" |
0dbfc675 | 628 | if [ "$cpu" = "x86_64" ] ; then |
a558ee17 | 629 | QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" |
0c439cbf | 630 | LDFLAGS="-arch x86_64 $LDFLAGS" |
0dbfc675 | 631 | fi |
0dbfc675 JQ |
632 | cocoa="yes" |
633 | audio_drv_list="coreaudio" | |
14382605 | 634 | audio_possible_drivers="coreaudio sdl" |
0dbfc675 | 635 | LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" |
7973f21c | 636 | libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" |
a0b7cf6b PM |
637 | # Disable attempts to use ObjectiveC features in os/object.h since they |
638 | # won't work when we're compiling with gcc as a C compiler. | |
639 | QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" | |
adfc3e91 | 640 | HOST_VARIANT_DIR="darwin" |
898be3e0 | 641 | supported_os="yes" |
83fb7adf | 642 | ;; |
ec530c81 | 643 | SunOS) |
0dbfc675 | 644 | solaris="yes" |
0db4a067 PB |
645 | make="${MAKE-gmake}" |
646 | install="${INSTALL-ginstall}" | |
fa58948d | 647 | ld="gld" |
e2d8830e | 648 | smbd="${SMBD-/usr/sfw/sbin/smbd}" |
0dbfc675 | 649 | needs_libsunmath="no" |
89138857 | 650 | solarisrev=$(uname -r | cut -f2 -d.) |
0dbfc675 JQ |
651 | if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then |
652 | if test "$solarisrev" -le 9 ; then | |
653 | if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then | |
654 | needs_libsunmath="yes" | |
f14bfdf9 JQ |
655 | QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" |
656 | LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" | |
657 | LIBS="-lsunmath $LIBS" | |
0dbfc675 | 658 | else |
76ad07a4 PM |
659 | error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \ |
660 | "libsunmath from the Sun Studio compilers tools, due to a lack of" \ | |
661 | "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \ | |
662 | "Studio 11 can be downloaded from www.sun.com." | |
0dbfc675 | 663 | fi |
86b2bd93 | 664 | fi |
0dbfc675 JQ |
665 | fi |
666 | if test -f /usr/include/sys/soundcard.h ; then | |
667 | audio_drv_list="oss" | |
668 | fi | |
669 | audio_possible_drivers="oss sdl" | |
d741429a BS |
670 | # needed for CMSG_ macros in sys/socket.h |
671 | QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" | |
672 | # needed for TIOCWIN* defines in termios.h | |
673 | QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" | |
a558ee17 | 674 | QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" |
560d375f AF |
675 | solarisnetlibs="-lsocket -lnsl -lresolv" |
676 | LIBS="$solarisnetlibs $LIBS" | |
677 | libs_qga="$solarisnetlibs $libs_qga" | |
86b2bd93 | 678 | ;; |
b29fe3ed | 679 | AIX) |
0dbfc675 | 680 | aix="yes" |
0db4a067 | 681 | make="${MAKE-gmake}" |
b29fe3ed | 682 | ;; |
179cf400 AF |
683 | Haiku) |
684 | haiku="yes" | |
685 | QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" | |
686 | LIBS="-lposix_error_mapper -lnetwork $LIBS" | |
687 | ;; | |
898be3e0 | 688 | Linux) |
0dbfc675 | 689 | audio_drv_list="oss" |
0bac1111 | 690 | audio_possible_drivers="oss alsa sdl pa" |
0dbfc675 JQ |
691 | linux="yes" |
692 | linux_user="yes" | |
af2be207 JK |
693 | kvm="yes" |
694 | vhost_net="yes" | |
5e9be92d | 695 | vhost_scsi="yes" |
fc0b9b0e | 696 | vhost_vsock="yes" |
a585140d | 697 | QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES" |
898be3e0 PM |
698 | supported_os="yes" |
699 | ;; | |
700 | *) | |
fb59dabd PM |
701 | # This is a fatal error, but don't report it yet, because we |
702 | # might be going to just print the --help text, or it might | |
703 | # be the result of a missing compiler. | |
704 | bogus_os="yes" | |
fb065187 | 705 | ;; |
7d13299d FB |
706 | esac |
707 | ||
7d3505c5 | 708 | if [ "$bsd" = "yes" ] ; then |
b1a550a0 | 709 | if [ "$darwin" != "yes" ] ; then |
08de3949 | 710 | bsd_user="yes" |
83fb7adf | 711 | fi |
7d3505c5 FB |
712 | fi |
713 | ||
0db4a067 PB |
714 | : ${make=${MAKE-make}} |
715 | : ${install=${INSTALL-install}} | |
52510f8b | 716 | : ${python=${PYTHON-python}} |
e2d8830e | 717 | : ${smbd=${SMBD-/usr/sbin/smbd}} |
0db4a067 | 718 | |
3c4a4d0d PM |
719 | # Default objcc to clang if available, otherwise use CC |
720 | if has clang; then | |
721 | objcc=clang | |
722 | else | |
723 | objcc="$cc" | |
724 | fi | |
725 | ||
3457a3f8 | 726 | if test "$mingw32" = "yes" ; then |
3457a3f8 | 727 | EXESUF=".exe" |
17969268 | 728 | DSOSUF=".dll" |
a558ee17 | 729 | QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" |
e94a7936 SW |
730 | # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) |
731 | QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" | |
78e9d4ad SW |
732 | # MinGW needs -mthreads for TLS and macro _MT. |
733 | QEMU_CFLAGS="-mthreads $QEMU_CFLAGS" | |
f7cf5d5b | 734 | LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" |
93b25869 | 735 | write_c_skeleton; |
f7cf5d5b SW |
736 | if compile_prog "" "-liberty" ; then |
737 | LIBS="-liberty $LIBS" | |
738 | fi | |
c5ec15ea | 739 | prefix="c:/Program Files/QEMU" |
683035de | 740 | mandir="\${prefix}" |
528ae5b8 | 741 | datadir="\${prefix}" |
850da188 | 742 | qemu_docdir="\${prefix}" |
683035de PB |
743 | bindir="\${prefix}" |
744 | sysconfdir="\${prefix}" | |
5a699bbb | 745 | local_statedir= |
683035de | 746 | confsuffix="" |
161a56a9 | 747 | libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -liphlpapi -lnetapi32 $libs_qga" |
3457a3f8 JQ |
748 | fi |
749 | ||
487fefdb | 750 | werror="" |
85aa5189 | 751 | |
7d13299d | 752 | for opt do |
89138857 | 753 | optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') |
7d13299d | 754 | case "$opt" in |
2efc3265 FB |
755 | --help|-h) show_help=yes |
756 | ;; | |
99123e13 MF |
757 | --version|-V) exec cat $source_path/VERSION |
758 | ;; | |
b1a550a0 | 759 | --prefix=*) prefix="$optarg" |
7d13299d | 760 | ;; |
b1a550a0 | 761 | --interp-prefix=*) interp_prefix="$optarg" |
32ce6337 | 762 | ;; |
ca4deeb1 | 763 | --source-path=*) |
7d13299d | 764 | ;; |
ac0df51d | 765 | --cross-prefix=*) |
7d13299d | 766 | ;; |
ac0df51d | 767 | --cc=*) |
7d13299d | 768 | ;; |
b1a550a0 | 769 | --host-cc=*) host_cc="$optarg" |
83469015 | 770 | ;; |
83f73fce TS |
771 | --cxx=*) |
772 | ;; | |
e007dbec MT |
773 | --iasl=*) iasl="$optarg" |
774 | ;; | |
3c4a4d0d PM |
775 | --objcc=*) objcc="$optarg" |
776 | ;; | |
b1a550a0 | 777 | --make=*) make="$optarg" |
7d13299d | 778 | ;; |
6a882643 PB |
779 | --install=*) install="$optarg" |
780 | ;; | |
c886edfb BS |
781 | --python=*) python="$optarg" |
782 | ;; | |
1d728c39 BS |
783 | --gcov=*) gcov_tool="$optarg" |
784 | ;; | |
e2d8830e BS |
785 | --smbd=*) smbd="$optarg" |
786 | ;; | |
e2a2ed06 | 787 | --extra-cflags=*) |
7d13299d | 788 | ;; |
e2a2ed06 | 789 | --extra-ldflags=*) |
7d13299d | 790 | ;; |
5bc62e01 GH |
791 | --enable-debug-info) |
792 | ;; | |
793 | --disable-debug-info) | |
794 | ;; | |
17969268 FZ |
795 | --enable-modules) |
796 | modules="yes" | |
3aa88b31 SH |
797 | ;; |
798 | --disable-modules) | |
799 | modules="no" | |
17969268 | 800 | ;; |
2ff6b91e | 801 | --cpu=*) |
7d13299d | 802 | ;; |
b1a550a0 | 803 | --target-list=*) target_list="$optarg" |
de83cd02 | 804 | ;; |
5b808275 LV |
805 | --enable-trace-backends=*) trace_backends="$optarg" |
806 | ;; | |
807 | # XXX: backwards compatibility | |
808 | --enable-trace-backend=*) trace_backends="$optarg" | |
94a420b1 | 809 | ;; |
74242e0f | 810 | --with-trace-file=*) trace_file="$optarg" |
9410b56c | 811 | ;; |
7d13299d FB |
812 | --enable-gprof) gprof="yes" |
813 | ;; | |
1d728c39 BS |
814 | --enable-gcov) gcov="yes" |
815 | ;; | |
79427693 LM |
816 | --static) |
817 | static="yes" | |
818 | LDFLAGS="-static $LDFLAGS" | |
17884d7b | 819 | QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" |
43ce4dfe | 820 | ;; |
0b24e75f PB |
821 | --mandir=*) mandir="$optarg" |
822 | ;; | |
823 | --bindir=*) bindir="$optarg" | |
824 | ;; | |
3aa5d2be AL |
825 | --libdir=*) libdir="$optarg" |
826 | ;; | |
8bf188aa MT |
827 | --libexecdir=*) libexecdir="$optarg" |
828 | ;; | |
0f94d6da AL |
829 | --includedir=*) includedir="$optarg" |
830 | ;; | |
528ae5b8 | 831 | --datadir=*) datadir="$optarg" |
0b24e75f | 832 | ;; |
023d3d67 EH |
833 | --with-confsuffix=*) confsuffix="$optarg" |
834 | ;; | |
850da188 | 835 | --docdir=*) qemu_docdir="$optarg" |
0b24e75f | 836 | ;; |
ca2fb938 | 837 | --sysconfdir=*) sysconfdir="$optarg" |
07381cc1 | 838 | ;; |
785c23ae LC |
839 | --localstatedir=*) local_statedir="$optarg" |
840 | ;; | |
841 | --sbindir=*|--sharedstatedir=*|\ | |
023ddd74 MF |
842 | --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ |
843 | --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) | |
844 | # These switches are silently ignored, for compatibility with | |
845 | # autoconf-generated configure scripts. This allows QEMU's | |
846 | # configure to be used by RPM and similar macros that set | |
847 | # lots of directory switches by default. | |
848 | ;; | |
e2134eb9 GH |
849 | --with-system-pixman) pixman="system" |
850 | ;; | |
851 | --without-system-pixman) pixman="internal" | |
852 | ;; | |
74880fe2 RS |
853 | --without-pixman) pixman="none" |
854 | ;; | |
97a847bc FB |
855 | --disable-sdl) sdl="no" |
856 | ;; | |
c4198157 JQ |
857 | --enable-sdl) sdl="yes" |
858 | ;; | |
47c03744 DA |
859 | --with-sdlabi=*) sdlabi="$optarg" |
860 | ;; | |
3556c233 PB |
861 | --disable-qom-cast-debug) qom_cast_debug="no" |
862 | ;; | |
863 | --enable-qom-cast-debug) qom_cast_debug="yes" | |
864 | ;; | |
983eef5a MI |
865 | --disable-virtfs) virtfs="no" |
866 | ;; | |
867 | --enable-virtfs) virtfs="yes" | |
868 | ;; | |
821601ea JS |
869 | --disable-vnc) vnc="no" |
870 | ;; | |
871 | --enable-vnc) vnc="yes" | |
872 | ;; | |
2f6a1ab0 BS |
873 | --oss-lib=*) oss_lib="$optarg" |
874 | ;; | |
0c58ac1c | 875 | --audio-drv-list=*) audio_drv_list="$optarg" |
102a52e4 | 876 | ;; |
89138857 | 877 | --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') |
b64ec4e4 | 878 | ;; |
89138857 | 879 | --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') |
eb852011 | 880 | ;; |
f8393946 AJ |
881 | --enable-debug-tcg) debug_tcg="yes" |
882 | ;; | |
883 | --disable-debug-tcg) debug_tcg="no" | |
884 | ;; | |
f3d08ee6 PB |
885 | --enable-debug) |
886 | # Enable debugging options that aren't excessively noisy | |
887 | debug_tcg="yes" | |
888 | debug="yes" | |
889 | strip_opt="no" | |
b553a042 | 890 | fortify_source="no" |
f3d08ee6 | 891 | ;; |
03b4fe7d AL |
892 | --enable-sparse) sparse="yes" |
893 | ;; | |
894 | --disable-sparse) sparse="no" | |
895 | ;; | |
1625af87 AL |
896 | --disable-strip) strip_opt="no" |
897 | ;; | |
2f9606b3 AL |
898 | --disable-vnc-sasl) vnc_sasl="no" |
899 | ;; | |
ea784e3b JQ |
900 | --enable-vnc-sasl) vnc_sasl="yes" |
901 | ;; | |
2f6f5c7a CC |
902 | --disable-vnc-jpeg) vnc_jpeg="no" |
903 | ;; | |
904 | --enable-vnc-jpeg) vnc_jpeg="yes" | |
905 | ;; | |
efe556ad CC |
906 | --disable-vnc-png) vnc_png="no" |
907 | ;; | |
908 | --enable-vnc-png) vnc_png="yes" | |
909 | ;; | |
443f1376 | 910 | --disable-slirp) slirp="no" |
1d14ffa9 | 911 | ;; |
e0e6c8c0 | 912 | --disable-vde) vde="no" |
8a16d273 | 913 | ;; |
dfb278bd JQ |
914 | --enable-vde) vde="yes" |
915 | ;; | |
58952137 VM |
916 | --disable-netmap) netmap="no" |
917 | ;; | |
918 | --enable-netmap) netmap="yes" | |
919 | ;; | |
e37630ca AL |
920 | --disable-xen) xen="no" |
921 | ;; | |
fc321b4b JQ |
922 | --enable-xen) xen="yes" |
923 | ;; | |
eb6fda0f AP |
924 | --disable-xen-pci-passthrough) xen_pci_passthrough="no" |
925 | ;; | |
926 | --enable-xen-pci-passthrough) xen_pci_passthrough="yes" | |
927 | ;; | |
64a7ad6f IC |
928 | --disable-xen-pv-domain-build) xen_pv_domain_build="no" |
929 | ;; | |
930 | --enable-xen-pv-domain-build) xen_pv_domain_build="yes" | |
931 | ;; | |
2e4d9fb1 AJ |
932 | --disable-brlapi) brlapi="no" |
933 | ;; | |
4ffcedb6 JQ |
934 | --enable-brlapi) brlapi="yes" |
935 | ;; | |
fb599c9a AZ |
936 | --disable-bluez) bluez="no" |
937 | ;; | |
a20a6f46 JQ |
938 | --enable-bluez) bluez="yes" |
939 | ;; | |
7ba1e619 AL |
940 | --disable-kvm) kvm="no" |
941 | ;; | |
b31a0277 JQ |
942 | --enable-kvm) kvm="yes" |
943 | ;; | |
b0cb0a66 | 944 | --disable-hax) hax="no" |
180fb750 | 945 | ;; |
b0cb0a66 | 946 | --enable-hax) hax="yes" |
180fb750 | 947 | ;; |
9195b2c2 SW |
948 | --disable-tcg-interpreter) tcg_interpreter="no" |
949 | ;; | |
950 | --enable-tcg-interpreter) tcg_interpreter="yes" | |
951 | ;; | |
47e98658 CB |
952 | --disable-cap-ng) cap_ng="no" |
953 | ;; | |
954 | --enable-cap-ng) cap_ng="yes" | |
955 | ;; | |
cd4ec0b4 GH |
956 | --disable-spice) spice="no" |
957 | ;; | |
958 | --enable-spice) spice="yes" | |
959 | ;; | |
c589b249 RS |
960 | --disable-libiscsi) libiscsi="no" |
961 | ;; | |
962 | --enable-libiscsi) libiscsi="yes" | |
963 | ;; | |
6542aa9c PL |
964 | --disable-libnfs) libnfs="no" |
965 | ;; | |
966 | --enable-libnfs) libnfs="yes" | |
967 | ;; | |
05c2a3e7 FB |
968 | --enable-profiler) profiler="yes" |
969 | ;; | |
14821030 PB |
970 | --disable-cocoa) cocoa="no" |
971 | ;; | |
c2de5c91 | 972 | --enable-cocoa) |
973 | cocoa="yes" ; | |
89138857 | 974 | audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" |
1d14ffa9 | 975 | ;; |
cad25d69 | 976 | --disable-system) softmmu="no" |
0a8e90f4 | 977 | ;; |
cad25d69 | 978 | --enable-system) softmmu="yes" |
0a8e90f4 | 979 | ;; |
0953a80f ZA |
980 | --disable-user) |
981 | linux_user="no" ; | |
982 | bsd_user="no" ; | |
0953a80f ZA |
983 | ;; |
984 | --enable-user) ;; | |
831b7825 | 985 | --disable-linux-user) linux_user="no" |
0a8e90f4 | 986 | ;; |
831b7825 TS |
987 | --enable-linux-user) linux_user="yes" |
988 | ;; | |
84778508 BS |
989 | --disable-bsd-user) bsd_user="no" |
990 | ;; | |
991 | --enable-bsd-user) bsd_user="yes" | |
992 | ;; | |
40d6444e | 993 | --enable-pie) pie="yes" |
34005a00 | 994 | ;; |
40d6444e | 995 | --disable-pie) pie="no" |
34005a00 | 996 | ;; |
85aa5189 FB |
997 | --enable-werror) werror="yes" |
998 | ;; | |
999 | --disable-werror) werror="no" | |
1000 | ;; | |
63678e17 SN |
1001 | --enable-stack-protector) stack_protector="yes" |
1002 | ;; | |
1003 | --disable-stack-protector) stack_protector="no" | |
1004 | ;; | |
4d3b6f6e AZ |
1005 | --disable-curses) curses="no" |
1006 | ;; | |
c584a6d0 JQ |
1007 | --enable-curses) curses="yes" |
1008 | ;; | |
769ce76d AG |
1009 | --disable-curl) curl="no" |
1010 | ;; | |
788c8196 JQ |
1011 | --enable-curl) curl="yes" |
1012 | ;; | |
2df87df7 JQ |
1013 | --disable-fdt) fdt="no" |
1014 | ;; | |
1015 | --enable-fdt) fdt="yes" | |
1016 | ;; | |
5c6c3a6c CH |
1017 | --disable-linux-aio) linux_aio="no" |
1018 | ;; | |
1019 | --enable-linux-aio) linux_aio="yes" | |
1020 | ;; | |
758e8e38 VJ |
1021 | --disable-attr) attr="no" |
1022 | ;; | |
1023 | --enable-attr) attr="yes" | |
1024 | ;; | |
77755340 TS |
1025 | --disable-blobs) blobs="no" |
1026 | ;; | |
4a19f1ec PB |
1027 | --with-pkgversion=*) pkgversion=" ($optarg)" |
1028 | ;; | |
519175a2 AB |
1029 | --with-coroutine=*) coroutine="$optarg" |
1030 | ;; | |
70c60c08 SH |
1031 | --disable-coroutine-pool) coroutine_pool="no" |
1032 | ;; | |
1033 | --enable-coroutine-pool) coroutine_pool="yes" | |
1034 | ;; | |
7d992e4d PL |
1035 | --enable-debug-stack-usage) debug_stack_usage="yes" |
1036 | ;; | |
a25dba17 | 1037 | --disable-docs) docs="no" |
70ec5dc0 | 1038 | ;; |
a25dba17 | 1039 | --enable-docs) docs="yes" |
83a3ab8b | 1040 | ;; |
d5970055 MT |
1041 | --disable-vhost-net) vhost_net="no" |
1042 | ;; | |
1043 | --enable-vhost-net) vhost_net="yes" | |
1044 | ;; | |
5e9be92d NB |
1045 | --disable-vhost-scsi) vhost_scsi="no" |
1046 | ;; | |
1047 | --enable-vhost-scsi) vhost_scsi="yes" | |
1048 | ;; | |
fc0b9b0e SH |
1049 | --disable-vhost-vsock) vhost_vsock="no" |
1050 | ;; | |
1051 | --enable-vhost-vsock) vhost_vsock="yes" | |
1052 | ;; | |
da076ffe | 1053 | --disable-opengl) opengl="no" |
20ff075b | 1054 | ;; |
da076ffe | 1055 | --enable-opengl) opengl="yes" |
20ff075b | 1056 | ;; |
f27aaf4b CB |
1057 | --disable-rbd) rbd="no" |
1058 | ;; | |
1059 | --enable-rbd) rbd="yes" | |
1060 | ;; | |
8c84cf11 ST |
1061 | --disable-xfsctl) xfs="no" |
1062 | ;; | |
1063 | --enable-xfsctl) xfs="yes" | |
1064 | ;; | |
7b02f544 | 1065 | --disable-smartcard) smartcard="no" |
111a38b0 | 1066 | ;; |
7b02f544 | 1067 | --enable-smartcard) smartcard="yes" |
111a38b0 | 1068 | ;; |
2b2325ff GH |
1069 | --disable-libusb) libusb="no" |
1070 | ;; | |
1071 | --enable-libusb) libusb="yes" | |
1072 | ;; | |
69354a83 HG |
1073 | --disable-usb-redir) usb_redir="no" |
1074 | ;; | |
1075 | --enable-usb-redir) usb_redir="yes" | |
1076 | ;; | |
1ece9905 AL |
1077 | --disable-zlib-test) zlib="no" |
1078 | ;; | |
b25c9dff SW |
1079 | --disable-lzo) lzo="no" |
1080 | ;; | |
607dacd0 QN |
1081 | --enable-lzo) lzo="yes" |
1082 | ;; | |
b25c9dff SW |
1083 | --disable-snappy) snappy="no" |
1084 | ;; | |
607dacd0 QN |
1085 | --enable-snappy) snappy="yes" |
1086 | ;; | |
6b383c08 PW |
1087 | --disable-bzip2) bzip2="no" |
1088 | ;; | |
1089 | --enable-bzip2) bzip2="yes" | |
1090 | ;; | |
d138cee9 MR |
1091 | --enable-guest-agent) guest_agent="yes" |
1092 | ;; | |
1093 | --disable-guest-agent) guest_agent="no" | |
1094 | ;; | |
9dacf32d YH |
1095 | --enable-guest-agent-msi) guest_agent_msi="yes" |
1096 | ;; | |
1097 | --disable-guest-agent-msi) guest_agent_msi="no" | |
1098 | ;; | |
d9840e25 TS |
1099 | --with-vss-sdk) vss_win32_sdk="" |
1100 | ;; | |
1101 | --with-vss-sdk=*) vss_win32_sdk="$optarg" | |
1102 | ;; | |
1103 | --without-vss-sdk) vss_win32_sdk="no" | |
1104 | ;; | |
1105 | --with-win-sdk) win_sdk="" | |
1106 | ;; | |
1107 | --with-win-sdk=*) win_sdk="$optarg" | |
1108 | ;; | |
1109 | --without-win-sdk) win_sdk="no" | |
1110 | ;; | |
4b1c11fd DB |
1111 | --enable-tools) want_tools="yes" |
1112 | ;; | |
1113 | --disable-tools) want_tools="no" | |
1114 | ;; | |
f794573e EO |
1115 | --enable-seccomp) seccomp="yes" |
1116 | ;; | |
1117 | --disable-seccomp) seccomp="no" | |
1118 | ;; | |
eb100396 BR |
1119 | --disable-glusterfs) glusterfs="no" |
1120 | ;; | |
1121 | --enable-glusterfs) glusterfs="yes" | |
1122 | ;; | |
52b53c04 FZ |
1123 | --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) |
1124 | echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 | |
583f6e7b | 1125 | ;; |
cb6414df FZ |
1126 | --enable-vhdx|--disable-vhdx) |
1127 | echo "$0: $opt is obsolete, VHDX driver is always built" >&2 | |
1128 | ;; | |
315d3184 FZ |
1129 | --enable-uuid|--disable-uuid) |
1130 | echo "$0: $opt is obsolete, UUID support is always built" >&2 | |
1131 | ;; | |
a4ccabcf AL |
1132 | --disable-gtk) gtk="no" |
1133 | ;; | |
1134 | --enable-gtk) gtk="yes" | |
1135 | ;; | |
a1c5e949 DB |
1136 | --tls-priority=*) tls_priority="$optarg" |
1137 | ;; | |
ddbb0d09 DB |
1138 | --disable-gnutls) gnutls="no" |
1139 | ;; | |
1140 | --enable-gnutls) gnutls="yes" | |
1141 | ;; | |
91bfcdb0 DB |
1142 | --disable-nettle) nettle="no" |
1143 | ;; | |
1144 | --enable-nettle) nettle="yes" | |
1145 | ;; | |
1146 | --disable-gcrypt) gcrypt="no" | |
1147 | ;; | |
1148 | --enable-gcrypt) gcrypt="yes" | |
1149 | ;; | |
2da776db MH |
1150 | --enable-rdma) rdma="yes" |
1151 | ;; | |
1152 | --disable-rdma) rdma="no" | |
1153 | ;; | |
528de90a DB |
1154 | --with-gtkabi=*) gtkabi="$optarg" |
1155 | ;; | |
bbbf9bfb SW |
1156 | --disable-vte) vte="no" |
1157 | ;; | |
1158 | --enable-vte) vte="yes" | |
1159 | ;; | |
9d9e1521 GH |
1160 | --disable-virglrenderer) virglrenderer="no" |
1161 | ;; | |
1162 | --enable-virglrenderer) virglrenderer="yes" | |
1163 | ;; | |
e91c793c CR |
1164 | --disable-tpm) tpm="no" |
1165 | ;; | |
ab214c29 SB |
1166 | --enable-tpm) tpm="yes" |
1167 | ;; | |
0a12ec87 RJ |
1168 | --disable-libssh2) libssh2="no" |
1169 | ;; | |
1170 | --enable-libssh2) libssh2="yes" | |
1171 | ;; | |
a99d57bb WG |
1172 | --disable-numa) numa="no" |
1173 | ;; | |
1174 | --enable-numa) numa="yes" | |
1175 | ;; | |
2847b469 FZ |
1176 | --disable-tcmalloc) tcmalloc="no" |
1177 | ;; | |
1178 | --enable-tcmalloc) tcmalloc="yes" | |
1179 | ;; | |
7b01cb97 AD |
1180 | --disable-jemalloc) jemalloc="no" |
1181 | ;; | |
1182 | --enable-jemalloc) jemalloc="yes" | |
1183 | ;; | |
a6b1d4c0 CX |
1184 | --disable-replication) replication="no" |
1185 | ;; | |
1186 | --enable-replication) replication="yes" | |
1187 | ;; | |
da92c3ff AM |
1188 | --disable-vxhs) vxhs="no" |
1189 | ;; | |
1190 | --enable-vxhs) vxhs="yes" | |
1191 | ;; | |
2d2ad6d0 FZ |
1192 | *) |
1193 | echo "ERROR: unknown option $opt" | |
1194 | echo "Try '$0 --help' for more information" | |
1195 | exit 1 | |
7f1559c6 | 1196 | ;; |
7d13299d FB |
1197 | esac |
1198 | done | |
1199 | ||
40293e58 | 1200 | case "$cpu" in |
e3608d66 RH |
1201 | ppc) |
1202 | CPU_CFLAGS="-m32" | |
1203 | LDFLAGS="-m32 $LDFLAGS" | |
1204 | ;; | |
1205 | ppc64) | |
1206 | CPU_CFLAGS="-m64" | |
1207 | LDFLAGS="-m64 $LDFLAGS" | |
1208 | ;; | |
9b9c37c3 | 1209 | sparc) |
ed968ff1 | 1210 | LDFLAGS="-m32 $LDFLAGS" |
79f3b12f | 1211 | CPU_CFLAGS="-m32 -mcpu=ultrasparc" |
3142255c | 1212 | ;; |
ed968ff1 | 1213 | sparc64) |
ed968ff1 | 1214 | LDFLAGS="-m64 $LDFLAGS" |
79f3b12f | 1215 | CPU_CFLAGS="-m64 -mcpu=ultrasparc" |
3142255c | 1216 | ;; |
76d83bde | 1217 | s390) |
061cdd81 | 1218 | CPU_CFLAGS="-m31" |
28d7cc49 RH |
1219 | LDFLAGS="-m31 $LDFLAGS" |
1220 | ;; | |
1221 | s390x) | |
061cdd81 | 1222 | CPU_CFLAGS="-m64" |
28d7cc49 | 1223 | LDFLAGS="-m64 $LDFLAGS" |
76d83bde | 1224 | ;; |
40293e58 | 1225 | i386) |
79f3b12f | 1226 | CPU_CFLAGS="-m32" |
0c439cbf | 1227 | LDFLAGS="-m32 $LDFLAGS" |
2b2e59e6 | 1228 | cc_i386='$(CC) -m32' |
40293e58 FB |
1229 | ;; |
1230 | x86_64) | |
7ebee43e RH |
1231 | # ??? Only extremely old AMD cpus do not have cmpxchg16b. |
1232 | # If we truly care, we should simply detect this case at | |
1233 | # runtime and generate the fallback to serial emulation. | |
1234 | CPU_CFLAGS="-m64 -mcx16" | |
0c439cbf | 1235 | LDFLAGS="-m64 $LDFLAGS" |
2b2e59e6 | 1236 | cc_i386='$(CC) -m32' |
d2fbca94 | 1237 | ;; |
c72b26ec RH |
1238 | x32) |
1239 | CPU_CFLAGS="-mx32" | |
1240 | LDFLAGS="-mx32 $LDFLAGS" | |
1241 | cc_i386='$(CC) -m32' | |
1242 | ;; | |
30163d89 | 1243 | # No special flags required for other host CPUs |
3142255c BS |
1244 | esac |
1245 | ||
79f3b12f PC |
1246 | QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" |
1247 | EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS" | |
1248 | ||
affc88cc PM |
1249 | # For user-mode emulation the host arch has to be one we explicitly |
1250 | # support, even if we're using TCI. | |
1251 | if [ "$ARCH" = "unknown" ]; then | |
1252 | bsd_user="no" | |
1253 | linux_user="no" | |
1254 | fi | |
1255 | ||
60e0df25 PM |
1256 | default_target_list="" |
1257 | ||
6e92f823 PM |
1258 | mak_wilds="" |
1259 | ||
1260 | if [ "$softmmu" = "yes" ]; then | |
1261 | mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak" | |
60e0df25 | 1262 | fi |
6e92f823 PM |
1263 | if [ "$linux_user" = "yes" ]; then |
1264 | mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak" | |
60e0df25 | 1265 | fi |
6e92f823 PM |
1266 | if [ "$bsd_user" = "yes" ]; then |
1267 | mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" | |
60e0df25 PM |
1268 | fi |
1269 | ||
6e92f823 PM |
1270 | for config in $mak_wilds; do |
1271 | default_target_list="${default_target_list} $(basename "$config" .mak)" | |
1272 | done | |
1273 | ||
c53eeaf7 | 1274 | # Enumerate public trace backends for --help output |
64a6047d | 1275 | trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) |
c53eeaf7 | 1276 | |
af5db58e PB |
1277 | if test x"$show_help" = x"yes" ; then |
1278 | cat << EOF | |
1279 | ||
1280 | Usage: configure [options] | |
1281 | Options: [defaults in brackets after descriptions] | |
1282 | ||
08fb77ed SW |
1283 | Standard options: |
1284 | --help print this message | |
1285 | --prefix=PREFIX install in PREFIX [$prefix] | |
1286 | --interp-prefix=PREFIX where to find shared libraries, etc. | |
1287 | use %M for cpu name [$interp_prefix] | |
1288 | --target-list=LIST set target list (default: build everything) | |
1289 | $(echo Available targets: $default_target_list | \ | |
1290 | fold -s -w 53 | sed -e 's/^/ /') | |
1291 | ||
1292 | Advanced options (experts only): | |
1293 | --source-path=PATH path of source code [$source_path] | |
1294 | --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] | |
1295 | --cc=CC use C compiler CC [$cc] | |
1296 | --iasl=IASL use ACPI compiler IASL [$iasl] | |
1297 | --host-cc=CC use C compiler CC [$host_cc] for code run at | |
1298 | build time | |
1299 | --cxx=CXX use C++ compiler CXX [$cxx] | |
1300 | --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] | |
1301 | --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS | |
1302 | --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS | |
1303 | --make=MAKE use specified make [$make] | |
1304 | --install=INSTALL use specified install [$install] | |
1305 | --python=PYTHON use specified python [$python] | |
1306 | --smbd=SMBD use specified smbd [$smbd] | |
1307 | --static enable static build [$static] | |
1308 | --mandir=PATH install man pages in PATH | |
1309 | --datadir=PATH install firmware in PATH$confsuffix | |
1310 | --docdir=PATH install documentation in PATH$confsuffix | |
1311 | --bindir=PATH install binaries in PATH | |
1312 | --libdir=PATH install libraries in PATH | |
1313 | --sysconfdir=PATH install config in PATH$confsuffix | |
1314 | --localstatedir=PATH install local state in PATH (set at runtime on win32) | |
e26110cf | 1315 | --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] |
08fb77ed | 1316 | --enable-debug enable common debug build options |
08fb77ed SW |
1317 | --disable-strip disable stripping binaries |
1318 | --disable-werror disable compilation abort on warning | |
63678e17 | 1319 | --disable-stack-protector disable compiler-provided stack protection |
08fb77ed SW |
1320 | --audio-drv-list=LIST set audio drivers list: |
1321 | Available drivers: $audio_possible_drivers | |
1322 | --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L | |
1323 | --block-drv-rw-whitelist=L | |
1324 | set block driver read-write whitelist | |
1325 | (affects only QEMU, not qemu-img) | |
1326 | --block-drv-ro-whitelist=L | |
1327 | set block driver read-only whitelist | |
1328 | (affects only QEMU, not qemu-img) | |
5b808275 | 1329 | --enable-trace-backends=B Set trace backend |
c53eeaf7 | 1330 | Available backends: $trace_backend_list |
08fb77ed SW |
1331 | --with-trace-file=NAME Full PATH,NAME of file to store traces |
1332 | Default:trace-<pid> | |
c23f23b9 MT |
1333 | --disable-slirp disable SLIRP userspace network connectivity |
1334 | --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) | |
1335 | --oss-lib path to OSS library | |
1336 | --cpu=CPU Build for host CPU [$cpu] | |
08fb77ed | 1337 | --with-coroutine=BACKEND coroutine backend. Supported options: |
33c53c54 | 1338 | ucontext, sigaltstack, windows |
08fb77ed SW |
1339 | --enable-gcov enable test coverage analysis with gcov |
1340 | --gcov=GCOV use specified gcov [$gcov_tool] | |
c23f23b9 MT |
1341 | --disable-blobs disable installing provided firmware blobs |
1342 | --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent | |
1343 | --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) | |
a1c5e949 | 1344 | --tls-priority default TLS protocol/cipher priority string |
c12d66aa LM |
1345 | --enable-gprof QEMU profiling with gprof |
1346 | --enable-profiler profiler support | |
1347 | --enable-xen-pv-domain-build | |
1348 | xen pv domain builder | |
1349 | --enable-debug-stack-usage | |
1350 | track the maximum stack usage of stacks created by qemu_alloc_stack | |
c23f23b9 MT |
1351 | |
1352 | Optional features, enabled with --enable-FEATURE and | |
1353 | disabled with --disable-FEATURE, default is enabled if available: | |
1354 | ||
1355 | system all system emulation targets | |
1356 | user supported user emulation targets | |
1357 | linux-user all linux usermode emulation targets | |
1358 | bsd-user all BSD usermode emulation targets | |
c23f23b9 MT |
1359 | docs build documentation |
1360 | guest-agent build the QEMU Guest Agent | |
1361 | guest-agent-msi build guest agent Windows MSI installation package | |
1362 | pie Position Independent Executables | |
1363 | modules modules support | |
1364 | debug-tcg TCG debugging (default is disabled) | |
1365 | debug-info debugging information | |
1366 | sparse sparse checker | |
1367 | ||
ddbb0d09 | 1368 | gnutls GNUTLS cryptography support |
91bfcdb0 DB |
1369 | nettle nettle cryptography support |
1370 | gcrypt libgcrypt cryptography support | |
c23f23b9 MT |
1371 | sdl SDL UI |
1372 | --with-sdlabi select preferred SDL ABI 1.2 or 2.0 | |
1373 | gtk gtk UI | |
1374 | --with-gtkabi select preferred GTK ABI 2.0 or 3.0 | |
1375 | vte vte support for the gtk UI | |
1376 | curses curses UI | |
1377 | vnc VNC UI support | |
c23f23b9 MT |
1378 | vnc-sasl SASL encryption for VNC server |
1379 | vnc-jpeg JPEG lossy compression for VNC server | |
1380 | vnc-png PNG compression for VNC server | |
c23f23b9 MT |
1381 | cocoa Cocoa UI (Mac OS X only) |
1382 | virtfs VirtFS | |
1383 | xen xen backend driver support | |
1384 | xen-pci-passthrough | |
1385 | brlapi BrlAPI (Braile) | |
1386 | curl curl connectivity | |
1387 | fdt fdt device tree | |
1388 | bluez bluez stack connectivity | |
1389 | kvm KVM acceleration support | |
b0cb0a66 | 1390 | hax HAX acceleration support |
c23f23b9 | 1391 | rdma RDMA-based migration support |
c23f23b9 MT |
1392 | vde support for vde network |
1393 | netmap support for netmap network | |
1394 | linux-aio Linux AIO support | |
1395 | cap-ng libcap-ng support | |
1396 | attr attr and xattr support | |
1397 | vhost-net vhost-net acceleration support | |
1398 | spice spice | |
1399 | rbd rados block device (rbd) | |
1400 | libiscsi iscsi support | |
1401 | libnfs nfs support | |
7b02f544 | 1402 | smartcard smartcard support (libcacard) |
c23f23b9 MT |
1403 | libusb libusb (for usb passthrough) |
1404 | usb-redir usb network redirection support | |
1405 | lzo support of lzo compression library | |
1406 | snappy support of snappy compression library | |
1407 | bzip2 support of bzip2 compression library | |
1408 | (for reading bzip2-compressed dmg images) | |
1409 | seccomp seccomp support | |
1410 | coroutine-pool coroutine freelist (better performance) | |
1411 | glusterfs GlusterFS backend | |
c23f23b9 MT |
1412 | tpm TPM support |
1413 | libssh2 ssh block device support | |
c23f23b9 MT |
1414 | numa libnuma support |
1415 | tcmalloc tcmalloc support | |
7b01cb97 | 1416 | jemalloc jemalloc support |
a6b1d4c0 | 1417 | replication replication support |
c12d66aa LM |
1418 | vhost-vsock virtio sockets device support |
1419 | opengl opengl support | |
1420 | virglrenderer virgl rendering support | |
1421 | xfsctl xfsctl support | |
1422 | qom-cast-debug cast debugging support | |
1423 | tools build qemu-io, qemu-nbd and qemu-image tools | |
da92c3ff | 1424 | vxhs Veritas HyperScale vDisk backend support |
08fb77ed SW |
1425 | |
1426 | NOTE: The object files are built at the place where configure is launched | |
af5db58e | 1427 | EOF |
2d2ad6d0 | 1428 | exit 0 |
af5db58e PB |
1429 | fi |
1430 | ||
c53eeaf7 SH |
1431 | if ! has $python; then |
1432 | error_exit "Python not found. Use --python=/path/to/python" | |
1433 | fi | |
1434 | ||
1435 | # Note that if the Python conditional here evaluates True we will exit | |
1436 | # with status 1 which is a shell 'false' value. | |
1437 | if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then | |
1438 | error_exit "Cannot use '$python', Python 2.6 or later is required." \ | |
1439 | "Note that Python 3 or later is not yet supported." \ | |
1440 | "Use --python=/path/to/python to specify a supported Python." | |
1441 | fi | |
1442 | ||
1443 | # Suppress writing compiled files | |
1444 | python="$python -B" | |
1445 | ||
359bc95d PM |
1446 | # Now we have handled --enable-tcg-interpreter and know we're not just |
1447 | # printing the help message, bail out if the host CPU isn't supported. | |
1448 | if test "$ARCH" = "unknown"; then | |
1449 | if test "$tcg_interpreter" = "yes" ; then | |
1450 | echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" | |
359bc95d | 1451 | else |
76ad07a4 | 1452 | error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter" |
359bc95d PM |
1453 | fi |
1454 | fi | |
1455 | ||
9c83ffd8 PM |
1456 | # Consult white-list to determine whether to enable werror |
1457 | # by default. Only enable by default for git builds | |
9c83ffd8 PM |
1458 | if test -z "$werror" ; then |
1459 | if test -d "$source_path/.git" -a \ | |
e4650c81 | 1460 | \( "$linux" = "yes" -o "$mingw32" = "yes" \) ; then |
9c83ffd8 PM |
1461 | werror="yes" |
1462 | else | |
1463 | werror="no" | |
1464 | fi | |
1465 | fi | |
1466 | ||
8d05095c | 1467 | # check that the C compiler works. |
93b25869 | 1468 | write_c_skeleton; |
8d05095c PB |
1469 | if compile_object ; then |
1470 | : C compiler works ok | |
1471 | else | |
76ad07a4 | 1472 | error_exit "\"$cc\" either does not exist or does not work" |
8d05095c | 1473 | fi |
0ef74c74 PM |
1474 | if ! compile_prog ; then |
1475 | error_exit "\"$cc\" cannot build an executable (is your linker broken?)" | |
1476 | fi | |
8d05095c | 1477 | |
fb59dabd PM |
1478 | if test "$bogus_os" = "yes"; then |
1479 | # Now that we know that we're not printing the help and that | |
1480 | # the compiler works (so the results of the check_defines we used | |
1481 | # to identify the OS are reliable), if we didn't recognize the | |
1482 | # host OS we should stop now. | |
1483 | error_exit "Unrecognized host OS $targetos" | |
1484 | fi | |
1485 | ||
98b21dcd PM |
1486 | # Check that the C++ compiler exists and works with the C compiler |
1487 | if has $cxx; then | |
1488 | cat > $TMPC <<EOF | |
1489 | int c_function(void); | |
1490 | int main(void) { return c_function(); } | |
1491 | EOF | |
1492 | ||
1493 | compile_object | |
1494 | ||
9c83ffd8 | 1495 | cat > $TMPCXX <<EOF |
98b21dcd PM |
1496 | extern "C" { |
1497 | int c_function(void); | |
1498 | } | |
1499 | int c_function(void) { return 42; } | |
1500 | EOF | |
1501 | ||
9c83ffd8 PM |
1502 | update_cxxflags |
1503 | ||
1504 | if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then | |
98b21dcd PM |
1505 | # C++ compiler $cxx works ok with C compiler $cc |
1506 | : | |
1507 | else | |
1508 | echo "C++ compiler $cxx does not work with C compiler $cc" | |
1509 | echo "Disabling C++ specific optional code" | |
1510 | cxx= | |
1511 | fi | |
1512 | else | |
1513 | echo "No C++ compiler available; disabling C++ specific optional code" | |
1514 | cxx= | |
1515 | fi | |
1516 | ||
8d05095c PB |
1517 | gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" |
1518 | gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" | |
ac7568bd | 1519 | gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" |
435405ac | 1520 | gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags" |
c1556a81 | 1521 | gcc_flags="-Wno-initializer-overrides $gcc_flags" |
71429097 | 1522 | gcc_flags="-Wno-string-plus-int $gcc_flags" |
6ca026cb PM |
1523 | # Note that we do not add -Werror to gcc_flags here, because that would |
1524 | # enable it for all configure tests. If a configure test failed due | |
1525 | # to -Werror this would just silently disable some features, | |
1526 | # so it's too error prone. | |
93b25869 JS |
1527 | |
1528 | cc_has_warning_flag() { | |
1529 | write_c_skeleton; | |
1530 | ||
a1d29d6c PM |
1531 | # Use the positive sense of the flag when testing for -Wno-wombat |
1532 | # support (gcc will happily accept the -Wno- form of unknown | |
1533 | # warning options). | |
93b25869 JS |
1534 | optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" |
1535 | compile_prog "-Werror $optflag" "" | |
1536 | } | |
1537 | ||
1538 | for flag in $gcc_flags; do | |
1539 | if cc_has_warning_flag $flag ; then | |
1540 | QEMU_CFLAGS="$QEMU_CFLAGS $flag" | |
8d05095c PB |
1541 | fi |
1542 | done | |
1543 | ||
3b463a3f | 1544 | if test "$stack_protector" != "no"; then |
fccd35a0 RR |
1545 | cat > $TMPC << EOF |
1546 | int main(int argc, char *argv[]) | |
1547 | { | |
1548 | char arr[64], *p = arr, *c = argv[0]; | |
1549 | while (*c) { | |
1550 | *p++ = *c++; | |
1551 | } | |
1552 | return 0; | |
1553 | } | |
1554 | EOF | |
63678e17 | 1555 | gcc_flags="-fstack-protector-strong -fstack-protector-all" |
3b463a3f | 1556 | sp_on=0 |
63678e17 | 1557 | for flag in $gcc_flags; do |
590e5dd9 PM |
1558 | # We need to check both a compile and a link, since some compiler |
1559 | # setups fail only on a .c->.o compile and some only at link time | |
1560 | if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC && | |
1561 | compile_prog "-Werror $flag" ""; then | |
63678e17 | 1562 | QEMU_CFLAGS="$QEMU_CFLAGS $flag" |
3b463a3f | 1563 | sp_on=1 |
63678e17 SN |
1564 | break |
1565 | fi | |
1566 | done | |
3b463a3f MR |
1567 | if test "$stack_protector" = yes; then |
1568 | if test $sp_on = 0; then | |
1569 | error_exit "Stack protector not supported" | |
1570 | fi | |
1571 | fi | |
37746c5e MAL |
1572 | fi |
1573 | ||
cbdd1999 PB |
1574 | # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and |
1575 | # large functions that use global variables. The bug is in all releases of | |
1576 | # GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in | |
1577 | # 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013. | |
1578 | cat > $TMPC << EOF | |
1579 | #if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2)) | |
1580 | int main(void) { return 0; } | |
1581 | #else | |
1582 | #error No bug in this compiler. | |
1583 | #endif | |
1584 | EOF | |
1585 | if compile_prog "-Werror -fno-gcse" "" ; then | |
1586 | TRANSLATE_OPT_CFLAGS=-fno-gcse | |
1587 | fi | |
1588 | ||
40d6444e | 1589 | if test "$static" = "yes" ; then |
aa0d1f44 PB |
1590 | if test "$modules" = "yes" ; then |
1591 | error_exit "static and modules are mutually incompatible" | |
1592 | fi | |
40d6444e | 1593 | if test "$pie" = "yes" ; then |
76ad07a4 | 1594 | error_exit "static and pie are mutually incompatible" |
40d6444e AK |
1595 | else |
1596 | pie="no" | |
1597 | fi | |
1598 | fi | |
1599 | ||
768b7855 EC |
1600 | # Unconditional check for compiler __thread support |
1601 | cat > $TMPC << EOF | |
1602 | static __thread int tls_var; | |
1603 | int main(void) { return tls_var; } | |
1604 | EOF | |
1605 | ||
1606 | if ! compile_prog "-Werror" "" ; then | |
1607 | error_exit "Your compiler does not support the __thread specifier for " \ | |
1608 | "Thread-Local Storage (TLS). Please upgrade to a version that does." | |
1609 | fi | |
1610 | ||
40d6444e AK |
1611 | if test "$pie" = ""; then |
1612 | case "$cpu-$targetos" in | |
c72b26ec | 1613 | i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD) |
40d6444e AK |
1614 | ;; |
1615 | *) | |
1616 | pie="no" | |
1617 | ;; | |
1618 | esac | |
1619 | fi | |
1620 | ||
1621 | if test "$pie" != "no" ; then | |
1622 | cat > $TMPC << EOF | |
21d4a791 AK |
1623 | |
1624 | #ifdef __linux__ | |
1625 | # define THREAD __thread | |
1626 | #else | |
1627 | # define THREAD | |
1628 | #endif | |
1629 | ||
1630 | static THREAD int tls_var; | |
1631 | ||
1632 | int main(void) { return tls_var; } | |
1633 | ||
40d6444e AK |
1634 | EOF |
1635 | if compile_prog "-fPIE -DPIE" "-pie"; then | |
1636 | QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" | |
1637 | LDFLAGS="-pie $LDFLAGS" | |
1638 | pie="yes" | |
1639 | if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then | |
1640 | LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" | |
1641 | fi | |
1642 | else | |
1643 | if test "$pie" = "yes"; then | |
76ad07a4 | 1644 | error_exit "PIE not available due to missing toolchain support" |
40d6444e AK |
1645 | else |
1646 | echo "Disabling PIE due to missing toolchain support" | |
1647 | pie="no" | |
1648 | fi | |
1649 | fi | |
46eef33b | 1650 | |
e4a7b344 | 1651 | if compile_prog "-Werror -fno-pie" "-nopie"; then |
46eef33b BS |
1652 | CFLAGS_NOPIE="-fno-pie" |
1653 | LDFLAGS_NOPIE="-nopie" | |
1654 | fi | |
40d6444e AK |
1655 | fi |
1656 | ||
09dada40 PB |
1657 | ########################################## |
1658 | # __sync_fetch_and_and requires at least -march=i486. Many toolchains | |
1659 | # use i686 as default anyway, but for those that don't, an explicit | |
1660 | # specification is necessary | |
1661 | ||
1662 | if test "$cpu" = "i386"; then | |
1663 | cat > $TMPC << EOF | |
1664 | static int sfaa(int *ptr) | |
1665 | { | |
1666 | return __sync_fetch_and_and(ptr, 0); | |
1667 | } | |
1668 | ||
1669 | int main(void) | |
1670 | { | |
1671 | int val = 42; | |
1405b629 | 1672 | val = __sync_val_compare_and_swap(&val, 0, 1); |
09dada40 PB |
1673 | sfaa(&val); |
1674 | return val; | |
1675 | } | |
1676 | EOF | |
1677 | if ! compile_prog "" "" ; then | |
1678 | QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" | |
1679 | fi | |
1680 | fi | |
1681 | ||
1682 | ######################################### | |
ec530c81 | 1683 | # Solaris specific configure tool chain decisions |
09dada40 | 1684 | |
ec530c81 | 1685 | if test "$solaris" = "yes" ; then |
6792aa11 LM |
1686 | if has $install; then |
1687 | : | |
1688 | else | |
76ad07a4 PM |
1689 | error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \ |
1690 | "install fileutils from www.blastwave.org using pkg-get -i fileutils" \ | |
1691 | "to get ginstall which is used by default (which lives in /opt/csw/bin)" | |
ec530c81 | 1692 | fi |
89138857 | 1693 | if test "$(path_of $install)" = "/usr/sbin/install" ; then |
76ad07a4 PM |
1694 | error_exit "Solaris /usr/sbin/install is not an appropriate install program." \ |
1695 | "try ginstall from the GNU fileutils available from www.blastwave.org" \ | |
1696 | "using pkg-get -i fileutils, or use --install=/usr/ucb/install" | |
ec530c81 | 1697 | fi |
6792aa11 LM |
1698 | if has ar; then |
1699 | : | |
1700 | else | |
ec530c81 | 1701 | if test -f /usr/ccs/bin/ar ; then |
76ad07a4 PM |
1702 | error_exit "No path includes ar" \ |
1703 | "Add /usr/ccs/bin to your path and rerun configure" | |
ec530c81 | 1704 | fi |
76ad07a4 | 1705 | error_exit "No path includes ar" |
ec530c81 | 1706 | fi |
5fafdf24 | 1707 | fi |
ec530c81 | 1708 | |
afb63ebd | 1709 | if test -z "${target_list+xxx}" ; then |
121afa9e AL |
1710 | target_list="$default_target_list" |
1711 | else | |
89138857 | 1712 | target_list=$(echo "$target_list" | sed -e 's/,/ /g') |
121afa9e | 1713 | fi |
25b48338 PM |
1714 | |
1715 | # Check that we recognised the target name; this allows a more | |
1716 | # friendly error message than if we let it fall through. | |
1717 | for target in $target_list; do | |
1718 | case " $default_target_list " in | |
1719 | *" $target "*) | |
1720 | ;; | |
1721 | *) | |
1722 | error_exit "Unknown target name '$target'" | |
1723 | ;; | |
1724 | esac | |
1725 | done | |
1726 | ||
f55fe278 PB |
1727 | # see if system emulation was really requested |
1728 | case " $target_list " in | |
1729 | *"-softmmu "*) softmmu=yes | |
1730 | ;; | |
1731 | *) softmmu=no | |
1732 | ;; | |
1733 | esac | |
5327cf48 | 1734 | |
249247c9 JQ |
1735 | feature_not_found() { |
1736 | feature=$1 | |
21684af0 | 1737 | remedy=$2 |
249247c9 | 1738 | |
76ad07a4 | 1739 | error_exit "User requested feature $feature" \ |
21684af0 SS |
1740 | "configure was not able to find it." \ |
1741 | "$remedy" | |
249247c9 JQ |
1742 | } |
1743 | ||
7d13299d FB |
1744 | # --- |
1745 | # big/little endian test | |
1746 | cat > $TMPC << EOF | |
61cc919f MF |
1747 | short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; |
1748 | short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; | |
1749 | extern int foo(short *, short *); | |
1750 | int main(int argc, char *argv[]) { | |
1751 | return foo(big_endian, little_endian); | |
7d13299d FB |
1752 | } |
1753 | EOF | |
1754 | ||
61cc919f MF |
1755 | if compile_object ; then |
1756 | if grep -q BiGeNdIaN $TMPO ; then | |
1757 | bigendian="yes" | |
1758 | elif grep -q LiTtLeEnDiAn $TMPO ; then | |
1759 | bigendian="no" | |
1760 | else | |
1761 | echo big/little test failed | |
21d89f84 | 1762 | fi |
61cc919f MF |
1763 | else |
1764 | echo big/little test failed | |
7d13299d FB |
1765 | fi |
1766 | ||
a30878e7 PM |
1767 | ########################################## |
1768 | # cocoa implies not SDL or GTK | |
1769 | # (the cocoa UI code currently assumes it is always the active UI | |
1770 | # and doesn't interact well with other UI frontend code) | |
1771 | if test "$cocoa" = "yes"; then | |
1772 | if test "$sdl" = "yes"; then | |
1773 | error_exit "Cocoa and SDL UIs cannot both be enabled at once" | |
1774 | fi | |
1775 | if test "$gtk" = "yes"; then | |
1776 | error_exit "Cocoa and GTK UIs cannot both be enabled at once" | |
1777 | fi | |
1778 | gtk=no | |
1779 | sdl=no | |
1780 | fi | |
1781 | ||
6b39b063 EB |
1782 | # Some versions of Mac OS X incorrectly define SIZE_MAX |
1783 | cat > $TMPC << EOF | |
1784 | #include <stdint.h> | |
1785 | #include <stdio.h> | |
1786 | int main(int argc, char *argv[]) { | |
1787 | return printf("%zu", SIZE_MAX); | |
1788 | } | |
1789 | EOF | |
1790 | have_broken_size_max=no | |
1791 | if ! compile_object -Werror ; then | |
1792 | have_broken_size_max=yes | |
1793 | fi | |
1794 | ||
015a33bd GA |
1795 | ########################################## |
1796 | # L2TPV3 probe | |
1797 | ||
1798 | cat > $TMPC <<EOF | |
1799 | #include <sys/socket.h> | |
bff6cb72 | 1800 | #include <linux/ip.h> |
015a33bd GA |
1801 | int main(void) { return sizeof(struct mmsghdr); } |
1802 | EOF | |
1803 | if compile_prog "" "" ; then | |
1804 | l2tpv3=yes | |
1805 | else | |
1806 | l2tpv3=no | |
1807 | fi | |
1808 | ||
4d9310f4 DB |
1809 | ########################################## |
1810 | # MinGW / Mingw-w64 localtime_r/gmtime_r check | |
1811 | ||
1812 | if test "$mingw32" = "yes"; then | |
1813 | # Some versions of MinGW / Mingw-w64 lack localtime_r | |
1814 | # and gmtime_r entirely. | |
1815 | # | |
1816 | # Some versions of Mingw-w64 define a macro for | |
1817 | # localtime_r/gmtime_r. | |
1818 | # | |
1819 | # Some versions of Mingw-w64 will define functions | |
1820 | # for localtime_r/gmtime_r, but only if you have | |
1821 | # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun | |
1822 | # though, unistd.h and pthread.h both define | |
1823 | # that for you. | |
1824 | # | |
1825 | # So this #undef localtime_r and #include <unistd.h> | |
1826 | # are not in fact redundant. | |
1827 | cat > $TMPC << EOF | |
1828 | #include <unistd.h> | |
1829 | #include <time.h> | |
1830 | #undef localtime_r | |
1831 | int main(void) { localtime_r(NULL, NULL); return 0; } | |
1832 | EOF | |
1833 | if compile_prog "" "" ; then | |
1834 | localtime_r="yes" | |
1835 | else | |
1836 | localtime_r="no" | |
1837 | fi | |
1838 | fi | |
1839 | ||
779ab5e3 SW |
1840 | ########################################## |
1841 | # pkg-config probe | |
1842 | ||
1843 | if ! has "$pkg_config_exe"; then | |
76ad07a4 | 1844 | error_exit "pkg-config binary '$pkg_config_exe' not found" |
779ab5e3 SW |
1845 | fi |
1846 | ||
b0a47e79 JQ |
1847 | ########################################## |
1848 | # NPTL probe | |
1849 | ||
24cb36a6 | 1850 | if test "$linux_user" = "yes"; then |
b0a47e79 | 1851 | cat > $TMPC <<EOF |
bd0c5661 | 1852 | #include <sched.h> |
30813cea | 1853 | #include <linux/futex.h> |
182eacc0 | 1854 | int main(void) { |
bd0c5661 PB |
1855 | #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) |
1856 | #error bork | |
1857 | #endif | |
182eacc0 | 1858 | return 0; |
bd0c5661 PB |
1859 | } |
1860 | EOF | |
24cb36a6 | 1861 | if ! compile_object ; then |
21684af0 | 1862 | feature_not_found "nptl" "Install glibc and linux kernel headers." |
b0a47e79 | 1863 | fi |
bd0c5661 PB |
1864 | fi |
1865 | ||
ac62922e | 1866 | ########################################## |
99f2dbd3 LL |
1867 | # avx2 optimization requirement check |
1868 | ||
5e33a872 | 1869 | cat > $TMPC << EOF |
4fb8320a DDAG |
1870 | #pragma GCC push_options |
1871 | #pragma GCC target("avx2") | |
1872 | #include <cpuid.h> | |
1873 | #include <immintrin.h> | |
4fb8320a | 1874 | static int bar(void *a) { |
5e33a872 RH |
1875 | __m256i x = *(__m256i *)a; |
1876 | return _mm256_testz_si256(x, x); | |
4fb8320a | 1877 | } |
5e33a872 | 1878 | int main(int argc, char *argv[]) { return bar(argv[0]); } |
99f2dbd3 | 1879 | EOF |
5e33a872 RH |
1880 | if compile_object "" ; then |
1881 | avx2_opt="yes" | |
99f2dbd3 LL |
1882 | fi |
1883 | ||
1884 | ######################################### | |
ac62922e AZ |
1885 | # zlib check |
1886 | ||
1ece9905 AL |
1887 | if test "$zlib" != "no" ; then |
1888 | cat > $TMPC << EOF | |
ac62922e AZ |
1889 | #include <zlib.h> |
1890 | int main(void) { zlibVersion(); return 0; } | |
1891 | EOF | |
1ece9905 AL |
1892 | if compile_prog "" "-lz" ; then |
1893 | : | |
1894 | else | |
76ad07a4 PM |
1895 | error_exit "zlib check failed" \ |
1896 | "Make sure to have the zlib libs and headers installed." | |
1ece9905 | 1897 | fi |
ac62922e | 1898 | fi |
eb0ecd5a | 1899 | LIBS="$LIBS -lz" |
ac62922e | 1900 | |
607dacd0 QN |
1901 | ########################################## |
1902 | # lzo check | |
1903 | ||
1904 | if test "$lzo" != "no" ; then | |
1905 | cat > $TMPC << EOF | |
1906 | #include <lzo/lzo1x.h> | |
1907 | int main(void) { lzo_version(); return 0; } | |
1908 | EOF | |
1909 | if compile_prog "" "-llzo2" ; then | |
b25c9dff SW |
1910 | libs_softmmu="$libs_softmmu -llzo2" |
1911 | lzo="yes" | |
607dacd0 | 1912 | else |
b25c9dff SW |
1913 | if test "$lzo" = "yes"; then |
1914 | feature_not_found "liblzo2" "Install liblzo2 devel" | |
1915 | fi | |
1916 | lzo="no" | |
607dacd0 | 1917 | fi |
607dacd0 QN |
1918 | fi |
1919 | ||
1920 | ########################################## | |
1921 | # snappy check | |
1922 | ||
1923 | if test "$snappy" != "no" ; then | |
1924 | cat > $TMPC << EOF | |
1925 | #include <snappy-c.h> | |
1926 | int main(void) { snappy_max_compressed_length(4096); return 0; } | |
1927 | EOF | |
1928 | if compile_prog "" "-lsnappy" ; then | |
b25c9dff SW |
1929 | libs_softmmu="$libs_softmmu -lsnappy" |
1930 | snappy="yes" | |
607dacd0 | 1931 | else |
b25c9dff SW |
1932 | if test "$snappy" = "yes"; then |
1933 | feature_not_found "libsnappy" "Install libsnappy devel" | |
1934 | fi | |
1935 | snappy="no" | |
607dacd0 | 1936 | fi |
607dacd0 QN |
1937 | fi |
1938 | ||
6b383c08 PW |
1939 | ########################################## |
1940 | # bzip2 check | |
1941 | ||
1942 | if test "$bzip2" != "no" ; then | |
1943 | cat > $TMPC << EOF | |
1944 | #include <bzlib.h> | |
1945 | int main(void) { BZ2_bzlibVersion(); return 0; } | |
1946 | EOF | |
1947 | if compile_prog "" "-lbz2" ; then | |
1948 | bzip2="yes" | |
1949 | else | |
1950 | if test "$bzip2" = "yes"; then | |
1951 | feature_not_found "libbzip2" "Install libbzip2 devel" | |
1952 | fi | |
1953 | bzip2="no" | |
1954 | fi | |
1955 | fi | |
1956 | ||
f794573e EO |
1957 | ########################################## |
1958 | # libseccomp check | |
1959 | ||
1960 | if test "$seccomp" != "no" ; then | |
693e5910 AJ |
1961 | case "$cpu" in |
1962 | i386|x86_64) | |
ba060c53 | 1963 | libseccomp_minver="2.1.0" |
693e5910 | 1964 | ;; |
5ce43972 JH |
1965 | mips) |
1966 | libseccomp_minver="2.2.0" | |
1967 | ;; | |
693e5910 AJ |
1968 | arm|aarch64) |
1969 | libseccomp_minver="2.2.3" | |
1970 | ;; | |
3e684455 MS |
1971 | ppc|ppc64) |
1972 | libseccomp_minver="2.3.0" | |
1973 | ;; | |
693e5910 AJ |
1974 | *) |
1975 | libseccomp_minver="" | |
1976 | ;; | |
1977 | esac | |
1978 | ||
1979 | if test "$libseccomp_minver" != "" && | |
1980 | $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then | |
89138857 SW |
1981 | libs_softmmu="$libs_softmmu $($pkg_config --libs libseccomp)" |
1982 | QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags libseccomp)" | |
693e5910 | 1983 | seccomp="yes" |
f794573e | 1984 | else |
693e5910 AJ |
1985 | if test "$seccomp" = "yes" ; then |
1986 | if test "$libseccomp_minver" != "" ; then | |
1987 | feature_not_found "libseccomp" \ | |
1988 | "Install libseccomp devel >= $libseccomp_minver" | |
1989 | else | |
1990 | feature_not_found "libseccomp" \ | |
1991 | "libseccomp is not supported for host cpu $cpu" | |
1992 | fi | |
1993 | fi | |
1994 | seccomp="no" | |
f794573e EO |
1995 | fi |
1996 | fi | |
e37630ca AL |
1997 | ########################################## |
1998 | # xen probe | |
1999 | ||
fc321b4b | 2000 | if test "$xen" != "no" ; then |
c1cdd9d5 JG |
2001 | # Check whether Xen library path is specified via --extra-ldflags to avoid |
2002 | # overriding this setting with pkg-config output. If not, try pkg-config | |
2003 | # to obtain all needed flags. | |
2004 | ||
2005 | if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ | |
2006 | $pkg_config --exists xencontrol ; then | |
2007 | xen_ctrl_version="$(printf '%d%02d%02d' \ | |
2008 | $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" | |
2009 | xen=yes | |
2010 | xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab" | |
2011 | xen_pc="$xen_pc xenevtchn xendevicemodel" | |
2012 | QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)" | |
2013 | libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu" | |
2014 | LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS" | |
2015 | else | |
d5b93ddf | 2016 | |
c1cdd9d5 | 2017 | xen_libs="-lxenstore -lxenctrl -lxenguest" |
d9506cab | 2018 | xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" |
50ced5b3 | 2019 | |
c1cdd9d5 JG |
2020 | # First we test whether Xen headers and libraries are available. |
2021 | # If no, we are done and there is no Xen support. | |
2022 | # If yes, more tests are run to detect the Xen version. | |
2023 | ||
2024 | # Xen (any) | |
2025 | cat > $TMPC <<EOF | |
e37630ca | 2026 | #include <xenctrl.h> |
50ced5b3 SW |
2027 | int main(void) { |
2028 | return 0; | |
2029 | } | |
2030 | EOF | |
c1cdd9d5 JG |
2031 | if ! compile_prog "" "$xen_libs" ; then |
2032 | # Xen not found | |
2033 | if test "$xen" = "yes" ; then | |
2034 | feature_not_found "xen" "Install xen devel" | |
2035 | fi | |
2036 | xen=no | |
50ced5b3 | 2037 | |
c1cdd9d5 JG |
2038 | # Xen unstable |
2039 | elif | |
2040 | cat > $TMPC <<EOF && | |
da8090cc PD |
2041 | #undef XC_WANT_COMPAT_DEVICEMODEL_API |
2042 | #define __XEN_TOOLS__ | |
2043 | #include <xendevicemodel.h> | |
2044 | int main(void) { | |
2045 | xendevicemodel_handle *xd; | |
2046 | ||
2047 | xd = xendevicemodel_open(0, 0); | |
2048 | xendevicemodel_close(xd); | |
50ced5b3 | 2049 | |
da8090cc PD |
2050 | return 0; |
2051 | } | |
2052 | EOF | |
c1cdd9d5 JG |
2053 | compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" |
2054 | then | |
2055 | xen_stable_libs="-lxendevicemodel $xen_stable_libs" | |
2056 | xen_ctrl_version=40900 | |
2057 | xen=yes | |
2058 | elif | |
2059 | cat > $TMPC <<EOF && | |
b6eb9b45 PS |
2060 | /* |
2061 | * If we have stable libs the we don't want the libxc compat | |
2062 | * layers, regardless of what CFLAGS we may have been given. | |
2063 | * | |
2064 | * Also, check if xengnttab_grant_copy_segment_t is defined and | |
2065 | * grant copy operation is implemented. | |
2066 | */ | |
2067 | #undef XC_WANT_COMPAT_EVTCHN_API | |
2068 | #undef XC_WANT_COMPAT_GNTTAB_API | |
2069 | #undef XC_WANT_COMPAT_MAP_FOREIGN_API | |
2070 | #include <xenctrl.h> | |
2071 | #include <xenstore.h> | |
2072 | #include <xenevtchn.h> | |
2073 | #include <xengnttab.h> | |
2074 | #include <xenforeignmemory.h> | |
2075 | #include <stdint.h> | |
2076 | #include <xen/hvm/hvm_info_table.h> | |
2077 | #if !defined(HVM_MAX_VCPUS) | |
2078 | # error HVM_MAX_VCPUS not defined | |
2079 | #endif | |
2080 | int main(void) { | |
2081 | xc_interface *xc = NULL; | |
2082 | xenforeignmemory_handle *xfmem; | |
2083 | xenevtchn_handle *xe; | |
2084 | xengnttab_handle *xg; | |
2085 | xen_domain_handle_t handle; | |
2086 | xengnttab_grant_copy_segment_t* seg = NULL; | |
2087 | ||
2088 | xs_daemon_open(); | |
2089 | ||
2090 | xc = xc_interface_open(0, 0, 0); | |
2091 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2092 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2093 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2094 | xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); | |
2095 | xc_domain_create(xc, 0, handle, 0, NULL, NULL); | |
2096 | ||
2097 | xfmem = xenforeignmemory_open(0, 0); | |
2098 | xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); | |
2099 | ||
2100 | xe = xenevtchn_open(0, 0); | |
2101 | xenevtchn_fd(xe); | |
2102 | ||
2103 | xg = xengnttab_open(0, 0); | |
2104 | xengnttab_grant_copy(xg, 0, seg); | |
2105 | ||
2106 | return 0; | |
2107 | } | |
2108 | EOF | |
c1cdd9d5 JG |
2109 | compile_prog "" "$xen_libs $xen_stable_libs" |
2110 | then | |
2111 | xen_ctrl_version=40800 | |
2112 | xen=yes | |
2113 | elif | |
2114 | cat > $TMPC <<EOF && | |
5eeb39c2 IC |
2115 | /* |
2116 | * If we have stable libs the we don't want the libxc compat | |
2117 | * layers, regardless of what CFLAGS we may have been given. | |
2118 | */ | |
2119 | #undef XC_WANT_COMPAT_EVTCHN_API | |
2120 | #undef XC_WANT_COMPAT_GNTTAB_API | |
2121 | #undef XC_WANT_COMPAT_MAP_FOREIGN_API | |
2122 | #include <xenctrl.h> | |
2123 | #include <xenstore.h> | |
2124 | #include <xenevtchn.h> | |
2125 | #include <xengnttab.h> | |
2126 | #include <xenforeignmemory.h> | |
2127 | #include <stdint.h> | |
2128 | #include <xen/hvm/hvm_info_table.h> | |
2129 | #if !defined(HVM_MAX_VCPUS) | |
2130 | # error HVM_MAX_VCPUS not defined | |
2131 | #endif | |
2132 | int main(void) { | |
2133 | xc_interface *xc = NULL; | |
2134 | xenforeignmemory_handle *xfmem; | |
2135 | xenevtchn_handle *xe; | |
2136 | xengnttab_handle *xg; | |
2137 | xen_domain_handle_t handle; | |
2138 | ||
2139 | xs_daemon_open(); | |
2140 | ||
2141 | xc = xc_interface_open(0, 0, 0); | |
2142 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2143 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2144 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2145 | xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); | |
2146 | xc_domain_create(xc, 0, handle, 0, NULL, NULL); | |
2147 | ||
2148 | xfmem = xenforeignmemory_open(0, 0); | |
2149 | xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); | |
2150 | ||
2151 | xe = xenevtchn_open(0, 0); | |
2152 | xenevtchn_fd(xe); | |
2153 | ||
2154 | xg = xengnttab_open(0, 0); | |
2155 | xengnttab_map_grant_ref(xg, 0, 0, 0); | |
2156 | ||
2157 | return 0; | |
2158 | } | |
2159 | EOF | |
c1cdd9d5 JG |
2160 | compile_prog "" "$xen_libs $xen_stable_libs" |
2161 | then | |
2162 | xen_ctrl_version=40701 | |
2163 | xen=yes | |
2164 | elif | |
2165 | cat > $TMPC <<EOF && | |
50ced5b3 | 2166 | #include <xenctrl.h> |
cdadde39 RPM |
2167 | #include <stdint.h> |
2168 | int main(void) { | |
2169 | xc_interface *xc = NULL; | |
2170 | xen_domain_handle_t handle; | |
2171 | xc_domain_create(xc, 0, handle, 0, NULL, NULL); | |
2172 | return 0; | |
2173 | } | |
2174 | EOF | |
c1cdd9d5 JG |
2175 | compile_prog "" "$xen_libs" |
2176 | then | |
2177 | xen_ctrl_version=40700 | |
2178 | xen=yes | |
2179 | ||
2180 | # Xen 4.6 | |
2181 | elif | |
2182 | cat > $TMPC <<EOF && | |
cdadde39 | 2183 | #include <xenctrl.h> |
e108a3c1 | 2184 | #include <xenstore.h> |
d5b93ddf AP |
2185 | #include <stdint.h> |
2186 | #include <xen/hvm/hvm_info_table.h> | |
2187 | #if !defined(HVM_MAX_VCPUS) | |
2188 | # error HVM_MAX_VCPUS not defined | |
2189 | #endif | |
d8b441a3 JB |
2190 | int main(void) { |
2191 | xc_interface *xc; | |
2192 | xs_daemon_open(); | |
2193 | xc = xc_interface_open(0, 0, 0); | |
2194 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2195 | xc_gnttab_open(NULL, 0); | |
2196 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2197 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2198 | xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); | |
20a544c7 | 2199 | xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); |
d8b441a3 JB |
2200 | return 0; |
2201 | } | |
2202 | EOF | |
c1cdd9d5 JG |
2203 | compile_prog "" "$xen_libs" |
2204 | then | |
2205 | xen_ctrl_version=40600 | |
2206 | xen=yes | |
2207 | ||
2208 | # Xen 4.5 | |
2209 | elif | |
2210 | cat > $TMPC <<EOF && | |
d8b441a3 JB |
2211 | #include <xenctrl.h> |
2212 | #include <xenstore.h> | |
2213 | #include <stdint.h> | |
2214 | #include <xen/hvm/hvm_info_table.h> | |
2215 | #if !defined(HVM_MAX_VCPUS) | |
2216 | # error HVM_MAX_VCPUS not defined | |
2217 | #endif | |
3996e85c PD |
2218 | int main(void) { |
2219 | xc_interface *xc; | |
2220 | xs_daemon_open(); | |
2221 | xc = xc_interface_open(0, 0, 0); | |
2222 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2223 | xc_gnttab_open(NULL, 0); | |
2224 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2225 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2226 | xc_hvm_create_ioreq_server(xc, 0, 0, NULL); | |
2227 | return 0; | |
2228 | } | |
2229 | EOF | |
c1cdd9d5 JG |
2230 | compile_prog "" "$xen_libs" |
2231 | then | |
2232 | xen_ctrl_version=40500 | |
2233 | xen=yes | |
3996e85c | 2234 | |
c1cdd9d5 JG |
2235 | elif |
2236 | cat > $TMPC <<EOF && | |
3996e85c PD |
2237 | #include <xenctrl.h> |
2238 | #include <xenstore.h> | |
2239 | #include <stdint.h> | |
2240 | #include <xen/hvm/hvm_info_table.h> | |
2241 | #if !defined(HVM_MAX_VCPUS) | |
2242 | # error HVM_MAX_VCPUS not defined | |
2243 | #endif | |
8688e065 SS |
2244 | int main(void) { |
2245 | xc_interface *xc; | |
2246 | xs_daemon_open(); | |
2247 | xc = xc_interface_open(0, 0, 0); | |
2248 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
2249 | xc_gnttab_open(NULL, 0); | |
2250 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
2251 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
2252 | return 0; | |
2253 | } | |
2254 | EOF | |
c1cdd9d5 JG |
2255 | compile_prog "" "$xen_libs" |
2256 | then | |
2257 | xen_ctrl_version=40200 | |
2258 | xen=yes | |
8688e065 | 2259 | |
c1cdd9d5 JG |
2260 | else |
2261 | if test "$xen" = "yes" ; then | |
2262 | feature_not_found "xen (unsupported version)" \ | |
2263 | "Install a supported xen (xen 4.2 or newer)" | |
2264 | fi | |
2265 | xen=no | |
fc321b4b | 2266 | fi |
d5b93ddf | 2267 | |
c1cdd9d5 JG |
2268 | if test "$xen" = yes; then |
2269 | if test $xen_ctrl_version -ge 40701 ; then | |
2270 | libs_softmmu="$xen_stable_libs $libs_softmmu" | |
2271 | fi | |
2272 | libs_softmmu="$xen_libs $libs_softmmu" | |
5eeb39c2 | 2273 | fi |
d5b93ddf | 2274 | fi |
e37630ca AL |
2275 | fi |
2276 | ||
eb6fda0f | 2277 | if test "$xen_pci_passthrough" != "no"; then |
edfb07ed | 2278 | if test "$xen" = "yes" && test "$linux" = "yes"; then |
eb6fda0f AP |
2279 | xen_pci_passthrough=yes |
2280 | else | |
2281 | if test "$xen_pci_passthrough" = "yes"; then | |
76ad07a4 PM |
2282 | error_exit "User requested feature Xen PCI Passthrough" \ |
2283 | " but this feature requires /sys from Linux" | |
eb6fda0f AP |
2284 | fi |
2285 | xen_pci_passthrough=no | |
2286 | fi | |
2287 | fi | |
2288 | ||
64a7ad6f IC |
2289 | if test "$xen_pv_domain_build" = "yes" && |
2290 | test "$xen" != "yes"; then | |
2291 | error_exit "User requested Xen PV domain builder support" \ | |
2292 | "which requires Xen support." | |
2293 | fi | |
2294 | ||
dfffc653 JQ |
2295 | ########################################## |
2296 | # Sparse probe | |
2297 | if test "$sparse" != "no" ; then | |
0dba6195 | 2298 | if has cgcc; then |
dfffc653 JQ |
2299 | sparse=yes |
2300 | else | |
2301 | if test "$sparse" = "yes" ; then | |
21684af0 | 2302 | feature_not_found "sparse" "Install sparse binary" |
dfffc653 JQ |
2303 | fi |
2304 | sparse=no | |
2305 | fi | |
2306 | fi | |
2307 | ||
f676c67e JW |
2308 | ########################################## |
2309 | # X11 probe | |
2310 | x11_cflags= | |
2311 | x11_libs=-lX11 | |
2312 | if $pkg_config --exists "x11"; then | |
89138857 SW |
2313 | x11_cflags=$($pkg_config --cflags x11) |
2314 | x11_libs=$($pkg_config --libs x11) | |
f676c67e JW |
2315 | fi |
2316 | ||
a4ccabcf AL |
2317 | ########################################## |
2318 | # GTK probe | |
2319 | ||
9e04c683 SW |
2320 | if test "$gtkabi" = ""; then |
2321 | # The GTK ABI was not specified explicitly, so try whether 2.0 is available. | |
2322 | # Use 3.0 as a fallback if that is available. | |
2323 | if $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then | |
2324 | gtkabi=2.0 | |
2325 | elif $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then | |
2326 | gtkabi=3.0 | |
2327 | else | |
2328 | gtkabi=2.0 | |
2329 | fi | |
2330 | fi | |
2331 | ||
a4ccabcf | 2332 | if test "$gtk" != "no"; then |
528de90a | 2333 | gtkpackage="gtk+-$gtkabi" |
0a337ed0 | 2334 | gtkx11package="gtk+-x11-$gtkabi" |
528de90a DB |
2335 | if test "$gtkabi" = "3.0" ; then |
2336 | gtkversion="3.0.0" | |
bbbf9bfb SW |
2337 | else |
2338 | gtkversion="2.18.0" | |
2339 | fi | |
2340 | if $pkg_config --exists "$gtkpackage >= $gtkversion"; then | |
89138857 SW |
2341 | gtk_cflags=$($pkg_config --cflags $gtkpackage) |
2342 | gtk_libs=$($pkg_config --libs $gtkpackage) | |
2343 | gtk_version=$($pkg_config --modversion $gtkpackage) | |
0a337ed0 | 2344 | if $pkg_config --exists "$gtkx11package >= $gtkversion"; then |
f676c67e JW |
2345 | gtk_cflags="$gtk_cflags $x11_cflags" |
2346 | gtk_libs="$gtk_libs $x11_libs" | |
0a337ed0 | 2347 | fi |
bbbf9bfb SW |
2348 | libs_softmmu="$gtk_libs $libs_softmmu" |
2349 | gtk="yes" | |
2350 | elif test "$gtk" = "yes"; then | |
9e04c683 | 2351 | feature_not_found "gtk" "Install gtk2 or gtk3 devel" |
bbbf9bfb SW |
2352 | else |
2353 | gtk="no" | |
2354 | fi | |
2355 | fi | |
2356 | ||
ddbb0d09 DB |
2357 | |
2358 | ########################################## | |
2359 | # GNUTLS probe | |
2360 | ||
37371299 PM |
2361 | gnutls_works() { |
2362 | # Unfortunately some distros have bad pkg-config information for gnutls | |
2363 | # such that it claims to exist but you get a compiler error if you try | |
2364 | # to use the options returned by --libs. Specifically, Ubuntu for --static | |
2365 | # builds doesn't work: | |
2366 | # https://bugs.launchpad.net/ubuntu/+source/gnutls26/+bug/1478035 | |
2367 | # | |
2368 | # So sanity check the cflags/libs before assuming gnutls can be used. | |
2369 | if ! $pkg_config --exists "gnutls"; then | |
2370 | return 1 | |
2371 | fi | |
2372 | ||
2373 | write_c_skeleton | |
2374 | compile_prog "$($pkg_config --cflags gnutls)" "$($pkg_config --libs gnutls)" | |
2375 | } | |
2376 | ||
62893b67 | 2377 | gnutls_gcrypt=no |
ed754746 | 2378 | gnutls_nettle=no |
ddbb0d09 | 2379 | if test "$gnutls" != "no"; then |
37371299 | 2380 | if gnutls_works; then |
89138857 SW |
2381 | gnutls_cflags=$($pkg_config --cflags gnutls) |
2382 | gnutls_libs=$($pkg_config --libs gnutls) | |
ddbb0d09 DB |
2383 | libs_softmmu="$gnutls_libs $libs_softmmu" |
2384 | libs_tools="$gnutls_libs $libs_tools" | |
2385 | QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" | |
2386 | gnutls="yes" | |
2387 | ||
b917da4c DB |
2388 | # gnutls_rnd requires >= 2.11.0 |
2389 | if $pkg_config --exists "gnutls >= 2.11.0"; then | |
2390 | gnutls_rnd="yes" | |
2391 | else | |
2392 | gnutls_rnd="no" | |
2393 | fi | |
2394 | ||
62893b67 DB |
2395 | if $pkg_config --exists 'gnutls >= 3.0'; then |
2396 | gnutls_gcrypt=no | |
ed754746 | 2397 | gnutls_nettle=yes |
62893b67 | 2398 | elif $pkg_config --exists 'gnutls >= 2.12'; then |
89138857 | 2399 | case $($pkg_config --libs --static gnutls) in |
ed754746 DB |
2400 | *gcrypt*) |
2401 | gnutls_gcrypt=yes | |
2402 | gnutls_nettle=no | |
2403 | ;; | |
2404 | *nettle*) | |
2405 | gnutls_gcrypt=no | |
2406 | gnutls_nettle=yes | |
2407 | ;; | |
2408 | *) | |
2409 | gnutls_gcrypt=yes | |
2410 | gnutls_nettle=no | |
2411 | ;; | |
62893b67 DB |
2412 | esac |
2413 | else | |
2414 | gnutls_gcrypt=yes | |
ed754746 | 2415 | gnutls_nettle=no |
62893b67 | 2416 | fi |
ddbb0d09 DB |
2417 | elif test "$gnutls" = "yes"; then |
2418 | feature_not_found "gnutls" "Install gnutls devel" | |
2419 | else | |
2420 | gnutls="no" | |
b917da4c | 2421 | gnutls_rnd="no" |
ddbb0d09 DB |
2422 | fi |
2423 | else | |
b917da4c | 2424 | gnutls_rnd="no" |
ddbb0d09 DB |
2425 | fi |
2426 | ||
91bfcdb0 DB |
2427 | |
2428 | # If user didn't give a --disable/enable-gcrypt flag, | |
2429 | # then mark as disabled if user requested nettle | |
2430 | # explicitly, or if gnutls links to nettle | |
2431 | if test -z "$gcrypt" | |
2432 | then | |
2433 | if test "$nettle" = "yes" || test "$gnutls_nettle" = "yes" | |
2434 | then | |
2435 | gcrypt="no" | |
2436 | fi | |
2437 | fi | |
2438 | ||
2439 | # If user didn't give a --disable/enable-nettle flag, | |
2440 | # then mark as disabled if user requested gcrypt | |
2441 | # explicitly, or if gnutls links to gcrypt | |
2442 | if test -z "$nettle" | |
2443 | then | |
2444 | if test "$gcrypt" = "yes" || test "$gnutls_gcrypt" = "yes" | |
2445 | then | |
2446 | nettle="no" | |
2447 | fi | |
2448 | fi | |
2449 | ||
2450 | has_libgcrypt_config() { | |
2451 | if ! has "libgcrypt-config" | |
2452 | then | |
2453 | return 1 | |
2454 | fi | |
2455 | ||
2456 | if test -n "$cross_prefix" | |
2457 | then | |
89138857 | 2458 | host=$(libgcrypt-config --host) |
91bfcdb0 DB |
2459 | if test "$host-" != $cross_prefix |
2460 | then | |
2461 | return 1 | |
2462 | fi | |
2463 | fi | |
2464 | ||
2465 | return 0 | |
2466 | } | |
2467 | ||
2468 | if test "$gcrypt" != "no"; then | |
2469 | if has_libgcrypt_config; then | |
89138857 SW |
2470 | gcrypt_cflags=$(libgcrypt-config --cflags) |
2471 | gcrypt_libs=$(libgcrypt-config --libs) | |
91bfcdb0 DB |
2472 | # Debian has remove -lgpg-error from libgcrypt-config |
2473 | # as it "spreads unnecessary dependencies" which in | |
2474 | # turn breaks static builds... | |
2475 | if test "$static" = "yes" | |
2476 | then | |
2477 | gcrypt_libs="$gcrypt_libs -lgpg-error" | |
2478 | fi | |
62893b67 DB |
2479 | libs_softmmu="$gcrypt_libs $libs_softmmu" |
2480 | libs_tools="$gcrypt_libs $libs_tools" | |
2481 | QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" | |
91bfcdb0 DB |
2482 | gcrypt="yes" |
2483 | if test -z "$nettle"; then | |
2484 | nettle="no" | |
2485 | fi | |
37788f25 DB |
2486 | |
2487 | cat > $TMPC << EOF | |
2488 | #include <gcrypt.h> | |
2489 | int main(void) { | |
2490 | gcry_kdf_derive(NULL, 0, GCRY_KDF_PBKDF2, | |
2491 | GCRY_MD_SHA256, | |
2492 | NULL, 0, 0, 0, NULL); | |
2493 | return 0; | |
2494 | } | |
2495 | EOF | |
2496 | if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then | |
2497 | gcrypt_kdf=yes | |
2498 | fi | |
1f923c70 LM |
2499 | |
2500 | cat > $TMPC << EOF | |
2501 | #include <gcrypt.h> | |
2502 | int main(void) { | |
2503 | gcry_mac_hd_t handle; | |
2504 | gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5, | |
2505 | GCRY_MAC_FLAG_SECURE, NULL); | |
2506 | return 0; | |
2507 | } | |
2508 | EOF | |
2509 | if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then | |
2510 | gcrypt_hmac=yes | |
2511 | fi | |
62893b67 | 2512 | else |
91bfcdb0 DB |
2513 | if test "$gcrypt" = "yes"; then |
2514 | feature_not_found "gcrypt" "Install gcrypt devel" | |
2515 | else | |
2516 | gcrypt="no" | |
2517 | fi | |
62893b67 DB |
2518 | fi |
2519 | fi | |
2520 | ||
ddbb0d09 | 2521 | |
91bfcdb0 | 2522 | if test "$nettle" != "no"; then |
ed754746 | 2523 | if $pkg_config --exists "nettle"; then |
89138857 SW |
2524 | nettle_cflags=$($pkg_config --cflags nettle) |
2525 | nettle_libs=$($pkg_config --libs nettle) | |
2526 | nettle_version=$($pkg_config --modversion nettle) | |
ed754746 DB |
2527 | libs_softmmu="$nettle_libs $libs_softmmu" |
2528 | libs_tools="$nettle_libs $libs_tools" | |
2529 | QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" | |
91bfcdb0 | 2530 | nettle="yes" |
fff2f982 DB |
2531 | |
2532 | cat > $TMPC << EOF | |
9e87a691 | 2533 | #include <stddef.h> |
fff2f982 DB |
2534 | #include <nettle/pbkdf2.h> |
2535 | int main(void) { | |
2536 | pbkdf2_hmac_sha256(8, NULL, 1000, 8, NULL, 8, NULL); | |
2537 | return 0; | |
2538 | } | |
2539 | EOF | |
2540 | if compile_prog "$nettle_cflags" "$nettle_libs" ; then | |
2541 | nettle_kdf=yes | |
2542 | fi | |
ed754746 | 2543 | else |
91bfcdb0 DB |
2544 | if test "$nettle" = "yes"; then |
2545 | feature_not_found "nettle" "Install nettle devel" | |
2546 | else | |
2547 | nettle="no" | |
2548 | fi | |
ed754746 DB |
2549 | fi |
2550 | fi | |
2551 | ||
91bfcdb0 DB |
2552 | if test "$gcrypt" = "yes" && test "$nettle" = "yes" |
2553 | then | |
2554 | error_exit "Only one of gcrypt & nettle can be enabled" | |
2555 | fi | |
2556 | ||
9a2fd434 DB |
2557 | ########################################## |
2558 | # libtasn1 - only for the TLS creds/session test suite | |
2559 | ||
2560 | tasn1=yes | |
90246037 DB |
2561 | tasn1_cflags="" |
2562 | tasn1_libs="" | |
9a2fd434 | 2563 | if $pkg_config --exists "libtasn1"; then |
89138857 SW |
2564 | tasn1_cflags=$($pkg_config --cflags libtasn1) |
2565 | tasn1_libs=$($pkg_config --libs libtasn1) | |
9a2fd434 DB |
2566 | else |
2567 | tasn1=no | |
2568 | fi | |
2569 | ||
ed754746 | 2570 | |
559607ea DB |
2571 | ########################################## |
2572 | # getifaddrs (for tests/test-io-channel-socket ) | |
2573 | ||
2574 | have_ifaddrs_h=yes | |
2575 | if ! check_include "ifaddrs.h" ; then | |
2576 | have_ifaddrs_h=no | |
2577 | fi | |
2578 | ||
bbbf9bfb SW |
2579 | ########################################## |
2580 | # VTE probe | |
2581 | ||
2582 | if test "$vte" != "no"; then | |
2583 | if test "$gtkabi" = "3.0"; then | |
c6feff9e CR |
2584 | vteminversion="0.32.0" |
2585 | if $pkg_config --exists "vte-2.91"; then | |
2586 | vtepackage="vte-2.91" | |
2587 | else | |
2588 | vtepackage="vte-2.90" | |
2589 | fi | |
528de90a | 2590 | else |
528de90a | 2591 | vtepackage="vte" |
c6feff9e | 2592 | vteminversion="0.24.0" |
528de90a | 2593 | fi |
c6feff9e | 2594 | if $pkg_config --exists "$vtepackage >= $vteminversion"; then |
89138857 SW |
2595 | vte_cflags=$($pkg_config --cflags $vtepackage) |
2596 | vte_libs=$($pkg_config --libs $vtepackage) | |
2597 | vteversion=$($pkg_config --modversion $vtepackage) | |
bbbf9bfb SW |
2598 | libs_softmmu="$vte_libs $libs_softmmu" |
2599 | vte="yes" | |
2600 | elif test "$vte" = "yes"; then | |
9e04c683 | 2601 | if test "$gtkabi" = "3.0"; then |
c6feff9e | 2602 | feature_not_found "vte" "Install libvte-2.90/2.91 devel" |
9e04c683 SW |
2603 | else |
2604 | feature_not_found "vte" "Install libvte devel" | |
2605 | fi | |
0d185e63 | 2606 | else |
bbbf9bfb | 2607 | vte="no" |
a4ccabcf AL |
2608 | fi |
2609 | fi | |
2610 | ||
11d9f695 FB |
2611 | ########################################## |
2612 | # SDL probe | |
2613 | ||
3ec87ffe PB |
2614 | # Look for sdl configuration program (pkg-config or sdl-config). Try |
2615 | # sdl-config even without cross prefix, and favour pkg-config over sdl-config. | |
47c03744 | 2616 | |
ee8466d0 CR |
2617 | if test "$sdlabi" = ""; then |
2618 | if $pkg_config --exists "sdl"; then | |
2619 | sdlabi=1.2 | |
2620 | elif $pkg_config --exists "sdl2"; then | |
2621 | sdlabi=2.0 | |
2622 | else | |
2623 | sdlabi=1.2 | |
2624 | fi | |
2625 | fi | |
2626 | ||
47c03744 DA |
2627 | if test $sdlabi = "2.0"; then |
2628 | sdl_config=$sdl2_config | |
2629 | sdlname=sdl2 | |
2630 | sdlconfigname=sdl2_config | |
e07047cf | 2631 | elif test $sdlabi = "1.2"; then |
47c03744 DA |
2632 | sdlname=sdl |
2633 | sdlconfigname=sdl_config | |
e07047cf CR |
2634 | else |
2635 | error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0" | |
47c03744 DA |
2636 | fi |
2637 | ||
89138857 | 2638 | if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then |
47c03744 | 2639 | sdl_config=$sdlconfigname |
3ec87ffe PB |
2640 | fi |
2641 | ||
47c03744 DA |
2642 | if $pkg_config $sdlname --exists; then |
2643 | sdlconfig="$pkg_config $sdlname" | |
89138857 | 2644 | sdlversion=$($sdlconfig --modversion 2>/dev/null) |
3ec87ffe PB |
2645 | elif has ${sdl_config}; then |
2646 | sdlconfig="$sdl_config" | |
89138857 | 2647 | sdlversion=$($sdlconfig --version) |
a0dfd8a4 LM |
2648 | else |
2649 | if test "$sdl" = "yes" ; then | |
21684af0 | 2650 | feature_not_found "sdl" "Install SDL devel" |
a0dfd8a4 LM |
2651 | fi |
2652 | sdl=no | |
9316f803 | 2653 | fi |
29e5bada | 2654 | if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then |
3ec87ffe PB |
2655 | echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 |
2656 | fi | |
11d9f695 | 2657 | |
9316f803 | 2658 | sdl_too_old=no |
c4198157 | 2659 | if test "$sdl" != "no" ; then |
ac119f9d | 2660 | cat > $TMPC << EOF |
11d9f695 FB |
2661 | #include <SDL.h> |
2662 | #undef main /* We don't want SDL to override our main() */ | |
2663 | int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } | |
2664 | EOF | |
89138857 | 2665 | sdl_cflags=$($sdlconfig --cflags 2>/dev/null) |
74f42e18 | 2666 | if test "$static" = "yes" ; then |
89138857 | 2667 | sdl_libs=$($sdlconfig --static-libs 2>/dev/null) |
74f42e18 | 2668 | else |
89138857 | 2669 | sdl_libs=$($sdlconfig --libs 2>/dev/null) |
74f42e18 | 2670 | fi |
52166aa0 | 2671 | if compile_prog "$sdl_cflags" "$sdl_libs" ; then |
89138857 | 2672 | if test $(echo $sdlversion | sed 's/[^0-9]//g') -lt 121 ; then |
ac119f9d JQ |
2673 | sdl_too_old=yes |
2674 | else | |
a30878e7 | 2675 | sdl=yes |
ac119f9d | 2676 | fi |
cd01b4a3 | 2677 | |
67c274d3 | 2678 | # static link with sdl ? (note: sdl.pc's --static --libs is broken) |
ac119f9d | 2679 | if test "$sdl" = "yes" -a "$static" = "yes" ; then |
67c274d3 | 2680 | if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then |
89138857 SW |
2681 | sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)" |
2682 | sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)" | |
ac119f9d | 2683 | fi |
52166aa0 | 2684 | if compile_prog "$sdl_cflags" "$sdl_libs" ; then |
ac119f9d JQ |
2685 | : |
2686 | else | |
2687 | sdl=no | |
2688 | fi | |
2689 | fi # static link | |
c4198157 JQ |
2690 | else # sdl not found |
2691 | if test "$sdl" = "yes" ; then | |
21684af0 | 2692 | feature_not_found "sdl" "Install SDL devel" |
c4198157 JQ |
2693 | fi |
2694 | sdl=no | |
ac119f9d | 2695 | fi # sdl compile test |
a68551bc | 2696 | fi |
11d9f695 | 2697 | |
5368a422 | 2698 | if test "$sdl" = "yes" ; then |
ac119f9d | 2699 | cat > $TMPC <<EOF |
5368a422 AL |
2700 | #include <SDL.h> |
2701 | #if defined(SDL_VIDEO_DRIVER_X11) | |
2702 | #include <X11/XKBlib.h> | |
2703 | #else | |
2704 | #error No x11 support | |
2705 | #endif | |
2706 | int main(void) { return 0; } | |
2707 | EOF | |
f676c67e JW |
2708 | if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then |
2709 | sdl_cflags="$sdl_cflags $x11_cflags" | |
2710 | sdl_libs="$sdl_libs $x11_libs" | |
ac119f9d | 2711 | fi |
0705667e | 2712 | libs_softmmu="$sdl_libs $libs_softmmu" |
5368a422 AL |
2713 | fi |
2714 | ||
2da776db MH |
2715 | ########################################## |
2716 | # RDMA needs OpenFabrics libraries | |
2717 | if test "$rdma" != "no" ; then | |
2718 | cat > $TMPC <<EOF | |
2719 | #include <rdma/rdma_cma.h> | |
2720 | int main(void) { return 0; } | |
2721 | EOF | |
2722 | rdma_libs="-lrdmacm -libverbs" | |
2723 | if compile_prog "" "$rdma_libs" ; then | |
2724 | rdma="yes" | |
2725 | libs_softmmu="$libs_softmmu $rdma_libs" | |
2726 | else | |
2727 | if test "$rdma" = "yes" ; then | |
2728 | error_exit \ | |
2729 | " OpenFabrics librdmacm/libibverbs not present." \ | |
2730 | " Your options:" \ | |
2731 | " (1) Fast: Install infiniband packages from your distro." \ | |
2732 | " (2) Cleanest: Install libraries from www.openfabrics.org" \ | |
2733 | " (3) Also: Install softiwarp if you don't have RDMA hardware" | |
2734 | fi | |
2735 | rdma="no" | |
2736 | fi | |
2737 | fi | |
2738 | ||
95c6bff3 | 2739 | |
2f9606b3 AL |
2740 | ########################################## |
2741 | # VNC SASL detection | |
821601ea | 2742 | if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then |
ea784e3b | 2743 | cat > $TMPC <<EOF |
2f9606b3 AL |
2744 | #include <sasl/sasl.h> |
2745 | #include <stdio.h> | |
2746 | int main(void) { sasl_server_init(NULL, "qemu"); return 0; } | |
2747 | EOF | |
ea784e3b JQ |
2748 | # Assuming Cyrus-SASL installed in /usr prefix |
2749 | vnc_sasl_cflags="" | |
2750 | vnc_sasl_libs="-lsasl2" | |
2751 | if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then | |
2752 | vnc_sasl=yes | |
2753 | libs_softmmu="$vnc_sasl_libs $libs_softmmu" | |
ca273d58 | 2754 | QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags" |
ea784e3b JQ |
2755 | else |
2756 | if test "$vnc_sasl" = "yes" ; then | |
21684af0 | 2757 | feature_not_found "vnc-sasl" "Install Cyrus SASL devel" |
2f9606b3 | 2758 | fi |
ea784e3b JQ |
2759 | vnc_sasl=no |
2760 | fi | |
2f9606b3 AL |
2761 | fi |
2762 | ||
2f6f5c7a CC |
2763 | ########################################## |
2764 | # VNC JPEG detection | |
821601ea | 2765 | if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then |
2f6f5c7a CC |
2766 | cat > $TMPC <<EOF |
2767 | #include <stdio.h> | |
2768 | #include <jpeglib.h> | |
2769 | int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } | |
2770 | EOF | |
2771 | vnc_jpeg_cflags="" | |
2772 | vnc_jpeg_libs="-ljpeg" | |
2773 | if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then | |
2774 | vnc_jpeg=yes | |
2775 | libs_softmmu="$vnc_jpeg_libs $libs_softmmu" | |
ca273d58 | 2776 | QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags" |
2f6f5c7a CC |
2777 | else |
2778 | if test "$vnc_jpeg" = "yes" ; then | |
21684af0 | 2779 | feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel" |
2f6f5c7a CC |
2780 | fi |
2781 | vnc_jpeg=no | |
2782 | fi | |
2783 | fi | |
2784 | ||
efe556ad CC |
2785 | ########################################## |
2786 | # VNC PNG detection | |
821601ea | 2787 | if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then |
efe556ad CC |
2788 | cat > $TMPC <<EOF |
2789 | //#include <stdio.h> | |
2790 | #include <png.h> | |
832ce9c2 | 2791 | #include <stddef.h> |
efe556ad CC |
2792 | int main(void) { |
2793 | png_structp png_ptr; | |
2794 | png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); | |
7edc3fed | 2795 | return png_ptr != 0; |
efe556ad CC |
2796 | } |
2797 | EOF | |
65d5d3f9 | 2798 | if $pkg_config libpng --exists; then |
89138857 SW |
2799 | vnc_png_cflags=$($pkg_config libpng --cflags) |
2800 | vnc_png_libs=$($pkg_config libpng --libs) | |
9af8025e | 2801 | else |
efe556ad CC |
2802 | vnc_png_cflags="" |
2803 | vnc_png_libs="-lpng" | |
9af8025e | 2804 | fi |
efe556ad CC |
2805 | if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then |
2806 | vnc_png=yes | |
2807 | libs_softmmu="$vnc_png_libs $libs_softmmu" | |
9af8025e | 2808 | QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" |
efe556ad CC |
2809 | else |
2810 | if test "$vnc_png" = "yes" ; then | |
21684af0 | 2811 | feature_not_found "vnc-png" "Install libpng devel" |
efe556ad CC |
2812 | fi |
2813 | vnc_png=no | |
2814 | fi | |
2815 | fi | |
2816 | ||
76655d6d AL |
2817 | ########################################## |
2818 | # fnmatch() probe, used for ACL routines | |
2819 | fnmatch="no" | |
2820 | cat > $TMPC << EOF | |
2821 | #include <fnmatch.h> | |
2822 | int main(void) | |
2823 | { | |
2824 | fnmatch("foo", "foo", 0); | |
2825 | return 0; | |
2826 | } | |
2827 | EOF | |
52166aa0 | 2828 | if compile_prog "" "" ; then |
76655d6d AL |
2829 | fnmatch="yes" |
2830 | fi | |
2831 | ||
ee682d27 | 2832 | ########################################## |
c1bb86cd | 2833 | # xfsctl() probe, used for file-posix.c |
dce512de CH |
2834 | if test "$xfs" != "no" ; then |
2835 | cat > $TMPC << EOF | |
ffc41d10 | 2836 | #include <stddef.h> /* NULL */ |
dce512de CH |
2837 | #include <xfs/xfs.h> |
2838 | int main(void) | |
2839 | { | |
2840 | xfsctl(NULL, 0, 0, NULL); | |
2841 | return 0; | |
2842 | } | |
2843 | EOF | |
2844 | if compile_prog "" "" ; then | |
2845 | xfs="yes" | |
2846 | else | |
2847 | if test "$xfs" = "yes" ; then | |
21684af0 | 2848 | feature_not_found "xfs" "Instal xfsprogs/xfslibs devel" |
dce512de CH |
2849 | fi |
2850 | xfs=no | |
2851 | fi | |
2852 | fi | |
2853 | ||
8a16d273 TS |
2854 | ########################################## |
2855 | # vde libraries probe | |
dfb278bd | 2856 | if test "$vde" != "no" ; then |
4baae0ac | 2857 | vde_libs="-lvdeplug" |
8a16d273 TS |
2858 | cat > $TMPC << EOF |
2859 | #include <libvdeplug.h> | |
4a7f0e06 PB |
2860 | int main(void) |
2861 | { | |
2862 | struct vde_open_args a = {0, 0, 0}; | |
fea08e08 PM |
2863 | char s[] = ""; |
2864 | vde_open(s, s, &a); | |
4a7f0e06 PB |
2865 | return 0; |
2866 | } | |
8a16d273 | 2867 | EOF |
52166aa0 | 2868 | if compile_prog "" "$vde_libs" ; then |
4baae0ac | 2869 | vde=yes |
8e02e54c JQ |
2870 | libs_softmmu="$vde_libs $libs_softmmu" |
2871 | libs_tools="$vde_libs $libs_tools" | |
dfb278bd JQ |
2872 | else |
2873 | if test "$vde" = "yes" ; then | |
21684af0 | 2874 | feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" |
dfb278bd JQ |
2875 | fi |
2876 | vde=no | |
4baae0ac | 2877 | fi |
8a16d273 TS |
2878 | fi |
2879 | ||
58952137 | 2880 | ########################################## |
0a985b37 VM |
2881 | # netmap support probe |
2882 | # Apart from looking for netmap headers, we make sure that the host API version | |
2883 | # supports the netmap backend (>=11). The upper bound (15) is meant to simulate | |
2884 | # a minor/major version number. Minor new features will be marked with values up | |
2885 | # to 15, and if something happens that requires a change to the backend we will | |
2886 | # move above 15, submit the backend fixes and modify this two bounds. | |
58952137 VM |
2887 | if test "$netmap" != "no" ; then |
2888 | cat > $TMPC << EOF | |
2889 | #include <inttypes.h> | |
2890 | #include <net/if.h> | |
2891 | #include <net/netmap.h> | |
2892 | #include <net/netmap_user.h> | |
0a985b37 VM |
2893 | #if (NETMAP_API < 11) || (NETMAP_API > 15) |
2894 | #error | |
2895 | #endif | |
58952137 VM |
2896 | int main(void) { return 0; } |
2897 | EOF | |
2898 | if compile_prog "" "" ; then | |
2899 | netmap=yes | |
2900 | else | |
2901 | if test "$netmap" = "yes" ; then | |
2902 | feature_not_found "netmap" | |
2903 | fi | |
2904 | netmap=no | |
2905 | fi | |
2906 | fi | |
2907 | ||
47e98658 CB |
2908 | ########################################## |
2909 | # libcap-ng library probe | |
2910 | if test "$cap_ng" != "no" ; then | |
2911 | cap_libs="-lcap-ng" | |
2912 | cat > $TMPC << EOF | |
2913 | #include <cap-ng.h> | |
2914 | int main(void) | |
2915 | { | |
2916 | capng_capability_to_name(CAPNG_EFFECTIVE); | |
2917 | return 0; | |
2918 | } | |
2919 | EOF | |
2920 | if compile_prog "" "$cap_libs" ; then | |
2921 | cap_ng=yes | |
2922 | libs_tools="$cap_libs $libs_tools" | |
2923 | else | |
2924 | if test "$cap_ng" = "yes" ; then | |
21684af0 | 2925 | feature_not_found "cap_ng" "Install libcap-ng devel" |
47e98658 CB |
2926 | fi |
2927 | cap_ng=no | |
2928 | fi | |
2929 | fi | |
2930 | ||
8f28f3fb | 2931 | ########################################## |
c2de5c91 | 2932 | # Sound support libraries probe |
8f28f3fb | 2933 | |
c2de5c91 | 2934 | audio_drv_probe() |
2935 | { | |
2936 | drv=$1 | |
2937 | hdr=$2 | |
2938 | lib=$3 | |
2939 | exp=$4 | |
2940 | cfl=$5 | |
2941 | cat > $TMPC << EOF | |
2942 | #include <$hdr> | |
2943 | int main(void) { $exp } | |
8f28f3fb | 2944 | EOF |
52166aa0 | 2945 | if compile_prog "$cfl" "$lib" ; then |
c2de5c91 | 2946 | : |
2947 | else | |
76ad07a4 PM |
2948 | error_exit "$drv check failed" \ |
2949 | "Make sure to have the $drv libs and headers installed." | |
c2de5c91 | 2950 | fi |
2951 | } | |
2952 | ||
89138857 | 2953 | audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g') |
c2de5c91 | 2954 | for drv in $audio_drv_list; do |
2955 | case $drv in | |
2956 | alsa) | |
2957 | audio_drv_probe $drv alsa/asoundlib.h -lasound \ | |
e35bcb0c | 2958 | "return snd_pcm_close((snd_pcm_t *)0);" |
a4bf6780 | 2959 | libs_softmmu="-lasound $libs_softmmu" |
c2de5c91 | 2960 | ;; |
2961 | ||
b8e59f18 | 2962 | pa) |
e58ff62d PK |
2963 | audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \ |
2964 | "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;" | |
a394aed2 | 2965 | libs_softmmu="-lpulse $libs_softmmu" |
67f86e8e | 2966 | audio_pt_int="yes" |
b8e59f18 | 2967 | ;; |
2968 | ||
373967b2 GH |
2969 | sdl) |
2970 | if test "$sdl" = "no"; then | |
2971 | error_exit "sdl not found or disabled, can not use sdl audio driver" | |
2972 | fi | |
2973 | ;; | |
2974 | ||
997e690a JQ |
2975 | coreaudio) |
2976 | libs_softmmu="-framework CoreAudio $libs_softmmu" | |
2977 | ;; | |
2978 | ||
a4bf6780 JQ |
2979 | dsound) |
2980 | libs_softmmu="-lole32 -ldxguid $libs_softmmu" | |
d5631638 | 2981 | audio_win_int="yes" |
a4bf6780 JQ |
2982 | ;; |
2983 | ||
2984 | oss) | |
2985 | libs_softmmu="$oss_lib $libs_softmmu" | |
2986 | ;; | |
2987 | ||
373967b2 GH |
2988 | wav) |
2989 | # XXX: Probes for CoreAudio, DirectSound | |
2f6a1ab0 BS |
2990 | ;; |
2991 | ||
e4c63a6a | 2992 | *) |
1c9b2a52 | 2993 | echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { |
76ad07a4 PM |
2994 | error_exit "Unknown driver '$drv' selected" \ |
2995 | "Possible drivers are: $audio_possible_drivers" | |
e4c63a6a | 2996 | } |
2997 | ;; | |
c2de5c91 | 2998 | esac |
2999 | done | |
8f28f3fb | 3000 | |
2e4d9fb1 AJ |
3001 | ########################################## |
3002 | # BrlAPI probe | |
3003 | ||
4ffcedb6 | 3004 | if test "$brlapi" != "no" ; then |
eb82284f JQ |
3005 | brlapi_libs="-lbrlapi" |
3006 | cat > $TMPC << EOF | |
2e4d9fb1 | 3007 | #include <brlapi.h> |
832ce9c2 | 3008 | #include <stddef.h> |
2e4d9fb1 AJ |
3009 | int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } |
3010 | EOF | |
52166aa0 | 3011 | if compile_prog "" "$brlapi_libs" ; then |
eb82284f | 3012 | brlapi=yes |
264606b3 | 3013 | libs_softmmu="$brlapi_libs $libs_softmmu" |
4ffcedb6 JQ |
3014 | else |
3015 | if test "$brlapi" = "yes" ; then | |
21684af0 | 3016 | feature_not_found "brlapi" "Install brlapi devel" |
4ffcedb6 JQ |
3017 | fi |
3018 | brlapi=no | |
eb82284f JQ |
3019 | fi |
3020 | fi | |
2e4d9fb1 | 3021 | |
4d3b6f6e AZ |
3022 | ########################################## |
3023 | # curses probe | |
a3605bf6 MT |
3024 | if test "$curses" != "no" ; then |
3025 | if test "$mingw32" = "yes" ; then | |
8ddc5bf9 ST |
3026 | curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" |
3027 | curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses" | |
a3605bf6 | 3028 | else |
7c703002 | 3029 | curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" |
8ddc5bf9 | 3030 | curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw" |
a3605bf6 | 3031 | fi |
c584a6d0 | 3032 | curses_found=no |
4d3b6f6e | 3033 | cat > $TMPC << EOF |
8ddc5bf9 | 3034 | #include <locale.h> |
4d3b6f6e | 3035 | #include <curses.h> |
8ddc5bf9 | 3036 | #include <wchar.h> |
ef9a2524 SW |
3037 | int main(void) { |
3038 | const char *s = curses_version(); | |
8ddc5bf9 ST |
3039 | wchar_t wch = L'w'; |
3040 | setlocale(LC_ALL, ""); | |
ef9a2524 | 3041 | resize_term(0, 0); |
8ddc5bf9 ST |
3042 | addwstr(L"wide chars\n"); |
3043 | addnwstr(&wch, 1); | |
7c703002 | 3044 | add_wch(WACS_DEGREE); |
ef9a2524 SW |
3045 | return s != 0; |
3046 | } | |
4d3b6f6e | 3047 | EOF |
ecbe251f | 3048 | IFS=: |
8ddc5bf9 | 3049 | for curses_inc in $curses_inc_list; do |
7c703002 | 3050 | IFS=: |
8ddc5bf9 ST |
3051 | for curses_lib in $curses_lib_list; do |
3052 | unset IFS | |
3053 | if compile_prog "$curses_inc" "$curses_lib" ; then | |
3054 | curses_found=yes | |
3055 | QEMU_CFLAGS="$curses_inc $QEMU_CFLAGS" | |
3056 | libs_softmmu="$curses_lib $libs_softmmu" | |
3057 | break | |
3058 | fi | |
3059 | done | |
7c703002 ST |
3060 | if test "$curses_found" = yes ; then |
3061 | break | |
3062 | fi | |
4f78ef9a | 3063 | done |
ecbe251f | 3064 | unset IFS |
c584a6d0 JQ |
3065 | if test "$curses_found" = "yes" ; then |
3066 | curses=yes | |
3067 | else | |
3068 | if test "$curses" = "yes" ; then | |
21684af0 | 3069 | feature_not_found "curses" "Install ncurses devel" |
c584a6d0 JQ |
3070 | fi |
3071 | curses=no | |
3072 | fi | |
4f78ef9a | 3073 | fi |
4d3b6f6e | 3074 | |
769ce76d AG |
3075 | ########################################## |
3076 | # curl probe | |
788c8196 | 3077 | if test "$curl" != "no" ; then |
65d5d3f9 | 3078 | if $pkg_config libcurl --exists; then |
a3605bf6 MT |
3079 | curlconfig="$pkg_config libcurl" |
3080 | else | |
3081 | curlconfig=curl-config | |
3082 | fi | |
769ce76d AG |
3083 | cat > $TMPC << EOF |
3084 | #include <curl/curl.h> | |
0b862ced | 3085 | int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } |
769ce76d | 3086 | EOF |
89138857 SW |
3087 | curl_cflags=$($curlconfig --cflags 2>/dev/null) |
3088 | curl_libs=$($curlconfig --libs 2>/dev/null) | |
b1d5a277 | 3089 | if compile_prog "$curl_cflags" "$curl_libs" ; then |
769ce76d | 3090 | curl=yes |
788c8196 JQ |
3091 | else |
3092 | if test "$curl" = "yes" ; then | |
21684af0 | 3093 | feature_not_found "curl" "Install libcurl devel" |
788c8196 JQ |
3094 | fi |
3095 | curl=no | |
769ce76d AG |
3096 | fi |
3097 | fi # test "$curl" | |
3098 | ||
fb599c9a AZ |
3099 | ########################################## |
3100 | # bluez support probe | |
a20a6f46 | 3101 | if test "$bluez" != "no" ; then |
e820e3f4 AZ |
3102 | cat > $TMPC << EOF |
3103 | #include <bluetooth/bluetooth.h> | |
3104 | int main(void) { return bt_error(0); } | |
3105 | EOF | |
89138857 SW |
3106 | bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null) |
3107 | bluez_libs=$($pkg_config --libs bluez 2>/dev/null) | |
52166aa0 | 3108 | if compile_prog "$bluez_cflags" "$bluez_libs" ; then |
a20a6f46 | 3109 | bluez=yes |
e482d56a | 3110 | libs_softmmu="$bluez_libs $libs_softmmu" |
e820e3f4 | 3111 | else |
a20a6f46 | 3112 | if test "$bluez" = "yes" ; then |
21684af0 | 3113 | feature_not_found "bluez" "Install bluez-libs/libbluetooth devel" |
a20a6f46 | 3114 | fi |
e820e3f4 AZ |
3115 | bluez="no" |
3116 | fi | |
fb599c9a AZ |
3117 | fi |
3118 | ||
e18df141 AL |
3119 | ########################################## |
3120 | # glib support probe | |
a52d28af | 3121 | |
ad04d8cb PM |
3122 | if test "$mingw32" = yes; then |
3123 | glib_req_ver=2.30 | |
3124 | else | |
3125 | glib_req_ver=2.22 | |
3126 | fi | |
aa0d1f44 PB |
3127 | glib_modules=gthread-2.0 |
3128 | if test "$modules" = yes; then | |
3129 | glib_modules="$glib_modules gmodule-2.0" | |
3130 | fi | |
e26110cf | 3131 | |
4eaf7202 SJ |
3132 | # This workaround is required due to a bug in pkg-config file for glib as it |
3133 | # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static | |
3134 | ||
3135 | if test "$static" = yes -a "$mingw32" = yes; then | |
3136 | QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS" | |
3137 | fi | |
3138 | ||
aa0d1f44 | 3139 | for i in $glib_modules; do |
e26110cf | 3140 | if $pkg_config --atleast-version=$glib_req_ver $i; then |
89138857 SW |
3141 | glib_cflags=$($pkg_config --cflags $i) |
3142 | glib_libs=$($pkg_config --libs $i) | |
4a058899 | 3143 | QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS" |
e26110cf FZ |
3144 | LIBS="$glib_libs $LIBS" |
3145 | libs_qga="$glib_libs $libs_qga" | |
3146 | else | |
3147 | error_exit "glib-$glib_req_ver $i is required to compile QEMU" | |
3148 | fi | |
3149 | done | |
3150 | ||
977a82ab DB |
3151 | # Sanity check that the current size_t matches the |
3152 | # size that glib thinks it should be. This catches | |
3153 | # problems on multi-arch where people try to build | |
3154 | # 32-bit QEMU while pointing at 64-bit glib headers | |
3155 | cat > $TMPC <<EOF | |
3156 | #include <glib.h> | |
3157 | #include <unistd.h> | |
3158 | ||
3159 | #define QEMU_BUILD_BUG_ON(x) \ | |
3160 | typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); | |
3161 | ||
3162 | int main(void) { | |
3163 | QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); | |
3164 | return 0; | |
3165 | } | |
3166 | EOF | |
3167 | ||
5919e032 | 3168 | if ! compile_prog "$CFLAGS" "$LIBS" ; then |
977a82ab DB |
3169 | error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ |
3170 | "You probably need to set PKG_CONFIG_LIBDIR"\ | |
3171 | "to point to the right pkg-config files for your"\ | |
3172 | "build target" | |
3173 | fi | |
3174 | ||
9d41401b MT |
3175 | # g_test_trap_subprocess added in 2.38. Used by some tests. |
3176 | glib_subprocess=yes | |
a049223a | 3177 | if ! $pkg_config --atleast-version=2.38 glib-2.0; then |
9d41401b MT |
3178 | glib_subprocess=no |
3179 | fi | |
3180 | ||
bbbf2e04 JS |
3181 | # Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage |
3182 | cat > $TMPC << EOF | |
3183 | #include <glib.h> | |
3184 | int main(void) { return 0; } | |
3185 | EOF | |
3186 | if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then | |
3187 | if cc_has_warning_flag "-Wno-unknown-attributes"; then | |
3188 | glib_cflags="-Wno-unknown-attributes $glib_cflags" | |
3189 | CFLAGS="-Wno-unknown-attributes $CFLAGS" | |
3190 | fi | |
3191 | fi | |
3192 | ||
e26110cf FZ |
3193 | ########################################## |
3194 | # SHA command probe for modules | |
3195 | if test "$modules" = yes; then | |
3196 | shacmd_probe="sha1sum sha1 shasum" | |
3197 | for c in $shacmd_probe; do | |
8ccefb91 | 3198 | if has $c; then |
e26110cf FZ |
3199 | shacmd="$c" |
3200 | break | |
3201 | fi | |
3202 | done | |
3203 | if test "$shacmd" = ""; then | |
3204 | error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" | |
3205 | fi | |
e18df141 AL |
3206 | fi |
3207 | ||
e2134eb9 GH |
3208 | ########################################## |
3209 | # pixman support probe | |
3210 | ||
3211 | if test "$pixman" = ""; then | |
74880fe2 RS |
3212 | if test "$want_tools" = "no" -a "$softmmu" = "no"; then |
3213 | pixman="none" | |
236f282c | 3214 | elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then |
e2134eb9 GH |
3215 | pixman="system" |
3216 | else | |
3217 | pixman="internal" | |
3218 | fi | |
3219 | fi | |
74880fe2 RS |
3220 | if test "$pixman" = "none"; then |
3221 | if test "$want_tools" != "no" -o "$softmmu" != "no"; then | |
76ad07a4 PM |
3222 | error_exit "pixman disabled but system emulation or tools build" \ |
3223 | "enabled. You can turn off pixman only if you also" \ | |
3224 | "disable all system emulation targets and the tools" \ | |
3225 | "build with '--disable-tools --disable-system'." | |
74880fe2 RS |
3226 | fi |
3227 | pixman_cflags= | |
3228 | pixman_libs= | |
3229 | elif test "$pixman" = "system"; then | |
236f282c | 3230 | # pixman version has been checked above |
89138857 SW |
3231 | pixman_cflags=$($pkg_config --cflags pixman-1) |
3232 | pixman_libs=$($pkg_config --libs pixman-1) | |
e2134eb9 GH |
3233 | else |
3234 | if test ! -d ${source_path}/pixman/pixman; then | |
236f282c | 3235 | error_exit "pixman >= 0.21.8 not present. Your options:" \ |
76ad07a4 PM |
3236 | " (1) Preferred: Install the pixman devel package (any recent" \ |
3237 | " distro should have packages as Xorg needs pixman too)." \ | |
3238 | " (2) Fetch the pixman submodule, using:" \ | |
3239 | " git submodule update --init pixman" | |
e2134eb9 | 3240 | fi |
5ca9388a GH |
3241 | mkdir -p pixman/pixman |
3242 | pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman" | |
3243 | pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1" | |
e2134eb9 | 3244 | fi |
e2134eb9 | 3245 | |
17bff52b MK |
3246 | ########################################## |
3247 | # libcap probe | |
3248 | ||
3249 | if test "$cap" != "no" ; then | |
3250 | cat > $TMPC <<EOF | |
3251 | #include <stdio.h> | |
3252 | #include <sys/capability.h> | |
cc939743 | 3253 | int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; } |
17bff52b MK |
3254 | EOF |
3255 | if compile_prog "" "-lcap" ; then | |
3256 | cap=yes | |
3257 | else | |
3258 | cap=no | |
3259 | fi | |
3260 | fi | |
3261 | ||
414f0dab | 3262 | ########################################## |
e5d355d1 | 3263 | # pthread probe |
4b29ec41 | 3264 | PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" |
3c529d93 | 3265 | |
4dd75c70 | 3266 | pthread=no |
e5d355d1 | 3267 | cat > $TMPC << EOF |
3c529d93 | 3268 | #include <pthread.h> |
7a42bbe4 SW |
3269 | static void *f(void *p) { return NULL; } |
3270 | int main(void) { | |
3271 | pthread_t thread; | |
3272 | pthread_create(&thread, 0, f, 0); | |
3273 | return 0; | |
3274 | } | |
414f0dab | 3275 | EOF |
bd00d539 AF |
3276 | if compile_prog "" "" ; then |
3277 | pthread=yes | |
3278 | else | |
3279 | for pthread_lib in $PTHREADLIBS_LIST; do | |
3280 | if compile_prog "" "$pthread_lib" ; then | |
3281 | pthread=yes | |
e3c56761 PP |
3282 | found=no |
3283 | for lib_entry in $LIBS; do | |
3284 | if test "$lib_entry" = "$pthread_lib"; then | |
3285 | found=yes | |
3286 | break | |
3287 | fi | |
3288 | done | |
3289 | if test "$found" = "no"; then | |
3290 | LIBS="$pthread_lib $LIBS" | |
3291 | fi | |
409437e1 | 3292 | PTHREAD_LIB="$pthread_lib" |
bd00d539 AF |
3293 | break |
3294 | fi | |
3295 | done | |
3296 | fi | |
414f0dab | 3297 | |
4617e593 | 3298 | if test "$mingw32" != yes -a "$pthread" = no; then |
76ad07a4 PM |
3299 | error_exit "pthread check failed" \ |
3300 | "Make sure to have the pthread libs and headers installed." | |
e5d355d1 AL |
3301 | fi |
3302 | ||
5c312079 DDAG |
3303 | # check for pthread_setname_np |
3304 | pthread_setname_np=no | |
3305 | cat > $TMPC << EOF | |
3306 | #include <pthread.h> | |
3307 | ||
3308 | static void *f(void *p) { return NULL; } | |
3309 | int main(void) | |
3310 | { | |
3311 | pthread_t thread; | |
3312 | pthread_create(&thread, 0, f, 0); | |
3313 | pthread_setname_np(thread, "QEMU"); | |
3314 | return 0; | |
3315 | } | |
3316 | EOF | |
3317 | if compile_prog "" "$pthread_lib" ; then | |
3318 | pthread_setname_np=yes | |
3319 | fi | |
3320 | ||
f27aaf4b CB |
3321 | ########################################## |
3322 | # rbd probe | |
3323 | if test "$rbd" != "no" ; then | |
3324 | cat > $TMPC <<EOF | |
3325 | #include <stdio.h> | |
ad32e9c0 | 3326 | #include <rbd/librbd.h> |
f27aaf4b | 3327 | int main(void) { |
ad32e9c0 JD |
3328 | rados_t cluster; |
3329 | rados_create(&cluster, NULL); | |
f27aaf4b CB |
3330 | return 0; |
3331 | } | |
3332 | EOF | |
ad32e9c0 JD |
3333 | rbd_libs="-lrbd -lrados" |
3334 | if compile_prog "" "$rbd_libs" ; then | |
3335 | rbd=yes | |
f27aaf4b CB |
3336 | else |
3337 | if test "$rbd" = "yes" ; then | |
21684af0 | 3338 | feature_not_found "rados block device" "Install librbd/ceph devel" |
f27aaf4b CB |
3339 | fi |
3340 | rbd=no | |
3341 | fi | |
f27aaf4b CB |
3342 | fi |
3343 | ||
0a12ec87 RJ |
3344 | ########################################## |
3345 | # libssh2 probe | |
4fc16838 | 3346 | min_libssh2_version=1.2.8 |
0a12ec87 | 3347 | if test "$libssh2" != "no" ; then |
65d5d3f9 | 3348 | if $pkg_config --atleast-version=$min_libssh2_version libssh2; then |
89138857 SW |
3349 | libssh2_cflags=$($pkg_config libssh2 --cflags) |
3350 | libssh2_libs=$($pkg_config libssh2 --libs) | |
0a12ec87 | 3351 | libssh2=yes |
0a12ec87 RJ |
3352 | else |
3353 | if test "$libssh2" = "yes" ; then | |
4fc16838 | 3354 | error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2" |
0a12ec87 RJ |
3355 | fi |
3356 | libssh2=no | |
3357 | fi | |
3358 | fi | |
3359 | ||
9a2d462e RJ |
3360 | ########################################## |
3361 | # libssh2_sftp_fsync probe | |
3362 | ||
3363 | if test "$libssh2" = "yes"; then | |
3364 | cat > $TMPC <<EOF | |
3365 | #include <stdio.h> | |
3366 | #include <libssh2.h> | |
3367 | #include <libssh2_sftp.h> | |
3368 | int main(void) { | |
3369 | LIBSSH2_SESSION *session; | |
3370 | LIBSSH2_SFTP *sftp; | |
3371 | LIBSSH2_SFTP_HANDLE *sftp_handle; | |
3372 | session = libssh2_session_init (); | |
3373 | sftp = libssh2_sftp_init (session); | |
3374 | sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0); | |
3375 | libssh2_sftp_fsync (sftp_handle); | |
3376 | return 0; | |
3377 | } | |
3378 | EOF | |
3379 | # libssh2_cflags/libssh2_libs defined in previous test. | |
3380 | if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then | |
3381 | QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS" | |
3382 | fi | |
3383 | fi | |
3384 | ||
5c6c3a6c CH |
3385 | ########################################## |
3386 | # linux-aio probe | |
5c6c3a6c CH |
3387 | |
3388 | if test "$linux_aio" != "no" ; then | |
3389 | cat > $TMPC <<EOF | |
3390 | #include <libaio.h> | |
3391 | #include <sys/eventfd.h> | |
832ce9c2 | 3392 | #include <stddef.h> |
5c6c3a6c CH |
3393 | int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } |
3394 | EOF | |
3395 | if compile_prog "" "-laio" ; then | |
3396 | linux_aio=yes | |
5c6c3a6c CH |
3397 | else |
3398 | if test "$linux_aio" = "yes" ; then | |
21684af0 | 3399 | feature_not_found "linux AIO" "Install libaio devel" |
5c6c3a6c | 3400 | fi |
3cfcae3c | 3401 | linux_aio=no |
5c6c3a6c CH |
3402 | fi |
3403 | fi | |
3404 | ||
3b8acc11 PB |
3405 | ########################################## |
3406 | # TPM passthrough is only on x86 Linux | |
3407 | ||
3408 | if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then | |
3409 | tpm_passthrough=$tpm | |
3410 | else | |
3411 | tpm_passthrough=no | |
3412 | fi | |
3413 | ||
758e8e38 VJ |
3414 | ########################################## |
3415 | # attr probe | |
3416 | ||
3417 | if test "$attr" != "no" ; then | |
3418 | cat > $TMPC <<EOF | |
3419 | #include <stdio.h> | |
3420 | #include <sys/types.h> | |
f2338fb4 PB |
3421 | #ifdef CONFIG_LIBATTR |
3422 | #include <attr/xattr.h> | |
3423 | #else | |
4f26f2b6 | 3424 | #include <sys/xattr.h> |
f2338fb4 | 3425 | #endif |
758e8e38 VJ |
3426 | int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } |
3427 | EOF | |
4f26f2b6 AK |
3428 | if compile_prog "" "" ; then |
3429 | attr=yes | |
3430 | # Older distros have <attr/xattr.h>, and need -lattr: | |
f2338fb4 | 3431 | elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then |
758e8e38 VJ |
3432 | attr=yes |
3433 | LIBS="-lattr $LIBS" | |
4f26f2b6 | 3434 | libattr=yes |
758e8e38 VJ |
3435 | else |
3436 | if test "$attr" = "yes" ; then | |
21684af0 | 3437 | feature_not_found "ATTR" "Install libc6 or libattr devel" |
758e8e38 VJ |
3438 | fi |
3439 | attr=no | |
3440 | fi | |
3441 | fi | |
3442 | ||
bf9298b9 AL |
3443 | ########################################## |
3444 | # iovec probe | |
3445 | cat > $TMPC <<EOF | |
db34f0b3 | 3446 | #include <sys/types.h> |
bf9298b9 | 3447 | #include <sys/uio.h> |
db34f0b3 | 3448 | #include <unistd.h> |
f91f9bee | 3449 | int main(void) { return sizeof(struct iovec); } |
bf9298b9 AL |
3450 | EOF |
3451 | iovec=no | |
52166aa0 | 3452 | if compile_prog "" "" ; then |
bf9298b9 AL |
3453 | iovec=yes |
3454 | fi | |
3455 | ||
ceb42de8 AL |
3456 | ########################################## |
3457 | # preadv probe | |
3458 | cat > $TMPC <<EOF | |
3459 | #include <sys/types.h> | |
3460 | #include <sys/uio.h> | |
3461 | #include <unistd.h> | |
c075a723 | 3462 | int main(void) { return preadv(0, 0, 0, 0); } |
ceb42de8 AL |
3463 | EOF |
3464 | preadv=no | |
52166aa0 | 3465 | if compile_prog "" "" ; then |
ceb42de8 AL |
3466 | preadv=yes |
3467 | fi | |
3468 | ||
f652e6af AJ |
3469 | ########################################## |
3470 | # fdt probe | |
e169e1e1 PM |
3471 | # fdt support is mandatory for at least some target architectures, |
3472 | # so insist on it if we're building those system emulators. | |
3473 | fdt_required=no | |
3474 | for target in $target_list; do | |
3475 | case $target in | |
df1d8a1f | 3476 | aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu) |
e169e1e1 PM |
3477 | fdt_required=yes |
3478 | ;; | |
3479 | esac | |
3480 | done | |
3481 | ||
3482 | if test "$fdt_required" = "yes"; then | |
3483 | if test "$fdt" = "no"; then | |
3484 | error_exit "fdt disabled but some requested targets require it." \ | |
3485 | "You can turn off fdt only if you also disable all the system emulation" \ | |
3486 | "targets which need it (by specifying a cut down --target-list)." | |
3487 | fi | |
3488 | fdt=yes | |
3489 | fi | |
3490 | ||
2df87df7 | 3491 | if test "$fdt" != "no" ; then |
b41af4ba | 3492 | fdt_libs="-lfdt" |
96ce6545 | 3493 | # explicitly check for libfdt_env.h as it is missing in some stable installs |
6e85fce0 | 3494 | # and test for required functions to make sure we are on a version >= 1.4.2 |
b41af4ba | 3495 | cat > $TMPC << EOF |
31ce0adb | 3496 | #include <libfdt.h> |
96ce6545 | 3497 | #include <libfdt_env.h> |
6e85fce0 | 3498 | int main(void) { fdt_first_subnode(0, 0); return 0; } |
f652e6af | 3499 | EOF |
52166aa0 | 3500 | if compile_prog "" "$fdt_libs" ; then |
a540f158 | 3501 | # system DTC is good - use it |
f652e6af | 3502 | fdt=yes |
a540f158 PC |
3503 | elif test -d ${source_path}/dtc/libfdt ; then |
3504 | # have submodule DTC - use it | |
3505 | fdt=yes | |
3506 | dtc_internal="yes" | |
3507 | mkdir -p dtc | |
cab00a5a | 3508 | if [ "$pwd_is_source_path" != "y" ] ; then |
a540f158 PC |
3509 | symlink "$source_path/dtc/Makefile" "dtc/Makefile" |
3510 | symlink "$source_path/dtc/scripts" "dtc/scripts" | |
2df87df7 | 3511 | fi |
a540f158 PC |
3512 | fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt" |
3513 | fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs" | |
3514 | elif test "$fdt" = "yes" ; then | |
3515 | # have neither and want - prompt for system/submodule install | |
6e85fce0 | 3516 | error_exit "DTC (libfdt) version >= 1.4.2 not present. Your options:" \ |
3f281822 | 3517 | " (1) Preferred: Install the DTC (libfdt) devel package" \ |
a540f158 PC |
3518 | " (2) Fetch the DTC submodule, using:" \ |
3519 | " git submodule update --init dtc" | |
3520 | else | |
3521 | # don't have and don't want | |
de3a354a | 3522 | fdt_libs= |
2df87df7 | 3523 | fdt=no |
f652e6af AJ |
3524 | fi |
3525 | fi | |
3526 | ||
a540f158 PC |
3527 | libs_softmmu="$libs_softmmu $fdt_libs" |
3528 | ||
20ff075b | 3529 | ########################################## |
fb719563 | 3530 | # opengl probe (for sdl2, gtk, milkymist-tmu2) |
b1546f32 | 3531 | |
da076ffe | 3532 | if test "$opengl" != "no" ; then |
014cb152 | 3533 | opengl_pkgs="epoxy libdrm gbm" |
fb719563 | 3534 | if $pkg_config $opengl_pkgs x11; then |
f676c67e JW |
3535 | opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags" |
3536 | opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs" | |
da076ffe | 3537 | opengl=yes |
925a0400 GH |
3538 | if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then |
3539 | gtk_gl="yes" | |
3540 | fi | |
cc720a5d | 3541 | QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags" |
20ff075b | 3542 | else |
da076ffe | 3543 | if test "$opengl" = "yes" ; then |
dcf30025 | 3544 | feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" |
20ff075b | 3545 | fi |
f676c67e | 3546 | opengl_cflags="" |
da076ffe GH |
3547 | opengl_libs="" |
3548 | opengl=no | |
20ff075b MW |
3549 | fi |
3550 | fi | |
3551 | ||
014cb152 GH |
3552 | if test "$opengl" = "yes"; then |
3553 | cat > $TMPC << EOF | |
3554 | #include <epoxy/egl.h> | |
3555 | #ifndef EGL_MESA_image_dma_buf_export | |
3556 | # error mesa/epoxy lacks support for dmabufs (mesa 10.6+) | |
3557 | #endif | |
3558 | int main(void) { return 0; } | |
3559 | EOF | |
3560 | if compile_prog "" "" ; then | |
3561 | opengl_dmabuf=yes | |
3562 | fi | |
3563 | fi | |
c9a12e75 | 3564 | |
c9a12e75 | 3565 | |
eb100396 BR |
3566 | ########################################## |
3567 | # glusterfs probe | |
3568 | if test "$glusterfs" != "no" ; then | |
65d5d3f9 | 3569 | if $pkg_config --atleast-version=3 glusterfs-api; then |
e01bee08 | 3570 | glusterfs="yes" |
89138857 SW |
3571 | glusterfs_cflags=$($pkg_config --cflags glusterfs-api) |
3572 | glusterfs_libs=$($pkg_config --libs glusterfs-api) | |
d85fa9eb JC |
3573 | if $pkg_config --atleast-version=4 glusterfs-api; then |
3574 | glusterfs_xlator_opt="yes" | |
3575 | fi | |
65d5d3f9 | 3576 | if $pkg_config --atleast-version=5 glusterfs-api; then |
0c14fb47 BR |
3577 | glusterfs_discard="yes" |
3578 | fi | |
7c815372 BR |
3579 | if $pkg_config --atleast-version=6 glusterfs-api; then |
3580 | glusterfs_zerofill="yes" | |
3581 | fi | |
eb100396 BR |
3582 | else |
3583 | if test "$glusterfs" = "yes" ; then | |
8efc9363 HT |
3584 | feature_not_found "GlusterFS backend support" \ |
3585 | "Install glusterfs-api devel >= 3" | |
eb100396 | 3586 | fi |
e01bee08 | 3587 | glusterfs="no" |
eb100396 BR |
3588 | fi |
3589 | fi | |
3590 | ||
39386ac7 | 3591 | # Check for inotify functions when we are building linux-user |
3b3f24ad AJ |
3592 | # emulator. This is done because older glibc versions don't |
3593 | # have syscall stubs for these implemented. In that case we | |
3594 | # don't provide them even if kernel supports them. | |
3595 | # | |
3596 | inotify=no | |
67ba57f6 | 3597 | cat > $TMPC << EOF |
3b3f24ad AJ |
3598 | #include <sys/inotify.h> |
3599 | ||
3600 | int | |
3601 | main(void) | |
3602 | { | |
3603 | /* try to start inotify */ | |
8690e420 | 3604 | return inotify_init(); |
3b3f24ad AJ |
3605 | } |
3606 | EOF | |
52166aa0 | 3607 | if compile_prog "" "" ; then |
67ba57f6 | 3608 | inotify=yes |
3b3f24ad AJ |
3609 | fi |
3610 | ||
c05c7a73 RV |
3611 | inotify1=no |
3612 | cat > $TMPC << EOF | |
3613 | #include <sys/inotify.h> | |
3614 | ||
3615 | int | |
3616 | main(void) | |
3617 | { | |
3618 | /* try to start inotify */ | |
3619 | return inotify_init1(0); | |
3620 | } | |
3621 | EOF | |
3622 | if compile_prog "" "" ; then | |
3623 | inotify1=yes | |
3624 | fi | |
3625 | ||
ebc996f3 RV |
3626 | # check if utimensat and futimens are supported |
3627 | utimens=no | |
3628 | cat > $TMPC << EOF | |
3629 | #define _ATFILE_SOURCE | |
ebc996f3 RV |
3630 | #include <stddef.h> |
3631 | #include <fcntl.h> | |
3014ee00 | 3632 | #include <sys/stat.h> |
ebc996f3 RV |
3633 | |
3634 | int main(void) | |
3635 | { | |
3636 | utimensat(AT_FDCWD, "foo", NULL, 0); | |
3637 | futimens(0, NULL); | |
3638 | return 0; | |
3639 | } | |
3640 | EOF | |
52166aa0 | 3641 | if compile_prog "" "" ; then |
ebc996f3 RV |
3642 | utimens=yes |
3643 | fi | |
3644 | ||
099d6b0f RV |
3645 | # check if pipe2 is there |
3646 | pipe2=no | |
3647 | cat > $TMPC << EOF | |
099d6b0f RV |
3648 | #include <unistd.h> |
3649 | #include <fcntl.h> | |
3650 | ||
3651 | int main(void) | |
3652 | { | |
3653 | int pipefd[2]; | |
9bca8162 | 3654 | return pipe2(pipefd, O_CLOEXEC); |
099d6b0f RV |
3655 | } |
3656 | EOF | |
52166aa0 | 3657 | if compile_prog "" "" ; then |
099d6b0f RV |
3658 | pipe2=yes |
3659 | fi | |
3660 | ||
40ff6d7e KW |
3661 | # check if accept4 is there |
3662 | accept4=no | |
3663 | cat > $TMPC << EOF | |
40ff6d7e KW |
3664 | #include <sys/socket.h> |
3665 | #include <stddef.h> | |
3666 | ||
3667 | int main(void) | |
3668 | { | |
3669 | accept4(0, NULL, NULL, SOCK_CLOEXEC); | |
3670 | return 0; | |
3671 | } | |
3672 | EOF | |
3673 | if compile_prog "" "" ; then | |
3674 | accept4=yes | |
3675 | fi | |
3676 | ||
3ce34dfb VS |
3677 | # check if tee/splice is there. vmsplice was added same time. |
3678 | splice=no | |
3679 | cat > $TMPC << EOF | |
3ce34dfb VS |
3680 | #include <unistd.h> |
3681 | #include <fcntl.h> | |
3682 | #include <limits.h> | |
3683 | ||
3684 | int main(void) | |
3685 | { | |
66ea0f22 | 3686 | int len, fd = 0; |
3ce34dfb VS |
3687 | len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); |
3688 | splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); | |
3689 | return 0; | |
3690 | } | |
3691 | EOF | |
52166aa0 | 3692 | if compile_prog "" "" ; then |
3ce34dfb VS |
3693 | splice=yes |
3694 | fi | |
3695 | ||
a99d57bb WG |
3696 | ########################################## |
3697 | # libnuma probe | |
3698 | ||
3699 | if test "$numa" != "no" ; then | |
3700 | cat > $TMPC << EOF | |
3701 | #include <numa.h> | |
3702 | int main(void) { return numa_available(); } | |
3703 | EOF | |
3704 | ||
3705 | if compile_prog "" "-lnuma" ; then | |
3706 | numa=yes | |
3707 | libs_softmmu="-lnuma $libs_softmmu" | |
3708 | else | |
3709 | if test "$numa" = "yes" ; then | |
3710 | feature_not_found "numa" "install numactl devel" | |
3711 | fi | |
3712 | numa=no | |
3713 | fi | |
3714 | fi | |
3715 | ||
7b01cb97 AD |
3716 | if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then |
3717 | echo "ERROR: tcmalloc && jemalloc can't be used at the same time" | |
3718 | exit 1 | |
3719 | fi | |
3720 | ||
2847b469 FZ |
3721 | ########################################## |
3722 | # tcmalloc probe | |
3723 | ||
3724 | if test "$tcmalloc" = "yes" ; then | |
3725 | cat > $TMPC << EOF | |
3726 | #include <stdlib.h> | |
3727 | int main(void) { malloc(1); return 0; } | |
3728 | EOF | |
3729 | ||
3730 | if compile_prog "" "-ltcmalloc" ; then | |
3731 | LIBS="-ltcmalloc $LIBS" | |
3732 | else | |
3733 | feature_not_found "tcmalloc" "install gperftools devel" | |
3734 | fi | |
3735 | fi | |
3736 | ||
7b01cb97 AD |
3737 | ########################################## |
3738 | # jemalloc probe | |
3739 | ||
3740 | if test "$jemalloc" = "yes" ; then | |
3741 | cat > $TMPC << EOF | |
3742 | #include <stdlib.h> | |
3743 | int main(void) { malloc(1); return 0; } | |
3744 | EOF | |
3745 | ||
3746 | if compile_prog "" "-ljemalloc" ; then | |
3747 | LIBS="-ljemalloc $LIBS" | |
3748 | else | |
3749 | feature_not_found "jemalloc" "install jemalloc devel" | |
3750 | fi | |
3751 | fi | |
3752 | ||
dcc38d1c MT |
3753 | ########################################## |
3754 | # signalfd probe | |
3755 | signalfd="no" | |
3756 | cat > $TMPC << EOF | |
dcc38d1c MT |
3757 | #include <unistd.h> |
3758 | #include <sys/syscall.h> | |
3759 | #include <signal.h> | |
3760 | int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } | |
3761 | EOF | |
3762 | ||
3763 | if compile_prog "" "" ; then | |
3764 | signalfd=yes | |
3765 | fi | |
3766 | ||
c2882b96 RV |
3767 | # check if eventfd is supported |
3768 | eventfd=no | |
3769 | cat > $TMPC << EOF | |
3770 | #include <sys/eventfd.h> | |
3771 | ||
3772 | int main(void) | |
3773 | { | |
55cc7f3e | 3774 | return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); |
c2882b96 RV |
3775 | } |
3776 | EOF | |
3777 | if compile_prog "" "" ; then | |
3778 | eventfd=yes | |
3779 | fi | |
3780 | ||
751bcc39 MAL |
3781 | # check if memfd is supported |
3782 | memfd=no | |
3783 | cat > $TMPC << EOF | |
3784 | #include <sys/memfd.h> | |
3785 | ||
3786 | int main(void) | |
3787 | { | |
3788 | return memfd_create("foo", MFD_ALLOW_SEALING); | |
3789 | } | |
3790 | EOF | |
3791 | if compile_prog "" "" ; then | |
3792 | memfd=yes | |
3793 | fi | |
3794 | ||
3795 | ||
3796 | ||
d0927938 UH |
3797 | # check for fallocate |
3798 | fallocate=no | |
3799 | cat > $TMPC << EOF | |
3800 | #include <fcntl.h> | |
3801 | ||
3802 | int main(void) | |
3803 | { | |
3804 | fallocate(0, 0, 0, 0); | |
3805 | return 0; | |
3806 | } | |
3807 | EOF | |
8fb03151 | 3808 | if compile_prog "" "" ; then |
d0927938 UH |
3809 | fallocate=yes |
3810 | fi | |
3811 | ||
3d4fa43e KK |
3812 | # check for fallocate hole punching |
3813 | fallocate_punch_hole=no | |
3814 | cat > $TMPC << EOF | |
3815 | #include <fcntl.h> | |
3816 | #include <linux/falloc.h> | |
3817 | ||
3818 | int main(void) | |
3819 | { | |
3820 | fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); | |
3821 | return 0; | |
3822 | } | |
3823 | EOF | |
3824 | if compile_prog "" "" ; then | |
3825 | fallocate_punch_hole=yes | |
3826 | fi | |
3827 | ||
b953f075 DL |
3828 | # check that fallocate supports range zeroing inside the file |
3829 | fallocate_zero_range=no | |
3830 | cat > $TMPC << EOF | |
3831 | #include <fcntl.h> | |
3832 | #include <linux/falloc.h> | |
3833 | ||
3834 | int main(void) | |
3835 | { | |
3836 | fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0); | |
3837 | return 0; | |
3838 | } | |
3839 | EOF | |
3840 | if compile_prog "" "" ; then | |
3841 | fallocate_zero_range=yes | |
3842 | fi | |
3843 | ||
ed911435 KW |
3844 | # check for posix_fallocate |
3845 | posix_fallocate=no | |
3846 | cat > $TMPC << EOF | |
3847 | #include <fcntl.h> | |
3848 | ||
3849 | int main(void) | |
3850 | { | |
3851 | posix_fallocate(0, 0, 0); | |
3852 | return 0; | |
3853 | } | |
3854 | EOF | |
3855 | if compile_prog "" "" ; then | |
3856 | posix_fallocate=yes | |
3857 | fi | |
3858 | ||
c727f47d PM |
3859 | # check for sync_file_range |
3860 | sync_file_range=no | |
3861 | cat > $TMPC << EOF | |
3862 | #include <fcntl.h> | |
3863 | ||
3864 | int main(void) | |
3865 | { | |
3866 | sync_file_range(0, 0, 0, 0); | |
3867 | return 0; | |
3868 | } | |
3869 | EOF | |
8fb03151 | 3870 | if compile_prog "" "" ; then |
c727f47d PM |
3871 | sync_file_range=yes |
3872 | fi | |
3873 | ||
dace20dc PM |
3874 | # check for linux/fiemap.h and FS_IOC_FIEMAP |
3875 | fiemap=no | |
3876 | cat > $TMPC << EOF | |
3877 | #include <sys/ioctl.h> | |
3878 | #include <linux/fs.h> | |
3879 | #include <linux/fiemap.h> | |
3880 | ||
3881 | int main(void) | |
3882 | { | |
3883 | ioctl(0, FS_IOC_FIEMAP, 0); | |
3884 | return 0; | |
3885 | } | |
3886 | EOF | |
8fb03151 | 3887 | if compile_prog "" "" ; then |
dace20dc PM |
3888 | fiemap=yes |
3889 | fi | |
3890 | ||
d0927938 UH |
3891 | # check for dup3 |
3892 | dup3=no | |
3893 | cat > $TMPC << EOF | |
3894 | #include <unistd.h> | |
3895 | ||
3896 | int main(void) | |
3897 | { | |
3898 | dup3(0, 0, 0); | |
3899 | return 0; | |
3900 | } | |
3901 | EOF | |
78f5d726 | 3902 | if compile_prog "" "" ; then |
d0927938 UH |
3903 | dup3=yes |
3904 | fi | |
3905 | ||
4e0c6529 AB |
3906 | # check for ppoll support |
3907 | ppoll=no | |
3908 | cat > $TMPC << EOF | |
3909 | #include <poll.h> | |
3910 | ||
3911 | int main(void) | |
3912 | { | |
3913 | struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; | |
3914 | ppoll(&pfd, 1, 0, 0); | |
3915 | return 0; | |
3916 | } | |
3917 | EOF | |
3918 | if compile_prog "" "" ; then | |
3919 | ppoll=yes | |
3920 | fi | |
3921 | ||
cd758dd0 AB |
3922 | # check for prctl(PR_SET_TIMERSLACK , ... ) support |
3923 | prctl_pr_set_timerslack=no | |
3924 | cat > $TMPC << EOF | |
3925 | #include <sys/prctl.h> | |
3926 | ||
3927 | int main(void) | |
3928 | { | |
3929 | prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); | |
3930 | return 0; | |
3931 | } | |
3932 | EOF | |
3933 | if compile_prog "" "" ; then | |
3934 | prctl_pr_set_timerslack=yes | |
3935 | fi | |
3936 | ||
3b6edd16 PM |
3937 | # check for epoll support |
3938 | epoll=no | |
3939 | cat > $TMPC << EOF | |
3940 | #include <sys/epoll.h> | |
3941 | ||
3942 | int main(void) | |
3943 | { | |
3944 | epoll_create(0); | |
3945 | return 0; | |
3946 | } | |
3947 | EOF | |
8fb03151 | 3948 | if compile_prog "" "" ; then |
3b6edd16 PM |
3949 | epoll=yes |
3950 | fi | |
3951 | ||
227f0214 PM |
3952 | # epoll_create1 is a later addition |
3953 | # so we must check separately for its presence | |
3b6edd16 PM |
3954 | epoll_create1=no |
3955 | cat > $TMPC << EOF | |
3956 | #include <sys/epoll.h> | |
3957 | ||
3958 | int main(void) | |
3959 | { | |
19e83f6b PM |
3960 | /* Note that we use epoll_create1 as a value, not as |
3961 | * a function being called. This is necessary so that on | |
3962 | * old SPARC glibc versions where the function was present in | |
3963 | * the library but not declared in the header file we will | |
3964 | * fail the configure check. (Otherwise we will get a compiler | |
3965 | * warning but not an error, and will proceed to fail the | |
3966 | * qemu compile where we compile with -Werror.) | |
3967 | */ | |
c075a723 | 3968 | return (int)(uintptr_t)&epoll_create1; |
3b6edd16 PM |
3969 | } |
3970 | EOF | |
8fb03151 | 3971 | if compile_prog "" "" ; then |
3b6edd16 PM |
3972 | epoll_create1=yes |
3973 | fi | |
3974 | ||
a8fd1aba PM |
3975 | # check for sendfile support |
3976 | sendfile=no | |
3977 | cat > $TMPC << EOF | |
3978 | #include <sys/sendfile.h> | |
3979 | ||
3980 | int main(void) | |
3981 | { | |
3982 | return sendfile(0, 0, 0, 0); | |
3983 | } | |
3984 | EOF | |
3985 | if compile_prog "" "" ; then | |
3986 | sendfile=yes | |
3987 | fi | |
3988 | ||
51834341 RV |
3989 | # check for timerfd support (glibc 2.8 and newer) |
3990 | timerfd=no | |
3991 | cat > $TMPC << EOF | |
3992 | #include <sys/timerfd.h> | |
3993 | ||
3994 | int main(void) | |
3995 | { | |
3996 | return(timerfd_create(CLOCK_REALTIME, 0)); | |
3997 | } | |
3998 | EOF | |
3999 | if compile_prog "" "" ; then | |
4000 | timerfd=yes | |
4001 | fi | |
4002 | ||
9af5c906 RV |
4003 | # check for setns and unshare support |
4004 | setns=no | |
4005 | cat > $TMPC << EOF | |
4006 | #include <sched.h> | |
4007 | ||
4008 | int main(void) | |
4009 | { | |
4010 | int ret; | |
4011 | ret = setns(0, 0); | |
4012 | ret = unshare(0); | |
4013 | return ret; | |
4014 | } | |
4015 | EOF | |
4016 | if compile_prog "" "" ; then | |
4017 | setns=yes | |
4018 | fi | |
4019 | ||
38860a03 AM |
4020 | # clock_adjtime probe |
4021 | clock_adjtime=no | |
4022 | cat > $TMPC <<EOF | |
4023 | #include <time.h> | |
4024 | ||
4025 | int main(void) | |
4026 | { | |
4027 | return clock_adjtime(0, 0); | |
4028 | } | |
4029 | EOF | |
4030 | clock_adjtime=no | |
4031 | if compile_prog "" "" ; then | |
4032 | clock_adjtime=yes | |
4033 | fi | |
4034 | ||
5a03cd00 AM |
4035 | # syncfs probe |
4036 | syncfs=no | |
4037 | cat > $TMPC <<EOF | |
4038 | #include <unistd.h> | |
4039 | ||
4040 | int main(void) | |
4041 | { | |
4042 | return syncfs(0); | |
4043 | } | |
4044 | EOF | |
4045 | syncfs=no | |
4046 | if compile_prog "" "" ; then | |
4047 | syncfs=yes | |
4048 | fi | |
4049 | ||
cc8ae6de | 4050 | # Check if tools are available to build documentation. |
a25dba17 | 4051 | if test "$docs" != "no" ; then |
01668d98 | 4052 | if has makeinfo && has pod2man; then |
a25dba17 | 4053 | docs=yes |
83a3ab8b | 4054 | else |
a25dba17 | 4055 | if test "$docs" = "yes" ; then |
21684af0 | 4056 | feature_not_found "docs" "Install texinfo and Perl/perl-podlators" |
83a3ab8b | 4057 | fi |
a25dba17 | 4058 | docs=no |
83a3ab8b | 4059 | fi |
cc8ae6de PB |
4060 | fi |
4061 | ||
f514f41c | 4062 | # Search for bswap_32 function |
6ae9a1f4 JQ |
4063 | byteswap_h=no |
4064 | cat > $TMPC << EOF | |
4065 | #include <byteswap.h> | |
4066 | int main(void) { return bswap_32(0); } | |
4067 | EOF | |
52166aa0 | 4068 | if compile_prog "" "" ; then |
6ae9a1f4 JQ |
4069 | byteswap_h=yes |
4070 | fi | |
4071 | ||
75f13596 | 4072 | # Search for bswap32 function |
6ae9a1f4 JQ |
4073 | bswap_h=no |
4074 | cat > $TMPC << EOF | |
4075 | #include <sys/endian.h> | |
4076 | #include <sys/types.h> | |
4077 | #include <machine/bswap.h> | |
4078 | int main(void) { return bswap32(0); } | |
4079 | EOF | |
52166aa0 | 4080 | if compile_prog "" "" ; then |
6ae9a1f4 JQ |
4081 | bswap_h=yes |
4082 | fi | |
4083 | ||
c589b249 | 4084 | ########################################## |
e49ab19f | 4085 | # Do we have libiscsi >= 1.9.0 |
c589b249 | 4086 | if test "$libiscsi" != "no" ; then |
e49ab19f | 4087 | if $pkg_config --atleast-version=1.9.0 libiscsi; then |
3c33ea96 | 4088 | libiscsi="yes" |
ca871ec8 SW |
4089 | libiscsi_cflags=$($pkg_config --cflags libiscsi) |
4090 | libiscsi_libs=$($pkg_config --libs libiscsi) | |
c589b249 RS |
4091 | else |
4092 | if test "$libiscsi" = "yes" ; then | |
e49ab19f | 4093 | feature_not_found "libiscsi" "Install libiscsi >= 1.9.0" |
c589b249 RS |
4094 | fi |
4095 | libiscsi="no" | |
4096 | fi | |
4097 | fi | |
4098 | ||
8bacde8d NC |
4099 | ########################################## |
4100 | # Do we need libm | |
4101 | cat > $TMPC << EOF | |
4102 | #include <math.h> | |
f80ea986 | 4103 | int main(int argc, char **argv) { return isnan(sin((double)argc)); } |
8bacde8d NC |
4104 | EOF |
4105 | if compile_prog "" "" ; then | |
4106 | : | |
4107 | elif compile_prog "" "-lm" ; then | |
4108 | LIBS="-lm $LIBS" | |
4109 | libs_qga="-lm $libs_qga" | |
4110 | else | |
76ad07a4 | 4111 | error_exit "libm check failed" |
8bacde8d NC |
4112 | fi |
4113 | ||
da93a1fd AL |
4114 | ########################################## |
4115 | # Do we need librt | |
8bacde8d NC |
4116 | # uClibc provides 2 versions of clock_gettime(), one with realtime |
4117 | # support and one without. This means that the clock_gettime() don't | |
4118 | # need -lrt. We still need it for timer_create() so we check for this | |
4119 | # function in addition. | |
da93a1fd AL |
4120 | cat > $TMPC <<EOF |
4121 | #include <signal.h> | |
4122 | #include <time.h> | |
8bacde8d NC |
4123 | int main(void) { |
4124 | timer_create(CLOCK_REALTIME, NULL, NULL); | |
4125 | return clock_gettime(CLOCK_REALTIME, NULL); | |
4126 | } | |
da93a1fd AL |
4127 | EOF |
4128 | ||
52166aa0 | 4129 | if compile_prog "" "" ; then |
07ffa4bd | 4130 | : |
8bacde8d | 4131 | # we need pthread for static linking. use previous pthread test result |
18e588b1 RL |
4132 | elif compile_prog "" "$pthread_lib -lrt" ; then |
4133 | LIBS="$LIBS -lrt" | |
4134 | libs_qga="$libs_qga -lrt" | |
da93a1fd AL |
4135 | fi |
4136 | ||
31ff504d | 4137 | if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ |
179cf400 | 4138 | "$aix" != "yes" -a "$haiku" != "yes" ; then |
6362a53f JQ |
4139 | libs_softmmu="-lutil $libs_softmmu" |
4140 | fi | |
4141 | ||
de5071c5 | 4142 | ########################################## |
cd4ec0b4 GH |
4143 | # spice probe |
4144 | if test "$spice" != "no" ; then | |
4145 | cat > $TMPC << EOF | |
4146 | #include <spice.h> | |
4147 | int main(void) { spice_server_new(); return 0; } | |
4148 | EOF | |
710fc4f5 JD |
4149 | spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) |
4150 | spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) | |
65d5d3f9 SW |
4151 | if $pkg_config --atleast-version=0.12.0 spice-server && \ |
4152 | $pkg_config --atleast-version=0.12.3 spice-protocol && \ | |
cd4ec0b4 GH |
4153 | compile_prog "$spice_cflags" "$spice_libs" ; then |
4154 | spice="yes" | |
4155 | libs_softmmu="$libs_softmmu $spice_libs" | |
4156 | QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" | |
2e0e3c39 AL |
4157 | spice_protocol_version=$($pkg_config --modversion spice-protocol) |
4158 | spice_server_version=$($pkg_config --modversion spice-server) | |
cd4ec0b4 GH |
4159 | else |
4160 | if test "$spice" = "yes" ; then | |
8efc9363 HT |
4161 | feature_not_found "spice" \ |
4162 | "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel" | |
cd4ec0b4 GH |
4163 | fi |
4164 | spice="no" | |
4165 | fi | |
4166 | fi | |
4167 | ||
7b02f544 | 4168 | # check for smartcard support |
afd347ab | 4169 | smartcard_cflags="" |
7b02f544 MAL |
4170 | if test "$smartcard" != "no"; then |
4171 | if $pkg_config libcacard; then | |
4172 | libcacard_cflags=$($pkg_config --cflags libcacard) | |
4173 | libcacard_libs=$($pkg_config --libs libcacard) | |
4174 | QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags" | |
4175 | libs_softmmu="$libs_softmmu $libcacard_libs" | |
4176 | smartcard="yes" | |
afd347ab | 4177 | else |
7b02f544 MAL |
4178 | if test "$smartcard" = "yes"; then |
4179 | feature_not_found "smartcard" "Install libcacard devel" | |
111a38b0 | 4180 | fi |
7b02f544 | 4181 | smartcard="no" |
111a38b0 RR |
4182 | fi |
4183 | fi | |
111a38b0 | 4184 | |
2b2325ff GH |
4185 | # check for libusb |
4186 | if test "$libusb" != "no" ; then | |
65d5d3f9 | 4187 | if $pkg_config --atleast-version=1.0.13 libusb-1.0; then |
2b2325ff | 4188 | libusb="yes" |
ca871ec8 SW |
4189 | libusb_cflags=$($pkg_config --cflags libusb-1.0) |
4190 | libusb_libs=$($pkg_config --libs libusb-1.0) | |
2b2325ff GH |
4191 | QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags" |
4192 | libs_softmmu="$libs_softmmu $libusb_libs" | |
4193 | else | |
4194 | if test "$libusb" = "yes"; then | |
8efc9363 | 4195 | feature_not_found "libusb" "Install libusb devel >= 1.0.13" |
2b2325ff GH |
4196 | fi |
4197 | libusb="no" | |
4198 | fi | |
4199 | fi | |
4200 | ||
69354a83 HG |
4201 | # check for usbredirparser for usb network redirection support |
4202 | if test "$usb_redir" != "no" ; then | |
65d5d3f9 | 4203 | if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then |
69354a83 | 4204 | usb_redir="yes" |
ca871ec8 SW |
4205 | usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) |
4206 | usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) | |
69354a83 | 4207 | QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags" |
56ab2ad1 | 4208 | libs_softmmu="$libs_softmmu $usb_redir_libs" |
69354a83 HG |
4209 | else |
4210 | if test "$usb_redir" = "yes"; then | |
21684af0 | 4211 | feature_not_found "usb-redir" "Install usbredir devel" |
69354a83 HG |
4212 | fi |
4213 | usb_redir="no" | |
4214 | fi | |
4215 | fi | |
4216 | ||
d9840e25 TS |
4217 | ########################################## |
4218 | # check if we have VSS SDK headers for win | |
4219 | ||
4220 | if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then | |
4221 | case "$vss_win32_sdk" in | |
690604f6 | 4222 | "") vss_win32_include="-isystem $source_path" ;; |
d9840e25 TS |
4223 | *\ *) # The SDK is installed in "Program Files" by default, but we cannot |
4224 | # handle path with spaces. So we symlink the headers into ".sdk/vss". | |
690604f6 | 4225 | vss_win32_include="-isystem $source_path/.sdk/vss" |
d9840e25 TS |
4226 | symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" |
4227 | ;; | |
690604f6 | 4228 | *) vss_win32_include="-isystem $vss_win32_sdk" |
d9840e25 TS |
4229 | esac |
4230 | cat > $TMPC << EOF | |
4231 | #define __MIDL_user_allocate_free_DEFINED__ | |
4232 | #include <inc/win2003/vss.h> | |
4233 | int main(void) { return VSS_CTX_BACKUP; } | |
4234 | EOF | |
4235 | if compile_prog "$vss_win32_include" "" ; then | |
4236 | guest_agent_with_vss="yes" | |
4237 | QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" | |
315d3184 | 4238 | libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" |
f33ca81f | 4239 | qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" |
d9840e25 TS |
4240 | else |
4241 | if test "$vss_win32_sdk" != "" ; then | |
4242 | echo "ERROR: Please download and install Microsoft VSS SDK:" | |
4243 | echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" | |
4244 | echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" | |
4245 | echo "ERROR: scripts/extract-vsssdk-headers setup.exe" | |
4246 | echo "ERROR: The headers are extracted in the directory \`inc'." | |
4247 | feature_not_found "VSS support" | |
4248 | fi | |
4249 | guest_agent_with_vss="no" | |
4250 | fi | |
4251 | fi | |
4252 | ||
4253 | ########################################## | |
4254 | # lookup Windows platform SDK (if not specified) | |
4255 | # The SDK is needed only to build .tlb (type library) file of guest agent | |
4256 | # VSS provider from the source. It is usually unnecessary because the | |
4257 | # pre-compiled .tlb file is included. | |
4258 | ||
4259 | if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then | |
4260 | if test -z "$win_sdk"; then | |
4261 | programfiles="$PROGRAMFILES" | |
4262 | test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" | |
4263 | if test -n "$programfiles"; then | |
4264 | win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null | |
4265 | else | |
4266 | feature_not_found "Windows SDK" | |
4267 | fi | |
4268 | elif test "$win_sdk" = "no"; then | |
4269 | win_sdk="" | |
4270 | fi | |
4271 | fi | |
4272 | ||
50cbebb9 MR |
4273 | ########################################## |
4274 | # check if mingw environment provides a recent ntddscsi.h | |
4275 | if test "$mingw32" = "yes" -a "$guest_agent" != "no"; then | |
4276 | cat > $TMPC << EOF | |
4277 | #include <windows.h> | |
4278 | #include <ntddscsi.h> | |
4279 | int main(void) { | |
4280 | #if !defined(IOCTL_SCSI_GET_ADDRESS) | |
4281 | #error Missing required ioctl definitions | |
4282 | #endif | |
4283 | SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; | |
4284 | return addr.Lun; | |
4285 | } | |
4286 | EOF | |
4287 | if compile_prog "" "" ; then | |
4288 | guest_agent_ntddscsi=yes | |
c54e1eb4 | 4289 | libs_qga="-lsetupapi $libs_qga" |
50cbebb9 MR |
4290 | fi |
4291 | fi | |
4292 | ||
9d9e1521 GH |
4293 | ########################################## |
4294 | # virgl renderer probe | |
4295 | ||
4296 | if test "$virglrenderer" != "no" ; then | |
4297 | cat > $TMPC << EOF | |
4298 | #include <virglrenderer.h> | |
4299 | int main(void) { virgl_renderer_poll(); return 0; } | |
4300 | EOF | |
4301 | virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null) | |
4302 | virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null) | |
4303 | if $pkg_config virglrenderer >/dev/null 2>&1 && \ | |
4304 | compile_prog "$virgl_cflags" "$virgl_libs" ; then | |
4305 | virglrenderer="yes" | |
4306 | else | |
4307 | if test "$virglrenderer" = "yes" ; then | |
4308 | feature_not_found "virglrenderer" | |
4309 | fi | |
4310 | virglrenderer="no" | |
4311 | fi | |
4312 | fi | |
4313 | ||
5f6b9e8f BS |
4314 | ########################################## |
4315 | # check if we have fdatasync | |
4316 | ||
4317 | fdatasync=no | |
4318 | cat > $TMPC << EOF | |
4319 | #include <unistd.h> | |
d1722a27 AR |
4320 | int main(void) { |
4321 | #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 | |
4322 | return fdatasync(0); | |
4323 | #else | |
e172fe11 | 4324 | #error Not supported |
d1722a27 AR |
4325 | #endif |
4326 | } | |
5f6b9e8f BS |
4327 | EOF |
4328 | if compile_prog "" "" ; then | |
4329 | fdatasync=yes | |
4330 | fi | |
4331 | ||
e78815a5 AF |
4332 | ########################################## |
4333 | # check if we have madvise | |
4334 | ||
4335 | madvise=no | |
4336 | cat > $TMPC << EOF | |
4337 | #include <sys/types.h> | |
4338 | #include <sys/mman.h> | |
832ce9c2 | 4339 | #include <stddef.h> |
e78815a5 AF |
4340 | int main(void) { return madvise(NULL, 0, MADV_DONTNEED); } |
4341 | EOF | |
4342 | if compile_prog "" "" ; then | |
4343 | madvise=yes | |
4344 | fi | |
4345 | ||
4346 | ########################################## | |
4347 | # check if we have posix_madvise | |
4348 | ||
4349 | posix_madvise=no | |
4350 | cat > $TMPC << EOF | |
4351 | #include <sys/mman.h> | |
832ce9c2 | 4352 | #include <stddef.h> |
e78815a5 AF |
4353 | int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } |
4354 | EOF | |
4355 | if compile_prog "" "" ; then | |
4356 | posix_madvise=yes | |
4357 | fi | |
4358 | ||
0a852417 PD |
4359 | ########################################## |
4360 | # check if we have posix_syslog | |
4361 | ||
4362 | posix_syslog=no | |
4363 | cat > $TMPC << EOF | |
4364 | #include <syslog.h> | |
4365 | int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; } | |
4366 | EOF | |
4367 | if compile_prog "" "" ; then | |
4368 | posix_syslog=yes | |
4369 | fi | |
4370 | ||
94a420b1 SH |
4371 | ########################################## |
4372 | # check if trace backend exists | |
4373 | ||
5b808275 | 4374 | $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null |
94a420b1 | 4375 | if test "$?" -ne 0 ; then |
5b808275 LV |
4376 | error_exit "invalid trace backends" \ |
4377 | "Please choose supported trace backends." | |
94a420b1 SH |
4378 | fi |
4379 | ||
7e24e92a SH |
4380 | ########################################## |
4381 | # For 'ust' backend, test if ust headers are present | |
5b808275 | 4382 | if have_backend "ust"; then |
7e24e92a | 4383 | cat > $TMPC << EOF |
bf15f63c | 4384 | #include <lttng/tracepoint.h> |
7e24e92a SH |
4385 | int main(void) { return 0; } |
4386 | EOF | |
c79ed23d | 4387 | if compile_prog "" "-Wl,--no-as-needed -ldl" ; then |
bf15f63c | 4388 | if $pkg_config lttng-ust --exists; then |
89138857 | 4389 | lttng_ust_libs=$($pkg_config --libs lttng-ust) |
bf15f63c | 4390 | else |
c79ed23d | 4391 | lttng_ust_libs="-llttng-ust -ldl" |
bf15f63c MG |
4392 | fi |
4393 | if $pkg_config liburcu-bp --exists; then | |
89138857 | 4394 | urcu_bp_libs=$($pkg_config --libs liburcu-bp) |
bf15f63c MG |
4395 | else |
4396 | urcu_bp_libs="-lurcu-bp" | |
4397 | fi | |
4398 | ||
4399 | LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS" | |
4400 | libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga" | |
7e24e92a | 4401 | else |
bf15f63c | 4402 | error_exit "Trace backend 'ust' missing lttng-ust header files" |
7e24e92a SH |
4403 | fi |
4404 | fi | |
b3d08c02 DB |
4405 | |
4406 | ########################################## | |
4407 | # For 'dtrace' backend, test if 'dtrace' command is present | |
5b808275 | 4408 | if have_backend "dtrace"; then |
b3d08c02 | 4409 | if ! has 'dtrace' ; then |
76ad07a4 | 4410 | error_exit "dtrace command is not found in PATH $PATH" |
b3d08c02 | 4411 | fi |
c276b17d DB |
4412 | trace_backend_stap="no" |
4413 | if has 'stap' ; then | |
4414 | trace_backend_stap="yes" | |
4415 | fi | |
b3d08c02 DB |
4416 | fi |
4417 | ||
023367e6 | 4418 | ########################################## |
519175a2 | 4419 | # check and set a backend for coroutine |
d0e2fce5 | 4420 | |
7c2acc70 | 4421 | # We prefer ucontext, but it's not always possible. The fallback |
33c53c54 DB |
4422 | # is sigcontext. On Windows the only valid backend is the Windows |
4423 | # specific one. | |
7c2acc70 PM |
4424 | |
4425 | ucontext_works=no | |
4426 | if test "$darwin" != "yes"; then | |
4427 | cat > $TMPC << EOF | |
d0e2fce5 | 4428 | #include <ucontext.h> |
cdf84806 PM |
4429 | #ifdef __stub_makecontext |
4430 | #error Ignoring glibc stub makecontext which will always fail | |
4431 | #endif | |
75cafad7 | 4432 | int main(void) { makecontext(0, 0, 0); return 0; } |
d0e2fce5 | 4433 | EOF |
7c2acc70 PM |
4434 | if compile_prog "" "" ; then |
4435 | ucontext_works=yes | |
4436 | fi | |
4437 | fi | |
4438 | ||
4439 | if test "$coroutine" = ""; then | |
4440 | if test "$mingw32" = "yes"; then | |
4441 | coroutine=win32 | |
4442 | elif test "$ucontext_works" = "yes"; then | |
4443 | coroutine=ucontext | |
4444 | else | |
4445 | coroutine=sigaltstack | |
d0e2fce5 | 4446 | fi |
519175a2 | 4447 | else |
7c2acc70 PM |
4448 | case $coroutine in |
4449 | windows) | |
4450 | if test "$mingw32" != "yes"; then | |
4451 | error_exit "'windows' coroutine backend only valid for Windows" | |
4452 | fi | |
4453 | # Unfortunately the user visible backend name doesn't match the | |
4454 | # coroutine-*.c filename for this case, so we have to adjust it here. | |
4455 | coroutine=win32 | |
4456 | ;; | |
4457 | ucontext) | |
4458 | if test "$ucontext_works" != "yes"; then | |
4459 | feature_not_found "ucontext" | |
4460 | fi | |
4461 | ;; | |
33c53c54 | 4462 | sigaltstack) |
7c2acc70 PM |
4463 | if test "$mingw32" = "yes"; then |
4464 | error_exit "only the 'windows' coroutine backend is valid for Windows" | |
4465 | fi | |
4466 | ;; | |
4467 | *) | |
4468 | error_exit "unknown coroutine backend $coroutine" | |
4469 | ;; | |
4470 | esac | |
d0e2fce5 AK |
4471 | fi |
4472 | ||
70c60c08 | 4473 | if test "$coroutine_pool" = ""; then |
33c53c54 | 4474 | coroutine_pool=yes |
70c60c08 SH |
4475 | fi |
4476 | ||
7d992e4d PL |
4477 | if test "$debug_stack_usage" = "yes"; then |
4478 | if test "$cpu" = "ia64" -o "$cpu" = "hppa"; then | |
4479 | error_exit "stack usage debugging is not supported for $cpu" | |
4480 | fi | |
4481 | if test "$coroutine_pool" = "yes"; then | |
4482 | echo "WARN: disabling coroutine pool for stack usage debugging" | |
4483 | coroutine_pool=no | |
4484 | fi | |
4485 | fi | |
4486 | ||
4487 | ||
d2042378 AK |
4488 | ########################################## |
4489 | # check if we have open_by_handle_at | |
4490 | ||
4e1797f9 | 4491 | open_by_handle_at=no |
d2042378 AK |
4492 | cat > $TMPC << EOF |
4493 | #include <fcntl.h> | |
acc55ba8 SW |
4494 | #if !defined(AT_EMPTY_PATH) |
4495 | # error missing definition | |
4496 | #else | |
75cafad7 | 4497 | int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } |
acc55ba8 | 4498 | #endif |
d2042378 AK |
4499 | EOF |
4500 | if compile_prog "" "" ; then | |
4501 | open_by_handle_at=yes | |
4502 | fi | |
4503 | ||
e06a765e HPB |
4504 | ######################################## |
4505 | # check if we have linux/magic.h | |
4506 | ||
4507 | linux_magic_h=no | |
4508 | cat > $TMPC << EOF | |
4509 | #include <linux/magic.h> | |
4510 | int main(void) { | |
75cafad7 | 4511 | return 0; |
e06a765e HPB |
4512 | } |
4513 | EOF | |
4514 | if compile_prog "" "" ; then | |
4515 | linux_magic_h=yes | |
4516 | fi | |
4517 | ||
06d71fa1 | 4518 | ######################################## |
c95e3080 KW |
4519 | # check whether we can disable warning option with a pragma (this is needed |
4520 | # to silence warnings in the headers of some versions of external libraries). | |
4521 | # This test has to be compiled with -Werror as otherwise an unknown pragma is | |
4522 | # only a warning. | |
4523 | # | |
4524 | # If we can't selectively disable warning in the code, disable -Werror so that | |
4525 | # the build doesn't fail anyway. | |
4526 | ||
06d71fa1 PM |
4527 | pragma_disable_unused_but_set=no |
4528 | cat > $TMPC << EOF | |
e6f53fd5 | 4529 | #pragma GCC diagnostic push |
06d71fa1 | 4530 | #pragma GCC diagnostic ignored "-Wunused-but-set-variable" |
c95e3080 | 4531 | #pragma GCC diagnostic ignored "-Wstrict-prototypes" |
e6f53fd5 | 4532 | #pragma GCC diagnostic pop |
c95e3080 | 4533 | |
06d71fa1 PM |
4534 | int main(void) { |
4535 | return 0; | |
4536 | } | |
4537 | EOF | |
4538 | if compile_prog "-Werror" "" ; then | |
cc6e3ca9 | 4539 | pragma_diagnostic_available=yes |
c95e3080 KW |
4540 | else |
4541 | werror=no | |
06d71fa1 PM |
4542 | fi |
4543 | ||
3f4349dc | 4544 | ######################################## |
541be927 | 4545 | # check if we have valgrind/valgrind.h |
3f4349dc KW |
4546 | |
4547 | valgrind_h=no | |
4548 | cat > $TMPC << EOF | |
4549 | #include <valgrind/valgrind.h> | |
3f4349dc | 4550 | int main(void) { |
3f4349dc KW |
4551 | return 0; |
4552 | } | |
4553 | EOF | |
4554 | if compile_prog "" "" ; then | |
4555 | valgrind_h=yes | |
4556 | fi | |
4557 | ||
8ab1bf12 LC |
4558 | ######################################## |
4559 | # check if environ is declared | |
4560 | ||
4561 | has_environ=no | |
4562 | cat > $TMPC << EOF | |
4563 | #include <unistd.h> | |
4564 | int main(void) { | |
c075a723 | 4565 | environ = 0; |
8ab1bf12 LC |
4566 | return 0; |
4567 | } | |
4568 | EOF | |
4569 | if compile_prog "" "" ; then | |
4570 | has_environ=yes | |
4571 | fi | |
4572 | ||
76a347e1 RH |
4573 | ######################################## |
4574 | # check if cpuid.h is usable. | |
4575 | ||
4576 | cpuid_h=no | |
4577 | cat > $TMPC << EOF | |
4578 | #include <cpuid.h> | |
4579 | int main(void) { | |
774d566c PM |
4580 | unsigned a, b, c, d; |
4581 | int max = __get_cpuid_max(0, 0); | |
4582 | ||
4583 | if (max >= 1) { | |
4584 | __cpuid(1, a, b, c, d); | |
4585 | } | |
4586 | ||
4587 | if (max >= 7) { | |
4588 | __cpuid_count(7, 0, a, b, c, d); | |
4589 | } | |
4590 | ||
4591 | return 0; | |
76a347e1 RH |
4592 | } |
4593 | EOF | |
4594 | if compile_prog "" "" ; then | |
4595 | cpuid_h=yes | |
4596 | fi | |
4597 | ||
f540166b RH |
4598 | ######################################## |
4599 | # check if __[u]int128_t is usable. | |
4600 | ||
4601 | int128=no | |
4602 | cat > $TMPC << EOF | |
a00f66ab SW |
4603 | #if defined(__clang_major__) && defined(__clang_minor__) |
4604 | # if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2)) | |
4605 | # error __int128_t does not work in CLANG before 3.2 | |
4606 | # endif | |
4607 | #endif | |
f540166b RH |
4608 | __int128_t a; |
4609 | __uint128_t b; | |
4610 | int main (void) { | |
4611 | a = a + b; | |
4612 | b = a * b; | |
464e3671 | 4613 | a = a * a; |
f540166b RH |
4614 | return 0; |
4615 | } | |
4616 | EOF | |
4617 | if compile_prog "" "" ; then | |
4618 | int128=yes | |
4619 | fi | |
76a347e1 | 4620 | |
7ebee43e RH |
4621 | ######################################### |
4622 | # See if 128-bit atomic operations are supported. | |
4623 | ||
4624 | atomic128=no | |
4625 | if test "$int128" = "yes"; then | |
4626 | cat > $TMPC << EOF | |
4627 | int main(void) | |
4628 | { | |
4629 | unsigned __int128 x = 0, y = 0; | |
4630 | y = __atomic_load_16(&x, 0); | |
4631 | __atomic_store_16(&x, y, 0); | |
4632 | __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0); | |
4633 | return 0; | |
4634 | } | |
4635 | EOF | |
4636 | if compile_prog "" "" ; then | |
4637 | atomic128=yes | |
4638 | fi | |
4639 | fi | |
4640 | ||
df79b996 RH |
4641 | ######################################### |
4642 | # See if 64-bit atomic operations are supported. | |
4643 | # Note that without __atomic builtins, we can only | |
4644 | # assume atomic loads/stores max at pointer size. | |
4645 | ||
4646 | cat > $TMPC << EOF | |
4647 | #include <stdint.h> | |
4648 | int main(void) | |
4649 | { | |
4650 | uint64_t x = 0, y = 0; | |
4651 | #ifdef __ATOMIC_RELAXED | |
4652 | y = __atomic_load_8(&x, 0); | |
4653 | __atomic_store_8(&x, y, 0); | |
4654 | __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0); | |
4655 | __atomic_exchange_8(&x, y, 0); | |
4656 | __atomic_fetch_add_8(&x, y, 0); | |
4657 | #else | |
4658 | typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1]; | |
4659 | __sync_lock_test_and_set(&x, y); | |
4660 | __sync_val_compare_and_swap(&x, y, 0); | |
4661 | __sync_fetch_and_add(&x, y); | |
4662 | #endif | |
4663 | return 0; | |
4664 | } | |
4665 | EOF | |
4666 | if compile_prog "" "" ; then | |
4667 | atomic64=yes | |
4668 | fi | |
4669 | ||
1e6e9aca RH |
4670 | ######################################## |
4671 | # check if getauxval is available. | |
4672 | ||
4673 | getauxval=no | |
4674 | cat > $TMPC << EOF | |
4675 | #include <sys/auxv.h> | |
4676 | int main(void) { | |
4677 | return getauxval(AT_HWCAP) == 0; | |
4678 | } | |
4679 | EOF | |
4680 | if compile_prog "" "" ; then | |
4681 | getauxval=yes | |
4682 | fi | |
4683 | ||
fd0e6053 JS |
4684 | ######################################## |
4685 | # check if ccache is interfering with | |
4686 | # semantic analysis of macros | |
4687 | ||
5e4dfd3d | 4688 | unset CCACHE_CPP2 |
fd0e6053 JS |
4689 | ccache_cpp2=no |
4690 | cat > $TMPC << EOF | |
4691 | static const int Z = 1; | |
4692 | #define fn() ({ Z; }) | |
4693 | #define TAUT(X) ((X) == Z) | |
4694 | #define PAREN(X, Y) (X == Y) | |
4695 | #define ID(X) (X) | |
4696 | int main(int argc, char *argv[]) | |
4697 | { | |
4698 | int x = 0, y = 0; | |
4699 | x = ID(x); | |
4700 | x = fn(); | |
4701 | fn(); | |
4702 | if (PAREN(x, y)) return 0; | |
4703 | if (TAUT(Z)) return 0; | |
4704 | return 0; | |
4705 | } | |
4706 | EOF | |
4707 | ||
4708 | if ! compile_object "-Werror"; then | |
4709 | ccache_cpp2=yes | |
4710 | fi | |
4711 | ||
b553a042 JS |
4712 | ################################################# |
4713 | # clang does not support glibc + FORTIFY_SOURCE. | |
4714 | ||
4715 | if test "$fortify_source" != "no"; then | |
4716 | if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then | |
4717 | fortify_source="no"; | |
cfcc7c14 JS |
4718 | elif test -n "$cxx" && |
4719 | echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then | |
b553a042 JS |
4720 | fortify_source="no"; |
4721 | else | |
4722 | fortify_source="yes" | |
4723 | fi | |
4724 | fi | |
4725 | ||
277abf15 JV |
4726 | ########################################## |
4727 | # check if struct fsxattr is available via linux/fs.h | |
4728 | ||
4729 | have_fsxattr=no | |
4730 | cat > $TMPC << EOF | |
4731 | #include <linux/fs.h> | |
4732 | struct fsxattr foo; | |
4733 | int main(void) { | |
4734 | return 0; | |
4735 | } | |
4736 | EOF | |
4737 | if compile_prog "" "" ; then | |
4738 | have_fsxattr=yes | |
4739 | fi | |
4740 | ||
b66e10e4 PM |
4741 | ########################################## |
4742 | # check if rtnetlink.h exists and is useful | |
575b22b1 LV |
4743 | have_rtnetlink=no |
4744 | cat > $TMPC << EOF | |
4745 | #include <linux/rtnetlink.h> | |
4746 | int main(void) { | |
4747 | return IFLA_PROTO_DOWN; | |
4748 | } | |
4749 | EOF | |
4750 | if compile_prog "" "" ; then | |
4751 | have_rtnetlink=yes | |
4752 | fi | |
4753 | ||
6a02c806 SH |
4754 | ########################################## |
4755 | # check for usable AF_VSOCK environment | |
4756 | have_af_vsock=no | |
4757 | cat > $TMPC << EOF | |
4758 | #include <errno.h> | |
4759 | #include <sys/types.h> | |
4760 | #include <sys/socket.h> | |
4761 | #if !defined(AF_VSOCK) | |
4762 | # error missing AF_VSOCK flag | |
4763 | #endif | |
4764 | #include <linux/vm_sockets.h> | |
4765 | int main(void) { | |
4766 | int sock, ret; | |
4767 | struct sockaddr_vm svm; | |
4768 | socklen_t len = sizeof(svm); | |
4769 | sock = socket(AF_VSOCK, SOCK_STREAM, 0); | |
4770 | ret = getpeername(sock, (struct sockaddr *)&svm, &len); | |
4771 | if ((ret == -1) && (errno == ENOTCONN)) { | |
4772 | return 0; | |
4773 | } | |
4774 | return -1; | |
4775 | } | |
4776 | EOF | |
4777 | if compile_prog "" "" ; then | |
4778 | have_af_vsock=yes | |
4779 | fi | |
4780 | ||
6969ec6c JC |
4781 | ################################################# |
4782 | # Sparc implicitly links with --relax, which is | |
4783 | # incompatible with -r, so --no-relax should be | |
4784 | # given. It does no harm to give it on other | |
4785 | # platforms too. | |
4786 | ||
4787 | # Note: the prototype is needed since QEMU_CFLAGS | |
4788 | # contains -Wmissing-prototypes | |
4789 | cat > $TMPC << EOF | |
4790 | extern int foo(void); | |
4791 | int foo(void) { return 0; } | |
4792 | EOF | |
4793 | if ! compile_object ""; then | |
4794 | error_exit "Failed to compile object file for LD_REL_FLAGS test" | |
4795 | fi | |
7ecf44a5 PB |
4796 | for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do |
4797 | if do_cc -nostdlib $i -o $TMPMO $TMPO; then | |
4798 | LD_REL_FLAGS=$i | |
4799 | break | |
4800 | fi | |
4801 | done | |
4802 | if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then | |
4803 | feature_not_found "modules" "Cannot find how to build relocatable objects" | |
6969ec6c JC |
4804 | fi |
4805 | ||
4d04351f CC |
4806 | ########################################## |
4807 | # check for sysmacros.h | |
4808 | ||
4809 | have_sysmacros=no | |
4810 | cat > $TMPC << EOF | |
4811 | #include <sys/sysmacros.h> | |
4812 | int main(void) { | |
4813 | return makedev(0, 0); | |
4814 | } | |
4815 | EOF | |
4816 | if compile_prog "" "" ; then | |
4817 | have_sysmacros=yes | |
4818 | fi | |
4819 | ||
da92c3ff AM |
4820 | ########################################## |
4821 | # Veritas HyperScale block driver VxHS | |
4822 | # Check if libvxhs is installed | |
4823 | ||
4824 | if test "$vxhs" != "no" ; then | |
4825 | cat > $TMPC <<EOF | |
4826 | #include <stdint.h> | |
4827 | #include <qnio/qnio_api.h> | |
4828 | ||
4829 | void *vxhs_callback; | |
4830 | ||
4831 | int main(void) { | |
4832 | iio_init(QNIO_VERSION, vxhs_callback); | |
4833 | return 0; | |
4834 | } | |
4835 | EOF | |
4836 | vxhs_libs="-lvxhs -lssl" | |
4837 | if compile_prog "" "$vxhs_libs" ; then | |
4838 | vxhs=yes | |
4839 | else | |
4840 | if test "$vxhs" = "yes" ; then | |
4841 | feature_not_found "vxhs block device" "Install libvxhs See github" | |
4842 | fi | |
4843 | vxhs=no | |
4844 | fi | |
4845 | fi | |
4846 | ||
49e00a18 AG |
4847 | ########################################## |
4848 | # check for _Static_assert() | |
4849 | ||
4850 | have_static_assert=no | |
4851 | cat > $TMPC << EOF | |
4852 | _Static_assert(1, "success"); | |
4853 | int main(void) { | |
4854 | return 0; | |
4855 | } | |
4856 | EOF | |
4857 | if compile_prog "" "" ; then | |
4858 | have_static_assert=yes | |
4859 | fi | |
4860 | ||
7e24e92a | 4861 | ########################################## |
e86ecd4b JQ |
4862 | # End of CC checks |
4863 | # After here, no more $cc or $ld runs | |
4864 | ||
1d728c39 BS |
4865 | if test "$gcov" = "yes" ; then |
4866 | CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS" | |
4867 | LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS" | |
b553a042 | 4868 | elif test "$fortify_source" = "yes" ; then |
e600cdf3 | 4869 | CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" |
ce278618 PM |
4870 | elif test "$debug" = "no"; then |
4871 | CFLAGS="-O2 $CFLAGS" | |
e86ecd4b | 4872 | fi |
a316e378 | 4873 | |
6542aa9c PL |
4874 | ########################################## |
4875 | # Do we have libnfs | |
4876 | if test "$libnfs" != "no" ; then | |
b7d769c9 | 4877 | if $pkg_config --atleast-version=1.9.3 libnfs; then |
6542aa9c PL |
4878 | libnfs="yes" |
4879 | libnfs_libs=$($pkg_config --libs libnfs) | |
6542aa9c PL |
4880 | else |
4881 | if test "$libnfs" = "yes" ; then | |
8efc9363 | 4882 | feature_not_found "libnfs" "Install libnfs devel >= 1.9.3" |
6542aa9c PL |
4883 | fi |
4884 | libnfs="no" | |
4885 | fi | |
4886 | fi | |
1d728c39 | 4887 | |
6ca026cb PM |
4888 | # Now we've finished running tests it's OK to add -Werror to the compiler flags |
4889 | if test "$werror" = "yes"; then | |
4890 | QEMU_CFLAGS="-Werror $QEMU_CFLAGS" | |
4891 | fi | |
4892 | ||
e86ecd4b JQ |
4893 | if test "$solaris" = "no" ; then |
4894 | if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then | |
1156c669 | 4895 | LDFLAGS="-Wl,--warn-common $LDFLAGS" |
e86ecd4b JQ |
4896 | fi |
4897 | fi | |
4898 | ||
94dd53c5 GH |
4899 | # test if pod2man has --utf8 option |
4900 | if pod2man --help | grep -q utf8; then | |
4901 | POD2MAN="pod2man --utf8" | |
4902 | else | |
4903 | POD2MAN="pod2man" | |
4904 | fi | |
4905 | ||
952afb71 BS |
4906 | # Use ASLR, no-SEH and DEP if available |
4907 | if test "$mingw32" = "yes" ; then | |
4908 | for flag in --dynamicbase --no-seh --nxcompat; do | |
4909 | if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then | |
4910 | LDFLAGS="-Wl,$flag $LDFLAGS" | |
4911 | fi | |
4912 | done | |
4913 | fi | |
4914 | ||
10ea68b3 | 4915 | qemu_confdir=$sysconfdir$confsuffix |
e26110cf | 4916 | qemu_moddir=$libdir$confsuffix |
528ae5b8 | 4917 | qemu_datadir=$datadir$confsuffix |
834574ea | 4918 | qemu_localedir="$datadir/locale" |
e7b45cc4 | 4919 | |
4b1c11fd DB |
4920 | tools="" |
4921 | if test "$want_tools" = "yes" ; then | |
ca35f780 | 4922 | tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" |
4b1c11fd DB |
4923 | if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then |
4924 | tools="qemu-nbd\$(EXESUF) $tools" | |
a75eb03b | 4925 | tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools" |
4b1c11fd DB |
4926 | fi |
4927 | fi | |
4928 | if test "$softmmu" = yes ; then | |
983eef5a | 4929 | if test "$virtfs" != no ; then |
aabfd88d AF |
4930 | if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then |
4931 | virtfs=yes | |
4932 | tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" | |
4933 | else | |
4934 | if test "$virtfs" = yes; then | |
3f3b5388 | 4935 | error_exit "VirtFS is supported only on Linux and requires libcap devel and libattr devel" |
983eef5a | 4936 | fi |
17500370 | 4937 | virtfs=no |
aabfd88d | 4938 | fi |
17bff52b | 4939 | fi |
e8ef31a3 | 4940 | fi |
9d6bc27b MR |
4941 | |
4942 | # Probe for guest agent support/options | |
4943 | ||
e8ef31a3 | 4944 | if [ "$guest_agent" != "no" ]; then |
b39297ae | 4945 | if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then |
fafcaf1d | 4946 | tools="qemu-ga $tools" |
e8ef31a3 MT |
4947 | guest_agent=yes |
4948 | elif [ "$guest_agent" != yes ]; then | |
4949 | guest_agent=no | |
4950 | else | |
4951 | error_exit "Guest agent is not supported on this platform" | |
ca35f780 | 4952 | fi |
00c705fb | 4953 | fi |
ca35f780 | 4954 | |
9d6bc27b MR |
4955 | # Guest agent Window MSI package |
4956 | ||
4957 | if test "$guest_agent" != yes; then | |
4958 | if test "$guest_agent_msi" = yes; then | |
4959 | error_exit "MSI guest agent package requires guest agent enabled" | |
4960 | fi | |
4961 | guest_agent_msi=no | |
4962 | elif test "$mingw32" != "yes"; then | |
4963 | if test "$guest_agent_msi" = "yes"; then | |
4964 | error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" | |
4965 | fi | |
4966 | guest_agent_msi=no | |
4967 | elif ! has wixl; then | |
4968 | if test "$guest_agent_msi" = "yes"; then | |
4969 | error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" | |
4970 | fi | |
4971 | guest_agent_msi=no | |
1a34904e MR |
4972 | else |
4973 | # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't | |
4974 | # disabled explicitly | |
4975 | if test "$guest_agent_msi" != "no"; then | |
4976 | guest_agent_msi=yes | |
4977 | fi | |
9d6bc27b MR |
4978 | fi |
4979 | ||
1a34904e | 4980 | if test "$guest_agent_msi" = "yes"; then |
9d6bc27b MR |
4981 | if test "$guest_agent_with_vss" = "yes"; then |
4982 | QEMU_GA_MSI_WITH_VSS="-D InstallVss" | |
4983 | fi | |
4984 | ||
4985 | if test "$QEMU_GA_MANUFACTURER" = ""; then | |
4986 | QEMU_GA_MANUFACTURER=QEMU | |
4987 | fi | |
4988 | ||
4989 | if test "$QEMU_GA_DISTRO" = ""; then | |
4990 | QEMU_GA_DISTRO=Linux | |
4991 | fi | |
4992 | ||
4993 | if test "$QEMU_GA_VERSION" = ""; then | |
89138857 | 4994 | QEMU_GA_VERSION=$(cat $source_path/VERSION) |
9d6bc27b MR |
4995 | fi |
4996 | ||
89138857 | 4997 | QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin" |
9d6bc27b MR |
4998 | |
4999 | case "$cpu" in | |
5000 | x86_64) | |
5001 | QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" | |
5002 | ;; | |
5003 | i386) | |
5004 | QEMU_GA_MSI_ARCH="-D Arch=32" | |
5005 | ;; | |
5006 | *) | |
5007 | error_exit "CPU $cpu not supported for building installation package" | |
5008 | ;; | |
5009 | esac | |
5010 | fi | |
5011 | ||
ca35f780 PB |
5012 | # Mac OS X ships with a broken assembler |
5013 | roms= | |
5014 | if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ | |
5015 | "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ | |
5016 | "$softmmu" = yes ; then | |
e57218b6 PM |
5017 | # Different host OS linkers have different ideas about the name of the ELF |
5018 | # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd | |
5019 | # variant; and Windows uses i386pe. | |
5020 | for emu in elf_i386 elf_i386_fbsd i386pe; do | |
5021 | if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then | |
5022 | ld_i386_emulation="$emu" | |
5023 | roms="optionrom" | |
5024 | break | |
5025 | fi | |
5026 | done | |
ca35f780 | 5027 | fi |
d0384d1d | 5028 | if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then |
39ac8455 DG |
5029 | roms="$roms spapr-rtas" |
5030 | fi | |
ca35f780 | 5031 | |
9933c305 CB |
5032 | if test "$cpu" = "s390x" ; then |
5033 | roms="$roms s390-ccw" | |
5034 | fi | |
5035 | ||
964c6fa1 | 5036 | # Probe for the need for relocating the user-only binary. |
92fe2ba8 | 5037 | if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then |
964c6fa1 RH |
5038 | textseg_addr= |
5039 | case "$cpu" in | |
479eb121 RH |
5040 | arm | i386 | ppc* | s390* | sparc* | x86_64 | x32) |
5041 | # ??? Rationale for choosing this address | |
964c6fa1 RH |
5042 | textseg_addr=0x60000000 |
5043 | ;; | |
5044 | mips) | |
479eb121 RH |
5045 | # A 256M aligned address, high in the address space, with enough |
5046 | # room for the code_gen_buffer above it before the stack. | |
5047 | textseg_addr=0x60000000 | |
964c6fa1 RH |
5048 | ;; |
5049 | esac | |
5050 | if [ -n "$textseg_addr" ]; then | |
5051 | cat > $TMPC <<EOF | |
5052 | int main(void) { return 0; } | |
5053 | EOF | |
5054 | textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr" | |
5055 | if ! compile_prog "" "$textseg_ldflags"; then | |
5056 | # In case ld does not support -Ttext-segment, edit the default linker | |
5057 | # script via sed to set the .text start addr. This is needed on FreeBSD | |
5058 | # at least. | |
92fe2ba8 PM |
5059 | if ! $ld --verbose >/dev/null 2>&1; then |
5060 | error_exit \ | |
5061 | "We need to link the QEMU user mode binaries at a" \ | |
5062 | "specific text address. Unfortunately your linker" \ | |
5063 | "doesn't support either the -Ttext-segment option or" \ | |
5064 | "printing the default linker script with --verbose." \ | |
5065 | "If you don't want the user mode binaries, pass the" \ | |
5066 | "--disable-user option to configure." | |
5067 | fi | |
5068 | ||
964c6fa1 RH |
5069 | $ld --verbose | sed \ |
5070 | -e '1,/==================================================/d' \ | |
5071 | -e '/==================================================/,$d' \ | |
5072 | -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \ | |
5073 | -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld | |
5074 | textseg_ldflags="-Wl,-T../config-host.ld" | |
5075 | fi | |
5076 | fi | |
5077 | fi | |
5078 | ||
02d34f62 CR |
5079 | echo_version() { |
5080 | if test "$1" = "yes" ; then | |
5081 | echo "($2)" | |
5082 | fi | |
5083 | } | |
5084 | ||
50e12060 JK |
5085 | # prepend pixman and ftd flags after all config tests are done |
5086 | QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS" | |
5087 | libs_softmmu="$pixman_libs $libs_softmmu" | |
5ca9388a | 5088 | |
43ce4dfe | 5089 | echo "Install prefix $prefix" |
89138857 SW |
5090 | echo "BIOS directory $(eval echo $qemu_datadir)" |
5091 | echo "binary directory $(eval echo $bindir)" | |
5092 | echo "library directory $(eval echo $libdir)" | |
5093 | echo "module directory $(eval echo $qemu_moddir)" | |
5094 | echo "libexec directory $(eval echo $libexecdir)" | |
5095 | echo "include directory $(eval echo $includedir)" | |
5096 | echo "config directory $(eval echo $sysconfdir)" | |
11d9f695 | 5097 | if test "$mingw32" = "no" ; then |
89138857 SW |
5098 | echo "local state directory $(eval echo $local_statedir)" |
5099 | echo "Manual directory $(eval echo $mandir)" | |
43ce4dfe | 5100 | echo "ELF interp prefix $interp_prefix" |
5a699bbb LE |
5101 | else |
5102 | echo "local state directory queried at runtime" | |
d9840e25 | 5103 | echo "Windows SDK $win_sdk" |
11d9f695 | 5104 | fi |
5a67135a | 5105 | echo "Source path $source_path" |
43ce4dfe | 5106 | echo "C compiler $cc" |
83469015 | 5107 | echo "Host C compiler $host_cc" |
83f73fce | 5108 | echo "C++ compiler $cxx" |
3c4a4d0d | 5109 | echo "Objective-C compiler $objcc" |
45d285ab | 5110 | echo "ARFLAGS $ARFLAGS" |
0c439cbf | 5111 | echo "CFLAGS $CFLAGS" |
a558ee17 | 5112 | echo "QEMU_CFLAGS $QEMU_CFLAGS" |
0c439cbf | 5113 | echo "LDFLAGS $LDFLAGS" |
43ce4dfe | 5114 | echo "make $make" |
6a882643 | 5115 | echo "install $install" |
c886edfb | 5116 | echo "python $python" |
e2d8830e BS |
5117 | if test "$slirp" = "yes" ; then |
5118 | echo "smbd $smbd" | |
5119 | fi | |
17969268 | 5120 | echo "module support $modules" |
43ce4dfe | 5121 | echo "host CPU $cpu" |
de83cd02 | 5122 | echo "host big endian $bigendian" |
97a847bc | 5123 | echo "target list $target_list" |
ade25b0d | 5124 | echo "tcg debug enabled $debug_tcg" |
43ce4dfe | 5125 | echo "gprof enabled $gprof" |
03b4fe7d | 5126 | echo "sparse enabled $sparse" |
1625af87 | 5127 | echo "strip binaries $strip_opt" |
05c2a3e7 | 5128 | echo "profiler $profiler" |
43ce4dfe | 5129 | echo "static build $static" |
5b0753e0 FB |
5130 | if test "$darwin" = "yes" ; then |
5131 | echo "Cocoa support $cocoa" | |
5132 | fi | |
e2134eb9 | 5133 | echo "pixman $pixman" |
89138857 SW |
5134 | echo "SDL support $sdl $(echo_version $sdl $sdlversion)" |
5135 | echo "GTK support $gtk $(echo_version $gtk $gtk_version)" | |
925a0400 | 5136 | echo "GTK GL support $gtk_gl" |
89138857 | 5137 | echo "VTE support $vte $(echo_version $vte $vteversion)" |
a1c5e949 | 5138 | echo "TLS priority $tls_priority" |
ddbb0d09 | 5139 | echo "GNUTLS support $gnutls" |
b917da4c | 5140 | echo "GNUTLS rnd $gnutls_rnd" |
91bfcdb0 | 5141 | echo "libgcrypt $gcrypt" |
37788f25 | 5142 | echo "libgcrypt kdf $gcrypt_kdf" |
89138857 | 5143 | echo "nettle $nettle $(echo_version $nettle $nettle_version)" |
fff2f982 | 5144 | echo "nettle kdf $nettle_kdf" |
9a2fd434 | 5145 | echo "libtasn1 $tasn1" |
4d3b6f6e | 5146 | echo "curses support $curses" |
9d9e1521 | 5147 | echo "virgl support $virglrenderer" |
769ce76d | 5148 | echo "curl support $curl" |
67b915a5 | 5149 | echo "mingw32 support $mingw32" |
0c58ac1c | 5150 | echo "Audio drivers $audio_drv_list" |
b64ec4e4 FZ |
5151 | echo "Block whitelist (rw) $block_drv_rw_whitelist" |
5152 | echo "Block whitelist (ro) $block_drv_ro_whitelist" | |
983eef5a | 5153 | echo "VirtFS support $virtfs" |
821601ea JS |
5154 | echo "VNC support $vnc" |
5155 | if test "$vnc" = "yes" ; then | |
821601ea JS |
5156 | echo "VNC SASL support $vnc_sasl" |
5157 | echo "VNC JPEG support $vnc_jpeg" | |
5158 | echo "VNC PNG support $vnc_png" | |
821601ea | 5159 | fi |
3142255c BS |
5160 | if test -n "$sparc_cpu"; then |
5161 | echo "Target Sparc Arch $sparc_cpu" | |
5162 | fi | |
e37630ca | 5163 | echo "xen support $xen" |
3996e85c PD |
5164 | if test "$xen" = "yes" ; then |
5165 | echo "xen ctrl version $xen_ctrl_version" | |
64a7ad6f | 5166 | echo "pv dom build $xen_pv_domain_build" |
3996e85c | 5167 | fi |
2e4d9fb1 | 5168 | echo "brlapi support $brlapi" |
a20a6f46 | 5169 | echo "bluez support $bluez" |
a25dba17 | 5170 | echo "Documentation $docs" |
40d6444e | 5171 | echo "PIE $pie" |
8a16d273 | 5172 | echo "vde support $vde" |
58952137 | 5173 | echo "netmap support $netmap" |
5c6c3a6c | 5174 | echo "Linux AIO support $linux_aio" |
758e8e38 | 5175 | echo "ATTR/XATTR support $attr" |
77755340 | 5176 | echo "Install blobs $blobs" |
b31a0277 | 5177 | echo "KVM support $kvm" |
b0cb0a66 | 5178 | echo "HAX support $hax" |
2da776db | 5179 | echo "RDMA support $rdma" |
9195b2c2 | 5180 | echo "TCG interpreter $tcg_interpreter" |
f652e6af | 5181 | echo "fdt support $fdt" |
ceb42de8 | 5182 | echo "preadv support $preadv" |
5f6b9e8f | 5183 | echo "fdatasync $fdatasync" |
e78815a5 AF |
5184 | echo "madvise $madvise" |
5185 | echo "posix_madvise $posix_madvise" | |
47e98658 | 5186 | echo "libcap-ng support $cap_ng" |
d5970055 | 5187 | echo "vhost-net support $vhost_net" |
5e9be92d | 5188 | echo "vhost-scsi support $vhost_scsi" |
fc0b9b0e | 5189 | echo "vhost-vsock support $vhost_vsock" |
5b808275 | 5190 | echo "Trace backends $trace_backends" |
713572a7 | 5191 | if have_backend "simple"; then |
9410b56c | 5192 | echo "Trace output file $trace_file-<pid>" |
e00e36fb | 5193 | fi |
89138857 | 5194 | echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)" |
f27aaf4b | 5195 | echo "rbd support $rbd" |
dce512de | 5196 | echo "xfsctl support $xfs" |
7b02f544 | 5197 | echo "smartcard support $smartcard" |
2b2325ff | 5198 | echo "libusb $libusb" |
69354a83 | 5199 | echo "usb net redir $usb_redir" |
da076ffe | 5200 | echo "OpenGL support $opengl" |
014cb152 | 5201 | echo "OpenGL dmabufs $opengl_dmabuf" |
c589b249 | 5202 | echo "libiscsi support $libiscsi" |
6542aa9c | 5203 | echo "libnfs support $libnfs" |
d138cee9 | 5204 | echo "build guest agent $guest_agent" |
d9840e25 | 5205 | echo "QGA VSS support $guest_agent_with_vss" |
50cbebb9 | 5206 | echo "QGA w32 disk info $guest_agent_ntddscsi" |
4c875d89 | 5207 | echo "QGA MSI support $guest_agent_msi" |
f794573e | 5208 | echo "seccomp support $seccomp" |
7c2acc70 | 5209 | echo "coroutine backend $coroutine" |
70c60c08 | 5210 | echo "coroutine pool $coroutine_pool" |
7d992e4d | 5211 | echo "debug stack usage $debug_stack_usage" |
eb100396 | 5212 | echo "GlusterFS support $glusterfs" |
1d728c39 BS |
5213 | echo "gcov $gcov_tool" |
5214 | echo "gcov enabled $gcov" | |
ab214c29 | 5215 | echo "TPM support $tpm" |
0a12ec87 | 5216 | echo "libssh2 support $libssh2" |
3b8acc11 | 5217 | echo "TPM passthrough $tpm_passthrough" |
3556c233 | 5218 | echo "QOM debugging $qom_cast_debug" |
607dacd0 QN |
5219 | echo "lzo support $lzo" |
5220 | echo "snappy support $snappy" | |
6b383c08 | 5221 | echo "bzip2 support $bzip2" |
a99d57bb | 5222 | echo "NUMA host support $numa" |
2847b469 | 5223 | echo "tcmalloc support $tcmalloc" |
7b01cb97 | 5224 | echo "jemalloc support $jemalloc" |
99f2dbd3 | 5225 | echo "avx2 optimization $avx2_opt" |
a6b1d4c0 | 5226 | echo "replication support $replication" |
da92c3ff | 5227 | echo "VxHS block device $vxhs" |
67b915a5 | 5228 | |
1ba16968 | 5229 | if test "$sdl_too_old" = "yes"; then |
24b55b96 | 5230 | echo "-> Your SDL version is too old - please upgrade to have SDL support" |
7c1f25b4 | 5231 | fi |
7d13299d | 5232 | |
898be3e0 PM |
5233 | if test "$supported_cpu" = "no"; then |
5234 | echo | |
5235 | echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!" | |
5236 | echo | |
5237 | echo "CPU host architecture $cpu support is not currently maintained." | |
5238 | echo "The QEMU project intends to remove support for this host CPU in" | |
5239 | echo "a future release if nobody volunteers to maintain it and to" | |
5240 | echo "provide a build host for our continuous integration setup." | |
5241 | echo "configure has succeeded and you can continue to build, but" | |
5242 | echo "if you care about QEMU on this platform you should contact" | |
5243 | echo "us upstream at qemu-devel@nongnu.org." | |
5244 | fi | |
5245 | ||
5246 | if test "$supported_os" = "no"; then | |
5247 | echo | |
5248 | echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!" | |
5249 | echo | |
c50126aa PM |
5250 | echo "Host OS $targetos support is not currently maintained." |
5251 | echo "The QEMU project intends to remove support for this host OS in" | |
898be3e0 PM |
5252 | echo "a future release if nobody volunteers to maintain it and to" |
5253 | echo "provide a build host for our continuous integration setup." | |
5254 | echo "configure has succeeded and you can continue to build, but" | |
5255 | echo "if you care about QEMU on this platform you should contact" | |
5256 | echo "us upstream at qemu-devel@nongnu.org." | |
5257 | fi | |
5258 | ||
98ec69ac | 5259 | config_host_mak="config-host.mak" |
98ec69ac | 5260 | |
dbd99ae3 SW |
5261 | echo "# Automatically generated by configure - do not modify" >config-all-disas.mak |
5262 | ||
98ec69ac | 5263 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
98ec69ac | 5264 | echo >> $config_host_mak |
98ec69ac | 5265 | |
e6c3b0f7 | 5266 | echo all: >> $config_host_mak |
99d7cc75 PB |
5267 | echo "prefix=$prefix" >> $config_host_mak |
5268 | echo "bindir=$bindir" >> $config_host_mak | |
3aa5d2be | 5269 | echo "libdir=$libdir" >> $config_host_mak |
8bf188aa | 5270 | echo "libexecdir=$libexecdir" >> $config_host_mak |
0f94d6da | 5271 | echo "includedir=$includedir" >> $config_host_mak |
99d7cc75 | 5272 | echo "mandir=$mandir" >> $config_host_mak |
99d7cc75 | 5273 | echo "sysconfdir=$sysconfdir" >> $config_host_mak |
22d07038 | 5274 | echo "qemu_confdir=$qemu_confdir" >> $config_host_mak |
9afa52ce EH |
5275 | echo "qemu_datadir=$qemu_datadir" >> $config_host_mak |
5276 | echo "qemu_docdir=$qemu_docdir" >> $config_host_mak | |
e26110cf | 5277 | echo "qemu_moddir=$qemu_moddir" >> $config_host_mak |
5a699bbb LE |
5278 | if test "$mingw32" = "no" ; then |
5279 | echo "qemu_localstatedir=$local_statedir" >> $config_host_mak | |
5280 | fi | |
f354b1a1 | 5281 | echo "qemu_helperdir=$libexecdir" >> $config_host_mak |
f9943cd5 GH |
5282 | echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak |
5283 | echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak | |
834574ea | 5284 | echo "qemu_localedir=$qemu_localedir" >> $config_host_mak |
f544a488 | 5285 | echo "libs_softmmu=$libs_softmmu" >> $config_host_mak |
804edf29 | 5286 | |
98ec69ac | 5287 | echo "ARCH=$ARCH" >> $config_host_mak |
727e5283 | 5288 | |
f8393946 | 5289 | if test "$debug_tcg" = "yes" ; then |
2358a494 | 5290 | echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak |
f8393946 | 5291 | fi |
1625af87 | 5292 | if test "$strip_opt" = "yes" ; then |
52ba784d | 5293 | echo "STRIP=${strip}" >> $config_host_mak |
1625af87 | 5294 | fi |
7d13299d | 5295 | if test "$bigendian" = "yes" ; then |
e2542fe2 | 5296 | echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak |
97a847bc | 5297 | fi |
67b915a5 | 5298 | if test "$mingw32" = "yes" ; then |
98ec69ac | 5299 | echo "CONFIG_WIN32=y" >> $config_host_mak |
89138857 | 5300 | rc_version=$(cat $source_path/VERSION) |
9fe6de94 BS |
5301 | version_major=${rc_version%%.*} |
5302 | rc_version=${rc_version#*.} | |
5303 | version_minor=${rc_version%%.*} | |
5304 | rc_version=${rc_version#*.} | |
5305 | version_subminor=${rc_version%%.*} | |
5306 | version_micro=0 | |
5307 | echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak | |
5308 | echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak | |
d9840e25 TS |
5309 | if test "$guest_agent_with_vss" = "yes" ; then |
5310 | echo "CONFIG_QGA_VSS=y" >> $config_host_mak | |
f33ca81f | 5311 | echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak |
d9840e25 TS |
5312 | echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak |
5313 | fi | |
50cbebb9 MR |
5314 | if test "$guest_agent_ntddscsi" = "yes" ; then |
5315 | echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak | |
5316 | fi | |
1a34904e | 5317 | if test "$guest_agent_msi" = "yes"; then |
9dacf32d YH |
5318 | echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak |
5319 | echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak | |
5320 | echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak | |
5321 | echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak | |
5322 | echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak | |
5323 | echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak | |
5324 | echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak | |
5325 | fi | |
210fa556 | 5326 | else |
35f4df27 | 5327 | echo "CONFIG_POSIX=y" >> $config_host_mak |
dffcb71c MM |
5328 | fi |
5329 | ||
5330 | if test "$linux" = "yes" ; then | |
5331 | echo "CONFIG_LINUX=y" >> $config_host_mak | |
67b915a5 | 5332 | fi |
128ab2ff | 5333 | |
83fb7adf | 5334 | if test "$darwin" = "yes" ; then |
98ec69ac | 5335 | echo "CONFIG_DARWIN=y" >> $config_host_mak |
83fb7adf | 5336 | fi |
b29fe3ed | 5337 | |
5338 | if test "$aix" = "yes" ; then | |
98ec69ac | 5339 | echo "CONFIG_AIX=y" >> $config_host_mak |
b29fe3ed | 5340 | fi |
5341 | ||
ec530c81 | 5342 | if test "$solaris" = "yes" ; then |
98ec69ac | 5343 | echo "CONFIG_SOLARIS=y" >> $config_host_mak |
2358a494 | 5344 | echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak |
0475a5ca | 5345 | if test "$needs_libsunmath" = "yes" ; then |
75b5a697 | 5346 | echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak |
0475a5ca | 5347 | fi |
ec530c81 | 5348 | fi |
179cf400 AF |
5349 | if test "$haiku" = "yes" ; then |
5350 | echo "CONFIG_HAIKU=y" >> $config_host_mak | |
5351 | fi | |
97a847bc | 5352 | if test "$static" = "yes" ; then |
98ec69ac | 5353 | echo "CONFIG_STATIC=y" >> $config_host_mak |
7d13299d | 5354 | fi |
1ba16968 | 5355 | if test "$profiler" = "yes" ; then |
2358a494 | 5356 | echo "CONFIG_PROFILER=y" >> $config_host_mak |
05c2a3e7 | 5357 | fi |
c20709aa | 5358 | if test "$slirp" = "yes" ; then |
98ec69ac | 5359 | echo "CONFIG_SLIRP=y" >> $config_host_mak |
e2d8830e | 5360 | echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak |
c20709aa | 5361 | fi |
8a16d273 | 5362 | if test "$vde" = "yes" ; then |
98ec69ac | 5363 | echo "CONFIG_VDE=y" >> $config_host_mak |
8a16d273 | 5364 | fi |
58952137 VM |
5365 | if test "$netmap" = "yes" ; then |
5366 | echo "CONFIG_NETMAP=y" >> $config_host_mak | |
5367 | fi | |
015a33bd GA |
5368 | if test "$l2tpv3" = "yes" ; then |
5369 | echo "CONFIG_L2TPV3=y" >> $config_host_mak | |
5370 | fi | |
47e98658 CB |
5371 | if test "$cap_ng" = "yes" ; then |
5372 | echo "CONFIG_LIBCAP=y" >> $config_host_mak | |
5373 | fi | |
2358a494 | 5374 | echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak |
0c58ac1c | 5375 | for drv in $audio_drv_list; do |
89138857 | 5376 | def=CONFIG_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]') |
98ec69ac | 5377 | echo "$def=y" >> $config_host_mak |
0c58ac1c | 5378 | done |
67f86e8e JQ |
5379 | if test "$audio_pt_int" = "yes" ; then |
5380 | echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak | |
5381 | fi | |
d5631638 | 5382 | if test "$audio_win_int" = "yes" ; then |
5383 | echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak | |
5384 | fi | |
b64ec4e4 FZ |
5385 | echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak |
5386 | echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak | |
821601ea JS |
5387 | if test "$vnc" = "yes" ; then |
5388 | echo "CONFIG_VNC=y" >> $config_host_mak | |
5389 | fi | |
2f9606b3 | 5390 | if test "$vnc_sasl" = "yes" ; then |
98ec69ac | 5391 | echo "CONFIG_VNC_SASL=y" >> $config_host_mak |
2f9606b3 | 5392 | fi |
821601ea | 5393 | if test "$vnc_jpeg" = "yes" ; then |
2f6f5c7a | 5394 | echo "CONFIG_VNC_JPEG=y" >> $config_host_mak |
2f6f5c7a | 5395 | fi |
821601ea | 5396 | if test "$vnc_png" = "yes" ; then |
efe556ad | 5397 | echo "CONFIG_VNC_PNG=y" >> $config_host_mak |
efe556ad | 5398 | fi |
76655d6d | 5399 | if test "$fnmatch" = "yes" ; then |
2358a494 | 5400 | echo "CONFIG_FNMATCH=y" >> $config_host_mak |
76655d6d | 5401 | fi |
dce512de CH |
5402 | if test "$xfs" = "yes" ; then |
5403 | echo "CONFIG_XFS=y" >> $config_host_mak | |
5404 | fi | |
89138857 | 5405 | qemu_version=$(head $source_path/VERSION) |
98ec69ac | 5406 | echo "VERSION=$qemu_version" >>$config_host_mak |
2358a494 | 5407 | echo "PKGVERSION=$pkgversion" >>$config_host_mak |
98ec69ac | 5408 | echo "SRC_PATH=$source_path" >> $config_host_mak |
98ec69ac | 5409 | echo "TARGET_DIRS=$target_list" >> $config_host_mak |
a25dba17 | 5410 | if [ "$docs" = "yes" ] ; then |
98ec69ac | 5411 | echo "BUILD_DOCS=yes" >> $config_host_mak |
cc8ae6de | 5412 | fi |
17969268 | 5413 | if test "$modules" = "yes"; then |
e26110cf FZ |
5414 | # $shacmd can generate a hash started with digit, which the compiler doesn't |
5415 | # like as an symbol. So prefix it with an underscore | |
89138857 | 5416 | echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak |
17969268 FZ |
5417 | echo "CONFIG_MODULES=y" >> $config_host_mak |
5418 | fi | |
1ac88f28 | 5419 | if test "$sdl" = "yes" ; then |
98ec69ac | 5420 | echo "CONFIG_SDL=y" >> $config_host_mak |
a3f4d63d | 5421 | echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak |
1ac88f28 | 5422 | echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak |
49ecc3fa FB |
5423 | fi |
5424 | if test "$cocoa" = "yes" ; then | |
98ec69ac | 5425 | echo "CONFIG_COCOA=y" >> $config_host_mak |
4d3b6f6e AZ |
5426 | fi |
5427 | if test "$curses" = "yes" ; then | |
98ec69ac | 5428 | echo "CONFIG_CURSES=y" >> $config_host_mak |
49ecc3fa | 5429 | fi |
ebc996f3 | 5430 | if test "$utimens" = "yes" ; then |
2358a494 | 5431 | echo "CONFIG_UTIMENSAT=y" >> $config_host_mak |
ebc996f3 | 5432 | fi |
099d6b0f | 5433 | if test "$pipe2" = "yes" ; then |
2358a494 | 5434 | echo "CONFIG_PIPE2=y" >> $config_host_mak |
099d6b0f | 5435 | fi |
40ff6d7e KW |
5436 | if test "$accept4" = "yes" ; then |
5437 | echo "CONFIG_ACCEPT4=y" >> $config_host_mak | |
5438 | fi | |
3ce34dfb | 5439 | if test "$splice" = "yes" ; then |
2358a494 | 5440 | echo "CONFIG_SPLICE=y" >> $config_host_mak |
3ce34dfb | 5441 | fi |
c2882b96 RV |
5442 | if test "$eventfd" = "yes" ; then |
5443 | echo "CONFIG_EVENTFD=y" >> $config_host_mak | |
5444 | fi | |
751bcc39 MAL |
5445 | if test "$memfd" = "yes" ; then |
5446 | echo "CONFIG_MEMFD=y" >> $config_host_mak | |
5447 | fi | |
d0927938 UH |
5448 | if test "$fallocate" = "yes" ; then |
5449 | echo "CONFIG_FALLOCATE=y" >> $config_host_mak | |
5450 | fi | |
3d4fa43e KK |
5451 | if test "$fallocate_punch_hole" = "yes" ; then |
5452 | echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak | |
5453 | fi | |
b953f075 DL |
5454 | if test "$fallocate_zero_range" = "yes" ; then |
5455 | echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak | |
5456 | fi | |
ed911435 KW |
5457 | if test "$posix_fallocate" = "yes" ; then |
5458 | echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak | |
5459 | fi | |
c727f47d PM |
5460 | if test "$sync_file_range" = "yes" ; then |
5461 | echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak | |
5462 | fi | |
dace20dc PM |
5463 | if test "$fiemap" = "yes" ; then |
5464 | echo "CONFIG_FIEMAP=y" >> $config_host_mak | |
5465 | fi | |
d0927938 UH |
5466 | if test "$dup3" = "yes" ; then |
5467 | echo "CONFIG_DUP3=y" >> $config_host_mak | |
5468 | fi | |
4e0c6529 AB |
5469 | if test "$ppoll" = "yes" ; then |
5470 | echo "CONFIG_PPOLL=y" >> $config_host_mak | |
5471 | fi | |
cd758dd0 AB |
5472 | if test "$prctl_pr_set_timerslack" = "yes" ; then |
5473 | echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak | |
5474 | fi | |
3b6edd16 PM |
5475 | if test "$epoll" = "yes" ; then |
5476 | echo "CONFIG_EPOLL=y" >> $config_host_mak | |
5477 | fi | |
5478 | if test "$epoll_create1" = "yes" ; then | |
5479 | echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak | |
5480 | fi | |
a8fd1aba PM |
5481 | if test "$sendfile" = "yes" ; then |
5482 | echo "CONFIG_SENDFILE=y" >> $config_host_mak | |
5483 | fi | |
51834341 RV |
5484 | if test "$timerfd" = "yes" ; then |
5485 | echo "CONFIG_TIMERFD=y" >> $config_host_mak | |
5486 | fi | |
9af5c906 RV |
5487 | if test "$setns" = "yes" ; then |
5488 | echo "CONFIG_SETNS=y" >> $config_host_mak | |
5489 | fi | |
38860a03 AM |
5490 | if test "$clock_adjtime" = "yes" ; then |
5491 | echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak | |
5492 | fi | |
5a03cd00 AM |
5493 | if test "$syncfs" = "yes" ; then |
5494 | echo "CONFIG_SYNCFS=y" >> $config_host_mak | |
5495 | fi | |
3b3f24ad | 5496 | if test "$inotify" = "yes" ; then |
2358a494 | 5497 | echo "CONFIG_INOTIFY=y" >> $config_host_mak |
3b3f24ad | 5498 | fi |
c05c7a73 RV |
5499 | if test "$inotify1" = "yes" ; then |
5500 | echo "CONFIG_INOTIFY1=y" >> $config_host_mak | |
5501 | fi | |
6ae9a1f4 JQ |
5502 | if test "$byteswap_h" = "yes" ; then |
5503 | echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak | |
5504 | fi | |
5505 | if test "$bswap_h" = "yes" ; then | |
5506 | echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak | |
5507 | fi | |
769ce76d | 5508 | if test "$curl" = "yes" ; then |
d3399d7c | 5509 | echo "CONFIG_CURL=m" >> $config_host_mak |
b1d5a277 | 5510 | echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak |
6ebc91e5 | 5511 | echo "CURL_LIBS=$curl_libs" >> $config_host_mak |
769ce76d | 5512 | fi |
2e4d9fb1 | 5513 | if test "$brlapi" = "yes" ; then |
98ec69ac | 5514 | echo "CONFIG_BRLAPI=y" >> $config_host_mak |
2e4d9fb1 | 5515 | fi |
fb599c9a | 5516 | if test "$bluez" = "yes" ; then |
98ec69ac | 5517 | echo "CONFIG_BLUEZ=y" >> $config_host_mak |
ef7635ec | 5518 | echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak |
fb599c9a | 5519 | fi |
d46f7c9e | 5520 | if test "$glib_subprocess" = "yes" ; then |
9d41401b MT |
5521 | echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak |
5522 | fi | |
a4ccabcf AL |
5523 | if test "$gtk" = "yes" ; then |
5524 | echo "CONFIG_GTK=y" >> $config_host_mak | |
a3f4d63d | 5525 | echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak |
a4ccabcf | 5526 | echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak |
014cb152 | 5527 | echo "GTK_LIBS=$gtk_libs" >> $config_host_mak |
925a0400 GH |
5528 | if test "$gtk_gl" = "yes" ; then |
5529 | echo "CONFIG_GTK_GL=y" >> $config_host_mak | |
5530 | fi | |
bbbf9bfb | 5531 | fi |
a1c5e949 | 5532 | echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak |
ddbb0d09 DB |
5533 | if test "$gnutls" = "yes" ; then |
5534 | echo "CONFIG_GNUTLS=y" >> $config_host_mak | |
5535 | fi | |
b917da4c DB |
5536 | if test "$gnutls_rnd" = "yes" ; then |
5537 | echo "CONFIG_GNUTLS_RND=y" >> $config_host_mak | |
5538 | fi | |
91bfcdb0 DB |
5539 | if test "$gcrypt" = "yes" ; then |
5540 | echo "CONFIG_GCRYPT=y" >> $config_host_mak | |
1f923c70 LM |
5541 | if test "$gcrypt_hmac" = "yes" ; then |
5542 | echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak | |
5543 | fi | |
37788f25 DB |
5544 | if test "$gcrypt_kdf" = "yes" ; then |
5545 | echo "CONFIG_GCRYPT_KDF=y" >> $config_host_mak | |
5546 | fi | |
62893b67 | 5547 | fi |
91bfcdb0 DB |
5548 | if test "$nettle" = "yes" ; then |
5549 | echo "CONFIG_NETTLE=y" >> $config_host_mak | |
becaeb72 | 5550 | echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak |
fff2f982 DB |
5551 | if test "$nettle_kdf" = "yes" ; then |
5552 | echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak | |
5553 | fi | |
ed754746 | 5554 | fi |
9a2fd434 DB |
5555 | if test "$tasn1" = "yes" ; then |
5556 | echo "CONFIG_TASN1=y" >> $config_host_mak | |
5557 | fi | |
559607ea DB |
5558 | if test "$have_ifaddrs_h" = "yes" ; then |
5559 | echo "HAVE_IFADDRS_H=y" >> $config_host_mak | |
5560 | fi | |
6b39b063 EB |
5561 | if test "$have_broken_size_max" = "yes" ; then |
5562 | echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak | |
5563 | fi | |
277abf15 JV |
5564 | |
5565 | # Work around a system header bug with some kernel/XFS header | |
5566 | # versions where they both try to define 'struct fsxattr': | |
5567 | # xfs headers will not try to redefine structs from linux headers | |
5568 | # if this macro is set. | |
5569 | if test "$have_fsxattr" = "yes" ; then | |
5570 | echo "HAVE_FSXATTR=y" >> $config_host_mak | |
5571 | fi | |
bbbf9bfb SW |
5572 | if test "$vte" = "yes" ; then |
5573 | echo "CONFIG_VTE=y" >> $config_host_mak | |
a4ccabcf AL |
5574 | echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak |
5575 | fi | |
9d9e1521 GH |
5576 | if test "$virglrenderer" = "yes" ; then |
5577 | echo "CONFIG_VIRGL=y" >> $config_host_mak | |
5578 | echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak | |
5579 | echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak | |
5580 | fi | |
e37630ca | 5581 | if test "$xen" = "yes" ; then |
6dbd588a | 5582 | echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak |
d5b93ddf | 5583 | echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak |
64a7ad6f IC |
5584 | if test "$xen_pv_domain_build" = "yes" ; then |
5585 | echo "CONFIG_XEN_PV_DOMAIN_BUILD=y" >> $config_host_mak | |
5586 | fi | |
e37630ca | 5587 | fi |
5c6c3a6c CH |
5588 | if test "$linux_aio" = "yes" ; then |
5589 | echo "CONFIG_LINUX_AIO=y" >> $config_host_mak | |
5590 | fi | |
758e8e38 VJ |
5591 | if test "$attr" = "yes" ; then |
5592 | echo "CONFIG_ATTR=y" >> $config_host_mak | |
5593 | fi | |
4f26f2b6 AK |
5594 | if test "$libattr" = "yes" ; then |
5595 | echo "CONFIG_LIBATTR=y" >> $config_host_mak | |
5596 | fi | |
983eef5a MI |
5597 | if test "$virtfs" = "yes" ; then |
5598 | echo "CONFIG_VIRTFS=y" >> $config_host_mak | |
758e8e38 | 5599 | fi |
5e9be92d NB |
5600 | if test "$vhost_scsi" = "yes" ; then |
5601 | echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak | |
5602 | fi | |
03ce5744 NN |
5603 | if test "$vhost_net" = "yes" ; then |
5604 | echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak | |
5605 | fi | |
fc0b9b0e SH |
5606 | if test "$vhost_vsock" = "yes" ; then |
5607 | echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak | |
5608 | fi | |
77755340 | 5609 | if test "$blobs" = "yes" ; then |
98ec69ac | 5610 | echo "INSTALL_BLOBS=yes" >> $config_host_mak |
77755340 | 5611 | fi |
bf9298b9 | 5612 | if test "$iovec" = "yes" ; then |
2358a494 | 5613 | echo "CONFIG_IOVEC=y" >> $config_host_mak |
bf9298b9 | 5614 | fi |
ceb42de8 | 5615 | if test "$preadv" = "yes" ; then |
2358a494 | 5616 | echo "CONFIG_PREADV=y" >> $config_host_mak |
ceb42de8 | 5617 | fi |
f652e6af | 5618 | if test "$fdt" = "yes" ; then |
3f0855b1 | 5619 | echo "CONFIG_FDT=y" >> $config_host_mak |
f652e6af | 5620 | fi |
dcc38d1c MT |
5621 | if test "$signalfd" = "yes" ; then |
5622 | echo "CONFIG_SIGNALFD=y" >> $config_host_mak | |
5623 | fi | |
9195b2c2 SW |
5624 | if test "$tcg_interpreter" = "yes" ; then |
5625 | echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak | |
5626 | fi | |
5f6b9e8f BS |
5627 | if test "$fdatasync" = "yes" ; then |
5628 | echo "CONFIG_FDATASYNC=y" >> $config_host_mak | |
5629 | fi | |
e78815a5 AF |
5630 | if test "$madvise" = "yes" ; then |
5631 | echo "CONFIG_MADVISE=y" >> $config_host_mak | |
5632 | fi | |
5633 | if test "$posix_madvise" = "yes" ; then | |
5634 | echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak | |
5635 | fi | |
97a847bc | 5636 | |
cd4ec0b4 GH |
5637 | if test "$spice" = "yes" ; then |
5638 | echo "CONFIG_SPICE=y" >> $config_host_mak | |
5639 | fi | |
36707144 | 5640 | |
7b02f544 MAL |
5641 | if test "$smartcard" = "yes" ; then |
5642 | echo "CONFIG_SMARTCARD=y" >> $config_host_mak | |
111a38b0 RR |
5643 | fi |
5644 | ||
2b2325ff GH |
5645 | if test "$libusb" = "yes" ; then |
5646 | echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak | |
5647 | fi | |
5648 | ||
69354a83 HG |
5649 | if test "$usb_redir" = "yes" ; then |
5650 | echo "CONFIG_USB_REDIR=y" >> $config_host_mak | |
5651 | fi | |
5652 | ||
da076ffe GH |
5653 | if test "$opengl" = "yes" ; then |
5654 | echo "CONFIG_OPENGL=y" >> $config_host_mak | |
5655 | echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak | |
014cb152 GH |
5656 | if test "$opengl_dmabuf" = "yes" ; then |
5657 | echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak | |
5658 | fi | |
20ff075b MW |
5659 | fi |
5660 | ||
99f2dbd3 LL |
5661 | if test "$avx2_opt" = "yes" ; then |
5662 | echo "CONFIG_AVX2_OPT=y" >> $config_host_mak | |
5663 | fi | |
5664 | ||
607dacd0 QN |
5665 | if test "$lzo" = "yes" ; then |
5666 | echo "CONFIG_LZO=y" >> $config_host_mak | |
5667 | fi | |
5668 | ||
5669 | if test "$snappy" = "yes" ; then | |
5670 | echo "CONFIG_SNAPPY=y" >> $config_host_mak | |
5671 | fi | |
5672 | ||
6b383c08 PW |
5673 | if test "$bzip2" = "yes" ; then |
5674 | echo "CONFIG_BZIP2=y" >> $config_host_mak | |
5675 | echo "BZIP2_LIBS=-lbz2" >> $config_host_mak | |
5676 | fi | |
5677 | ||
c589b249 | 5678 | if test "$libiscsi" = "yes" ; then |
d3399d7c | 5679 | echo "CONFIG_LIBISCSI=m" >> $config_host_mak |
6ebc91e5 FZ |
5680 | echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak |
5681 | echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak | |
c589b249 RS |
5682 | fi |
5683 | ||
6542aa9c | 5684 | if test "$libnfs" = "yes" ; then |
4be4879f CL |
5685 | echo "CONFIG_LIBNFS=m" >> $config_host_mak |
5686 | echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak | |
6542aa9c PL |
5687 | fi |
5688 | ||
f794573e EO |
5689 | if test "$seccomp" = "yes"; then |
5690 | echo "CONFIG_SECCOMP=y" >> $config_host_mak | |
5691 | fi | |
5692 | ||
83fb7adf | 5693 | # XXX: suppress that |
7d3505c5 | 5694 | if [ "$bsd" = "yes" ] ; then |
2358a494 | 5695 | echo "CONFIG_BSD=y" >> $config_host_mak |
7d3505c5 FB |
5696 | fi |
5697 | ||
4d9310f4 DB |
5698 | if test "$localtime_r" = "yes" ; then |
5699 | echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak | |
5700 | fi | |
3556c233 PB |
5701 | if test "$qom_cast_debug" = "yes" ; then |
5702 | echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak | |
5703 | fi | |
f27aaf4b | 5704 | if test "$rbd" = "yes" ; then |
d3399d7c | 5705 | echo "CONFIG_RBD=m" >> $config_host_mak |
6ebc91e5 FZ |
5706 | echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak |
5707 | echo "RBD_LIBS=$rbd_libs" >> $config_host_mak | |
d0e2fce5 AK |
5708 | fi |
5709 | ||
7c2acc70 | 5710 | echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak |
70c60c08 SH |
5711 | if test "$coroutine_pool" = "yes" ; then |
5712 | echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak | |
5713 | else | |
5714 | echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak | |
5715 | fi | |
20ff6c80 | 5716 | |
7d992e4d PL |
5717 | if test "$debug_stack_usage" = "yes" ; then |
5718 | echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak | |
5719 | fi | |
5720 | ||
d2042378 AK |
5721 | if test "$open_by_handle_at" = "yes" ; then |
5722 | echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak | |
5723 | fi | |
5724 | ||
e06a765e HPB |
5725 | if test "$linux_magic_h" = "yes" ; then |
5726 | echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak | |
8ab1bf12 LC |
5727 | fi |
5728 | ||
cc6e3ca9 GH |
5729 | if test "$pragma_diagnostic_available" = "yes" ; then |
5730 | echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak | |
06d71fa1 PM |
5731 | fi |
5732 | ||
3f4349dc KW |
5733 | if test "$valgrind_h" = "yes" ; then |
5734 | echo "CONFIG_VALGRIND_H=y" >> $config_host_mak | |
5735 | fi | |
5736 | ||
8ab1bf12 LC |
5737 | if test "$has_environ" = "yes" ; then |
5738 | echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak | |
e06a765e HPB |
5739 | fi |
5740 | ||
76a347e1 RH |
5741 | if test "$cpuid_h" = "yes" ; then |
5742 | echo "CONFIG_CPUID_H=y" >> $config_host_mak | |
5743 | fi | |
5744 | ||
f540166b RH |
5745 | if test "$int128" = "yes" ; then |
5746 | echo "CONFIG_INT128=y" >> $config_host_mak | |
5747 | fi | |
5748 | ||
7ebee43e RH |
5749 | if test "$atomic128" = "yes" ; then |
5750 | echo "CONFIG_ATOMIC128=y" >> $config_host_mak | |
5751 | fi | |
5752 | ||
df79b996 RH |
5753 | if test "$atomic64" = "yes" ; then |
5754 | echo "CONFIG_ATOMIC64=y" >> $config_host_mak | |
5755 | fi | |
5756 | ||
1e6e9aca RH |
5757 | if test "$getauxval" = "yes" ; then |
5758 | echo "CONFIG_GETAUXVAL=y" >> $config_host_mak | |
5759 | fi | |
5760 | ||
eb100396 | 5761 | if test "$glusterfs" = "yes" ; then |
d3399d7c | 5762 | echo "CONFIG_GLUSTERFS=m" >> $config_host_mak |
6ebc91e5 FZ |
5763 | echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak |
5764 | echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak | |
0c14fb47 BR |
5765 | fi |
5766 | ||
d85fa9eb JC |
5767 | if test "$glusterfs_xlator_opt" = "yes" ; then |
5768 | echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak | |
5769 | fi | |
5770 | ||
0c14fb47 BR |
5771 | if test "$glusterfs_discard" = "yes" ; then |
5772 | echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak | |
eb100396 | 5773 | fi |
e06a765e | 5774 | |
7c815372 BR |
5775 | if test "$glusterfs_zerofill" = "yes" ; then |
5776 | echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak | |
5777 | fi | |
5778 | ||
0a12ec87 | 5779 | if test "$libssh2" = "yes" ; then |
d3399d7c | 5780 | echo "CONFIG_LIBSSH2=m" >> $config_host_mak |
6ebc91e5 FZ |
5781 | echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak |
5782 | echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak | |
0a12ec87 RJ |
5783 | fi |
5784 | ||
68063649 | 5785 | # USB host support |
b5613fdc GH |
5786 | if test "$libusb" = "yes"; then |
5787 | echo "HOST_USB=libusb legacy" >> $config_host_mak | |
5788 | else | |
98ec69ac | 5789 | echo "HOST_USB=stub" >> $config_host_mak |
b5613fdc | 5790 | fi |
68063649 | 5791 | |
3b8acc11 PB |
5792 | # TPM passthrough support? |
5793 | if test "$tpm" = "yes"; then | |
5794 | echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak | |
5795 | if test "$tpm_passthrough" = "yes"; then | |
5796 | echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak | |
5797 | fi | |
5798 | fi | |
5799 | ||
5b808275 LV |
5800 | echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak |
5801 | if have_backend "nop"; then | |
6d8a764e | 5802 | echo "CONFIG_TRACE_NOP=y" >> $config_host_mak |
22890ab5 | 5803 | fi |
5b808275 | 5804 | if have_backend "simple"; then |
6d8a764e LV |
5805 | echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak |
5806 | # Set the appropriate trace file. | |
953ffe0f | 5807 | trace_file="\"$trace_file-\" FMT_pid" |
9410b56c | 5808 | fi |
ed7f5f1d PB |
5809 | if have_backend "log"; then |
5810 | echo "CONFIG_TRACE_LOG=y" >> $config_host_mak | |
6d8a764e | 5811 | fi |
5b808275 | 5812 | if have_backend "ust"; then |
6d8a764e LV |
5813 | echo "CONFIG_TRACE_UST=y" >> $config_host_mak |
5814 | fi | |
5b808275 | 5815 | if have_backend "dtrace"; then |
6d8a764e LV |
5816 | echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak |
5817 | if test "$trace_backend_stap" = "yes" ; then | |
5818 | echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak | |
5819 | fi | |
c276b17d | 5820 | fi |
5b808275 | 5821 | if have_backend "ftrace"; then |
781e9545 ET |
5822 | if test "$linux" = "yes" ; then |
5823 | echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak | |
781e9545 | 5824 | else |
21684af0 | 5825 | feature_not_found "ftrace(trace backend)" "ftrace requires Linux" |
781e9545 ET |
5826 | fi |
5827 | fi | |
0a852417 PD |
5828 | if have_backend "syslog"; then |
5829 | if test "$posix_syslog" = "yes" ; then | |
5830 | echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak | |
5831 | else | |
5832 | feature_not_found "syslog(trace backend)" "syslog not available" | |
5833 | fi | |
5834 | fi | |
9410b56c PS |
5835 | echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak |
5836 | ||
2da776db MH |
5837 | if test "$rdma" = "yes" ; then |
5838 | echo "CONFIG_RDMA=y" >> $config_host_mak | |
5839 | fi | |
5840 | ||
575b22b1 LV |
5841 | if test "$have_rtnetlink" = "yes" ; then |
5842 | echo "CONFIG_RTNETLINK=y" >> $config_host_mak | |
5843 | fi | |
5844 | ||
a6b1d4c0 CX |
5845 | if test "$replication" = "yes" ; then |
5846 | echo "CONFIG_REPLICATION=y" >> $config_host_mak | |
5847 | fi | |
5848 | ||
6a02c806 SH |
5849 | if test "$have_af_vsock" = "yes" ; then |
5850 | echo "CONFIG_AF_VSOCK=y" >> $config_host_mak | |
5851 | fi | |
5852 | ||
4d04351f CC |
5853 | if test "$have_sysmacros" = "yes" ; then |
5854 | echo "CONFIG_SYSMACROS=y" >> $config_host_mak | |
5855 | fi | |
5856 | ||
49e00a18 AG |
5857 | if test "$have_static_assert" = "yes" ; then |
5858 | echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak | |
5859 | fi | |
5860 | ||
5c312079 DDAG |
5861 | # Hold two types of flag: |
5862 | # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on | |
5863 | # a thread we have a handle to | |
5864 | # CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular | |
5865 | # platform | |
5866 | if test "$pthread_setname_np" = "yes" ; then | |
5867 | echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak | |
5868 | echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak | |
5869 | fi | |
5870 | ||
da92c3ff AM |
5871 | if test "$vxhs" = "yes" ; then |
5872 | echo "CONFIG_VXHS=y" >> $config_host_mak | |
5873 | echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak | |
5874 | fi | |
5875 | ||
5b5e3037 PB |
5876 | if test "$tcg_interpreter" = "yes"; then |
5877 | QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" | |
5878 | elif test "$ARCH" = "sparc64" ; then | |
5879 | QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES" | |
5880 | elif test "$ARCH" = "s390x" ; then | |
5881 | QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES" | |
c72b26ec | 5882 | elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then |
5b5e3037 | 5883 | QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES" |
40d964b5 RH |
5884 | elif test "$ARCH" = "ppc64" ; then |
5885 | QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES" | |
5b5e3037 PB |
5886 | else |
5887 | QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES" | |
5888 | fi | |
5889 | QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES" | |
5890 | ||
98ec69ac | 5891 | echo "TOOLS=$tools" >> $config_host_mak |
98ec69ac | 5892 | echo "ROMS=$roms" >> $config_host_mak |
804edf29 JQ |
5893 | echo "MAKE=$make" >> $config_host_mak |
5894 | echo "INSTALL=$install" >> $config_host_mak | |
1901cb14 BS |
5895 | echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak |
5896 | echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak | |
e999ee44 MT |
5897 | echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak |
5898 | echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak | |
c886edfb | 5899 | echo "PYTHON=$python" >> $config_host_mak |
804edf29 | 5900 | echo "CC=$cc" >> $config_host_mak |
a31a8642 MT |
5901 | if $iasl -h > /dev/null 2>&1; then |
5902 | echo "IASL=$iasl" >> $config_host_mak | |
5903 | fi | |
2b2e59e6 | 5904 | echo "CC_I386=$cc_i386" >> $config_host_mak |
804edf29 | 5905 | echo "HOST_CC=$host_cc" >> $config_host_mak |
83f73fce | 5906 | echo "CXX=$cxx" >> $config_host_mak |
3c4a4d0d | 5907 | echo "OBJCC=$objcc" >> $config_host_mak |
804edf29 | 5908 | echo "AR=$ar" >> $config_host_mak |
45d285ab | 5909 | echo "ARFLAGS=$ARFLAGS" >> $config_host_mak |
cdbd727c | 5910 | echo "AS=$as" >> $config_host_mak |
5f6f0e27 | 5911 | echo "CCAS=$ccas" >> $config_host_mak |
3dd46c78 | 5912 | echo "CPP=$cpp" >> $config_host_mak |
804edf29 JQ |
5913 | echo "OBJCOPY=$objcopy" >> $config_host_mak |
5914 | echo "LD=$ld" >> $config_host_mak | |
4852ee95 | 5915 | echo "NM=$nm" >> $config_host_mak |
9fe6de94 | 5916 | echo "WINDRES=$windres" >> $config_host_mak |
e2a2ed06 | 5917 | echo "CFLAGS=$CFLAGS" >> $config_host_mak |
46eef33b | 5918 | echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak |
a558ee17 | 5919 | echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak |
f9728943 | 5920 | echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak |
e39f0062 PB |
5921 | if test "$sparse" = "yes" ; then |
5922 | echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak | |
80fd48df | 5923 | echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak |
2944d742 | 5924 | echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak |
e39f0062 PB |
5925 | echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak |
5926 | echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak | |
5927 | fi | |
42da6041 GH |
5928 | if test "$cross_prefix" != ""; then |
5929 | echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak | |
5930 | else | |
5931 | echo "AUTOCONF_HOST := " >> $config_host_mak | |
5932 | fi | |
e2a2ed06 | 5933 | echo "LDFLAGS=$LDFLAGS" >> $config_host_mak |
46eef33b | 5934 | echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak |
6969ec6c | 5935 | echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak |
e57218b6 | 5936 | echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak |
73da375e | 5937 | echo "LIBS+=$LIBS" >> $config_host_mak |
3e2e0e6b | 5938 | echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak |
409437e1 | 5939 | echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak |
804edf29 | 5940 | echo "EXESUF=$EXESUF" >> $config_host_mak |
17969268 FZ |
5941 | echo "DSOSUF=$DSOSUF" >> $config_host_mak |
5942 | echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak | |
957f1f99 | 5943 | echo "LIBS_QGA+=$libs_qga" >> $config_host_mak |
90246037 DB |
5944 | echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak |
5945 | echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak | |
94dd53c5 | 5946 | echo "POD2MAN=$POD2MAN" >> $config_host_mak |
cbdd1999 | 5947 | echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak |
1d728c39 BS |
5948 | if test "$gcov" = "yes" ; then |
5949 | echo "CONFIG_GCOV=y" >> $config_host_mak | |
5950 | echo "GCOV=$gcov_tool" >> $config_host_mak | |
5951 | fi | |
804edf29 | 5952 | |
6efd7517 PM |
5953 | # use included Linux headers |
5954 | if test "$linux" = "yes" ; then | |
a307beb6 | 5955 | mkdir -p linux-headers |
6efd7517 | 5956 | case "$cpu" in |
c72b26ec | 5957 | i386|x86_64|x32) |
08312a63 | 5958 | linux_arch=x86 |
6efd7517 PM |
5959 | ;; |
5960 | ppcemb|ppc|ppc64) | |
08312a63 | 5961 | linux_arch=powerpc |
6efd7517 PM |
5962 | ;; |
5963 | s390x) | |
08312a63 PM |
5964 | linux_arch=s390 |
5965 | ;; | |
1f080313 CF |
5966 | aarch64) |
5967 | linux_arch=arm64 | |
5968 | ;; | |
222e7d11 SL |
5969 | mips64) |
5970 | linux_arch=mips | |
5971 | ;; | |
08312a63 PM |
5972 | *) |
5973 | # For most CPUs the kernel architecture name and QEMU CPU name match. | |
5974 | linux_arch="$cpu" | |
6efd7517 PM |
5975 | ;; |
5976 | esac | |
08312a63 PM |
5977 | # For non-KVM architectures we will not have asm headers |
5978 | if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then | |
5979 | symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm | |
5980 | fi | |
6efd7517 PM |
5981 | fi |
5982 | ||
1d14ffa9 | 5983 | for target in $target_list; do |
97a847bc | 5984 | target_dir="$target" |
25be210f | 5985 | config_target_mak=$target_dir/config-target.mak |
89138857 | 5986 | target_name=$(echo $target | cut -d '-' -f 1) |
97a847bc | 5987 | target_bigendian="no" |
1f3d3c8f | 5988 | |
c1799a84 | 5989 | case "$target_name" in |
4a09d0bb | 5990 | armeb|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) |
ea2d6a39 JQ |
5991 | target_bigendian=yes |
5992 | ;; | |
5993 | esac | |
97a847bc | 5994 | target_softmmu="no" |
997344f3 | 5995 | target_user_only="no" |
831b7825 | 5996 | target_linux_user="no" |
84778508 | 5997 | target_bsd_user="no" |
9e407a85 | 5998 | case "$target" in |
c1799a84 | 5999 | ${target_name}-softmmu) |
9e407a85 PB |
6000 | target_softmmu="yes" |
6001 | ;; | |
c1799a84 | 6002 | ${target_name}-linux-user) |
9c7a4202 | 6003 | if test "$linux" != "yes" ; then |
76ad07a4 | 6004 | error_exit "Target '$target' is only available on a Linux host" |
9c7a4202 | 6005 | fi |
9e407a85 PB |
6006 | target_user_only="yes" |
6007 | target_linux_user="yes" | |
6008 | ;; | |
c1799a84 | 6009 | ${target_name}-bsd-user) |
9cf55765 | 6010 | if test "$bsd" != "yes" ; then |
76ad07a4 | 6011 | error_exit "Target '$target' is only available on a BSD host" |
9c7a4202 | 6012 | fi |
84778508 BS |
6013 | target_user_only="yes" |
6014 | target_bsd_user="yes" | |
6015 | ;; | |
9e407a85 | 6016 | *) |
76ad07a4 | 6017 | error_exit "Target '$target' not recognised" |
9e407a85 PB |
6018 | exit 1 |
6019 | ;; | |
6020 | esac | |
831b7825 | 6021 | |
97a847bc | 6022 | mkdir -p $target_dir |
25be210f | 6023 | echo "# Automatically generated by configure - do not modify" > $config_target_mak |
de83cd02 | 6024 | |
e5fe0c52 | 6025 | bflt="no" |
ca759f9e | 6026 | mttcg="no" |
89138857 | 6027 | interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g") |
56aebc89 | 6028 | gdb_xml_files="" |
7ba1e619 | 6029 | |
c1799a84 | 6030 | TARGET_ARCH="$target_name" |
6acff7da | 6031 | TARGET_BASE_ARCH="" |
e6e91b9c | 6032 | TARGET_ABI_DIR="" |
e73aae67 | 6033 | |
c1799a84 | 6034 | case "$target_name" in |
2408a527 | 6035 | i386) |
00fcd100 | 6036 | gdb_xml_files="i386-32bit-core.xml" |
2408a527 AJ |
6037 | ;; |
6038 | x86_64) | |
6acff7da | 6039 | TARGET_BASE_ARCH=i386 |
00fcd100 | 6040 | gdb_xml_files="i386-64bit-core.xml" |
2408a527 AJ |
6041 | ;; |
6042 | alpha) | |
5ee4f3c2 | 6043 | mttcg="yes" |
2408a527 AJ |
6044 | ;; |
6045 | arm|armeb) | |
b498c8a0 | 6046 | TARGET_ARCH=arm |
2408a527 | 6047 | bflt="yes" |
ca759f9e | 6048 | mttcg="yes" |
56aebc89 | 6049 | gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" |
2408a527 | 6050 | ;; |
6a49fa95 AG |
6051 | aarch64) |
6052 | TARGET_BASE_ARCH=arm | |
6053 | bflt="yes" | |
ca759f9e | 6054 | mttcg="yes" |
8f95ce2e | 6055 | gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" |
6a49fa95 | 6056 | ;; |
2408a527 | 6057 | cris) |
2408a527 | 6058 | ;; |
61766fe9 RH |
6059 | hppa) |
6060 | ;; | |
613a22c9 | 6061 | lm32) |
613a22c9 | 6062 | ;; |
2408a527 | 6063 | m68k) |
2408a527 | 6064 | bflt="yes" |
56aebc89 | 6065 | gdb_xml_files="cf-core.xml cf-fp.xml" |
2408a527 | 6066 | ;; |
877fdc12 EI |
6067 | microblaze|microblazeel) |
6068 | TARGET_ARCH=microblaze | |
72b675ca | 6069 | bflt="yes" |
72b675ca | 6070 | ;; |
0adcffb1 | 6071 | mips|mipsel) |
b498c8a0 | 6072 | TARGET_ARCH=mips |
25be210f | 6073 | echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak |
2408a527 AJ |
6074 | ;; |
6075 | mipsn32|mipsn32el) | |
597e2cec | 6076 | TARGET_ARCH=mips64 |
6acff7da | 6077 | TARGET_BASE_ARCH=mips |
25be210f | 6078 | echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak |
597e2cec | 6079 | echo "TARGET_ABI32=y" >> $config_target_mak |
2408a527 AJ |
6080 | ;; |
6081 | mips64|mips64el) | |
b498c8a0 | 6082 | TARGET_ARCH=mips64 |
6acff7da | 6083 | TARGET_BASE_ARCH=mips |
25be210f | 6084 | echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak |
2408a527 | 6085 | ;; |
d15a9c23 AG |
6086 | moxie) |
6087 | ;; | |
e671711c MV |
6088 | nios2) |
6089 | ;; | |
4a09d0bb | 6090 | or1k) |
e67db06e JL |
6091 | TARGET_ARCH=openrisc |
6092 | TARGET_BASE_ARCH=openrisc | |
e67db06e | 6093 | ;; |
2408a527 | 6094 | ppc) |
c8b3532d | 6095 | gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" |
2408a527 AJ |
6096 | ;; |
6097 | ppcemb) | |
6acff7da | 6098 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 6099 | TARGET_ABI_DIR=ppc |
c8b3532d | 6100 | gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" |
2408a527 AJ |
6101 | ;; |
6102 | ppc64) | |
6acff7da | 6103 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 6104 | TARGET_ABI_DIR=ppc |
f0b0685d | 6105 | mttcg=yes |
1438eff3 | 6106 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" |
2408a527 | 6107 | ;; |
9c35126c DK |
6108 | ppc64le) |
6109 | TARGET_ARCH=ppc64 | |
6110 | TARGET_BASE_ARCH=ppc | |
6111 | TARGET_ABI_DIR=ppc | |
f0b0685d | 6112 | mttcg=yes |
1438eff3 | 6113 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" |
9c35126c | 6114 | ;; |
2408a527 | 6115 | ppc64abi32) |
b498c8a0 | 6116 | TARGET_ARCH=ppc64 |
6acff7da | 6117 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 6118 | TARGET_ABI_DIR=ppc |
25be210f | 6119 | echo "TARGET_ABI32=y" >> $config_target_mak |
1438eff3 | 6120 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" |
2408a527 AJ |
6121 | ;; |
6122 | sh4|sh4eb) | |
b498c8a0 | 6123 | TARGET_ARCH=sh4 |
2408a527 AJ |
6124 | bflt="yes" |
6125 | ;; | |
6126 | sparc) | |
2408a527 AJ |
6127 | ;; |
6128 | sparc64) | |
6acff7da | 6129 | TARGET_BASE_ARCH=sparc |
2408a527 AJ |
6130 | ;; |
6131 | sparc32plus) | |
b498c8a0 | 6132 | TARGET_ARCH=sparc64 |
6acff7da | 6133 | TARGET_BASE_ARCH=sparc |
e6e91b9c | 6134 | TARGET_ABI_DIR=sparc |
25be210f | 6135 | echo "TARGET_ABI32=y" >> $config_target_mak |
2408a527 | 6136 | ;; |
24e804ec | 6137 | s390x) |
8a641ff6 | 6138 | gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml" |
24e804ec | 6139 | ;; |
444e06b1 CG |
6140 | tilegx) |
6141 | ;; | |
5ecaa4ed PC |
6142 | tricore) |
6143 | ;; | |
d2fbca94 | 6144 | unicore32) |
d2fbca94 | 6145 | ;; |
cfa550c6 MF |
6146 | xtensa|xtensaeb) |
6147 | TARGET_ARCH=xtensa | |
cfa550c6 | 6148 | ;; |
2408a527 | 6149 | *) |
76ad07a4 | 6150 | error_exit "Unsupported target CPU" |
2408a527 AJ |
6151 | ;; |
6152 | esac | |
5e8861a0 PB |
6153 | # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH |
6154 | if [ "$TARGET_BASE_ARCH" = "" ]; then | |
6155 | TARGET_BASE_ARCH=$TARGET_ARCH | |
6156 | fi | |
6157 | ||
5e8861a0 PB |
6158 | symlink "$source_path/Makefile.target" "$target_dir/Makefile" |
6159 | ||
99afc91d DB |
6160 | upper() { |
6161 | echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' | |
6162 | } | |
6163 | ||
89138857 | 6164 | target_arch_name="$(upper $TARGET_ARCH)" |
25be210f | 6165 | echo "TARGET_$target_arch_name=y" >> $config_target_mak |
c1799a84 | 6166 | echo "TARGET_NAME=$target_name" >> $config_target_mak |
25be210f | 6167 | echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak |
e6e91b9c JQ |
6168 | if [ "$TARGET_ABI_DIR" = "" ]; then |
6169 | TARGET_ABI_DIR=$TARGET_ARCH | |
6170 | fi | |
25be210f | 6171 | echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak |
adfc3e91 SS |
6172 | if [ "$HOST_VARIANT_DIR" != "" ]; then |
6173 | echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak | |
6174 | fi | |
c1799a84 | 6175 | case "$target_name" in |
1b0c87fc JQ |
6176 | i386|x86_64) |
6177 | if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then | |
25be210f | 6178 | echo "CONFIG_XEN=y" >> $config_target_mak |
eb6fda0f AP |
6179 | if test "$xen_pci_passthrough" = yes; then |
6180 | echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" | |
6181 | fi | |
1b0c87fc | 6182 | fi |
59d21e53 AG |
6183 | ;; |
6184 | *) | |
1b0c87fc | 6185 | esac |
c1799a84 | 6186 | case "$target_name" in |
222e7d11 | 6187 | aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x|mipsel|mips) |
c59249f9 JQ |
6188 | # Make sure the target and host cpus are compatible |
6189 | if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ | |
c1799a84 PB |
6190 | \( "$target_name" = "$cpu" -o \ |
6191 | \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \ | |
6192 | \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \ | |
6193 | \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \ | |
6194 | \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ | |
222e7d11 | 6195 | \( "$target_name" = "mipsel" -a "$cpu" = "mips" \) -o \ |
c1799a84 | 6196 | \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \ |
18b8263e MT |
6197 | \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) -o \ |
6198 | \( "$target_name" = "x86_64" -a "$cpu" = "x32" \) -o \ | |
6199 | \( "$target_name" = "i386" -a "$cpu" = "x32" \) \) ; then | |
25be210f | 6200 | echo "CONFIG_KVM=y" >> $config_target_mak |
1ba16968 | 6201 | if test "$vhost_net" = "yes" ; then |
d5970055 | 6202 | echo "CONFIG_VHOST_NET=y" >> $config_target_mak |
421f4448 | 6203 | echo "CONFIG_VHOST_NET_TEST_$target_name=y" >> $config_host_mak |
d5970055 | 6204 | fi |
c59249f9 JQ |
6205 | fi |
6206 | esac | |
b0cb0a66 VP |
6207 | if test "$hax" = "yes" ; then |
6208 | if test "$target_softmmu" = "yes" ; then | |
6209 | case "$target_name" in | |
6210 | i386|x86_64) | |
6211 | echo "CONFIG_HAX=y" >> $config_target_mak | |
6212 | ;; | |
6213 | esac | |
6214 | fi | |
6215 | fi | |
de83cd02 | 6216 | if test "$target_bigendian" = "yes" ; then |
25be210f | 6217 | echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak |
de83cd02 | 6218 | fi |
97a847bc | 6219 | if test "$target_softmmu" = "yes" ; then |
25be210f | 6220 | echo "CONFIG_SOFTMMU=y" >> $config_target_mak |
ca759f9e AB |
6221 | if test "$mttcg" = "yes" ; then |
6222 | echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak | |
6223 | fi | |
43ce4dfe | 6224 | fi |
997344f3 | 6225 | if test "$target_user_only" = "yes" ; then |
25be210f | 6226 | echo "CONFIG_USER_ONLY=y" >> $config_target_mak |
a2c80be9 | 6227 | echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak |
997344f3 | 6228 | fi |
831b7825 | 6229 | if test "$target_linux_user" = "yes" ; then |
25be210f | 6230 | echo "CONFIG_LINUX_USER=y" >> $config_target_mak |
831b7825 | 6231 | fi |
56aebc89 PB |
6232 | list="" |
6233 | if test ! -z "$gdb_xml_files" ; then | |
6234 | for x in $gdb_xml_files; do | |
6235 | list="$list $source_path/gdb-xml/$x" | |
6236 | done | |
3d0f1517 | 6237 | echo "TARGET_XML_FILES=$list" >> $config_target_mak |
56aebc89 | 6238 | fi |
97a847bc | 6239 | |
e5fe0c52 | 6240 | if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then |
25be210f | 6241 | echo "TARGET_HAS_BFLT=y" >> $config_target_mak |
e5fe0c52 | 6242 | fi |
84778508 | 6243 | if test "$target_bsd_user" = "yes" ; then |
25be210f | 6244 | echo "CONFIG_BSD_USER=y" >> $config_target_mak |
84778508 | 6245 | fi |
5b0753e0 | 6246 | |
4afddb55 | 6247 | # generate QEMU_CFLAGS/LDFLAGS for targets |
fa282484 | 6248 | |
4afddb55 | 6249 | cflags="" |
fa282484 | 6250 | ldflags="" |
9b8e111f | 6251 | |
c765fcac PC |
6252 | disas_config() { |
6253 | echo "CONFIG_${1}_DIS=y" >> $config_target_mak | |
6254 | echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak | |
6255 | } | |
6256 | ||
64656024 JQ |
6257 | for i in $ARCH $TARGET_BASE_ARCH ; do |
6258 | case "$i" in | |
6259 | alpha) | |
c765fcac | 6260 | disas_config "ALPHA" |
64656024 | 6261 | ;; |
82295d8a RH |
6262 | aarch64) |
6263 | if test -n "${cxx}"; then | |
c765fcac | 6264 | disas_config "ARM_A64" |
82295d8a RH |
6265 | fi |
6266 | ;; | |
64656024 | 6267 | arm) |
c765fcac | 6268 | disas_config "ARM" |
999b53ec | 6269 | if test -n "${cxx}"; then |
c765fcac | 6270 | disas_config "ARM_A64" |
999b53ec | 6271 | fi |
64656024 JQ |
6272 | ;; |
6273 | cris) | |
c765fcac | 6274 | disas_config "CRIS" |
64656024 | 6275 | ;; |
429b31a2 RH |
6276 | hppa) |
6277 | disas_config "HPPA" | |
6278 | ;; | |
c72b26ec | 6279 | i386|x86_64|x32) |
c765fcac | 6280 | disas_config "I386" |
64656024 | 6281 | ;; |
903ec55c | 6282 | ia64*) |
c765fcac | 6283 | disas_config "IA64" |
903ec55c | 6284 | ;; |
79368f49 | 6285 | lm32) |
c765fcac | 6286 | disas_config "LM32" |
79368f49 | 6287 | ;; |
64656024 | 6288 | m68k) |
c765fcac | 6289 | disas_config "M68K" |
64656024 | 6290 | ;; |
877fdc12 | 6291 | microblaze*) |
c765fcac | 6292 | disas_config "MICROBLAZE" |
64656024 JQ |
6293 | ;; |
6294 | mips*) | |
c765fcac | 6295 | disas_config "MIPS" |
64656024 | 6296 | ;; |
d15a9c23 | 6297 | moxie*) |
c765fcac | 6298 | disas_config "MOXIE" |
d15a9c23 | 6299 | ;; |
e671711c MV |
6300 | nios2) |
6301 | disas_config "NIOS2" | |
6302 | ;; | |
4a09d0bb | 6303 | or1k) |
c765fcac | 6304 | disas_config "OPENRISC" |
e67db06e | 6305 | ;; |
64656024 | 6306 | ppc*) |
c765fcac | 6307 | disas_config "PPC" |
64656024 | 6308 | ;; |
24e804ec | 6309 | s390*) |
c765fcac | 6310 | disas_config "S390" |
64656024 JQ |
6311 | ;; |
6312 | sh4) | |
c765fcac | 6313 | disas_config "SH4" |
64656024 JQ |
6314 | ;; |
6315 | sparc*) | |
c765fcac | 6316 | disas_config "SPARC" |
64656024 | 6317 | ;; |
cfa550c6 | 6318 | xtensa*) |
c765fcac | 6319 | disas_config "XTENSA" |
cfa550c6 | 6320 | ;; |
64656024 JQ |
6321 | esac |
6322 | done | |
9195b2c2 | 6323 | if test "$tcg_interpreter" = "yes" ; then |
c765fcac | 6324 | disas_config "TCI" |
9195b2c2 | 6325 | fi |
64656024 | 6326 | |
6ee7126f JQ |
6327 | case "$ARCH" in |
6328 | alpha) | |
6329 | # Ensure there's only a single GP | |
6330 | cflags="-msmall-data $cflags" | |
6331 | ;; | |
6332 | esac | |
6333 | ||
d02c1db3 | 6334 | if test "$gprof" = "yes" ; then |
25be210f | 6335 | echo "TARGET_GPROF=yes" >> $config_target_mak |
d02c1db3 JQ |
6336 | if test "$target_linux_user" = "yes" ; then |
6337 | cflags="-p $cflags" | |
6338 | ldflags="-p $ldflags" | |
6339 | fi | |
6340 | if test "$target_softmmu" = "yes" ; then | |
6341 | ldflags="-p $ldflags" | |
25be210f | 6342 | echo "GPROF_CFLAGS=-p" >> $config_target_mak |
d02c1db3 JQ |
6343 | fi |
6344 | fi | |
6345 | ||
9b8e111f | 6346 | if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then |
964c6fa1 | 6347 | ldflags="$ldflags $textseg_ldflags" |
fa282484 | 6348 | fi |
fa282484 | 6349 | |
25be210f JQ |
6350 | echo "LDFLAGS+=$ldflags" >> $config_target_mak |
6351 | echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak | |
fa282484 | 6352 | |
97a847bc | 6353 | done # for target in $targets |
7d13299d | 6354 | |
b776eca1 GH |
6355 | if [ "$pixman" = "internal" ]; then |
6356 | echo "config-host.h: subdir-pixman" >> $config_host_mak | |
2da776db MH |
6357 | fi |
6358 | ||
a540f158 PC |
6359 | if [ "$dtc_internal" = "yes" ]; then |
6360 | echo "config-host.h: subdir-dtc" >> $config_host_mak | |
6361 | fi | |
6362 | ||
a99d57bb WG |
6363 | if test "$numa" = "yes"; then |
6364 | echo "CONFIG_NUMA=y" >> $config_host_mak | |
6365 | fi | |
6366 | ||
fd0e6053 JS |
6367 | if test "$ccache_cpp2" = "yes"; then |
6368 | echo "export CCACHE_CPP2=y" >> $config_host_mak | |
6369 | fi | |
6370 | ||
d1807a4f | 6371 | # build tree in object directory in case the source is not in the current directory |
f93296ea | 6372 | DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests" |
56e8bdd4 | 6373 | DIRS="$DIRS docs fsdev" |
9933c305 | 6374 | DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw" |
d1807a4f | 6375 | DIRS="$DIRS roms/seabios roms/vgabios" |
2dee8d54 | 6376 | DIRS="$DIRS qapi-generated" |
c09015dd AL |
6377 | FILES="Makefile tests/tcg/Makefile qdict-test-data.txt" |
6378 | FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" | |
aaa2ebc5 | 6379 | FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile" |
d1807a4f | 6380 | FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" |
446b9165 | 6381 | FILES="$FILES pc-bios/spapr-rtas/Makefile" |
9933c305 | 6382 | FILES="$FILES pc-bios/s390-ccw/Makefile" |
d1807a4f | 6383 | FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" |
4652b792 | 6384 | FILES="$FILES pc-bios/qemu-icon.bmp" |
753d11f2 RH |
6385 | for bios_file in \ |
6386 | $source_path/pc-bios/*.bin \ | |
225a9ab8 | 6387 | $source_path/pc-bios/*.lid \ |
5acc2ec0 | 6388 | $source_path/pc-bios/*.aml \ |
753d11f2 RH |
6389 | $source_path/pc-bios/*.rom \ |
6390 | $source_path/pc-bios/*.dtb \ | |
e89e33e1 | 6391 | $source_path/pc-bios/*.img \ |
753d11f2 | 6392 | $source_path/pc-bios/openbios-* \ |
4e73c781 | 6393 | $source_path/pc-bios/u-boot.* \ |
753d11f2 RH |
6394 | $source_path/pc-bios/palcode-* |
6395 | do | |
89138857 | 6396 | FILES="$FILES pc-bios/$(basename $bios_file)" |
d1807a4f | 6397 | done |
89138857 | 6398 | for test_file in $(find $source_path/tests/acpi-test-data -type f) |
c2304b52 | 6399 | do |
89138857 | 6400 | FILES="$FILES tests/acpi-test-data$(echo $test_file | sed -e 's/.*acpi-test-data//')" |
c2304b52 | 6401 | done |
d1807a4f PB |
6402 | mkdir -p $DIRS |
6403 | for f in $FILES ; do | |
cab00a5a | 6404 | if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then |
f9245e10 PM |
6405 | symlink "$source_path/$f" "$f" |
6406 | fi | |
d1807a4f | 6407 | done |
1ad2134f | 6408 | |
c34ebfdc | 6409 | # temporary config to build submodules |
2d9f27d2 | 6410 | for rom in seabios vgabios ; do |
c34ebfdc | 6411 | config_mak=roms/$rom/config.mak |
37116c89 | 6412 | echo "# Automatically generated by configure - do not modify" > $config_mak |
c34ebfdc | 6413 | echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak |
cdbd727c | 6414 | echo "AS=$as" >> $config_mak |
5f6f0e27 | 6415 | echo "CCAS=$ccas" >> $config_mak |
c34ebfdc AL |
6416 | echo "CC=$cc" >> $config_mak |
6417 | echo "BCC=bcc" >> $config_mak | |
3dd46c78 | 6418 | echo "CPP=$cpp" >> $config_mak |
c34ebfdc | 6419 | echo "OBJCOPY=objcopy" >> $config_mak |
a31a8642 | 6420 | echo "IASL=$iasl" >> $config_mak |
c34ebfdc AL |
6421 | echo "LD=$ld" >> $config_mak |
6422 | done | |
6423 | ||
fe31017f MAL |
6424 | # set up tests data directory |
6425 | if [ ! -e tests/data ]; then | |
6426 | symlink "$source_path/tests/data" tests/data | |
6427 | fi | |
6428 | ||
76c7560a HR |
6429 | # set up qemu-iotests in this build directory |
6430 | iotests_common_env="tests/qemu-iotests/common.env" | |
6431 | iotests_check="tests/qemu-iotests/check" | |
6432 | ||
6433 | echo "# Automatically generated by configure - do not modify" > "$iotests_common_env" | |
6434 | echo >> "$iotests_common_env" | |
6435 | echo "export PYTHON='$python'" >> "$iotests_common_env" | |
6436 | ||
6437 | if [ ! -e "$iotests_check" ]; then | |
6438 | symlink "$source_path/$iotests_check" "$iotests_check" | |
6439 | fi | |
6440 | ||
dc655404 MT |
6441 | # Save the configure command line for later reuse. |
6442 | cat <<EOD >config.status | |
6443 | #!/bin/sh | |
6444 | # Generated by configure. | |
6445 | # Run this file to recreate the current configuration. | |
6446 | # Compiler output produced by configure, useful for debugging | |
6447 | # configure, is in config.log if it exists. | |
6448 | EOD | |
6449 | printf "exec" >>config.status | |
6450 | printf " '%s'" "$0" "$@" >>config.status | |
cf7cc929 | 6451 | echo ' "$@"' >>config.status |
dc655404 MT |
6452 | chmod +x config.status |
6453 | ||
8cd05ab6 | 6454 | rm -r "$TMPDIR1" |