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