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