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