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