]> git.proxmox.com Git - mirror_qemu.git/blame - configure
block: use BlockDriverState AioContext
[mirror_qemu.git] / configure
CommitLineData
7d13299d
FB
1#!/bin/sh
2#
3ef693a0 3# qemu configure script (c) 2003 Fabrice Bellard
7d13299d 4#
8cd05ab6
PM
5
6# Temporary directory used for files created while
7# configure runs. Since it is in the build directory
8# we can safely blow away any previous version of it
9# (and we need not jump through hoops to try to delete
10# it when configure exits.)
11TMPDIR1="config-temp"
12rm -rf "${TMPDIR1}"
13mkdir -p "${TMPDIR1}"
14if [ $? -ne 0 ]; then
15 echo "ERROR: failed to create temporary directory"
16 exit 1
7d13299d
FB
17fi
18
8cd05ab6
PM
19TMPB="qemu-conf"
20TMPC="${TMPDIR1}/${TMPB}.c"
66518bf6 21TMPO="${TMPDIR1}/${TMPB}.o"
9c83ffd8 22TMPCXX="${TMPDIR1}/${TMPB}.cxx"
66518bf6
DS
23TMPL="${TMPDIR1}/${TMPB}.lo"
24TMPA="${TMPDIR1}/lib${TMPB}.la"
8cd05ab6 25TMPE="${TMPDIR1}/${TMPB}.exe"
7d13299d 26
da1d85e3 27rm -f config.log
9ac81bbb 28
b48e3611
PM
29# Print a helpful header at the top of config.log
30echo "# QEMU configure log $(date)" >> config.log
979ae168
PM
31printf "# Configured with:" >> config.log
32printf " '%s'" "$0" "$@" >> config.log
33echo >> config.log
b48e3611
PM
34echo "#" >> config.log
35
76ad07a4
PM
36error_exit() {
37 echo
38 echo "ERROR: $1"
39 while test -n "$2"; do
40 echo " $2"
41 shift
42 done
43 echo
44 exit 1
45}
46
9c83ffd8
PM
47do_compiler() {
48 # Run the compiler, capturing its output to the log. First argument
49 # is compiler binary to execute.
50 local compiler="$1"
51 shift
52 echo $compiler "$@" >> config.log
53 $compiler "$@" >> config.log 2>&1 || return $?
8dc38a78
PM
54 # Test passed. If this is an --enable-werror build, rerun
55 # the test with -Werror and bail out if it fails. This
56 # makes warning-generating-errors in configure test code
57 # obvious to developers.
58 if test "$werror" != "yes"; then
59 return 0
60 fi
61 # Don't bother rerunning the compile if we were already using -Werror
62 case "$*" in
63 *-Werror*)
64 return 0
65 ;;
66 esac
9c83ffd8
PM
67 echo $compiler -Werror "$@" >> config.log
68 $compiler -Werror "$@" >> config.log 2>&1 && return $?
76ad07a4
PM
69 error_exit "configure test passed without -Werror but failed with -Werror." \
70 "This is probably a bug in the configure script. The failing command" \
71 "will be at the bottom of config.log." \
72 "You can run configure with --disable-werror to bypass this check."
8dc38a78
PM
73}
74
9c83ffd8
PM
75do_cc() {
76 do_compiler "$cc" "$@"
77}
78
79do_cxx() {
80 do_compiler "$cxx" "$@"
81}
82
83update_cxxflags() {
84 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
85 # options which some versions of GCC's C++ compiler complain about
86 # because they only make sense for C programs.
87 QEMU_CXXFLAGS=
88 for arg in $QEMU_CFLAGS; do
89 case $arg in
90 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
91 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
92 ;;
93 *)
94 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
95 ;;
96 esac
97 done
98}
99
52166aa0 100compile_object() {
8dc38a78 101 do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
52166aa0
JQ
102}
103
104compile_prog() {
105 local_cflags="$1"
106 local_ldflags="$2"
8dc38a78 107 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
52166aa0
JQ
108}
109
66518bf6
DS
110do_libtool() {
111 local mode=$1
112 shift
113 # Run the compiler, capturing its output to the log.
114 echo $libtool $mode --tag=CC $cc "$@" >> config.log
115 $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $?
116 # Test passed. If this is an --enable-werror build, rerun
117 # the test with -Werror and bail out if it fails. This
118 # makes warning-generating-errors in configure test code
119 # obvious to developers.
120 if test "$werror" != "yes"; then
121 return 0
122 fi
123 # Don't bother rerunning the compile if we were already using -Werror
124 case "$*" in
125 *-Werror*)
126 return 0
127 ;;
128 esac
129 echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log
130 $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $?
131 error_exit "configure test passed without -Werror but failed with -Werror." \
132 "This is probably a bug in the configure script. The failing command" \
133 "will be at the bottom of config.log." \
134 "You can run configure with --disable-werror to bypass this check."
135}
136
137libtool_prog() {
138 do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $?
139 do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib
140}
141
11568d6d
PB
142# symbolically link $1 to $2. Portable version of "ln -sf".
143symlink() {
72b8b5a1 144 rm -rf "$2"
ec5b06d7 145 mkdir -p "$(dirname "$2")"
72b8b5a1 146 ln -s "$1" "$2"
11568d6d
PB
147}
148
0dba6195
LM
149# check whether a command is available to this shell (may be either an
150# executable or a builtin)
151has() {
152 type "$1" >/dev/null 2>&1
153}
154
155# search for an executable in PATH
156path_of() {
157 local_command="$1"
158 local_ifs="$IFS"
159 local_dir=""
160
161 # pathname has a dir component?
162 if [ "${local_command#*/}" != "$local_command" ]; then
163 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
164 echo "$local_command"
165 return 0
166 fi
167 fi
168 if [ -z "$local_command" ]; then
169 return 1
170 fi
171
172 IFS=:
173 for local_dir in $PATH; do
174 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
175 echo "$local_dir/$local_command"
176 IFS="${local_ifs:-$(printf ' \t\n')}"
177 return 0
178 fi
179 done
180 # not found
181 IFS="${local_ifs:-$(printf ' \t\n')}"
182 return 1
183}
184
7d13299d 185# default parameters
ca4deeb1 186source_path=`dirname "$0"`
2ff6b91e 187cpu=""
a31a8642 188iasl="iasl"
1e43adfc 189interp_prefix="/usr/gnemul/qemu-%M"
43ce4dfe 190static="no"
7d13299d 191cross_prefix=""
0c58ac1c 192audio_drv_list=""
b64ec4e4
FZ
193block_drv_rw_whitelist=""
194block_drv_ro_whitelist=""
e49d021e 195host_cc="cc"
73da375e 196libs_softmmu=""
3e2e0e6b 197libs_tools=""
67f86e8e 198audio_pt_int=""
d5631638 199audio_win_int=""
2b2e59e6 200cc_i386=i386-pc-linux-gnu-gcc
957f1f99 201libs_qga=""
5bc62e01 202debug_info="yes"
63678e17 203stack_protector=""
ac0df51d 204
afb63ebd
SW
205# Don't accept a target_list environment variable.
206unset target_list
377529c0
PB
207
208# Default value for a variable defining feature "foo".
209# * foo="no" feature will only be used if --enable-foo arg is given
210# * foo="" feature will be searched for, and if found, will be used
211# unless --disable-foo is given
212# * foo="yes" this value will only be set by --enable-foo flag.
213# feature will searched for,
214# if not found, configure exits with error
215#
216# Always add --enable-foo and --disable-foo command line args.
217# Distributions want to ensure that several features are compiled in, and it
218# is impossible without a --enable-foo that exits if a feature is not found.
219
220bluez=""
221brlapi=""
222curl=""
223curses=""
224docs=""
225fdt=""
58952137 226netmap="no"
e2134eb9 227pixman=""
377529c0 228sdl=""
47c03744 229sdlabi="1.2"
983eef5a 230virtfs=""
821601ea 231vnc="yes"
377529c0
PB
232sparse="no"
233uuid=""
234vde=""
235vnc_tls=""
236vnc_sasl=""
237vnc_jpeg=""
238vnc_png=""
7536ee4b 239vnc_ws=""
377529c0 240xen=""
d5b93ddf 241xen_ctrl_version=""
eb6fda0f 242xen_pci_passthrough=""
377529c0 243linux_aio=""
47e98658 244cap_ng=""
377529c0 245attr=""
4f26f2b6 246libattr=""
377529c0
PB
247xfs=""
248
d41a75a2 249vhost_net="no"
5e9be92d 250vhost_scsi="no"
d41a75a2 251kvm="no"
2da776db 252rdma=""
377529c0
PB
253gprof="no"
254debug_tcg="no"
377529c0
PB
255debug="no"
256strip_opt="yes"
9195b2c2 257tcg_interpreter="no"
377529c0
PB
258bigendian="no"
259mingw32="no"
1d728c39
BS
260gcov="no"
261gcov_tool="gcov"
377529c0 262EXESUF=""
17969268
FZ
263DSOSUF=".so"
264LDFLAGS_SHARED="-shared"
265modules="no"
377529c0
PB
266prefix="/usr/local"
267mandir="\${prefix}/share/man"
528ae5b8 268datadir="\${prefix}/share"
850da188 269qemu_docdir="\${prefix}/share/doc/qemu"
377529c0 270bindir="\${prefix}/bin"
3aa5d2be 271libdir="\${prefix}/lib"
8bf188aa 272libexecdir="\${prefix}/libexec"
0f94d6da 273includedir="\${prefix}/include"
377529c0 274sysconfdir="\${prefix}/etc"
785c23ae 275local_statedir="\${prefix}/var"
377529c0
PB
276confsuffix="/qemu"
277slirp="yes"
278fmod_lib=""
279fmod_inc=""
280oss_lib=""
281bsd="no"
282linux="no"
283solaris="no"
284profiler="no"
285cocoa="no"
286softmmu="yes"
287linux_user="no"
377529c0 288bsd_user="no"
30163d89 289guest_base="yes"
377529c0
PB
290aix="no"
291blobs="yes"
292pkgversion=""
40d6444e 293pie=""
377529c0 294zero_malloc=""
3556c233 295qom_cast_debug="yes"
377529c0
PB
296trace_backend="nop"
297trace_file="trace"
298spice=""
299rbd=""
111a38b0 300smartcard_nss=""
2b2325ff 301libusb=""
69354a83 302usb_redir=""
b1e5fff4 303glx=""
1ece9905 304zlib="yes"
607dacd0
QN
305lzo="no"
306snappy="no"
e8ef31a3 307guest_agent=""
d9840e25
TS
308guest_agent_with_vss="no"
309vss_win32_sdk=""
310win_sdk="no"
4b1c11fd 311want_tools="yes"
c589b249 312libiscsi=""
6542aa9c 313libnfs=""
519175a2 314coroutine=""
70c60c08 315coroutine_pool=""
f794573e 316seccomp=""
eb100396 317glusterfs=""
0c14fb47 318glusterfs_discard="no"
7c815372 319glusterfs_zerofill="no"
583f6e7b 320virtio_blk_data_plane=""
a4ccabcf 321gtk=""
9e04c683 322gtkabi=""
bbbf9bfb 323vte=""
ab214c29 324tpm="no"
0a12ec87 325libssh2=""
4f18b782 326vhdx=""
95c6bff3 327quorum="no"
377529c0 328
ac0df51d
AL
329# parse CC options first
330for opt do
331 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
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 ;;
a558ee17 343 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
f9943cd5 344 EXTRA_CFLAGS="$optarg"
e2a2ed06
JQ
345 ;;
346 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
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
354done
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
363if test -z "${CC}${cross_prefix}"; then
364 cc="$host_cc"
365else
366 cc="${CC-${cross_prefix}gcc}"
367fi
368
83f73fce
TS
369if test -z "${CXX}${cross_prefix}"; then
370 cxx="c++"
371else
372 cxx="${CXX-${cross_prefix}g++}"
373fi
374
b3198cc2 375ar="${AR-${cross_prefix}ar}"
3dd46c78
BS
376as="${AS-${cross_prefix}as}"
377cpp="${CPP-$cc -E}"
b3198cc2
SY
378objcopy="${OBJCOPY-${cross_prefix}objcopy}"
379ld="${LD-${cross_prefix}ld}"
3f534581 380libtool="${LIBTOOL-${cross_prefix}libtool}"
b3198cc2
SY
381strip="${STRIP-${cross_prefix}strip}"
382windres="${WINDRES-${cross_prefix}windres}"
17884d7b
ST
383pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
384query_pkg_config() {
385 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
386}
387pkg_config=query_pkg_config
b3198cc2 388sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
47c03744 389sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
ac0df51d 390
45d285ab
PM
391# If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
392ARFLAGS="${ARFLAGS-rv}"
393
be17dc90 394# default flags for all hosts
4c288acb 395QEMU_CFLAGS="-fno-strict-aliasing -fno-common $QEMU_CFLAGS"
f9188227 396QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
c95e3080 397QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
be17dc90 398QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
6b4c305c 399QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
5bc62e01
GH
400if test "$debug_info" = "yes"; then
401 CFLAGS="-g $CFLAGS"
402 LDFLAGS="-g $LDFLAGS"
403fi
be17dc90 404
ca4deeb1
PB
405# make source path absolute
406source_path=`cd "$source_path"; pwd`
407
cab00a5a
MT
408# running configure in the source tree?
409# we know that's the case if configure is there.
410if test -f "./configure"; then
411 pwd_is_source_path="y"
412else
413 pwd_is_source_path="n"
414fi
415
ac0df51d
AL
416check_define() {
417cat > $TMPC <<EOF
418#if !defined($1)
fd786e1a 419#error $1 not defined
ac0df51d
AL
420#endif
421int main(void) { return 0; }
422EOF
52166aa0 423 compile_object
ac0df51d
AL
424}
425
bbea4050
PM
426if check_define __linux__ ; then
427 targetos="Linux"
428elif check_define _WIN32 ; then
429 targetos='MINGW32'
430elif check_define __OpenBSD__ ; then
431 targetos='OpenBSD'
432elif check_define __sun__ ; then
433 targetos='SunOS'
434elif check_define __HAIKU__ ; then
435 targetos='Haiku'
436else
437 targetos=`uname -s`
438fi
439
440# Some host OSes need non-standard checks for which CPU to use.
441# Note that these checks are broken for cross-compilation: if you're
442# cross-compiling to one of these OSes then you'll need to specify
443# the correct CPU with the --cpu option.
444case $targetos in
445Darwin)
446 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
447 # run 64-bit userspace code.
448 # If the user didn't specify a CPU explicitly and the kernel says this is
449 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
450 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
451 cpu="x86_64"
452 fi
453 ;;
454SunOS)
455 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
456 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
457 cpu="x86_64"
458 fi
459esac
460
2ff6b91e
JQ
461if test ! -z "$cpu" ; then
462 # command line argument
463 :
464elif check_define __i386__ ; then
ac0df51d
AL
465 cpu="i386"
466elif check_define __x86_64__ ; then
c72b26ec
RH
467 if check_define __ILP32__ ; then
468 cpu="x32"
469 else
470 cpu="x86_64"
471 fi
3aa9bd6c 472elif check_define __sparc__ ; then
3aa9bd6c
BS
473 if check_define __arch64__ ; then
474 cpu="sparc64"
475 else
476 cpu="sparc"
477 fi
fdf7ed96 478elif check_define _ARCH_PPC ; then
479 if check_define _ARCH_PPC64 ; then
480 cpu="ppc64"
481 else
482 cpu="ppc"
483 fi
afa05235
AJ
484elif check_define __mips__ ; then
485 cpu="mips"
477ba620
AJ
486elif check_define __ia64__ ; then
487 cpu="ia64"
d66ed0ea
AJ
488elif check_define __s390__ ; then
489 if check_define __s390x__ ; then
490 cpu="s390x"
491 else
492 cpu="s390"
493 fi
21d89f84
PM
494elif check_define __arm__ ; then
495 cpu="arm"
1f080313
CF
496elif check_define __aarch64__ ; then
497 cpu="aarch64"
f28ffed5
BS
498elif check_define __hppa__ ; then
499 cpu="hppa"
ac0df51d 500else
fdf7ed96 501 cpu=`uname -m`
ac0df51d
AL
502fi
503
359bc95d
PM
504ARCH=
505# Normalise host CPU name and set ARCH.
506# Note that this case should only have supported host CPUs, not guests.
7d13299d 507case "$cpu" in
c72b26ec 508 ia64|ppc|ppc64|s390|s390x|sparc64|x32)
ea8f20f8
JQ
509 cpu="$cpu"
510 ;;
7d13299d 511 i386|i486|i586|i686|i86pc|BePC)
97a847bc 512 cpu="i386"
7d13299d 513 ;;
aaa5fa14
AJ
514 x86_64|amd64)
515 cpu="x86_64"
516 ;;
21d89f84
PM
517 armv*b|armv*l|arm)
518 cpu="arm"
7d13299d 519 ;;
1f080313
CF
520 aarch64)
521 cpu="aarch64"
522 ;;
afa05235
AJ
523 mips*)
524 cpu="mips"
525 ;;
3142255c 526 sparc|sun4[cdmuv])
ae228531
FB
527 cpu="sparc"
528 ;;
7d13299d 529 *)
359bc95d
PM
530 # This will result in either an error or falling back to TCI later
531 ARCH=unknown
7d13299d
FB
532 ;;
533esac
359bc95d
PM
534if test -z "$ARCH"; then
535 ARCH="$cpu"
536fi
e2d52ad3 537
7d13299d 538# OS specific
0dbfc675 539
7d13299d 540case $targetos in
c326e0af 541CYGWIN*)
0dbfc675 542 mingw32="yes"
a558ee17 543 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
d5631638 544 audio_possible_drivers="winwave sdl"
545 audio_drv_list="winwave"
c326e0af 546;;
67b915a5 547MINGW32*)
0dbfc675 548 mingw32="yes"
d5631638 549 audio_possible_drivers="winwave dsound sdl fmod"
550 audio_drv_list="winwave"
67b915a5 551;;
5c40d2bd 552GNU/kFreeBSD)
a167ba50 553 bsd="yes"
0dbfc675
JQ
554 audio_drv_list="oss"
555 audio_possible_drivers="oss sdl esd pa"
5c40d2bd 556;;
7d3505c5 557FreeBSD)
0dbfc675 558 bsd="yes"
0db4a067 559 make="${MAKE-gmake}"
0dbfc675
JQ
560 audio_drv_list="oss"
561 audio_possible_drivers="oss sdl esd pa"
f01576f1
JL
562 # needed for kinfo_getvmmap(3) in libutil.h
563 LIBS="-lutil $LIBS"
58952137 564 netmap="" # enable netmap autodetect
7d3505c5 565;;
c5e97233 566DragonFly)
0dbfc675 567 bsd="yes"
0db4a067 568 make="${MAKE-gmake}"
0dbfc675
JQ
569 audio_drv_list="oss"
570 audio_possible_drivers="oss sdl esd pa"
c5e97233 571;;
7d3505c5 572NetBSD)
0dbfc675 573 bsd="yes"
0db4a067 574 make="${MAKE-gmake}"
0dbfc675
JQ
575 audio_drv_list="oss"
576 audio_possible_drivers="oss sdl esd"
577 oss_lib="-lossaudio"
7d3505c5
FB
578;;
579OpenBSD)
0dbfc675 580 bsd="yes"
0db4a067 581 make="${MAKE-gmake}"
4f6ab397
BS
582 audio_drv_list="sdl"
583 audio_possible_drivers="sdl esd"
7d3505c5 584;;
83fb7adf 585Darwin)
0dbfc675
JQ
586 bsd="yes"
587 darwin="yes"
17969268 588 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
0dbfc675 589 if [ "$cpu" = "x86_64" ] ; then
a558ee17 590 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
0c439cbf 591 LDFLAGS="-arch x86_64 $LDFLAGS"
0dbfc675 592 fi
0dbfc675
JQ
593 cocoa="yes"
594 audio_drv_list="coreaudio"
595 audio_possible_drivers="coreaudio sdl fmod"
596 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
7973f21c 597 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
a0b7cf6b
PM
598 # Disable attempts to use ObjectiveC features in os/object.h since they
599 # won't work when we're compiling with gcc as a C compiler.
600 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
83fb7adf 601;;
ec530c81 602SunOS)
0dbfc675 603 solaris="yes"
0db4a067
PB
604 make="${MAKE-gmake}"
605 install="${INSTALL-ginstall}"
fa58948d 606 ld="gld"
e2d8830e 607 smbd="${SMBD-/usr/sfw/sbin/smbd}"
0dbfc675
JQ
608 needs_libsunmath="no"
609 solarisrev=`uname -r | cut -f2 -d.`
0dbfc675
JQ
610 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
611 if test "$solarisrev" -le 9 ; then
612 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
613 needs_libsunmath="yes"
f14bfdf9
JQ
614 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
615 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
616 LIBS="-lsunmath $LIBS"
0dbfc675 617 else
76ad07a4
PM
618 error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
619 "libsunmath from the Sun Studio compilers tools, due to a lack of" \
620 "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
621 "Studio 11 can be downloaded from www.sun.com."
0dbfc675 622 fi
86b2bd93 623 fi
0dbfc675
JQ
624 fi
625 if test -f /usr/include/sys/soundcard.h ; then
626 audio_drv_list="oss"
627 fi
628 audio_possible_drivers="oss sdl"
d741429a
BS
629# needed for CMSG_ macros in sys/socket.h
630 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
631# needed for TIOCWIN* defines in termios.h
632 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
a558ee17 633 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
560d375f
AF
634 solarisnetlibs="-lsocket -lnsl -lresolv"
635 LIBS="$solarisnetlibs $LIBS"
636 libs_qga="$solarisnetlibs $libs_qga"
86b2bd93 637;;
b29fe3ed 638AIX)
0dbfc675 639 aix="yes"
0db4a067 640 make="${MAKE-gmake}"
b29fe3ed 641;;
179cf400
AF
642Haiku)
643 haiku="yes"
644 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
645 LIBS="-lposix_error_mapper -lnetwork $LIBS"
646;;
1d14ffa9 647*)
0dbfc675
JQ
648 audio_drv_list="oss"
649 audio_possible_drivers="oss alsa sdl esd pa"
650 linux="yes"
651 linux_user="yes"
af2be207
JK
652 kvm="yes"
653 vhost_net="yes"
5e9be92d 654 vhost_scsi="yes"
c72b26ec 655 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
c2de5c91 656 audio_possible_drivers="$audio_possible_drivers fmod"
0dbfc675 657 fi
a585140d 658 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
fb065187 659;;
7d13299d
FB
660esac
661
7d3505c5 662if [ "$bsd" = "yes" ] ; then
b1a550a0 663 if [ "$darwin" != "yes" ] ; then
08de3949 664 bsd_user="yes"
83fb7adf 665 fi
7d3505c5
FB
666fi
667
0db4a067
PB
668: ${make=${MAKE-make}}
669: ${install=${INSTALL-install}}
52510f8b 670: ${python=${PYTHON-python}}
e2d8830e 671: ${smbd=${SMBD-/usr/sbin/smbd}}
0db4a067 672
3c4a4d0d
PM
673# Default objcc to clang if available, otherwise use CC
674if has clang; then
675 objcc=clang
676else
677 objcc="$cc"
678fi
679
3457a3f8 680if test "$mingw32" = "yes" ; then
3457a3f8 681 EXESUF=".exe"
17969268 682 DSOSUF=".dll"
a558ee17 683 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
e94a7936
SW
684 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
685 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
f7cf5d5b
SW
686 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
687cat > $TMPC << EOF
688int main(void) { return 0; }
689EOF
690 if compile_prog "" "-liberty" ; then
691 LIBS="-liberty $LIBS"
692 fi
c5ec15ea 693 prefix="c:/Program Files/QEMU"
683035de 694 mandir="\${prefix}"
528ae5b8 695 datadir="\${prefix}"
850da188 696 qemu_docdir="\${prefix}"
683035de
PB
697 bindir="\${prefix}"
698 sysconfdir="\${prefix}"
5a699bbb 699 local_statedir=
683035de 700 confsuffix=""
368542b8 701 libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
3457a3f8
JQ
702fi
703
487fefdb 704werror=""
85aa5189 705
7d13299d 706for opt do
a46e4035 707 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
7d13299d 708 case "$opt" in
2efc3265
FB
709 --help|-h) show_help=yes
710 ;;
99123e13
MF
711 --version|-V) exec cat $source_path/VERSION
712 ;;
b1a550a0 713 --prefix=*) prefix="$optarg"
7d13299d 714 ;;
b1a550a0 715 --interp-prefix=*) interp_prefix="$optarg"
32ce6337 716 ;;
ca4deeb1 717 --source-path=*)
7d13299d 718 ;;
ac0df51d 719 --cross-prefix=*)
7d13299d 720 ;;
ac0df51d 721 --cc=*)
7d13299d 722 ;;
b1a550a0 723 --host-cc=*) host_cc="$optarg"
83469015 724 ;;
83f73fce
TS
725 --cxx=*)
726 ;;
e007dbec
MT
727 --iasl=*) iasl="$optarg"
728 ;;
3c4a4d0d
PM
729 --objcc=*) objcc="$optarg"
730 ;;
b1a550a0 731 --make=*) make="$optarg"
7d13299d 732 ;;
6a882643
PB
733 --install=*) install="$optarg"
734 ;;
c886edfb
BS
735 --python=*) python="$optarg"
736 ;;
1d728c39
BS
737 --gcov=*) gcov_tool="$optarg"
738 ;;
e2d8830e
BS
739 --smbd=*) smbd="$optarg"
740 ;;
e2a2ed06 741 --extra-cflags=*)
7d13299d 742 ;;
e2a2ed06 743 --extra-ldflags=*)
7d13299d 744 ;;
5bc62e01
GH
745 --enable-debug-info)
746 ;;
747 --disable-debug-info)
748 ;;
17969268
FZ
749 --enable-modules)
750 modules="yes"
751 ;;
2ff6b91e 752 --cpu=*)
7d13299d 753 ;;
b1a550a0 754 --target-list=*) target_list="$optarg"
de83cd02 755 ;;
74242e0f 756 --enable-trace-backend=*) trace_backend="$optarg"
94a420b1 757 ;;
74242e0f 758 --with-trace-file=*) trace_file="$optarg"
9410b56c 759 ;;
7d13299d
FB
760 --enable-gprof) gprof="yes"
761 ;;
1d728c39
BS
762 --enable-gcov) gcov="yes"
763 ;;
79427693
LM
764 --static)
765 static="yes"
766 LDFLAGS="-static $LDFLAGS"
17884d7b 767 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
43ce4dfe 768 ;;
0b24e75f
PB
769 --mandir=*) mandir="$optarg"
770 ;;
771 --bindir=*) bindir="$optarg"
772 ;;
3aa5d2be
AL
773 --libdir=*) libdir="$optarg"
774 ;;
8bf188aa
MT
775 --libexecdir=*) libexecdir="$optarg"
776 ;;
0f94d6da
AL
777 --includedir=*) includedir="$optarg"
778 ;;
528ae5b8 779 --datadir=*) datadir="$optarg"
0b24e75f 780 ;;
023d3d67
EH
781 --with-confsuffix=*) confsuffix="$optarg"
782 ;;
850da188 783 --docdir=*) qemu_docdir="$optarg"
0b24e75f 784 ;;
ca2fb938 785 --sysconfdir=*) sysconfdir="$optarg"
07381cc1 786 ;;
785c23ae
LC
787 --localstatedir=*) local_statedir="$optarg"
788 ;;
789 --sbindir=*|--sharedstatedir=*|\
023ddd74
MF
790 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
791 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
792 # These switches are silently ignored, for compatibility with
793 # autoconf-generated configure scripts. This allows QEMU's
794 # configure to be used by RPM and similar macros that set
795 # lots of directory switches by default.
796 ;;
e2134eb9
GH
797 --with-system-pixman) pixman="system"
798 ;;
799 --without-system-pixman) pixman="internal"
800 ;;
74880fe2
RS
801 --without-pixman) pixman="none"
802 ;;
97a847bc
FB
803 --disable-sdl) sdl="no"
804 ;;
c4198157
JQ
805 --enable-sdl) sdl="yes"
806 ;;
47c03744
DA
807 --with-sdlabi=*) sdlabi="$optarg"
808 ;;
3556c233
PB
809 --disable-qom-cast-debug) qom_cast_debug="no"
810 ;;
811 --enable-qom-cast-debug) qom_cast_debug="yes"
812 ;;
983eef5a
MI
813 --disable-virtfs) virtfs="no"
814 ;;
815 --enable-virtfs) virtfs="yes"
816 ;;
821601ea
JS
817 --disable-vnc) vnc="no"
818 ;;
819 --enable-vnc) vnc="yes"
820 ;;
0c58ac1c 821 --fmod-lib=*) fmod_lib="$optarg"
1d14ffa9 822 ;;
c2de5c91 823 --fmod-inc=*) fmod_inc="$optarg"
824 ;;
2f6a1ab0
BS
825 --oss-lib=*) oss_lib="$optarg"
826 ;;
0c58ac1c 827 --audio-drv-list=*) audio_drv_list="$optarg"
102a52e4 828 ;;
b64ec4e4
FZ
829 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
830 ;;
831 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
eb852011 832 ;;
f8393946
AJ
833 --enable-debug-tcg) debug_tcg="yes"
834 ;;
835 --disable-debug-tcg) debug_tcg="no"
836 ;;
f3d08ee6
PB
837 --enable-debug)
838 # Enable debugging options that aren't excessively noisy
839 debug_tcg="yes"
840 debug="yes"
841 strip_opt="no"
842 ;;
03b4fe7d
AL
843 --enable-sparse) sparse="yes"
844 ;;
845 --disable-sparse) sparse="no"
846 ;;
1625af87
AL
847 --disable-strip) strip_opt="no"
848 ;;
8d5d2d4c
TS
849 --disable-vnc-tls) vnc_tls="no"
850 ;;
1be10ad2
JQ
851 --enable-vnc-tls) vnc_tls="yes"
852 ;;
2f9606b3
AL
853 --disable-vnc-sasl) vnc_sasl="no"
854 ;;
ea784e3b
JQ
855 --enable-vnc-sasl) vnc_sasl="yes"
856 ;;
2f6f5c7a
CC
857 --disable-vnc-jpeg) vnc_jpeg="no"
858 ;;
859 --enable-vnc-jpeg) vnc_jpeg="yes"
860 ;;
efe556ad
CC
861 --disable-vnc-png) vnc_png="no"
862 ;;
863 --enable-vnc-png) vnc_png="yes"
864 ;;
7536ee4b
TH
865 --disable-vnc-ws) vnc_ws="no"
866 ;;
867 --enable-vnc-ws) vnc_ws="yes"
868 ;;
443f1376 869 --disable-slirp) slirp="no"
1d14ffa9 870 ;;
ee682d27
SW
871 --disable-uuid) uuid="no"
872 ;;
873 --enable-uuid) uuid="yes"
874 ;;
e0e6c8c0 875 --disable-vde) vde="no"
8a16d273 876 ;;
dfb278bd
JQ
877 --enable-vde) vde="yes"
878 ;;
58952137
VM
879 --disable-netmap) netmap="no"
880 ;;
881 --enable-netmap) netmap="yes"
882 ;;
e37630ca
AL
883 --disable-xen) xen="no"
884 ;;
fc321b4b
JQ
885 --enable-xen) xen="yes"
886 ;;
eb6fda0f
AP
887 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
888 ;;
889 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
890 ;;
2e4d9fb1
AJ
891 --disable-brlapi) brlapi="no"
892 ;;
4ffcedb6
JQ
893 --enable-brlapi) brlapi="yes"
894 ;;
fb599c9a
AZ
895 --disable-bluez) bluez="no"
896 ;;
a20a6f46
JQ
897 --enable-bluez) bluez="yes"
898 ;;
7ba1e619
AL
899 --disable-kvm) kvm="no"
900 ;;
b31a0277
JQ
901 --enable-kvm) kvm="yes"
902 ;;
9195b2c2
SW
903 --disable-tcg-interpreter) tcg_interpreter="no"
904 ;;
905 --enable-tcg-interpreter) tcg_interpreter="yes"
906 ;;
47e98658
CB
907 --disable-cap-ng) cap_ng="no"
908 ;;
909 --enable-cap-ng) cap_ng="yes"
910 ;;
cd4ec0b4
GH
911 --disable-spice) spice="no"
912 ;;
913 --enable-spice) spice="yes"
914 ;;
c589b249
RS
915 --disable-libiscsi) libiscsi="no"
916 ;;
917 --enable-libiscsi) libiscsi="yes"
918 ;;
6542aa9c
PL
919 --disable-libnfs) libnfs="no"
920 ;;
921 --enable-libnfs) libnfs="yes"
922 ;;
05c2a3e7
FB
923 --enable-profiler) profiler="yes"
924 ;;
14821030
PB
925 --disable-cocoa) cocoa="no"
926 ;;
c2de5c91 927 --enable-cocoa)
928 cocoa="yes" ;
929 sdl="no" ;
930 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
1d14ffa9 931 ;;
cad25d69 932 --disable-system) softmmu="no"
0a8e90f4 933 ;;
cad25d69 934 --enable-system) softmmu="yes"
0a8e90f4 935 ;;
0953a80f
ZA
936 --disable-user)
937 linux_user="no" ;
938 bsd_user="no" ;
0953a80f
ZA
939 ;;
940 --enable-user) ;;
831b7825 941 --disable-linux-user) linux_user="no"
0a8e90f4 942 ;;
831b7825
TS
943 --enable-linux-user) linux_user="yes"
944 ;;
84778508
BS
945 --disable-bsd-user) bsd_user="no"
946 ;;
947 --enable-bsd-user) bsd_user="yes"
948 ;;
379f6698
PB
949 --enable-guest-base) guest_base="yes"
950 ;;
951 --disable-guest-base) guest_base="no"
952 ;;
40d6444e 953 --enable-pie) pie="yes"
34005a00 954 ;;
40d6444e 955 --disable-pie) pie="no"
34005a00 956 ;;
85aa5189
FB
957 --enable-werror) werror="yes"
958 ;;
959 --disable-werror) werror="no"
960 ;;
63678e17
SN
961 --enable-stack-protector) stack_protector="yes"
962 ;;
963 --disable-stack-protector) stack_protector="no"
964 ;;
4d3b6f6e
AZ
965 --disable-curses) curses="no"
966 ;;
c584a6d0
JQ
967 --enable-curses) curses="yes"
968 ;;
769ce76d
AG
969 --disable-curl) curl="no"
970 ;;
788c8196
JQ
971 --enable-curl) curl="yes"
972 ;;
2df87df7
JQ
973 --disable-fdt) fdt="no"
974 ;;
975 --enable-fdt) fdt="yes"
976 ;;
5c6c3a6c
CH
977 --disable-linux-aio) linux_aio="no"
978 ;;
979 --enable-linux-aio) linux_aio="yes"
980 ;;
758e8e38
VJ
981 --disable-attr) attr="no"
982 ;;
983 --enable-attr) attr="yes"
984 ;;
77755340
TS
985 --disable-blobs) blobs="no"
986 ;;
4a19f1ec
PB
987 --with-pkgversion=*) pkgversion=" ($optarg)"
988 ;;
519175a2
AB
989 --with-coroutine=*) coroutine="$optarg"
990 ;;
70c60c08
SH
991 --disable-coroutine-pool) coroutine_pool="no"
992 ;;
993 --enable-coroutine-pool) coroutine_pool="yes"
994 ;;
a25dba17 995 --disable-docs) docs="no"
70ec5dc0 996 ;;
a25dba17 997 --enable-docs) docs="yes"
83a3ab8b 998 ;;
d5970055
MT
999 --disable-vhost-net) vhost_net="no"
1000 ;;
1001 --enable-vhost-net) vhost_net="yes"
1002 ;;
5e9be92d
NB
1003 --disable-vhost-scsi) vhost_scsi="no"
1004 ;;
1005 --enable-vhost-scsi) vhost_scsi="yes"
1006 ;;
b1e5fff4 1007 --disable-glx) glx="no"
20ff075b 1008 ;;
b1e5fff4 1009 --enable-glx) glx="yes"
20ff075b 1010 ;;
f27aaf4b
CB
1011 --disable-rbd) rbd="no"
1012 ;;
1013 --enable-rbd) rbd="yes"
1014 ;;
8c84cf11
ST
1015 --disable-xfsctl) xfs="no"
1016 ;;
1017 --enable-xfsctl) xfs="yes"
1018 ;;
111a38b0
RR
1019 --disable-smartcard-nss) smartcard_nss="no"
1020 ;;
1021 --enable-smartcard-nss) smartcard_nss="yes"
1022 ;;
2b2325ff
GH
1023 --disable-libusb) libusb="no"
1024 ;;
1025 --enable-libusb) libusb="yes"
1026 ;;
69354a83
HG
1027 --disable-usb-redir) usb_redir="no"
1028 ;;
1029 --enable-usb-redir) usb_redir="yes"
1030 ;;
1ece9905
AL
1031 --disable-zlib-test) zlib="no"
1032 ;;
607dacd0
QN
1033 --enable-lzo) lzo="yes"
1034 ;;
1035 --enable-snappy) snappy="yes"
1036 ;;
d138cee9
MR
1037 --enable-guest-agent) guest_agent="yes"
1038 ;;
1039 --disable-guest-agent) guest_agent="no"
1040 ;;
d9840e25
TS
1041 --with-vss-sdk) vss_win32_sdk=""
1042 ;;
1043 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1044 ;;
1045 --without-vss-sdk) vss_win32_sdk="no"
1046 ;;
1047 --with-win-sdk) win_sdk=""
1048 ;;
1049 --with-win-sdk=*) win_sdk="$optarg"
1050 ;;
1051 --without-win-sdk) win_sdk="no"
1052 ;;
4b1c11fd
DB
1053 --enable-tools) want_tools="yes"
1054 ;;
1055 --disable-tools) want_tools="no"
1056 ;;
f794573e
EO
1057 --enable-seccomp) seccomp="yes"
1058 ;;
1059 --disable-seccomp) seccomp="no"
1060 ;;
eb100396
BR
1061 --disable-glusterfs) glusterfs="no"
1062 ;;
1063 --enable-glusterfs) glusterfs="yes"
1064 ;;
583f6e7b
SH
1065 --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
1066 ;;
1067 --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
1068 ;;
a4ccabcf
AL
1069 --disable-gtk) gtk="no"
1070 ;;
1071 --enable-gtk) gtk="yes"
1072 ;;
2da776db
MH
1073 --enable-rdma) rdma="yes"
1074 ;;
1075 --disable-rdma) rdma="no"
1076 ;;
528de90a
DB
1077 --with-gtkabi=*) gtkabi="$optarg"
1078 ;;
bbbf9bfb
SW
1079 --disable-vte) vte="no"
1080 ;;
1081 --enable-vte) vte="yes"
1082 ;;
ab214c29
SB
1083 --enable-tpm) tpm="yes"
1084 ;;
0a12ec87
RJ
1085 --disable-libssh2) libssh2="no"
1086 ;;
1087 --enable-libssh2) libssh2="yes"
1088 ;;
4f18b782
JC
1089 --enable-vhdx) vhdx="yes"
1090 ;;
1091 --disable-vhdx) vhdx="no"
1092 ;;
95c6bff3
BC
1093 --disable-quorum) quorum="no"
1094 ;;
1095 --enable-quorum) quorum="yes"
1096 ;;
2d2ad6d0
FZ
1097 *)
1098 echo "ERROR: unknown option $opt"
1099 echo "Try '$0 --help' for more information"
1100 exit 1
7f1559c6 1101 ;;
7d13299d
FB
1102 esac
1103done
1104
f6f0b7d9
SW
1105if ! has $python; then
1106 error_exit "Python not found. Use --python=/path/to/python"
1107fi
1108
1109# Note that if the Python conditional here evaluates True we will exit
1110# with status 1 which is a shell 'false' value.
1111if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1112 error_exit "Cannot use '$python', Python 2.4 or later is required." \
1113 "Note that Python 3 or later is not yet supported." \
1114 "Use --python=/path/to/python to specify a supported Python."
1115fi
1116
1117# The -B switch was added in Python 2.6.
1118# If it is supplied, compiled files are not written.
1119# Use it for Python versions which support it.
1120if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
1121 python="$python -B"
1122fi
1123
40293e58 1124case "$cpu" in
e3608d66
RH
1125 ppc)
1126 CPU_CFLAGS="-m32"
1127 LDFLAGS="-m32 $LDFLAGS"
1128 ;;
1129 ppc64)
1130 CPU_CFLAGS="-m64"
1131 LDFLAGS="-m64 $LDFLAGS"
1132 ;;
9b9c37c3 1133 sparc)
ed968ff1 1134 LDFLAGS="-m32 $LDFLAGS"
79f3b12f 1135 CPU_CFLAGS="-m32 -mcpu=ultrasparc"
3142255c 1136 ;;
ed968ff1 1137 sparc64)
ed968ff1 1138 LDFLAGS="-m64 $LDFLAGS"
79f3b12f 1139 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
3142255c 1140 ;;
76d83bde 1141 s390)
061cdd81 1142 CPU_CFLAGS="-m31"
28d7cc49
RH
1143 LDFLAGS="-m31 $LDFLAGS"
1144 ;;
1145 s390x)
061cdd81 1146 CPU_CFLAGS="-m64"
28d7cc49 1147 LDFLAGS="-m64 $LDFLAGS"
76d83bde 1148 ;;
40293e58 1149 i386)
79f3b12f 1150 CPU_CFLAGS="-m32"
0c439cbf 1151 LDFLAGS="-m32 $LDFLAGS"
2b2e59e6 1152 cc_i386='$(CC) -m32'
40293e58
FB
1153 ;;
1154 x86_64)
79f3b12f 1155 CPU_CFLAGS="-m64"
0c439cbf 1156 LDFLAGS="-m64 $LDFLAGS"
2b2e59e6 1157 cc_i386='$(CC) -m32'
d2fbca94 1158 ;;
c72b26ec
RH
1159 x32)
1160 CPU_CFLAGS="-mx32"
1161 LDFLAGS="-mx32 $LDFLAGS"
1162 cc_i386='$(CC) -m32'
1163 ;;
30163d89 1164 # No special flags required for other host CPUs
3142255c
BS
1165esac
1166
79f3b12f
PC
1167QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1168EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1169
60e0df25
PM
1170default_target_list=""
1171
6e92f823
PM
1172mak_wilds=""
1173
1174if [ "$softmmu" = "yes" ]; then
1175 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
60e0df25 1176fi
6e92f823
PM
1177if [ "$linux_user" = "yes" ]; then
1178 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
60e0df25 1179fi
6e92f823
PM
1180if [ "$bsd_user" = "yes" ]; then
1181 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
60e0df25
PM
1182fi
1183
6e92f823
PM
1184for config in $mak_wilds; do
1185 default_target_list="${default_target_list} $(basename "$config" .mak)"
1186done
1187
af5db58e
PB
1188if test x"$show_help" = x"yes" ; then
1189cat << EOF
1190
1191Usage: configure [options]
1192Options: [defaults in brackets after descriptions]
1193
08fb77ed
SW
1194Standard options:
1195 --help print this message
1196 --prefix=PREFIX install in PREFIX [$prefix]
1197 --interp-prefix=PREFIX where to find shared libraries, etc.
1198 use %M for cpu name [$interp_prefix]
1199 --target-list=LIST set target list (default: build everything)
1200$(echo Available targets: $default_target_list | \
1201 fold -s -w 53 | sed -e 's/^/ /')
1202
1203Advanced options (experts only):
1204 --source-path=PATH path of source code [$source_path]
1205 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1206 --cc=CC use C compiler CC [$cc]
1207 --iasl=IASL use ACPI compiler IASL [$iasl]
1208 --host-cc=CC use C compiler CC [$host_cc] for code run at
1209 build time
1210 --cxx=CXX use C++ compiler CXX [$cxx]
1211 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1212 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
1213 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1214 --make=MAKE use specified make [$make]
1215 --install=INSTALL use specified install [$install]
1216 --python=PYTHON use specified python [$python]
1217 --smbd=SMBD use specified smbd [$smbd]
1218 --static enable static build [$static]
1219 --mandir=PATH install man pages in PATH
1220 --datadir=PATH install firmware in PATH$confsuffix
1221 --docdir=PATH install documentation in PATH$confsuffix
1222 --bindir=PATH install binaries in PATH
1223 --libdir=PATH install libraries in PATH
1224 --sysconfdir=PATH install config in PATH$confsuffix
1225 --localstatedir=PATH install local state in PATH (set at runtime on win32)
e26110cf 1226 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
17969268 1227 --enable-modules enable modules support
08fb77ed
SW
1228 --enable-debug-tcg enable TCG debugging
1229 --disable-debug-tcg disable TCG debugging (default)
d61ce900
PM
1230 --enable-debug-info enable debugging information (default)
1231 --disable-debug-info disable debugging information
08fb77ed
SW
1232 --enable-debug enable common debug build options
1233 --enable-sparse enable sparse checker
1234 --disable-sparse disable sparse checker (default)
1235 --disable-strip disable stripping binaries
1236 --disable-werror disable compilation abort on warning
63678e17 1237 --disable-stack-protector disable compiler-provided stack protection
08fb77ed
SW
1238 --disable-sdl disable SDL
1239 --enable-sdl enable SDL
47c03744 1240 --with-sdlabi select preferred SDL ABI 1.2 or 2.0
08fb77ed
SW
1241 --disable-gtk disable gtk UI
1242 --enable-gtk enable gtk UI
f92d61f3 1243 --with-gtkabi select preferred GTK ABI 2.0 or 3.0
08fb77ed
SW
1244 --disable-virtfs disable VirtFS
1245 --enable-virtfs enable VirtFS
1246 --disable-vnc disable VNC
1247 --enable-vnc enable VNC
1248 --disable-cocoa disable Cocoa (Mac OS X only)
1249 --enable-cocoa enable Cocoa (default on Mac OS X)
1250 --audio-drv-list=LIST set audio drivers list:
1251 Available drivers: $audio_possible_drivers
1252 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1253 --block-drv-rw-whitelist=L
1254 set block driver read-write whitelist
1255 (affects only QEMU, not qemu-img)
1256 --block-drv-ro-whitelist=L
1257 set block driver read-only whitelist
1258 (affects only QEMU, not qemu-img)
1259 --disable-xen disable xen backend driver support
1260 --enable-xen enable xen backend driver support
1261 --disable-xen-pci-passthrough
1262 --enable-xen-pci-passthrough
1263 --disable-brlapi disable BrlAPI
1264 --enable-brlapi enable BrlAPI
1265 --disable-vnc-tls disable TLS encryption for VNC server
1266 --enable-vnc-tls enable TLS encryption for VNC server
1267 --disable-vnc-sasl disable SASL encryption for VNC server
1268 --enable-vnc-sasl enable SASL encryption for VNC server
1269 --disable-vnc-jpeg disable JPEG lossy compression for VNC server
1270 --enable-vnc-jpeg enable JPEG lossy compression for VNC server
1271 --disable-vnc-png disable PNG compression for VNC server (default)
1272 --enable-vnc-png enable PNG compression for VNC server
1273 --disable-vnc-ws disable Websockets support for VNC server
1274 --enable-vnc-ws enable Websockets support for VNC server
1275 --disable-curses disable curses output
1276 --enable-curses enable curses output
1277 --disable-curl disable curl connectivity
1278 --enable-curl enable curl connectivity
1279 --disable-fdt disable fdt device tree
1280 --enable-fdt enable fdt device tree
1281 --disable-bluez disable bluez stack connectivity
1282 --enable-bluez enable bluez stack connectivity
1283 --disable-slirp disable SLIRP userspace network connectivity
1284 --disable-kvm disable KVM acceleration support
1285 --enable-kvm enable KVM acceleration support
1286 --disable-rdma disable RDMA-based migration support
1287 --enable-rdma enable RDMA-based migration support
1288 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1289 --enable-system enable all system emulation targets
1290 --disable-system disable all system emulation targets
1291 --enable-user enable supported user emulation targets
1292 --disable-user disable all user emulation targets
1293 --enable-linux-user enable all linux usermode emulation targets
1294 --disable-linux-user disable all linux usermode emulation targets
1295 --enable-bsd-user enable all BSD usermode emulation targets
1296 --disable-bsd-user disable all BSD usermode emulation targets
1297 --enable-guest-base enable GUEST_BASE support for usermode
1298 emulation targets
1299 --disable-guest-base disable GUEST_BASE support
1300 --enable-pie build Position Independent Executables
1301 --disable-pie do not build Position Independent Executables
1302 --fmod-lib path to FMOD library
1303 --fmod-inc path to FMOD includes
1304 --oss-lib path to OSS library
08fb77ed
SW
1305 --cpu=CPU Build for host CPU [$cpu]
1306 --disable-uuid disable uuid support
1307 --enable-uuid enable uuid support
1308 --disable-vde disable support for vde network
1309 --enable-vde enable support for vde network
1310 --disable-netmap disable support for netmap network
1311 --enable-netmap enable support for netmap network
1312 --disable-linux-aio disable Linux AIO support
1313 --enable-linux-aio enable Linux AIO support
1314 --disable-cap-ng disable libcap-ng support
1315 --enable-cap-ng enable libcap-ng support
1316 --disable-attr disables attr and xattr support
1317 --enable-attr enable attr and xattr support
1318 --disable-blobs disable installing provided firmware blobs
1319 --enable-docs enable documentation build
1320 --disable-docs disable documentation build
1321 --disable-vhost-net disable vhost-net acceleration support
1322 --enable-vhost-net enable vhost-net acceleration support
1323 --enable-trace-backend=B Set trace backend
1324 Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
1325 --with-trace-file=NAME Full PATH,NAME of file to store traces
1326 Default:trace-<pid>
1327 --disable-spice disable spice
1328 --enable-spice enable spice
1329 --enable-rbd enable building the rados block device (rbd)
1330 --disable-libiscsi disable iscsi support
1331 --enable-libiscsi enable iscsi support
6542aa9c
PL
1332 --disable-libnfs disable nfs support
1333 --enable-libnfs enable nfs support
08fb77ed
SW
1334 --disable-smartcard-nss disable smartcard nss support
1335 --enable-smartcard-nss enable smartcard nss support
1336 --disable-libusb disable libusb (for usb passthrough)
1337 --enable-libusb enable libusb (for usb passthrough)
1338 --disable-usb-redir disable usb network redirection support
1339 --enable-usb-redir enable usb network redirection support
607dacd0
QN
1340 --enable-lzo enable the support of lzo compression library
1341 --enable-snappy enable the support of snappy compression library
08fb77ed
SW
1342 --disable-guest-agent disable building of the QEMU Guest Agent
1343 --enable-guest-agent enable building of the QEMU Guest Agent
1344 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1345 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1346 --disable-seccomp disable seccomp support
1347 --enable-seccomp enables seccomp support
1348 --with-coroutine=BACKEND coroutine backend. Supported options:
1349 gthread, ucontext, sigaltstack, windows
1350 --disable-coroutine-pool disable coroutine freelist (worse performance)
1351 --enable-coroutine-pool enable coroutine freelist (better performance)
1352 --enable-glusterfs enable GlusterFS backend
1353 --disable-glusterfs disable GlusterFS backend
1354 --enable-gcov enable test coverage analysis with gcov
1355 --gcov=GCOV use specified gcov [$gcov_tool]
1356 --enable-tpm enable TPM support
1357 --disable-libssh2 disable ssh block device support
1358 --enable-libssh2 enable ssh block device support
1359 --disable-vhdx disables support for the Microsoft VHDX image format
1360 --enable-vhdx enable support for the Microsoft VHDX image format
95c6bff3
BC
1361 --disable-quorum disable quorum block filter support
1362 --enable-quorum enable quorum block filter support
08fb77ed
SW
1363
1364NOTE: The object files are built at the place where configure is launched
af5db58e 1365EOF
2d2ad6d0 1366exit 0
af5db58e
PB
1367fi
1368
359bc95d
PM
1369# Now we have handled --enable-tcg-interpreter and know we're not just
1370# printing the help message, bail out if the host CPU isn't supported.
1371if test "$ARCH" = "unknown"; then
1372 if test "$tcg_interpreter" = "yes" ; then
1373 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1374 ARCH=tci
1375 else
76ad07a4 1376 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
359bc95d
PM
1377 fi
1378fi
1379
9c83ffd8
PM
1380# Consult white-list to determine whether to enable werror
1381# by default. Only enable by default for git builds
1382z_version=`cut -f3 -d. $source_path/VERSION`
1383
1384if test -z "$werror" ; then
1385 if test -d "$source_path/.git" -a \
1386 "$linux" = "yes" ; then
1387 werror="yes"
1388 else
1389 werror="no"
1390 fi
1391fi
1392
8d05095c
PB
1393# check that the C compiler works.
1394cat > $TMPC <<EOF
75cafad7 1395int main(void) { return 0; }
8d05095c
PB
1396EOF
1397
1398if compile_object ; then
1399 : C compiler works ok
1400else
76ad07a4 1401 error_exit "\"$cc\" either does not exist or does not work"
8d05095c
PB
1402fi
1403
98b21dcd
PM
1404# Check that the C++ compiler exists and works with the C compiler
1405if has $cxx; then
1406 cat > $TMPC <<EOF
1407int c_function(void);
1408int main(void) { return c_function(); }
1409EOF
1410
1411 compile_object
1412
9c83ffd8 1413 cat > $TMPCXX <<EOF
98b21dcd
PM
1414extern "C" {
1415 int c_function(void);
1416}
1417int c_function(void) { return 42; }
1418EOF
1419
9c83ffd8
PM
1420 update_cxxflags
1421
1422 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
98b21dcd
PM
1423 # C++ compiler $cxx works ok with C compiler $cc
1424 :
1425 else
1426 echo "C++ compiler $cxx does not work with C compiler $cc"
1427 echo "Disabling C++ specific optional code"
1428 cxx=
1429 fi
1430else
1431 echo "No C++ compiler available; disabling C++ specific optional code"
1432 cxx=
1433fi
1434
8d05095c
PB
1435gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1436gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1437gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
37746c5e 1438gcc_flags="-Wendif-labels $gcc_flags"
c1556a81 1439gcc_flags="-Wno-initializer-overrides $gcc_flags"
71429097 1440gcc_flags="-Wno-string-plus-int $gcc_flags"
6ca026cb
PM
1441# Note that we do not add -Werror to gcc_flags here, because that would
1442# enable it for all configure tests. If a configure test failed due
1443# to -Werror this would just silently disable some features,
1444# so it's too error prone.
8d05095c
PB
1445cat > $TMPC << EOF
1446int main(void) { return 0; }
1447EOF
1448for flag in $gcc_flags; do
a1d29d6c
PM
1449 # Use the positive sense of the flag when testing for -Wno-wombat
1450 # support (gcc will happily accept the -Wno- form of unknown
1451 # warning options).
1452 optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1453 if compile_prog "-Werror $optflag" "" ; then
8d05095c
PB
1454 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1455 fi
1456done
1457
63678e17
SN
1458if test "$stack_protector" != "no" ; then
1459 gcc_flags="-fstack-protector-strong -fstack-protector-all"
1460 for flag in $gcc_flags; do
590e5dd9
PM
1461 # We need to check both a compile and a link, since some compiler
1462 # setups fail only on a .c->.o compile and some only at link time
1463 if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
1464 compile_prog "-Werror $flag" ""; then
63678e17
SN
1465 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1466 LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,$flag"
1467 break
1468 fi
1469 done
37746c5e
MAL
1470fi
1471
cbdd1999
PB
1472# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1473# large functions that use global variables. The bug is in all releases of
1474# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1475# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1476cat > $TMPC << EOF
1477#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1478int main(void) { return 0; }
1479#else
1480#error No bug in this compiler.
1481#endif
1482EOF
1483if compile_prog "-Werror -fno-gcse" "" ; then
1484 TRANSLATE_OPT_CFLAGS=-fno-gcse
1485fi
1486
40d6444e 1487if test "$static" = "yes" ; then
aa0d1f44
PB
1488 if test "$modules" = "yes" ; then
1489 error_exit "static and modules are mutually incompatible"
1490 fi
40d6444e 1491 if test "$pie" = "yes" ; then
76ad07a4 1492 error_exit "static and pie are mutually incompatible"
40d6444e
AK
1493 else
1494 pie="no"
1495 fi
1496fi
1497
1498if test "$pie" = ""; then
1499 case "$cpu-$targetos" in
c72b26ec 1500 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
40d6444e
AK
1501 ;;
1502 *)
1503 pie="no"
1504 ;;
1505 esac
1506fi
1507
1508if test "$pie" != "no" ; then
1509 cat > $TMPC << EOF
21d4a791
AK
1510
1511#ifdef __linux__
1512# define THREAD __thread
1513#else
1514# define THREAD
1515#endif
1516
1517static THREAD int tls_var;
1518
1519int main(void) { return tls_var; }
1520
40d6444e
AK
1521EOF
1522 if compile_prog "-fPIE -DPIE" "-pie"; then
1523 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1524 LDFLAGS="-pie $LDFLAGS"
1525 pie="yes"
1526 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1527 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1528 fi
1529 else
1530 if test "$pie" = "yes"; then
76ad07a4 1531 error_exit "PIE not available due to missing toolchain support"
40d6444e
AK
1532 else
1533 echo "Disabling PIE due to missing toolchain support"
1534 pie="no"
1535 fi
1536 fi
46eef33b
BS
1537
1538 if compile_prog "-fno-pie" "-nopie"; then
1539 CFLAGS_NOPIE="-fno-pie"
1540 LDFLAGS_NOPIE="-nopie"
1541 fi
40d6444e
AK
1542fi
1543
66518bf6
DS
1544# check for broken gcc and libtool in RHEL5
1545if test -n "$libtool" -a "$pie" != "no" ; then
1546 cat > $TMPC <<EOF
1547
1548void *f(unsigned char *buf, int len);
1549void *g(unsigned char *buf, int len);
1550
1551void *
1552f(unsigned char *buf, int len)
1553{
1554 return (void*)0L;
1555}
1556
1557void *
1558g(unsigned char *buf, int len)
1559{
1560 return f(buf, len);
1561}
1562
1563EOF
1564 if ! libtool_prog; then
1565 echo "Disabling libtool due to broken toolchain support"
1566 libtool=
1567 fi
1568fi
1569
09dada40
PB
1570##########################################
1571# __sync_fetch_and_and requires at least -march=i486. Many toolchains
1572# use i686 as default anyway, but for those that don't, an explicit
1573# specification is necessary
1574
1575if test "$cpu" = "i386"; then
1576 cat > $TMPC << EOF
1577static int sfaa(int *ptr)
1578{
1579 return __sync_fetch_and_and(ptr, 0);
1580}
1581
1582int main(void)
1583{
1584 int val = 42;
1405b629 1585 val = __sync_val_compare_and_swap(&val, 0, 1);
09dada40
PB
1586 sfaa(&val);
1587 return val;
1588}
1589EOF
1590 if ! compile_prog "" "" ; then
1591 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1592 fi
1593fi
1594
1595#########################################
ec530c81 1596# Solaris specific configure tool chain decisions
09dada40 1597
ec530c81 1598if test "$solaris" = "yes" ; then
6792aa11
LM
1599 if has $install; then
1600 :
1601 else
76ad07a4
PM
1602 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1603 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1604 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
ec530c81 1605 fi
6792aa11 1606 if test "`path_of $install`" = "/usr/sbin/install" ; then
76ad07a4
PM
1607 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1608 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1609 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
ec530c81 1610 fi
6792aa11
LM
1611 if has ar; then
1612 :
1613 else
ec530c81 1614 if test -f /usr/ccs/bin/ar ; then
76ad07a4
PM
1615 error_exit "No path includes ar" \
1616 "Add /usr/ccs/bin to your path and rerun configure"
ec530c81 1617 fi
76ad07a4 1618 error_exit "No path includes ar"
ec530c81 1619 fi
5fafdf24 1620fi
ec530c81 1621
afb63ebd 1622if test -z "${target_list+xxx}" ; then
121afa9e
AL
1623 target_list="$default_target_list"
1624else
1625 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1626fi
25b48338
PM
1627
1628# Check that we recognised the target name; this allows a more
1629# friendly error message than if we let it fall through.
1630for target in $target_list; do
1631 case " $default_target_list " in
1632 *" $target "*)
1633 ;;
1634 *)
1635 error_exit "Unknown target name '$target'"
1636 ;;
1637 esac
1638done
1639
f55fe278
PB
1640# see if system emulation was really requested
1641case " $target_list " in
1642 *"-softmmu "*) softmmu=yes
1643 ;;
1644 *) softmmu=no
1645 ;;
1646esac
5327cf48 1647
249247c9
JQ
1648feature_not_found() {
1649 feature=$1
21684af0 1650 remedy=$2
249247c9 1651
76ad07a4 1652 error_exit "User requested feature $feature" \
21684af0
SS
1653 "configure was not able to find it." \
1654 "$remedy"
249247c9
JQ
1655}
1656
7d13299d
FB
1657# ---
1658# big/little endian test
1659cat > $TMPC << EOF
61cc919f
MF
1660short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1661short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1662extern int foo(short *, short *);
1663int main(int argc, char *argv[]) {
1664 return foo(big_endian, little_endian);
7d13299d
FB
1665}
1666EOF
1667
61cc919f
MF
1668if compile_object ; then
1669 if grep -q BiGeNdIaN $TMPO ; then
1670 bigendian="yes"
1671 elif grep -q LiTtLeEnDiAn $TMPO ; then
1672 bigendian="no"
1673 else
1674 echo big/little test failed
21d89f84 1675 fi
61cc919f
MF
1676else
1677 echo big/little test failed
7d13299d
FB
1678fi
1679
779ab5e3
SW
1680##########################################
1681# pkg-config probe
1682
1683if ! has "$pkg_config_exe"; then
76ad07a4 1684 error_exit "pkg-config binary '$pkg_config_exe' not found"
779ab5e3
SW
1685fi
1686
b0a47e79
JQ
1687##########################################
1688# NPTL probe
1689
24cb36a6 1690if test "$linux_user" = "yes"; then
b0a47e79 1691 cat > $TMPC <<EOF
bd0c5661 1692#include <sched.h>
30813cea 1693#include <linux/futex.h>
182eacc0 1694int main(void) {
bd0c5661
PB
1695#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1696#error bork
1697#endif
182eacc0 1698 return 0;
bd0c5661
PB
1699}
1700EOF
24cb36a6 1701 if ! compile_object ; then
21684af0 1702 feature_not_found "nptl" "Install glibc and linux kernel headers."
b0a47e79 1703 fi
bd0c5661
PB
1704fi
1705
ac62922e
AZ
1706##########################################
1707# zlib check
1708
1ece9905
AL
1709if test "$zlib" != "no" ; then
1710 cat > $TMPC << EOF
ac62922e
AZ
1711#include <zlib.h>
1712int main(void) { zlibVersion(); return 0; }
1713EOF
1ece9905
AL
1714 if compile_prog "" "-lz" ; then
1715 :
1716 else
76ad07a4
PM
1717 error_exit "zlib check failed" \
1718 "Make sure to have the zlib libs and headers installed."
1ece9905 1719 fi
ac62922e 1720fi
eb0ecd5a 1721LIBS="$LIBS -lz"
ac62922e 1722
607dacd0
QN
1723##########################################
1724# lzo check
1725
1726if test "$lzo" != "no" ; then
1727 cat > $TMPC << EOF
1728#include <lzo/lzo1x.h>
1729int main(void) { lzo_version(); return 0; }
1730EOF
1731 if compile_prog "" "-llzo2" ; then
1732 :
1733 else
1734 error_exit "lzo check failed" \
1735 "Make sure to have the lzo libs and headers installed."
1736 fi
1737
1738 libs_softmmu="$libs_softmmu -llzo2"
1739fi
1740
1741##########################################
1742# snappy check
1743
1744if test "$snappy" != "no" ; then
1745 cat > $TMPC << EOF
1746#include <snappy-c.h>
1747int main(void) { snappy_max_compressed_length(4096); return 0; }
1748EOF
1749 if compile_prog "" "-lsnappy" ; then
1750 :
1751 else
1752 error_exit "snappy check failed" \
1753 "Make sure to have the snappy libs and headers installed."
1754 fi
1755
1756 libs_softmmu="$libs_softmmu -lsnappy"
1757fi
1758
f794573e
EO
1759##########################################
1760# libseccomp check
1761
1762if test "$seccomp" != "no" ; then
65d5d3f9 1763 if $pkg_config --atleast-version=2.1.0 libseccomp; then
b4451996 1764 libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
372e47e9 1765 QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
f794573e
EO
1766 seccomp="yes"
1767 else
f794573e 1768 if test "$seccomp" = "yes"; then
21684af0 1769 feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
f794573e 1770 fi
e84d5956 1771 seccomp="no"
f794573e
EO
1772 fi
1773fi
e37630ca
AL
1774##########################################
1775# xen probe
1776
fc321b4b 1777if test "$xen" != "no" ; then
b2266bee 1778 xen_libs="-lxenstore -lxenctrl -lxenguest"
d5b93ddf 1779
50ced5b3
SW
1780 # First we test whether Xen headers and libraries are available.
1781 # If no, we are done and there is no Xen support.
1782 # If yes, more tests are run to detect the Xen version.
1783
1784 # Xen (any)
b2266bee 1785 cat > $TMPC <<EOF
e37630ca 1786#include <xenctrl.h>
50ced5b3
SW
1787int main(void) {
1788 return 0;
1789}
1790EOF
1791 if ! compile_prog "" "$xen_libs" ; then
1792 # Xen not found
1793 if test "$xen" = "yes" ; then
21684af0 1794 feature_not_found "xen" "Install xen devel"
50ced5b3
SW
1795 fi
1796 xen=no
1797
1798 # Xen unstable
69deef08
PM
1799 elif
1800 cat > $TMPC <<EOF &&
50ced5b3 1801#include <xenctrl.h>
e108a3c1 1802#include <xenstore.h>
d5b93ddf
AP
1803#include <stdint.h>
1804#include <xen/hvm/hvm_info_table.h>
1805#if !defined(HVM_MAX_VCPUS)
1806# error HVM_MAX_VCPUS not defined
1807#endif
8688e065
SS
1808int main(void) {
1809 xc_interface *xc;
1810 xs_daemon_open();
1811 xc = xc_interface_open(0, 0, 0);
1812 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1813 xc_gnttab_open(NULL, 0);
1814 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1815 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1816 return 0;
1817}
1818EOF
1819 compile_prog "" "$xen_libs"
69deef08 1820 then
8688e065
SS
1821 xen_ctrl_version=420
1822 xen=yes
1823
69deef08
PM
1824 elif
1825 cat > $TMPC <<EOF &&
8688e065
SS
1826#include <xenctrl.h>
1827#include <xs.h>
1828#include <stdint.h>
1829#include <xen/hvm/hvm_info_table.h>
1830#if !defined(HVM_MAX_VCPUS)
1831# error HVM_MAX_VCPUS not defined
1832#endif
d5b93ddf 1833int main(void) {
d5b93ddf 1834 xs_daemon_open();
9b4c0b56 1835 xc_interface_open(0, 0, 0);
d5b93ddf
AP
1836 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1837 xc_gnttab_open(NULL, 0);
b87de24e 1838 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
d5b93ddf
AP
1839 return 0;
1840}
e37630ca 1841EOF
50ced5b3 1842 compile_prog "" "$xen_libs"
69deef08 1843 then
d5b93ddf 1844 xen_ctrl_version=410
fc321b4b 1845 xen=yes
d5b93ddf
AP
1846
1847 # Xen 4.0.0
69deef08
PM
1848 elif
1849 cat > $TMPC <<EOF &&
d5b93ddf
AP
1850#include <xenctrl.h>
1851#include <xs.h>
1852#include <stdint.h>
1853#include <xen/hvm/hvm_info_table.h>
1854#if !defined(HVM_MAX_VCPUS)
1855# error HVM_MAX_VCPUS not defined
1856#endif
1857int main(void) {
b87de24e
AP
1858 struct xen_add_to_physmap xatp = {
1859 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1860 };
d5b93ddf
AP
1861 xs_daemon_open();
1862 xc_interface_open();
1863 xc_gnttab_open();
1864 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
b87de24e 1865 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
d5b93ddf
AP
1866 return 0;
1867}
1868EOF
1869 compile_prog "" "$xen_libs"
69deef08 1870 then
d5b93ddf
AP
1871 xen_ctrl_version=400
1872 xen=yes
1873
b87de24e 1874 # Xen 3.4.0
69deef08
PM
1875 elif
1876 cat > $TMPC <<EOF &&
b87de24e
AP
1877#include <xenctrl.h>
1878#include <xs.h>
1879int main(void) {
1880 struct xen_add_to_physmap xatp = {
1881 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1882 };
1883 xs_daemon_open();
1884 xc_interface_open();
1885 xc_gnttab_open();
1886 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1887 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1888 return 0;
1889}
1890EOF
1891 compile_prog "" "$xen_libs"
69deef08 1892 then
b87de24e
AP
1893 xen_ctrl_version=340
1894 xen=yes
1895
1896 # Xen 3.3.0
69deef08
PM
1897 elif
1898 cat > $TMPC <<EOF &&
d5b93ddf
AP
1899#include <xenctrl.h>
1900#include <xs.h>
1901int main(void) {
1902 xs_daemon_open();
1903 xc_interface_open();
1904 xc_gnttab_open();
1905 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1906 return 0;
1907}
1908EOF
1909 compile_prog "" "$xen_libs"
69deef08 1910 then
d5b93ddf
AP
1911 xen_ctrl_version=330
1912 xen=yes
1913
50ced5b3 1914 # Xen version unsupported
b2266bee 1915 else
fc321b4b 1916 if test "$xen" = "yes" ; then
21684af0 1917 feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
fc321b4b
JQ
1918 fi
1919 xen=no
b2266bee 1920 fi
d5b93ddf
AP
1921
1922 if test "$xen" = yes; then
1923 libs_softmmu="$xen_libs $libs_softmmu"
1924 fi
e37630ca
AL
1925fi
1926
eb6fda0f
AP
1927if test "$xen_pci_passthrough" != "no"; then
1928 if test "$xen" = "yes" && test "$linux" = "yes" &&
1929 test "$xen_ctrl_version" -ge 340; then
1930 xen_pci_passthrough=yes
1931 else
1932 if test "$xen_pci_passthrough" = "yes"; then
eb6fda0f 1933 if test "$xen_ctrl_version" -lt 340; then
76ad07a4
PM
1934 error_exit "User requested feature Xen PCI Passthrough" \
1935 "This feature does not work with Xen 3.3"
eb6fda0f 1936 fi
76ad07a4
PM
1937 error_exit "User requested feature Xen PCI Passthrough" \
1938 " but this feature requires /sys from Linux"
eb6fda0f
AP
1939 fi
1940 xen_pci_passthrough=no
1941 fi
1942fi
1943
44dc0ca3
AL
1944##########################################
1945# libtool probe
1946
3f534581 1947if ! has $libtool; then
44dc0ca3 1948 libtool=
44dc0ca3
AL
1949fi
1950
8e515b12
PM
1951# MacOSX ships with a libtool which isn't the GNU one; weed this
1952# out by checking whether libtool supports the --version switch
1953if test -n "$libtool"; then
1954 if ! "$libtool" --version >/dev/null 2>&1; then
1955 libtool=
1956 fi
1957fi
1958
dfffc653
JQ
1959##########################################
1960# Sparse probe
1961if test "$sparse" != "no" ; then
0dba6195 1962 if has cgcc; then
dfffc653
JQ
1963 sparse=yes
1964 else
1965 if test "$sparse" = "yes" ; then
21684af0 1966 feature_not_found "sparse" "Install sparse binary"
dfffc653
JQ
1967 fi
1968 sparse=no
1969 fi
1970fi
1971
a4ccabcf
AL
1972##########################################
1973# GTK probe
1974
9e04c683
SW
1975if test "$gtkabi" = ""; then
1976 # The GTK ABI was not specified explicitly, so try whether 2.0 is available.
1977 # Use 3.0 as a fallback if that is available.
1978 if $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
1979 gtkabi=2.0
1980 elif $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
1981 gtkabi=3.0
1982 else
1983 gtkabi=2.0
1984 fi
1985fi
1986
a4ccabcf 1987if test "$gtk" != "no"; then
528de90a
DB
1988 gtkpackage="gtk+-$gtkabi"
1989 if test "$gtkabi" = "3.0" ; then
1990 gtkversion="3.0.0"
bbbf9bfb
SW
1991 else
1992 gtkversion="2.18.0"
1993 fi
1994 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
1995 gtk_cflags=`$pkg_config --cflags $gtkpackage`
1996 gtk_libs=`$pkg_config --libs $gtkpackage`
1997 libs_softmmu="$gtk_libs $libs_softmmu"
1998 gtk="yes"
1999 elif test "$gtk" = "yes"; then
9e04c683 2000 feature_not_found "gtk" "Install gtk2 or gtk3 devel"
bbbf9bfb
SW
2001 else
2002 gtk="no"
2003 fi
2004fi
2005
2006##########################################
2007# VTE probe
2008
2009if test "$vte" != "no"; then
2010 if test "$gtkabi" = "3.0"; then
528de90a
DB
2011 vtepackage="vte-2.90"
2012 vteversion="0.32.0"
2013 else
528de90a
DB
2014 vtepackage="vte"
2015 vteversion="0.24.0"
2016 fi
bbbf9bfb
SW
2017 if $pkg_config --exists "$vtepackage >= $vteversion"; then
2018 vte_cflags=`$pkg_config --cflags $vtepackage`
2019 vte_libs=`$pkg_config --libs $vtepackage`
2020 libs_softmmu="$vte_libs $libs_softmmu"
2021 vte="yes"
2022 elif test "$vte" = "yes"; then
9e04c683
SW
2023 if test "$gtkabi" = "3.0"; then
2024 feature_not_found "vte" "Install libvte-2.90 devel"
2025 else
2026 feature_not_found "vte" "Install libvte devel"
2027 fi
0d185e63 2028 else
bbbf9bfb 2029 vte="no"
a4ccabcf
AL
2030 fi
2031fi
2032
11d9f695
FB
2033##########################################
2034# SDL probe
2035
3ec87ffe
PB
2036# Look for sdl configuration program (pkg-config or sdl-config). Try
2037# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
47c03744
DA
2038
2039if test $sdlabi = "2.0"; then
2040 sdl_config=$sdl2_config
2041 sdlname=sdl2
2042 sdlconfigname=sdl2_config
2043else
2044 sdlname=sdl
2045 sdlconfigname=sdl_config
2046fi
2047
2048if test "`basename $sdl_config`" != $sdlconfigname && ! has ${sdl_config}; then
2049 sdl_config=$sdlconfigname
3ec87ffe
PB
2050fi
2051
47c03744
DA
2052if $pkg_config $sdlname --exists; then
2053 sdlconfig="$pkg_config $sdlname"
9316f803 2054 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
3ec87ffe
PB
2055elif has ${sdl_config}; then
2056 sdlconfig="$sdl_config"
9316f803 2057 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
a0dfd8a4
LM
2058else
2059 if test "$sdl" = "yes" ; then
21684af0 2060 feature_not_found "sdl" "Install SDL devel"
a0dfd8a4
LM
2061 fi
2062 sdl=no
9316f803 2063fi
29e5bada 2064if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
3ec87ffe
PB
2065 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
2066fi
11d9f695 2067
9316f803 2068sdl_too_old=no
c4198157 2069if test "$sdl" != "no" ; then
ac119f9d 2070 cat > $TMPC << EOF
11d9f695
FB
2071#include <SDL.h>
2072#undef main /* We don't want SDL to override our main() */
2073int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
2074EOF
9316f803 2075 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
74f42e18
T
2076 if test "$static" = "yes" ; then
2077 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
2078 else
2079 sdl_libs=`$sdlconfig --libs 2> /dev/null`
2080 fi
52166aa0 2081 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
ac119f9d
JQ
2082 if test "$_sdlversion" -lt 121 ; then
2083 sdl_too_old=yes
2084 else
2085 if test "$cocoa" = "no" ; then
2086 sdl=yes
2087 fi
2088 fi
cd01b4a3 2089
67c274d3 2090 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
ac119f9d 2091 if test "$sdl" = "yes" -a "$static" = "yes" ; then
67c274d3 2092 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
f8aa6c7b
SW
2093 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
2094 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
ac119f9d 2095 fi
52166aa0 2096 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
ac119f9d
JQ
2097 :
2098 else
2099 sdl=no
2100 fi
2101 fi # static link
c4198157
JQ
2102 else # sdl not found
2103 if test "$sdl" = "yes" ; then
21684af0 2104 feature_not_found "sdl" "Install SDL devel"
c4198157
JQ
2105 fi
2106 sdl=no
ac119f9d 2107 fi # sdl compile test
a68551bc 2108fi
11d9f695 2109
5368a422 2110if test "$sdl" = "yes" ; then
ac119f9d 2111 cat > $TMPC <<EOF
5368a422
AL
2112#include <SDL.h>
2113#if defined(SDL_VIDEO_DRIVER_X11)
2114#include <X11/XKBlib.h>
2115#else
2116#error No x11 support
2117#endif
2118int main(void) { return 0; }
2119EOF
52166aa0 2120 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
ac119f9d
JQ
2121 sdl_libs="$sdl_libs -lX11"
2122 fi
0705667e 2123 libs_softmmu="$sdl_libs $libs_softmmu"
5368a422
AL
2124fi
2125
2da776db
MH
2126##########################################
2127# RDMA needs OpenFabrics libraries
2128if test "$rdma" != "no" ; then
2129 cat > $TMPC <<EOF
2130#include <rdma/rdma_cma.h>
2131int main(void) { return 0; }
2132EOF
2133 rdma_libs="-lrdmacm -libverbs"
2134 if compile_prog "" "$rdma_libs" ; then
2135 rdma="yes"
2136 libs_softmmu="$libs_softmmu $rdma_libs"
2137 else
2138 if test "$rdma" = "yes" ; then
2139 error_exit \
2140 " OpenFabrics librdmacm/libibverbs not present." \
2141 " Your options:" \
2142 " (1) Fast: Install infiniband packages from your distro." \
2143 " (2) Cleanest: Install libraries from www.openfabrics.org" \
2144 " (3) Also: Install softiwarp if you don't have RDMA hardware"
2145 fi
2146 rdma="no"
2147 fi
2148fi
2149
8d5d2d4c 2150##########################################
7536ee4b
TH
2151# VNC TLS/WS detection
2152if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
1be10ad2 2153 cat > $TMPC <<EOF
ae6b5e5a
AL
2154#include <gnutls/gnutls.h>
2155int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
2156EOF
a8bd70ad
PB
2157 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2158 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
1be10ad2 2159 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
7536ee4b
TH
2160 if test "$vnc_tls" != "no" ; then
2161 vnc_tls=yes
2162 fi
2163 if test "$vnc_ws" != "no" ; then
2164 vnc_ws=yes
2165 fi
1be10ad2 2166 libs_softmmu="$vnc_tls_libs $libs_softmmu"
ca273d58 2167 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
1be10ad2
JQ
2168 else
2169 if test "$vnc_tls" = "yes" ; then
21684af0 2170 feature_not_found "vnc-tls" "Install gnutls devel"
ae6b5e5a 2171 fi
7536ee4b 2172 if test "$vnc_ws" = "yes" ; then
21684af0 2173 feature_not_found "vnc-ws" "Install gnutls devel"
7536ee4b 2174 fi
1be10ad2 2175 vnc_tls=no
7536ee4b 2176 vnc_ws=no
1be10ad2 2177 fi
8d5d2d4c
TS
2178fi
2179
95c6bff3
BC
2180##########################################
2181# Quorum probe (check for gnutls)
2182if test "$quorum" != "no" ; then
2183cat > $TMPC <<EOF
2184#include <gnutls/gnutls.h>
2185#include <gnutls/crypto.h>
2186int main(void) {char data[4096], digest[32];
2187gnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest);
2188return 0;
2189}
2190EOF
2191quorum_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2192quorum_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
2193if compile_prog "$quorum_tls_cflags" "$quorum_tls_libs" ; then
2194 qcow_tls=yes
2195 libs_softmmu="$quorum_tls_libs $libs_softmmu"
2196 libs_tools="$quorum_tls_libs $libs_softmmu"
2197 QEMU_CFLAGS="$QEMU_CFLAGS $quorum_tls_cflags"
2198else
2199 echo "gnutls > 2.10.0 required to compile Quorum"
2200 exit 1
2201fi
2202fi
2203
2f9606b3
AL
2204##########################################
2205# VNC SASL detection
821601ea 2206if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
ea784e3b 2207 cat > $TMPC <<EOF
2f9606b3
AL
2208#include <sasl/sasl.h>
2209#include <stdio.h>
2210int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
2211EOF
ea784e3b
JQ
2212 # Assuming Cyrus-SASL installed in /usr prefix
2213 vnc_sasl_cflags=""
2214 vnc_sasl_libs="-lsasl2"
2215 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
2216 vnc_sasl=yes
2217 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
ca273d58 2218 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
ea784e3b
JQ
2219 else
2220 if test "$vnc_sasl" = "yes" ; then
21684af0 2221 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
2f9606b3 2222 fi
ea784e3b
JQ
2223 vnc_sasl=no
2224 fi
2f9606b3
AL
2225fi
2226
2f6f5c7a
CC
2227##########################################
2228# VNC JPEG detection
821601ea 2229if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
2f6f5c7a
CC
2230cat > $TMPC <<EOF
2231#include <stdio.h>
2232#include <jpeglib.h>
2233int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2234EOF
2235 vnc_jpeg_cflags=""
2236 vnc_jpeg_libs="-ljpeg"
2237 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2238 vnc_jpeg=yes
2239 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
ca273d58 2240 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
2f6f5c7a
CC
2241 else
2242 if test "$vnc_jpeg" = "yes" ; then
21684af0 2243 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
2f6f5c7a
CC
2244 fi
2245 vnc_jpeg=no
2246 fi
2247fi
2248
efe556ad
CC
2249##########################################
2250# VNC PNG detection
821601ea 2251if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
efe556ad
CC
2252cat > $TMPC <<EOF
2253//#include <stdio.h>
2254#include <png.h>
832ce9c2 2255#include <stddef.h>
efe556ad
CC
2256int main(void) {
2257 png_structp png_ptr;
2258 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
7edc3fed 2259 return png_ptr != 0;
efe556ad
CC
2260}
2261EOF
65d5d3f9 2262 if $pkg_config libpng --exists; then
ca871ec8
SW
2263 vnc_png_cflags=`$pkg_config libpng --cflags`
2264 vnc_png_libs=`$pkg_config libpng --libs`
9af8025e 2265 else
efe556ad
CC
2266 vnc_png_cflags=""
2267 vnc_png_libs="-lpng"
9af8025e 2268 fi
efe556ad
CC
2269 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2270 vnc_png=yes
2271 libs_softmmu="$vnc_png_libs $libs_softmmu"
9af8025e 2272 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
efe556ad
CC
2273 else
2274 if test "$vnc_png" = "yes" ; then
21684af0 2275 feature_not_found "vnc-png" "Install libpng devel"
efe556ad
CC
2276 fi
2277 vnc_png=no
2278 fi
2279fi
2280
76655d6d
AL
2281##########################################
2282# fnmatch() probe, used for ACL routines
2283fnmatch="no"
2284cat > $TMPC << EOF
2285#include <fnmatch.h>
2286int main(void)
2287{
2288 fnmatch("foo", "foo", 0);
2289 return 0;
2290}
2291EOF
52166aa0 2292if compile_prog "" "" ; then
76655d6d
AL
2293 fnmatch="yes"
2294fi
2295
ee682d27
SW
2296##########################################
2297# uuid_generate() probe, used for vdi block driver
2d16c8e9
PM
2298# Note that on some systems (notably MacOSX) no extra library
2299# need be linked to get the uuid functions.
ee682d27
SW
2300if test "$uuid" != "no" ; then
2301 uuid_libs="-luuid"
2302 cat > $TMPC << EOF
2303#include <uuid/uuid.h>
2304int main(void)
2305{
2306 uuid_t my_uuid;
2307 uuid_generate(my_uuid);
2308 return 0;
2309}
2310EOF
2d16c8e9
PM
2311 if compile_prog "" "" ; then
2312 uuid="yes"
2313 elif compile_prog "" "$uuid_libs" ; then
ee682d27
SW
2314 uuid="yes"
2315 libs_softmmu="$uuid_libs $libs_softmmu"
2316 libs_tools="$uuid_libs $libs_tools"
2317 else
2318 if test "$uuid" = "yes" ; then
21684af0 2319 feature_not_found "uuid" "Install libuuid devel"
ee682d27
SW
2320 fi
2321 uuid=no
2322 fi
2323fi
2324
4f18b782
JC
2325if test "$vhdx" = "yes" ; then
2326 if test "$uuid" = "no" ; then
2327 error_exit "uuid required for VHDX support"
2328 fi
2329elif test "$vhdx" != "no" ; then
2330 if test "$uuid" = "yes" ; then
2331 vhdx=yes
2332 else
2333 vhdx=no
2334 fi
2335fi
2336
dce512de
CH
2337##########################################
2338# xfsctl() probe, used for raw-posix
2339if test "$xfs" != "no" ; then
2340 cat > $TMPC << EOF
ffc41d10 2341#include <stddef.h> /* NULL */
dce512de
CH
2342#include <xfs/xfs.h>
2343int main(void)
2344{
2345 xfsctl(NULL, 0, 0, NULL);
2346 return 0;
2347}
2348EOF
2349 if compile_prog "" "" ; then
2350 xfs="yes"
2351 else
2352 if test "$xfs" = "yes" ; then
21684af0 2353 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
dce512de
CH
2354 fi
2355 xfs=no
2356 fi
2357fi
2358
8a16d273
TS
2359##########################################
2360# vde libraries probe
dfb278bd 2361if test "$vde" != "no" ; then
4baae0ac 2362 vde_libs="-lvdeplug"
8a16d273
TS
2363 cat > $TMPC << EOF
2364#include <libvdeplug.h>
4a7f0e06
PB
2365int main(void)
2366{
2367 struct vde_open_args a = {0, 0, 0};
fea08e08
PM
2368 char s[] = "";
2369 vde_open(s, s, &a);
4a7f0e06
PB
2370 return 0;
2371}
8a16d273 2372EOF
52166aa0 2373 if compile_prog "" "$vde_libs" ; then
4baae0ac 2374 vde=yes
8e02e54c
JQ
2375 libs_softmmu="$vde_libs $libs_softmmu"
2376 libs_tools="$vde_libs $libs_tools"
dfb278bd
JQ
2377 else
2378 if test "$vde" = "yes" ; then
21684af0 2379 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
dfb278bd
JQ
2380 fi
2381 vde=no
4baae0ac 2382 fi
8a16d273
TS
2383fi
2384
58952137 2385##########################################
0a985b37
VM
2386# netmap support probe
2387# Apart from looking for netmap headers, we make sure that the host API version
2388# supports the netmap backend (>=11). The upper bound (15) is meant to simulate
2389# a minor/major version number. Minor new features will be marked with values up
2390# to 15, and if something happens that requires a change to the backend we will
2391# move above 15, submit the backend fixes and modify this two bounds.
58952137
VM
2392if test "$netmap" != "no" ; then
2393 cat > $TMPC << EOF
2394#include <inttypes.h>
2395#include <net/if.h>
2396#include <net/netmap.h>
2397#include <net/netmap_user.h>
0a985b37
VM
2398#if (NETMAP_API < 11) || (NETMAP_API > 15)
2399#error
2400#endif
58952137
VM
2401int main(void) { return 0; }
2402EOF
2403 if compile_prog "" "" ; then
2404 netmap=yes
2405 else
2406 if test "$netmap" = "yes" ; then
2407 feature_not_found "netmap"
2408 fi
2409 netmap=no
2410 fi
2411fi
2412
47e98658
CB
2413##########################################
2414# libcap-ng library probe
2415if test "$cap_ng" != "no" ; then
2416 cap_libs="-lcap-ng"
2417 cat > $TMPC << EOF
2418#include <cap-ng.h>
2419int main(void)
2420{
2421 capng_capability_to_name(CAPNG_EFFECTIVE);
2422 return 0;
2423}
2424EOF
2425 if compile_prog "" "$cap_libs" ; then
2426 cap_ng=yes
2427 libs_tools="$cap_libs $libs_tools"
2428 else
2429 if test "$cap_ng" = "yes" ; then
21684af0 2430 feature_not_found "cap_ng" "Install libcap-ng devel"
47e98658
CB
2431 fi
2432 cap_ng=no
2433 fi
2434fi
2435
8f28f3fb 2436##########################################
c2de5c91 2437# Sound support libraries probe
8f28f3fb 2438
c2de5c91 2439audio_drv_probe()
2440{
2441 drv=$1
2442 hdr=$2
2443 lib=$3
2444 exp=$4
2445 cfl=$5
2446 cat > $TMPC << EOF
2447#include <$hdr>
2448int main(void) { $exp }
8f28f3fb 2449EOF
52166aa0 2450 if compile_prog "$cfl" "$lib" ; then
c2de5c91 2451 :
2452 else
76ad07a4
PM
2453 error_exit "$drv check failed" \
2454 "Make sure to have the $drv libs and headers installed."
c2de5c91 2455 fi
2456}
2457
2fa7d3bf 2458audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
c2de5c91 2459for drv in $audio_drv_list; do
2460 case $drv in
2461 alsa)
2462 audio_drv_probe $drv alsa/asoundlib.h -lasound \
e35bcb0c 2463 "return snd_pcm_close((snd_pcm_t *)0);"
a4bf6780 2464 libs_softmmu="-lasound $libs_softmmu"
c2de5c91 2465 ;;
2466
2467 fmod)
2468 if test -z $fmod_lib || test -z $fmod_inc; then
76ad07a4
PM
2469 error_exit "You must specify path to FMOD library and headers" \
2470 "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
c2de5c91 2471 fi
2472 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
a4bf6780 2473 libs_softmmu="$fmod_lib $libs_softmmu"
c2de5c91 2474 ;;
2475
2476 esd)
2477 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
a4bf6780 2478 libs_softmmu="-lesd $libs_softmmu"
67f86e8e 2479 audio_pt_int="yes"
c2de5c91 2480 ;;
b8e59f18 2481
2482 pa)
a394aed2
MAL
2483 audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2484 "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2485 libs_softmmu="-lpulse $libs_softmmu"
67f86e8e 2486 audio_pt_int="yes"
b8e59f18 2487 ;;
2488
997e690a
JQ
2489 coreaudio)
2490 libs_softmmu="-framework CoreAudio $libs_softmmu"
2491 ;;
2492
a4bf6780
JQ
2493 dsound)
2494 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
d5631638 2495 audio_win_int="yes"
a4bf6780
JQ
2496 ;;
2497
2498 oss)
2499 libs_softmmu="$oss_lib $libs_softmmu"
2500 ;;
2501
2502 sdl|wav)
2f6a1ab0
BS
2503 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
2504 ;;
2505
d5631638 2506 winwave)
2507 libs_softmmu="-lwinmm $libs_softmmu"
2508 audio_win_int="yes"
2509 ;;
2510
e4c63a6a 2511 *)
1c9b2a52 2512 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
76ad07a4
PM
2513 error_exit "Unknown driver '$drv' selected" \
2514 "Possible drivers are: $audio_possible_drivers"
e4c63a6a 2515 }
2516 ;;
c2de5c91 2517 esac
2518done
8f28f3fb 2519
2e4d9fb1
AJ
2520##########################################
2521# BrlAPI probe
2522
4ffcedb6 2523if test "$brlapi" != "no" ; then
eb82284f
JQ
2524 brlapi_libs="-lbrlapi"
2525 cat > $TMPC << EOF
2e4d9fb1 2526#include <brlapi.h>
832ce9c2 2527#include <stddef.h>
2e4d9fb1
AJ
2528int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
2529EOF
52166aa0 2530 if compile_prog "" "$brlapi_libs" ; then
eb82284f 2531 brlapi=yes
264606b3 2532 libs_softmmu="$brlapi_libs $libs_softmmu"
4ffcedb6
JQ
2533 else
2534 if test "$brlapi" = "yes" ; then
21684af0 2535 feature_not_found "brlapi" "Install brlapi devel"
4ffcedb6
JQ
2536 fi
2537 brlapi=no
eb82284f
JQ
2538 fi
2539fi
2e4d9fb1 2540
4d3b6f6e
AZ
2541##########################################
2542# curses probe
a3605bf6
MT
2543if test "$curses" != "no" ; then
2544 if test "$mingw32" = "yes" ; then
e095e2f3 2545 curses_list="-lpdcurses"
a3605bf6 2546 else
cfeda5f4 2547 curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
a3605bf6 2548 fi
c584a6d0 2549 curses_found=no
4d3b6f6e
AZ
2550 cat > $TMPC << EOF
2551#include <curses.h>
ef9a2524
SW
2552int main(void) {
2553 const char *s = curses_version();
2554 resize_term(0, 0);
2555 return s != 0;
2556}
4d3b6f6e 2557EOF
ecbe251f 2558 IFS=:
4f78ef9a 2559 for curses_lib in $curses_list; do
ecbe251f 2560 unset IFS
4f78ef9a 2561 if compile_prog "" "$curses_lib" ; then
c584a6d0 2562 curses_found=yes
4f78ef9a
JQ
2563 libs_softmmu="$curses_lib $libs_softmmu"
2564 break
2565 fi
2566 done
ecbe251f 2567 unset IFS
c584a6d0
JQ
2568 if test "$curses_found" = "yes" ; then
2569 curses=yes
2570 else
2571 if test "$curses" = "yes" ; then
21684af0 2572 feature_not_found "curses" "Install ncurses devel"
c584a6d0
JQ
2573 fi
2574 curses=no
2575 fi
4f78ef9a 2576fi
4d3b6f6e 2577
769ce76d
AG
2578##########################################
2579# curl probe
788c8196 2580if test "$curl" != "no" ; then
65d5d3f9 2581 if $pkg_config libcurl --exists; then
a3605bf6
MT
2582 curlconfig="$pkg_config libcurl"
2583 else
2584 curlconfig=curl-config
2585 fi
769ce76d
AG
2586 cat > $TMPC << EOF
2587#include <curl/curl.h>
0b862ced 2588int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
769ce76d 2589EOF
4e2b0658
PB
2590 curl_cflags=`$curlconfig --cflags 2>/dev/null`
2591 curl_libs=`$curlconfig --libs 2>/dev/null`
b1d5a277 2592 if compile_prog "$curl_cflags" "$curl_libs" ; then
769ce76d 2593 curl=yes
788c8196
JQ
2594 else
2595 if test "$curl" = "yes" ; then
21684af0 2596 feature_not_found "curl" "Install libcurl devel"
788c8196
JQ
2597 fi
2598 curl=no
769ce76d
AG
2599 fi
2600fi # test "$curl"
2601
fb599c9a
AZ
2602##########################################
2603# bluez support probe
a20a6f46 2604if test "$bluez" != "no" ; then
e820e3f4
AZ
2605 cat > $TMPC << EOF
2606#include <bluetooth/bluetooth.h>
2607int main(void) { return bt_error(0); }
2608EOF
a8bd70ad
PB
2609 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2610 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
52166aa0 2611 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
a20a6f46 2612 bluez=yes
e482d56a 2613 libs_softmmu="$bluez_libs $libs_softmmu"
e820e3f4 2614 else
a20a6f46 2615 if test "$bluez" = "yes" ; then
21684af0 2616 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
a20a6f46 2617 fi
e820e3f4
AZ
2618 bluez="no"
2619 fi
fb599c9a
AZ
2620fi
2621
e18df141
AL
2622##########################################
2623# glib support probe
a52d28af
PB
2624
2625if test "$mingw32" = yes; then
2626 # g_poll is required in order to integrate with the glib main loop.
2627 glib_req_ver=2.20
2628else
2629 glib_req_ver=2.12
2630fi
aa0d1f44
PB
2631glib_modules=gthread-2.0
2632if test "$modules" = yes; then
2633 glib_modules="$glib_modules gmodule-2.0"
2634fi
e26110cf 2635
aa0d1f44 2636for i in $glib_modules; do
e26110cf
FZ
2637 if $pkg_config --atleast-version=$glib_req_ver $i; then
2638 glib_cflags=`$pkg_config --cflags $i`
2639 glib_libs=`$pkg_config --libs $i`
2640 CFLAGS="$glib_cflags $CFLAGS"
2641 LIBS="$glib_libs $LIBS"
2642 libs_qga="$glib_libs $libs_qga"
2643 else
2644 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
2645 fi
2646done
2647
2648##########################################
2649# SHA command probe for modules
2650if test "$modules" = yes; then
2651 shacmd_probe="sha1sum sha1 shasum"
2652 for c in $shacmd_probe; do
4fc00556 2653 if which $c >/dev/null 2>&1; then
e26110cf
FZ
2654 shacmd="$c"
2655 break
2656 fi
2657 done
2658 if test "$shacmd" = ""; then
2659 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
2660 fi
e18df141
AL
2661fi
2662
e2134eb9
GH
2663##########################################
2664# pixman support probe
2665
2666if test "$pixman" = ""; then
74880fe2
RS
2667 if test "$want_tools" = "no" -a "$softmmu" = "no"; then
2668 pixman="none"
2669 elif $pkg_config pixman-1 > /dev/null 2>&1; then
e2134eb9
GH
2670 pixman="system"
2671 else
2672 pixman="internal"
2673 fi
2674fi
74880fe2
RS
2675if test "$pixman" = "none"; then
2676 if test "$want_tools" != "no" -o "$softmmu" != "no"; then
76ad07a4
PM
2677 error_exit "pixman disabled but system emulation or tools build" \
2678 "enabled. You can turn off pixman only if you also" \
2679 "disable all system emulation targets and the tools" \
2680 "build with '--disable-tools --disable-system'."
74880fe2
RS
2681 fi
2682 pixman_cflags=
2683 pixman_libs=
2684elif test "$pixman" = "system"; then
ca871ec8
SW
2685 pixman_cflags=`$pkg_config --cflags pixman-1`
2686 pixman_libs=`$pkg_config --libs pixman-1`
e2134eb9
GH
2687else
2688 if test ! -d ${source_path}/pixman/pixman; then
76ad07a4
PM
2689 error_exit "pixman not present. Your options:" \
2690 " (1) Preferred: Install the pixman devel package (any recent" \
2691 " distro should have packages as Xorg needs pixman too)." \
2692 " (2) Fetch the pixman submodule, using:" \
2693 " git submodule update --init pixman"
e2134eb9 2694 fi
5ca9388a
GH
2695 mkdir -p pixman/pixman
2696 pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
2697 pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
e2134eb9 2698fi
e2134eb9 2699
17bff52b
MK
2700##########################################
2701# libcap probe
2702
2703if test "$cap" != "no" ; then
2704 cat > $TMPC <<EOF
2705#include <stdio.h>
2706#include <sys/capability.h>
cc939743 2707int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
17bff52b
MK
2708EOF
2709 if compile_prog "" "-lcap" ; then
2710 cap=yes
2711 else
2712 cap=no
2713 fi
2714fi
2715
414f0dab 2716##########################################
e5d355d1 2717# pthread probe
4b29ec41 2718PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
3c529d93 2719
4dd75c70 2720pthread=no
e5d355d1 2721cat > $TMPC << EOF
3c529d93 2722#include <pthread.h>
7a42bbe4
SW
2723static void *f(void *p) { return NULL; }
2724int main(void) {
2725 pthread_t thread;
2726 pthread_create(&thread, 0, f, 0);
2727 return 0;
2728}
414f0dab 2729EOF
bd00d539
AF
2730if compile_prog "" "" ; then
2731 pthread=yes
2732else
2733 for pthread_lib in $PTHREADLIBS_LIST; do
2734 if compile_prog "" "$pthread_lib" ; then
2735 pthread=yes
e3c56761
PP
2736 found=no
2737 for lib_entry in $LIBS; do
2738 if test "$lib_entry" = "$pthread_lib"; then
2739 found=yes
2740 break
2741 fi
2742 done
2743 if test "$found" = "no"; then
2744 LIBS="$pthread_lib $LIBS"
2745 fi
bd00d539
AF
2746 break
2747 fi
2748 done
2749fi
414f0dab 2750
4617e593 2751if test "$mingw32" != yes -a "$pthread" = no; then
76ad07a4
PM
2752 error_exit "pthread check failed" \
2753 "Make sure to have the pthread libs and headers installed."
e5d355d1
AL
2754fi
2755
5c312079
DDAG
2756# check for pthread_setname_np
2757pthread_setname_np=no
2758cat > $TMPC << EOF
2759#include <pthread.h>
2760
2761static void *f(void *p) { return NULL; }
2762int main(void)
2763{
2764 pthread_t thread;
2765 pthread_create(&thread, 0, f, 0);
2766 pthread_setname_np(thread, "QEMU");
2767 return 0;
2768}
2769EOF
2770if compile_prog "" "$pthread_lib" ; then
2771 pthread_setname_np=yes
2772fi
2773
f27aaf4b
CB
2774##########################################
2775# rbd probe
2776if test "$rbd" != "no" ; then
2777 cat > $TMPC <<EOF
2778#include <stdio.h>
ad32e9c0 2779#include <rbd/librbd.h>
f27aaf4b 2780int main(void) {
ad32e9c0
JD
2781 rados_t cluster;
2782 rados_create(&cluster, NULL);
f27aaf4b
CB
2783 return 0;
2784}
2785EOF
ad32e9c0
JD
2786 rbd_libs="-lrbd -lrados"
2787 if compile_prog "" "$rbd_libs" ; then
2788 rbd=yes
f27aaf4b
CB
2789 else
2790 if test "$rbd" = "yes" ; then
21684af0 2791 feature_not_found "rados block device" "Install librbd/ceph devel"
f27aaf4b
CB
2792 fi
2793 rbd=no
2794 fi
f27aaf4b
CB
2795fi
2796
0a12ec87
RJ
2797##########################################
2798# libssh2 probe
4fc16838 2799min_libssh2_version=1.2.8
0a12ec87 2800if test "$libssh2" != "no" ; then
65d5d3f9 2801 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
0a12ec87
RJ
2802 libssh2_cflags=`$pkg_config libssh2 --cflags`
2803 libssh2_libs=`$pkg_config libssh2 --libs`
0a12ec87 2804 libssh2=yes
0a12ec87
RJ
2805 else
2806 if test "$libssh2" = "yes" ; then
4fc16838 2807 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
0a12ec87
RJ
2808 fi
2809 libssh2=no
2810 fi
2811fi
2812
9a2d462e
RJ
2813##########################################
2814# libssh2_sftp_fsync probe
2815
2816if test "$libssh2" = "yes"; then
2817 cat > $TMPC <<EOF
2818#include <stdio.h>
2819#include <libssh2.h>
2820#include <libssh2_sftp.h>
2821int main(void) {
2822 LIBSSH2_SESSION *session;
2823 LIBSSH2_SFTP *sftp;
2824 LIBSSH2_SFTP_HANDLE *sftp_handle;
2825 session = libssh2_session_init ();
2826 sftp = libssh2_sftp_init (session);
2827 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
2828 libssh2_sftp_fsync (sftp_handle);
2829 return 0;
2830}
2831EOF
2832 # libssh2_cflags/libssh2_libs defined in previous test.
2833 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
2834 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
2835 fi
2836fi
2837
5c6c3a6c
CH
2838##########################################
2839# linux-aio probe
5c6c3a6c
CH
2840
2841if test "$linux_aio" != "no" ; then
2842 cat > $TMPC <<EOF
2843#include <libaio.h>
2844#include <sys/eventfd.h>
832ce9c2 2845#include <stddef.h>
5c6c3a6c
CH
2846int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2847EOF
2848 if compile_prog "" "-laio" ; then
2849 linux_aio=yes
5c6c3a6c
CH
2850 else
2851 if test "$linux_aio" = "yes" ; then
21684af0 2852 feature_not_found "linux AIO" "Install libaio devel"
5c6c3a6c 2853 fi
3cfcae3c 2854 linux_aio=no
5c6c3a6c
CH
2855 fi
2856fi
2857
3b8acc11
PB
2858##########################################
2859# TPM passthrough is only on x86 Linux
2860
2861if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
2862 tpm_passthrough=$tpm
2863else
2864 tpm_passthrough=no
2865fi
2866
583f6e7b
SH
2867##########################################
2868# adjust virtio-blk-data-plane based on linux-aio
2869
2870if test "$virtio_blk_data_plane" = "yes" -a \
2871 "$linux_aio" != "yes" ; then
76ad07a4 2872 error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
583f6e7b
SH
2873elif test -z "$virtio_blk_data_plane" ; then
2874 virtio_blk_data_plane=$linux_aio
2875fi
2876
758e8e38
VJ
2877##########################################
2878# attr probe
2879
2880if test "$attr" != "no" ; then
2881 cat > $TMPC <<EOF
2882#include <stdio.h>
2883#include <sys/types.h>
f2338fb4
PB
2884#ifdef CONFIG_LIBATTR
2885#include <attr/xattr.h>
2886#else
4f26f2b6 2887#include <sys/xattr.h>
f2338fb4 2888#endif
758e8e38
VJ
2889int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2890EOF
4f26f2b6
AK
2891 if compile_prog "" "" ; then
2892 attr=yes
2893 # Older distros have <attr/xattr.h>, and need -lattr:
f2338fb4 2894 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
758e8e38
VJ
2895 attr=yes
2896 LIBS="-lattr $LIBS"
4f26f2b6 2897 libattr=yes
758e8e38
VJ
2898 else
2899 if test "$attr" = "yes" ; then
21684af0 2900 feature_not_found "ATTR" "Install libc6 or libattr devel"
758e8e38
VJ
2901 fi
2902 attr=no
2903 fi
2904fi
2905
bf9298b9
AL
2906##########################################
2907# iovec probe
2908cat > $TMPC <<EOF
db34f0b3 2909#include <sys/types.h>
bf9298b9 2910#include <sys/uio.h>
db34f0b3 2911#include <unistd.h>
f91f9bee 2912int main(void) { return sizeof(struct iovec); }
bf9298b9
AL
2913EOF
2914iovec=no
52166aa0 2915if compile_prog "" "" ; then
bf9298b9
AL
2916 iovec=yes
2917fi
2918
ceb42de8
AL
2919##########################################
2920# preadv probe
2921cat > $TMPC <<EOF
2922#include <sys/types.h>
2923#include <sys/uio.h>
2924#include <unistd.h>
c075a723 2925int main(void) { return preadv(0, 0, 0, 0); }
ceb42de8
AL
2926EOF
2927preadv=no
52166aa0 2928if compile_prog "" "" ; then
ceb42de8
AL
2929 preadv=yes
2930fi
2931
f652e6af
AJ
2932##########################################
2933# fdt probe
e169e1e1
PM
2934# fdt support is mandatory for at least some target architectures,
2935# so insist on it if we're building those system emulators.
2936fdt_required=no
2937for target in $target_list; do
2938 case $target in
6a49fa95 2939 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
e169e1e1
PM
2940 fdt_required=yes
2941 ;;
2942 esac
2943done
2944
2945if test "$fdt_required" = "yes"; then
2946 if test "$fdt" = "no"; then
2947 error_exit "fdt disabled but some requested targets require it." \
2948 "You can turn off fdt only if you also disable all the system emulation" \
2949 "targets which need it (by specifying a cut down --target-list)."
2950 fi
2951 fdt=yes
2952fi
2953
2df87df7 2954if test "$fdt" != "no" ; then
b41af4ba 2955 fdt_libs="-lfdt"
96ce6545 2956 # explicitly check for libfdt_env.h as it is missing in some stable installs
b41af4ba 2957 cat > $TMPC << EOF
96ce6545 2958#include <libfdt_env.h>
f652e6af
AJ
2959int main(void) { return 0; }
2960EOF
52166aa0 2961 if compile_prog "" "$fdt_libs" ; then
a540f158 2962 # system DTC is good - use it
f652e6af 2963 fdt=yes
a540f158
PC
2964 elif test -d ${source_path}/dtc/libfdt ; then
2965 # have submodule DTC - use it
2966 fdt=yes
2967 dtc_internal="yes"
2968 mkdir -p dtc
cab00a5a 2969 if [ "$pwd_is_source_path" != "y" ] ; then
a540f158
PC
2970 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
2971 symlink "$source_path/dtc/scripts" "dtc/scripts"
2df87df7 2972 fi
a540f158
PC
2973 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
2974 fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
2975 elif test "$fdt" = "yes" ; then
2976 # have neither and want - prompt for system/submodule install
3f281822
SS
2977 error_exit "DTC (libfdt) not present. Your options:" \
2978 " (1) Preferred: Install the DTC (libfdt) devel package" \
a540f158
PC
2979 " (2) Fetch the DTC submodule, using:" \
2980 " git submodule update --init dtc"
2981 else
2982 # don't have and don't want
de3a354a 2983 fdt_libs=
2df87df7 2984 fdt=no
f652e6af
AJ
2985 fi
2986fi
2987
a540f158
PC
2988libs_softmmu="$libs_softmmu $fdt_libs"
2989
20ff075b 2990##########################################
b1e5fff4
MW
2991# GLX probe, used by milkymist-tmu2
2992if test "$glx" != "no" ; then
2993 glx_libs="-lGL -lX11"
20ff075b
MW
2994 cat > $TMPC << EOF
2995#include <X11/Xlib.h>
2996#include <GL/gl.h>
2997#include <GL/glx.h>
d3fcbb16 2998int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
20ff075b 2999EOF
d3fcbb16 3000 if compile_prog "" "-lGL -lX11" ; then
b1e5fff4 3001 glx=yes
20ff075b 3002 else
b1e5fff4 3003 if test "$glx" = "yes" ; then
21684af0 3004 feature_not_found "glx" "Install GL devel (e.g. MESA)"
20ff075b 3005 fi
b1e5fff4
MW
3006 glx_libs=
3007 glx=no
20ff075b
MW
3008 fi
3009fi
3010
eb100396
BR
3011##########################################
3012# glusterfs probe
3013if test "$glusterfs" != "no" ; then
65d5d3f9 3014 if $pkg_config --atleast-version=3 glusterfs-api; then
e01bee08 3015 glusterfs="yes"
ca871ec8
SW
3016 glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
3017 glusterfs_libs=`$pkg_config --libs glusterfs-api`
65d5d3f9 3018 if $pkg_config --atleast-version=5 glusterfs-api; then
0c14fb47
BR
3019 glusterfs_discard="yes"
3020 fi
7c815372
BR
3021 if $pkg_config --atleast-version=6 glusterfs-api; then
3022 glusterfs_zerofill="yes"
3023 fi
eb100396
BR
3024 else
3025 if test "$glusterfs" = "yes" ; then
21684af0 3026 feature_not_found "GlusterFS backend support" "Install glusterfs-api devel"
eb100396 3027 fi
e01bee08 3028 glusterfs="no"
eb100396
BR
3029 fi
3030fi
3031
39386ac7 3032# Check for inotify functions when we are building linux-user
3b3f24ad
AJ
3033# emulator. This is done because older glibc versions don't
3034# have syscall stubs for these implemented. In that case we
3035# don't provide them even if kernel supports them.
3036#
3037inotify=no
67ba57f6 3038cat > $TMPC << EOF
3b3f24ad
AJ
3039#include <sys/inotify.h>
3040
3041int
3042main(void)
3043{
3044 /* try to start inotify */
8690e420 3045 return inotify_init();
3b3f24ad
AJ
3046}
3047EOF
52166aa0 3048if compile_prog "" "" ; then
67ba57f6 3049 inotify=yes
3b3f24ad
AJ
3050fi
3051
c05c7a73
RV
3052inotify1=no
3053cat > $TMPC << EOF
3054#include <sys/inotify.h>
3055
3056int
3057main(void)
3058{
3059 /* try to start inotify */
3060 return inotify_init1(0);
3061}
3062EOF
3063if compile_prog "" "" ; then
3064 inotify1=yes
3065fi
3066
ebc996f3
RV
3067# check if utimensat and futimens are supported
3068utimens=no
3069cat > $TMPC << EOF
3070#define _ATFILE_SOURCE
ebc996f3
RV
3071#include <stddef.h>
3072#include <fcntl.h>
3014ee00 3073#include <sys/stat.h>
ebc996f3
RV
3074
3075int main(void)
3076{
3077 utimensat(AT_FDCWD, "foo", NULL, 0);
3078 futimens(0, NULL);
3079 return 0;
3080}
3081EOF
52166aa0 3082if compile_prog "" "" ; then
ebc996f3
RV
3083 utimens=yes
3084fi
3085
099d6b0f
RV
3086# check if pipe2 is there
3087pipe2=no
3088cat > $TMPC << EOF
099d6b0f
RV
3089#include <unistd.h>
3090#include <fcntl.h>
3091
3092int main(void)
3093{
3094 int pipefd[2];
9bca8162 3095 return pipe2(pipefd, O_CLOEXEC);
099d6b0f
RV
3096}
3097EOF
52166aa0 3098if compile_prog "" "" ; then
099d6b0f
RV
3099 pipe2=yes
3100fi
3101
40ff6d7e
KW
3102# check if accept4 is there
3103accept4=no
3104cat > $TMPC << EOF
40ff6d7e
KW
3105#include <sys/socket.h>
3106#include <stddef.h>
3107
3108int main(void)
3109{
3110 accept4(0, NULL, NULL, SOCK_CLOEXEC);
3111 return 0;
3112}
3113EOF
3114if compile_prog "" "" ; then
3115 accept4=yes
3116fi
3117
3ce34dfb
VS
3118# check if tee/splice is there. vmsplice was added same time.
3119splice=no
3120cat > $TMPC << EOF
3ce34dfb
VS
3121#include <unistd.h>
3122#include <fcntl.h>
3123#include <limits.h>
3124
3125int main(void)
3126{
66ea0f22 3127 int len, fd = 0;
3ce34dfb
VS
3128 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
3129 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
3130 return 0;
3131}
3132EOF
52166aa0 3133if compile_prog "" "" ; then
3ce34dfb
VS
3134 splice=yes
3135fi
3136
dcc38d1c
MT
3137##########################################
3138# signalfd probe
3139signalfd="no"
3140cat > $TMPC << EOF
dcc38d1c
MT
3141#include <unistd.h>
3142#include <sys/syscall.h>
3143#include <signal.h>
3144int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
3145EOF
3146
3147if compile_prog "" "" ; then
3148 signalfd=yes
3149fi
3150
c2882b96
RV
3151# check if eventfd is supported
3152eventfd=no
3153cat > $TMPC << EOF
3154#include <sys/eventfd.h>
3155
3156int main(void)
3157{
55cc7f3e 3158 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
c2882b96
RV
3159}
3160EOF
3161if compile_prog "" "" ; then
3162 eventfd=yes
3163fi
3164
d0927938
UH
3165# check for fallocate
3166fallocate=no
3167cat > $TMPC << EOF
3168#include <fcntl.h>
3169
3170int main(void)
3171{
3172 fallocate(0, 0, 0, 0);
3173 return 0;
3174}
3175EOF
8fb03151 3176if compile_prog "" "" ; then
d0927938
UH
3177 fallocate=yes
3178fi
3179
3d4fa43e
KK
3180# check for fallocate hole punching
3181fallocate_punch_hole=no
3182cat > $TMPC << EOF
3183#include <fcntl.h>
3184#include <linux/falloc.h>
3185
3186int main(void)
3187{
3188 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
3189 return 0;
3190}
3191EOF
3192if compile_prog "" "" ; then
3193 fallocate_punch_hole=yes
3194fi
3195
c727f47d
PM
3196# check for sync_file_range
3197sync_file_range=no
3198cat > $TMPC << EOF
3199#include <fcntl.h>
3200
3201int main(void)
3202{
3203 sync_file_range(0, 0, 0, 0);
3204 return 0;
3205}
3206EOF
8fb03151 3207if compile_prog "" "" ; then
c727f47d
PM
3208 sync_file_range=yes
3209fi
3210
dace20dc
PM
3211# check for linux/fiemap.h and FS_IOC_FIEMAP
3212fiemap=no
3213cat > $TMPC << EOF
3214#include <sys/ioctl.h>
3215#include <linux/fs.h>
3216#include <linux/fiemap.h>
3217
3218int main(void)
3219{
3220 ioctl(0, FS_IOC_FIEMAP, 0);
3221 return 0;
3222}
3223EOF
8fb03151 3224if compile_prog "" "" ; then
dace20dc
PM
3225 fiemap=yes
3226fi
3227
d0927938
UH
3228# check for dup3
3229dup3=no
3230cat > $TMPC << EOF
3231#include <unistd.h>
3232
3233int main(void)
3234{
3235 dup3(0, 0, 0);
3236 return 0;
3237}
3238EOF
78f5d726 3239if compile_prog "" "" ; then
d0927938
UH
3240 dup3=yes
3241fi
3242
4e0c6529
AB
3243# check for ppoll support
3244ppoll=no
3245cat > $TMPC << EOF
3246#include <poll.h>
3247
3248int main(void)
3249{
3250 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
3251 ppoll(&pfd, 1, 0, 0);
3252 return 0;
3253}
3254EOF
3255if compile_prog "" "" ; then
3256 ppoll=yes
3257fi
3258
cd758dd0
AB
3259# check for prctl(PR_SET_TIMERSLACK , ... ) support
3260prctl_pr_set_timerslack=no
3261cat > $TMPC << EOF
3262#include <sys/prctl.h>
3263
3264int main(void)
3265{
3266 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
3267 return 0;
3268}
3269EOF
3270if compile_prog "" "" ; then
3271 prctl_pr_set_timerslack=yes
3272fi
3273
3b6edd16
PM
3274# check for epoll support
3275epoll=no
3276cat > $TMPC << EOF
3277#include <sys/epoll.h>
3278
3279int main(void)
3280{
3281 epoll_create(0);
3282 return 0;
3283}
3284EOF
8fb03151 3285if compile_prog "" "" ; then
3b6edd16
PM
3286 epoll=yes
3287fi
3288
3289# epoll_create1 and epoll_pwait are later additions
3290# so we must check separately for their presence
3291epoll_create1=no
3292cat > $TMPC << EOF
3293#include <sys/epoll.h>
3294
3295int main(void)
3296{
19e83f6b
PM
3297 /* Note that we use epoll_create1 as a value, not as
3298 * a function being called. This is necessary so that on
3299 * old SPARC glibc versions where the function was present in
3300 * the library but not declared in the header file we will
3301 * fail the configure check. (Otherwise we will get a compiler
3302 * warning but not an error, and will proceed to fail the
3303 * qemu compile where we compile with -Werror.)
3304 */
c075a723 3305 return (int)(uintptr_t)&epoll_create1;
3b6edd16
PM
3306}
3307EOF
8fb03151 3308if compile_prog "" "" ; then
3b6edd16
PM
3309 epoll_create1=yes
3310fi
3311
3312epoll_pwait=no
3313cat > $TMPC << EOF
3314#include <sys/epoll.h>
3315
3316int main(void)
3317{
3318 epoll_pwait(0, 0, 0, 0, 0);
3319 return 0;
3320}
3321EOF
8fb03151 3322if compile_prog "" "" ; then
3b6edd16
PM
3323 epoll_pwait=yes
3324fi
3325
a8fd1aba
PM
3326# check for sendfile support
3327sendfile=no
3328cat > $TMPC << EOF
3329#include <sys/sendfile.h>
3330
3331int main(void)
3332{
3333 return sendfile(0, 0, 0, 0);
3334}
3335EOF
3336if compile_prog "" "" ; then
3337 sendfile=yes
3338fi
3339
cc8ae6de 3340# Check if tools are available to build documentation.
a25dba17 3341if test "$docs" != "no" ; then
01668d98 3342 if has makeinfo && has pod2man; then
a25dba17 3343 docs=yes
83a3ab8b 3344 else
a25dba17 3345 if test "$docs" = "yes" ; then
21684af0 3346 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
83a3ab8b 3347 fi
a25dba17 3348 docs=no
83a3ab8b 3349 fi
cc8ae6de
PB
3350fi
3351
f514f41c 3352# Search for bswap_32 function
6ae9a1f4
JQ
3353byteswap_h=no
3354cat > $TMPC << EOF
3355#include <byteswap.h>
3356int main(void) { return bswap_32(0); }
3357EOF
52166aa0 3358if compile_prog "" "" ; then
6ae9a1f4
JQ
3359 byteswap_h=yes
3360fi
3361
75f13596 3362# Search for bswap32 function
6ae9a1f4
JQ
3363bswap_h=no
3364cat > $TMPC << EOF
3365#include <sys/endian.h>
3366#include <sys/types.h>
3367#include <machine/bswap.h>
3368int main(void) { return bswap32(0); }
3369EOF
52166aa0 3370if compile_prog "" "" ; then
6ae9a1f4
JQ
3371 bswap_h=yes
3372fi
3373
c589b249
RS
3374##########################################
3375# Do we have libiscsi
063c3378
PL
3376# We check for iscsi_write16_sync() to make sure we have a
3377# at least version 1.4.0 of libiscsi.
c589b249
RS
3378if test "$libiscsi" != "no" ; then
3379 cat > $TMPC << EOF
fa6acb0c 3380#include <stdio.h>
c589b249 3381#include <iscsi/iscsi.h>
063c3378 3382int main(void) { iscsi_write16_sync(NULL,0,0,NULL,0,0,0,0,0,0,0); return 0; }
c589b249 3383EOF
65d5d3f9 3384 if $pkg_config --atleast-version=1.7.0 libiscsi; then
3c33ea96 3385 libiscsi="yes"
ca871ec8
SW
3386 libiscsi_cflags=$($pkg_config --cflags libiscsi)
3387 libiscsi_libs=$($pkg_config --libs libiscsi)
3c33ea96 3388 elif compile_prog "" "-liscsi" ; then
c589b249 3389 libiscsi="yes"
6ebc91e5 3390 libiscsi_libs="-liscsi"
c589b249
RS
3391 else
3392 if test "$libiscsi" = "yes" ; then
21684af0 3393 feature_not_found "libiscsi" "Install libiscsi devel"
c589b249
RS
3394 fi
3395 libiscsi="no"
3396 fi
3397fi
3398
219c2521
SW
3399# We also need to know the API version because there was an
3400# API change from 1.4.0 to 1.5.0.
3401if test "$libiscsi" = "yes"; then
3402 cat >$TMPC <<EOF
3403#include <iscsi/iscsi.h>
3404int main(void)
3405{
3406 iscsi_read10_task(0, 0, 0, 0, 0, 0, 0);
3407 return 0;
3408}
3409EOF
3410 if compile_prog "" "-liscsi"; then
3411 libiscsi_version="1.4.0"
3412 fi
3413fi
c589b249 3414
8bacde8d
NC
3415##########################################
3416# Do we need libm
3417cat > $TMPC << EOF
3418#include <math.h>
3419int main(void) { return isnan(sin(0.0)); }
3420EOF
3421if compile_prog "" "" ; then
3422 :
3423elif compile_prog "" "-lm" ; then
3424 LIBS="-lm $LIBS"
3425 libs_qga="-lm $libs_qga"
3426else
76ad07a4 3427 error_exit "libm check failed"
8bacde8d
NC
3428fi
3429
da93a1fd
AL
3430##########################################
3431# Do we need librt
8bacde8d
NC
3432# uClibc provides 2 versions of clock_gettime(), one with realtime
3433# support and one without. This means that the clock_gettime() don't
3434# need -lrt. We still need it for timer_create() so we check for this
3435# function in addition.
da93a1fd
AL
3436cat > $TMPC <<EOF
3437#include <signal.h>
3438#include <time.h>
8bacde8d
NC
3439int main(void) {
3440 timer_create(CLOCK_REALTIME, NULL, NULL);
3441 return clock_gettime(CLOCK_REALTIME, NULL);
3442}
da93a1fd
AL
3443EOF
3444
52166aa0 3445if compile_prog "" "" ; then
07ffa4bd 3446 :
8bacde8d
NC
3447# we need pthread for static linking. use previous pthread test result
3448elif compile_prog "" "-lrt $pthread_lib" ; then
07ffa4bd 3449 LIBS="-lrt $LIBS"
8bacde8d 3450 libs_qga="-lrt $libs_qga"
da93a1fd
AL
3451fi
3452
31ff504d 3453if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
179cf400 3454 "$aix" != "yes" -a "$haiku" != "yes" ; then
6362a53f
JQ
3455 libs_softmmu="-lutil $libs_softmmu"
3456fi
3457
de5071c5 3458##########################################
cd4ec0b4
GH
3459# spice probe
3460if test "$spice" != "no" ; then
3461 cat > $TMPC << EOF
3462#include <spice.h>
3463int main(void) { spice_server_new(); return 0; }
3464EOF
710fc4f5
JD
3465 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3466 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
65d5d3f9
SW
3467 if $pkg_config --atleast-version=0.12.0 spice-server && \
3468 $pkg_config --atleast-version=0.12.3 spice-protocol && \
cd4ec0b4
GH
3469 compile_prog "$spice_cflags" "$spice_libs" ; then
3470 spice="yes"
3471 libs_softmmu="$libs_softmmu $spice_libs"
3472 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2e0e3c39
AL
3473 spice_protocol_version=$($pkg_config --modversion spice-protocol)
3474 spice_server_version=$($pkg_config --modversion spice-server)
cd4ec0b4
GH
3475 else
3476 if test "$spice" = "yes" ; then
21684af0 3477 feature_not_found "spice" "Install spice-server and spice-protocol devel"
cd4ec0b4
GH
3478 fi
3479 spice="no"
3480 fi
3481fi
3482
111a38b0 3483# check for libcacard for smartcard support
afd347ab
PB
3484smartcard_cflags=""
3485# TODO - what's the minimal nss version we support?
3486if test "$smartcard_nss" != "no"; then
3487 cat > $TMPC << EOF
5f01e06f
ST
3488#include <pk11pub.h>
3489int main(void) { PK11_FreeSlot(0); return 0; }
3490EOF
9d171bd9
MT
3491 # FIXME: do not include $glib_* in here
3492 nss_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
3493 nss_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
3494 test_cflags="$nss_cflags"
afd347ab
PB
3495 # The header files in nss < 3.13.3 have a bug which causes them to
3496 # emit a warning. If we're going to compile QEMU with -Werror, then
3497 # test that the headers don't have this bug. Otherwise we would pass
3498 # the configure test but fail to compile QEMU later.
3499 if test "$werror" = "yes"; then
3500 test_cflags="-Werror $test_cflags"
3501 fi
b6fc675b 3502 if test -n "$libtool" &&
65d5d3f9 3503 $pkg_config --atleast-version=3.12.8 nss && \
9d171bd9 3504 compile_prog "$test_cflags" "$nss_libs"; then
afd347ab 3505 smartcard_nss="yes"
afd347ab
PB
3506 else
3507 if test "$smartcard_nss" = "yes"; then
3508 feature_not_found "nss"
111a38b0 3509 fi
afd347ab 3510 smartcard_nss="no"
111a38b0
RR
3511 fi
3512fi
111a38b0 3513
2b2325ff
GH
3514# check for libusb
3515if test "$libusb" != "no" ; then
65d5d3f9 3516 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
2b2325ff 3517 libusb="yes"
ca871ec8
SW
3518 libusb_cflags=$($pkg_config --cflags libusb-1.0)
3519 libusb_libs=$($pkg_config --libs libusb-1.0)
2b2325ff
GH
3520 QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
3521 libs_softmmu="$libs_softmmu $libusb_libs"
3522 else
3523 if test "$libusb" = "yes"; then
21684af0 3524 feature_not_found "libusb" "Install libusb devel"
2b2325ff
GH
3525 fi
3526 libusb="no"
3527 fi
3528fi
3529
69354a83
HG
3530# check for usbredirparser for usb network redirection support
3531if test "$usb_redir" != "no" ; then
65d5d3f9 3532 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
69354a83 3533 usb_redir="yes"
ca871ec8
SW
3534 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3535 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
69354a83 3536 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
56ab2ad1 3537 libs_softmmu="$libs_softmmu $usb_redir_libs"
69354a83
HG
3538 else
3539 if test "$usb_redir" = "yes"; then
21684af0 3540 feature_not_found "usb-redir" "Install usbredir devel"
69354a83
HG
3541 fi
3542 usb_redir="no"
3543 fi
3544fi
3545
d9840e25
TS
3546##########################################
3547# check if we have VSS SDK headers for win
3548
3549if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3550 case "$vss_win32_sdk" in
3551 "") vss_win32_include="-I$source_path" ;;
3552 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3553 # handle path with spaces. So we symlink the headers into ".sdk/vss".
3554 vss_win32_include="-I$source_path/.sdk/vss"
3555 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3556 ;;
3557 *) vss_win32_include="-I$vss_win32_sdk"
3558 esac
3559 cat > $TMPC << EOF
3560#define __MIDL_user_allocate_free_DEFINED__
3561#include <inc/win2003/vss.h>
3562int main(void) { return VSS_CTX_BACKUP; }
3563EOF
3564 if compile_prog "$vss_win32_include" "" ; then
3565 guest_agent_with_vss="yes"
3566 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3567 libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3568 else
3569 if test "$vss_win32_sdk" != "" ; then
3570 echo "ERROR: Please download and install Microsoft VSS SDK:"
3571 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3572 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3573 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
3574 echo "ERROR: The headers are extracted in the directory \`inc'."
3575 feature_not_found "VSS support"
3576 fi
3577 guest_agent_with_vss="no"
3578 fi
3579fi
3580
3581##########################################
3582# lookup Windows platform SDK (if not specified)
3583# The SDK is needed only to build .tlb (type library) file of guest agent
3584# VSS provider from the source. It is usually unnecessary because the
3585# pre-compiled .tlb file is included.
3586
3587if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3588 if test -z "$win_sdk"; then
3589 programfiles="$PROGRAMFILES"
3590 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3591 if test -n "$programfiles"; then
3592 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3593 else
3594 feature_not_found "Windows SDK"
3595 fi
3596 elif test "$win_sdk" = "no"; then
3597 win_sdk=""
3598 fi
3599fi
3600
cd4ec0b4
GH
3601##########################################
3602
5f6b9e8f
BS
3603##########################################
3604# check if we have fdatasync
3605
3606fdatasync=no
3607cat > $TMPC << EOF
3608#include <unistd.h>
d1722a27
AR
3609int main(void) {
3610#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3611return fdatasync(0);
3612#else
e172fe11 3613#error Not supported
d1722a27
AR
3614#endif
3615}
5f6b9e8f
BS
3616EOF
3617if compile_prog "" "" ; then
3618 fdatasync=yes
3619fi
3620
e78815a5
AF
3621##########################################
3622# check if we have madvise
3623
3624madvise=no
3625cat > $TMPC << EOF
3626#include <sys/types.h>
3627#include <sys/mman.h>
832ce9c2 3628#include <stddef.h>
e78815a5
AF
3629int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3630EOF
3631if compile_prog "" "" ; then
3632 madvise=yes
3633fi
3634
3635##########################################
3636# check if we have posix_madvise
3637
3638posix_madvise=no
3639cat > $TMPC << EOF
3640#include <sys/mman.h>
832ce9c2 3641#include <stddef.h>
e78815a5
AF
3642int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3643EOF
3644if compile_prog "" "" ; then
3645 posix_madvise=yes
3646fi
3647
1e9737da
RH
3648##########################################
3649# check if we have usable SIGEV_THREAD_ID
3650
3651sigev_thread_id=no
3652cat > $TMPC << EOF
3653#include <signal.h>
3654int main(void) {
3655 struct sigevent ev;
3656 ev.sigev_notify = SIGEV_THREAD_ID;
3657 ev._sigev_un._tid = 0;
3658 asm volatile("" : : "g"(&ev));
3659 return 0;
3660}
3661EOF
3662if compile_prog "" "" ; then
3663 sigev_thread_id=yes
3664fi
3665
94a420b1
SH
3666##########################################
3667# check if trace backend exists
3668
650ab98d 3669$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null
94a420b1 3670if test "$?" -ne 0 ; then
76ad07a4
PM
3671 error_exit "invalid trace backend" \
3672 "Please choose a supported trace backend."
94a420b1
SH
3673fi
3674
7e24e92a
SH
3675##########################################
3676# For 'ust' backend, test if ust headers are present
3677if test "$trace_backend" = "ust"; then
3678 cat > $TMPC << EOF
bf15f63c 3679#include <lttng/tracepoint.h>
7e24e92a
SH
3680int main(void) { return 0; }
3681EOF
3682 if compile_prog "" "" ; then
bf15f63c
MG
3683 if $pkg_config lttng-ust --exists; then
3684 lttng_ust_libs=`$pkg_config --libs lttng-ust`
3685 else
3686 lttng_ust_libs="-llttng-ust"
3687 fi
3688 if $pkg_config liburcu-bp --exists; then
3689 urcu_bp_libs=`$pkg_config --libs liburcu-bp`
3690 else
3691 urcu_bp_libs="-lurcu-bp"
3692 fi
3693
3694 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
3695 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
7e24e92a 3696 else
bf15f63c 3697 error_exit "Trace backend 'ust' missing lttng-ust header files"
7e24e92a
SH
3698 fi
3699fi
b3d08c02
DB
3700
3701##########################################
3702# For 'dtrace' backend, test if 'dtrace' command is present
3703if test "$trace_backend" = "dtrace"; then
3704 if ! has 'dtrace' ; then
76ad07a4 3705 error_exit "dtrace command is not found in PATH $PATH"
b3d08c02 3706 fi
c276b17d
DB
3707 trace_backend_stap="no"
3708 if has 'stap' ; then
3709 trace_backend_stap="yes"
3710 fi
b3d08c02
DB
3711fi
3712
023367e6 3713##########################################
519175a2 3714# check and set a backend for coroutine
d0e2fce5 3715
7c2acc70
PM
3716# We prefer ucontext, but it's not always possible. The fallback
3717# is sigcontext. gthread is not selectable except explicitly, because
3718# it is not functional enough to run QEMU proper. (It is occasionally
3719# useful for debugging purposes.) On Windows the only valid backend
3720# is the Windows-specific one.
3721
3722ucontext_works=no
3723if test "$darwin" != "yes"; then
3724 cat > $TMPC << EOF
d0e2fce5 3725#include <ucontext.h>
cdf84806
PM
3726#ifdef __stub_makecontext
3727#error Ignoring glibc stub makecontext which will always fail
3728#endif
75cafad7 3729int main(void) { makecontext(0, 0, 0); return 0; }
d0e2fce5 3730EOF
7c2acc70
PM
3731 if compile_prog "" "" ; then
3732 ucontext_works=yes
3733 fi
3734fi
3735
3736if test "$coroutine" = ""; then
3737 if test "$mingw32" = "yes"; then
3738 coroutine=win32
3739 elif test "$ucontext_works" = "yes"; then
3740 coroutine=ucontext
3741 else
3742 coroutine=sigaltstack
d0e2fce5 3743 fi
519175a2 3744else
7c2acc70
PM
3745 case $coroutine in
3746 windows)
3747 if test "$mingw32" != "yes"; then
3748 error_exit "'windows' coroutine backend only valid for Windows"
3749 fi
3750 # Unfortunately the user visible backend name doesn't match the
3751 # coroutine-*.c filename for this case, so we have to adjust it here.
3752 coroutine=win32
3753 ;;
3754 ucontext)
3755 if test "$ucontext_works" != "yes"; then
3756 feature_not_found "ucontext"
3757 fi
3758 ;;
3759 gthread|sigaltstack)
3760 if test "$mingw32" = "yes"; then
3761 error_exit "only the 'windows' coroutine backend is valid for Windows"
3762 fi
3763 ;;
3764 *)
3765 error_exit "unknown coroutine backend $coroutine"
3766 ;;
3767 esac
d0e2fce5
AK
3768fi
3769
70c60c08
SH
3770if test "$coroutine_pool" = ""; then
3771 if test "$coroutine" = "gthread"; then
3772 coroutine_pool=no
3773 else
3774 coroutine_pool=yes
3775 fi
3776fi
3777if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
3778 error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
3779fi
3780
d2042378
AK
3781##########################################
3782# check if we have open_by_handle_at
3783
4e1797f9 3784open_by_handle_at=no
d2042378
AK
3785cat > $TMPC << EOF
3786#include <fcntl.h>
acc55ba8
SW
3787#if !defined(AT_EMPTY_PATH)
3788# error missing definition
3789#else
75cafad7 3790int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
acc55ba8 3791#endif
d2042378
AK
3792EOF
3793if compile_prog "" "" ; then
3794 open_by_handle_at=yes
3795fi
3796
e06a765e
HPB
3797########################################
3798# check if we have linux/magic.h
3799
3800linux_magic_h=no
3801cat > $TMPC << EOF
3802#include <linux/magic.h>
3803int main(void) {
75cafad7 3804 return 0;
e06a765e
HPB
3805}
3806EOF
3807if compile_prog "" "" ; then
3808 linux_magic_h=yes
3809fi
3810
06d71fa1 3811########################################
c95e3080
KW
3812# check whether we can disable warning option with a pragma (this is needed
3813# to silence warnings in the headers of some versions of external libraries).
3814# This test has to be compiled with -Werror as otherwise an unknown pragma is
3815# only a warning.
3816#
3817# If we can't selectively disable warning in the code, disable -Werror so that
3818# the build doesn't fail anyway.
3819
06d71fa1
PM
3820pragma_disable_unused_but_set=no
3821cat > $TMPC << EOF
e6f53fd5 3822#pragma GCC diagnostic push
06d71fa1 3823#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
c95e3080 3824#pragma GCC diagnostic ignored "-Wstrict-prototypes"
e6f53fd5 3825#pragma GCC diagnostic pop
c95e3080 3826
06d71fa1
PM
3827int main(void) {
3828 return 0;
3829}
3830EOF
3831if compile_prog "-Werror" "" ; then
cc6e3ca9 3832 pragma_diagnostic_available=yes
c95e3080
KW
3833else
3834 werror=no
06d71fa1
PM
3835fi
3836
3f4349dc 3837########################################
62fe8331 3838# check if we have valgrind/valgrind.h and valgrind/memcheck.h
3f4349dc
KW
3839
3840valgrind_h=no
3841cat > $TMPC << EOF
3842#include <valgrind/valgrind.h>
62fe8331 3843#include <valgrind/memcheck.h>
3f4349dc 3844int main(void) {
3f4349dc
KW
3845 return 0;
3846}
3847EOF
3848if compile_prog "" "" ; then
3849 valgrind_h=yes
3850fi
3851
8ab1bf12
LC
3852########################################
3853# check if environ is declared
3854
3855has_environ=no
3856cat > $TMPC << EOF
3857#include <unistd.h>
3858int main(void) {
c075a723 3859 environ = 0;
8ab1bf12
LC
3860 return 0;
3861}
3862EOF
3863if compile_prog "" "" ; then
3864 has_environ=yes
3865fi
3866
76a347e1
RH
3867########################################
3868# check if cpuid.h is usable.
3869
3870cpuid_h=no
3871cat > $TMPC << EOF
3872#include <cpuid.h>
3873int main(void) {
774d566c
PM
3874 unsigned a, b, c, d;
3875 int max = __get_cpuid_max(0, 0);
3876
3877 if (max >= 1) {
3878 __cpuid(1, a, b, c, d);
3879 }
3880
3881 if (max >= 7) {
3882 __cpuid_count(7, 0, a, b, c, d);
3883 }
3884
3885 return 0;
76a347e1
RH
3886}
3887EOF
3888if compile_prog "" "" ; then
3889 cpuid_h=yes
3890fi
3891
f540166b
RH
3892########################################
3893# check if __[u]int128_t is usable.
3894
3895int128=no
3896cat > $TMPC << EOF
a00f66ab
SW
3897#if defined(__clang_major__) && defined(__clang_minor__)
3898# if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
3899# error __int128_t does not work in CLANG before 3.2
3900# endif
3901#endif
f540166b
RH
3902__int128_t a;
3903__uint128_t b;
3904int main (void) {
3905 a = a + b;
3906 b = a * b;
464e3671 3907 a = a * a;
f540166b
RH
3908 return 0;
3909}
3910EOF
3911if compile_prog "" "" ; then
3912 int128=yes
3913fi
76a347e1 3914
1e6e9aca
RH
3915########################################
3916# check if getauxval is available.
3917
3918getauxval=no
3919cat > $TMPC << EOF
3920#include <sys/auxv.h>
3921int main(void) {
3922 return getauxval(AT_HWCAP) == 0;
3923}
3924EOF
3925if compile_prog "" "" ; then
3926 getauxval=yes
3927fi
3928
7e24e92a 3929##########################################
e86ecd4b
JQ
3930# End of CC checks
3931# After here, no more $cc or $ld runs
3932
1d728c39
BS
3933if test "$gcov" = "yes" ; then
3934 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
3935 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
3936elif test "$debug" = "no" ; then
e600cdf3 3937 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
e86ecd4b 3938fi
a316e378 3939
6542aa9c
PL
3940##########################################
3941# Do we have libnfs
3942if test "$libnfs" != "no" ; then
b7d769c9 3943 if $pkg_config --atleast-version=1.9.3 libnfs; then
6542aa9c
PL
3944 libnfs="yes"
3945 libnfs_libs=$($pkg_config --libs libnfs)
3946 LIBS="$LIBS $libnfs_libs"
3947 else
3948 if test "$libnfs" = "yes" ; then
3949 feature_not_found "libnfs"
3950 fi
3951 libnfs="no"
3952 fi
3953fi
1d728c39 3954
20ff6c80
AL
3955# Disable zero malloc errors for official releases unless explicitly told to
3956# enable/disable
3957if test -z "$zero_malloc" ; then
3958 if test "$z_version" = "50" ; then
3959 zero_malloc="no"
3960 else
3961 zero_malloc="yes"
3962 fi
3963fi
3964
6ca026cb
PM
3965# Now we've finished running tests it's OK to add -Werror to the compiler flags
3966if test "$werror" = "yes"; then
3967 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
3968fi
3969
e86ecd4b
JQ
3970if test "$solaris" = "no" ; then
3971 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
1156c669 3972 LDFLAGS="-Wl,--warn-common $LDFLAGS"
e86ecd4b
JQ
3973 fi
3974fi
3975
94dd53c5
GH
3976# test if pod2man has --utf8 option
3977if pod2man --help | grep -q utf8; then
3978 POD2MAN="pod2man --utf8"
3979else
3980 POD2MAN="pod2man"
3981fi
3982
952afb71
BS
3983# Use ASLR, no-SEH and DEP if available
3984if test "$mingw32" = "yes" ; then
3985 for flag in --dynamicbase --no-seh --nxcompat; do
3986 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3987 LDFLAGS="-Wl,$flag $LDFLAGS"
3988 fi
3989 done
3990fi
3991
10ea68b3 3992qemu_confdir=$sysconfdir$confsuffix
e26110cf 3993qemu_moddir=$libdir$confsuffix
528ae5b8 3994qemu_datadir=$datadir$confsuffix
834574ea 3995qemu_localedir="$datadir/locale"
e7b45cc4 3996
4b1c11fd
DB
3997tools=""
3998if test "$want_tools" = "yes" ; then
ca35f780 3999 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
4b1c11fd
DB
4000 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
4001 tools="qemu-nbd\$(EXESUF) $tools"
4002 fi
4003fi
4004if test "$softmmu" = yes ; then
983eef5a 4005 if test "$virtfs" != no ; then
aabfd88d
AF
4006 if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
4007 virtfs=yes
4008 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
4009 else
4010 if test "$virtfs" = yes; then
76ad07a4 4011 error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
983eef5a 4012 fi
17500370 4013 virtfs=no
aabfd88d 4014 fi
17bff52b 4015 fi
e8ef31a3
MT
4016fi
4017if [ "$guest_agent" != "no" ]; then
b39297ae 4018 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
48ff7a62 4019 tools="qemu-ga\$(EXESUF) $tools"
b39297ae
TS
4020 if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
4021 tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
4022 fi
e8ef31a3
MT
4023 guest_agent=yes
4024 elif [ "$guest_agent" != yes ]; then
4025 guest_agent=no
4026 else
4027 error_exit "Guest agent is not supported on this platform"
ca35f780 4028 fi
00c705fb 4029fi
ca35f780
PB
4030
4031# Mac OS X ships with a broken assembler
4032roms=
4033if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
4034 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
4035 "$softmmu" = yes ; then
4036 roms="optionrom"
4037fi
d0384d1d 4038if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
39ac8455
DG
4039 roms="$roms spapr-rtas"
4040fi
ca35f780 4041
9933c305
CB
4042if test "$cpu" = "s390x" ; then
4043 roms="$roms s390-ccw"
4044fi
4045
964c6fa1
RH
4046# Probe for the need for relocating the user-only binary.
4047if test "$pie" = "no" ; then
4048 textseg_addr=
4049 case "$cpu" in
479eb121
RH
4050 arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
4051 # ??? Rationale for choosing this address
964c6fa1
RH
4052 textseg_addr=0x60000000
4053 ;;
4054 mips)
479eb121
RH
4055 # A 256M aligned address, high in the address space, with enough
4056 # room for the code_gen_buffer above it before the stack.
4057 textseg_addr=0x60000000
964c6fa1
RH
4058 ;;
4059 esac
4060 if [ -n "$textseg_addr" ]; then
4061 cat > $TMPC <<EOF
4062 int main(void) { return 0; }
4063EOF
4064 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
4065 if ! compile_prog "" "$textseg_ldflags"; then
4066 # In case ld does not support -Ttext-segment, edit the default linker
4067 # script via sed to set the .text start addr. This is needed on FreeBSD
4068 # at least.
4069 $ld --verbose | sed \
4070 -e '1,/==================================================/d' \
4071 -e '/==================================================/,$d' \
4072 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
4073 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
4074 textseg_ldflags="-Wl,-T../config-host.ld"
4075 fi
4076 fi
4077fi
4078
5ca9388a 4079# add pixman flags after all config tests are done
a540f158 4080QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
5ca9388a
GH
4081libs_softmmu="$libs_softmmu $pixman_libs"
4082
43ce4dfe 4083echo "Install prefix $prefix"
c00b2808 4084echo "BIOS directory `eval echo $qemu_datadir`"
f2b9e1e3 4085echo "binary directory `eval echo $bindir`"
3aa5d2be 4086echo "library directory `eval echo $libdir`"
e26110cf 4087echo "module directory `eval echo $qemu_moddir`"
8bf188aa 4088echo "libexec directory `eval echo $libexecdir`"
0f94d6da 4089echo "include directory `eval echo $includedir`"
1c0fd160 4090echo "config directory `eval echo $sysconfdir`"
11d9f695 4091if test "$mingw32" = "no" ; then
5a699bbb 4092echo "local state directory `eval echo $local_statedir`"
f2b9e1e3 4093echo "Manual directory `eval echo $mandir`"
43ce4dfe 4094echo "ELF interp prefix $interp_prefix"
5a699bbb
LE
4095else
4096echo "local state directory queried at runtime"
d9840e25 4097echo "Windows SDK $win_sdk"
11d9f695 4098fi
5a67135a 4099echo "Source path $source_path"
43ce4dfe 4100echo "C compiler $cc"
83469015 4101echo "Host C compiler $host_cc"
83f73fce 4102echo "C++ compiler $cxx"
3c4a4d0d 4103echo "Objective-C compiler $objcc"
45d285ab 4104echo "ARFLAGS $ARFLAGS"
0c439cbf 4105echo "CFLAGS $CFLAGS"
a558ee17 4106echo "QEMU_CFLAGS $QEMU_CFLAGS"
0c439cbf 4107echo "LDFLAGS $LDFLAGS"
43ce4dfe 4108echo "make $make"
6a882643 4109echo "install $install"
c886edfb 4110echo "python $python"
e2d8830e
BS
4111if test "$slirp" = "yes" ; then
4112 echo "smbd $smbd"
4113fi
17969268 4114echo "module support $modules"
43ce4dfe 4115echo "host CPU $cpu"
de83cd02 4116echo "host big endian $bigendian"
97a847bc 4117echo "target list $target_list"
ade25b0d 4118echo "tcg debug enabled $debug_tcg"
43ce4dfe 4119echo "gprof enabled $gprof"
03b4fe7d 4120echo "sparse enabled $sparse"
1625af87 4121echo "strip binaries $strip_opt"
05c2a3e7 4122echo "profiler $profiler"
43ce4dfe 4123echo "static build $static"
5b0753e0
FB
4124if test "$darwin" = "yes" ; then
4125 echo "Cocoa support $cocoa"
4126fi
e2134eb9 4127echo "pixman $pixman"
97a847bc 4128echo "SDL support $sdl"
a4ccabcf 4129echo "GTK support $gtk"
bbbf9bfb 4130echo "VTE support $vte"
4d3b6f6e 4131echo "curses support $curses"
769ce76d 4132echo "curl support $curl"
67b915a5 4133echo "mingw32 support $mingw32"
0c58ac1c 4134echo "Audio drivers $audio_drv_list"
b64ec4e4
FZ
4135echo "Block whitelist (rw) $block_drv_rw_whitelist"
4136echo "Block whitelist (ro) $block_drv_ro_whitelist"
983eef5a 4137echo "VirtFS support $virtfs"
821601ea
JS
4138echo "VNC support $vnc"
4139if test "$vnc" = "yes" ; then
4140 echo "VNC TLS support $vnc_tls"
4141 echo "VNC SASL support $vnc_sasl"
4142 echo "VNC JPEG support $vnc_jpeg"
4143 echo "VNC PNG support $vnc_png"
7536ee4b 4144 echo "VNC WS support $vnc_ws"
821601ea 4145fi
3142255c
BS
4146if test -n "$sparc_cpu"; then
4147 echo "Target Sparc Arch $sparc_cpu"
4148fi
e37630ca 4149echo "xen support $xen"
2e4d9fb1 4150echo "brlapi support $brlapi"
a20a6f46 4151echo "bluez support $bluez"
a25dba17 4152echo "Documentation $docs"
379f6698 4153echo "GUEST_BASE $guest_base"
40d6444e 4154echo "PIE $pie"
8a16d273 4155echo "vde support $vde"
58952137 4156echo "netmap support $netmap"
5c6c3a6c 4157echo "Linux AIO support $linux_aio"
758e8e38 4158echo "ATTR/XATTR support $attr"
77755340 4159echo "Install blobs $blobs"
b31a0277 4160echo "KVM support $kvm"
2da776db 4161echo "RDMA support $rdma"
9195b2c2 4162echo "TCG interpreter $tcg_interpreter"
f652e6af 4163echo "fdt support $fdt"
ceb42de8 4164echo "preadv support $preadv"
5f6b9e8f 4165echo "fdatasync $fdatasync"
e78815a5
AF
4166echo "madvise $madvise"
4167echo "posix_madvise $posix_madvise"
1e9737da 4168echo "sigev_thread_id $sigev_thread_id"
ee682d27 4169echo "uuid support $uuid"
47e98658 4170echo "libcap-ng support $cap_ng"
d5970055 4171echo "vhost-net support $vhost_net"
5e9be92d 4172echo "vhost-scsi support $vhost_scsi"
94a420b1 4173echo "Trace backend $trace_backend"
e00e36fb 4174if test "$trace_backend" = "simple"; then
9410b56c 4175echo "Trace output file $trace_file-<pid>"
e00e36fb 4176fi
c9dd4074 4177if test "$spice" = "yes"; then
2e0e3c39 4178echo "spice support $spice ($spice_protocol_version/$spice_server_version)"
c9dd4074
SW
4179else
4180echo "spice support $spice"
4181fi
f27aaf4b 4182echo "rbd support $rbd"
dce512de 4183echo "xfsctl support $xfs"
111a38b0 4184echo "nss used $smartcard_nss"
2b2325ff 4185echo "libusb $libusb"
69354a83 4186echo "usb net redir $usb_redir"
b1e5fff4 4187echo "GLX support $glx"
219c2521
SW
4188if test "$libiscsi_version" = "1.4.0"; then
4189echo "libiscsi support $libiscsi (1.4.0)"
4190else
c589b249 4191echo "libiscsi support $libiscsi"
219c2521 4192fi
6542aa9c 4193echo "libnfs support $libnfs"
d138cee9 4194echo "build guest agent $guest_agent"
d9840e25 4195echo "QGA VSS support $guest_agent_with_vss"
f794573e 4196echo "seccomp support $seccomp"
7c2acc70 4197echo "coroutine backend $coroutine"
70c60c08 4198echo "coroutine pool $coroutine_pool"
eb100396 4199echo "GlusterFS support $glusterfs"
583f6e7b 4200echo "virtio-blk-data-plane $virtio_blk_data_plane"
1d728c39
BS
4201echo "gcov $gcov_tool"
4202echo "gcov enabled $gcov"
ab214c29 4203echo "TPM support $tpm"
0a12ec87 4204echo "libssh2 support $libssh2"
3b8acc11 4205echo "TPM passthrough $tpm_passthrough"
3556c233 4206echo "QOM debugging $qom_cast_debug"
4f18b782 4207echo "vhdx $vhdx"
95c6bff3 4208echo "Quorum $quorum"
607dacd0
QN
4209echo "lzo support $lzo"
4210echo "snappy support $snappy"
67b915a5 4211
1ba16968 4212if test "$sdl_too_old" = "yes"; then
24b55b96 4213echo "-> Your SDL version is too old - please upgrade to have SDL support"
7c1f25b4 4214fi
7d13299d 4215
98ec69ac 4216config_host_mak="config-host.mak"
98ec69ac 4217
dbd99ae3
SW
4218echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
4219
98ec69ac 4220echo "# Automatically generated by configure - do not modify" > $config_host_mak
98ec69ac 4221echo >> $config_host_mak
98ec69ac 4222
e6c3b0f7 4223echo all: >> $config_host_mak
99d7cc75
PB
4224echo "prefix=$prefix" >> $config_host_mak
4225echo "bindir=$bindir" >> $config_host_mak
3aa5d2be 4226echo "libdir=$libdir" >> $config_host_mak
8bf188aa 4227echo "libexecdir=$libexecdir" >> $config_host_mak
0f94d6da 4228echo "includedir=$includedir" >> $config_host_mak
99d7cc75 4229echo "mandir=$mandir" >> $config_host_mak
99d7cc75 4230echo "sysconfdir=$sysconfdir" >> $config_host_mak
22d07038 4231echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
9afa52ce
EH
4232echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
4233echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
e26110cf 4234echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
5a699bbb
LE
4235if test "$mingw32" = "no" ; then
4236 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
4237fi
f354b1a1 4238echo "qemu_helperdir=$libexecdir" >> $config_host_mak
f9943cd5
GH
4239echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
4240echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
834574ea 4241echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
f544a488 4242echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
804edf29 4243
98ec69ac 4244echo "ARCH=$ARCH" >> $config_host_mak
727e5283 4245
f8393946 4246if test "$debug_tcg" = "yes" ; then
2358a494 4247 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
f8393946 4248fi
1625af87 4249if test "$strip_opt" = "yes" ; then
52ba784d 4250 echo "STRIP=${strip}" >> $config_host_mak
1625af87 4251fi
7d13299d 4252if test "$bigendian" = "yes" ; then
e2542fe2 4253 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
97a847bc 4254fi
67b915a5 4255if test "$mingw32" = "yes" ; then
98ec69ac 4256 echo "CONFIG_WIN32=y" >> $config_host_mak
9fe6de94
BS
4257 rc_version=`cat $source_path/VERSION`
4258 version_major=${rc_version%%.*}
4259 rc_version=${rc_version#*.}
4260 version_minor=${rc_version%%.*}
4261 rc_version=${rc_version#*.}
4262 version_subminor=${rc_version%%.*}
4263 version_micro=0
4264 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
4265 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
d9840e25
TS
4266 if test "$guest_agent_with_vss" = "yes" ; then
4267 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
4268 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
4269 fi
210fa556 4270else
35f4df27 4271 echo "CONFIG_POSIX=y" >> $config_host_mak
dffcb71c
MM
4272fi
4273
4274if test "$linux" = "yes" ; then
4275 echo "CONFIG_LINUX=y" >> $config_host_mak
67b915a5 4276fi
128ab2ff 4277
83fb7adf 4278if test "$darwin" = "yes" ; then
98ec69ac 4279 echo "CONFIG_DARWIN=y" >> $config_host_mak
83fb7adf 4280fi
b29fe3ed 4281
4282if test "$aix" = "yes" ; then
98ec69ac 4283 echo "CONFIG_AIX=y" >> $config_host_mak
b29fe3ed 4284fi
4285
ec530c81 4286if test "$solaris" = "yes" ; then
98ec69ac 4287 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2358a494 4288 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
0475a5ca 4289 if test "$needs_libsunmath" = "yes" ; then
75b5a697 4290 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
0475a5ca 4291 fi
ec530c81 4292fi
179cf400
AF
4293if test "$haiku" = "yes" ; then
4294 echo "CONFIG_HAIKU=y" >> $config_host_mak
4295fi
97a847bc 4296if test "$static" = "yes" ; then
98ec69ac 4297 echo "CONFIG_STATIC=y" >> $config_host_mak
7d13299d 4298fi
1ba16968 4299if test "$profiler" = "yes" ; then
2358a494 4300 echo "CONFIG_PROFILER=y" >> $config_host_mak
05c2a3e7 4301fi
c20709aa 4302if test "$slirp" = "yes" ; then
98ec69ac 4303 echo "CONFIG_SLIRP=y" >> $config_host_mak
e2d8830e 4304 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
c20709aa 4305fi
8a16d273 4306if test "$vde" = "yes" ; then
98ec69ac 4307 echo "CONFIG_VDE=y" >> $config_host_mak
8a16d273 4308fi
58952137
VM
4309if test "$netmap" = "yes" ; then
4310 echo "CONFIG_NETMAP=y" >> $config_host_mak
4311fi
47e98658
CB
4312if test "$cap_ng" = "yes" ; then
4313 echo "CONFIG_LIBCAP=y" >> $config_host_mak
4314fi
2358a494 4315echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
0c58ac1c 4316for drv in $audio_drv_list; do
bb55b712 4317 def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
98ec69ac 4318 echo "$def=y" >> $config_host_mak
923e4521 4319 if test "$drv" = "fmod"; then
7aac6cb1 4320 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
0c58ac1c 4321 fi
4322done
67f86e8e
JQ
4323if test "$audio_pt_int" = "yes" ; then
4324 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
4325fi
d5631638 4326if test "$audio_win_int" = "yes" ; then
4327 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
4328fi
b64ec4e4
FZ
4329echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
4330echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
821601ea
JS
4331if test "$vnc" = "yes" ; then
4332 echo "CONFIG_VNC=y" >> $config_host_mak
4333fi
8d5d2d4c 4334if test "$vnc_tls" = "yes" ; then
98ec69ac 4335 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
8d5d2d4c 4336fi
2f9606b3 4337if test "$vnc_sasl" = "yes" ; then
98ec69ac 4338 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
2f9606b3 4339fi
821601ea 4340if test "$vnc_jpeg" = "yes" ; then
2f6f5c7a 4341 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
2f6f5c7a 4342fi
821601ea 4343if test "$vnc_png" = "yes" ; then
efe556ad 4344 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
efe556ad 4345fi
7536ee4b
TH
4346if test "$vnc_ws" = "yes" ; then
4347 echo "CONFIG_VNC_WS=y" >> $config_host_mak
4348 echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
4349fi
76655d6d 4350if test "$fnmatch" = "yes" ; then
2358a494 4351 echo "CONFIG_FNMATCH=y" >> $config_host_mak
76655d6d 4352fi
ee682d27
SW
4353if test "$uuid" = "yes" ; then
4354 echo "CONFIG_UUID=y" >> $config_host_mak
4355fi
dce512de
CH
4356if test "$xfs" = "yes" ; then
4357 echo "CONFIG_XFS=y" >> $config_host_mak
4358fi
b1a550a0 4359qemu_version=`head $source_path/VERSION`
98ec69ac 4360echo "VERSION=$qemu_version" >>$config_host_mak
2358a494 4361echo "PKGVERSION=$pkgversion" >>$config_host_mak
98ec69ac 4362echo "SRC_PATH=$source_path" >> $config_host_mak
98ec69ac 4363echo "TARGET_DIRS=$target_list" >> $config_host_mak
a25dba17 4364if [ "$docs" = "yes" ] ; then
98ec69ac 4365 echo "BUILD_DOCS=yes" >> $config_host_mak
cc8ae6de 4366fi
17969268 4367if test "$modules" = "yes"; then
e26110cf
FZ
4368 # $shacmd can generate a hash started with digit, which the compiler doesn't
4369 # like as an symbol. So prefix it with an underscore
4370 echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak
17969268
FZ
4371 echo "CONFIG_MODULES=y" >> $config_host_mak
4372fi
1ac88f28 4373if test "$sdl" = "yes" ; then
98ec69ac 4374 echo "CONFIG_SDL=y" >> $config_host_mak
a3f4d63d 4375 echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
1ac88f28 4376 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
49ecc3fa
FB
4377fi
4378if test "$cocoa" = "yes" ; then
98ec69ac 4379 echo "CONFIG_COCOA=y" >> $config_host_mak
4d3b6f6e
AZ
4380fi
4381if test "$curses" = "yes" ; then
98ec69ac 4382 echo "CONFIG_CURSES=y" >> $config_host_mak
49ecc3fa 4383fi
ebc996f3 4384if test "$utimens" = "yes" ; then
2358a494 4385 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
ebc996f3 4386fi
099d6b0f 4387if test "$pipe2" = "yes" ; then
2358a494 4388 echo "CONFIG_PIPE2=y" >> $config_host_mak
099d6b0f 4389fi
40ff6d7e
KW
4390if test "$accept4" = "yes" ; then
4391 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
4392fi
3ce34dfb 4393if test "$splice" = "yes" ; then
2358a494 4394 echo "CONFIG_SPLICE=y" >> $config_host_mak
3ce34dfb 4395fi
c2882b96
RV
4396if test "$eventfd" = "yes" ; then
4397 echo "CONFIG_EVENTFD=y" >> $config_host_mak
4398fi
d0927938
UH
4399if test "$fallocate" = "yes" ; then
4400 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
4401fi
3d4fa43e
KK
4402if test "$fallocate_punch_hole" = "yes" ; then
4403 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
4404fi
c727f47d
PM
4405if test "$sync_file_range" = "yes" ; then
4406 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
4407fi
dace20dc
PM
4408if test "$fiemap" = "yes" ; then
4409 echo "CONFIG_FIEMAP=y" >> $config_host_mak
4410fi
d0927938
UH
4411if test "$dup3" = "yes" ; then
4412 echo "CONFIG_DUP3=y" >> $config_host_mak
4413fi
4e0c6529
AB
4414if test "$ppoll" = "yes" ; then
4415 echo "CONFIG_PPOLL=y" >> $config_host_mak
4416fi
cd758dd0
AB
4417if test "$prctl_pr_set_timerslack" = "yes" ; then
4418 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
4419fi
3b6edd16
PM
4420if test "$epoll" = "yes" ; then
4421 echo "CONFIG_EPOLL=y" >> $config_host_mak
4422fi
4423if test "$epoll_create1" = "yes" ; then
4424 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
4425fi
4426if test "$epoll_pwait" = "yes" ; then
4427 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
4428fi
a8fd1aba
PM
4429if test "$sendfile" = "yes" ; then
4430 echo "CONFIG_SENDFILE=y" >> $config_host_mak
4431fi
3b3f24ad 4432if test "$inotify" = "yes" ; then
2358a494 4433 echo "CONFIG_INOTIFY=y" >> $config_host_mak
3b3f24ad 4434fi
c05c7a73
RV
4435if test "$inotify1" = "yes" ; then
4436 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
4437fi
6ae9a1f4
JQ
4438if test "$byteswap_h" = "yes" ; then
4439 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
4440fi
4441if test "$bswap_h" = "yes" ; then
4442 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
4443fi
769ce76d 4444if test "$curl" = "yes" ; then
d3399d7c 4445 echo "CONFIG_CURL=m" >> $config_host_mak
b1d5a277 4446 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
6ebc91e5 4447 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
769ce76d 4448fi
2e4d9fb1 4449if test "$brlapi" = "yes" ; then
98ec69ac 4450 echo "CONFIG_BRLAPI=y" >> $config_host_mak
2e4d9fb1 4451fi
fb599c9a 4452if test "$bluez" = "yes" ; then
98ec69ac 4453 echo "CONFIG_BLUEZ=y" >> $config_host_mak
ef7635ec 4454 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
fb599c9a 4455fi
e18df141 4456echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
a4ccabcf
AL
4457if test "$gtk" = "yes" ; then
4458 echo "CONFIG_GTK=y" >> $config_host_mak
a3f4d63d 4459 echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
a4ccabcf 4460 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
bbbf9bfb
SW
4461fi
4462if test "$vte" = "yes" ; then
4463 echo "CONFIG_VTE=y" >> $config_host_mak
a4ccabcf
AL
4464 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
4465fi
e37630ca 4466if test "$xen" = "yes" ; then
6dbd588a 4467 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
d5b93ddf 4468 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
e37630ca 4469fi
5c6c3a6c
CH
4470if test "$linux_aio" = "yes" ; then
4471 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
4472fi
758e8e38
VJ
4473if test "$attr" = "yes" ; then
4474 echo "CONFIG_ATTR=y" >> $config_host_mak
4475fi
4f26f2b6
AK
4476if test "$libattr" = "yes" ; then
4477 echo "CONFIG_LIBATTR=y" >> $config_host_mak
4478fi
983eef5a
MI
4479if test "$virtfs" = "yes" ; then
4480 echo "CONFIG_VIRTFS=y" >> $config_host_mak
758e8e38 4481fi
5e9be92d
NB
4482if test "$vhost_scsi" = "yes" ; then
4483 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
4484fi
77755340 4485if test "$blobs" = "yes" ; then
98ec69ac 4486 echo "INSTALL_BLOBS=yes" >> $config_host_mak
77755340 4487fi
bf9298b9 4488if test "$iovec" = "yes" ; then
2358a494 4489 echo "CONFIG_IOVEC=y" >> $config_host_mak
bf9298b9 4490fi
ceb42de8 4491if test "$preadv" = "yes" ; then
2358a494 4492 echo "CONFIG_PREADV=y" >> $config_host_mak
ceb42de8 4493fi
f652e6af 4494if test "$fdt" = "yes" ; then
3f0855b1 4495 echo "CONFIG_FDT=y" >> $config_host_mak
f652e6af 4496fi
dcc38d1c
MT
4497if test "$signalfd" = "yes" ; then
4498 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
4499fi
9195b2c2
SW
4500if test "$tcg_interpreter" = "yes" ; then
4501 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
4502fi
5f6b9e8f
BS
4503if test "$fdatasync" = "yes" ; then
4504 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
4505fi
e78815a5
AF
4506if test "$madvise" = "yes" ; then
4507 echo "CONFIG_MADVISE=y" >> $config_host_mak
4508fi
4509if test "$posix_madvise" = "yes" ; then
4510 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
4511fi
1e9737da
RH
4512if test "$sigev_thread_id" = "yes" ; then
4513 echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
4514fi
97a847bc 4515
cd4ec0b4
GH
4516if test "$spice" = "yes" ; then
4517 echo "CONFIG_SPICE=y" >> $config_host_mak
4518fi
36707144 4519
111a38b0
RR
4520if test "$smartcard_nss" = "yes" ; then
4521 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
9d171bd9
MT
4522 echo "NSS_LIBS=$nss_libs" >> $config_host_mak
4523 echo "NSS_CFLAGS=$nss_cflags" >> $config_host_mak
111a38b0
RR
4524fi
4525
2b2325ff
GH
4526if test "$libusb" = "yes" ; then
4527 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
4528fi
4529
69354a83
HG
4530if test "$usb_redir" = "yes" ; then
4531 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
4532fi
4533
b1e5fff4
MW
4534if test "$glx" = "yes" ; then
4535 echo "CONFIG_GLX=y" >> $config_host_mak
2b6b7099 4536 echo "GLX_LIBS=$glx_libs" >> $config_host_mak
20ff075b
MW
4537fi
4538
607dacd0
QN
4539if test "$lzo" = "yes" ; then
4540 echo "CONFIG_LZO=y" >> $config_host_mak
4541fi
4542
4543if test "$snappy" = "yes" ; then
4544 echo "CONFIG_SNAPPY=y" >> $config_host_mak
4545fi
4546
c589b249 4547if test "$libiscsi" = "yes" ; then
d3399d7c 4548 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
219c2521
SW
4549 if test "$libiscsi_version" = "1.4.0"; then
4550 echo "CONFIG_LIBISCSI_1_4=y" >> $config_host_mak
4551 fi
6ebc91e5
FZ
4552 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
4553 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
c589b249
RS
4554fi
4555
6542aa9c
PL
4556if test "$libnfs" = "yes" ; then
4557 echo "CONFIG_LIBNFS=y" >> $config_host_mak
4558fi
4559
f794573e
EO
4560if test "$seccomp" = "yes"; then
4561 echo "CONFIG_SECCOMP=y" >> $config_host_mak
4562fi
4563
83fb7adf 4564# XXX: suppress that
7d3505c5 4565if [ "$bsd" = "yes" ] ; then
2358a494 4566 echo "CONFIG_BSD=y" >> $config_host_mak
7d3505c5
FB
4567fi
4568
20ff6c80
AL
4569if test "$zero_malloc" = "yes" ; then
4570 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
4571fi
3556c233
PB
4572if test "$qom_cast_debug" = "yes" ; then
4573 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
4574fi
f27aaf4b 4575if test "$rbd" = "yes" ; then
d3399d7c 4576 echo "CONFIG_RBD=m" >> $config_host_mak
6ebc91e5
FZ
4577 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
4578 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
d0e2fce5
AK
4579fi
4580
7c2acc70 4581echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
70c60c08
SH
4582if test "$coroutine_pool" = "yes" ; then
4583 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
4584else
4585 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
4586fi
20ff6c80 4587
d2042378
AK
4588if test "$open_by_handle_at" = "yes" ; then
4589 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
4590fi
4591
e06a765e
HPB
4592if test "$linux_magic_h" = "yes" ; then
4593 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
8ab1bf12
LC
4594fi
4595
cc6e3ca9
GH
4596if test "$pragma_diagnostic_available" = "yes" ; then
4597 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
06d71fa1
PM
4598fi
4599
3f4349dc
KW
4600if test "$valgrind_h" = "yes" ; then
4601 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
4602fi
4603
8ab1bf12
LC
4604if test "$has_environ" = "yes" ; then
4605 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
e06a765e
HPB
4606fi
4607
76a347e1
RH
4608if test "$cpuid_h" = "yes" ; then
4609 echo "CONFIG_CPUID_H=y" >> $config_host_mak
4610fi
4611
f540166b
RH
4612if test "$int128" = "yes" ; then
4613 echo "CONFIG_INT128=y" >> $config_host_mak
4614fi
4615
1e6e9aca
RH
4616if test "$getauxval" = "yes" ; then
4617 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
4618fi
4619
eb100396 4620if test "$glusterfs" = "yes" ; then
d3399d7c 4621 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
6ebc91e5
FZ
4622 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
4623 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
0c14fb47
BR
4624fi
4625
4626if test "$glusterfs_discard" = "yes" ; then
4627 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
eb100396 4628fi
e06a765e 4629
7c815372
BR
4630if test "$glusterfs_zerofill" = "yes" ; then
4631 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
4632fi
4633
0a12ec87 4634if test "$libssh2" = "yes" ; then
d3399d7c 4635 echo "CONFIG_LIBSSH2=m" >> $config_host_mak
6ebc91e5
FZ
4636 echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
4637 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
0a12ec87
RJ
4638fi
4639
95c6bff3
BC
4640if test "$quorum" = "yes" ; then
4641 echo "CONFIG_QUORUM=y" >> $config_host_mak
4642fi
4643
583f6e7b 4644if test "$virtio_blk_data_plane" = "yes" ; then
6e790746 4645 echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
583f6e7b
SH
4646fi
4647
4f18b782
JC
4648if test "$vhdx" = "yes" ; then
4649 echo "CONFIG_VHDX=y" >> $config_host_mak
4650fi
4651
68063649 4652# USB host support
b5613fdc
GH
4653if test "$libusb" = "yes"; then
4654 echo "HOST_USB=libusb legacy" >> $config_host_mak
4655else
98ec69ac 4656 echo "HOST_USB=stub" >> $config_host_mak
b5613fdc 4657fi
68063649 4658
3b8acc11
PB
4659# TPM passthrough support?
4660if test "$tpm" = "yes"; then
4661 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
4662 if test "$tpm_passthrough" = "yes"; then
4663 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
4664 fi
4665fi
4666
e4858974
LV
4667# use default implementation for tracing backend-specific routines
4668trace_default=yes
94a420b1 4669echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
6d8a764e
LV
4670if test "$trace_backend" = "nop"; then
4671 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
22890ab5 4672fi
9410b56c 4673if test "$trace_backend" = "simple"; then
6d8a764e 4674 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
e4858974 4675 trace_default=no
6d8a764e 4676 # Set the appropriate trace file.
953ffe0f 4677 trace_file="\"$trace_file-\" FMT_pid"
9410b56c 4678fi
6d8a764e
LV
4679if test "$trace_backend" = "stderr"; then
4680 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
9a82b6a5 4681 trace_default=no
6d8a764e
LV
4682fi
4683if test "$trace_backend" = "ust"; then
4684 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
4685fi
4686if test "$trace_backend" = "dtrace"; then
4687 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
4688 if test "$trace_backend_stap" = "yes" ; then
4689 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
4690 fi
c276b17d 4691fi
781e9545
ET
4692if test "$trace_backend" = "ftrace"; then
4693 if test "$linux" = "yes" ; then
4694 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
4695 trace_default=no
4696 else
21684af0 4697 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
781e9545
ET
4698 fi
4699fi
9410b56c 4700echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
e4858974
LV
4701if test "$trace_default" = "yes"; then
4702 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
4703fi
9410b56c 4704
2da776db
MH
4705if test "$rdma" = "yes" ; then
4706 echo "CONFIG_RDMA=y" >> $config_host_mak
4707fi
4708
5c312079
DDAG
4709# Hold two types of flag:
4710# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
4711# a thread we have a handle to
4712# CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
4713# platform
4714if test "$pthread_setname_np" = "yes" ; then
4715 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
4716 echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
4717fi
4718
5b5e3037
PB
4719if test "$tcg_interpreter" = "yes"; then
4720 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
4721elif test "$ARCH" = "sparc64" ; then
4722 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
4723elif test "$ARCH" = "s390x" ; then
4724 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
c72b26ec 4725elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
5b5e3037
PB
4726 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
4727else
4728 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
4729fi
4730QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
4731
98ec69ac 4732echo "TOOLS=$tools" >> $config_host_mak
98ec69ac 4733echo "ROMS=$roms" >> $config_host_mak
804edf29
JQ
4734echo "MAKE=$make" >> $config_host_mak
4735echo "INSTALL=$install" >> $config_host_mak
1901cb14
BS
4736echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
4737echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
21655882
PB
4738if test -n "$libtool"; then
4739 echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
4740 echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
4741else
4742 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
4743 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
4744fi
c886edfb 4745echo "PYTHON=$python" >> $config_host_mak
804edf29 4746echo "CC=$cc" >> $config_host_mak
a31a8642
MT
4747if $iasl -h > /dev/null 2>&1; then
4748 echo "IASL=$iasl" >> $config_host_mak
4749fi
2b2e59e6 4750echo "CC_I386=$cc_i386" >> $config_host_mak
804edf29 4751echo "HOST_CC=$host_cc" >> $config_host_mak
83f73fce 4752echo "CXX=$cxx" >> $config_host_mak
3c4a4d0d 4753echo "OBJCC=$objcc" >> $config_host_mak
804edf29 4754echo "AR=$ar" >> $config_host_mak
45d285ab 4755echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
3dd46c78
BS
4756echo "AS=$as" >> $config_host_mak
4757echo "CPP=$cpp" >> $config_host_mak
804edf29
JQ
4758echo "OBJCOPY=$objcopy" >> $config_host_mak
4759echo "LD=$ld" >> $config_host_mak
9fe6de94 4760echo "WINDRES=$windres" >> $config_host_mak
44dc0ca3 4761echo "LIBTOOL=$libtool" >> $config_host_mak
e2a2ed06 4762echo "CFLAGS=$CFLAGS" >> $config_host_mak
46eef33b 4763echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
a558ee17 4764echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
f9728943 4765echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
e39f0062
PB
4766if test "$sparse" = "yes" ; then
4767 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
4768 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
4769 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
4770fi
42da6041
GH
4771if test "$cross_prefix" != ""; then
4772 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
4773else
4774 echo "AUTOCONF_HOST := " >> $config_host_mak
4775fi
e2a2ed06 4776echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
46eef33b 4777echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
37746c5e 4778echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
73da375e 4779echo "LIBS+=$LIBS" >> $config_host_mak
3e2e0e6b 4780echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
804edf29 4781echo "EXESUF=$EXESUF" >> $config_host_mak
17969268
FZ
4782echo "DSOSUF=$DSOSUF" >> $config_host_mak
4783echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
957f1f99 4784echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
94dd53c5 4785echo "POD2MAN=$POD2MAN" >> $config_host_mak
cbdd1999 4786echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
1d728c39
BS
4787if test "$gcov" = "yes" ; then
4788 echo "CONFIG_GCOV=y" >> $config_host_mak
4789 echo "GCOV=$gcov_tool" >> $config_host_mak
4790fi
804edf29 4791
6efd7517
PM
4792# use included Linux headers
4793if test "$linux" = "yes" ; then
a307beb6 4794 mkdir -p linux-headers
6efd7517 4795 case "$cpu" in
c72b26ec 4796 i386|x86_64|x32)
08312a63 4797 linux_arch=x86
6efd7517
PM
4798 ;;
4799 ppcemb|ppc|ppc64)
08312a63 4800 linux_arch=powerpc
6efd7517
PM
4801 ;;
4802 s390x)
08312a63
PM
4803 linux_arch=s390
4804 ;;
1f080313
CF
4805 aarch64)
4806 linux_arch=arm64
4807 ;;
08312a63
PM
4808 *)
4809 # For most CPUs the kernel architecture name and QEMU CPU name match.
4810 linux_arch="$cpu"
6efd7517
PM
4811 ;;
4812 esac
08312a63
PM
4813 # For non-KVM architectures we will not have asm headers
4814 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
4815 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
4816 fi
6efd7517
PM
4817fi
4818
1d14ffa9 4819for target in $target_list; do
97a847bc 4820target_dir="$target"
25be210f 4821config_target_mak=$target_dir/config-target.mak
c1799a84 4822target_name=`echo $target | cut -d '-' -f 1`
97a847bc 4823target_bigendian="no"
1f3d3c8f 4824
c1799a84 4825case "$target_name" in
d15a9c23 4826 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
ea2d6a39
JQ
4827 target_bigendian=yes
4828 ;;
4829esac
97a847bc 4830target_softmmu="no"
997344f3 4831target_user_only="no"
831b7825 4832target_linux_user="no"
84778508 4833target_bsd_user="no"
9e407a85 4834case "$target" in
c1799a84 4835 ${target_name}-softmmu)
9e407a85
PB
4836 target_softmmu="yes"
4837 ;;
c1799a84 4838 ${target_name}-linux-user)
9c7a4202 4839 if test "$linux" != "yes" ; then
76ad07a4 4840 error_exit "Target '$target' is only available on a Linux host"
9c7a4202 4841 fi
9e407a85
PB
4842 target_user_only="yes"
4843 target_linux_user="yes"
4844 ;;
c1799a84 4845 ${target_name}-bsd-user)
9cf55765 4846 if test "$bsd" != "yes" ; then
76ad07a4 4847 error_exit "Target '$target' is only available on a BSD host"
9c7a4202 4848 fi
84778508
BS
4849 target_user_only="yes"
4850 target_bsd_user="yes"
4851 ;;
9e407a85 4852 *)
76ad07a4 4853 error_exit "Target '$target' not recognised"
9e407a85
PB
4854 exit 1
4855 ;;
4856esac
831b7825 4857
97a847bc 4858mkdir -p $target_dir
25be210f 4859echo "# Automatically generated by configure - do not modify" > $config_target_mak
de83cd02 4860
e5fe0c52 4861bflt="no"
c1799a84 4862interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
56aebc89 4863gdb_xml_files=""
7ba1e619 4864
c1799a84 4865TARGET_ARCH="$target_name"
6acff7da 4866TARGET_BASE_ARCH=""
e6e91b9c 4867TARGET_ABI_DIR=""
e73aae67 4868
c1799a84 4869case "$target_name" in
2408a527 4870 i386)
2408a527
AJ
4871 ;;
4872 x86_64)
6acff7da 4873 TARGET_BASE_ARCH=i386
2408a527
AJ
4874 ;;
4875 alpha)
2408a527
AJ
4876 ;;
4877 arm|armeb)
b498c8a0 4878 TARGET_ARCH=arm
2408a527 4879 bflt="yes"
56aebc89 4880 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2408a527 4881 ;;
6a49fa95
AG
4882 aarch64)
4883 TARGET_BASE_ARCH=arm
4884 bflt="yes"
6a669427 4885 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml"
6a49fa95 4886 ;;
2408a527 4887 cris)
2408a527 4888 ;;
613a22c9 4889 lm32)
613a22c9 4890 ;;
2408a527 4891 m68k)
2408a527 4892 bflt="yes"
56aebc89 4893 gdb_xml_files="cf-core.xml cf-fp.xml"
2408a527 4894 ;;
877fdc12
EI
4895 microblaze|microblazeel)
4896 TARGET_ARCH=microblaze
72b675ca 4897 bflt="yes"
72b675ca 4898 ;;
0adcffb1 4899 mips|mipsel)
b498c8a0 4900 TARGET_ARCH=mips
25be210f 4901 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
2408a527
AJ
4902 ;;
4903 mipsn32|mipsn32el)
597e2cec 4904 TARGET_ARCH=mips64
6acff7da 4905 TARGET_BASE_ARCH=mips
25be210f 4906 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
597e2cec 4907 echo "TARGET_ABI32=y" >> $config_target_mak
2408a527
AJ
4908 ;;
4909 mips64|mips64el)
b498c8a0 4910 TARGET_ARCH=mips64
6acff7da 4911 TARGET_BASE_ARCH=mips
25be210f 4912 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
2408a527 4913 ;;
d15a9c23
AG
4914 moxie)
4915 ;;
e67db06e
JL
4916 or32)
4917 TARGET_ARCH=openrisc
4918 TARGET_BASE_ARCH=openrisc
e67db06e 4919 ;;
2408a527 4920 ppc)
c8b3532d 4921 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2408a527
AJ
4922 ;;
4923 ppcemb)
6acff7da 4924 TARGET_BASE_ARCH=ppc
e6e91b9c 4925 TARGET_ABI_DIR=ppc
c8b3532d 4926 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2408a527
AJ
4927 ;;
4928 ppc64)
6acff7da 4929 TARGET_BASE_ARCH=ppc
e6e91b9c 4930 TARGET_ABI_DIR=ppc
c8b3532d 4931 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2408a527
AJ
4932 ;;
4933 ppc64abi32)
b498c8a0 4934 TARGET_ARCH=ppc64
6acff7da 4935 TARGET_BASE_ARCH=ppc
e6e91b9c 4936 TARGET_ABI_DIR=ppc
25be210f 4937 echo "TARGET_ABI32=y" >> $config_target_mak
c8b3532d 4938 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2408a527
AJ
4939 ;;
4940 sh4|sh4eb)
b498c8a0 4941 TARGET_ARCH=sh4
2408a527
AJ
4942 bflt="yes"
4943 ;;
4944 sparc)
2408a527
AJ
4945 ;;
4946 sparc64)
6acff7da 4947 TARGET_BASE_ARCH=sparc
2408a527
AJ
4948 ;;
4949 sparc32plus)
b498c8a0 4950 TARGET_ARCH=sparc64
6acff7da 4951 TARGET_BASE_ARCH=sparc
e6e91b9c 4952 TARGET_ABI_DIR=sparc
25be210f 4953 echo "TARGET_ABI32=y" >> $config_target_mak
2408a527 4954 ;;
24e804ec 4955 s390x)
24e804ec 4956 ;;
d2fbca94 4957 unicore32)
d2fbca94 4958 ;;
cfa550c6
MF
4959 xtensa|xtensaeb)
4960 TARGET_ARCH=xtensa
cfa550c6 4961 ;;
2408a527 4962 *)
76ad07a4 4963 error_exit "Unsupported target CPU"
2408a527
AJ
4964 ;;
4965esac
5e8861a0
PB
4966# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
4967if [ "$TARGET_BASE_ARCH" = "" ]; then
4968 TARGET_BASE_ARCH=$TARGET_ARCH
4969fi
4970
5e8861a0
PB
4971symlink "$source_path/Makefile.target" "$target_dir/Makefile"
4972
99afc91d
DB
4973upper() {
4974 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
4975}
4976
99afc91d 4977target_arch_name="`upper $TARGET_ARCH`"
25be210f 4978echo "TARGET_$target_arch_name=y" >> $config_target_mak
c1799a84 4979echo "TARGET_NAME=$target_name" >> $config_target_mak
25be210f 4980echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
e6e91b9c
JQ
4981if [ "$TARGET_ABI_DIR" = "" ]; then
4982 TARGET_ABI_DIR=$TARGET_ARCH
4983fi
25be210f 4984echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
c1799a84 4985case "$target_name" in
1b0c87fc
JQ
4986 i386|x86_64)
4987 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
25be210f 4988 echo "CONFIG_XEN=y" >> $config_target_mak
eb6fda0f
AP
4989 if test "$xen_pci_passthrough" = yes; then
4990 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4991 fi
1b0c87fc 4992 fi
59d21e53
AG
4993 ;;
4994 *)
1b0c87fc 4995esac
c1799a84 4996case "$target_name" in
70a5f682 4997 aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
c59249f9
JQ
4998 # Make sure the target and host cpus are compatible
4999 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
c1799a84
PB
5000 \( "$target_name" = "$cpu" -o \
5001 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
5002 \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
5003 \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
5004 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
5005 \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
5006 \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then
25be210f 5007 echo "CONFIG_KVM=y" >> $config_target_mak
1ba16968 5008 if test "$vhost_net" = "yes" ; then
d5970055
MT
5009 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
5010 fi
c59249f9
JQ
5011 fi
5012esac
de83cd02 5013if test "$target_bigendian" = "yes" ; then
25be210f 5014 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
de83cd02 5015fi
97a847bc 5016if test "$target_softmmu" = "yes" ; then
25be210f 5017 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
43ce4dfe 5018fi
997344f3 5019if test "$target_user_only" = "yes" ; then
25be210f 5020 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
a2c80be9 5021 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
997344f3 5022fi
831b7825 5023if test "$target_linux_user" = "yes" ; then
25be210f 5024 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
831b7825 5025fi
56aebc89
PB
5026list=""
5027if test ! -z "$gdb_xml_files" ; then
5028 for x in $gdb_xml_files; do
5029 list="$list $source_path/gdb-xml/$x"
5030 done
3d0f1517 5031 echo "TARGET_XML_FILES=$list" >> $config_target_mak
56aebc89 5032fi
97a847bc 5033
e5fe0c52 5034if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
25be210f 5035 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
e5fe0c52 5036fi
379f6698 5037if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
25be210f 5038 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
379f6698 5039fi
84778508 5040if test "$target_bsd_user" = "yes" ; then
25be210f 5041 echo "CONFIG_BSD_USER=y" >> $config_target_mak
84778508 5042fi
5b0753e0 5043
4afddb55 5044# generate QEMU_CFLAGS/LDFLAGS for targets
fa282484 5045
4afddb55 5046cflags=""
fa282484 5047ldflags=""
9b8e111f 5048
64656024
JQ
5049for i in $ARCH $TARGET_BASE_ARCH ; do
5050 case "$i" in
5051 alpha)
25be210f 5052 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
76cad711 5053 echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak
64656024 5054 ;;
82295d8a
RH
5055 aarch64)
5056 if test -n "${cxx}"; then
5057 echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
5058 echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
5059 fi
5060 ;;
64656024 5061 arm)
25be210f 5062 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
76cad711 5063 echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak
999b53ec
CF
5064 if test -n "${cxx}"; then
5065 echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
5066 echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
5067 fi
64656024
JQ
5068 ;;
5069 cris)
25be210f 5070 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
76cad711 5071 echo "CONFIG_CRIS_DIS=y" >> config-all-disas.mak
64656024
JQ
5072 ;;
5073 hppa)
25be210f 5074 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
76cad711 5075 echo "CONFIG_HPPA_DIS=y" >> config-all-disas.mak
64656024 5076 ;;
c72b26ec 5077 i386|x86_64|x32)
25be210f 5078 echo "CONFIG_I386_DIS=y" >> $config_target_mak
76cad711 5079 echo "CONFIG_I386_DIS=y" >> config-all-disas.mak
64656024 5080 ;;
903ec55c
AJ
5081 ia64*)
5082 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
76cad711 5083 echo "CONFIG_IA64_DIS=y" >> config-all-disas.mak
903ec55c 5084 ;;
79368f49
MW
5085 lm32)
5086 echo "CONFIG_LM32_DIS=y" >> $config_target_mak
76cad711 5087 echo "CONFIG_LM32_DIS=y" >> config-all-disas.mak
79368f49 5088 ;;
64656024 5089 m68k)
25be210f 5090 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
76cad711 5091 echo "CONFIG_M68K_DIS=y" >> config-all-disas.mak
64656024 5092 ;;
877fdc12 5093 microblaze*)
25be210f 5094 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
76cad711 5095 echo "CONFIG_MICROBLAZE_DIS=y" >> config-all-disas.mak
64656024
JQ
5096 ;;
5097 mips*)
25be210f 5098 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
76cad711 5099 echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak
64656024 5100 ;;
d15a9c23
AG
5101 moxie*)
5102 echo "CONFIG_MOXIE_DIS=y" >> $config_target_mak
5103 echo "CONFIG_MOXIE_DIS=y" >> config-all-disas.mak
5104 ;;
e67db06e
JL
5105 or32)
5106 echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak
76cad711 5107 echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak
e67db06e 5108 ;;
64656024 5109 ppc*)
25be210f 5110 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
76cad711 5111 echo "CONFIG_PPC_DIS=y" >> config-all-disas.mak
64656024 5112 ;;
24e804ec 5113 s390*)
25be210f 5114 echo "CONFIG_S390_DIS=y" >> $config_target_mak
76cad711 5115 echo "CONFIG_S390_DIS=y" >> config-all-disas.mak
64656024
JQ
5116 ;;
5117 sh4)
25be210f 5118 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
76cad711 5119 echo "CONFIG_SH4_DIS=y" >> config-all-disas.mak
64656024
JQ
5120 ;;
5121 sparc*)
25be210f 5122 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
76cad711 5123 echo "CONFIG_SPARC_DIS=y" >> config-all-disas.mak
64656024 5124 ;;
cfa550c6
MF
5125 xtensa*)
5126 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
76cad711 5127 echo "CONFIG_XTENSA_DIS=y" >> config-all-disas.mak
cfa550c6 5128 ;;
64656024
JQ
5129 esac
5130done
9195b2c2
SW
5131if test "$tcg_interpreter" = "yes" ; then
5132 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
76cad711 5133 echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak
9195b2c2 5134fi
64656024 5135
6ee7126f
JQ
5136case "$ARCH" in
5137alpha)
5138 # Ensure there's only a single GP
5139 cflags="-msmall-data $cflags"
5140;;
5141esac
5142
d02c1db3 5143if test "$gprof" = "yes" ; then
25be210f 5144 echo "TARGET_GPROF=yes" >> $config_target_mak
d02c1db3
JQ
5145 if test "$target_linux_user" = "yes" ; then
5146 cflags="-p $cflags"
5147 ldflags="-p $ldflags"
5148 fi
5149 if test "$target_softmmu" = "yes" ; then
5150 ldflags="-p $ldflags"
25be210f 5151 echo "GPROF_CFLAGS=-p" >> $config_target_mak
d02c1db3
JQ
5152 fi
5153fi
5154
9b8e111f 5155if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
964c6fa1 5156 ldflags="$ldflags $textseg_ldflags"
fa282484 5157fi
fa282484 5158
25be210f
JQ
5159echo "LDFLAGS+=$ldflags" >> $config_target_mak
5160echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
fa282484 5161
97a847bc 5162done # for target in $targets
7d13299d 5163
b776eca1
GH
5164if [ "$pixman" = "internal" ]; then
5165 echo "config-host.h: subdir-pixman" >> $config_host_mak
5166fi
5167
2da776db
MH
5168if test "$rdma" = "yes" ; then
5169echo "CONFIG_RDMA=y" >> $config_host_mak
5170fi
5171
a540f158
PC
5172if [ "$dtc_internal" = "yes" ]; then
5173 echo "config-host.h: subdir-dtc" >> $config_host_mak
5174fi
5175
d1807a4f 5176# build tree in object directory in case the source is not in the current directory
f93296ea 5177DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
2b170eff 5178DIRS="$DIRS fsdev"
9933c305 5179DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
d1807a4f 5180DIRS="$DIRS roms/seabios roms/vgabios"
2dee8d54 5181DIRS="$DIRS qapi-generated"
c09015dd
AL
5182FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
5183FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
aaa2ebc5 5184FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
d1807a4f 5185FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
446b9165 5186FILES="$FILES pc-bios/spapr-rtas/Makefile"
9933c305 5187FILES="$FILES pc-bios/s390-ccw/Makefile"
d1807a4f 5188FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
4652b792 5189FILES="$FILES pc-bios/qemu-icon.bmp"
753d11f2
RH
5190for bios_file in \
5191 $source_path/pc-bios/*.bin \
5acc2ec0 5192 $source_path/pc-bios/*.aml \
753d11f2
RH
5193 $source_path/pc-bios/*.rom \
5194 $source_path/pc-bios/*.dtb \
e89e33e1 5195 $source_path/pc-bios/*.img \
753d11f2
RH
5196 $source_path/pc-bios/openbios-* \
5197 $source_path/pc-bios/palcode-*
5198do
d1807a4f
PB
5199 FILES="$FILES pc-bios/`basename $bios_file`"
5200done
c2304b52
MA
5201for test_file in `find $source_path/tests/acpi-test-data -type f`
5202do
5203 FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`"
5204done
d1807a4f
PB
5205mkdir -p $DIRS
5206for f in $FILES ; do
cab00a5a 5207 if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
f9245e10
PM
5208 symlink "$source_path/$f" "$f"
5209 fi
d1807a4f 5210done
1ad2134f 5211
c34ebfdc 5212# temporary config to build submodules
2d9f27d2 5213for rom in seabios vgabios ; do
c34ebfdc 5214 config_mak=roms/$rom/config.mak
37116c89 5215 echo "# Automatically generated by configure - do not modify" > $config_mak
c34ebfdc 5216 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3dd46c78 5217 echo "AS=$as" >> $config_mak
c34ebfdc
AL
5218 echo "CC=$cc" >> $config_mak
5219 echo "BCC=bcc" >> $config_mak
3dd46c78 5220 echo "CPP=$cpp" >> $config_mak
c34ebfdc 5221 echo "OBJCOPY=objcopy" >> $config_mak
a31a8642 5222 echo "IASL=$iasl" >> $config_mak
c34ebfdc
AL
5223 echo "LD=$ld" >> $config_mak
5224done
5225
b40292e7
JK
5226if test "$docs" = "yes" ; then
5227 mkdir -p QMP
5228fi
dc655404
MT
5229
5230# Save the configure command line for later reuse.
5231cat <<EOD >config.status
5232#!/bin/sh
5233# Generated by configure.
5234# Run this file to recreate the current configuration.
5235# Compiler output produced by configure, useful for debugging
5236# configure, is in config.log if it exists.
5237EOD
5238printf "exec" >>config.status
5239printf " '%s'" "$0" "$@" >>config.status
5240echo >>config.status
5241chmod +x config.status
5242
8cd05ab6 5243rm -r "$TMPDIR1"